dojah-kyc-sdk-react_native 0.0.8-dev → 0.0.9

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
@@ -35,6 +35,14 @@ dependencyResolutionManagement {
35
35
  }
36
36
  ```
37
37
 
38
+ ### Enable Jetifier
39
+ Enable Jetifier in android/gradle.properties
40
+
41
+ ```
42
+ android.enableJetifier=true
43
+ ```
44
+
45
+
38
46
  ### Permissions
39
47
  For Android you don't need to declare permissions, its already included in the Package.
40
48
 
@@ -125,8 +133,8 @@ To start KYC, import Dojah in your React Native code, and launch Dojah Screen
125
133
  import {launchDojahKyc } from 'dojah-kyc-sdk-react_native';
126
134
 
127
135
 
128
- /**
129
- * The following parameters are available
136
+ /**
137
+ * The following parameters are available
130
138
  * for launching the flow.
131
139
  */
132
140
 
@@ -205,11 +213,11 @@ const metadata = {
205
213
  key2: 'value2'
206
214
  };
207
215
 
208
- /**
209
- * to launch the flow only [widgetId] is mandatory
216
+ /**
217
+ * to launch the flow only [widgetId] is mandatory
210
218
  * @returns - the Promise of the result, promise
211
- * will return a status that you can use to track
212
- * the immidiate progress.
219
+ * will return a status that you can use to track
220
+ * the immidiate progress.
213
221
  * @throws - an error if the Dojah KYC flow fails
214
222
  */
215
223
  launchDojahKyc(
@@ -250,6 +258,7 @@ launchDojahKyc(
250
258
  - `WidgetID` - a `REQUIRED` parameter. You get this ID when you sign up on the Dojah platform, follow the next step to generate your WidgetId.
251
259
  - `Reference ID` - an `OPTIONAL` parameter that allows you to initialize the SDK for an ongoing verification.
252
260
  - `Email Address` - an `OPTIONAL` parameter that allows you to initialize the SDK for an ongoing verification.
261
+ - `ExtraUserData` - an `OPTIONAL` parameter that allows you to pass custom data to the SDK.
253
262
 
254
263
  ## How to Get a Widget ID
255
264
  To use the SDK, you need a WidgetID, which is a required parameter for initializing the SDK. You can obtain this by creating a flow on the Dojah platform. Follow these steps to configure and get your Widget ID:
@@ -280,3 +289,113 @@ To use the SDK, you need a WidgetID, which is a required parameter for initializ
280
289
 
281
290
  7. Copy Your Widget ID: After publishing, the platform will generate a Widget ID. Copy this Widget ID as you will need it to initialize the SDK as stated above.
282
291
  ```
