@qore-id/react-native-qoreid-sdk 1.1.0 → 1.1.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/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
+ ```
@@ -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:1.1.32'
95
+ implementation 'com.qoreid:qoreid-sdk:1.1.40'
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
 
@@ -1,4 +1,3 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
2
  package="com.qoreidsdk">
3
-
4
3
  </manifest>
@@ -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
@@ -93,6 +104,7 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
93
104
  .inputData(applicantData, addressData)
94
105
  .ocrAcceptedDocuments(data?.get("acceptedDocuments") as List<String>)
95
106
  .workflow(flowId!!.toLong())
107
+ // .workflowDefaultIdentity(config?.get("defaultIdType") as String)
96
108
  } else {
97
109
  QoreIDParams()
98
110
  .clientId(config?.get("clientId") as String)
@@ -105,6 +117,7 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
105
117
  QoreIDSdk.s(BuildConfig.s);
106
118
  QoreIDSdk.params(qoreIDParams)
107
119
  QoreIDSdk.launch(requireNotNull(currentActivity))
120
+
108
121
  }
109
122
 
110
123
  fun processQoreIDResult(context: ReactContext, qoreIdResult: QoreIDResult) {
@@ -115,6 +128,7 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
115
128
  putString("code", qoreIdResult.code.toString())
116
129
  putString("data", qoreIdResult.data.toString())
117
130
  putString("message", qoreIdResult.message)
131
+ putString("event", "ERROR_RESULT")
118
132
  }
119
133
 
120
134
  sendEvent(context, "onResult", event)
@@ -126,6 +140,7 @@ class QoreidSdkModule(val reactContext: ReactApplicationContext) :
126
140
  val event = Arguments.createMap().apply {
127
141
  putString("data", qoreIdResult.data.toString())
128
142
  putString("message", qoreIdResult.message)
143
+ putString("event", "SUCCESS_RESULT")
129
144
  }
130
145
 
131
146
  sendEvent(context, "onResult", event)
@@ -54,6 +54,7 @@ class QoreidSdk: RCTEventEmitter {
54
54
  .inputData(InputData(applicant: applicant,address: addressData, identity: identityData))
55
55
  .ocrAcceptedDocuments(ocrs as? Array<String>)
56
56
  .workFlow(config!["flowId"] as! Int)
57
+ .workFlowRequiredIdentity(config?["defaultIdType"] as? String ?? "")
57
58
  .build()
58
59
  } else {
59
60
  param = QoreIDParam()
@@ -80,13 +81,43 @@ class QoreidSdk: RCTEventEmitter {
80
81
  func onQoreIdResultReceived(result: QoreIDResult?) {
81
82
  if let result = result {
82
83
  if let errorResult = result as? ErrorResult {
83
- self.sendEvent(withName: "onResult", body:["code": String(describing: errorResult.code), "data":errorResult.data as Any, "message": errorResult.message])
84
+ self.sendEvent(withName: "onResult", body:["code": String(describing: errorResult.code), "data": self.parseData(errorResult.data), "message": errorResult.message, "event": "ERROR_RESULT"])
85
+ self.controller().popViewController(animated: false)
84
86
  } else if let successResult = result as? SuccessResult {
85
- self.sendEvent(withName: "onResult", body:["data":successResult.data as Any, "message": successResult.message as Any])
87
+ self.sendEvent(withName: "onResult", body:["data": self.parseData( successResult.data), "message": successResult.message!, "event": "SUCCESS_RESULT"])
88
+ self.controller().popViewController(animated: false)
89
+ } else if let pendingResult = result as? PendingResult {
90
+ self.sendEvent(withName: "onResult", body:["data": pendingResult.data?.verification?.id! ?? 0, "message": pendingResult.message!, "event": "SESSION_RESULT"])
86
91
  }
92
+ }
93
+ }
94
+
95
+ func parseData(_ resultData: QoreIDSDK.ResultData?) -> [String: Any] {
96
+ var data: [String: Any] = [:]
97
+
98
+ if let resultData = resultData {
99
+ data["customerReference"] = resultData.customerReference ?? ""
100
+
101
+ data["flowId"] = String(resultData.flowId ?? 0)
102
+
103
+ var verificationData: [String: Any] = [:]
104
+
105
+ verificationData["id"] = resultData.verification?.id
106
+
107
+ verificationData["status"] = [
108
+ "status": resultData.verification?.status?.status ?? "",
109
+ "state": resultData.verification?.status?.state ?? ""
110
+ ]
111
+
112
+ data["verification"] = verificationData
113
+
114
+ data["productCode"] = resultData.productCode
115
+
116
+ } else {
117
+ data = [:]
87
118
  }
88
- self.controller().popViewController(animated: false)
89
-
119
+
120
+ return data
90
121
  }
91
122
 
92
123
  override func supportedEvents() -> [String] {
@@ -102,3 +133,5 @@ class QoreidSdk: RCTEventEmitter {
102
133
  return rootViewController as! UINavigationController
103
134
  }
104
135
  }
136
+
137
+
@@ -1 +1 @@
1
- {"version":3,"names":["_utils","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_qoreIdSdk"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;AACA,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"}
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
- _reactNative.NativeModules.QoreidSdk.launchQoreidSdk({
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 onSuccess Called on success with result
38
- * @param onError Called on error with error object
38
+ * @param callback(data: OnResultType) Handles various events from QoreID SDK
39
39
  */
40
- events(onSuccess, onError) {
41
- (0, _react.useEffect)(() => {
42
- const eventEmitter = _reactNative.Platform.OS === 'android' ? new _reactNative.NativeEventEmitter() : new _reactNative.NativeEventEmitter(_reactNative.NativeModules.QoreidSdk);
43
- let eventListener = eventEmitter.addListener('onResult', event => {
44
- if (event !== null && event !== void 0 && event.code) {
45
- onError === null || onError === void 0 ? void 0 : onError(event);
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":["_react","require","_reactNative","QoreIdSdk","launch","initialData","NativeModules","QoreidSdk","launchQoreidSdk","config","flowId","customerReference","productCode","clientId","applicantData","addressData","acceptedDocuments","ocrAcceptedDocuments","identityData","events","onSuccess","onError","useEffect","eventEmitter","Platform","OS","NativeEventEmitter","eventListener","addListener","event","code","removeSubscription","exports"],"sourceRoot":"../../src","sources":["qoreIdSdk.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAGO,MAAME,SAAS,GAAG;EACvB;AACF;AACA;AACA;AACA;EACEC,MAAMA,CAACC,WAAqB,EAAE;IAC5BC,0BAAa,CAACC,SAAS,CAACC,eAAe,CAAC;MACtCC,MAAM,EAAE;QACNC,MAAM,EAAEL,WAAW,CAACK,MAAM,IAAI,CAAC;QAC/BC,iBAAiB,EAAEN,WAAW,CAACM,iBAAiB;QAChDC,WAAW,EAAEP,WAAW,CAACO,WAAW;QACpCC,QAAQ,EAAER,WAAW,CAACQ;MACxB,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,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,MAAMA,CACJC,SAAqD,EACrDC,OAAqC,EACrC;IACA,IAAAC,gBAAS,EAAC,MAAM;MACd,MAAMC,YAAY,GAChBC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACrB,IAAIC,+BAAkB,EAAE,GACxB,IAAIA,+BAAkB,CAACpB,0BAAa,CAACC,SAAS,CAAC;MACrD,IAAIoB,aAAa,GAAGJ,YAAY,CAACK,WAAW,CAC1C,UAAU,EACTC,KAAmB,IAAK;QACvB,IAAIA,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEC,IAAI,EAAE;UACfT,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGQ,KAAK,CAAC;UAChB;QACF;QACAT,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAGS,KAAK,CAAC;MACpB,CAAC,CACF;MAED,OAAO,MAAM;QACXN,YAAY,CAACQ,kBAAkB,CAACJ,aAAa,CAAC;MAChD,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;EACR;AACF,CAAC;AAACK,OAAA,CAAA7B,SAAA,GAAAA,SAAA"}
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"}
@@ -1,6 +1,2 @@
1
1
  "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
2
  //# sourceMappingURL=types.d.js.map
@@ -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;AAACM,OAAA,CAAAD,KAAA,GAAAA,KAAA"}
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"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AACA,cAAc,SAAS;AACvB,cAAc,aAAa"}
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,cAAc,SAAS;AACvB,cAAc,aAAa"}
@@ -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
- NativeModules.QoreidSdk.launchQoreidSdk({
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 onSuccess Called on success with result
32
- * @param onError Called on error with error object
32
+ * @param callback(data: OnResultType) Handles various events from QoreID SDK
33
33
  */
34
- events(onSuccess, onError) {
35
- useEffect(() => {
36
- const eventEmitter = Platform.OS === 'android' ? new NativeEventEmitter() : new NativeEventEmitter(NativeModules.QoreidSdk);
37
- let eventListener = eventEmitter.addListener('onResult', event => {
38
- if (event !== null && event !== void 0 && event.code) {
39
- onError === null || onError === void 0 ? void 0 : onError(event);
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":["useEffect","NativeEventEmitter","NativeModules","Platform","QoreIdSdk","launch","initialData","QoreidSdk","launchQoreidSdk","config","flowId","customerReference","productCode","clientId","applicantData","addressData","acceptedDocuments","ocrAcceptedDocuments","identityData","events","onSuccess","onError","eventEmitter","OS","eventListener","addListener","event","code","removeSubscription"],"sourceRoot":"../../src","sources":["qoreIdSdk.tsx"],"mappings":"AAAA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,kBAAkB,EAAEC,aAAa,EAAEC,QAAQ,QAAS,cAAc;AAG3E,OAAO,MAAMC,SAAS,GAAG;EACvB;AACF;AACA;AACA;AACA;EACEC,MAAMA,CAACC,WAAqB,EAAE;IAC5BJ,aAAa,CAACK,SAAS,CAACC,eAAe,CAAC;MACtCC,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;MACxB,CAAC;MACDC,aAAa,EAAE;QACb,GAAGR,WAAW,CAACQ;MACjB,CAAC;MACDC,WAAW,EAAE;QACX,GAAGT,WAAW,CAACS;MACjB,CAAC;MACDC,iBAAiB,EAAEV,WAAW,CAACW,oBAAoB;MACnDC,YAAY,EAAE;QAAE,GAAGZ,WAAW,CAACY;MAAa;IAC9C,CAAC,CAAC;EACJ,CAAC;EAED;AACF;AACA;AACA;AACA;EACEC,MAAMA,CACJC,SAAqD,EACrDC,OAAqC,EACrC;IACArB,SAAS,CAAC,MAAM;MACd,MAAMsB,YAAY,GAChBnB,QAAQ,CAACoB,EAAE,KAAK,SAAS,GACrB,IAAItB,kBAAkB,EAAE,GACxB,IAAIA,kBAAkB,CAACC,aAAa,CAACK,SAAS,CAAC;MACrD,IAAIiB,aAAa,GAAGF,YAAY,CAACG,WAAW,CAC1C,UAAU,EACTC,KAAmB,IAAK;QACvB,IAAIA,KAAK,aAALA,KAAK,eAALA,KAAK,CAAEC,IAAI,EAAE;UACfN,OAAO,aAAPA,OAAO,uBAAPA,OAAO,CAAGK,KAAK,CAAC;UAChB;QACF;QACAN,SAAS,aAATA,SAAS,uBAATA,SAAS,CAAGM,KAAK,CAAC;MACpB,CAAC,CACF;MAED,OAAO,MAAM;QACXJ,YAAY,CAACM,kBAAkB,CAACJ,aAAa,CAAC;MAChD,CAAC;IACH,CAAC,EAAE,EAAE,CAAC;EACR;AACF,CAAC"}
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"}
@@ -1,2 +1,2 @@
1
- export {};
1
+
2
2
  //# sourceMappingURL=types.d.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAA"}
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 { OnResultType, DataType } from './types';
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: DataType): void;
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 onSuccess Called on success with result
12
- * @param onError Called on error with error object
11
+ * @param callback(data: OnResultType) Handles various events from QoreID SDK
13
12
  */
14
- events(onSuccess: (data: Omit<OnResultType, 'code'>) => void, onError: (data: OnResultType) => void): void;
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":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEtD,eAAO,MAAM,SAAS;IACpB;;;;OAIG;wBACiB,QAAQ;IAmB5B;;;;OAIG;6BAEiB,KAAK,YAAY,EAAE,MAAM,CAAC,KAAK,IAAI,kBACrC,YAAY,KAAK,IAAI;CAuBxC,CAAC"}
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.0",
3
+ "version": "1.1.1",
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
- "react-native": "*",
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 => "11.0" }
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', '1.0.1'
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
@@ -1,3 +1,2 @@
1
-
2
1
  export * from './utils';
3
- export * from './qoreIdSdk'
2
+ export * from './qoreIdSdk';
package/src/qoreIdSdk.tsx CHANGED
@@ -1,6 +1,5 @@
1
- import { useEffect } from 'react';
2
- import { NativeEventEmitter, NativeModules, Platform, } from 'react-native';
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: DataType) {
12
- NativeModules.QoreidSdk.launchQoreidSdk({
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 onSuccess Called on success with result
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
- onSuccess: (data: Omit<OnResultType, 'code'>) => void,
37
- onError: (data: OnResultType) => void
38
- ) {
39
- useEffect(() => {
40
- const eventEmitter =
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
- return () => {
56
- eventEmitter.removeSubscription(eventListener);
57
- };
58
- }, []);
43
+ return () => {
44
+ eventListener.remove();
45
+ };
59
46
  },
60
47
  };
package/src/types.d.ts CHANGED
@@ -1,14 +1,13 @@
1
- import type { GestureResponderEvent } from 'react-native';
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 OnResultType {
46
+ export interface OnResult {
48
47
  code: string;
49
48
  data: string;
50
49
  message: string;
51
50
  }
52
51
 
53
-
54
-
55
-
56
- export type QoreIdSdkType = {
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