assentify-sdk-react-native 0.0.42 → 1.0.0-Beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -3
- package/android/build.gradle +31 -32
- package/android/gradle.properties +2 -2
- package/android/src/main/java/com/assentifysdk/AssentifySdkModule.kt +81 -118
- package/android/src/main/java/com/assentifysdk/FaceMatchActivity.kt +27 -24
- package/android/src/main/java/com/assentifysdk/FlowActivity.kt +198 -0
- package/android/src/main/java/com/assentifysdk/QrActivity.kt +10 -11
- package/android/src/main/java/com/assentifysdk/ScanIDActivity.kt +83 -98
- package/android/src/main/java/com/assentifysdk/ScanOtherActivity.kt +7 -6
- package/android/src/main/java/com/assentifysdk/ScanPassportActivity.kt +8 -13
- package/android/src/main/res/layout/activity_face_scan.xml +1 -1
- package/android/src/main/res/layout/activity_flow.xml +9 -0
- package/android/src/main/res/layout/activity_scan.xml +1 -1
- package/assentify-sdk.podspec +2 -1
- package/ios/NativeAssentifySdk.mm +24 -4
- package/ios/NativeAssentifySdk.swift +240 -30
- package/ios/UIComponents/RNPassportScanner.swift +4 -3
- package/ios/View/FaceMatchController.swift +131 -124
- package/ios/View/IDCardController.swift +48 -35
- package/ios/View/OtherController.swift +9 -18
- package/ios/View/PassportController.swift +82 -121
- package/ios/View/QrController.swift +9 -6
- package/lib/commonjs/AssentifyProvider.js +97 -101
- package/lib/commonjs/AssentifyProvider.js.map +1 -1
- package/lib/commonjs/AssentifyWrapper.js +11 -17
- package/lib/commonjs/AssentifyWrapper.js.map +1 -1
- package/lib/commonjs/BackgroundType.js +11 -0
- package/lib/commonjs/BackgroundType.js.map +1 -0
- package/lib/commonjs/helpers/parsers/FlowCompletedModelParser.js +26 -0
- package/lib/commonjs/helpers/parsers/FlowCompletedModelParser.js.map +1 -0
- package/lib/commonjs/index.js +4 -4
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/AssentifyProvider.js +95 -98
- package/lib/module/AssentifyProvider.js.map +1 -1
- package/lib/module/AssentifyWrapper.js +11 -17
- package/lib/module/AssentifyWrapper.js.map +1 -1
- package/lib/module/BackgroundType.js +5 -0
- package/lib/module/BackgroundType.js.map +1 -0
- package/lib/module/helpers/parsers/FlowCompletedModelParser.js +20 -0
- package/lib/module/helpers/parsers/FlowCompletedModelParser.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/example/babel.config.d.ts +153 -1
- package/lib/typescript/example/babel.config.d.ts.map +1 -1
- package/lib/typescript/example/metro.config.d.ts +2 -2
- package/lib/typescript/example/metro.config.d.ts.map +1 -1
- package/lib/typescript/example/react-native.config.d.ts +153 -1
- package/lib/typescript/example/react-native.config.d.ts.map +1 -1
- package/lib/typescript/example/src/App.d.ts.map +1 -1
- package/lib/typescript/example/src/Home.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts +3 -1
- package/lib/typescript/lib/commonjs/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts +4 -6
- package/lib/typescript/lib/commonjs/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/BackgroundType.d.ts +6 -0
- package/lib/typescript/lib/commonjs/BackgroundType.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/FlowCompletedModelParser.d.ts +11 -0
- package/lib/typescript/lib/commonjs/helpers/parsers/FlowCompletedModelParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/AssentifyProvider.d.ts +4 -2
- package/lib/typescript/lib/module/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts +4 -6
- package/lib/typescript/lib/module/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/lib/module/BackgroundType.d.ts +5 -0
- package/lib/typescript/lib/module/BackgroundType.d.ts.map +1 -0
- package/lib/typescript/lib/module/helpers/parsers/FlowCompletedModelParser.d.ts +10 -0
- package/lib/typescript/lib/module/helpers/parsers/FlowCompletedModelParser.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +5 -7
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyProvider.d.ts +5 -2
- package/lib/typescript/src/AssentifyProvider.d.ts.map +1 -1
- package/lib/typescript/src/AssentifyWrapper.d.ts +6 -7
- package/lib/typescript/src/AssentifyWrapper.d.ts.map +1 -1
- package/lib/typescript/src/BackgroundType.d.ts +6 -0
- package/lib/typescript/src/BackgroundType.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/FaceMatchParser.d.ts.map +1 -1
- package/lib/typescript/src/helpers/parsers/FlowCompletedModelParser.d.ts +4 -0
- package/lib/typescript/src/helpers/parsers/FlowCompletedModelParser.d.ts.map +1 -0
- package/lib/typescript/src/helpers/parsers/IDCardParser.d.ts.map +1 -1
- package/lib/typescript/src/helpers/parsers/OtherIDParser.d.ts.map +1 -1
- package/lib/typescript/src/helpers/parsers/PassportParser.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +5 -7
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +11 -2
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +14 -10
- package/src/AssentifyProvider.tsx +207 -147
- package/src/AssentifyWrapper.ts +55 -27
- package/src/BackgroundType.ts +7 -0
- package/src/helpers/parsers/FlowCompletedModelParser.ts +31 -0
- package/src/index.ts +1 -1
- package/src/types.ts +13 -2
- package/lib/commonjs/DoneFlags.js +0 -14
- package/lib/commonjs/DoneFlags.js.map +0 -1
- package/lib/module/DoneFlags.js +0 -8
- package/lib/module/DoneFlags.js.map +0 -1
- package/lib/typescript/lib/commonjs/DoneFlags.d.ts +0 -9
- package/lib/typescript/lib/commonjs/DoneFlags.d.ts.map +0 -1
- package/lib/typescript/lib/module/DoneFlags.d.ts +0 -8
- package/lib/typescript/lib/module/DoneFlags.d.ts.map +0 -1
- package/lib/typescript/src/DoneFlags.d.ts +0 -9
- package/lib/typescript/src/DoneFlags.d.ts.map +0 -1
- package/src/DoneFlags.ts +0 -11
|
@@ -8,7 +8,9 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
|
|
|
8
8
|
{
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
func onUploadingProgress(progress: Double) {
|
|
12
|
+
// NOTHING TODO
|
|
13
|
+
}
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
private var isDone:Bool = false;
|
|
@@ -201,64 +203,28 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
|
|
|
201
203
|
|
|
202
204
|
|
|
203
205
|
|
|
204
|
-
func onComplete(dataModel: PassportResponseModel
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
if let isExpired = dataModel.passportExtractedModel?
|
|
208
|
-
.identificationDocumentCapture?.IsExpired as? Bool,
|
|
209
|
-
isExpired && doneFlag == DoneFlags.Success {
|
|
210
|
-
if(isExpired as! Bool == true){
|
|
211
|
-
DispatchQueue.main.async {
|
|
212
|
-
self.start = false;
|
|
213
|
-
self.popUpMessage!.removeFromSuperview();
|
|
214
|
-
self.popUpMessage = showPopUpMessage(view: self.view, title: "Expired", subTitle: "Please provide valid ID",initialTextColorHex:self.processingColor,initialBackgroundColorHex:self.holdHandColor, iconName: "expire", isGif: false,target: self, action: #selector(self.dismissPopUpMessage))
|
|
215
|
-
}
|
|
216
|
-
}else{
|
|
217
|
-
if(!isDone){
|
|
218
|
-
isDone = true;
|
|
219
|
-
if let outputProperties = try? JSONSerialization.data(withJSONObject: dataModel.passportExtractedModel?.transformedProperties, options: []) {
|
|
220
|
-
if UserDefaults.standard.object(forKey: String(self.stepID)) != nil {
|
|
221
|
-
UserDefaults.standard.removeObject(forKey: String(self.stepID))
|
|
222
|
-
}
|
|
223
|
-
UserDefaults.standard.set(nil, forKey:String(self.stepID))
|
|
224
|
-
UserDefaults.standard.set(outputProperties, forKey: String(self.stepID))
|
|
225
|
-
}
|
|
226
|
-
triggerCompleteEvent(eventName:"onComplete",dataModel:dataModel.passportExtractedModel,doneFlag: doneFlag)
|
|
227
|
-
DispatchQueue.main.async {
|
|
228
|
-
self.scanPassport?.stopScanning();
|
|
229
|
-
self.scanPassport?.willMove(toParent: nil)
|
|
230
|
-
self.scanPassport?.view.removeFromSuperview()
|
|
231
|
-
self.scanPassport?.removeFromParent()
|
|
232
|
-
self.scanPassport = nil
|
|
233
|
-
self.dismiss(animated: false)
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
} else {
|
|
238
|
-
if(!isDone){
|
|
239
|
-
isDone = true;
|
|
240
|
-
if let outputProperties = try? JSONSerialization.data(withJSONObject: dataModel.passportExtractedModel?.transformedProperties, options: []) {
|
|
241
|
-
if UserDefaults.standard.object(forKey: String(self.stepID)) != nil {
|
|
242
|
-
UserDefaults.standard.removeObject(forKey: String(self.stepID))
|
|
243
|
-
}
|
|
244
|
-
UserDefaults.standard.set(nil, forKey:String(self.stepID))
|
|
245
|
-
UserDefaults.standard.set(outputProperties, forKey: String(self.stepID))
|
|
246
|
-
}
|
|
247
|
-
triggerCompleteEvent(eventName:"onComplete",dataModel:dataModel.passportExtractedModel,doneFlag: doneFlag)
|
|
248
|
-
DispatchQueue.main.async {
|
|
249
|
-
self.scanPassport?.stopScanning();
|
|
250
|
-
self.scanPassport?.willMove(toParent: nil)
|
|
251
|
-
self.scanPassport?.view.removeFromSuperview()
|
|
252
|
-
self.scanPassport?.removeFromParent()
|
|
253
|
-
self.scanPassport = nil
|
|
254
|
-
self.dismiss(animated: false)
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
206
|
+
func onComplete(dataModel: PassportResponseModel) {
|
|
261
207
|
|
|
208
|
+
if(!isDone){
|
|
209
|
+
isDone = true;
|
|
210
|
+
if let outputProperties = try? JSONSerialization.data(withJSONObject: dataModel.passportExtractedModel?.transformedProperties, options: []) {
|
|
211
|
+
if UserDefaults.standard.object(forKey: String(self.stepID)) != nil {
|
|
212
|
+
UserDefaults.standard.removeObject(forKey: String(self.stepID))
|
|
213
|
+
}
|
|
214
|
+
UserDefaults.standard.set(nil, forKey:String(self.stepID))
|
|
215
|
+
UserDefaults.standard.set(outputProperties, forKey: String(self.stepID))
|
|
216
|
+
}
|
|
217
|
+
triggerCompleteEvent(eventName:"onComplete",dataModel:dataModel.passportExtractedModel)
|
|
218
|
+
DispatchQueue.main.async {
|
|
219
|
+
self.scanPassport?.stopScanning();
|
|
220
|
+
self.scanPassport?.willMove(toParent: nil)
|
|
221
|
+
self.scanPassport?.view.removeFromSuperview()
|
|
222
|
+
self.scanPassport?.removeFromParent()
|
|
223
|
+
self.scanPassport = nil
|
|
224
|
+
self.dismiss(animated: false)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
262
228
|
}
|
|
263
229
|
|
|
264
230
|
func onCardDetected(dataModel: RemoteProcessingModel) {
|
|
@@ -306,72 +272,67 @@ class PassportController: UIViewController ,ScanPassportDelegate , ChildViewCont
|
|
|
306
272
|
triggerEvent(eventName:"onUploadFailed",dataModel:dataModel)
|
|
307
273
|
}
|
|
308
274
|
|
|
309
|
-
func onEnvironmentalConditionsChange(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
275
|
+
func onEnvironmentalConditionsChange( brightnessEvents: BrightnessEvents,
|
|
276
|
+
motion: MotionType,
|
|
277
|
+
zoom: ZoomType,
|
|
278
|
+
isCentered:Bool) {
|
|
279
|
+
DispatchQueue.main.async {
|
|
280
|
+
if self.start == false {
|
|
281
|
+
if (zoom != ZoomType.SENDING && zoom != ZoomType.NO_DETECT) {
|
|
282
|
+
if (zoom == ZoomType.ZOOM_IN) {
|
|
283
|
+
self.start = false
|
|
284
|
+
self.infoLabel?.text = "Move Passport Closer"
|
|
285
|
+
self.infoImage!.image = UIImage(named: "zoom_in")
|
|
286
|
+
}
|
|
287
|
+
if (zoom == ZoomType.ZOOM_OUT) {
|
|
288
|
+
self.start = false
|
|
289
|
+
self.infoLabel?.text = "Move Passport Further"
|
|
290
|
+
self.infoImage!.image = UIImage(named: "zoom_out")
|
|
291
|
+
}
|
|
292
|
+
} else if (motion != MotionType.SENDING && motion != MotionType.NO_DETECT) {
|
|
293
|
+
self.start = false
|
|
294
|
+
self.infoLabel?.text = "Please Hold Your Hand"
|
|
295
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
296
|
+
} else if brightnessEvents != BrightnessEvents.Good {
|
|
297
|
+
if brightnessEvents == BrightnessEvents.TooDark {
|
|
298
|
+
self.start = false
|
|
299
|
+
self.infoLabel?.text = "Please increase the lighting"
|
|
300
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
301
|
+
}
|
|
302
|
+
if brightnessEvents == BrightnessEvents.TooBright {
|
|
303
|
+
self.start = false
|
|
304
|
+
self.infoLabel?.text = "Please reduce the lighting"
|
|
305
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
306
|
+
}
|
|
307
|
+
} else {
|
|
308
|
+
if (motion == MotionType.SENDING && zoom == ZoomType.SENDING && brightnessEvents == BrightnessEvents.Good) {
|
|
309
|
+
self.start = false
|
|
310
|
+
self.infoLabel?.text = "Hold Steady"
|
|
311
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
312
|
+
}
|
|
313
|
+
if (motion == MotionType.NO_DETECT && zoom == ZoomType.NO_DETECT) {
|
|
314
|
+
self.start = false
|
|
315
|
+
self.infoLabel?.text = "Please present passport"
|
|
316
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
317
|
+
} else if(!isCentered){
|
|
318
|
+
self.start = false
|
|
319
|
+
self.infoLabel?.text = " Please center your card"
|
|
320
|
+
self.infoImage!.image = UIImage(named: "info_icon")
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
}
|
|
324
|
+
} else {
|
|
325
|
+
self.infoLabel?.removeFromSuperview()
|
|
326
|
+
self.infoImage?.removeFromSuperview()
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
}
|
|
357
331
|
|
|
358
|
-
func triggerCompleteEvent(eventName:String, dataModel: PassportExtractedModel
|
|
332
|
+
func triggerCompleteEvent(eventName:String, dataModel: PassportExtractedModel?){
|
|
359
333
|
var eventResultMap: [String: Any] = [:]
|
|
360
334
|
if(dataModel != nil){
|
|
361
|
-
|
|
362
|
-
switch doneFlag {
|
|
363
|
-
case .Success:
|
|
364
|
-
doneFlagValue = "Success";
|
|
365
|
-
case .LivenessFailed:
|
|
366
|
-
doneFlagValue = "LivenessFailed";
|
|
367
|
-
case .ExtractFailed:
|
|
368
|
-
doneFlagValue = "ExtractFailed";
|
|
369
|
-
case .MatchFailed:
|
|
370
|
-
doneFlagValue = "MatchFailed";
|
|
371
|
-
case .WrongTemplate:
|
|
372
|
-
doneFlagValue = "WrongTemplate";
|
|
373
|
-
}
|
|
374
|
-
eventResultMap = ["PassportDataModel": passportModelToJsonString(dataModel: dataModel) as Any,"DoneFlag":doneFlagValue]
|
|
335
|
+
eventResultMap = ["PassportDataModel": passportModelToJsonString(dataModel: dataModel) as Any]
|
|
375
336
|
}
|
|
376
337
|
DispatchQueue.main.async {
|
|
377
338
|
self.nativeAssentifySdk?.sendEvent(withName: eventName, body: eventResultMap)
|
|
@@ -8,7 +8,10 @@ class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelega
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
func onUploadingProgress(progress: Double) {
|
|
12
|
+
// NOTHING TODO
|
|
13
|
+
}
|
|
14
|
+
|
|
12
15
|
|
|
13
16
|
private var imageUrl: String? = "";
|
|
14
17
|
private var apiKey: String? = "";
|
|
@@ -22,7 +25,7 @@ class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelega
|
|
|
22
25
|
private var processingColor: String;
|
|
23
26
|
private var language: String;
|
|
24
27
|
private var showCountDown:Bool = true;
|
|
25
|
-
private var
|
|
28
|
+
private var templatesByCountry: TemplatesByCountry;
|
|
26
29
|
private var titleID:String? = "";
|
|
27
30
|
private var nativeAssentifySdk:NativeAssentifySdk?;
|
|
28
31
|
private var outputResultProperties: [String: Any]? = [:];
|
|
@@ -32,12 +35,12 @@ class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelega
|
|
|
32
35
|
private var backIDPage: UIView?;
|
|
33
36
|
private var scanQr:ScanQr?;
|
|
34
37
|
|
|
35
|
-
init(assentifySdk: AssentifySdk,nativeAssentifySdk:NativeAssentifySdk,holdHandColor: String,processingColor: String,
|
|
38
|
+
init(assentifySdk: AssentifySdk,nativeAssentifySdk:NativeAssentifySdk,holdHandColor: String,processingColor: String,templatesByCountry: TemplatesByCountry,language:String,titleID:String,showCountDown:Bool,apiKey:String,stepID:Int,manualClickColor:String) {
|
|
36
39
|
self.assentifySdk = assentifySdk
|
|
37
40
|
self.nativeAssentifySdk = nativeAssentifySdk
|
|
38
41
|
self.holdHandColor = holdHandColor
|
|
39
42
|
self.processingColor = processingColor
|
|
40
|
-
self.
|
|
43
|
+
self.templatesByCountry = templatesByCountry
|
|
41
44
|
self.language = language
|
|
42
45
|
self.titleID = titleID
|
|
43
46
|
self.showCountDown = showCountDown
|
|
@@ -59,7 +62,7 @@ class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelega
|
|
|
59
62
|
self.view.backgroundColor = .clear
|
|
60
63
|
UIApplication.shared.isStatusBarHidden = false;
|
|
61
64
|
DispatchQueue.main.async {
|
|
62
|
-
|
|
65
|
+
self.scanQr = self.assentifySdk?.startScanQr(scanQrDelegate: self, templatesByCountry: self.templatesByCountry,language:self.language,stepId: self.stepID)
|
|
63
66
|
self.addChild(self.scanQr!)
|
|
64
67
|
self.view.addSubview(self.scanQr!.view)
|
|
65
68
|
self.scanQr!.view.translatesAutoresizingMaskIntoConstraints = false
|
|
@@ -143,7 +146,7 @@ class QrController: UIViewController ,ScanQrDelegate , ChildViewControllerDelega
|
|
|
143
146
|
}
|
|
144
147
|
}
|
|
145
148
|
|
|
146
|
-
func onErrorQrScan(message: String) {
|
|
149
|
+
func onErrorQrScan(message: String,dataModel: RemoteProcessingModel) {
|
|
147
150
|
triggerEvent(eventName:"onErrorQrScan",dataModel:nil)
|
|
148
151
|
DispatchQueue.main.async {
|
|
149
152
|
self.start = false;
|
|
@@ -5,232 +5,229 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.AssentifyProvider = void 0;
|
|
7
7
|
var _reactNative = require("react-native");
|
|
8
|
-
var
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _PassportParser = _interopRequireDefault(require("./helpers/parsers/PassportParser"));
|
|
10
10
|
var _FaceMatchParser = _interopRequireDefault(require("./helpers/parsers/FaceMatchParser"));
|
|
11
11
|
var _IDCardParser = _interopRequireDefault(require("./helpers/parsers/IDCardParser"));
|
|
12
12
|
var _OtherIDParser = _interopRequireDefault(require("./helpers/parsers/OtherIDParser"));
|
|
13
|
+
var _FlowCompletedModelParser = _interopRequireDefault(require("./helpers/parsers/FlowCompletedModelParser"));
|
|
13
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
-
function
|
|
15
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
16
16
|
const {
|
|
17
17
|
NativeAssentifySdk
|
|
18
18
|
} = _reactNative.NativeModules;
|
|
19
|
-
const AssentifyContext = /*#__PURE__*/
|
|
19
|
+
const AssentifyContext = /*#__PURE__*/React.createContext(undefined);
|
|
20
20
|
_reactNative.LogBox.ignoreAllLogs();
|
|
21
|
-
const AssentifyProvider = (
|
|
22
|
-
|
|
21
|
+
const AssentifyProvider = ({
|
|
22
|
+
children
|
|
23
|
+
}) => {
|
|
24
|
+
React.useEffect(() => {
|
|
23
25
|
const emitter = new _reactNative.NativeEventEmitter(NativeAssentifySdk);
|
|
24
|
-
|
|
25
|
-
/// Initialize
|
|
26
26
|
const assentifySdkInit = emitter.addListener('AppResult', result => {
|
|
27
27
|
if ((result === null || result === void 0 ? void 0 : result.assentifySdkInitSuccess) != null) {
|
|
28
|
-
if (result
|
|
28
|
+
if (result.assentifySdkInitSuccess) {
|
|
29
29
|
const templates = JSON.parse(result === null || result === void 0 ? void 0 : result.AssentifySdkHasTemplates);
|
|
30
30
|
const stepDefinitions = JSON.parse(result === null || result === void 0 ? void 0 : result.StepDefinitions);
|
|
31
31
|
_reactNative.DeviceEventEmitter.emit('assentifySdkInit', {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
status: true,
|
|
33
|
+
templates,
|
|
34
|
+
stepDefinitions
|
|
35
35
|
});
|
|
36
36
|
} else {
|
|
37
37
|
_reactNative.DeviceEventEmitter.emit('assentifySdkInit', {
|
|
38
|
-
|
|
38
|
+
status: false
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
|
-
|
|
44
|
-
/// onComplete
|
|
45
43
|
const onComplete = emitter.addListener('onComplete', result => {
|
|
46
44
|
if (result !== null && result !== void 0 && result.PassportDataModel) {
|
|
47
|
-
const response = (0, _PassportParser.default)(result
|
|
48
|
-
const doneFlag = result === null || result === void 0 ? void 0 : result.DoneFlag;
|
|
45
|
+
const response = (0, _PassportParser.default)(result.PassportDataModel);
|
|
49
46
|
_reactNative.DeviceEventEmitter.emit('onCompletePassport', {
|
|
50
|
-
|
|
51
|
-
"doneFlag": doneFlag
|
|
47
|
+
passportExtractedModel: response
|
|
52
48
|
});
|
|
53
49
|
} else if (result !== null && result !== void 0 && result.FaceMatchDataModel) {
|
|
54
|
-
const response = (0, _FaceMatchParser.default)(result
|
|
55
|
-
const doneFlag = result === null || result === void 0 ? void 0 : result.DoneFlag;
|
|
50
|
+
const response = (0, _FaceMatchParser.default)(result.FaceMatchDataModel);
|
|
56
51
|
_reactNative.DeviceEventEmitter.emit('onCompleteFaceMatch', {
|
|
57
|
-
|
|
58
|
-
"doneFlag": doneFlag
|
|
52
|
+
faceExtractedModel: response
|
|
59
53
|
});
|
|
60
54
|
} else if (result !== null && result !== void 0 && result.IdDataModel) {
|
|
61
|
-
const response = (0, _IDCardParser.default)(result
|
|
62
|
-
const
|
|
55
|
+
const response = (0, _IDCardParser.default)(result.IdDataModel);
|
|
56
|
+
const isFrontPage = result === null || result === void 0 ? void 0 : result.isFrontPage;
|
|
57
|
+
const isLastPage = result === null || result === void 0 ? void 0 : result.isLastPage;
|
|
63
58
|
_reactNative.DeviceEventEmitter.emit('onCompleteIDCard', {
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
iDExtractedModel: response,
|
|
60
|
+
isFrontPage,
|
|
61
|
+
isLastPage
|
|
66
62
|
});
|
|
67
63
|
} else if (result !== null && result !== void 0 && result.OtherDataModel) {
|
|
68
|
-
const response = (0, _OtherIDParser.default)(result
|
|
69
|
-
const doneFlag = result === null || result === void 0 ? void 0 : result.DoneFlag;
|
|
64
|
+
const response = (0, _OtherIDParser.default)(result.OtherDataModel);
|
|
70
65
|
_reactNative.DeviceEventEmitter.emit('onCompleteOther', {
|
|
71
|
-
|
|
72
|
-
"doneFlag": doneFlag
|
|
66
|
+
otherExtractedModel: response
|
|
73
67
|
});
|
|
74
68
|
}
|
|
75
69
|
});
|
|
76
70
|
const onCompleteQrScan = emitter.addListener('onCompleteQrScan', result => {
|
|
77
71
|
if (result !== null && result !== void 0 && result.IdQrDataModel) {
|
|
78
|
-
const response = (0, _IDCardParser.default)(result
|
|
72
|
+
const response = (0, _IDCardParser.default)(result.IdQrDataModel);
|
|
79
73
|
_reactNative.DeviceEventEmitter.emit('onCompleteQr', {
|
|
80
|
-
|
|
74
|
+
iDExtractedModel: response
|
|
81
75
|
});
|
|
82
76
|
}
|
|
83
77
|
});
|
|
84
|
-
|
|
85
|
-
// General
|
|
86
|
-
const onStartQrScan = emitter.addListener('onStartQrScan', _result => {
|
|
78
|
+
const onStartQrScan = emitter.addListener('onStartQrScan', () => {
|
|
87
79
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
88
|
-
|
|
80
|
+
eventName: 'onStartQrScan'
|
|
89
81
|
});
|
|
90
82
|
});
|
|
91
|
-
const onErrorQrScan = emitter.addListener('onErrorQrScan',
|
|
83
|
+
const onErrorQrScan = emitter.addListener('onErrorQrScan', () => {
|
|
92
84
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
93
|
-
|
|
85
|
+
eventName: 'onErrorQrScan'
|
|
94
86
|
});
|
|
95
87
|
});
|
|
96
|
-
const onSendEvent = emitter.addListener('onSend',
|
|
88
|
+
const onSendEvent = emitter.addListener('onSend', () => {
|
|
97
89
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
98
|
-
|
|
90
|
+
eventName: 'onSend'
|
|
99
91
|
});
|
|
100
92
|
});
|
|
101
|
-
const onRetryEvent = emitter.addListener('onRetry',
|
|
93
|
+
const onRetryEvent = emitter.addListener('onRetry', () => {
|
|
102
94
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
103
|
-
|
|
95
|
+
eventName: 'onRetry'
|
|
104
96
|
});
|
|
105
97
|
});
|
|
106
|
-
const onClipPreparationCompleteEvent = emitter.addListener('onClipPreparationComplete',
|
|
98
|
+
const onClipPreparationCompleteEvent = emitter.addListener('onClipPreparationComplete', () => {
|
|
107
99
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
108
|
-
|
|
100
|
+
eventName: 'onClipPreparationComplete'
|
|
109
101
|
});
|
|
110
102
|
});
|
|
111
|
-
const onStatusUpdatedEvent = emitter.addListener('onStatusUpdated',
|
|
103
|
+
const onStatusUpdatedEvent = emitter.addListener('onStatusUpdated', () => {
|
|
112
104
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
113
|
-
|
|
105
|
+
eventName: 'onStatusUpdated'
|
|
114
106
|
});
|
|
115
107
|
});
|
|
116
|
-
const onUpdatedEvent = emitter.addListener('onUpdated',
|
|
108
|
+
const onUpdatedEvent = emitter.addListener('onUpdated', () => {
|
|
117
109
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
118
|
-
|
|
110
|
+
eventName: 'onUpdated'
|
|
119
111
|
});
|
|
120
112
|
});
|
|
121
|
-
const onLivenessUpdateEvent = emitter.addListener('onLivenessUpdate',
|
|
113
|
+
const onLivenessUpdateEvent = emitter.addListener('onLivenessUpdate', () => {
|
|
122
114
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
123
|
-
|
|
115
|
+
eventName: 'onLivenessUpdate'
|
|
124
116
|
});
|
|
125
117
|
});
|
|
126
|
-
const onCardDetectedEvent = emitter.addListener('onCardDetected',
|
|
118
|
+
const onCardDetectedEvent = emitter.addListener('onCardDetected', () => {
|
|
127
119
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
128
|
-
|
|
120
|
+
eventName: 'onCardDetected'
|
|
129
121
|
});
|
|
130
122
|
});
|
|
131
|
-
const onMrzExtractedEvent = emitter.addListener('onMrzExtracted',
|
|
123
|
+
const onMrzExtractedEvent = emitter.addListener('onMrzExtracted', () => {
|
|
132
124
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
133
|
-
|
|
125
|
+
eventName: 'onMrzExtracted'
|
|
134
126
|
});
|
|
135
127
|
});
|
|
136
|
-
const onMrzDetectedEvent = emitter.addListener('onMrzDetected',
|
|
128
|
+
const onMrzDetectedEvent = emitter.addListener('onMrzDetected', () => {
|
|
137
129
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
138
|
-
|
|
130
|
+
eventName: 'onMrzDetected'
|
|
139
131
|
});
|
|
140
132
|
});
|
|
141
|
-
const onNoMrzDetectedEvent = emitter.addListener('onNoMrzDetected',
|
|
133
|
+
const onNoMrzDetectedEvent = emitter.addListener('onNoMrzDetected', () => {
|
|
142
134
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
143
|
-
|
|
135
|
+
eventName: 'onNoMrzDetected'
|
|
144
136
|
});
|
|
145
137
|
});
|
|
146
|
-
const onFaceDetectedEvent = emitter.addListener('onFaceDetected',
|
|
138
|
+
const onFaceDetectedEvent = emitter.addListener('onFaceDetected', () => {
|
|
147
139
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
148
|
-
|
|
140
|
+
eventName: 'onFaceDetected'
|
|
149
141
|
});
|
|
150
142
|
});
|
|
151
|
-
const onNoFaceDetectedEvent = emitter.addListener('onNoFaceDetected',
|
|
143
|
+
const onNoFaceDetectedEvent = emitter.addListener('onNoFaceDetected', () => {
|
|
152
144
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
153
|
-
|
|
145
|
+
eventName: 'onNoFaceDetected'
|
|
154
146
|
});
|
|
155
147
|
});
|
|
156
|
-
const onFaceExtractedEvent = emitter.addListener('onFaceExtracted',
|
|
148
|
+
const onFaceExtractedEvent = emitter.addListener('onFaceExtracted', () => {
|
|
157
149
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
158
|
-
|
|
150
|
+
eventName: 'onFaceExtracted'
|
|
159
151
|
});
|
|
160
152
|
});
|
|
161
|
-
const onQualityCheckAvailableEvent = emitter.addListener('onQualityCheckAvailable',
|
|
153
|
+
const onQualityCheckAvailableEvent = emitter.addListener('onQualityCheckAvailable', () => {
|
|
162
154
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
163
|
-
|
|
155
|
+
eventName: 'onQualityCheckAvailable'
|
|
164
156
|
});
|
|
165
157
|
});
|
|
166
|
-
const onDocumentCapturedEvent = emitter.addListener('onDocumentCaptured',
|
|
158
|
+
const onDocumentCapturedEvent = emitter.addListener('onDocumentCaptured', () => {
|
|
167
159
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
168
|
-
|
|
160
|
+
eventName: 'onDocumentCaptured'
|
|
169
161
|
});
|
|
170
162
|
});
|
|
171
|
-
const onDocumentCroppedEvent = emitter.addListener('onDocumentCropped',
|
|
163
|
+
const onDocumentCroppedEvent = emitter.addListener('onDocumentCropped', () => {
|
|
172
164
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
173
|
-
|
|
165
|
+
eventName: 'onDocumentCropped'
|
|
174
166
|
});
|
|
175
167
|
});
|
|
176
|
-
const onUploadFailedEvent = emitter.addListener('onUploadFailed',
|
|
168
|
+
const onUploadFailedEvent = emitter.addListener('onUploadFailed', () => {
|
|
177
169
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
178
|
-
|
|
170
|
+
eventName: 'onUploadFailed'
|
|
179
171
|
});
|
|
180
172
|
});
|
|
181
|
-
const onWrongTemplate = emitter.addListener('onWrongTemplate',
|
|
173
|
+
const onWrongTemplate = emitter.addListener('onWrongTemplate', () => {
|
|
182
174
|
_reactNative.DeviceEventEmitter.emit('EventResult', {
|
|
183
|
-
|
|
175
|
+
eventName: 'onWrongTemplate'
|
|
184
176
|
});
|
|
185
177
|
});
|
|
186
|
-
|
|
187
|
-
/// onHasTokens
|
|
188
178
|
const onHasTokens = emitter.addListener('onHasTokens', result => {
|
|
189
179
|
if (result != null) {
|
|
190
180
|
const response = JSON.parse(result === null || result === void 0 ? void 0 : result.documentTokens);
|
|
191
181
|
_reactNative.DeviceEventEmitter.emit('signingOnHasTokens', {
|
|
192
|
-
|
|
182
|
+
documentTokens: response
|
|
193
183
|
});
|
|
194
184
|
}
|
|
195
185
|
});
|
|
196
|
-
|
|
197
|
-
/// onCreateUserDocumentInstance
|
|
198
186
|
const onCreateUserDocumentInstance = emitter.addListener('onCreateUserDocumentInstance', result => {
|
|
199
187
|
if (result != null) {
|
|
200
188
|
const response = JSON.parse(result === null || result === void 0 ? void 0 : result.userDocumentResponseModel);
|
|
201
189
|
_reactNative.DeviceEventEmitter.emit('signingOnCreateUserDocumentInstance', {
|
|
202
|
-
|
|
190
|
+
userDocumentResponseModel: response
|
|
203
191
|
});
|
|
204
192
|
}
|
|
205
193
|
});
|
|
206
|
-
|
|
207
|
-
/// onSignature
|
|
208
194
|
const onSignature = emitter.addListener('onSignature', result => {
|
|
209
195
|
if (result != null) {
|
|
210
196
|
const response = JSON.parse(result === null || result === void 0 ? void 0 : result.signatureResponseModel);
|
|
211
197
|
_reactNative.DeviceEventEmitter.emit('signingOnSignature', {
|
|
212
|
-
|
|
198
|
+
signatureResponseModel: response
|
|
213
199
|
});
|
|
214
200
|
}
|
|
215
201
|
});
|
|
216
|
-
|
|
217
|
-
/// SubmitResult
|
|
218
202
|
const submitResult = emitter.addListener('SubmitResult', result => {
|
|
219
203
|
if (result != null) {
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
204
|
+
_reactNative.DeviceEventEmitter.emit('SubmitDataEvents', {
|
|
205
|
+
Success: !!(result !== null && result !== void 0 && result.success)
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
});
|
|
209
|
+
const onNativeFlowCompleted = emitter.addListener('OnNativeFlowCompleted', result => {
|
|
210
|
+
if (result !== null && result !== void 0 && result.DataModel) {
|
|
211
|
+
const response = (0, _FlowCompletedModelParser.default)(result.DataModel);
|
|
212
|
+
_reactNative.DeviceEventEmitter.emit('OnFlowCompleted', {
|
|
213
|
+
dataModel: response
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
const onNativeStepCompleted = emitter.addListener('OnNativeStepCompleted', result => {
|
|
218
|
+
if (result !== null && result !== void 0 && result.DataModel) {
|
|
219
|
+
const response = (0, _FlowCompletedModelParser.default)(result.DataModel);
|
|
220
|
+
_reactNative.DeviceEventEmitter.emit('OnStepCompleted', {
|
|
221
|
+
dataModel: response
|
|
222
|
+
});
|
|
229
223
|
}
|
|
230
224
|
});
|
|
231
225
|
return () => {
|
|
232
226
|
assentifySdkInit.remove();
|
|
233
227
|
onComplete.remove();
|
|
228
|
+
onCompleteQrScan.remove();
|
|
229
|
+
onStartQrScan.remove();
|
|
230
|
+
onErrorQrScan.remove();
|
|
234
231
|
onSendEvent.remove();
|
|
235
232
|
onRetryEvent.remove();
|
|
236
233
|
onClipPreparationCompleteEvent.remove();
|
|
@@ -249,18 +246,17 @@ const AssentifyProvider = () => {
|
|
|
249
246
|
onDocumentCroppedEvent.remove();
|
|
250
247
|
onUploadFailedEvent.remove();
|
|
251
248
|
onWrongTemplate.remove();
|
|
252
|
-
submitResult.remove();
|
|
253
249
|
onHasTokens.remove();
|
|
254
250
|
onCreateUserDocumentInstance.remove();
|
|
255
251
|
onSignature.remove();
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
252
|
+
submitResult.remove();
|
|
253
|
+
onNativeFlowCompleted.remove();
|
|
254
|
+
onNativeStepCompleted.remove();
|
|
259
255
|
};
|
|
260
256
|
}, []);
|
|
261
|
-
return /*#__PURE__*/
|
|
257
|
+
return /*#__PURE__*/React.createElement(AssentifyContext.Provider, {
|
|
262
258
|
value: undefined
|
|
263
|
-
});
|
|
259
|
+
}, children);
|
|
264
260
|
};
|
|
265
261
|
exports.AssentifyProvider = AssentifyProvider;
|
|
266
262
|
//# sourceMappingURL=AssentifyProvider.js.map
|