@certiface/sdk 1.0.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/LICENSE +20 -0
- package/README.md +966 -0
- package/RnSdk.podspec +27 -0
- package/android/build.gradle +86 -0
- package/android/gradle.properties +6 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/RnSdkModule.kt +128 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/RnSdkPackage.kt +33 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/executor/LivenessExevutor.kt +66 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/factories/FacetecThemeFactory.kt +233 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/factories/IProovThemeFactory.kt +176 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/managers/AssetManager.kt +152 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/model/Featues.kt +6 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/processors/AssetProcessor.kt +179 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/strategy/FacetecStrategy.kt +25 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/strategy/IProovStrategy.kt +25 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/strategy/LivenessProviderStrategy.kt +16 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/theme/FacetecFonts.kt +85 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/theme/IProovFonts.kt +52 -0
- package/android/src/main/java/br/com/oititec/rn/sdk/utils/AssetProcessor.kt +181 -0
- package/android/src/main/res/drawable/backhand_left.xml +20 -0
- package/android/src/main/res/drawable/backhand_right.xml +20 -0
- package/android/src/main/res/drawable/camera_icon.xml +14 -0
- package/android/src/main/res/drawable/close_icon.xml +11 -0
- package/android/src/main/res/drawable/error_icon.xml +11 -0
- package/android/src/main/res/drawable/neutral_face.xml +11 -0
- package/android/src/main/res/drawable/success_icon.xml +11 -0
- package/android/src/main/res/font/sixty.ttf +0 -0
- package/ios/Extensions/RnSDK+Callbacks.swift +62 -0
- package/ios/Extensions/UIColor+Hex.swift +39 -0
- package/ios/Resources/Media.xcassets/Contents.json +6 -0
- package/ios/Resources/Media.xcassets/shell.imageset/Contents.json +12 -0
- package/ios/Resources/Media.xcassets/shell.imageset/shell.png +0 -0
- package/ios/Resources/Media.xcassets/test.imageset/Contents.json +12 -0
- package/ios/Resources/Media.xcassets/test.imageset/arrow_forward_ios.png +0 -0
- package/ios/RnSdk.h +5 -0
- package/ios/RnSdk.mm +71 -0
- package/ios/RnSdkImpl.swift +91 -0
- package/ios/Utils/RnSdkBundle.swift +27 -0
- package/ios/Utils/ThemeFactory.swift +424 -0
- package/lib/module/@types/result.js +2 -0
- package/lib/module/@types/result.js.map +1 -0
- package/lib/module/@types/theme.js +41 -0
- package/lib/module/@types/theme.js.map +1 -0
- package/lib/module/NativeRnSdk.js +5 -0
- package/lib/module/NativeRnSdk.js.map +1 -0
- package/lib/module/index.js +33 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/utils/AssetProcessor.js +78 -0
- package/lib/module/utils/AssetProcessor.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/@types/result.d.ts +17 -0
- package/lib/typescript/src/@types/result.d.ts.map +1 -0
- package/lib/typescript/src/@types/theme.d.ts +306 -0
- package/lib/typescript/src/@types/theme.d.ts.map +1 -0
- package/lib/typescript/src/NativeRnSdk.d.ts +9 -0
- package/lib/typescript/src/NativeRnSdk.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +14 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/utils/AssetProcessor.d.ts +8 -0
- package/lib/typescript/src/utils/AssetProcessor.d.ts.map +1 -0
- package/package.json +165 -0
- package/src/@types/result.ts +19 -0
- package/src/@types/theme.ts +346 -0
- package/src/NativeRnSdk.ts +18 -0
- package/src/index.tsx +54 -0
- package/src/utils/AssetProcessor.ts +114 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RnSdkBundle.swift
|
|
3
|
+
// RnSdk
|
|
4
|
+
//
|
|
5
|
+
// Created by Vitor Souza on 28/10/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import UIKit
|
|
9
|
+
|
|
10
|
+
final class RnSdkBundle {
|
|
11
|
+
static func getImage(named imageName: String) -> UIImage? {
|
|
12
|
+
guard let resourceBundle = getBundle() else { return nil }
|
|
13
|
+
return UIImage(named: imageName, in: resourceBundle, compatibleWith: nil)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
private static func getBundle() -> Bundle? {
|
|
17
|
+
let bundleUrl = Bundle(for: RnSdkBundle.self).url(
|
|
18
|
+
forResource: "RnSdkBundle",
|
|
19
|
+
withExtension: "bundle"
|
|
20
|
+
)
|
|
21
|
+
guard let bundleUrl else { return nil }
|
|
22
|
+
guard let resourceBundle = Bundle(url: bundleUrl) else {
|
|
23
|
+
return nil
|
|
24
|
+
}
|
|
25
|
+
return resourceBundle
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ThemeFactory.swift
|
|
3
|
+
// RnSdk
|
|
4
|
+
//
|
|
5
|
+
// Created by Gabriel Catelli Goulart on 01/08/25.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import CertifaceSDK
|
|
9
|
+
import CertifaceIProov
|
|
10
|
+
import UIKit
|
|
11
|
+
|
|
12
|
+
final class ThemeFactory {
|
|
13
|
+
static func createIProovCustomization(from theme: [String: Any]?) -> IProovCustomization {
|
|
14
|
+
let builder = IProovCustomization.builder()
|
|
15
|
+
guard let theme else { return builder.build() }
|
|
16
|
+
|
|
17
|
+
return builder
|
|
18
|
+
.setInstructionCustomization { instructionBuilder in
|
|
19
|
+
customizeInstruction(in: instructionBuilder, with: theme)
|
|
20
|
+
}
|
|
21
|
+
.setCameraPermissionCustomization { cameraPermissionBuilder in
|
|
22
|
+
customizeCameraPermission(in: cameraPermissionBuilder, with: theme)
|
|
23
|
+
}
|
|
24
|
+
.setLivenessCustomization { livenessBuilder in
|
|
25
|
+
customizeLivenessIProov(in: livenessBuilder, with: theme)
|
|
26
|
+
}
|
|
27
|
+
.setLoadingCustomization { loadingBuilder in
|
|
28
|
+
customizeLoadingIProov(in: loadingBuilder, with: theme)
|
|
29
|
+
}
|
|
30
|
+
.setResultCustomization { resultBuilder in
|
|
31
|
+
customizeResultIProov(in: resultBuilder, with: theme)
|
|
32
|
+
}
|
|
33
|
+
.build()
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
static func createFacetecCustomization(from theme: [String: Any]?) -> FacetecCustomization {
|
|
37
|
+
let builder = FacetecCustomization.builder()
|
|
38
|
+
guard let theme else { return builder.build() }
|
|
39
|
+
|
|
40
|
+
return builder
|
|
41
|
+
.setInstructionCustomization { instructionBuilder in
|
|
42
|
+
customizeInstruction(in: instructionBuilder, with: theme)
|
|
43
|
+
}
|
|
44
|
+
.setCameraPermissionCustomization { cameraPermissionBuilder in
|
|
45
|
+
customizeCameraPermission(in: cameraPermissionBuilder, with: theme)
|
|
46
|
+
}
|
|
47
|
+
.setLoadingCustomization { loadingBuilder in
|
|
48
|
+
customizeLoadingFacetec(in: loadingBuilder, with: theme)
|
|
49
|
+
}
|
|
50
|
+
.setLivenessDefaultTheme { defaultThemeBuilder in
|
|
51
|
+
customizeLivenessFacetec(in: defaultThemeBuilder, with: theme)
|
|
52
|
+
}
|
|
53
|
+
.setLivenessLowLightTheme { defaultThemeBuilder in
|
|
54
|
+
customizeLivenessFacetec(in: defaultThemeBuilder, with: theme)
|
|
55
|
+
}
|
|
56
|
+
.setLivenessTexts(customizeLivenessTexts(from: theme))
|
|
57
|
+
.build()
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// MARK: - Customization
|
|
61
|
+
|
|
62
|
+
// MARK: Oiti
|
|
63
|
+
|
|
64
|
+
private static func customizeInstruction(
|
|
65
|
+
in builder: InstructionCustomizationBuilder,
|
|
66
|
+
with theme: [String: Any]
|
|
67
|
+
) -> InstructionCustomizationBuilder {
|
|
68
|
+
guard let instructionsTheme = theme["instructions"] as? [String: Any] else {
|
|
69
|
+
return builder
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
let colors = instructionsTheme["colors"] as? [String: String] ?? [:]
|
|
73
|
+
setColor(colors["background"], with: builder.setBackgroundColor(_:))
|
|
74
|
+
setColor(colors["backButtonIcon"], with: builder.setBackButtonIconColor(_:))
|
|
75
|
+
setColor(colors["backButtonBackground"], with: builder.setBackButtonBackgroundColor(_:))
|
|
76
|
+
setColor(colors["backButtonBorder"], with: builder.setBackButtonBorderColor(_:))
|
|
77
|
+
setColor(colors["bottomSheet"], with: builder.setBottomSheetColor(_:))
|
|
78
|
+
|
|
79
|
+
setColor(colors["title"], with: builder.setTitleColor)
|
|
80
|
+
setColor(colors["caption"], with: builder.setCaptionColor(_:))
|
|
81
|
+
setColor(colors["firstInstructionTitle"], with: builder.setFirstInstructionTitleColor(_:))
|
|
82
|
+
setColor(colors["secondInstructionTitle"], with: builder.setSecondInstructionTitleColor(_:))
|
|
83
|
+
setColor(colors["continueButtonText"], with: builder.setContinueButtonTextColor(_:))
|
|
84
|
+
setColor(colors["continueButtonBackground"], with: builder.setContinueButtonBackgroundColor(_:))
|
|
85
|
+
setColor(colors["continueButtonBorder"], with: builder.setContinueButtonBorderColor(_:))
|
|
86
|
+
|
|
87
|
+
let texts = instructionsTheme["texts"] as? [String: String] ?? [:]
|
|
88
|
+
setText(texts["title"], with: builder.setTitle(_:))
|
|
89
|
+
setText(texts["caption"], with: builder.setCaption(_:))
|
|
90
|
+
setText(texts["firstInstruction"], with: builder.setFirstInstructionTitle(_:))
|
|
91
|
+
setText(texts["secondInstruction"], with: builder.setSecondInstructionTitle(_:))
|
|
92
|
+
setText(texts["continueButton"], with: builder.setContinueButtonText(_:))
|
|
93
|
+
|
|
94
|
+
let assets = instructionsTheme["assets"] as? [String: String] ?? [:]
|
|
95
|
+
setImage(assets["backButtonIcon"], with: builder.setBackButtonIcon(_:))
|
|
96
|
+
setImage(assets["contextImage"], with: builder.setContextImage(_:))
|
|
97
|
+
setImage(assets["firstInstructionIcon"], with: builder.setFirstInstructionIcon(_:))
|
|
98
|
+
setImage(assets["secondInstructionIcon"], with: builder.setSecondInstructionIcon(_:))
|
|
99
|
+
|
|
100
|
+
let fonts = instructionsTheme["fonts"] as? [String: String] ?? [:]
|
|
101
|
+
setFont(fonts["title"], with: builder.setTitleFont(_:), size: 20)
|
|
102
|
+
setFont(fonts["caption"], with: builder.setCaptionFont(_:), size: 20)
|
|
103
|
+
setFont(fonts["firstInstructionTitle"], with: builder.setFirstInstructionTitleFont(_:), size: 20)
|
|
104
|
+
setFont(fonts["secondInstructionTitle"], with: builder.setSecondInstructionTitleFont(_:), size: 20)
|
|
105
|
+
setFont(fonts["continueButton"], with: builder.setContinueButtonFont(_:), size: 20)
|
|
106
|
+
|
|
107
|
+
return builder
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
private static func customizeCameraPermission(
|
|
111
|
+
in builder: CameraPermissionCustomizationBuilder,
|
|
112
|
+
with theme: [String: Any]
|
|
113
|
+
) -> CameraPermissionCustomizationBuilder {
|
|
114
|
+
guard let cameraPermissionTheme = theme["permission"] as? [String: Any] else {
|
|
115
|
+
return builder
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
let colors = cameraPermissionTheme["colors"] as? [String: String] ?? [:]
|
|
119
|
+
setColor(colors["background"], with: builder.setBackgroundColor(_:))
|
|
120
|
+
setColor(colors["backButtonIcon"], with: builder.setBackButtonIconColor(_:))
|
|
121
|
+
setColor(colors["backButtonBackground"], with: builder.setBackButtonBackgroundColor(_:))
|
|
122
|
+
setColor(colors["backButtonBorder"], with: builder.setBackButtonBorderColor(_:))
|
|
123
|
+
setColor(colors["cameraImage"], with: builder.setCameraImageColor(_:))
|
|
124
|
+
setColor(colors["title"], with: builder.setTitleColor(_:))
|
|
125
|
+
setColor(colors["caption"], with: builder.setCaptionColor(_:))
|
|
126
|
+
setColor(colors["checkPermissionButtonText"], with: builder.setCheckPermissionButtonTextColor(_:))
|
|
127
|
+
setColor(colors["checkPermissionButtonBackground"], with: builder.setCheckPermissionButtonBackgroundColor(_:))
|
|
128
|
+
setColor(colors["checkPermissionButtonBorder"], with: builder.setCheckPermissionButtonBorderColor(_:))
|
|
129
|
+
setColor(colors["bottomSheet"], with: builder.setBottomSheetColor(_:))
|
|
130
|
+
setColor(colors["bottomSheetTitle"], with: builder.setBottomSheetTitleColor(_:))
|
|
131
|
+
setColor(colors["bottomSheetCaption"], with: builder.setBottomSheetCaptionColor(_:))
|
|
132
|
+
setColor(colors["openSettingsButtonText"], with: builder.setOpenSettingsButtonTextColor(_:))
|
|
133
|
+
setColor(colors["openSettingsButtonBackground"], with: builder.setOpenSettingsButtonBackgroundColor(_:))
|
|
134
|
+
setColor(colors["openSettingsButtonBorder"], with: builder.setOpenSettingsButtonBorderColor(_:))
|
|
135
|
+
setColor(colors["closeButtonText"], with: builder.setCloseButtonTextColor(_:))
|
|
136
|
+
setColor(colors["closeButtonBackground"], with: builder.setCloseButtonBackgroundColor(_:))
|
|
137
|
+
setColor(colors["closeButtonBorder"], with: builder.setCloseButtonBorderColor(_:))
|
|
138
|
+
|
|
139
|
+
let texts = cameraPermissionTheme["texts"] as? [String: String] ?? [:]
|
|
140
|
+
setText(texts["title"], with: builder.setTitle(_:))
|
|
141
|
+
setText(texts["caption"], with: builder.setCaption(_:))
|
|
142
|
+
setText(texts["checkPermissionButton"], with: builder.setCheckPermissionButtonText(_:))
|
|
143
|
+
setText(texts["bottomSheetTitle"], with: builder.setBottomSheetTitle(_:))
|
|
144
|
+
setText(texts["bottomSheetCaption"], with: builder.setBottomSheetCaption(_:))
|
|
145
|
+
setText(texts["openSettingsButton"], with: builder.setOpenSettingsButtonText(_:))
|
|
146
|
+
setText(texts["closeButton"], with: builder.setCloseButtonText(_:))
|
|
147
|
+
|
|
148
|
+
let assets = cameraPermissionTheme["assets"] as? [String: String] ?? [:]
|
|
149
|
+
setImage(assets["backButtonIcon"], with: builder.setBackButtonIcon(_:))
|
|
150
|
+
setImage(assets["cameraImage"], with: builder.setCameraImage(_:))
|
|
151
|
+
|
|
152
|
+
let fonts = cameraPermissionTheme["fonts"] as? [String: String] ?? [:]
|
|
153
|
+
setFont(fonts["title"], with: builder.setTitleFont(_:), size: 20)
|
|
154
|
+
setFont(fonts["caption"], with: builder.setCaptionFont(_:), size: 20)
|
|
155
|
+
setFont(fonts["checkPermissionButton"], with: builder.setCheckPermissionButtonTextFont(_:), size: 20)
|
|
156
|
+
setFont(fonts["bottomSheetTitle"], with: builder.setBottomSheetTitleFont(_:), size: 20)
|
|
157
|
+
setFont(fonts["bottomSheetCaption"], with: builder.setBottomSheetCaptionFont(_:), size: 20)
|
|
158
|
+
setFont(fonts["opentSettingsButton"], with: builder.setOpenSettingsButtonTextFont(_:), size: 20)
|
|
159
|
+
setFont(fonts["closeButton"], with: builder.setCloseButtonTextFont(_:), size: 20)
|
|
160
|
+
|
|
161
|
+
return builder
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// MARK: IProov
|
|
165
|
+
|
|
166
|
+
private static func customizeLivenessIProov(
|
|
167
|
+
in builder: IProovLivenessCustomizationBuilder,
|
|
168
|
+
with theme: [String: Any]
|
|
169
|
+
) -> IProovLivenessCustomizationBuilder {
|
|
170
|
+
guard let instructionsTheme = theme["iproov"] as? [String: Any] else {
|
|
171
|
+
return builder
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
let colors = instructionsTheme["colors"] as? [String: String] ?? [:]
|
|
175
|
+
setColor(colors["closeButtonIcon"], with: builder.setCloseButtonImageColor(_:))
|
|
176
|
+
setColor(colors["title"], with: builder.setTitleTextColor(_:))
|
|
177
|
+
setColor(colors["titleBackground"], with: builder.setTitleBackgroundColor(_:))
|
|
178
|
+
setColor(colors["promptText"], with: builder.setPromptTextColor(_:))
|
|
179
|
+
setColor(colors["promptBackground"], with: builder.setPromptBackgroundColor(_:))
|
|
180
|
+
setColor(colors["background"], with: builder.setBackgroundColor(_:))
|
|
181
|
+
setColor(colors["ovalReady"], with: builder.setGPAOvalStrokeReadyColor(_:))
|
|
182
|
+
setColor(colors["ovalNotReady"], with: builder.setGPAOvalStrokeNotReadyColor(_:))
|
|
183
|
+
setColor(colors["ovalCapturing"], with: builder.setLAOvalStrokeCapturingColor(_:))
|
|
184
|
+
setColor(colors["ovalCompleted"], with: builder.setLAOvalStrokeCompletedColor(_:))
|
|
185
|
+
setColor(colors["filterLineDrawingForeground"], with: builder.setFilterLineDrawingForegroundColor(_:))
|
|
186
|
+
setColor(colors["filterLineDrawingBackground"], with: builder.setFilterLineDrawingBackgroundColor(_:))
|
|
187
|
+
|
|
188
|
+
let texts = instructionsTheme["texts"] as? [String: String] ?? [:]
|
|
189
|
+
setText(texts["title"], with: builder.setTitle(_:))
|
|
190
|
+
|
|
191
|
+
let assets = instructionsTheme["assets"] as? [String: String] ?? [:]
|
|
192
|
+
setImage(assets["closeButtonIcon"], with: builder.setCloseButtonImage(_:))
|
|
193
|
+
setImage(assets["logoImage"], with: builder.setLogoImage(_:))
|
|
194
|
+
|
|
195
|
+
return builder
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
private static func customizeLoadingIProov(
|
|
199
|
+
in builder: LoadingCustomizationBuilder,
|
|
200
|
+
with theme: [String: Any]
|
|
201
|
+
) -> LoadingCustomizationBuilder {
|
|
202
|
+
guard let loadingTheme = theme["processing"] as? [String: Any] else {
|
|
203
|
+
return builder
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
let colors = loadingTheme["colors"] as? [String: String] ?? [:]
|
|
207
|
+
setColor(colors["background"], with: builder.setBackgroundColor(_:))
|
|
208
|
+
setColor(colors["loading"], with: builder.setSpinnerColor(_:))
|
|
209
|
+
|
|
210
|
+
return builder
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
private static func customizeResultIProov(
|
|
214
|
+
in builder: IProovResultCustomizationBuilder,
|
|
215
|
+
with theme: [String: Any]
|
|
216
|
+
) -> IProovResultCustomizationBuilder {
|
|
217
|
+
guard let resultTheme = theme["result"] as? [String: Any] else {
|
|
218
|
+
return builder
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
let colors = resultTheme["colors"] as? [String: String] ?? [:]
|
|
222
|
+
setColor(colors["successBackground"], with: builder.setSuccessBackgroundColor(_:))
|
|
223
|
+
setColor(colors["successText"], with: builder.setSuccessMessageColor(_:))
|
|
224
|
+
setColor(colors["errorBackground"], with: builder.setErrorBackgroundColor(_:))
|
|
225
|
+
setColor(colors["errorText"], with: builder.setErrorMessageColor(_:))
|
|
226
|
+
setColor(colors["retryBackground"], with: builder.setRetryBackgroundColor(_:))
|
|
227
|
+
setColor(colors["retryText"], with: builder.setRetryMessageColor(_:))
|
|
228
|
+
setColor(colors["retryButtonText"], with: builder.setRetryButtonTextColor(_:))
|
|
229
|
+
setColor(colors["retryButtonBackground"], with: builder.setRetryButtonBackgroundColor(_:))
|
|
230
|
+
setColor(colors["retryButtonBorder"], with: builder.setRetryButtonBorderColor(_:))
|
|
231
|
+
|
|
232
|
+
let texts = resultTheme["texts"] as? [String: String] ?? [:]
|
|
233
|
+
setText(texts["success"], with: builder.setSuccessMessage(_:))
|
|
234
|
+
setText(texts["error"], with: builder.setErrorMessage(_:))
|
|
235
|
+
setText(texts["retryButton"], with: builder.setRetryButtonText(_:))
|
|
236
|
+
|
|
237
|
+
let assets = resultTheme["assets"] as? [String: String] ?? [:]
|
|
238
|
+
setImage(assets["successImage"], with: builder.setSuccessImage(_:))
|
|
239
|
+
setImage(assets["errorImage"], with: builder.setErrorImage(_:))
|
|
240
|
+
setImage(assets["retryImage"], with: builder.setRetryImage(_:))
|
|
241
|
+
|
|
242
|
+
let fonts = resultTheme["fonts"] as? [String: String] ?? [:]
|
|
243
|
+
setFont(fonts["text"], with: builder.setMessageFont(_:), size: 20)
|
|
244
|
+
setFont(fonts["retryButton"], with: builder.setRetryButtonTextFont(_:), size: 20)
|
|
245
|
+
|
|
246
|
+
return builder
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// MARK: Facetec
|
|
250
|
+
|
|
251
|
+
private static func customizeLoadingFacetec(
|
|
252
|
+
in builder: LoadingCustomizationBuilder,
|
|
253
|
+
with theme: [String: Any]
|
|
254
|
+
) -> LoadingCustomizationBuilder {
|
|
255
|
+
guard let loadingTheme = theme["processing"] as? [String: Any] else {
|
|
256
|
+
return builder
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
let colors = loadingTheme["colors"] as? [String: String] ?? [:]
|
|
260
|
+
setColor(colors["background"], with: builder.setBackgroundColor(_:))
|
|
261
|
+
setColor(colors["loading"], with: builder.setSpinnerColor(_:))
|
|
262
|
+
|
|
263
|
+
return builder
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
private static func customizeLivenessFacetec(
|
|
267
|
+
in builder: Liveness3DThemeBuilder,
|
|
268
|
+
with theme: [String: Any]
|
|
269
|
+
) -> Liveness3DThemeBuilder {
|
|
270
|
+
guard let livenessTheme = theme["facetec"] as? [String: Any] else {
|
|
271
|
+
return builder
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
let colors = livenessTheme["colors"] as? [String: String] ?? [:]
|
|
275
|
+
setColor(colors["readyScreenHeader"], with: builder.setReadyScreenHeaderColor(_:))
|
|
276
|
+
setColor(colors["readyScreenSubtext"], with: builder.setReadyScreenMessageColor(_:))
|
|
277
|
+
setColor(colors["readyScreenTextBackground"], with: builder.setReadyScreenTextBackgroundColor(_:))
|
|
278
|
+
setColor(colors["resultScreenMessage"], with: builder.setResultScreenMessageColor(_:))
|
|
279
|
+
setColor(colors["resultScreenUploadProgressBarFill"], with: builder.setResultScreenUploadProgressBarFillColor(_:))
|
|
280
|
+
setColor(colors["resultScreenUploadProgressBarTrack"], with: builder.setResultScreenUploadProgressBarTrackColor(_:))
|
|
281
|
+
builder.setResultScreenAnimationStyle(.blob(appearance: getResultStyleApperance(from: colors)))
|
|
282
|
+
setColor(colors["retryScreenHeader"], with: builder.setRetryScreenHeaderColor(_:))
|
|
283
|
+
setColor(colors["retryScreenSubtext"], with: builder.setRetryScreenCaptionColor(_:))
|
|
284
|
+
setColor(colors["retryScreenImageBorder"], with: builder.setRetryScreenImageBorderColor(_:))
|
|
285
|
+
setColor(colors["feedbackMessage"], with: builder.setFeedbackMessageColor(_:))
|
|
286
|
+
setColor(colors["feedbackBarBackground"], with: builder.setFeedbackBarBackgroundColor(_:))
|
|
287
|
+
setColor(colors["guidanceButtonTextNormal"], with: builder.setGuidanceButtonTextNormalColor(_:))
|
|
288
|
+
setColor(colors["guidanceButtonTextHighlight"], with: builder.setGuidanceButtonTextHighlightColor(_:))
|
|
289
|
+
setColor(colors["guidanceButtonTextDisabled"], with: builder.setGuidanceButtonTextDisabledColor(_:))
|
|
290
|
+
setColor(colors["guidanceButtonBackgroundNormal"], with: builder.setGuidanceButtonBackgroundNormalColor(_:))
|
|
291
|
+
setColor(colors["guidanceButtonBackgroundHighlight"], with: builder.setGuidanceButtonBackgroundHighlightColor(_:))
|
|
292
|
+
setColor(colors["guidanceButtonBackgroundDisabled"], with: builder.setGuidanceButtonBackgroundDisabledColor(_:))
|
|
293
|
+
setColor(colors["guidanceButtonBorder"], with: builder.setGuidanceButtonBorderColor(_:))
|
|
294
|
+
setColor(colors["frameBorder"], with: builder.setFrameBorderColor(_:))
|
|
295
|
+
setColor(colors["frameBackground"], with: builder.setFrameBackgroundColor(_:))
|
|
296
|
+
setColor(colors["ovalStroke"], with: builder.setOvalStrokeColor(_:))
|
|
297
|
+
setColor(colors["ovalProgressFirst"], with: builder.setOvalProgressFirstColor(_:))
|
|
298
|
+
setColor(colors["ovalProgressSecond"], with: builder.setOvalProgressSecondColor(_:))
|
|
299
|
+
setColor(colors["overlayBackground"], with: builder.setOverlayBackgroundColor(_:))
|
|
300
|
+
|
|
301
|
+
let assets = livenessTheme["assets"] as? [String: String] ?? [:]
|
|
302
|
+
setImage(assets["overlayBrandImage"], with: builder.setOverlayBrandImage(_:))
|
|
303
|
+
setImage(assets["cancelButtonIcon"], with: builder.setCancelButtonIcon(_:))
|
|
304
|
+
|
|
305
|
+
let fonts = livenessTheme["fonts"] as? [String: String] ?? [:]
|
|
306
|
+
setFont(fonts["readyScreenHeader"], with: builder.setReadyScreenHeaderFont(_:), size: 0)
|
|
307
|
+
setFont(fonts["readyScreenSubtext"], with: builder.setReadyScreenMessageFont(_:), size: 0)
|
|
308
|
+
setFont(fonts["resultScreenMessage"], with: builder.setResultScreenMessageFont(_:), size: 0)
|
|
309
|
+
setFont(fonts["retryScreenHeader"], with: builder.setRetryScreenHeaderFont(_:), size: 0)
|
|
310
|
+
setFont(fonts["retryScreenSubtext"], with: builder.setRetryScreenCaptionFont(_:), size: 0)
|
|
311
|
+
setFont(fonts["feedbackMessage"], with: builder.setFeedbackMessageFont(_:), size: 0)
|
|
312
|
+
setFont(fonts["guidanceHeader"], with: builder.setGuidanceHeaderFont(_:), size: 0)
|
|
313
|
+
setFont(fonts["guidanceSubtext"], with: builder.setGuidanceSubtextFont(_:), size: 0)
|
|
314
|
+
setFont(fonts["guidanceButton"], with: builder.setGuidanceButtonFont(_:), size: 0)
|
|
315
|
+
|
|
316
|
+
return builder
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
private static func customizeLivenessTexts(
|
|
320
|
+
from theme: [String: Any]
|
|
321
|
+
) -> [Liveness3DTextKey : String] {
|
|
322
|
+
guard let livenessTheme = theme["facetec"] as? [String: Any] else {
|
|
323
|
+
return [:]
|
|
324
|
+
}
|
|
325
|
+
guard let texts = livenessTheme["texts"] as? [String: String] else {
|
|
326
|
+
return [:]
|
|
327
|
+
}
|
|
328
|
+
let keys: [String: Liveness3DTextKey] = [
|
|
329
|
+
"readyHeader1": .readyHeader1,
|
|
330
|
+
"readyHeader2": .readyHeader2,
|
|
331
|
+
"readyMessage1": .readyMessage1,
|
|
332
|
+
"readyMessage2": .readyMessage2,
|
|
333
|
+
"readyButton": .readyButton,
|
|
334
|
+
"feedbackLookStraightInOval": .feedbackPositionFaceStraightInOval,
|
|
335
|
+
"feedbackCenterFace": .feedbackCenterFace,
|
|
336
|
+
"feedbackFaceNotFound": .feedbackFaceNotFound,
|
|
337
|
+
"feedbackFaceNotLookingStraightAhead": .feedbackFaceNotLookingStraightAhead,
|
|
338
|
+
"feedbackFaceNotUpright": .feedbackFaceNotUpright,
|
|
339
|
+
"feedbackHoldSteady": .feedbackHoldSteady,
|
|
340
|
+
"feedbackMovePhoneAway": .feedbackMovePhoneAway,
|
|
341
|
+
"feedbackMovePhoneCloser": .feedbackMovePhoneCloser,
|
|
342
|
+
"feedbackMovePhoneToEyeLevel": .feedbackMovePhoneToEyeLevel,
|
|
343
|
+
"feedbackUseEvenLighting": .feedbackUseEvenLighting,
|
|
344
|
+
"feedbackFrameYourFace": .feedbackFrameYourFace,
|
|
345
|
+
"feedbackHoldSteady1": .feedbackHoldSteady1,
|
|
346
|
+
"feedbackHoldSteady2": .feedbackHoldSteady2,
|
|
347
|
+
"feedbackHoldSteady3": .feedbackHoldSteady3,
|
|
348
|
+
"feedbackRemoveDarkGlasses": .feedbackRemoveDarkGlasses,
|
|
349
|
+
"feedbackNeutralExpression": .feedbackNeutralExpression,
|
|
350
|
+
"feedbackConditionsTooBright": .feedbackConditionsTooBright,
|
|
351
|
+
"feedbackBrightenYourEnvironment": .feedbackBrightenYourEnvironment,
|
|
352
|
+
"resultUploadMessage": .resultUploadMessage,
|
|
353
|
+
"resultSuccessMessage": .resultSuccessMessage,
|
|
354
|
+
"retryHeader": .retryHeader,
|
|
355
|
+
"retrySubheader": .retrySubheader,
|
|
356
|
+
"retryMessageSmile": .retryMessageSmile,
|
|
357
|
+
"retryMessageLighting": .retryMessageLightning,
|
|
358
|
+
"retryMessageContrast": .retryMessageContrast,
|
|
359
|
+
"retryYourPicture": .retryYourPicture,
|
|
360
|
+
"retryIdealPicture": .retryIdealPicture,
|
|
361
|
+
"retryButton": .retryButton,
|
|
362
|
+
]
|
|
363
|
+
var livenessTexts = [Liveness3DTextKey : String]()
|
|
364
|
+
|
|
365
|
+
for (themeKey, textKey) in keys {
|
|
366
|
+
livenessTexts[textKey] = texts[themeKey]
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
return livenessTexts
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
// MARK: - Utils
|
|
373
|
+
|
|
374
|
+
private static func setColor<T>(_ colorHex: String?, with builder: @escaping (UIColor) -> T) {
|
|
375
|
+
if let colorHex, let color = UIColor(hex: colorHex) {
|
|
376
|
+
_ = builder(color)
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
private static func setText<T>(_ text: String?, with builder: @escaping (String) -> T) {
|
|
381
|
+
if let text {
|
|
382
|
+
_ = builder(text)
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
private static func setImage<T>(_ imageName: String?, with builder: @escaping (UIImage) -> T) {
|
|
387
|
+
if let imageName, let image = RnSdkBundle.getImage(named: imageName) {
|
|
388
|
+
_ = builder(image)
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
private static func setFont<T>(_ fontName: String?, with builder: @escaping (UIFont) -> T, size: CGFloat) {
|
|
393
|
+
if let fontName, let font = UIFont(name: fontName, size: size) {
|
|
394
|
+
_ = builder(font)
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
private static func getResultStyleApperance(from colors: [String: String]) -> BlobAnimationAppearance {
|
|
399
|
+
func getColor(from colorHex: String?, defaultColor: UIColor) -> UIColor {
|
|
400
|
+
guard let colorHex, let color = UIColor(hex: colorHex) else {
|
|
401
|
+
return defaultColor
|
|
402
|
+
}
|
|
403
|
+
return color
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
let blobColor = getColor(
|
|
407
|
+
from: colors["resultScreenActivityIndicator"],
|
|
408
|
+
defaultColor: .black
|
|
409
|
+
)
|
|
410
|
+
let checkmarkForegroundColor = getColor(
|
|
411
|
+
from: colors["resultScreenResultAnimationForeground"],
|
|
412
|
+
defaultColor: .black
|
|
413
|
+
)
|
|
414
|
+
let checkmarkBackgroundColor = getColor(
|
|
415
|
+
from: colors["resultScreenResultAnimationBackground"],
|
|
416
|
+
defaultColor: .black
|
|
417
|
+
)
|
|
418
|
+
return BlobAnimationAppearance(
|
|
419
|
+
blobColor: blobColor,
|
|
420
|
+
checkmarkForegroundColor: checkmarkForegroundColor,
|
|
421
|
+
checkmarkBackgroundColor: checkmarkBackgroundColor
|
|
422
|
+
)
|
|
423
|
+
}
|
|
424
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["@types/result.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export let LivenessProvider = /*#__PURE__*/function (LivenessProvider) {
|
|
4
|
+
LivenessProvider["FACETEC"] = "FACETEC";
|
|
5
|
+
LivenessProvider["IPROOV"] = "IPROOV";
|
|
6
|
+
return LivenessProvider;
|
|
7
|
+
}({});
|
|
8
|
+
export let Environment = /*#__PURE__*/function (Environment) {
|
|
9
|
+
Environment["HML"] = "HML";
|
|
10
|
+
Environment["PRD"] = "PRD";
|
|
11
|
+
return Environment;
|
|
12
|
+
}({});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Facetec Theme
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* IProov Theme
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Instructions Theme
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Permission Theme
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Processing Theme
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Result Theme
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Oiti Theme
|
|
40
|
+
*/
|
|
41
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["LivenessProvider","Environment"],"sourceRoot":"../../../src","sources":["@types/theme.ts"],"mappings":";;AAAA,WAAYA,gBAAgB,0BAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAhBA,gBAAgB;EAAA,OAAhBA,gBAAgB;AAAA;AAK5B,WAAYC,WAAW,0BAAXA,WAAW;EAAXA,WAAW;EAAXA,WAAW;EAAA,OAAXA,WAAW;AAAA;;AAKvB;AACA;AACA;;AAuGA;AACA;AACA;;AA8CA;AACA;AACA;;AAqDA;AACA;AACA;;AAyDA;AACA;AACA;;AAYA;AACA;AACA;;AAwCA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["TurboModuleRegistry","getEnforcing"],"sourceRoot":"../../src","sources":["NativeRnSdk.ts"],"mappings":";;AACA,SAASA,mBAAmB,QAAQ,cAAc;AAgBlD,eAAeA,mBAAmB,CAACC,YAAY,CAAO,OAAO,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import OitiSDK from "./NativeRnSdk.js";
|
|
4
|
+
function checkCameraPermission() {
|
|
5
|
+
return OitiSDK.checkCameraPermission();
|
|
6
|
+
}
|
|
7
|
+
function requestCameraPermission() {
|
|
8
|
+
return OitiSDK.requestCameraPermission();
|
|
9
|
+
}
|
|
10
|
+
async function startJourney(appKey, environment, provider, isCustomEnabled, theme) {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
OitiSDK.startJourney(appKey, environment, provider, data => {
|
|
13
|
+
try {
|
|
14
|
+
const parsedResponse = JSON.parse(data);
|
|
15
|
+
if (parsedResponse.status === 'success') {
|
|
16
|
+
resolve(parsedResponse.result);
|
|
17
|
+
} else {
|
|
18
|
+
reject(new Error(parsedResponse.message));
|
|
19
|
+
}
|
|
20
|
+
} catch (parseError) {
|
|
21
|
+
reject(new Error(`Failed to parse response: ${parseError}`));
|
|
22
|
+
}
|
|
23
|
+
}, error => reject(new Error(error)), isCustomEnabled, theme);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export const CertifaceSDK = {
|
|
27
|
+
checkCameraPermission,
|
|
28
|
+
requestCameraPermission,
|
|
29
|
+
startJourney
|
|
30
|
+
};
|
|
31
|
+
export * from "./@types/theme.js";
|
|
32
|
+
export * from "./@types/result.js";
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["OitiSDK","checkCameraPermission","requestCameraPermission","startJourney","appKey","environment","provider","isCustomEnabled","theme","Promise","resolve","reject","data","parsedResponse","JSON","parse","status","result","Error","message","parseError","error","CertifaceSDK"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,OAAOA,OAAO,MAAM,kBAAe;AAMnC,SAASC,qBAAqBA,CAAA,EAAqB;EACjD,OAAOD,OAAO,CAACC,qBAAqB,CAAC,CAAC;AACxC;AAEA,SAASC,uBAAuBA,CAAA,EAAqB;EACnD,OAAOF,OAAO,CAACE,uBAAuB,CAAC,CAAC;AAC1C;AAEA,eAAeC,YAAYA,CACzBC,MAAc,EACdC,WAAwB,EACxBC,QAA0B,EAC1BC,eAAyB,EACzBC,KAAiB,EACQ;EACzB,OAAO,IAAIC,OAAO,CAAC,CAACC,OAAO,EAAEC,MAAM,KAAK;IACtCX,OAAO,CAACG,YAAY,CAClBC,MAAM,EACNC,WAAW,EACXC,QAAQ,EACPM,IAAY,IAAK;MAChB,IAAI;QACF,MAAMC,cAAgC,GAAGC,IAAI,CAACC,KAAK,CAACH,IAAI,CAAC;QAEzD,IAAIC,cAAc,CAACG,MAAM,KAAK,SAAS,EAAE;UACvCN,OAAO,CAACG,cAAc,CAACI,MAAM,CAAC;QAChC,CAAC,MAAM;UACLN,MAAM,CAAC,IAAIO,KAAK,CAACL,cAAc,CAACM,OAAO,CAAC,CAAC;QAC3C;MACF,CAAC,CAAC,OAAOC,UAAU,EAAE;QACnBT,MAAM,CAAC,IAAIO,KAAK,CAAC,6BAA6BE,UAAU,EAAE,CAAC,CAAC;MAC9D;IACF,CAAC,EACAC,KAAa,IAAKV,MAAM,CAAC,IAAIO,KAAK,CAACG,KAAK,CAAC,CAAC,EAC3Cd,eAAe,EACfC,KACF,CAAC;EACH,CAAC,CAAC;AACJ;AAEA,OAAO,MAAMc,YAAY,GAAG;EAC1BrB,qBAAqB;EACrBC,uBAAuB;EACvBC;AACF,CAAC;AAED,cAAc,mBAAgB;AAC9B,cAAc,oBAAiB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Image } from 'react-native';
|
|
4
|
+
export class AssetProcessor {
|
|
5
|
+
static async processThemeAssets(theme) {
|
|
6
|
+
if (!theme) return theme;
|
|
7
|
+
const processedTheme = JSON.parse(JSON.stringify(theme));
|
|
8
|
+
if (processedTheme.instructions?.assets) {
|
|
9
|
+
processedTheme.instructions.assets = await this.processInstructionsAssets(processedTheme.instructions.assets);
|
|
10
|
+
}
|
|
11
|
+
if (processedTheme.iproov?.assets) {
|
|
12
|
+
processedTheme.iproov.assets = await this.processIProovAssets(processedTheme.iproov.assets);
|
|
13
|
+
}
|
|
14
|
+
if (processedTheme.facetec?.assets) {
|
|
15
|
+
processedTheme.facetec.assets = await this.processFacetecAssets(processedTheme.facetec.assets);
|
|
16
|
+
}
|
|
17
|
+
return processedTheme;
|
|
18
|
+
}
|
|
19
|
+
static async processInstructionsAssets(assets) {
|
|
20
|
+
const processedAssets = {};
|
|
21
|
+
if (assets.logo) {
|
|
22
|
+
processedAssets.logo = await this.convertAssetToBase64(assets.logo);
|
|
23
|
+
}
|
|
24
|
+
return processedAssets;
|
|
25
|
+
}
|
|
26
|
+
static async processIProovAssets(assets) {
|
|
27
|
+
const processedAssets = {};
|
|
28
|
+
if (assets.logo) {
|
|
29
|
+
processedAssets.logo = await this.convertAssetToBase64(assets.logo);
|
|
30
|
+
}
|
|
31
|
+
if (assets.closeButton) {
|
|
32
|
+
processedAssets.closeButton = await this.convertAssetToBase64(assets.closeButton);
|
|
33
|
+
}
|
|
34
|
+
return processedAssets;
|
|
35
|
+
}
|
|
36
|
+
static async processFacetecAssets(assets) {
|
|
37
|
+
const processedAssets = {};
|
|
38
|
+
if (assets.overlayBrandingImage) {
|
|
39
|
+
processedAssets.overlayBrandingImage = await this.convertAssetToBase64(assets.overlayBrandingImage);
|
|
40
|
+
}
|
|
41
|
+
if (assets.cancelButtonCustomImage) {
|
|
42
|
+
processedAssets.cancelButtonCustomImage = await this.convertAssetToBase64(assets.cancelButtonCustomImage);
|
|
43
|
+
}
|
|
44
|
+
if (assets.resultScreenCustomActivityIndicatorImage) {
|
|
45
|
+
processedAssets.resultScreenCustomActivityIndicatorImage = await this.convertAssetToBase64(assets.resultScreenCustomActivityIndicatorImage);
|
|
46
|
+
}
|
|
47
|
+
return processedAssets;
|
|
48
|
+
}
|
|
49
|
+
static async convertAssetToBase64(asset) {
|
|
50
|
+
return new Promise((resolve, reject) => {
|
|
51
|
+
if (typeof asset === 'string') {
|
|
52
|
+
resolve(asset);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const assetSource = Image.resolveAssetSource(asset);
|
|
56
|
+
if (!assetSource) {
|
|
57
|
+
reject(new Error('Failed to resolve asset source'));
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
fetch(assetSource.uri).then(response => response.blob()).then(blob => {
|
|
61
|
+
const reader = new FileReader();
|
|
62
|
+
reader.onload = () => {
|
|
63
|
+
if (typeof reader.result === 'string') {
|
|
64
|
+
resolve(reader.result);
|
|
65
|
+
} else {
|
|
66
|
+
reject(new Error('Failed to convert asset to base64'));
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
reader.onerror = () => reject(new Error('Failed to read asset blob'));
|
|
70
|
+
reader.readAsDataURL(blob);
|
|
71
|
+
}).catch(error => {
|
|
72
|
+
console.warn('Failed to convert asset to base64, using URI:', error);
|
|
73
|
+
resolve(assetSource.uri);
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=AssetProcessor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Image","AssetProcessor","processThemeAssets","theme","processedTheme","JSON","parse","stringify","instructions","assets","processInstructionsAssets","iproov","processIProovAssets","facetec","processFacetecAssets","processedAssets","logo","convertAssetToBase64","closeButton","overlayBrandingImage","cancelButtonCustomImage","resultScreenCustomActivityIndicatorImage","asset","Promise","resolve","reject","assetSource","resolveAssetSource","Error","fetch","uri","then","response","blob","reader","FileReader","onload","result","onerror","readAsDataURL","catch","error","console","warn"],"sourceRoot":"../../../src","sources":["utils/AssetProcessor.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface LivenessResult {
|
|
2
|
+
valid: boolean;
|
|
3
|
+
codID: string;
|
|
4
|
+
cause: string;
|
|
5
|
+
protocol: string;
|
|
6
|
+
scanResultBlob: string;
|
|
7
|
+
}
|
|
8
|
+
export interface LivenessSuccessResponse {
|
|
9
|
+
status: 'success';
|
|
10
|
+
result: LivenessResult;
|
|
11
|
+
}
|
|
12
|
+
export interface LivenessErrorResponse {
|
|
13
|
+
status: 'error';
|
|
14
|
+
message: string;
|
|
15
|
+
}
|
|
16
|
+
export type LivenessResponse = LivenessSuccessResponse | LivenessErrorResponse;
|
|
17
|
+
//# sourceMappingURL=result.d.ts.map
|