@smile_identity/react-native 10.2.4 → 10.2.6
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/android/build.gradle +2 -1
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/smileidentity/react/Mapper.kt +7 -2
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDBiometricKYCViewManager.kt +10 -3
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDDocumentVerificationViewManager.kt +1 -1
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDEnhancedDocumentVerificationViewManager.kt +13 -5
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieAuthenticationEnhancedViewManager.kt +1 -0
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieCaptureViewManager.kt +1 -0
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieEnrollmentEnhancedViewManager.kt +1 -0
- package/android/src/main/java/com/smileidentity/react/views/SmileIDBiometricKYCView.kt +2 -0
- package/android/src/main/java/com/smileidentity/react/views/SmileIDDocumentVerificationView.kt +2 -0
- package/android/src/main/java/com/smileidentity/react/views/SmileIDEnhancedDocumentVerificationView.kt +2 -0
- package/android/src/main/java/com/smileidentity/react/views/SmileIDSelfieView.kt +48 -0
- package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieAuthenticationEnhancedView.kt +5 -30
- package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieAuthenticationView.kt +7 -32
- package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieCaptureView.kt +30 -189
- package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieEnrollmentEnhancedView.kt +5 -35
- package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieEnrollmentView.kt +7 -40
- package/ios/RNSmileID.swift +19 -0
- package/ios/Utils/SmileIDDictExt.swift +242 -216
- package/ios/Utils/SmileIDUtils.swift +9 -0
- package/ios/View/SmileIDBiometricKYCView.swift +4 -2
- package/ios/View/SmileIDConsentView.swift +1 -1
- package/ios/View/SmileIDDocumentCaptureView.swift +2 -2
- package/ios/View/SmileIDDocumentVerificationView.swift +2 -1
- package/ios/View/SmileIDEnhancedDocumentVerificationView.swift +3 -1
- package/ios/View/SmileIDSmartSelfieAuthEnhancedView.swift +35 -34
- package/ios/View/SmileIDSmartSelfieAuthView.swift +3 -1
- package/ios/View/SmileIDSmartSelfieCaptureView.swift +28 -34
- package/ios/View/SmileIDSmartSelfieEnrollmentEnhancedView.swift +2 -1
- package/ios/View/SmileIDSmartSelfieEnrollmentView.swift +1 -1
- package/ios/ViewManagers/SmileIDBaseViewManager.swift +1 -1
- package/ios/ViewManagers/SmileIDBiometricKYCViewManager.swift +35 -24
- package/ios/ViewManagers/SmileIDDocumentVerificationViewManager.swift +1 -0
- package/ios/ViewManagers/SmileIDEnhancedDocumentVerificationViewManager.swift +52 -40
- package/ios/ViewManagers/SmileIDSmartSelfieAuthenticationEnhancedViewManager.swift +7 -2
- package/ios/ViewManagers/SmileIDSmartSelfieCaptureViewManager.swift +1 -0
- package/ios/ViewManagers/SmileIDSmartSelfieEnrollmentEnhancedViewManager.swift +1 -0
- package/ios/ViewModels/SmileIDProductModel.swift +29 -22
- package/lib/commonjs/SmileIDBiometricKYCView.js +2 -11
- package/lib/commonjs/SmileIDBiometricKYCView.js.map +1 -1
- package/lib/commonjs/SmileIDEnhancedDocumentVerificationView.js +2 -11
- package/lib/commonjs/SmileIDEnhancedDocumentVerificationView.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js +33 -2
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/SmileIDBiometricKYCView.js +2 -11
- package/lib/module/SmileIDBiometricKYCView.js.map +1 -1
- package/lib/module/SmileIDEnhancedDocumentVerificationView.js +2 -11
- package/lib/module/SmileIDEnhancedDocumentVerificationView.js.map +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +31 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/SmileIDBiometricKYCView.d.ts.map +1 -1
- package/lib/typescript/SmileIDEnhancedDocumentVerificationView.d.ts +2 -2
- package/lib/typescript/SmileIDEnhancedDocumentVerificationView.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +2 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +19 -4
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-smile-id.podspec +1 -1
- package/src/SmileIDBiometricKYCView.tsx +2 -9
- package/src/SmileIDEnhancedDocumentVerificationView.tsx +6 -16
- package/src/index.tsx +2 -0
- package/src/types.ts +66 -4
|
@@ -8,3 +8,12 @@ extension String {
|
|
|
8
8
|
return false
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
func getCurrentIsoTimestamp() -> String {
|
|
13
|
+
let pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"
|
|
14
|
+
let formatter = DateFormatter()
|
|
15
|
+
formatter.dateFormat = pattern
|
|
16
|
+
formatter.locale = Locale(identifier: "en_US")
|
|
17
|
+
formatter.timeZone = TimeZone(identifier: "UTC")
|
|
18
|
+
return formatter.string(from: Date())
|
|
19
|
+
}
|
|
@@ -10,14 +10,16 @@ struct SmileIDBiometricKYCView: View, SmileIDFileUtilsProtocol {
|
|
|
10
10
|
NavigationView {
|
|
11
11
|
if let idInfo = product.idInfo {
|
|
12
12
|
SmileID.biometricKycScreen(
|
|
13
|
-
idInfo: idInfo,
|
|
13
|
+
idInfo: idInfo,
|
|
14
14
|
userId: product.userId ?? generateUserId(),
|
|
15
15
|
jobId: product.jobId ?? generateJobId(),
|
|
16
16
|
allowNewEnroll: product.allowNewEnroll,
|
|
17
17
|
allowAgentMode: product.allowAgentMode,
|
|
18
18
|
showAttribution: product.showAttribution,
|
|
19
19
|
showInstructions: product.showInstructions,
|
|
20
|
+
useStrictMode: product.useStrictMode,
|
|
20
21
|
extraPartnerParams: product.extraPartnerParams as [String: String],
|
|
22
|
+
consentInformation: product.consentInformation, // already validated in the SmileIDBiometricKYCViewManager
|
|
21
23
|
delegate: self
|
|
22
24
|
)
|
|
23
25
|
} else {
|
|
@@ -58,6 +60,6 @@ extension SmileIDBiometricKYCView: BiometricKycResultDelegate {
|
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
func didError(error: Error) {
|
|
61
|
-
smileIDUIViewDelegate.onError(error: error
|
|
63
|
+
smileIDUIViewDelegate.onError(error: error)
|
|
62
64
|
}
|
|
63
65
|
}
|
|
@@ -20,7 +20,7 @@ struct SmileIDConsentView: View {
|
|
|
20
20
|
productName: productName,
|
|
21
21
|
partnerPrivacyPolicy: URL(string: partnerPrivacyPolicy)!,
|
|
22
22
|
showAttribution: true,
|
|
23
|
-
onConsentGranted: {
|
|
23
|
+
onConsentGranted: { _ in
|
|
24
24
|
DispatchQueue.main.async {
|
|
25
25
|
self.product.onResult?(["result": true])
|
|
26
26
|
}
|
|
@@ -68,12 +68,12 @@ struct SmileIDDocumentCaptureView: View {
|
|
|
68
68
|
|
|
69
69
|
} catch {
|
|
70
70
|
// Handle file creation error
|
|
71
|
-
|
|
71
|
+
smileIDUIViewDelegate.onError(error: SmileIDError.unknown("Error creating document file: \(error.localizedDescription)"))
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
func onError(error: Error) {
|
|
76
|
-
smileIDUIViewDelegate.onError(error: error
|
|
76
|
+
smileIDUIViewDelegate.onError(error: error)
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
func onSkip() {
|
|
@@ -23,6 +23,7 @@ struct SmileIDDocumentVerificationView: View, SmileIDFileUtilsProtocol {
|
|
|
23
23
|
showInstructions: product.showInstructions,
|
|
24
24
|
showAttribution: product.showAttribution,
|
|
25
25
|
skipApiSubmission: product.skipApiSubmission,
|
|
26
|
+
useStrictMode: product.useStrictMode,
|
|
26
27
|
extraPartnerParams: product.extraPartnerParams as [String: String],
|
|
27
28
|
delegate: self
|
|
28
29
|
)
|
|
@@ -56,6 +57,6 @@ extension SmileIDDocumentVerificationView: DocumentVerificationResultDelegate {
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
func didError(error: Error) {
|
|
59
|
-
smileIDUIViewDelegate.onError(error: error
|
|
60
|
+
smileIDUIViewDelegate.onError(error: error)
|
|
60
61
|
}
|
|
61
62
|
}
|
|
@@ -23,7 +23,9 @@ struct SmileIDEnhancedDocumentVerificationView: View, SmileIDFileUtilsProtocol {
|
|
|
23
23
|
showInstructions: product.showInstructions,
|
|
24
24
|
skipApiSubmission: product.skipApiSubmission,
|
|
25
25
|
showAttribution: product.showAttribution,
|
|
26
|
+
useStrictMode: product.useStrictMode,
|
|
26
27
|
extraPartnerParams: product.extraPartnerParams as [String: String],
|
|
28
|
+
consentInformation: product.consentInformation,
|
|
27
29
|
delegate: self
|
|
28
30
|
)
|
|
29
31
|
} else {
|
|
@@ -56,6 +58,6 @@ extension SmileIDEnhancedDocumentVerificationView: EnhancedDocumentVerificationR
|
|
|
56
58
|
}
|
|
57
59
|
|
|
58
60
|
func didError(error: Error) {
|
|
59
|
-
smileIDUIViewDelegate.onError(error: error
|
|
61
|
+
smileIDUIViewDelegate.onError(error: error)
|
|
60
62
|
}
|
|
61
63
|
}
|
|
@@ -3,43 +3,44 @@ import SmileID
|
|
|
3
3
|
import SwiftUI
|
|
4
4
|
|
|
5
5
|
struct SmileIDSmartSelfieAuthEnhancedView: View, SmileIDFileUtilsProtocol {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
6
|
+
var fileManager: FileManager = Foundation.FileManager.default
|
|
7
|
+
@ObservedObject var product: SmileIDProductModel
|
|
8
|
+
var smileIDUIViewDelegate: SmileIDUIViewDelegate
|
|
9
|
+
var body: some View {
|
|
10
|
+
NavigationView {
|
|
11
|
+
SmileID.smartSelfieAuthenticationScreenEnhanced(
|
|
12
|
+
userId: product.userId ?? generateUserId(),
|
|
13
|
+
allowNewEnroll: product.allowNewEnroll,
|
|
14
|
+
showAttribution: product.showAttribution,
|
|
15
|
+
showInstructions: product.showInstructions,
|
|
16
|
+
skipApiSubmission: product.skipApiSubmission,
|
|
17
|
+
extraPartnerParams: product.extraPartnerParams as [String: String],
|
|
18
|
+
delegate: self
|
|
19
|
+
)
|
|
20
|
+
}.navigationViewStyle(StackNavigationViewStyle())
|
|
21
|
+
}
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
extension SmileIDSmartSelfieAuthEnhancedView: SmartSelfieResultDelegate {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
guard let jsonData = try? JSONSerialization.data(withJSONObject: params.toJSONCompatibleDictionary(), options: .prettyPrinted) else {
|
|
36
|
-
smileIDUIViewDelegate.onError(error: SmileIDError.unknown("SmileIDSmartSelfieAuthView encoding error"))
|
|
37
|
-
return
|
|
38
|
-
}
|
|
39
|
-
smileIDUIViewDelegate.onResult(smileResult: String(data: jsonData, encoding: .utf8)!)
|
|
25
|
+
func didSucceed(selfieImage: URL, livenessImages: [URL], apiResponse: SmartSelfieResponse?) {
|
|
26
|
+
var params: [String: Any] = [
|
|
27
|
+
"selfieFile": getFilePath(fileName: selfieImage.absoluteString),
|
|
28
|
+
"livenessFiles": livenessImages.map {
|
|
29
|
+
getFilePath(fileName: $0.absoluteString)
|
|
30
|
+
},
|
|
31
|
+
]
|
|
32
|
+
if let apiResponse = apiResponse {
|
|
33
|
+
params["apiResponse"] = apiResponse
|
|
40
34
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
|
|
36
|
+
guard let jsonData = try? JSONSerialization.data(withJSONObject: params.toJSONCompatibleDictionary(), options: .prettyPrinted) else {
|
|
37
|
+
smileIDUIViewDelegate.onError(error: SmileIDError.unknown("SmileIDSmartSelfieAuthView encoding error"))
|
|
38
|
+
return
|
|
44
39
|
}
|
|
40
|
+
smileIDUIViewDelegate.onResult(smileResult: String(data: jsonData, encoding: .utf8)!)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
func didError(error: Error) {
|
|
44
|
+
smileIDUIViewDelegate.onError(error: error)
|
|
45
|
+
}
|
|
45
46
|
}
|
|
@@ -10,10 +10,12 @@ struct SmileIDSmartSelfieAuthView: View, SmileIDFileUtilsProtocol {
|
|
|
10
10
|
NavigationView {
|
|
11
11
|
SmileID.smartSelfieAuthenticationScreen(
|
|
12
12
|
userId: product.userId ?? generateUserId(),
|
|
13
|
+
jobId: product.jobId ?? generateJobId(),
|
|
13
14
|
allowNewEnroll: product.allowNewEnroll,
|
|
14
15
|
allowAgentMode: product.allowAgentMode,
|
|
15
16
|
showAttribution: product.showAttribution,
|
|
16
17
|
showInstructions: product.showInstructions,
|
|
18
|
+
skipApiSubmission: product.skipApiSubmission,
|
|
17
19
|
extraPartnerParams: product.extraPartnerParams as [String: String],
|
|
18
20
|
delegate: self
|
|
19
21
|
)
|
|
@@ -41,6 +43,6 @@ extension SmileIDSmartSelfieAuthView: SmartSelfieResultDelegate {
|
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
func didError(error: Error) {
|
|
44
|
-
smileIDUIViewDelegate.onError(error: error
|
|
46
|
+
smileIDUIViewDelegate.onError(error: error)
|
|
45
47
|
}
|
|
46
48
|
}
|
|
@@ -11,41 +11,35 @@ struct SmileIDSmartSelfieCaptureView: View, SmileIDFileUtilsProtocol {
|
|
|
11
11
|
|
|
12
12
|
var body: some View {
|
|
13
13
|
NavigationView {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
SelfieCaptureScreen(
|
|
42
|
-
viewModel: viewModel,
|
|
43
|
-
allowAgentMode: self.product.allowAgentMode
|
|
44
|
-
).preferredColorScheme(.light)
|
|
45
|
-
}
|
|
14
|
+
selfieCaptureScreen
|
|
15
|
+
}.navigationViewStyle(StackNavigationViewStyle())
|
|
16
|
+
.padding()
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private var selfieCaptureScreen: some View {
|
|
20
|
+
Group {
|
|
21
|
+
if product.useStrictMode {
|
|
22
|
+
SmileID.smartSelfieEnrollmentScreenEnhanced(
|
|
23
|
+
userId: product.userId ?? generateUserId(),
|
|
24
|
+
showAttribution: product.showAttribution,
|
|
25
|
+
showInstructions: product.showInstructions,
|
|
26
|
+
skipApiSubmission: true,
|
|
27
|
+
extraPartnerParams: product.extraPartnerParams,
|
|
28
|
+
delegate: self
|
|
29
|
+
)
|
|
30
|
+
} else {
|
|
31
|
+
SmileID.smartSelfieEnrollmentScreen(
|
|
32
|
+
userId: product.userId ?? generateUserId(),
|
|
33
|
+
jobId: product.jobId ?? generateJobId(),
|
|
34
|
+
allowAgentMode: product.allowAgentMode,
|
|
35
|
+
showAttribution: product.showAttribution,
|
|
36
|
+
showInstructions: product.showInstructions,
|
|
37
|
+
skipApiSubmission: true,
|
|
38
|
+
extraPartnerParams: product.extraPartnerParams,
|
|
39
|
+
delegate: self
|
|
40
|
+
)
|
|
46
41
|
}
|
|
47
42
|
}
|
|
48
|
-
.navigationViewStyle(StackNavigationViewStyle()).padding()
|
|
49
43
|
}
|
|
50
44
|
}
|
|
51
45
|
|
|
@@ -66,6 +60,6 @@ extension SmileIDSmartSelfieCaptureView: SmartSelfieResultDelegate {
|
|
|
66
60
|
}
|
|
67
61
|
|
|
68
62
|
func didError(error: Error) {
|
|
69
|
-
smileIDUIViewDelegate.onError(error: error
|
|
63
|
+
smileIDUIViewDelegate.onError(error: error)
|
|
70
64
|
}
|
|
71
65
|
}
|
|
@@ -13,6 +13,7 @@ struct SmileIDSmartSelfieEnrollmentEnhancedView: View, SmileIDFileUtilsProtocol
|
|
|
13
13
|
allowNewEnroll: product.allowNewEnroll,
|
|
14
14
|
showAttribution: product.showAttribution,
|
|
15
15
|
showInstructions: product.showInstructions,
|
|
16
|
+
skipApiSubmission: product.skipApiSubmission,
|
|
16
17
|
extraPartnerParams: product.extraPartnerParams as [String: String],
|
|
17
18
|
delegate: self
|
|
18
19
|
)
|
|
@@ -40,6 +41,6 @@ extension SmileIDSmartSelfieEnrollmentEnhancedView: SmartSelfieResultDelegate {
|
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
func didError(error: Error) {
|
|
43
|
-
smileIDUIViewDelegate.onError(error: error
|
|
44
|
+
smileIDUIViewDelegate.onError(error: error)
|
|
44
45
|
}
|
|
45
46
|
}
|
|
@@ -22,7 +22,7 @@ class SmileIDBaseViewManager: RCTViewManager, SmileIDUIViewDelegate {
|
|
|
22
22
|
func onError(error: any Error) {
|
|
23
23
|
bridge.eventDispatcher().sendDeviceEvent(
|
|
24
24
|
withName: "onSmileResult",
|
|
25
|
-
body: ["error": error]
|
|
25
|
+
body: ["error": error.localizedDescription]
|
|
26
26
|
)
|
|
27
27
|
}
|
|
28
28
|
|
|
@@ -5,30 +5,41 @@ import SwiftUI
|
|
|
5
5
|
|
|
6
6
|
@objc(SmileIDBiometricKYCViewManager)
|
|
7
7
|
class SmileIDBiometricKYCViewManager: SmileIDBaseViewManager {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
8
|
+
override func getView() -> UIView {
|
|
9
|
+
BaseSmileIDView(frame: .zero, contentView: AnyView(SmileIDBiometricKYCView(product: product, smileIDUIViewDelegate: self)), product: product)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@objc func setParams(_ node: NSNumber, commandId _: NSNumber, params: NSDictionary) {
|
|
13
|
+
/* UI Updates on the Main Thread:async ensures that the UI update is scheduled to run on the next cycle of the run loop, preventing any potential blocking of the UI if the update were to take a noticeable amount of time
|
|
14
|
+
*/
|
|
15
|
+
DispatchQueue.main.async {
|
|
16
|
+
if let component = self.bridge.uiManager.view(forReactTag: node) as? BaseSmileIDView {
|
|
17
|
+
let onResult = params["onResult"] as? RCTDirectEventBlock
|
|
18
|
+
guard let idInfo = params["idInfo"] as? NSDictionary else {
|
|
19
|
+
onResult?(["error": SmileIDError.unknown("idInfo is required to run Biometric KYC")])
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
if let consentInformation = params["consentInformation"] as? NSDictionary{
|
|
23
|
+
self.product.consentInformation = consentInformation.toConsentInfo()
|
|
24
|
+
} else {
|
|
25
|
+
self.product.consentInformation = ConsentInformation(
|
|
26
|
+
consentGrantedDate: getCurrentIsoTimestamp(),
|
|
27
|
+
personalDetailsConsentGranted: false,
|
|
28
|
+
contactInformationConsentGranted: false,
|
|
29
|
+
documentInformationConsentGranted: false
|
|
30
|
+
)
|
|
32
31
|
}
|
|
32
|
+
self.product.extraPartnerParams = params["extraPartnerParams"] as? [String: String] ?? [:]
|
|
33
|
+
self.product.userId = params["userId"] as? String
|
|
34
|
+
self.product.jobId = params["jobId"] as? String
|
|
35
|
+
self.product.allowNewEnroll = params["allowNewEnroll"] as? Bool ?? false
|
|
36
|
+
self.product.allowAgentMode = params["allowAgentMode"] as? Bool ?? false
|
|
37
|
+
self.product.showAttribution = params["showAttribution"] as? Bool ?? true
|
|
38
|
+
self.product.showInstructions = params["showInstructions"] as? Bool ?? true
|
|
39
|
+
self.product.useStrictMode = params["useStrictMode"] as? Bool ?? false
|
|
40
|
+
self.product.idInfo = idInfo.toIdInfo()
|
|
41
|
+
self.product.onResult = onResult
|
|
42
|
+
}
|
|
33
43
|
}
|
|
44
|
+
}
|
|
34
45
|
}
|
|
@@ -43,6 +43,7 @@ class SmileIDDocumentVerificationViewManager: SmileIDBaseViewManager {
|
|
|
43
43
|
self.product.captureBothSides = params["captureBothSides"] as? Bool ?? true
|
|
44
44
|
self.product.allowGalleryUpload = params["allowGalleryUpload"] as? Bool ?? false
|
|
45
45
|
self.product.skipApiSubmission = params["skipApiSubmission"] as? Bool ?? false
|
|
46
|
+
self.product.useStrictMode = params["useStrictMode"] as? Bool ?? false
|
|
46
47
|
self.product.onResult = params["onResult"] as? RCTDirectEventBlock
|
|
47
48
|
}
|
|
48
49
|
}
|
|
@@ -5,46 +5,58 @@ import SwiftUI
|
|
|
5
5
|
|
|
6
6
|
@objc(SmileIDEnhancedDocumentVerificationViewManager)
|
|
7
7
|
class SmileIDEnhancedDocumentVerificationViewManager: SmileIDBaseViewManager {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
self.product.idAspectRatio = params["idAspectRatio"] as? Double
|
|
42
|
-
self.product.bypassSelfieCaptureWithFilePath = bypassSelfieCaptureWithFilePath
|
|
43
|
-
self.product.captureBothSides = params["captureBothSides"] as? Bool ?? true
|
|
44
|
-
self.product.allowGalleryUpload = params["allowGalleryUpload"] as? Bool ?? false
|
|
45
|
-
self.product.skipApiSubmission = params["skipApiSubmission"] as? Bool ?? false
|
|
46
|
-
self.product.onResult = params["onResult"] as? RCTDirectEventBlock
|
|
47
|
-
}
|
|
8
|
+
override func getView() -> UIView {
|
|
9
|
+
BaseSmileIDView(frame: .zero, contentView: AnyView(SmileIDEnhancedDocumentVerificationView(product: product, smileIDUIViewDelegate: self)), product: product)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@objc func setParams(_ node: NSNumber, commandId _: NSNumber, params: NSDictionary) {
|
|
13
|
+
/* UI Updates on the Main Thread:async ensures that the UI update is scheduled to run on the next cycle of the run loop, preventing any potential blocking of the UI if the update were to take a noticeable amount of time
|
|
14
|
+
*/
|
|
15
|
+
DispatchQueue.main.async {
|
|
16
|
+
if let component = self.bridge.uiManager.view(forReactTag: node) as? BaseSmileIDView {
|
|
17
|
+
let onResult = params["onResult"] as? RCTDirectEventBlock
|
|
18
|
+
guard let countryCode = params["countryCode"] as? String else {
|
|
19
|
+
onResult?(["error": SmileIDError.unknown("countryCode is required to run Enhanced Document Verification")])
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
var bypassSelfieCaptureWithFilePath: URL?
|
|
24
|
+
if let filePath = params["bypassSelfieCaptureWithFile"] as? String {
|
|
25
|
+
if !filePath.isValidUrl() {
|
|
26
|
+
onResult?(["error": SmileIDError.unknown("bypassSelfieCaptureWithFile must be a valid file url")])
|
|
27
|
+
return
|
|
28
|
+
}
|
|
29
|
+
bypassSelfieCaptureWithFilePath = URL(string: filePath)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if let consentInformation = params["consentInformation"] as? NSDictionary{
|
|
33
|
+
self.product.consentInformation = consentInformation.toConsentInfo()
|
|
34
|
+
} else {
|
|
35
|
+
self.product.consentInformation = ConsentInformation(
|
|
36
|
+
consentGrantedDate: getCurrentIsoTimestamp(),
|
|
37
|
+
personalDetailsConsentGranted: false,
|
|
38
|
+
contactInformationConsentGranted: false,
|
|
39
|
+
documentInformationConsentGranted: false
|
|
40
|
+
)
|
|
48
41
|
}
|
|
42
|
+
|
|
43
|
+
self.product.extraPartnerParams = params["extraPartnerParams"] as? [String: String] ?? [:]
|
|
44
|
+
self.product.userId = params["userId"] as? String
|
|
45
|
+
self.product.jobId = params["jobId"] as? String
|
|
46
|
+
self.product.countryCode = countryCode
|
|
47
|
+
self.product.allowAgentMode = params["allowAgentMode"] as? Bool ?? false
|
|
48
|
+
self.product.allowNewEnroll = params["allowNewEnroll"] as? Bool ?? false
|
|
49
|
+
self.product.showAttribution = params["showAttribution"] as? Bool ?? true
|
|
50
|
+
self.product.showInstructions = params["showInstructions"] as? Bool ?? true
|
|
51
|
+
self.product.documentType = params["documentType"] as? String
|
|
52
|
+
self.product.idAspectRatio = params["idAspectRatio"] as? Double
|
|
53
|
+
self.product.bypassSelfieCaptureWithFilePath = bypassSelfieCaptureWithFilePath
|
|
54
|
+
self.product.captureBothSides = params["captureBothSides"] as? Bool ?? true
|
|
55
|
+
self.product.allowGalleryUpload = params["allowGalleryUpload"] as? Bool ?? false
|
|
56
|
+
self.product.skipApiSubmission = params["skipApiSubmission"] as? Bool ?? false
|
|
57
|
+
self.product.useStrictMode = params["useStrictMode"] as? Bool ?? false
|
|
58
|
+
self.product.onResult = params["onResult"] as? RCTDirectEventBlock
|
|
59
|
+
}
|
|
49
60
|
}
|
|
61
|
+
}
|
|
50
62
|
}
|
|
@@ -5,11 +5,15 @@ import SwiftUI
|
|
|
5
5
|
@objc(SmileIDSmartSelfieAuthenticationEnhancedViewManager)
|
|
6
6
|
class SmileIDSmartSelfieAuthenticationEnhancedViewManager: SmileIDBaseViewManager {
|
|
7
7
|
override func getView() -> UIView {
|
|
8
|
-
BaseSmileIDView(frame: .zero,
|
|
8
|
+
BaseSmileIDView(frame: .zero,
|
|
9
|
+
contentView: AnyView(SmileIDSmartSelfieAuthEnhancedView(product:
|
|
10
|
+
product, smileIDUIViewDelegate: self)), product: product)
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
@objc func setParams(_ node: NSNumber, commandId _: NSNumber, params: NSDictionary) {
|
|
12
|
-
/* UI Updates on the Main Thread:async ensures that the UI update is scheduled to run on the next cycle
|
|
14
|
+
/* UI Updates on the Main Thread:async ensures that the UI update is scheduled to run on the next cycle
|
|
15
|
+
of the run loop, preventing any potential blocking of the UI if the update were to take
|
|
16
|
+
a noticeable amount of time
|
|
13
17
|
*/
|
|
14
18
|
DispatchQueue.main.async {
|
|
15
19
|
if let component = self.bridge.uiManager.view(forReactTag: node) as? BaseSmileIDView {
|
|
@@ -18,6 +22,7 @@ class SmileIDSmartSelfieAuthenticationEnhancedViewManager: SmileIDBaseViewManage
|
|
|
18
22
|
self.product.allowNewEnroll = params["allowNewEnroll"] as? Bool ?? false
|
|
19
23
|
self.product.showAttribution = params["showAttribution"] as? Bool ?? true
|
|
20
24
|
self.product.showInstructions = params["showInstructions"] as? Bool ?? true
|
|
25
|
+
self.product.skipApiSubmission = params["skipApiSubmission"] as? Bool ?? false
|
|
21
26
|
self.product.onResult = params["onResult"] as? RCTDirectEventBlock
|
|
22
27
|
}
|
|
23
28
|
}
|
|
@@ -30,6 +30,7 @@ class SmileIDSmartSelfieCaptureViewManager: SmileIDBaseViewManager {
|
|
|
30
30
|
self.product.showConfirmation = params["showConfirmation"] as? Bool ?? true
|
|
31
31
|
self.product.showInstructions = params["showInstructions"] as? Bool ?? true
|
|
32
32
|
self.product.showAttribution = params["showAttribution"] as? Bool ?? true
|
|
33
|
+
self.product.useStrictMode = params["useStrictMode"] as? Bool ?? false
|
|
33
34
|
self.product.onResult = params["onResult"] as? RCTBubblingEventBlock
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -18,6 +18,7 @@ class SmileIDSmartSelfieEnrollmentEnhancedViewManager: SmileIDBaseViewManager {
|
|
|
18
18
|
self.product.allowNewEnroll = params["allowNewEnroll"] as? Bool ?? false
|
|
19
19
|
self.product.showAttribution = params["showAttribution"] as? Bool ?? true
|
|
20
20
|
self.product.showInstructions = params["showInstructions"] as? Bool ?? true
|
|
21
|
+
self.product.skipApiSubmission = params["skipApiSubmission"] as? Bool ?? false
|
|
21
22
|
self.product.onResult = params["onResult"] as? RCTBubblingEventBlock
|
|
22
23
|
}
|
|
23
24
|
}
|
|
@@ -8,26 +8,33 @@ import SmileID
|
|
|
8
8
|
// when views are instantiated we don't have all the props
|
|
9
9
|
// also state could change
|
|
10
10
|
class SmileIDProductModel: ObservableObject {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
11
|
+
@Published var userId: String?
|
|
12
|
+
@Published var jobId: String?
|
|
13
|
+
@Published var partnerIcon: String?
|
|
14
|
+
@Published var partnerName: String?
|
|
15
|
+
@Published var productName: String?
|
|
16
|
+
@Published var partnerPrivacyPolicy: String?
|
|
17
|
+
@Published var allowAgentMode: Bool = false
|
|
18
|
+
@Published var allowNewEnroll: Bool = false
|
|
19
|
+
@Published var front: Bool = true
|
|
20
|
+
@Published var showConfirmation: Bool = true
|
|
21
|
+
@Published var showAttribution: Bool = true
|
|
22
|
+
@Published var showInstructions: Bool = true
|
|
23
|
+
@Published var skipApiSubmission: Bool = false
|
|
24
|
+
@Published var extraPartnerParams: [String: String] = [:]
|
|
25
|
+
@Published var idAspectRatio: Double?
|
|
26
|
+
@Published var countryCode: String?
|
|
27
|
+
@Published var documentType: String?
|
|
28
|
+
@Published var captureBothSides: Bool = false
|
|
29
|
+
@Published var allowGalleryUpload: Bool = false
|
|
30
|
+
@Published var useStrictMode: Bool = false
|
|
31
|
+
@Published var idInfo: IdInfo?
|
|
32
|
+
@Published var consentInformation: ConsentInformation = ConsentInformation(
|
|
33
|
+
consentGrantedDate: getCurrentIsoTimestamp(),
|
|
34
|
+
personalDetailsConsentGranted: false,
|
|
35
|
+
contactInformationConsentGranted: false,
|
|
36
|
+
documentInformationConsentGranted: false
|
|
37
|
+
)
|
|
38
|
+
@Published var bypassSelfieCaptureWithFilePath: URL?
|
|
39
|
+
@Published var onResult: RCTBubblingEventBlock?
|
|
33
40
|
}
|
|
@@ -9,21 +9,12 @@ var _codegenNativeComponent = _interopRequireDefault(require("react-native/Libra
|
|
|
9
9
|
var _useSmileIDView = require("./useSmileIDView");
|
|
10
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
11
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
|
-
const defaultConsentInfo = {
|
|
13
|
-
consentInformation: {
|
|
14
|
-
timestamp: new Date().toISOString()
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
12
|
const SmileIDBiometricKYCComponent = (0, _codegenNativeComponent.default)('SmileIDBiometricKYCView');
|
|
18
13
|
const SmileIDBiometricKYCView = props => {
|
|
19
|
-
const
|
|
20
|
-
...defaultConsentInfo,
|
|
21
|
-
...props
|
|
22
|
-
};
|
|
23
|
-
const viewRef = (0, _useSmileIDView.useSmileIDView)('SmileIDBiometricKYCView', mergedProps);
|
|
14
|
+
const viewRef = (0, _useSmileIDView.useSmileIDView)('SmileIDBiometricKYCView', props);
|
|
24
15
|
return /*#__PURE__*/_react.default.createElement(SmileIDBiometricKYCComponent, _extends({
|
|
25
16
|
ref: viewRef
|
|
26
|
-
},
|
|
17
|
+
}, props));
|
|
27
18
|
};
|
|
28
19
|
var _default = exports.default = SmileIDBiometricKYCView;
|
|
29
20
|
//# sourceMappingURL=SmileIDBiometricKYCView.js.map
|