dojah-kyc-sdk-react 0.0.1

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 ADDED
@@ -0,0 +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.
package/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # react-dojah
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/react-dojah-sdk) [![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 react-dojah-sdk --save
12
+ ```
13
+
14
+ or with `yarn`
15
+
16
+ ```sh
17
+ yarn add react-dojah-sdk
18
+ ```
19
+
20
+ ## Usage
21
+
22
+ ```jsx
23
+ import React from 'react'
24
+ import Dojah from 'react-dojah-sdk'
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
+ /**
95
+ * @param {String} type
96
+ * This method receives the type
97
+ * The type can only be one of:
98
+ * loading, begin, success, error, close
99
+ * @param {String} data
100
+ * This is the data from doja
101
+ */
102
+ const response = (type, data) => {
103
+ console.log(type, data);
104
+ if (type === 'success') {
105
+ } else if (type === 'error') {
106
+ } else if (type === 'close') {
107
+ } else if (type === 'begin') {
108
+ } else if (type === 'loading') {
109
+ }
110
+ }
111
+
112
+ // The Doja library accepts 3 props and
113
+ // initiliazes the doja widget and connect process
114
+ return (
115
+ <Dojah
116
+ response={response}
117
+ appID={appID}
118
+ publicKey={publicKey}
119
+ type={type}
120
+ config={config}
121
+ userData={userData}
122
+ metadata={metadata}
123
+ govData={govData}
124
+ />
125
+ );
126
+ }
127
+
128
+ export default App
129
+
130
+ ```
131
+
132
+ See the `examples` folder for an implementation
133
+
134
+ ## Deployment
135
+
136
+ **`REMEMBER TO CHANGE THE APP ID and PUBLIC KEY WHEN DEPLOYING TO A LIVE (PRODUCTION) ENVIRONMENT`**
137
+
138
+ ## Contributing
139
+
140
+ 1. Fork it!
141
+ 2. Create your feature branch: `git checkout -b feature/feature-name`
142
+ 3. Commit your changes: `git commit -am 'Some commit message'`
143
+ 4. Push to the branch: `git push origin feature/feature-name`
144
+ 5. Submit a pull request 😉😉
145
+
146
+ ## License
147
+
148
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details