292
+
293
+
294
+ ## TroubleShooting
295
+
296
+ ### Android ProGuard/R8 Configuration for Release Builds
297
+ When building your Android application in release mode with code shrinking (R8/ProGuard) enabled, you might encounter issues where the SDK or its dependencies fail to function correctly. This happens because R8, the default code shrinker, might remove classes or methods that are used by the SDK but aren't explicitly referenced in a way R8 can detect.
298
+
299
+ If you experience crashes or unexpected behavior related to missing classes (often indicated by errors like ClassNotFoundException or Missing classes detected while running R8), you'll need to add specific "keep" rules to your project's ProGuard configuration.
300
+
301
+ ### How to Apply ProGuard Rules
302
+
303
+ Locate your ProGuard file: In your Flutter project, navigate to android/app/proguard-rules.pro. If this file doesn't exist, create it.
304
+
305
+ Add the necessary rules: Open the proguard-rules.pro file and add the following lines. These rules instruct R8 to preserve the essential components of the Dojah SDK and its underlying libraries during the build process.
306
+
307
+ ```
308
+ # These are essential for React Native's internal mechanisms and module linking.
309
+ -keepclassmembers class com.facebook.react.bridge.JavaModule$$Props { *; }
310
+ -keepclassmembers class com.facebook.react.bridge.ModuleSpec { *; }
311
+ -keepclassmembers class * implements com.facebook.react.bridge.JavaScriptModule { *; }
312
+ -keepclassmembers class * implements com.facebook.react.bridge.NativeModule { *; }
313
+
314
+ # Prevents the stripping of unused methods in classes that are accessed dynamically.
315
+ -keep public class * extends com.facebook.react.bridge.ViewManager { *; }
316
+ -keep public class * extends com.facebook.react.uimanager.ViewManager { *; } # Older versions might use this
317
+
318
+ # Keep React Native module classes and their constructors.
319
+ # This is crucial for autolinking and manual linking.
320
+ -keep class * implements com.facebook.react.bridge.NativeModule {
321
+ <init>(...);
322
+ }
323
+ -keep class * extends com.facebook.react.bridge.BaseJavaModule {
324
+ <init>(...);
325
+ }
326
+ -keep class * extends com.facebook.react.uimanager.ViewManager {
327
+ <init>(...);
328
+ }
329
+
330
+ # Standard dontwarn rules for common React Native dependencies
331
+ -dontwarn com.facebook.react.**
332
+ -dontwarn com.facebook.jni.**
333
+ -dontwarn com.facebook.soloader.**
334
+ -dontwarn com.facebook.yoga.**
335
+ -dontwarn javax.annotation.**
336
+
337
+ # Keep gRPC-related classes
338
+ -keep class io.grpc.** { *; }
339
+ -keep class com.google.android.libraries.places.** { *; }
340
+
341
+
342
+ -keepnames class io.grpc.internal.**
343
+ -keepclassmembers class io.grpc.internal.** { *; }
344
+ -dontwarn io.grpc.**
345
+
346
+
347
+ -keep class com.dojah.kyc_sdk_kotlin.domain.** { *; }
348
+ -keep class com.dojah.kyc_sdk_kotlin.core.Result
349
+
350
+ #For retrofit
351
+ -keepattributes Signature, InnerClasses, EnclosingMethod
352
+ -keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations
353
+ -keepattributes AnnotationDefault
354
+ -keepclassmembers,allowshrinking,allowobfuscation interface * {
355
+ @retrofit2.http.* <methods>;
356
+ }
357
+ -dontwarn javax.annotation.**
358
+ -dontwarn kotlin.Unit
359
+ -dontwarn retrofit2.KotlinExtensions
360
+ -dontwarn retrofit2.KotlinExtensions$*
361
+ -if interface * { @retrofit2.http.* <methods>; }
362
+ -keep,allowobfuscation interface <1>
363
+ -keep,allowobfuscation,allowshrinking interface retrofit2.Call
364
+ -keep,allowobfuscation,allowshrinking class retrofit2.Response
365
+ -keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
366
+
367
+ #For Okio
368
+ -dontwarn org.codehaus.mojo.animal_sniffer.*
369
+
370
+ #For Gson
371
+ -keep class sun.misc.Unsafe { *; }
372
+ -keep class com.google.gson.examples.android.model.** { *; }
373
+
374
+ #For Glide
375
+ -keep public class * implements com.bumptech.glide.module.GlideModule
376
+ -keep class * extends com.bumptech.glide.module.AppGlideModule {
377
+ <init>(...);
378
+ }
379
+ -keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
380
+ **[] $VALUES;
381
+ public *;
382
+ }
383
+ -keep class com.bumptech.glide.load.data.ParcelFileDescriptorRewinder$InternalRewinder {
384
+ *** rewind();
385
+ }
386
+ ```
387
+
388
+ Ensure ProGuard is enabled: Verify that proguardFiles is pointing to the default Android ProGuard rules and your custom proguard-rules.pro file. This tells R8 to use your added rules.
389
+ Your release build type block should look similar to this:
390
+
391
+ ``` groovy
392
+ android {
393
+ buildTypes {
394
+ release {
395
+ // ... other configurations like signingConfig
396
+ minifyEnabled true
397
+ proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
398
+ }
399
+ }
400
+ }
401
+ ```
@@ -55,7 +55,7 @@ def supportsNamespace() {
55
55
 
56
56
  android {
57
57
  if (supportsNamespace()) {
58
- namespace "com.dojahkyc"
58
+ namespace "com.dojahkyc.rn"
59
59
 
60
60
  sourceSets {
61
61
  main {
@@ -74,6 +74,8 @@ android {
74
74
 
75
75
  buildTypes {
76
76
  release {
77
+ proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
78
+
77
79
  minifyEnabled true
78
80
  }
79
81
  }
@@ -0,0 +1,50 @@
1
+ # These are essential for React Native's internal mechanisms and module linking.
2
+ -keepclassmembers class com.facebook.react.bridge.JavaModule$$Props { *; }
3
+ -keepclassmembers class com.facebook.react.bridge.ModuleSpec { *; }
4
+ -keepclassmembers class * implements com.facebook.react.bridge.JavaScriptModule { *; }
5
+ -keepclassmembers class * implements com.facebook.react.bridge.NativeModule { *; }
6
+
7
+ # Prevents the stripping of unused methods in classes that are accessed dynamically.
8
+ -keep public class * extends com.facebook.react.bridge.ViewManager { *; }
9
+ -keep public class * extends com.facebook.react.uimanager.ViewManager { *; } # Older versions might use this
10
+
11
+ # Keep React Native module classes and their constructors.
12
+ # This is crucial for autolinking and manual linking.
13
+ -keep class * implements com.facebook.react.bridge.NativeModule {
14
+ <init>(...);
15
+ }
16
+ -keep class * extends com.facebook.react.bridge.BaseJavaModule {
17
+ <init>(...);
18
+ }
19
+ -keep class * extends com.facebook.react.uimanager.ViewManager {
20
+ <init>(...);
21
+ }
22
+
23
+ # Standard dontwarn rules for common React Native dependencies
24
+ -dontwarn com.facebook.react.**
25
+ -dontwarn com.facebook.jni.**
26
+ -dontwarn com.facebook.soloader.**
27
+ -dontwarn com.facebook.yoga.**
28
+ -dontwarn javax.annotation.**
29
+
30
+
31
+ # Keep your SDK's core Kotlin classes and interfaces (likely in kyc_sdk_kotlin)
32
+ -keep class com.dojah.kyc_sdk_kotlin.domain.** { *; }
33
+ -keep class com.dojah.kyc_sdk_kotlin.core.Result
34
+ -keep interface com.dojah.** { *; }
35
+
36
+ # IMPORTANT: Keep React Native module and package classes.
37
+ -keep class com.dojahkyc.rn.** {*;}
38
+
39
+
40
+ # Keep gRPC classes
41
+ -keep class io.grpc.** { *; }
42
+
43
+ # Keep BouncyCastle classes
44
+ -keep class org.bouncycastle.** { *; }
45
+
46
+ # Keep Conscrypt classes
47
+ -keep class org.conscrypt.** { *; }
48
+
49
+ # Keep OpenJSSE classes
50
+ -keep class org.openjsse.** { *; }
@@ -1,3 +1,3 @@
1
1
  <manifest xmlns:android="http://schemas.android.com/apk/res/android"
2
- package="com.dojahkyc">
2
+ package="com.dojahkyc.rn">
3
3
  </manifest>
@@ -1,9 +1,7 @@
1
- package com.dojahkyc
1
+ package com.dojahkyc.rn
2
2
 
3
3
  import android.app.Activity
4
- import android.app.Activity.RESULT_OK
5
4
  import android.content.Intent
6
- import android.widget.Toast
7
5
  import com.dojah.kyc_sdk_kotlin.DojahSdk
8
6
  import com.dojah.kyc_sdk_kotlin.DOJAH_RESULT_KEY
9
7
  // import com.dojah.kyc_sdk_kotlin.BACKWARD_CALL_REQUEST_CODE
@@ -15,9 +13,6 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
15
13
  import com.facebook.react.bridge.ReactMethod
16
14
  import com.facebook.react.bridge.WritableMap
17
15
  import com.facebook.react.bridge.WritableNativeMap
18
- import androidx.activity.result.ActivityResult
19
- import androidx.activity.result.ActivityResultLauncher
20
- import androidx.activity.result.contract.ActivityResultContracts
21
16
  import com.facebook.react.bridge.ReadableMap
22
17
  import com.dojah.kyc_sdk_kotlin.domain.UserData
23
18
  import com.dojah.kyc_sdk_kotlin.domain.GovData
@@ -93,13 +88,13 @@ class DojahKycModule(private val reactContext: ReactApplicationContext) :
93
88
  cac = businessData?.getString("cac")
94
89
  ),
95
90
  address = address,
96
- metadata = metadata?.toHashMap()
91
+ metadata = metadata?.toHashMap() as? Map<String, Any>
97
92
  ))
98
93
  } catch (e: Exception) {
99
94
  // this.promise.reject("LAUNCH_ERROR", e.message, e)
100
95
  // this.promise = null
101
96
  }
102
-
97
+
103
98
  }
104
99
 
105
100
 
@@ -1,4 +1,4 @@
1
- package com.dojahkyc
1
+ package com.dojahkyc.rn
2
2
 
3
3
  import com.facebook.react.ReactPackage
4
4
  import com.facebook.react.bridge.NativeModule
package/ios/DojahKyc.mm CHANGED
@@ -21,12 +21,12 @@
21
21
  RCT_EXTERN_METHOD(initialize:(NSString)appName)
22
22
 
23
23
 
24
- RCT_EXTERN_METHOD(launch:(NSString)widgetId withReferenceId:(NSString)referenceId withEmail:(NSString)email)
25
-
26
- + (BOOL)requiresMainQueueSetup
27
- {
28
- return NO;
29
- }
30
-
24
+ RCT_EXTERN_METHOD(
25
+ launch:(NSString *)widgetId
26
+ withReferenceId:(NSString *)referenceId
27
+ withEmail:(NSString *)email
28
+ resolver:(RCTPromiseResolveBlock)resolve
29
+ rejecter:(RCTPromiseRejectBlock)reject
30
+ )
31
31
  @end
32
32
 
@@ -4,42 +4,78 @@ import Foundation
4
4
  import DojahWidget
5
5
  import React
6
6
 
7
+
8
+ class DojahNavigationControllerDelegate: NSObject, UINavigationControllerDelegate {
9
+ var onDidShow: (UIViewController) -> Void = { _ in }
10
+ func navigationController(_ navigationController: UINavigationController,
11
+ didShow viewController: UIViewController,
12
+ animated: Bool) {
13
+ print("Did show: \(viewController)")
14
+ onDidShow(viewController)
15
+ }
16
+
17
+ func navigationController(_ navigationController: UINavigationController,
18
+ willShow viewController: UIViewController,
19
+ animated: Bool) {
20
+ print("Will show: \(viewController)")
21
+ }
22
+
23
+ func setOnDidShow(_ onDidShow: @escaping (UIViewController) -> Void) {
24
+ self.onDidShow = onDidShow
25
+ }
26
+ }
27
+
7
28
  @objc(DojahKyc)
8
29
  class DojahKyc: RCTEventEmitter, RCTBridgeDelegate {
9
- func sourceURL(for bridge: RCTBridge) -> URL? {
10
-
30
+ @objc override static func requiresMainQueueSetup() -> Bool {
31
+ return false
32
+ }
33
+
34
+ let navDelegate = DojahNavigationControllerDelegate()
35
+
36
+ var navCtrl:UINavigationController? = nil
37
+
38
+ var prevController:UIViewController? = nil
39
+
40
+ override init() {
41
+ super.init()
42
+
43
+ DispatchQueue.main.async {
44
+ self.navCtrl = UIApplication.shared.keyWindow?.rootViewController as? UINavigationController
45
+ if self.navCtrl != nil {
46
+ self.navCtrl!.delegate = self.navDelegate
47
+ }
48
+ }
49
+ }
50
+
51
+ func sourceURL(for bridge: RCTBridge) -> URL? {
11
52
  #if DEBUG
12
53
  return RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index", fallbackExtension: nil)
13
54
  #else
14
55
  return Bundle.main.url(forResource: "main", withExtension: "jsbundle")!
15
56
  #endif
16
-
17
57
  }
18
-
19
-
58
+
59
+
20
60
  override var methodQueue: DispatchQueue {
21
61
  return DispatchQueue.main;
22
62
  }
23
-
24
- override class func requiresMainQueueSetup() -> Bool {
25
- return true;
26
- }
27
-
28
-
63
+
64
+
29
65
  @objc(initialize:)
30
66
  func initialize(appName:String) -> Void {
31
67
  // Initialize the React Native bridge
32
68
  if let bridge = RCTBridge(delegate: self, launchOptions: nil) {
33
69
  // Create a React Native root view with the provided module name
34
70
  let rootView = RCTRootView(bridge: bridge, moduleName: appName, initialProperties: nil)
35
-
71
+
36
72
  // Create the initial view controller with the React Native view
37
73
  let rootViewController = UIViewController()
38
74
  rootViewController.view = rootView
39
-
75
+
40
76
  // Create a UINavigationController and set it as the window's rootViewController
41
77
  let navigationController = UINavigationController(rootViewController: rootViewController)
42
-
78
+
43
79
  // Set the window's rootViewController
44
80
  if let window = UIApplication.shared.delegate?.window {
45
81
  window?.rootViewController = navigationController
@@ -48,46 +84,52 @@ class DojahKyc: RCTEventEmitter, RCTBridgeDelegate {
48
84
  }else{
49
85
  print("bridge is null")
50
86
  }
51
-
52
-
87
+
88
+
53
89
  }
54
-
55
-
56
- @objc(launch:withReferenceId:withEmail:)
57
- func launch(widgetId:String, referenceId:String, email:String) -> Void {
58
-
59
-
60
- guard let rootViewController = UIApplication.shared.keyWindow?.rootViewController else {
61
- print("no root ctrl")
62
- return
90
+
91
+
92
+ @objc(launch:withReferenceId:withEmail:resolver:rejecter:)
93
+ func launch(
94
+ _ widgetId:String,
95
+ withReferenceId referenceId:String,
96
+ withEmail email:String,
97
+ resolver resolve: @escaping RCTPromiseResolveBlock,
98
+ rejecter reject: @escaping RCTPromiseRejectBlock
99
+ ) {
100
+ navDelegate.setOnDidShow { vc in
101
+ print("onDidShow: \(vc)")
102
+ //return result from DojahWidget once verification
103
+ //is done,failed or cancel
104
+ if(!String(describing:vc).contains("DojahWidget")){
105
+ let vStatus = DojahWidgetSDK.getVerificationResultStatus()
106
+ let status = if(vStatus.isEmpty){ "closed"} else {vStatus}
107
+
108
+ resolve(status)
109
+ print("resolve onDidShow: \(vc)")
110
+
111
+
112
+ self.prevController = nil
113
+ }else if(String(describing:vc).contains("DojahWidget.DJDisclaimer")
114
+ && self.prevController != nil){
115
+ self.navCtrl?.popToRootViewController(animated: false)
116
+ }else if(!String(describing:vc).contains("DojahWidget.SDKInitViewController")){
117
+ self.prevController = vc
118
+ }
63
119
  }
64
- print("nav ctrl: $\(rootViewController as? UINavigationController)")
65
-
66
- // print("Launched start")
67
- // let nav: UIViewController? = RCTPresentedViewController()
68
- // print("nav ctrl is \(nav?.navigationController)")
69
-
70
- if(rootViewController as? UINavigationController != nil){
71
- DojahWidgetSDK.initialize(widgetID: widgetId,referenceID: referenceId,emailAddress: email, navController: rootViewController as! UINavigationController)
72
- // DojahWidgetSDK.initializeNormal(widgetID: widgetId,referenceID: referenceId,emailAddress: email, uiController: nav!)
73
- print("Launched...")
74
- // print("cached count is: \(DojahWidgetSDK.getCachedWidgetIDs().count)")
75
- print("native details: Launch=> email:\(email), referenceId:\(referenceId), widgetId:\(widgetId)")
76
- }else{
120
+
121
+
122
+ if(navCtrl != nil){
123
+ do{
124
+ DojahWidgetSDK.initialize(widgetID: widgetId,referenceID: referenceId,emailAddress: email, navController: navCtrl!)
125
+ }catch{
126
+ reject("no-launch", "Could not launch Dojah Widget", error)
127
+ }
128
+ }else{
129
+ reject("no-launch", "Could not launch Dojah Widget", nil)
130
+ //throw error status to react native
77
131
  print("rootViewController is nil")
78
132
  }
79
-
80
133
  }
81
-
82
- // @objc(launchTest:withB:withResolver:withRejecter:)
83
- // func launchTest(a: Float, b: Float, resolve:RCTPromiseResolveBlock,reject:RCTPromiseRejectBlock) -> Void {
84
- // print("Launched Test")
85
- // // print("count is:\(DojahWidgetSDK.getCachedWidgetIDs().count;)")
86
- // // if(DojahWidgetSDK.getCachedWidgetIDs().count > 0){
87
- // // resolve("launched more")
88
- // // }else{
89
- // // resolve("launched 0")
90
- // // }
91
- // resolve("launched")
92
- // }
134
+
93
135
  }
@@ -31,7 +31,7 @@ const DojahKyc = _reactNative.NativeModules.DojahKyc ? _reactNative.NativeModule
31
31
  * @returns - the Promise of the result
32
32
  * @throws - an error if the Dojah KYC flow fails
33
33
  * @example
34
- *
34
+ *
35
35
  * ```typescript
36
36
  * import { launchDojahKyc } from 'dojah-kyc-sdk-react_native';
37
37
  * const widgetId = 'your-widget-id';
@@ -77,21 +77,10 @@ const DojahKyc = _reactNative.NativeModules.DojahKyc ? _reactNative.NativeModule
77
77
  * console.error('Error: ', error);
78
78
  * });
79
79
  * ```
80
- **/
80
+ **/
81
81
 
82
82
  function launchDojahKyc(widgetId, referenceId, email, userData = null, govData = null, govId = null, location = null, businessData = null, address = null, metadata = null) {
83
- if (_reactNative.Platform.OS === 'ios') {
84
- return new Promise((resolve, reject) => {
85
- try {
86
- DojahKyc.launch(widgetId, referenceId ?? '', email ?? '');
87
- resolve("launched"); // Adjust this based on the actual return value of DojahKyc.launch
88
- } catch (error) {
89
- reject("closed");
90
- }
91
- });
92
- } else {
93
- return DojahKyc.launch(widgetId, referenceId, email, userData, govData, govId, location, businessData, address, metadata);
94
- }
83
+ return DojahKyc.launch(widgetId, referenceId, email, userData, govData, govId, location, businessData, address, metadata);
95
84
  }
96
85
  function getIdHistory() {
97
86
  return DojahKyc.getIdHistory();
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","DojahKyc","NativeModules","Proxy","get","Error","launchDojahKyc","widgetId","referenceId","email","userData","govData","govId","location","businessData","address","metadata","OS","Promise","resolve","reject","launch","error","getIdHistory"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,qFAAqF,GACrFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,QAAQ,GAAGC,0BAAa,CAACD,QAAQ,GACnCC,0BAAa,CAACD,QAAQ,GACtB,IAAIE,KAAK,CACT,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAASU,cAAcA,CAC5BC,QAAgB,EAChBC,WAA2B,EAC3BC,KAAqB,EACrBC,QAAuB,GAAG,IAAI,EAC9BC,OAAsB,GAAG,IAAI,EAC7BC,KAAoB,GAAG,IAAI,EAC3BC,QAAuB,GAAG,IAAI,EAC9BC,YAA2B,GAAG,IAAI,EAClCC,OAAsB,GAAG,IAAI,EAC7BC,QAAuB,GAAG,IAAI,EACN;EACxB,IAAInB,qBAAQ,CAACoB,EAAE,KAAK,KAAK,EAAE;IACzB,OAAO,IAAIC,OAAO,CAAgB,CAACC,OAAO,EAAEC,MAAM,KAAK;MACrD,IAAI;QACFnB,QAAQ,CAACoB,MAAM,CAACd,QAAQ,EAAEC,WAAW,IAAI,EAAE,EAAEC,KAAK,IAAI,EAAE,CAAC;QACzDU,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;MACvB,CAAC,CAAC,OAAOG,KAAK,EAAE;QACdF,MAAM,CAAC,QAAQ,CAAC;MAClB;IACF,CAAC,CAAC;EACJ,CAAC,MAAM;IACL,OAAOnB,QAAQ,CAACoB,MAAM,CAACd,QAAQ,EAAEC,WAAW,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,OAAO,EAAEC,QAAQ,CAAC;EAC3H;AACF;AAEO,SAASO,YAAYA,CAAA,EAAwC;EAClE,OAAOtB,QAAQ,CAACsB,YAAY,CAAC,CAAC;AAChC","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","DojahKyc","NativeModules","Proxy","get","Error","launchDojahKyc","widgetId","referenceId","email","userData","govData","govId","location","businessData","address","metadata","launch","getIdHistory"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,qFAAqF,GACrFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,QAAQ,GAAGC,0BAAa,CAACD,QAAQ,GACnCC,0BAAa,CAACD,QAAQ,GACtB,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,SAASU,cAAcA,CAC5BC,QAAgB,EAChBC,WAA2B,EAC3BC,KAAqB,EACrBC,QAAuB,GAAG,IAAI,EAC9BC,OAAsB,GAAG,IAAI,EAC7BC,KAAoB,GAAG,IAAI,EAC3BC,QAAuB,GAAG,IAAI,EAC9BC,YAA2B,GAAG,IAAI,EAClCC,OAAsB,GAAG,IAAI,EAC7BC,QAAuB,GAAG,IAAI,EACN;EACxB,OAAOf,QAAQ,CAACgB,MAAM,CACpBV,QAAQ,EACRC,WAAW,EACXC,KAAK,EACLC,QAAQ,EACRC,OAAO,EACPC,KAAK,EACLC,QAAQ,EACRC,YAAY,EACZC,OAAO,EACPC,QACF,CAAC;AACH;AAEO,SAASE,YAAYA,CAAA,EAAwC;EAClE,OAAOjB,QAAQ,CAACiB,YAAY,CAAC,CAAC;AAChC","ignoreList":[]}
@@ -24,7 +24,7 @@ const DojahKyc = NativeModules.DojahKyc ? NativeModules.DojahKyc : new Proxy({},
24
24
  * @returns - the Promise of the result
25
25
  * @throws - an error if the Dojah KYC flow fails
26
26
  * @example
27
- *
27
+ *
28
28
  * ```typescript
29
29
  * import { launchDojahKyc } from 'dojah-kyc-sdk-react_native';
30
30
  * const widgetId = 'your-widget-id';
@@ -70,21 +70,10 @@ const DojahKyc = NativeModules.DojahKyc ? NativeModules.DojahKyc : new Proxy({},
70
70
  * console.error('Error: ', error);
71
71
  * });
72
72
  * ```
73
- **/
73
+ **/
74
74
 
75
75
  export function launchDojahKyc(widgetId, referenceId, email, userData = null, govData = null, govId = null, location = null, businessData = null, address = null, metadata = null) {
76
- if (Platform.OS === 'ios') {
77
- return new Promise((resolve, reject) => {
78
- try {
79
- DojahKyc.launch(widgetId, referenceId ?? '', email ?? '');
80
- resolve("launched"); // Adjust this based on the actual return value of DojahKyc.launch
81
- } catch (error) {
82
- reject("closed");
83
- }
84
- });
85
- } else {
86
- return DojahKyc.launch(widgetId, referenceId, email, userData, govData, govId, location, businessData, address, metadata);
87
- }
76
+ return DojahKyc.launch(widgetId, referenceId, email, userData, govData, govId, location, businessData, address, metadata);
88
77
  }
89
78
  export function getIdHistory() {
90
79
  return DojahKyc.getIdHistory();
@@ -1 +1 @@
1
- {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","DojahKyc","Proxy","get","Error","launchDojahKyc","widgetId","referenceId","email","userData","govData","govId","location","businessData","address","metadata","OS","Promise","resolve","reject","launch","error","getIdHistory"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,qFAAqF,GACrFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,QAAQ,GAAGN,aAAa,CAACM,QAAQ,GACnCN,aAAa,CAACM,QAAQ,GACtB,IAAIC,KAAK,CACT,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;;AAEH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASQ,cAAcA,CAC5BC,QAAgB,EAChBC,WAA2B,EAC3BC,KAAqB,EACrBC,QAAuB,GAAG,IAAI,EAC9BC,OAAsB,GAAG,IAAI,EAC7BC,KAAoB,GAAG,IAAI,EAC3BC,QAAuB,GAAG,IAAI,EAC9BC,YAA2B,GAAG,IAAI,EAClCC,OAAsB,GAAG,IAAI,EAC7BC,QAAuB,GAAG,IAAI,EACN;EACxB,IAAInB,QAAQ,CAACoB,EAAE,KAAK,KAAK,EAAE;IACzB,OAAO,IAAIC,OAAO,CAAgB,CAACC,OAAO,EAAEC,MAAM,KAAK;MACrD,IAAI;QACFlB,QAAQ,CAACmB,MAAM,CAACd,QAAQ,EAAEC,WAAW,IAAI,EAAE,EAAEC,KAAK,IAAI,EAAE,CAAC;QACzDU,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;MACvB,CAAC,CAAC,OAAOG,KAAK,EAAE;QACdF,MAAM,CAAC,QAAQ,CAAC;MAClB;IACF,CAAC,CAAC;EACJ,CAAC,MAAM;IACL,OAAOlB,QAAQ,CAACmB,MAAM,CAACd,QAAQ,EAAEC,WAAW,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,OAAO,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,OAAO,EAAEC,QAAQ,CAAC;EAC3H;AACF;AAEA,OAAO,SAASO,YAAYA,CAAA,EAAwC;EAClE,OAAOrB,QAAQ,CAACqB,YAAY,CAAC,CAAC;AAChC","ignoreList":[]}
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","DojahKyc","Proxy","get","Error","launchDojahKyc","widgetId","referenceId","email","userData","govData","govId","location","businessData","address","metadata","launch","getIdHistory"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,qFAAqF,GACrFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,QAAQ,GAAGN,aAAa,CAACM,QAAQ,GACnCN,aAAa,CAACM,QAAQ,GACtB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;;AAEL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASQ,cAAcA,CAC5BC,QAAgB,EAChBC,WAA2B,EAC3BC,KAAqB,EACrBC,QAAuB,GAAG,IAAI,EAC9BC,OAAsB,GAAG,IAAI,EAC7BC,KAAoB,GAAG,IAAI,EAC3BC,QAAuB,GAAG,IAAI,EAC9BC,YAA2B,GAAG,IAAI,EAClCC,OAAsB,GAAG,IAAI,EAC7BC,QAAuB,GAAG,IAAI,EACN;EACxB,OAAOd,QAAQ,CAACe,MAAM,CACpBV,QAAQ,EACRC,WAAW,EACXC,KAAK,EACLC,QAAQ,EACRC,OAAO,EACPC,KAAK,EACLC,QAAQ,EACRC,YAAY,EACZC,OAAO,EACPC,QACF,CAAC;AACH;AAEA,OAAO,SAASE,YAAYA,CAAA,EAAwC;EAClE,OAAOhB,QAAQ,CAACgB,YAAY,CAAC,CAAC;AAChC","ignoreList":[]}
@@ -59,7 +59,7 @@
59
59
  * console.error('Error: ', error);
60
60
  * });
61
61
  * ```
62
- **/
62
+ **/
63
63
  export declare function launchDojahKyc(widgetId: string, referenceId?: string | null, email?: string | null, userData?: Object | null, govData?: Object | null, govId?: Object | null, location?: Object | null, businessData?: Object | null, address?: string | null, metadata?: Object | null): Promise<string | null>;
64
64
  export declare function getIdHistory(): Promise<Map<string, string> | null>;
65
65
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,EAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,QAAQ,GAAE,MAAM,GAAG,IAAW,EAC9B,OAAO,GAAE,MAAM,GAAG,IAAW,EAC7B,KAAK,GAAE,MAAM,GAAG,IAAW,EAC3B,QAAQ,GAAE,MAAM,GAAG,IAAW,EAC9B,YAAY,GAAE,MAAM,GAAG,IAAW,EAClC,OAAO,GAAE,MAAM,GAAG,IAAW,EAC7B,QAAQ,GAAE,MAAM,GAAG,IAAW,GAC7B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAaxB;AAED,wBAAgB,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAElE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAmBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA6DI;AAEJ,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,EAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,EACrB,QAAQ,GAAE,MAAM,GAAG,IAAW,EAC9B,OAAO,GAAE,MAAM,GAAG,IAAW,EAC7B,KAAK,GAAE,MAAM,GAAG,IAAW,EAC3B,QAAQ,GAAE,MAAM,GAAG,IAAW,EAC9B,YAAY,GAAE,MAAM,GAAG,IAAW,EAClC,OAAO,GAAE,MAAM,GAAG,IAAW,EAC7B,QAAQ,GAAE,MAAM,GAAG,IAAW,GAC7B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAaxB;AAED,wBAAgB,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC,CAElE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dojah-kyc-sdk-react_native",
3
- "version": "0.0.8-dev",
3
+ "version": "0.0.9",
4
4
  "description": "Dojah SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
package/src/index.tsx CHANGED
@@ -9,13 +9,13 @@ const LINKING_ERROR =
9
9
  const DojahKyc = NativeModules.DojahKyc
10
10
  ? NativeModules.DojahKyc
11
11
  : new Proxy(
12
- {},
13
- {
14
- get() {
15
- throw new Error(LINKING_ERROR);
16
- },
17
- }
18
- );
12
+ {},
13
+ {
14
+ get() {
15
+ throw new Error(LINKING_ERROR);
16
+ },
17
+ }
18
+ );
19
19
 
20
20
  /**
21
21
  * Launches the Dojah KYC flow
@@ -32,7 +32,7 @@ const DojahKyc = NativeModules.DojahKyc
32
32
  * @returns - the Promise of the result
33
33
  * @throws - an error if the Dojah KYC flow fails
34
34
  * @example
35
- *
35
+ *
36
36
  * ```typescript
37
37
  * import { launchDojahKyc } from 'dojah-kyc-sdk-react_native';
38
38
  * const widgetId = 'your-widget-id';
@@ -78,7 +78,7 @@ const DojahKyc = NativeModules.DojahKyc
78
78
  * console.error('Error: ', error);
79
79
  * });
80
80
  * ```
81
- **/
81
+ **/
82
82
 
83
83
  export function launchDojahKyc(
84
84
  widgetId: string,
@@ -92,18 +92,18 @@ export function launchDojahKyc(
92
92
  address: string | null = null,
93
93
  metadata: Object | null = null
94
94
  ): Promise<string | null> {
95
- if (Platform.OS === 'ios') {
96
- return new Promise<string | null>((resolve, reject) => {
97
- try {
98
- DojahKyc.launch(widgetId, referenceId ?? '', email ?? '');
99
- resolve("launched"); // Adjust this based on the actual return value of DojahKyc.launch
100
- } catch (error) {
101
- reject("closed");
102
- }
103
- });
104
- } else {
105
- return DojahKyc.launch(widgetId, referenceId, email, userData, govData, govId, location, businessData, address, metadata);
106
- }
95
+ return DojahKyc.launch(
96
+ widgetId,
97
+ referenceId,
98
+ email,
99
+ userData,
100
+ govData,
101
+ govId,
102
+ location,
103
+ businessData,
104
+ address,
105
+ metadata
106
+ );
107
107
  }
108
108
 
109
109
  export function getIdHistory(): Promise<Map<string, string> | null> {