diff --git a/LICENSE b/LICENSE index 44e2ee0..97d53d9 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020-present, Elta Solutions. +Copyright (c) 2023-present, Dojah Technology Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 1fee568..3eda1ff 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@ # react-native-dojah -> https://github.com/cjayprime/react-native-dojah +> https://github.com/YemmyFolayan/react-native-dojah -[![NPM](https://img.shields.io/npm/v/react-native-dojah.svg)](https://www.npmjs.com/package/react-native-dojah) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) +[![NPM](https://img.shields.io/npm/v/react-native-dojah.svg)](https://www.npmjs.com/package/react-native-dojah-sdk) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) ## Install ```sh -npm install react-native-dojah --save +npm install react-native-dojah-sdk --save ``` or with `yarn` ```sh -yarn add react-native-dojah +yarn add react-native-dojah-sdk ``` Required Packages @@ -53,8 +53,8 @@ pod 'react-native-geolocation-service', path: '../node_modules/react-native-geol ## Usage ```jsx -import React from 'react' -import Dojah from 'react-native-dojah' +import React, {useEffect} from 'react'; +import Dojah from 'react-native-dojah-sdk'; const App = () => { /** @@ -63,7 +63,7 @@ const App = () => { * https://dojah.io/dashboard * to create an app and retrieve it) */ - const appID = '6000604fb87ea60035ef41bb'; + const appID = ''; /** * This is your account public key @@ -71,7 +71,7 @@ const App = () => { * https://dojah.io/dashboard to * retrieve it. You can also regenerate one) */ - const publicKey = 'test_pk_TO6a57RT0v5QyhZmhbuLG8nZI'; + const publicKey = ''; /** * This is the widget type you'd like to load @@ -79,12 +79,12 @@ const App = () => { * https://dojah.io/dashboard to enable different * widget types) */ - const type = 'liveness'; + const type = 'custom'; /** * These are the configuration options * available to you are: - * {debug: BOOL, pages: ARRAY[{page: STRING, config: OBJECT}]} + * {debug: BOOL, pages: ARRAY[page: STRING, config: OBJECT]} * * The config object is as defined below * @@ -92,24 +92,8 @@ const App = () => { * available to the `verification` widget */ const config = { - debug: true, - pages: [ - {page: 'phone-number', config: {verification: false}}, - {page: 'address'}, - { - page: 'government-data', - config: { - bvn: true, - nin: false, - dl: false, - mobile: false, - otp: false, - selfie: false, - }, - }, - {page: 'selfie'}, - {page: 'id', config: {passport: false, dl: true}}, - ], + widget_id: '', + pages: [], }; /** @@ -134,6 +118,13 @@ const App = () => { user_id: '121', }; + + const govData = { + bvn: "", + nin: "", + dl: "", + mobile: "" + }; /** * @param {String} responseType * This method receives the type @@ -143,7 +134,7 @@ const App = () => { * This is the data from doja */ const response = (responseType, data) => { - console.log(responseType, data); + console.log('Response:', responseType, JSON.stringify(data)); if (responseType === 'success') { } else if (responseType === 'error') { } else if (responseType === 'close') { @@ -170,23 +161,28 @@ const App = () => { */ const innerContainerStyle = {}; - // The Doja library accepts 3 props and - // initiliazes the doja widget and connect process + useEffect(() => { + Dojah.hydrate(appID, publicKey); + }, [appID, publicKey]); + return ( ); -} +}; -export default App +export default App; ``` diff --git a/example/App.js b/example/App.js index f3b80c1..70b50cb 100644 --- a/example/App.js +++ b/example/App.js @@ -8,7 +8,7 @@ const App = () => { * https://dojah.io/dashboard * to create an app and retrieve it) */ - const appID = '6000604fb87ea60035ef41bb'; + const appID = ''; /** * This is your account public key @@ -16,7 +16,7 @@ const App = () => { * https://dojah.io/dashboard to * retrieve it. You can also regenerate one) */ - const publicKey = 'prod_pk_7jspvKP2FMkjkSZx1qnbgiMWy'; + const publicKey = ''; /** * This is the widget type you'd like to load @@ -24,7 +24,7 @@ const App = () => { * https://dojah.io/dashboard to enable different * widget types) */ - const type = 'liveness'; + const type = 'custom'; /** * These are the configuration options @@ -37,23 +37,8 @@ const App = () => { * available to the `verification` widget */ const config = { - debug: true, - pages: [ - {page: 'address'}, - { - page: 'government-data', - config: { - bvn: true, - nin: false, - dl: false, - mobile: false, - otp: false, - selfie: false, - }, - }, - {page: 'selfie'}, - {page: 'id', config: {passport: false, dl: true}}, - ], + widget_id: '', + pages: [], }; /** @@ -78,6 +63,13 @@ const App = () => { user_id: '121', }; + + const govData = { + bvn: "", + nin: "", + dl: "", + mobile: "" + }; /** * @param {String} responseType * This method receives the type @@ -124,6 +116,7 @@ const App = () => { publicKey={publicKey} type={type} userData={userData} + govData={govData} metadata={metadata} config={config} response={response} diff --git a/example/package.json b/example/package.json index 26d4efa..07ccbf2 100644 --- a/example/package.json +++ b/example/package.json @@ -1,6 +1,6 @@ { "name": "dojah", - "version": "0.0.1", + "version": "1.0.0", "private": true, "scripts": { "android": "react-native run-android", @@ -12,7 +12,7 @@ "dependencies": { "react": "16.13.1", "react-native": "0.63.3", - "react-native-dojah": "^0.3.2", + "react-native-dojah-sdk": "^0.0.1", "react-native-permissions": "^3.2.0", "react-native-webview": "^10.8.2", "@react-native-async-storage/async-storage": "^1.17.3", diff --git a/lib/Dojah.js b/lib/Dojah.js index 8c8eada..2cb5ff6 100644 --- a/lib/Dojah.js +++ b/lib/Dojah.js @@ -33,6 +33,8 @@ import AsyncStorage from '@react-native-async-storage/async-storage'; * `last_name` for the last name and `dob` for the date of birth * @param {Object} metadata Pass in any data you choose to tag the response when passed to you, this will be * returned to you in the `kyc_widget` webhook or passed as a parameter to the onSuccess function + * @param {Object} govData Pass in the following keys: `nin` for the National Identification Number, + * `bvn`, 'mobile', 'dl'. * @param {StyleProp} outerContainerStyle The style of the outermost view * @param {StyleProp} outerContainerStyle The style of the outermost view * @param {StyleProp} style The style of the middle view @@ -56,6 +58,7 @@ const Dojah = ({ response, config, userData, + govData, metadata, outerContainerStyle, style, @@ -334,6 +337,7 @@ const Dojah = ({ type, config, userData, + govData, metadata, location, )} @@ -414,6 +418,7 @@ Dojah.config = { type, config, userData, + govData, metadata, location, ) { @@ -424,6 +429,7 @@ Dojah.config = { type: "${type}", config: ${config ? JSON.stringify(config) : null}, user_data: ${userData ? JSON.stringify(userData) : null}, + gov_data: ${govData ? JSON.stringify(govData) : null}, metadata: ${metadata ? JSON.stringify(metadata) : null}, __location: ${location ? JSON.stringify(location) : null}, onSuccess: function (response) { diff --git a/package.json b/package.json index 86e4875..8262a90 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { - "name": "react-native-dojah", - "version": "0.3.2", + "name": "react-native-dojah-sdk", + "version": "0.0.1", "main": "lib/index.js", "repository": { "type": "git", - "url": "git+https://github.com/cjayprime/react-native-dojah.git" + "url": "git+https://github.com/YemmyFolayan/react-native-dojah.git" }, "bugs": { - "url": "https://github.com/cjayprime/react-native-dojah/issues" + "url": "https://github.com/YemmyFolayan/react-native-dojah/issues" }, - "homepage": "https://github.com/cjayprime/react-native-dojah#readme", + "homepage": "https://github.com/YemmyFolayan/react-native-dojah#readme", "engines": { "node": ">=10" },