@qore-id/react-native-qoreid-sdk 1.1.0 → 1.1.2
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/README.md +1 -217
- package/android/build.gradle +2 -1
- package/android/src/main/AndroidManifest.xml +0 -1
- package/android/src/main/java/com/qoreidsdk/QoreidSdkModule.kt +20 -3
- package/ios/QoreidSdk.swift +41 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/qoreIdSdk.js +14 -23
- package/lib/commonjs/qoreIdSdk.js.map +1 -1
- package/lib/commonjs/types.d.js +0 -4
- package/lib/commonjs/utils.js +1 -2
- package/lib/commonjs/utils.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/qoreIdSdk.js +13 -21
- package/lib/module/qoreIdSdk.js.map +1 -1
- package/lib/module/types.d.js +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/qoreIdSdk.d.ts +4 -5
- package/lib/typescript/qoreIdSdk.d.ts.map +1 -1
- package/package.json +3 -6
- package/qore-id-react-native-qoreid-sdk.podspec +2 -2
- package/src/index.tsx +1 -2
- package/src/qoreIdSdk.tsx +18 -31
- package/src/types.d.ts +8 -17
- package/android/Untitled +0 -0
package/README.md
CHANGED
|
@@ -10,220 +10,4 @@ npm install --save @qore-id/react-native-qoreid-sdk
|
|
|
10
10
|
|
|
11
11
|
```c yarn
|
|
12
12
|
yarn add @qore-id/react-native-qoreid-sdk
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
```sh
|
|
17
|
-
//in your project directory
|
|
18
|
-
|
|
19
|
-
cd ios
|
|
20
|
-
pod install
|
|
21
|
-
```
|
|
22
|
-
> Note: You are required to rebuild your application after installing the package.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
### Android
|
|
26
|
-
|
|
27
|
-
Add the following to your `app/build.gradle`
|
|
28
|
-
|
|
29
|
-
```groovy
|
|
30
|
-
repositories {
|
|
31
|
-
mavenCentral()
|
|
32
|
-
google()
|
|
33
|
-
maven {
|
|
34
|
-
url "https://repo.qoreid.com/repository/maven-releases/"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
Add this snippet of code to your `~/java/com.<app name>/MainActivity`
|
|
40
|
-
|
|
41
|
-
```java
|
|
42
|
-
@Override
|
|
43
|
-
protected void onCreate(Bundle savedInstanceState) {
|
|
44
|
-
super.onCreate(savedInstanceState);
|
|
45
|
-
QoreidSdkModule.initialize(this);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
Add this import statement above the class
|
|
51
|
-
|
|
52
|
-
```java
|
|
53
|
-
import com.qoreidsdk.QoreidSdkModule;
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
#### Permissions
|
|
59
|
-
|
|
60
|
-
Certain services on QoreID require device permissions to work properly. Follow the instructions [here](https://docs.qoreid.com/docs/permissions) to add the required permissions to your `~/android/app/src/main/AndroidManifest.xml` file.
|
|
61
|
-
|
|
62
|
-
Verifind required permissions
|
|
63
|
-
|
|
64
|
-
```xml
|
|
65
|
-
...
|
|
66
|
-
<!-- Required for Verifind -->
|
|
67
|
-
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
|
|
68
|
-
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
|
|
69
|
-
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
|
70
|
-
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
|
71
|
-
...
|
|
72
|
-
```
|
|
73
|
-
### iOS
|
|
74
|
-
|
|
75
|
-
#### Update your AppDelegate.m
|
|
76
|
-
> QoreidSdK requires the UINavigationController to push a new ViewController to your app. To wrap your app's rootViewController in a UINavigationController, add the following code to your AppDelegate.m file.
|
|
77
|
-
|
|
78
|
-
```mm
|
|
79
|
-
//AppDelegate.m
|
|
80
|
-
|
|
81
|
-
// 1. Import necessary headers
|
|
82
|
-
#import "AppDelegate.h"
|
|
83
|
-
#import <React/RCTBridge.h>
|
|
84
|
-
#import <React/RCTRootView.h>
|
|
85
|
-
|
|
86
|
-
@implementation AppDelegate
|
|
87
|
-
|
|
88
|
-
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
|
|
89
|
-
{
|
|
90
|
-
...
|
|
91
|
-
|
|
92
|
-
// 2. Create an instance of UIWindow
|
|
93
|
-
self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|
94
|
-
|
|
95
|
-
// 3. Set up the UINavigationController with a UIViewController
|
|
96
|
-
UIViewController *viewController = [UIViewController new];
|
|
97
|
-
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
|
|
98
|
-
[navigationController setNavigationBarHidden:YES animated:NO];
|
|
99
|
-
|
|
100
|
-
// 4. Set the RN bridge to use the UIWindow as the root view controller
|
|
101
|
-
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
|
|
102
|
-
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
|
|
103
|
-
moduleName:self.moduleName
|
|
104
|
-
initialProperties:self.initialProps];
|
|
105
|
-
viewController.view = rootView;
|
|
106
|
-
self.window.rootViewController = navigationController; // Use the UINavigationController as the root
|
|
107
|
-
|
|
108
|
-
[self.window makeKeyAndVisible];
|
|
109
|
-
|
|
110
|
-
return YES;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
...
|
|
114
|
-
@end
|
|
115
|
-
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
#### Permissions
|
|
119
|
-
Added the following to your `~/ios/<app name>/Info.plist` file
|
|
120
|
-
|
|
121
|
-
```xml
|
|
122
|
-
...
|
|
123
|
-
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
|
124
|
-
<string>We need access to your location to provide you with location-based services, even when the app is in the background.</string>
|
|
125
|
-
<key>NSLocationWhenInUseUsageDescription</key>
|
|
126
|
-
<string>We need access to your location while you are using the app to provide you with location-based services.</string>
|
|
127
|
-
<key>NSCameraUsageDescription</key>
|
|
128
|
-
<string>We need access to your camera to take photos for profile pictures.</string>
|
|
129
|
-
<key>NSPhotoLibraryUsageDescription</key>
|
|
130
|
-
<string>We need access to your photo library to allow you to select and upload images.</string>
|
|
131
|
-
...
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Usage
|
|
135
|
-
|
|
136
|
-
```tsx
|
|
137
|
-
//verify.tsx
|
|
138
|
-
import React from 'react';
|
|
139
|
-
import { Button, View } from 'react-native';
|
|
140
|
-
import { QoreIdSdk } from '@qore-id/react-native-qoreid-sdk';
|
|
141
|
-
|
|
142
|
-
function App() {
|
|
143
|
-
|
|
144
|
-
const onError = (data) => {
|
|
145
|
-
console.error(data);
|
|
146
|
-
Alert.alert('Error', data);
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
const onSuccess = (data) => {
|
|
150
|
-
console.debug(data);
|
|
151
|
-
Alert.alert('Sumitted', data);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
QoreIdSdk.events(onSuccess, onError);
|
|
155
|
-
|
|
156
|
-
function onSubmit() {
|
|
157
|
-
const formData = {
|
|
158
|
-
flowId: parseInt(flowId),
|
|
159
|
-
clientId: clientId,
|
|
160
|
-
productCode: selectedProductId,
|
|
161
|
-
customerReference: customerRef,
|
|
162
|
-
applicantData: {
|
|
163
|
-
firstName: firstName,
|
|
164
|
-
middleName: middleName,
|
|
165
|
-
lastName: lastName,
|
|
166
|
-
gender: gender,
|
|
167
|
-
phoneNumber: phoneNumber,
|
|
168
|
-
email: email,
|
|
169
|
-
},
|
|
170
|
-
identityData: {
|
|
171
|
-
idType: idCardType,
|
|
172
|
-
idNumber: idNumber,
|
|
173
|
-
},
|
|
174
|
-
addressData: {
|
|
175
|
-
address: phyAddress,
|
|
176
|
-
city: city,
|
|
177
|
-
lga: lga,
|
|
178
|
-
},
|
|
179
|
-
ocrAcceptedDocuments:
|
|
180
|
-
['DRIVERS_LICENSE_NGA','VOTERS_CARD_NGA','NIN_SLIP_NGA','PASSPORT_NGA'],
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
QoreIdSdk.launchQoreId(formData);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return (
|
|
187
|
-
<View>
|
|
188
|
-
<Button title="Launch QoreIdSdk" onPress={onSubmit} />
|
|
189
|
-
</View>
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
## Utilities
|
|
195
|
-
|
|
196
|
-
QoreId SDK exposes utilities that you can easily use
|
|
197
|
-
|
|
198
|
-
```coffeescript
|
|
199
|
-
|
|
200
|
-
import React, {useRef} from 'react'
|
|
201
|
-
import { QoreIdButton, utils } from '@qore-id/react-native-qoreid-sdk';
|
|
202
|
-
|
|
203
|
-
function App() {
|
|
204
|
-
|
|
205
|
-
// Array of string
|
|
206
|
-
//For more information check -> https://docs.qoreid.com/docs/product-codes
|
|
207
|
-
const productIds = utils.productCodes;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
//An array of accepted documents in a specific country
|
|
211
|
-
//For more information check -> https://docs.qoreid.com/docs/ocr-accepted-documents#accepted-documents-for-ocr-verifications
|
|
212
|
-
const ocrLists = utils.acceptedDocuments["Nigeria"]
|
|
213
|
-
...
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
## <span style="color: red;">CHANGE LOGS</span>
|
|
219
|
-
|
|
220
|
-
#### 1.0.9
|
|
221
|
-
|
|
222
|
-
- Added qoreid initialization function. You can now launche the sdk in your code implementation - offering you more control.
|
|
223
|
-
- Addition of event listener `QoreIdSdk.events` to listen to events from the sdk.
|
|
224
|
-
- QoreIdButton component will be deprecated in the next major release. Use `QoreIdSdk.launchQoreId` instead.
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
#### 1.1.0 Breaking Changes
|
|
228
|
-
- Removed `QoreIdButton` component. Use `QoreIdSdk.launchQoreId` instead.
|
|
229
|
-
- QoreIdSdk is now available on iOS.
|
|
13
|
+
```
|
package/android/build.gradle
CHANGED
|
@@ -92,7 +92,8 @@ dependencies {
|
|
|
92
92
|
// For < 0.71, this will be from the local maven repo
|
|
93
93
|
// For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
|
|
94
94
|
//noinspection GradleDynamicVersion
|
|
95
|
-
implementation 'com.qoreid:qoreid-sdk
|
|
95
|
+
implementation 'com.qoreid:qoreid-sdk:+'
|
|
96
|
+
// implementation 'com.qoreid:qoreid-sdk-dev-min:1.1.43'
|
|
96
97
|
implementation "com.facebook.react:react-native:+"
|
|
97
98
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
98
99
|
|
|
@@ -21,8 +21,7 @@ import java.util.HashMap
|
|
|
21
21
|
|
|
22
22
|
class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
23
23
|
ReactContextBaseJavaModule(reactContext) {
|
|
24
|
-
private var qoreIdResult: QoreIDResult? = null
|
|
25
|
-
|
|
24
|
+
private var qoreIdResult: QoreIDResult? = null
|
|
26
25
|
|
|
27
26
|
private val activityEventListener =
|
|
28
27
|
object : BaseActivityEventListener() {
|
|
@@ -51,6 +50,17 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
|
51
50
|
|
|
52
51
|
init {
|
|
53
52
|
reactContext.addActivityEventListener(activityEventListener)
|
|
53
|
+
QoreIDSdk.Callbacks.onFlowRequestId {
|
|
54
|
+
Log.i("QORE_ID", it.toString())
|
|
55
|
+
|
|
56
|
+
val event = Arguments.createMap().apply {
|
|
57
|
+
putString("data", it.toString())
|
|
58
|
+
putString("message", "QOREID SDK INITIALIZED")
|
|
59
|
+
putString("event", "SESSION_RESULT")
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
sendEvent(reactContext, "onResult", event)
|
|
63
|
+
}
|
|
54
64
|
}
|
|
55
65
|
|
|
56
66
|
override fun getName(): String {
|
|
@@ -60,6 +70,7 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
|
60
70
|
@ReactMethod
|
|
61
71
|
fun launchQoreidSdk(readableData: ReadableMap) {
|
|
62
72
|
val data = readableData.toHashMap()
|
|
73
|
+
|
|
63
74
|
if (currentActivity == null) {
|
|
64
75
|
Log.e("Error", "No current activity");
|
|
65
76
|
return
|
|
@@ -73,7 +84,9 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
|
73
84
|
apD?.get("phoneNumber") as String?,
|
|
74
85
|
apD?.get("middleName") as String?,
|
|
75
86
|
apD?.get("dob") as String?,
|
|
76
|
-
apD?.get("gender") as String
|
|
87
|
+
apD?.get("gender") as String?,
|
|
88
|
+
apD?.get("email") as String?
|
|
89
|
+
|
|
77
90
|
)
|
|
78
91
|
|
|
79
92
|
|
|
@@ -93,6 +106,7 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
|
93
106
|
.inputData(applicantData, addressData)
|
|
94
107
|
.ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
|
|
95
108
|
.workflow(flowId!!.toLong())
|
|
109
|
+
// .workflowDefaultIdentity(config?.get("defaultIdType") as String)
|
|
96
110
|
} else {
|
|
97
111
|
QoreIDParams()
|
|
98
112
|
.clientId(config?.get("clientId") as String)
|
|
@@ -105,6 +119,7 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
|
105
119
|
QoreIDSdk.s(BuildConfig.s);
|
|
106
120
|
QoreIDSdk.params(qoreIDParams)
|
|
107
121
|
QoreIDSdk.launch(requireNotNull(currentActivity))
|
|
122
|
+
|
|
108
123
|
}
|
|
109
124
|
|
|
110
125
|
fun processQoreIDResult(context: ReactContext, qoreIdResult: QoreIDResult) {
|
|
@@ -115,6 +130,7 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
|
115
130
|
putString("code", qoreIdResult.code.toString())
|
|
116
131
|
putString("data", qoreIdResult.data.toString())
|
|
117
132
|
putString("message", qoreIdResult.message)
|
|
133
|
+
putString("event", "ERROR_RESULT")
|
|
118
134
|
}
|
|
119
135
|
|
|
120
136
|
sendEvent(context, "onResult", event)
|
|
@@ -126,6 +142,7 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
|
|
|
126
142
|
val event = Arguments.createMap().apply {
|
|
127
143
|
putString("data", qoreIdResult.data.toString())
|
|
128
144
|
putString("message", qoreIdResult.message)
|
|
145
|
+
putString("event", "SUCCESS_RESULT")
|
|
129
146
|
}
|
|
130
147
|
|
|
131
148
|
sendEvent(context, "onResult", event)
|
package/ios/QoreidSdk.swift
CHANGED
|
@@ -27,7 +27,9 @@ class QoreidSdk: RCTEventEmitter {
|
|
|
27
27
|
firstname:_applicant?["firstName"] as? String,
|
|
28
28
|
lastname:_applicant?["lastName"] as? String,
|
|
29
29
|
phone: _applicant?["phoneNumber"] as? String,
|
|
30
|
-
middlename: _applicant?["middleName"] as? String
|
|
30
|
+
middlename: _applicant?["middleName"] as? String,
|
|
31
|
+
dob: _applicant?["dob"] as? String,
|
|
32
|
+
email: _applicant?["email"] as? String
|
|
31
33
|
)
|
|
32
34
|
|
|
33
35
|
let addressData = AddressData(
|
|
@@ -54,6 +56,7 @@ class QoreidSdk: RCTEventEmitter {
|
|
|
54
56
|
.inputData(InputData(applicant: applicant,address: addressData, identity: identityData))
|
|
55
57
|
.ocrAcceptedDocuments(ocrs as? Array<String>)
|
|
56
58
|
.workFlow(config!["flowId"] as! Int)
|
|
59
|
+
.workFlowRequiredIdentity(config?["defaultIdType"] as? String ?? "")
|
|
57
60
|
.build()
|
|
58
61
|
} else {
|
|
59
62
|
param = QoreIDParam()
|
|
@@ -68,7 +71,7 @@ class QoreidSdk: RCTEventEmitter {
|
|
|
68
71
|
if let params = param {
|
|
69
72
|
DispatchQueue.main.async {
|
|
70
73
|
let vc = ViewController()
|
|
71
|
-
vc.param =
|
|
74
|
+
vc.param = params
|
|
72
75
|
vc.onQoreIdResult = { [weak self] result in
|
|
73
76
|
self?.onQoreIdResultReceived(result: result)
|
|
74
77
|
}
|
|
@@ -80,13 +83,43 @@ class QoreidSdk: RCTEventEmitter {
|
|
|
80
83
|
func onQoreIdResultReceived(result: QoreIDResult?) {
|
|
81
84
|
if let result = result {
|
|
82
85
|
if let errorResult = result as? ErrorResult {
|
|
83
|
-
self.sendEvent(withName: "onResult", body:["code": String(describing: errorResult.code), "data":errorResult.data
|
|
86
|
+
self.sendEvent(withName: "onResult", body:["code": String(describing: errorResult.code), "data": self.parseData(errorResult.data), "message": errorResult.message, "event": "ERROR_RESULT"])
|
|
87
|
+
self.controller().popViewController(animated: false)
|
|
84
88
|
} else if let successResult = result as? SuccessResult {
|
|
85
|
-
self.sendEvent(withName: "onResult", body:["data":successResult.data
|
|
89
|
+
self.sendEvent(withName: "onResult", body:["data": self.parseData( successResult.data), "message": successResult.message!, "event": "SUCCESS_RESULT"])
|
|
90
|
+
self.controller().popViewController(animated: false)
|
|
91
|
+
} else if let pendingResult = result as? PendingResult {
|
|
92
|
+
self.sendEvent(withName: "onResult", body:["data": pendingResult.data?.verification?.id! ?? 0, "message": pendingResult.message!, "event": "SESSION_RESULT"])
|
|
86
93
|
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
func parseData(_ resultData: QoreIDSDK.ResultData?) -> [String: Any] {
|
|
98
|
+
var data: [String: Any] = [:]
|
|
99
|
+
|
|
100
|
+
if let resultData = resultData {
|
|
101
|
+
data["customerReference"] = resultData.customerReference ?? ""
|
|
102
|
+
|
|
103
|
+
data["flowId"] = String(resultData.flowId ?? 0)
|
|
104
|
+
|
|
105
|
+
var verificationData: [String: Any] = [:]
|
|
106
|
+
|
|
107
|
+
verificationData["id"] = resultData.verification?.id
|
|
108
|
+
|
|
109
|
+
verificationData["status"] = [
|
|
110
|
+
"status": resultData.verification?.status?.status ?? "",
|
|
111
|
+
"state": resultData.verification?.status?.state ?? ""
|
|
112
|
+
]
|
|
113
|
+
|
|
114
|
+
data["verification"] = verificationData
|
|
115
|
+
|
|
116
|
+
data["productCode"] = resultData.productCode
|
|
117
|
+
|
|
118
|
+
} else {
|
|
119
|
+
data = [:]
|
|
87
120
|
}
|
|
88
|
-
|
|
89
|
-
|
|
121
|
+
|
|
122
|
+
return data
|
|
90
123
|
}
|
|
91
124
|
|
|
92
125
|
override func supportedEvents() -> [String] {
|
|
@@ -102,3 +135,5 @@ class QoreidSdk: RCTEventEmitter {
|
|
|
102
135
|
return rootViewController as! UINavigationController
|
|
103
136
|
}
|
|
104
137
|
}
|
|
138
|
+
|
|
139
|
+
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_utils","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_qoreIdSdk"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"names":["_utils","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_qoreIdSdk"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,MAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,MAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,MAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,UAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,UAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,UAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,UAAA,CAAAL,GAAA;IAAA;EAAA;AAAA"}
|
|
@@ -4,21 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.QoreIdSdk = void 0;
|
|
7
|
-
var _react = require("react");
|
|
8
7
|
var _reactNative = require("react-native");
|
|
9
|
-
const QoreIdSdk = {
|
|
8
|
+
const QoreIdSdk = exports.QoreIdSdk = {
|
|
10
9
|
/**
|
|
11
10
|
* lauches QoreID SDK
|
|
12
11
|
* @param initialData - data to launch Qore ID SDK
|
|
13
12
|
* @requires QoreIdSdk native module installed
|
|
14
13
|
*/
|
|
15
|
-
launch(initialData) {
|
|
16
|
-
|
|
14
|
+
launch(initialData, _callback) {
|
|
15
|
+
const payload = {
|
|
17
16
|
config: {
|
|
18
17
|
flowId: initialData.flowId || 0,
|
|
19
18
|
customerReference: initialData.customerReference,
|
|
20
19
|
productCode: initialData.productCode,
|
|
21
|
-
clientId: initialData.clientId
|
|
20
|
+
clientId: initialData.clientId,
|
|
21
|
+
defaultIdType: (initialData === null || initialData === void 0 ? void 0 : initialData.defaultIdType) || ''
|
|
22
22
|
},
|
|
23
23
|
applicantData: {
|
|
24
24
|
...initialData.applicantData
|
|
@@ -30,28 +30,19 @@ const QoreIdSdk = {
|
|
|
30
30
|
identityData: {
|
|
31
31
|
...initialData.identityData
|
|
32
32
|
}
|
|
33
|
-
}
|
|
33
|
+
};
|
|
34
|
+
_reactNative.NativeModules.QoreidSdk.launchQoreidSdk(payload);
|
|
34
35
|
},
|
|
35
36
|
/**
|
|
36
37
|
* QoreIdSdk events listener. It takes callbacks to handle success and error events
|
|
37
|
-
* @param
|
|
38
|
-
* @param onError Called on error with error object
|
|
38
|
+
* @param callback(data: OnResultType) Handles various events from QoreID SDK
|
|
39
39
|
*/
|
|
40
|
-
events(
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(event);
|
|
49
|
-
});
|
|
50
|
-
return () => {
|
|
51
|
-
eventEmitter.removeSubscription(eventListener);
|
|
52
|
-
};
|
|
53
|
-
}, []);
|
|
40
|
+
events(callback) {
|
|
41
|
+
const eventEmitter = _reactNative.Platform.OS === 'android' ? new _reactNative.NativeEventEmitter() : new _reactNative.NativeEventEmitter(_reactNative.NativeModules.QoreidSdk);
|
|
42
|
+
let eventListener = eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addListener('onResult', callback);
|
|
43
|
+
return () => {
|
|
44
|
+
eventListener.remove();
|
|
45
|
+
};
|
|
54
46
|
}
|
|
55
47
|
};
|
|
56
|
-
exports.QoreIdSdk = QoreIdSdk;
|
|
57
48
|
//# sourceMappingURL=qoreIdSdk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_reactNative","require","QoreIdSdk","exports","launch","initialData","_callback","payload","config","flowId","customerReference","productCode","clientId","defaultIdType","applicantData","addressData","acceptedDocuments","ocrAcceptedDocuments","identityData","NativeModules","QoreidSdk","launchQoreidSdk","events","callback","eventEmitter","Platform","OS","NativeEventEmitter","eventListener","addListener","remove"],"sourceRoot":"../../src","sources":["qoreIdSdk.tsx"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAGO,MAAMC,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAG;EACvB;AACF;AACA;AACA;AACA;EACEE,MAAMA,CAACC,WAAuB,EAAEC,SAAoC,EAAE;IACpE,MAAMC,OAAO,GAAG;MACdC,MAAM,EAAE;QACNC,MAAM,EAAEJ,WAAW,CAACI,MAAM,IAAI,CAAC;QAC/BC,iBAAiB,EAAEL,WAAW,CAACK,iBAAiB;QAChDC,WAAW,EAAEN,WAAW,CAACM,WAAW;QACpCC,QAAQ,EAAEP,WAAW,CAACO,QAAQ;QAC9BC,aAAa,EAAE,CAAAR,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEQ,aAAa,KAAI;MAC/C,CAAC;MACDC,aAAa,EAAE;QACb,GAAGT,WAAW,CAACS;MACjB,CAAC;MACDC,WAAW,EAAE;QACX,GAAGV,WAAW,CAACU;MACjB,CAAC;MACDC,iBAAiB,EAAEX,WAAW,CAACY,oBAAoB;MACnDC,YAAY,EAAE;QAAE,GAAGb,WAAW,CAACa;MAAa;IAC9C,CAAC;IAEDC,0BAAa,CAACC,SAAS,CAACC,eAAe,CAACd,OAAO,CAAC;EAClD,CAAC;EAED;AACF;AACA;AACA;EACEe,MAAMA,CAACC,QAAkC,EAAE;IACzC,MAAMC,YAAY,GAChBC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACrB,IAAIC,+BAAkB,CAAC,CAAC,GACxB,IAAIA,+BAAkB,CAACR,0BAAa,CAACC,SAAS,CAAC;IACrD,IAAIQ,aAAa,GAAGJ,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEK,WAAW,CAAC,UAAU,EAAEN,QAAQ,CAAC;IAEnE,OAAO,MAAM;MACXK,aAAa,CAACE,MAAM,CAAC,CAAC;IACxB,CAAC;EACH;AACF,CAAC"}
|
package/lib/commonjs/types.d.js
CHANGED
package/lib/commonjs/utils.js
CHANGED
|
@@ -12,9 +12,8 @@ const acceptedDocuments = {
|
|
|
12
12
|
const productCodes = ['alien_card', 'brs', 'business_address', 'bvn_basic', 'bvn_boolean', 'bvn_nuban', 'bvn_premium', 'cac_basic', 'cac_premium', 'drivers_license', 'employment', 'guarantor', 'face_verification_bvn', 'face_verification_drivers_license', 'face_verification_nin', 'face_verification_passport_ng', 'face_verification_passport_ke', 'face_verification_vnin', 'individual_address', 'kenya_id', 'license_plate_basic', 'license_plate_premium', 'liveness', 'liveness_bvn', 'liveness_drivers_license', 'liveness_nin', 'liveness_ocr', 'liveness_passport_ng', 'liveness_vnin', 'nin', 'nin_phone', 'nuban', 'ocr', 'passport_ng', 'passport_ke', 'property', 'tin',
|
|
13
13
|
// "vehicle",
|
|
14
14
|
'verifind', 'verifind_4d', 'vin', 'virtual_nin'];
|
|
15
|
-
const utils = {
|
|
15
|
+
const utils = exports.utils = {
|
|
16
16
|
productCodes,
|
|
17
17
|
acceptedDocuments
|
|
18
18
|
};
|
|
19
|
-
exports.utils = utils;
|
|
20
19
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["acceptedDocuments","Nigeria","Ghana","Kenya","productCodes","utils","exports"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;;;;;AAAA,MAAMA,iBAAiB,GAAG;EACxBC,OAAO,EAAE,CACP,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,cAAc,CACf;EACDC,KAAK,EAAE,CACL,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,CACjB;EACDC,KAAK,EAAE,CACL,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc;AAElB,CAAC;AAED,MAAMC,YAAY,GAAG,CACnB,YAAY,EACZ,KAAK,EACL,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,uBAAuB,EACvB,mCAAmC,EACnC,uBAAuB,EACvB,+BAA+B,EAC/B,+BAA+B,EAC/B,wBAAwB,EACxB,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACV,cAAc,EACd,0BAA0B,EAC1B,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,KAAK,EACL,WAAW,EACX,OAAO,EACP,KAAK,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,KAAK;AACL;AACA,UAAU,EACV,aAAa,EACb,KAAK,EACL,aAAa,CACd;AAEM,MAAMC,KAAK,GAAG;EACnBD,YAAY;EACZJ;AACF,CAAC
|
|
1
|
+
{"version":3,"names":["acceptedDocuments","Nigeria","Ghana","Kenya","productCodes","utils","exports"],"sourceRoot":"../../src","sources":["utils.ts"],"mappings":";;;;;;AAAA,MAAMA,iBAAiB,GAAG;EACxBC,OAAO,EAAE,CACP,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,cAAc,CACf;EACDC,KAAK,EAAE,CACL,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACd,gBAAgB,CACjB;EACDC,KAAK,EAAE,CACL,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc;AAElB,CAAC;AAED,MAAMC,YAAY,GAAG,CACnB,YAAY,EACZ,KAAK,EACL,kBAAkB,EAClB,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,WAAW,EACX,uBAAuB,EACvB,mCAAmC,EACnC,uBAAuB,EACvB,+BAA+B,EAC/B,+BAA+B,EAC/B,wBAAwB,EACxB,oBAAoB,EACpB,UAAU,EACV,qBAAqB,EACrB,uBAAuB,EACvB,UAAU,EACV,cAAc,EACd,0BAA0B,EAC1B,cAAc,EACd,cAAc,EACd,sBAAsB,EACtB,eAAe,EACf,KAAK,EACL,WAAW,EACX,OAAO,EACP,KAAK,EACL,aAAa,EACb,aAAa,EACb,UAAU,EACV,KAAK;AACL;AACA,UAAU,EACV,aAAa,EACb,KAAK,EACL,aAAa,CACd;AAEM,MAAMC,KAAK,GAAAC,OAAA,CAAAD,KAAA,GAAG;EACnBD,YAAY;EACZJ;AACF,CAAC"}
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,cAAc,SAAS;AACvB,cAAc,aAAa"}
|
package/lib/module/qoreIdSdk.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
1
|
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
3
2
|
export const QoreIdSdk = {
|
|
4
3
|
/**
|
|
@@ -6,13 +5,14 @@ export const QoreIdSdk = {
|
|
|
6
5
|
* @param initialData - data to launch Qore ID SDK
|
|
7
6
|
* @requires QoreIdSdk native module installed
|
|
8
7
|
*/
|
|
9
|
-
launch(initialData) {
|
|
10
|
-
|
|
8
|
+
launch(initialData, _callback) {
|
|
9
|
+
const payload = {
|
|
11
10
|
config: {
|
|
12
11
|
flowId: initialData.flowId || 0,
|
|
13
12
|
customerReference: initialData.customerReference,
|
|
14
13
|
productCode: initialData.productCode,
|
|
15
|
-
clientId: initialData.clientId
|
|
14
|
+
clientId: initialData.clientId,
|
|
15
|
+
defaultIdType: (initialData === null || initialData === void 0 ? void 0 : initialData.defaultIdType) || ''
|
|
16
16
|
},
|
|
17
17
|
applicantData: {
|
|
18
18
|
...initialData.applicantData
|
|
@@ -24,27 +24,19 @@ export const QoreIdSdk = {
|
|
|
24
24
|
identityData: {
|
|
25
25
|
...initialData.identityData
|
|
26
26
|
}
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
|
+
NativeModules.QoreidSdk.launchQoreidSdk(payload);
|
|
28
29
|
},
|
|
29
30
|
/**
|
|
30
31
|
* QoreIdSdk events listener. It takes callbacks to handle success and error events
|
|
31
|
-
* @param
|
|
32
|
-
* @param onError Called on error with error object
|
|
32
|
+
* @param callback(data: OnResultType) Handles various events from QoreID SDK
|
|
33
33
|
*/
|
|
34
|
-
events(
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(event);
|
|
43
|
-
});
|
|
44
|
-
return () => {
|
|
45
|
-
eventEmitter.removeSubscription(eventListener);
|
|
46
|
-
};
|
|
47
|
-
}, []);
|
|
34
|
+
events(callback) {
|
|
35
|
+
const eventEmitter = Platform.OS === 'android' ? new NativeEventEmitter() : new NativeEventEmitter(NativeModules.QoreidSdk);
|
|
36
|
+
let eventListener = eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.addListener('onResult', callback);
|
|
37
|
+
return () => {
|
|
38
|
+
eventListener.remove();
|
|
39
|
+
};
|
|
48
40
|
}
|
|
49
41
|
};
|
|
50
42
|
//# sourceMappingURL=qoreIdSdk.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["NativeEventEmitter","NativeModules","Platform","QoreIdSdk","launch","initialData","_callback","payload","config","flowId","customerReference","productCode","clientId","defaultIdType","applicantData","addressData","acceptedDocuments","ocrAcceptedDocuments","identityData","QoreidSdk","launchQoreidSdk","events","callback","eventEmitter","OS","eventListener","addListener","remove"],"sourceRoot":"../../src","sources":["qoreIdSdk.tsx"],"mappings":"AAAA,SAASA,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAG1E,OAAO,MAAMC,SAAS,GAAG;EACvB;AACF;AACA;AACA;AACA;EACEC,MAAMA,CAACC,WAAuB,EAAEC,SAAoC,EAAE;IACpE,MAAMC,OAAO,GAAG;MACdC,MAAM,EAAE;QACNC,MAAM,EAAEJ,WAAW,CAACI,MAAM,IAAI,CAAC;QAC/BC,iBAAiB,EAAEL,WAAW,CAACK,iBAAiB;QAChDC,WAAW,EAAEN,WAAW,CAACM,WAAW;QACpCC,QAAQ,EAAEP,WAAW,CAACO,QAAQ;QAC9BC,aAAa,EAAE,CAAAR,WAAW,aAAXA,WAAW,uBAAXA,WAAW,CAAEQ,aAAa,KAAI;MAC/C,CAAC;MACDC,aAAa,EAAE;QACb,GAAGT,WAAW,CAACS;MACjB,CAAC;MACDC,WAAW,EAAE;QACX,GAAGV,WAAW,CAACU;MACjB,CAAC;MACDC,iBAAiB,EAAEX,WAAW,CAACY,oBAAoB;MACnDC,YAAY,EAAE;QAAE,GAAGb,WAAW,CAACa;MAAa;IAC9C,CAAC;IAEDjB,aAAa,CAACkB,SAAS,CAACC,eAAe,CAACb,OAAO,CAAC;EAClD,CAAC;EAED;AACF;AACA;AACA;EACEc,MAAMA,CAACC,QAAkC,EAAE;IACzC,MAAMC,YAAY,GAChBrB,QAAQ,CAACsB,EAAE,KAAK,SAAS,GACrB,IAAIxB,kBAAkB,CAAC,CAAC,GACxB,IAAIA,kBAAkB,CAACC,aAAa,CAACkB,SAAS,CAAC;IACrD,IAAIM,aAAa,GAAGF,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEG,WAAW,CAAC,UAAU,EAAEJ,QAAQ,CAAC;IAEnE,OAAO,MAAM;MACXG,aAAa,CAACE,MAAM,CAAC,CAAC;IACxB,CAAC;EACH;AACF,CAAC"}
|
package/lib/module/types.d.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
//# sourceMappingURL=types.d.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { OnResult, QoreIdData } from './types';
|
|
2
2
|
export declare const QoreIdSdk: {
|
|
3
3
|
/**
|
|
4
4
|
* lauches QoreID SDK
|
|
5
5
|
* @param initialData - data to launch Qore ID SDK
|
|
6
6
|
* @requires QoreIdSdk native module installed
|
|
7
7
|
*/
|
|
8
|
-
launch(initialData:
|
|
8
|
+
launch(initialData: QoreIdData, _callback?: ((data: OnResult) => void) | undefined): void;
|
|
9
9
|
/**
|
|
10
10
|
* QoreIdSdk events listener. It takes callbacks to handle success and error events
|
|
11
|
-
* @param
|
|
12
|
-
* @param onError Called on error with error object
|
|
11
|
+
* @param callback(data: OnResultType) Handles various events from QoreID SDK
|
|
13
12
|
*/
|
|
14
|
-
events(
|
|
13
|
+
events(callback: (data: OnResult) => void): () => void;
|
|
15
14
|
};
|
|
16
15
|
//# sourceMappingURL=qoreIdSdk.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qoreIdSdk.d.ts","sourceRoot":"","sources":["../../src/qoreIdSdk.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"qoreIdSdk.d.ts","sourceRoot":"","sources":["../../src/qoreIdSdk.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAEpD,eAAO,MAAM,SAAS;IACpB;;;;OAIG;wBACiB,UAAU,sBAAqB,QAAQ,KAAK,IAAI;IAsBpE;;;OAGG;4BACqB,QAAQ,KAAK,IAAI;CAW1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qore-id/react-native-qoreid-sdk",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"description": "QoreId React Native SDK",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -79,8 +79,7 @@
|
|
|
79
79
|
},
|
|
80
80
|
"peerDependencies": {
|
|
81
81
|
"react": "*",
|
|
82
|
-
|
|
83
|
-
"react-native-webview": "*"
|
|
82
|
+
"react-native": "*"
|
|
84
83
|
},
|
|
85
84
|
"engines": {
|
|
86
85
|
"node": ">= 16.0.0"
|
|
@@ -122,6 +121,7 @@
|
|
|
122
121
|
"prettier"
|
|
123
122
|
],
|
|
124
123
|
"rules": {
|
|
124
|
+
"react-native/no-inline-styles": 0,
|
|
125
125
|
"prettier/prettier": [
|
|
126
126
|
"error",
|
|
127
127
|
{
|
|
@@ -158,8 +158,5 @@
|
|
|
158
158
|
}
|
|
159
159
|
]
|
|
160
160
|
]
|
|
161
|
-
},
|
|
162
|
-
"dependencies": {
|
|
163
|
-
"react-native-webview": "^12.2.0"
|
|
164
161
|
}
|
|
165
162
|
}
|
|
@@ -11,12 +11,12 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.license = package["license"]
|
|
12
12
|
s.authors = package["author"]
|
|
13
13
|
|
|
14
|
-
s.platforms = { :ios => "
|
|
14
|
+
s.platforms = { :ios => "12.0" }
|
|
15
15
|
s.source = { :git => "https://.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
17
|
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
18
|
s.dependency "React-Core"
|
|
19
|
-
s.dependency 'QoreIDSDK'
|
|
19
|
+
s.dependency 'QoreIDSDK'
|
|
20
20
|
|
|
21
21
|
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
22
22
|
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
package/src/index.tsx
CHANGED
package/src/qoreIdSdk.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import type { OnResultType, DataType } from './types';
|
|
1
|
+
import { NativeEventEmitter, NativeModules, Platform } from 'react-native';
|
|
2
|
+
import type { OnResult, QoreIdData } from './types';
|
|
4
3
|
|
|
5
4
|
export const QoreIdSdk = {
|
|
6
5
|
/**
|
|
@@ -8,13 +7,14 @@ export const QoreIdSdk = {
|
|
|
8
7
|
* @param initialData - data to launch Qore ID SDK
|
|
9
8
|
* @requires QoreIdSdk native module installed
|
|
10
9
|
*/
|
|
11
|
-
launch(initialData:
|
|
12
|
-
|
|
10
|
+
launch(initialData: QoreIdData, _callback?: (data: OnResult) => void) {
|
|
11
|
+
const payload = {
|
|
13
12
|
config: {
|
|
14
13
|
flowId: initialData.flowId || 0,
|
|
15
14
|
customerReference: initialData.customerReference,
|
|
16
15
|
productCode: initialData.productCode,
|
|
17
16
|
clientId: initialData.clientId,
|
|
17
|
+
defaultIdType: initialData?.defaultIdType || '',
|
|
18
18
|
},
|
|
19
19
|
applicantData: {
|
|
20
20
|
...initialData.applicantData,
|
|
@@ -24,37 +24,24 @@ export const QoreIdSdk = {
|
|
|
24
24
|
},
|
|
25
25
|
acceptedDocuments: initialData.ocrAcceptedDocuments,
|
|
26
26
|
identityData: { ...initialData.identityData },
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
NativeModules.QoreidSdk.launchQoreidSdk(payload);
|
|
28
30
|
},
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* QoreIdSdk events listener. It takes callbacks to handle success and error events
|
|
32
|
-
* @param
|
|
33
|
-
* @param onError Called on error with error object
|
|
34
|
+
* @param callback(data: OnResultType) Handles various events from QoreID SDK
|
|
34
35
|
*/
|
|
35
|
-
events(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
Platform.OS === 'android'
|
|
42
|
-
? new NativeEventEmitter()
|
|
43
|
-
: new NativeEventEmitter(NativeModules.QoreidSdk);
|
|
44
|
-
let eventListener = eventEmitter.addListener(
|
|
45
|
-
'onResult',
|
|
46
|
-
(event: OnResultType) => {
|
|
47
|
-
if (event?.code) {
|
|
48
|
-
onError?.(event);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
onSuccess?.(event);
|
|
52
|
-
}
|
|
53
|
-
);
|
|
36
|
+
events(callback: (data: OnResult) => void) {
|
|
37
|
+
const eventEmitter =
|
|
38
|
+
Platform.OS === 'android'
|
|
39
|
+
? new NativeEventEmitter()
|
|
40
|
+
: new NativeEventEmitter(NativeModules.QoreidSdk);
|
|
41
|
+
let eventListener = eventEmitter?.addListener('onResult', callback);
|
|
54
42
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}, []);
|
|
43
|
+
return () => {
|
|
44
|
+
eventListener.remove();
|
|
45
|
+
};
|
|
59
46
|
},
|
|
60
47
|
};
|
package/src/types.d.ts
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export interface DataType {
|
|
1
|
+
export interface QoreIdData {
|
|
4
2
|
flowId?: number;
|
|
5
3
|
customerReference: string;
|
|
6
4
|
productCode: string;
|
|
7
5
|
clientId: string;
|
|
6
|
+
defaultIdType?: string;
|
|
8
7
|
applicantData?: ApplicantData;
|
|
9
8
|
addressData?: AddressData;
|
|
10
9
|
ocrAcceptedDocuments: string[];
|
|
11
|
-
identityData?: IdentityData
|
|
10
|
+
identityData?: IdentityData;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
13
|
interface IConfig {
|
|
@@ -44,21 +43,13 @@ interface AddressData {
|
|
|
44
43
|
virAddress?: string;
|
|
45
44
|
}
|
|
46
45
|
|
|
47
|
-
export interface
|
|
46
|
+
export interface OnResult {
|
|
48
47
|
code: string;
|
|
49
48
|
data: string;
|
|
50
49
|
message: string;
|
|
51
50
|
}
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
launchQoreId: (
|
|
58
|
-
initialData: DataType
|
|
59
|
-
) => void;
|
|
60
|
-
events: (
|
|
61
|
-
onSuccess: (data: Omit<OnResultType, 'code'>) => void,
|
|
62
|
-
onError: (data: OnResultType) => void
|
|
63
|
-
) => void;
|
|
64
|
-
}
|
|
52
|
+
export type QoreIdSdk = {
|
|
53
|
+
launchQoreId: (initialData: DataTyp) => void;
|
|
54
|
+
events: (OnResult: (data: OnResultType) => void) => void;
|
|
55
|
+
};
|
package/android/Untitled
DELETED
|
Binary file
|