@smile_identity/react-native 10.0.0-beta01 → 10.0.0-beta02
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/gradle.properties +1 -1
- package/android/src/main/java/com/smileidentity/react/SmileIdModule.kt +59 -9
- package/android/src/main/java/com/smileidentity/react/SmileIdPackage.kt +4 -2
- package/android/src/main/java/com/smileidentity/react/utils/ReactUtils.kt +16 -10
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDBiometricKYCViewManager.kt +38 -9
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDConsentViewManager.kt +77 -0
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDDocumentVerificationViewManager.kt +43 -9
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDEnhancedDocumentVerificationViewManager.kt +75 -0
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieAuthenticationViewManager.kt +35 -9
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDSmartSelfieEnrollmentViewManager.kt +35 -9
- package/android/src/main/java/com/smileidentity/react/views/SmileIDBiometricKYCView.kt +54 -0
- package/android/src/main/java/com/smileidentity/react/views/SmileIDConsentView.kt +60 -0
- package/android/src/main/java/com/smileidentity/react/views/SmileIDDocumentVerificationView.kt +69 -0
- package/android/src/main/java/com/smileidentity/react/views/SmileIDEnhancedDocumentVerificationView.kt +63 -0
- package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieAuthenticationView.kt +50 -0
- package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieEnrollmentView.kt +49 -0
- package/android/src/main/java/com/smileidentity/react/views/SmileIDView.kt +2 -27
- package/android/src/oldarch/SmileIdSpec.kt +4 -1
- package/ios/RNDelegates/SmileIDUIViewDelegate.swift +4 -0
- package/ios/RNDelegates/SmileIDViewDelegate.swift +5 -0
- package/ios/RNSmileID.mm +7 -0
- package/ios/RNSmileID.swift +147 -0
- package/ios/SmileId.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/SmileId.xcodeproj/project.xcworkspace/xcuserdata/japhetndhlovu.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/SmileId.xcodeproj/xcuserdata/japhetndhlovu.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/Utils/SmileIDDictExt.swift +50 -0
- package/ios/Utils/SmileIDUtils.swift +10 -0
- package/ios/View/BaseSmileIDView.swift +35 -0
- package/ios/View/SmileIDBiometricKYCView.swift +44 -0
- package/ios/View/SmileIDConsentView.swift +35 -0
- package/ios/View/SmileIDDocumentVerificationView.swift +53 -0
- package/ios/View/SmileIDEnhancedDocumentVerificationView.swift +53 -0
- package/ios/View/SmileIDSmartSelfieAuthView.swift +39 -0
- package/ios/View/SmileIDSmartSelfieEnrollmentView.swift +39 -0
- package/ios/ViewManagers/SmileIDBaseViewManager.swift +17 -0
- package/ios/ViewManagers/SmileIDBiometricKYCViewManager.m +6 -0
- package/ios/ViewManagers/SmileIDBiometricKYCViewManager.swift +33 -0
- package/ios/ViewManagers/SmileIDConsentViewManager.m +6 -0
- package/ios/ViewManagers/SmileIDConsentViewManager.swift +47 -0
- package/ios/ViewManagers/SmileIDDocumentVerificationViewManager.m +6 -0
- package/ios/ViewManagers/SmileIDDocumentVerificationViewManager.swift +48 -0
- package/ios/ViewManagers/SmileIDEnhancedDocumentVerificationViewManager.m +6 -0
- package/ios/ViewManagers/SmileIDEnhancedDocumentVerificationViewManager.swift +48 -0
- package/ios/ViewManagers/SmileIDSmartSelfieAuthenticationViewManager.m +6 -0
- package/ios/ViewManagers/SmileIDSmartSelfieAuthenticationViewManager.swift +26 -0
- package/ios/ViewManagers/SmileIDSmartSelfieEnrollmentViewManager.m +6 -0
- package/ios/ViewManagers/SmileIDSmartSelfieEnrollmentViewManager.swift +26 -0
- package/ios/ViewModels/SmileIDProductModel.swift +29 -0
- package/ios/react-native-smile-id-Bridging-Header.h +8 -0
- package/lib/commonjs/NativeSmileId.js +1 -1
- package/lib/commonjs/NativeSmileId.js.map +1 -1
- package/lib/commonjs/SmileIDBiometricKYCView.js +40 -0
- package/lib/commonjs/SmileIDBiometricKYCView.js.map +1 -0
- package/lib/commonjs/SmileIDConsentView.js +40 -0
- package/lib/commonjs/SmileIDConsentView.js.map +1 -0
- package/lib/commonjs/SmileIDDocumentVerificationView.js +40 -0
- package/lib/commonjs/SmileIDDocumentVerificationView.js.map +1 -0
- package/lib/commonjs/SmileIDEnhancedDocumentVerificationView.js +40 -0
- package/lib/commonjs/SmileIDEnhancedDocumentVerificationView.js.map +1 -0
- package/lib/commonjs/SmileIDSmartSelfieAuthenticationView.js +40 -0
- package/lib/commonjs/SmileIDSmartSelfieAuthenticationView.js.map +1 -0
- package/lib/commonjs/SmileIDSmartSelfieEnrollmentView.js +40 -0
- package/lib/commonjs/SmileIDSmartSelfieEnrollmentView.js.map +1 -0
- package/lib/commonjs/index.js +98 -27
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js +6 -0
- package/lib/commonjs/types.js.map +1 -0
- package/lib/module/NativeSmileId.js +1 -1
- package/lib/module/NativeSmileId.js.map +1 -1
- package/lib/module/SmileIDBiometricKYCView.js +30 -0
- package/lib/module/SmileIDBiometricKYCView.js.map +1 -0
- package/lib/module/SmileIDConsentView.js +30 -0
- package/lib/module/SmileIDConsentView.js.map +1 -0
- package/lib/module/SmileIDDocumentVerificationView.js +30 -0
- package/lib/module/SmileIDDocumentVerificationView.js.map +1 -0
- package/lib/module/SmileIDEnhancedDocumentVerificationView.js +30 -0
- package/lib/module/SmileIDEnhancedDocumentVerificationView.js.map +1 -0
- package/lib/module/SmileIDSmartSelfieAuthenticationView.js +30 -0
- package/lib/module/SmileIDSmartSelfieAuthenticationView.js.map +1 -0
- package/lib/module/SmileIDSmartSelfieEnrollmentView.js +30 -0
- package/lib/module/SmileIDSmartSelfieEnrollmentView.js.map +1 -0
- package/lib/module/index.js +33 -21
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/typescript/NativeSmileId.d.ts +16 -1
- package/lib/typescript/NativeSmileId.d.ts.map +1 -1
- package/lib/typescript/SmileIDBiometricKYCView.d.ts +8 -0
- package/lib/typescript/SmileIDBiometricKYCView.d.ts.map +1 -0
- package/lib/typescript/SmileIDConsentView.d.ts +8 -0
- package/lib/typescript/SmileIDConsentView.d.ts.map +1 -0
- package/lib/typescript/SmileIDDocumentVerificationView.d.ts +8 -0
- package/lib/typescript/SmileIDDocumentVerificationView.d.ts.map +1 -0
- package/lib/typescript/SmileIDEnhancedDocumentVerificationView.d.ts +8 -0
- package/lib/typescript/SmileIDEnhancedDocumentVerificationView.d.ts.map +1 -0
- package/lib/typescript/SmileIDSmartSelfieAuthenticationView.d.ts +8 -0
- package/lib/typescript/SmileIDSmartSelfieAuthenticationView.d.ts.map +1 -0
- package/lib/typescript/SmileIDSmartSelfieEnrollmentView.d.ts +8 -0
- package/lib/typescript/SmileIDSmartSelfieEnrollmentView.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +24 -86
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +182 -0
- package/lib/typescript/types.d.ts.map +1 -0
- package/package.json +1 -2
- package/react-native-smile-id.podspec +2 -2
- package/src/NativeSmileId.ts +17 -5
- package/src/SmileIDBiometricKYCView.tsx +45 -0
- package/src/SmileIDConsentView.tsx +44 -0
- package/src/SmileIDDocumentVerificationView.tsx +51 -0
- package/src/SmileIDEnhancedDocumentVerificationView.tsx +51 -0
- package/src/SmileIDSmartSelfieAuthenticationView.tsx +51 -0
- package/src/SmileIDSmartSelfieEnrollmentView.tsx +51 -0
- package/src/index.tsx +54 -122
- package/src/types.ts +189 -0
- package/android/src/main/java/com/smileidentity/react/viewmanagers/SmileIDBVNConsentViewManager.kt +0 -42
- package/android/src/main/java/com/smileidentity/react/views/SmileIDBVNConsentScreen.kt +0 -54
- package/android/src/main/java/com/smileidentity/react/views/SmileIDBiometricKYC.kt +0 -89
- package/android/src/main/java/com/smileidentity/react/views/SmileIDDocumentVerification.kt +0 -59
- package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieAuthentication.kt +0 -47
- package/android/src/main/java/com/smileidentity/react/views/SmileIDSmartSelfieEnrollment.kt +0 -48
- package/ios/SmileId.h +0 -12
- package/ios/SmileId.mm +0 -27
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import SwiftUI
|
|
3
|
+
|
|
4
|
+
class BaseSmileIDView: UIView {
|
|
5
|
+
typealias ContentView = AnyView
|
|
6
|
+
|
|
7
|
+
var product = SmileIDProductModel()
|
|
8
|
+
|
|
9
|
+
override init(frame: CGRect) {
|
|
10
|
+
super.init(frame: frame)
|
|
11
|
+
commonInit()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
required init?(coder aDecoder: NSCoder) {
|
|
15
|
+
super.init(coder: aDecoder)
|
|
16
|
+
commonInit()
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private func commonInit() {
|
|
20
|
+
// Perform initialization tasks here
|
|
21
|
+
// For example, setup subviews, add constraints, configure appearance
|
|
22
|
+
let hostingController = UIHostingController(rootView: getView())
|
|
23
|
+
let hostingView = hostingController.view!
|
|
24
|
+
hostingView.translatesAutoresizingMaskIntoConstraints = false
|
|
25
|
+
addSubview(hostingView)
|
|
26
|
+
hostingView.topAnchor.constraint(equalTo: topAnchor).isActive = true
|
|
27
|
+
hostingView.leftAnchor.constraint(equalTo: leftAnchor).isActive = true
|
|
28
|
+
hostingView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
|
|
29
|
+
hostingView.rightAnchor.constraint(equalTo: rightAnchor).isActive = true
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
func getView() -> AnyView {
|
|
33
|
+
fatalError("Must be implemented by subclass")
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
import SmileID
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
class SmileIDBiometricKYCView: BaseSmileIDView {
|
|
7
|
+
override func getView() -> AnyView {
|
|
8
|
+
AnyView(NavigationView {
|
|
9
|
+
if let idInfo = product.idInfo {
|
|
10
|
+
SmileID.biometricKycScreen(
|
|
11
|
+
idInfo: idInfo, // already validated in the SmileIDBiometricKYCViewManager
|
|
12
|
+
userId: product.userId ?? generateUserId(),
|
|
13
|
+
jobId: product.jobId ?? generateJobId(),
|
|
14
|
+
allowAgentMode: product.allowAgentMode,
|
|
15
|
+
showAttribution: product.showAttribution,
|
|
16
|
+
showInstructions: product.showInstructions,
|
|
17
|
+
extraPartnerParams: product.extraPartnerParams as [String: String],
|
|
18
|
+
delegate: self
|
|
19
|
+
)
|
|
20
|
+
} else {
|
|
21
|
+
// This exists for debugging purposes and will show in extreme cases
|
|
22
|
+
// when the params were not set NB: setParams in the viewmanager will always
|
|
23
|
+
// return an error if the required data is missing
|
|
24
|
+
Text("An error has occured")
|
|
25
|
+
}
|
|
26
|
+
}.navigationViewStyle(StackNavigationViewStyle()))
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
extension SmileIDBiometricKYCView: BiometricKycResultDelegate {
|
|
31
|
+
func didSucceed(
|
|
32
|
+
selfieImage _: URL,
|
|
33
|
+
livenessImages _: [URL],
|
|
34
|
+
jobStatusResponse: BiometricKycJobStatusResponse
|
|
35
|
+
) {
|
|
36
|
+
let encoder = JSONEncoder()
|
|
37
|
+
let jsonData = try! encoder.encode(jobStatusResponse)
|
|
38
|
+
product.onResult?(["result": String(data: jsonData, encoding: .utf8)!])
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
func didError(error: Error) {
|
|
42
|
+
product.onResult?(["error": error.localizedDescription])
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
import SmileID
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
class SmileIDConsentView: BaseSmileIDView {
|
|
7
|
+
override func getView() -> AnyView {
|
|
8
|
+
AnyView(NavigationView {
|
|
9
|
+
if let partnerIcon = product.partnerIcon,
|
|
10
|
+
let partnerName = product.partnerName,
|
|
11
|
+
let productName = product.productName,
|
|
12
|
+
let partnerPrivacyPolicy = product.partnerPrivacyPolicy
|
|
13
|
+
{
|
|
14
|
+
SmileID.consentScreen(
|
|
15
|
+
partnerIcon: UIImage(named: partnerIcon)!,
|
|
16
|
+
partnerName: partnerName,
|
|
17
|
+
productName: productName,
|
|
18
|
+
partnerPrivacyPolicy: URL(string: partnerPrivacyPolicy)!,
|
|
19
|
+
showAttribution: true,
|
|
20
|
+
onConsentGranted: {
|
|
21
|
+
self.product.onResult?(["result": true])
|
|
22
|
+
},
|
|
23
|
+
onConsentDenied: {
|
|
24
|
+
self.product.onResult?(["error": SmileIDError.consentDenied])
|
|
25
|
+
}
|
|
26
|
+
)
|
|
27
|
+
} else {
|
|
28
|
+
// This exists for debugging purposes and will show in extreme cases
|
|
29
|
+
// when the params were not set NB: setParams in the viewmanager will always
|
|
30
|
+
// return an error if the required data is missing
|
|
31
|
+
Text("An error has occured")
|
|
32
|
+
}
|
|
33
|
+
}.navigationViewStyle(StackNavigationViewStyle()))
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
import SmileID
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
class SmileIDDocumentVerificationView: BaseSmileIDView {
|
|
7
|
+
override func getView() -> AnyView {
|
|
8
|
+
AnyView(NavigationView {
|
|
9
|
+
if let countryCode = product.countryCode {
|
|
10
|
+
SmileID.documentVerificationScreen(
|
|
11
|
+
userId: product.userId ?? generateUserId(),
|
|
12
|
+
jobId: product.jobId ?? generateJobId(),
|
|
13
|
+
countryCode: countryCode, // already validated in SmileIDDocumentVerificationViewManager
|
|
14
|
+
documentType: product.documentType,
|
|
15
|
+
idAspectRatio: product.idAspectRatio,
|
|
16
|
+
bypassSelfieCaptureWithFile: product.bypassSelfieCaptureWithFilePath,
|
|
17
|
+
captureBothSides: product.captureBothSides,
|
|
18
|
+
allowAgentMode: product.allowAgentMode,
|
|
19
|
+
allowGalleryUpload: product.allowGalleryUpload,
|
|
20
|
+
showInstructions: product.showInstructions,
|
|
21
|
+
showAttribution: product.showAttribution,
|
|
22
|
+
extraPartnerParams: product.extraPartnerParams as [String: String],
|
|
23
|
+
delegate: self
|
|
24
|
+
)
|
|
25
|
+
} else {
|
|
26
|
+
// This exists for debugging purposes and will show in extreme cases
|
|
27
|
+
// when the params were not set NB: setParams in the viewmanager will always
|
|
28
|
+
// return an error if the required data is missing
|
|
29
|
+
Text("An error has occured")
|
|
30
|
+
}
|
|
31
|
+
}.navigationViewStyle(StackNavigationViewStyle()))
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
extension SmileIDDocumentVerificationView: DocumentVerificationResultDelegate {
|
|
36
|
+
func didSucceed(
|
|
37
|
+
selfie _: URL,
|
|
38
|
+
documentFrontImage _: URL,
|
|
39
|
+
documentBackImage _: URL?,
|
|
40
|
+
jobStatusResponse: DocumentVerificationJobStatusResponse
|
|
41
|
+
) {
|
|
42
|
+
let encoder = JSONEncoder()
|
|
43
|
+
guard let jsonData = try? encoder.encode(jobStatusResponse) else {
|
|
44
|
+
product.onResult?(["error": SmileIDError.unknown("SmileIDDocumentVerificationView encoding error")])
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
product.onResult?(["result": String(data: jsonData, encoding: .utf8)!])
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
func didError(error: Error) {
|
|
51
|
+
product.onResult?(["error": error.localizedDescription])
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
import SmileID
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
class SmileIDEnhancedDocumentVerificationView: BaseSmileIDView {
|
|
7
|
+
override func getView() -> AnyView {
|
|
8
|
+
AnyView(NavigationView {
|
|
9
|
+
if let countryCode = product.countryCode {
|
|
10
|
+
SmileID.enhancedDocumentVerificationScreen(
|
|
11
|
+
userId: product.userId ?? generateUserId(),
|
|
12
|
+
jobId: product.jobId ?? generateJobId(),
|
|
13
|
+
countryCode: countryCode, // already validated in the view manager
|
|
14
|
+
documentType: product.documentType,
|
|
15
|
+
idAspectRatio: product.idAspectRatio,
|
|
16
|
+
bypassSelfieCaptureWithFile: product.bypassSelfieCaptureWithFilePath,
|
|
17
|
+
captureBothSides: product.captureBothSides,
|
|
18
|
+
allowAgentMode: product.allowAgentMode,
|
|
19
|
+
allowGalleryUpload: product.allowGalleryUpload,
|
|
20
|
+
showInstructions: product.showInstructions,
|
|
21
|
+
showAttribution: product.showAttribution,
|
|
22
|
+
extraPartnerParams: product.extraPartnerParams as [String: String],
|
|
23
|
+
delegate: self
|
|
24
|
+
)
|
|
25
|
+
} else {
|
|
26
|
+
// This exists for debugging purposes and will show in extreme cases
|
|
27
|
+
// when the params were not set NB: setParams in the viewmanager will always
|
|
28
|
+
// return an error if the required data is missing
|
|
29
|
+
Text("An error has occured")
|
|
30
|
+
}
|
|
31
|
+
}.navigationViewStyle(StackNavigationViewStyle()))
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
extension SmileIDEnhancedDocumentVerificationView: EnhancedDocumentVerificationResultDelegate {
|
|
36
|
+
func didSucceed(
|
|
37
|
+
selfie _: URL,
|
|
38
|
+
documentFrontImage _: URL,
|
|
39
|
+
documentBackImage _: URL?,
|
|
40
|
+
jobStatusResponse: EnhancedDocumentVerificationJobStatusResponse
|
|
41
|
+
) {
|
|
42
|
+
let encoder = JSONEncoder()
|
|
43
|
+
guard let jsonData = try? encoder.encode(jobStatusResponse) else {
|
|
44
|
+
product.onResult?(["error": SmileIDError.unknown("SmileIDEnhancedDocumentVerificationView encoding error")])
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
product.onResult?(["result": String(data: jsonData, encoding: .utf8)!])
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
func didError(error: Error) {
|
|
51
|
+
product.onResult?(["error": error.localizedDescription])
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
import SmileID
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
class SmileIDSmartSelfieAuthView: BaseSmileIDView {
|
|
7
|
+
override func getView() -> AnyView {
|
|
8
|
+
AnyView(NavigationView {
|
|
9
|
+
SmileID.smartSelfieAuthenticationScreen(
|
|
10
|
+
userId: product.userId ?? generateUserId(),
|
|
11
|
+
jobId: product.jobId ?? generateJobId(),
|
|
12
|
+
allowAgentMode: product.allowAgentMode,
|
|
13
|
+
showAttribution: product.showAttribution,
|
|
14
|
+
showInstructions: product.showInstructions,
|
|
15
|
+
extraPartnerParams: product.extraPartnerParams as [String: String],
|
|
16
|
+
delegate: self
|
|
17
|
+
)
|
|
18
|
+
}.navigationViewStyle(StackNavigationViewStyle()))
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
extension SmileIDSmartSelfieAuthView: SmartSelfieResultDelegate {
|
|
23
|
+
func didSucceed(
|
|
24
|
+
selfieImage _: URL,
|
|
25
|
+
livenessImages _: [URL],
|
|
26
|
+
jobStatusResponse: SmartSelfieJobStatusResponse
|
|
27
|
+
) {
|
|
28
|
+
let encoder = JSONEncoder()
|
|
29
|
+
guard let jsonData = try? encoder.encode(jobStatusResponse) else {
|
|
30
|
+
product.onResult?(["error": SmileIDError.unknown("SmileIDSmartSelfieAuthView encoding error")])
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
product.onResult?(["result": String(data: jsonData, encoding: .utf8)!])
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
func didError(error: Error) {
|
|
37
|
+
product.onResult?(["error": error.localizedDescription])
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
|
|
3
|
+
import SmileID
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
class SmileIDSmartSelfieEnrollmentView: BaseSmileIDView {
|
|
7
|
+
override func getView() -> AnyView {
|
|
8
|
+
AnyView(NavigationView {
|
|
9
|
+
SmileID.smartSelfieEnrollmentScreen(
|
|
10
|
+
userId: product.userId ?? generateUserId(),
|
|
11
|
+
jobId: product.jobId ?? generateJobId(),
|
|
12
|
+
allowAgentMode: product.allowAgentMode,
|
|
13
|
+
showAttribution: product.showAttribution,
|
|
14
|
+
showInstructions: product.showInstructions,
|
|
15
|
+
extraPartnerParams: product.extraPartnerParams as [String: String],
|
|
16
|
+
delegate: self
|
|
17
|
+
)
|
|
18
|
+
}.navigationViewStyle(StackNavigationViewStyle()))
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
extension SmileIDSmartSelfieEnrollmentView: SmartSelfieResultDelegate {
|
|
23
|
+
func didSucceed(
|
|
24
|
+
selfieImage _: URL,
|
|
25
|
+
livenessImages _: [URL],
|
|
26
|
+
jobStatusResponse: SmartSelfieJobStatusResponse
|
|
27
|
+
) {
|
|
28
|
+
let encoder = JSONEncoder()
|
|
29
|
+
guard let jsonData = try? encoder.encode(jobStatusResponse) else {
|
|
30
|
+
product.onResult?(["error": SmileIDError.unknown("SmileIDSmartSelfieEnrollmentView encoding error")])
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
product.onResult?(["result": String(data: jsonData, encoding: .utf8)!])
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
func didError(error: Error) {
|
|
37
|
+
product.onResult?(["error": error.localizedDescription])
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
import SwiftUI
|
|
4
|
+
|
|
5
|
+
class SmileIDBaseViewManager: RCTViewManager, SmileIDUIViewDelegate {
|
|
6
|
+
func getView() -> UIView {
|
|
7
|
+
fatalError("Must be implemented by subclass")
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
override func view() -> UIView! {
|
|
11
|
+
getView()
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@objc override static func requiresMainQueueSetup() -> Bool {
|
|
15
|
+
true
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
import SmileID
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
@objc(SmileIDBiometricKYCViewManager)
|
|
7
|
+
class SmileIDBiometricKYCViewManager: SmileIDBaseViewManager {
|
|
8
|
+
override func getView() -> UIView {
|
|
9
|
+
SmileIDBiometricKYCView()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@objc func setParams(_ node: 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? SmileIDBiometricKYCView {
|
|
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
|
+
component.product.extraPartnerParams = params["extraPartnerParams"] as? [String: String] ?? [:]
|
|
23
|
+
component.product.userId = params["userId"] as? String
|
|
24
|
+
component.product.jobId = params["jobId"] as? String
|
|
25
|
+
component.product.allowAgentMode = params["allowAgentMode"] as? Bool ?? false
|
|
26
|
+
component.product.showAttribution = params["showAttribution"] as? Bool ?? true
|
|
27
|
+
component.product.showInstructions = params["showInstructions"] as? Bool ?? true
|
|
28
|
+
component.product.idInfo = idInfo.toIdInfo()
|
|
29
|
+
component.product.onResult = onResult
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
import SmileID
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
@objc(SmileIDConsentViewManager)
|
|
7
|
+
class SmileIDConsentViewManager: SmileIDBaseViewManager {
|
|
8
|
+
override func getView() -> UIView {
|
|
9
|
+
SmileIDConsentView()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@objc func setParams(_ node: 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? SmileIDConsentView {
|
|
17
|
+
let onResult = params["onResult"] as? RCTDirectEventBlock
|
|
18
|
+
guard let partnerIcon = params["partnerIcon"] as? String else {
|
|
19
|
+
onResult?(["error": SmileIDError.unknown("partnerIcon is required to run show consent screen")])
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
guard let partnerName = params["partnerName"] as? String else {
|
|
23
|
+
onResult?(["error": SmileIDError.unknown("partnerName is required to run show consent screen")])
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
guard let productName = params["productName"] as? String else {
|
|
27
|
+
onResult?(["error": SmileIDError.unknown("productName is required to run show consent screen")])
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
guard let partnerPrivacyPolicyUrl = params["partnerPrivacyPolicy"] as? String else {
|
|
31
|
+
onResult?(["error": SmileIDError.unknown("partnerPrivacyPolicy is required to run show consent screen")])
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
if !partnerPrivacyPolicyUrl.isValidUrl() {
|
|
35
|
+
onResult?(["error": SmileIDError.unknown("partnerPrivacyPolicy must be a valid url")])
|
|
36
|
+
return
|
|
37
|
+
}
|
|
38
|
+
component.product.partnerIcon = partnerIcon
|
|
39
|
+
component.product.partnerName = partnerName
|
|
40
|
+
component.product.productName = productName
|
|
41
|
+
component.product.partnerPrivacyPolicy = partnerPrivacyPolicyUrl
|
|
42
|
+
component.product.showAttribution = params["showAttribution"] as? Bool ?? true
|
|
43
|
+
component.product.onResult = params["onResult"] as? RCTDirectEventBlock
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
import SmileID
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
@objc(SmileIDDocumentVerificationViewManager)
|
|
7
|
+
class SmileIDDocumentVerificationViewManager: SmileIDBaseViewManager {
|
|
8
|
+
override func getView() -> UIView {
|
|
9
|
+
SmileIDDocumentVerificationView()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@objc func setParams(_ node: 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? SmileIDDocumentVerificationView {
|
|
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
|
+
component.product.extraPartnerParams = params["extraPartnerParams"] as? [String: String] ?? [:]
|
|
33
|
+
component.product.userId = params["userId"] as? String
|
|
34
|
+
component.product.jobId = params["jobId"] as? String
|
|
35
|
+
component.product.countryCode = countryCode
|
|
36
|
+
component.product.allowAgentMode = params["allowAgentMode"] as? Bool ?? false
|
|
37
|
+
component.product.showAttribution = params["showAttribution"] as? Bool ?? true
|
|
38
|
+
component.product.showInstructions = params["showInstructions"] as? Bool ?? true
|
|
39
|
+
component.product.documentType = params["documentType"] as? String
|
|
40
|
+
component.product.idAspectRatio = params["idAspectRatio"] as? Double
|
|
41
|
+
component.product.bypassSelfieCaptureWithFilePath = bypassSelfieCaptureWithFilePath
|
|
42
|
+
component.product.captureBothSides = params["captureBothSides"] as? Bool ?? true
|
|
43
|
+
component.product.allowGalleryUpload = params["allowGalleryUpload"] as? Bool ?? false
|
|
44
|
+
component.product.onResult = params["onResult"] as? RCTDirectEventBlock
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
import SmileID
|
|
4
|
+
import SwiftUI
|
|
5
|
+
|
|
6
|
+
@objc(SmileIDEnhancedDocumentVerificationViewManager)
|
|
7
|
+
class SmileIDEnhancedDocumentVerificationViewManager: SmileIDBaseViewManager {
|
|
8
|
+
override func getView() -> UIView {
|
|
9
|
+
SmileIDEnhancedDocumentVerificationView()
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@objc func setParams(_ node: 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? SmileIDEnhancedDocumentVerificationView {
|
|
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
|
+
component.product.extraPartnerParams = params["extraPartnerParams"] as? [String: String] ?? [:]
|
|
33
|
+
component.product.userId = params["userId"] as? String
|
|
34
|
+
component.product.jobId = params["jobId"] as? String
|
|
35
|
+
component.product.countryCode = countryCode
|
|
36
|
+
component.product.allowAgentMode = params["allowAgentMode"] as? Bool ?? false
|
|
37
|
+
component.product.showAttribution = params["showAttribution"] as? Bool ?? true
|
|
38
|
+
component.product.showInstructions = params["showInstructions"] as? Bool ?? true
|
|
39
|
+
component.product.documentType = params["documentType"] as? String
|
|
40
|
+
component.product.idAspectRatio = params["idAspectRatio"] as? Double
|
|
41
|
+
component.product.bypassSelfieCaptureWithFilePath = bypassSelfieCaptureWithFilePath
|
|
42
|
+
component.product.captureBothSides = params["captureBothSides"] as? Bool ?? true
|
|
43
|
+
component.product.allowGalleryUpload = params["allowGalleryUpload"] as? Bool ?? false
|
|
44
|
+
component.product.onResult = params["onResult"] as? RCTDirectEventBlock
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
import SwiftUI
|
|
4
|
+
|
|
5
|
+
@objc(SmileIDSmartSelfieAuthenticationViewManager)
|
|
6
|
+
class SmileIDSmartSelfieAuthenticationViewManager: SmileIDBaseViewManager {
|
|
7
|
+
override func getView() -> UIView {
|
|
8
|
+
SmileIDSmartSelfieAuthView()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@objc func setParams(_ node: NSNumber, params: NSDictionary) {
|
|
12
|
+
/* 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
|
|
13
|
+
*/
|
|
14
|
+
DispatchQueue.main.async {
|
|
15
|
+
if let component = self.bridge.uiManager.view(forReactTag: node) as? SmileIDSmartSelfieAuthView {
|
|
16
|
+
component.product.extraPartnerParams = params["extraPartnerParams"] as? [String: String] ?? [:]
|
|
17
|
+
component.product.userId = params["userId"] as? String
|
|
18
|
+
component.product.jobId = params["jobId"] as? String
|
|
19
|
+
component.product.allowAgentMode = params["allowAgentMode"] as? Bool ?? false
|
|
20
|
+
component.product.showAttribution = params["showAttribution"] as? Bool ?? true
|
|
21
|
+
component.product.showInstructions = params["showInstructions"] as? Bool ?? true
|
|
22
|
+
component.product.onResult = params["onResult"] as? RCTDirectEventBlock
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import React
|
|
3
|
+
import SwiftUI
|
|
4
|
+
|
|
5
|
+
@objc(SmileIDSmartSelfieEnrollmentViewManager)
|
|
6
|
+
class SmileIDSmartSelfieEnrollmentViewManager: SmileIDBaseViewManager {
|
|
7
|
+
override func getView() -> UIView {
|
|
8
|
+
SmileIDSmartSelfieEnrollmentView()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@objc func setParams(_ node: NSNumber, params: NSDictionary) {
|
|
12
|
+
/* 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
|
|
13
|
+
*/
|
|
14
|
+
DispatchQueue.main.async {
|
|
15
|
+
if let component = self.bridge.uiManager.view(forReactTag: node) as? SmileIDSmartSelfieEnrollmentView {
|
|
16
|
+
component.product.extraPartnerParams = params["extraPartnerParams"] as? [String: String] ?? [:]
|
|
17
|
+
component.product.userId = params["userId"] as? String
|
|
18
|
+
component.product.jobId = params["jobId"] as? String
|
|
19
|
+
component.product.allowAgentMode = params["allowAgentMode"] as? Bool ?? false
|
|
20
|
+
component.product.showAttribution = params["showAttribution"] as? Bool ?? true
|
|
21
|
+
component.product.showInstructions = params["showInstructions"] as? Bool ?? true
|
|
22
|
+
component.product.onResult = params["onResult"] as? RCTDirectEventBlock
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import Combine
|
|
2
|
+
import Foundation
|
|
3
|
+
import SmileID
|
|
4
|
+
|
|
5
|
+
//We're making this a central place to observe
|
|
6
|
+
//changes published after props have been updated
|
|
7
|
+
//from react native side the main thing being that
|
|
8
|
+
//when views are instantiated we don't have all the props
|
|
9
|
+
//also state could change
|
|
10
|
+
class SmileIDProductModel: ObservableObject {
|
|
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 showAttribution: Bool = true
|
|
19
|
+
@Published var showInstructions: Bool = true
|
|
20
|
+
@Published var extraPartnerParams: [String: String] = [:]
|
|
21
|
+
@Published var idAspectRatio: Double?
|
|
22
|
+
@Published var countryCode: String?
|
|
23
|
+
@Published var documentType: String?
|
|
24
|
+
@Published var captureBothSides: Bool = false
|
|
25
|
+
@Published var allowGalleryUpload: Bool = false
|
|
26
|
+
@Published var idInfo: IdInfo?
|
|
27
|
+
@Published var bypassSelfieCaptureWithFilePath: URL?
|
|
28
|
+
@Published var onResult: RCTDirectEventBlock?
|
|
29
|
+
}
|
|
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
|
-
var _default = _reactNative.TurboModuleRegistry.getEnforcing('
|
|
8
|
+
var _default = _reactNative.TurboModuleRegistry.getEnforcing('RNSmileID');
|
|
9
9
|
exports.default = _default;
|
|
10
10
|
//# sourceMappingURL=NativeSmileId.js.map
|