dojah-kyc-sdk-react 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2020-present, Elta Solutions.
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2020-present, Elta Solutions.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,151 +1,151 @@
1
- # dojah-kyc-sdk-react
2
-
3
- > https://github.com/dojah-inc/React-Js-sdk
4
-
5
- [![NPM](https://img.shields.io/npm/v/react-dojah.svg)](https://www.npmjs.com/package/dojah-kyc-sdk-react) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6
-
7
-
8
- ## Install
9
-
10
- ```sh
11
- npm install dojah-kyc-sdk-react --save
12
- ```
13
-
14
- or with `yarn`
15
-
16
- ```sh
17
- yarn add dojah-kyc-sdk-react
18
- ```
19
-
20
- ## Usage
21
-
22
- ```jsx
23
- import React from 'react'
24
- import Dojah from 'dojah-kyc-sdk-react'
25
-
26
- const App = () => {
27
- /**
28
- * This is your app ID
29
- * (go to your dashboard at
30
- * https://dojah.io/dashboard
31
- * to create an app and retrieve it)
32
- */
33
- const appID = "";
34
-
35
- /**
36
- * This is your account public key
37
- * (go to your dashboard at
38
- * https://dojah.io/dashboard to
39
- * retrieve it. You can also regenerate one)
40
- */
41
- const publicKey = "";
42
-
43
- /**
44
- * This is the widget type you'd like to load
45
- * (go to your dashboard at
46
- * https://dojah.io/dashboard to enable different
47
- * widget types)
48
- */
49
- const type = "custom";
50
-
51
- /**
52
- * These are the configuration options
53
- * available to you are:
54
- * {debug: BOOL, pages: ARRAY[page: STRING, config: OBJECT]}
55
- *
56
- * The config object is as defined below
57
- *
58
- * NOTE: The otp and selfie options are only
59
- * available to the `verification` widget
60
- */
61
- const config = {
62
- widget_id: ""
63
- };
64
-
65
- /**
66
- * These are the user's data to verify, options
67
- * available to you possible options are:
68
- * {first_name: STRING, last_name: STRING, dob: DATE STRING}
69
- *
70
- * NOTE: Passing all the values will automatically skip
71
- * the user-data page (thus the commented out `last_name`)
72
- */
73
- const userData = {
74
- first_name: 'Chijioke',
75
- last_name: '', // 'Nna'
76
- dob: '2022-05-01',
77
- };
78
-
79
- /**
80
- * These are the metadata options
81
- * You can pass any values within the object
82
- */
83
- const metadata = {
84
- user_id: '121',
85
- };
86
-
87
- const govData = {
88
- bvn: "",
89
- nin: "",
90
- dl: "",
91
- mobile: ""
92
- }
93
-
94
- const referenceId = "1234555666" //Unique reference Id
95
-
96
- /**
97
- * @param {String} type
98
- * This method receives the type
99
- * The type can only be one of:
100
- * loading, begin, success, error, close
101
- * @param {String} data
102
- * This is the data from doja
103
- */
104
- const response = (type, data) => {
105
- console.log(type, data);
106
- if (type === 'success') {
107
- } else if (type === 'error') {
108
- } else if (type === 'close') {
109
- } else if (type === 'begin') {
110
- } else if (type === 'loading') {
111
- }
112
- }
113
-
114
- // The Doja library accepts 3 props and
115
- // initiliazes the doja widget and connect process
116
- return (
117
- <Dojah
118
- response={response}
119
- appID={appID}
120
- publicKey={publicKey}
121
- type={type}
122
- config={config}
123
- userData={userData}
124
- metadata={metadata}
125
- govData={govData}
126
- referenceId = {referenceId}
127
- />
128
- );
129
- }
130
-
131
- export default App
132
-
133
- ```
134
-
135
- See the `examples` folder for an implementation
136
-
137
- ## Deployment
138
-
139
- **`REMEMBER TO CHANGE THE APP ID and PUBLIC KEY WHEN DEPLOYING TO A LIVE (PRODUCTION) ENVIRONMENT`**
140
-
141
- ## Contributing
142
-
143
- 1. Fork it!
144
- 2. Create your feature branch: `git checkout -b feature/feature-name`
145
- 3. Commit your changes: `git commit -am 'Some commit message'`
146
- 4. Push to the branch: `git push origin feature/feature-name`
147
- 5. Submit a pull request 😉😉
148
-
149
- ## License
150
-
151
- This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
1
+ # dojah-kyc-sdk-react
2
+
3
+ > https://github.com/dojah-inc/React-Js-sdk
4
+
5
+ [![NPM](https://img.shields.io/npm/v/react-dojah.svg)](https://www.npmjs.com/package/dojah-kyc-sdk-react) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
6
+
7
+
8
+ ## Install
9
+
10
+ ```sh
11
+ npm install dojah-kyc-sdk-react --save
12
+ ```
13
+
14
+ or with `yarn`
15
+
16
+ ```sh
17
+ yarn add dojah-kyc-sdk-react
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```jsx
23
+ import React from 'react'
24
+ import Dojah from 'dojah-kyc-sdk-react'
25
+
26
+ const App = () => {
27
+ /**
28
+ * This is your app ID
29
+ * (go to your dashboard at
30
+ * https://dojah.io/dashboard
31
+ * to create an app and retrieve it)
32
+ */
33
+ const appID = "";
34
+
35
+ /**
36
+ * This is your account public key
37
+ * (go to your dashboard at
38
+ * https://dojah.io/dashboard to
39
+ * retrieve it. You can also regenerate one)
40
+ */
41
+ const publicKey = "";
42
+
43
+ /**
44
+ * This is the widget type you'd like to load
45
+ * (go to your dashboard at
46
+ * https://dojah.io/dashboard to enable different
47
+ * widget types)
48
+ */
49
+ const type = "custom";
50
+
51
+ /**
52
+ * These are the configuration options
53
+ * available to you are:
54
+ * {debug: BOOL, pages: ARRAY[page: STRING, config: OBJECT]}
55
+ *
56
+ * The config object is as defined below
57
+ *
58
+ * NOTE: The otp and selfie options are only
59
+ * available to the `verification` widget
60
+ */
61
+ const config = {
62
+ widget_id: ""
63
+ };
64
+
65
+ /**
66
+ * These are the user's data to verify, options
67
+ * available to you possible options are:
68
+ * {first_name: STRING, last_name: STRING, dob: DATE STRING}
69
+ *
70
+ * NOTE: Passing all the values will automatically skip
71
+ * the user-data page (thus the commented out `last_name`)
72
+ */
73
+ const userData = {
74
+ first_name: 'Chijioke',
75
+ last_name: '', // 'Nna'
76
+ dob: '2022-05-01',
77
+ };
78
+
79
+ /**
80
+ * These are the metadata options
81
+ * You can pass any values within the object
82
+ */
83
+ const metadata = {
84
+ user_id: '121',
85
+ };
86
+
87
+ const govData = {
88
+ bvn: "",
89
+ nin: "",
90
+ dl: "",
91
+ mobile: ""
92
+ }
93
+
94
+ const referenceId = "1234555666" //Unique reference Id
95
+
96
+ /**
97
+ * @param {String} type
98
+ * This method receives the type
99
+ * The type can only be one of:
100
+ * loading, begin, success, error, close
101
+ * @param {String} data
102
+ * This is the data from doja
103
+ */
104
+ const response = (type, data) => {
105
+ console.log(type, data);
106
+ if (type === 'success') {
107
+ } else if (type === 'error') {
108
+ } else if (type === 'close') {
109
+ } else if (type === 'begin') {
110
+ } else if (type === 'loading') {
111
+ }
112
+ }
113
+
114
+ // The Doja library accepts 3 props and
115
+ // initiliazes the doja widget and connect process
116
+ return (
117
+ <Dojah
118
+ response={response}
119
+ appID={appID}
120
+ publicKey={publicKey}
121
+ type={type}
122
+ config={config}
123
+ userData={userData}
124
+ metadata={metadata}
125
+ govData={govData}
126
+ referenceId = {referenceId}
127
+ />
128
+ );
129
+ }
130
+
131
+ export default App
132
+
133
+ ```
134
+
135
+ See the `examples` folder for an implementation
136
+
137
+ ## Deployment
138
+
139
+ **`REMEMBER TO CHANGE THE APP ID and PUBLIC KEY WHEN DEPLOYING TO A LIVE (PRODUCTION) ENVIRONMENT`**
140
+
141
+ ## Contributing
142
+
143
+ 1. Fork it!
144
+ 2. Create your feature branch: `git checkout -b feature/feature-name`
145
+ 3. Commit your changes: `git commit -am 'Some commit message'`
146
+ 4. Push to the branch: `git push origin feature/feature-name`
147
+ 5. Submit a pull request 😉😉
148
+
149
+ ## License
150
+
151
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
package/dist/index.js CHANGED
@@ -1128,8 +1128,10 @@ var Dojah = /*#__PURE__*/function (_Component) {
1128
1128
  response('error');
1129
1129
  };
1130
1130
  _this.start = function () {
1131
- var response = _this.props.response;
1132
- var uri = Dojah.config.uri;
1131
+ var _this$props = _this.props,
1132
+ response = _this$props.response,
1133
+ env = _this$props.env;
1134
+ var uri = env === 'development' ? 'https://dev-widget.dojah.services/widget.js' : Dojah.config.uri;
1133
1135
  if (window.dojah && window.dojah.uri) {
1134
1136
  uri = window.dojah.uri;
1135
1137
  }
@@ -1147,16 +1149,16 @@ var Dojah = /*#__PURE__*/function (_Component) {
1147
1149
  _this.script.removeEventListener('error', _this.error);
1148
1150
  };
1149
1151
  _this.open = function () {
1150
- var _this$props = _this.props,
1151
- appID = _this$props.appID,
1152
- publicKey = _this$props.publicKey,
1153
- type = _this$props.type,
1154
- response = _this$props.response,
1155
- config = _this$props.config,
1156
- metadata = _this$props.metadata,
1157
- userData = _this$props.userData,
1158
- govData = _this$props.govData,
1159
- referenceId = _this$props.referenceId;
1152
+ var _this$props2 = _this.props,
1153
+ appID = _this$props2.appID,
1154
+ publicKey = _this$props2.publicKey,
1155
+ type = _this$props2.type,
1156
+ response = _this$props2.response,
1157
+ config = _this$props2.config,
1158
+ metadata = _this$props2.metadata,
1159
+ userData = _this$props2.userData,
1160
+ govData = _this$props2.govData,
1161
+ referenceId = _this$props2.referenceId;
1160
1162
  var options = {
1161
1163
  app_id: appID,
1162
1164
  p_key: publicKey,
@@ -1215,7 +1217,8 @@ Dojah.propTypes = {
1215
1217
  appID: propTypes.string.isRequired,
1216
1218
  publicKey: propTypes.string.isRequired,
1217
1219
  type: propTypes.string.isRequired,
1218
- response: propTypes.func.isRequired
1220
+ response: propTypes.func.isRequired,
1221
+ env: propTypes.string
1219
1222
  };
1220
1223
 
1221
1224
  module.exports = Dojah;