dojah-kyc-sdk-react_native 0.0.8 → 0.1.0
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 +125 -6
- package/android/build.gradle +3 -1
- package/android/proguard-rules.pro +50 -0
- package/android/src/main/AndroidManifest.xml +1 -1
- package/android/src/main/java/com/dojahkyc/{DojahKycModule.kt → rn/DojahKycModule.kt} +3 -8
- package/android/src/main/java/com/dojahkyc/{DojahKycPackage.kt → rn/DojahKycPackage.kt} +1 -1
- package/ios/DojahKyc.mm +15 -8
- package/ios/DojahKyc.swift +169 -50
- package/lib/commonjs/index.js +1 -5
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +1 -5
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +12 -16
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
|
+
```
|
package/android/build.gradle
CHANGED
|
@@ -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,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
|
|
package/ios/DojahKyc.mm
CHANGED
|
@@ -20,13 +20,20 @@
|
|
|
20
20
|
|
|
21
21
|
RCT_EXTERN_METHOD(initialize:(NSString)appName)
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
RCT_EXTERN_METHOD(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
//launch:withReferenceId:withEmail:withUserData:withGovData:withGovId:withLocation:withBuisnessData:withAddress:withMetaData:resolver:rejecter:
|
|
24
|
+
RCT_EXTERN_METHOD(
|
|
25
|
+
launch:(NSString *)widgetId
|
|
26
|
+
withReferenceId:(NSString *)referenceId
|
|
27
|
+
withEmail:(NSString *)email
|
|
28
|
+
withUserData:(NSDictionary *)userData
|
|
29
|
+
withGovData:(NSDictionary *)govData
|
|
30
|
+
withGovId:(NSDictionary *)govId
|
|
31
|
+
withLocation:(NSDictionary *)location
|
|
32
|
+
withBuisnessData:(NSDictionary *)businessData
|
|
33
|
+
withAddress:(NSString *)address
|
|
34
|
+
withMetaData:(NSDictionary *)metadata
|
|
35
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
36
|
+
rejecter:(RCTPromiseRejectBlock)reject
|
|
37
|
+
)
|
|
31
38
|
@end
|
|
32
39
|
|
package/ios/DojahKyc.swift
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
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,129 @@ class DojahKyc: RCTEventEmitter, RCTBridgeDelegate {
|
|
|
48
84
|
}else{
|
|
49
85
|
print("bridge is null")
|
|
50
86
|
}
|
|
51
|
-
|
|
52
|
-
|
|
87
|
+
|
|
88
|
+
|
|
53
89
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
func launch(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@objc(launch:withReferenceId:withEmail:withUserData:withGovData:withGovId:withLocation:withBuisnessData:withAddress:withMetaData:resolver:rejecter:)
|
|
93
|
+
func launch(
|
|
94
|
+
_ widgetId:String,
|
|
95
|
+
withReferenceId referenceId:String,
|
|
96
|
+
withEmail email:String,
|
|
97
|
+
withUserData userData : NSDictionary? = nil,
|
|
98
|
+
withGovData govData: NSDictionary? = nil,
|
|
99
|
+
withGovId govId: NSDictionary? = nil,
|
|
100
|
+
withLocation location: NSDictionary? = nil,
|
|
101
|
+
withBuisnessData businessData: NSDictionary? = nil,
|
|
102
|
+
withAddress address: String = "",
|
|
103
|
+
withMetaData metadata: NSDictionary? = nil,
|
|
104
|
+
resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
105
|
+
rejecter reject: @escaping RCTPromiseRejectBlock
|
|
106
|
+
) {
|
|
107
|
+
navDelegate.setOnDidShow { vc in
|
|
108
|
+
print("onDidShow: \(vc)")
|
|
109
|
+
//return result from DojahWidget once verification
|
|
110
|
+
//is done,failed or cancel
|
|
111
|
+
if(!String(describing:vc).contains("DojahWidget")){
|
|
112
|
+
let vStatus = DojahWidgetSDK.getVerificationResultStatus()
|
|
113
|
+
let status = if(vStatus.isEmpty){ "closed"} else {vStatus}
|
|
114
|
+
|
|
115
|
+
resolve(status)
|
|
116
|
+
print("resolve onDidShow: \(vc)")
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
self.prevController = nil
|
|
120
|
+
}else if(String(describing:vc).contains("DojahWidget.DJDisclaimer")
|
|
121
|
+
&& self.prevController != nil){
|
|
122
|
+
self.navCtrl?.popToRootViewController(animated: false)
|
|
123
|
+
}else if(!String(describing:vc).contains("DojahWidget.SDKInitViewController")){
|
|
124
|
+
self.prevController = vc
|
|
125
|
+
}
|
|
63
126
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
if(navCtrl != nil){
|
|
130
|
+
do{
|
|
131
|
+
|
|
132
|
+
DojahWidgetSDK.initialize(
|
|
133
|
+
widgetID: widgetId,
|
|
134
|
+
referenceID: referenceId,
|
|
135
|
+
emailAddress: email,
|
|
136
|
+
extraUserData: ExtraUserData(
|
|
137
|
+
userData: mapToUserBioData(from: userData),
|
|
138
|
+
govData: mapToExtraGovData(from: govData),
|
|
139
|
+
govId: mapToExtraGovIdData(from: govId),
|
|
140
|
+
location: mapToExtraLocationData(from: location),
|
|
141
|
+
businessData: mapToExtraBusinessData(from: businessData),
|
|
142
|
+
metadata: metadata as? [String : Any]
|
|
143
|
+
),
|
|
144
|
+
navController: navCtrl!)
|
|
145
|
+
|
|
146
|
+
}catch{
|
|
147
|
+
reject("no-launch", "Could not launch Dojah Widget", error)
|
|
148
|
+
}
|
|
149
|
+
}else{
|
|
150
|
+
reject("no-launch", "Could not launch Dojah Widget", nil)
|
|
151
|
+
//throw error status to react native
|
|
77
152
|
print("rootViewController is nil")
|
|
78
153
|
}
|
|
79
|
-
|
|
80
154
|
}
|
|
155
|
+
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
// Mapping functions for each sub-struct
|
|
161
|
+
func mapToUserBioData(from dictionary: NSDictionary?) -> UserBioData? {
|
|
162
|
+
guard let userData = dictionary else { return nil }
|
|
163
|
+
|
|
164
|
+
return UserBioData(
|
|
165
|
+
firstName: userData["first_name"] as? String,
|
|
166
|
+
lastName: userData["last_name"] as? String,
|
|
167
|
+
dob: userData["dob"] as? String,
|
|
168
|
+
email: userData["email"] as? String
|
|
169
|
+
)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
func mapToExtraGovData(from dictionary: NSDictionary?) -> ExtraGovData? {
|
|
173
|
+
guard let govData = dictionary else { return nil }
|
|
81
174
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
// // }else{
|
|
89
|
-
// // resolve("launched 0")
|
|
90
|
-
// // }
|
|
91
|
-
// resolve("launched")
|
|
92
|
-
// }
|
|
175
|
+
return ExtraGovData(
|
|
176
|
+
bvn: govData["bvn"] as? String,
|
|
177
|
+
dl: govData["dl"] as? String,
|
|
178
|
+
nin: govData["nin"] as? String,
|
|
179
|
+
vnin: govData["vnin"] as? String
|
|
180
|
+
)
|
|
93
181
|
}
|
|
182
|
+
|
|
183
|
+
func mapToExtraGovIdData(from dictionary: NSDictionary?) -> ExtraGovIdData? {
|
|
184
|
+
guard let govId = dictionary else { return nil }
|
|
185
|
+
|
|
186
|
+
return ExtraGovIdData(
|
|
187
|
+
national: govId["national"] as? String,
|
|
188
|
+
passport: govId["passport"] as? String,
|
|
189
|
+
dl: govId["dl"] as? String,
|
|
190
|
+
voter: govId["voter"] as? String,
|
|
191
|
+
nin: govId["nin"] as? String,
|
|
192
|
+
others: govId["others"] as? String
|
|
193
|
+
)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
func mapToExtraLocationData(from dictionary: NSDictionary?) -> ExtraLocationData? {
|
|
197
|
+
guard let location = dictionary else { return nil }
|
|
198
|
+
|
|
199
|
+
return ExtraLocationData(
|
|
200
|
+
longitude: location["longitude"] as? String,
|
|
201
|
+
latitude: location["latitude"] as? String
|
|
202
|
+
)
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
func mapToExtraBusinessData(from dictionary: NSDictionary?) -> ExtraBusinessData? {
|
|
206
|
+
guard let businessData = dictionary else { return nil }
|
|
207
|
+
|
|
208
|
+
return ExtraBusinessData(
|
|
209
|
+
cac: businessData["cac"] as? String
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
|
package/lib/commonjs/index.js
CHANGED
|
@@ -80,11 +80,7 @@ const DojahKyc = _reactNative.NativeModules.DojahKyc ? _reactNative.NativeModule
|
|
|
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
|
-
|
|
84
|
-
return DojahKyc.launch(widgetId, referenceId ?? '', email ?? '');
|
|
85
|
-
} else {
|
|
86
|
-
return DojahKyc.launch(widgetId, referenceId, email, userData, govData, govId, location, businessData, address, metadata);
|
|
87
|
-
}
|
|
83
|
+
return DojahKyc.launch(widgetId, referenceId, email, userData, govData, govId, location, businessData, address, metadata);
|
|
88
84
|
}
|
|
89
85
|
function getIdHistory() {
|
|
90
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","
|
|
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":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -73,11 +73,7 @@ const DojahKyc = NativeModules.DojahKyc ? NativeModules.DojahKyc : new Proxy({},
|
|
|
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
|
-
|
|
77
|
-
return DojahKyc.launch(widgetId, referenceId ?? '', email ?? '');
|
|
78
|
-
} else {
|
|
79
|
-
return DojahKyc.launch(widgetId, referenceId, email, userData, govData, govId, location, businessData, address, metadata);
|
|
80
|
-
}
|
|
76
|
+
return DojahKyc.launch(widgetId, referenceId, email, userData, govData, govId, location, businessData, address, metadata);
|
|
81
77
|
}
|
|
82
78
|
export function getIdHistory() {
|
|
83
79
|
return DojahKyc.getIdHistory();
|
package/lib/module/index.js.map
CHANGED
|
@@ -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","
|
|
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":[]}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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
package/src/index.tsx
CHANGED
|
@@ -92,22 +92,18 @@ export function launchDojahKyc(
|
|
|
92
92
|
address: string | null = null,
|
|
93
93
|
metadata: Object | null = null
|
|
94
94
|
): Promise<string | null> {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
address,
|
|
108
|
-
metadata
|
|
109
|
-
);
|
|
110
|
-
}
|
|
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
|
+
);
|
|
111
107
|
}
|
|
112
108
|
|
|
113
109
|
export function getIdHistory(): Promise<Map<string, string> | null> {
|