idmission-web-sdk 2.0.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +36 -28
  2. package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts +3 -12
  3. package/dist/components/customer_flows/IdAndFaceValidation.d.ts +3 -12
  4. package/dist/components/customer_flows/IdValidation.d.ts +3 -12
  5. package/dist/components/customer_flows/VideoIdValidation.d.ts +3 -12
  6. package/dist/components/id_capture/CapturedDocuments.d.ts +2 -0
  7. package/dist/components/id_capture/FocusModelProvider.d.ts +2 -1
  8. package/dist/components/id_capture/IdCapture.d.ts +4 -14
  9. package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +7 -22
  10. package/dist/components/id_capture/IdCaptureStateProvider.d.ts +11 -38
  11. package/dist/components/id_capture/IdCaptureSuccess.d.ts +2 -3
  12. package/dist/components/id_capture/IdCaptureWizard.d.ts +3 -9
  13. package/dist/components/video_id/IdVideoCapture.d.ts +12 -7
  14. package/dist/components/video_id/IdVideoCaptureWizard.d.ts +3 -8
  15. package/dist/lib/models/DocumentDetection.d.ts +15 -12
  16. package/dist/lib/models/Focus.d.ts +6 -2
  17. package/dist/lib/models/helpers.d.ts +2 -0
  18. package/dist/sdk2.cjs.development.js +842 -968
  19. package/dist/sdk2.cjs.development.js.map +1 -1
  20. package/dist/sdk2.cjs.production.js +1 -1
  21. package/dist/sdk2.cjs.production.js.map +1 -1
  22. package/dist/sdk2.esm.js +842 -968
  23. package/dist/sdk2.esm.js.map +1 -1
  24. package/dist/sdk2.umd.development.js +842 -968
  25. package/dist/sdk2.umd.development.js.map +1 -1
  26. package/dist/sdk2.umd.production.js +1 -1
  27. package/dist/sdk2.umd.production.js.map +1 -1
  28. package/dist/stories/Components/IdCapture/LicenseBackCapture.stories.d.ts +0 -48
  29. package/dist/stories/Components/IdCapture/LicenseFrontCapture.stories.d.ts +0 -45
  30. package/dist/stories/Components/IdCapture/PassportCapture.stories.d.ts +0 -47
  31. package/dist/stories/Components/IdCapture/Wizard.stories.d.ts +1 -77
  32. package/dist/version.d.ts +1 -1
  33. package/package.json +1 -1
@@ -49,7 +49,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
49
49
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
50
50
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
51
51
 
52
- var webSdkVersion = '2.0.2';
52
+ var webSdkVersion = '2.1.0';
53
53
 
54
54
  function getPlatform() {
55
55
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -1634,10 +1634,6 @@ function convertBase64ToBlob(base64Image) {
1634
1634
  });
1635
1635
  }
1636
1636
 
1637
- function supportsNativeBarcodeScanning() {
1638
- return 'BarcodeDetector' in window;
1639
- }
1640
-
1641
1637
  function getFrameDimensions(frame) {
1642
1638
  var frameWidth = frame.width,
1643
1639
  frameHeight = frame.height;
@@ -2481,10 +2477,42 @@ function giveUpAfter(maxTime) {
2481
2477
  });
2482
2478
  }
2483
2479
 
2484
- var defaultFocusModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/focusmp20240523/model_float16.tflite";
2480
+ function convertBoundingBox(box) {
2481
+ var _a, _b, _c, _d, _e, _f, _g, _h;
2482
+ return {
2483
+ xMin: (_a = box === null || box === void 0 ? void 0 : box.originX) !== null && _a !== void 0 ? _a : 0,
2484
+ xMax: ((_b = box === null || box === void 0 ? void 0 : box.originX) !== null && _b !== void 0 ? _b : 0) + ((_c = box === null || box === void 0 ? void 0 : box.width) !== null && _c !== void 0 ? _c : 0),
2485
+ yMin: (_d = box === null || box === void 0 ? void 0 : box.originY) !== null && _d !== void 0 ? _d : 0,
2486
+ yMax: ((_e = box === null || box === void 0 ? void 0 : box.originY) !== null && _e !== void 0 ? _e : 0) + ((_f = box === null || box === void 0 ? void 0 : box.height) !== null && _f !== void 0 ? _f : 0),
2487
+ width: (_g = box === null || box === void 0 ? void 0 : box.width) !== null && _g !== void 0 ? _g : 0,
2488
+ height: (_h = box === null || box === void 0 ? void 0 : box.height) !== null && _h !== void 0 ? _h : 0
2489
+ };
2490
+ }
2491
+ function waitForVideoReady(videoRef, checkEveryMs) {
2492
+ if (checkEveryMs === void 0) {
2493
+ checkEveryMs = 100;
2494
+ }
2495
+ return new Promise(function (resolve) {
2496
+ var _a;
2497
+ if (((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) === 4) return resolve();
2498
+ var interval = setInterval(function () {
2499
+ var _a;
2500
+ if (((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) === 4) {
2501
+ clearInterval(interval);
2502
+ resolve();
2503
+ }
2504
+ }, checkEveryMs);
2505
+ });
2506
+ }
2507
+
2508
+ var defaultFocusModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/focusmp20240619/model_fp16.tflite";
2485
2509
  var defaultFocusModelLoadTimeoutMs = 45000;
2486
2510
  var defaultFocusThresholds = {
2487
- idCard: {
2511
+ idCardFront: {
2512
+ desktop: 0,
2513
+ mobile: 0.3
2514
+ },
2515
+ idCardBack: {
2488
2516
  desktop: 0,
2489
2517
  mobile: 0.3
2490
2518
  },
@@ -2519,16 +2547,9 @@ function loadFocusModel(modelAssetPath) {
2519
2547
  delegate: modelCapabilities.delegate
2520
2548
  },
2521
2549
  runningMode: 'VIDEO'
2522
- }])
2523
- // const emptyFrame = document.createElement('canvas')
2524
- // models[id].classifyForVideo(emptyFrame, performance.now())
2525
- // emptyFrame.remove()
2526
- ];
2550
+ }])];
2527
2551
  case 3:
2528
2552
  _a[_b] = _e.sent();
2529
- // const emptyFrame = document.createElement('canvas')
2530
- // models[id].classifyForVideo(emptyFrame, performance.now())
2531
- // emptyFrame.remove()
2532
2553
  return [2 /*return*/, models[id]];
2533
2554
  }
2534
2555
  });
@@ -2550,7 +2571,9 @@ function useLoadFocusModel(_a) {
2550
2571
  var _f = React.useState(null),
2551
2572
  modelError = _f[0],
2552
2573
  setModelError = _f[1];
2574
+ var videoRef = React.useContext(CameraStateContext).videoRef;
2553
2575
  React.useEffect(function loadModel() {
2576
+ var _this = this;
2554
2577
  setReady(false);
2555
2578
  function handleDownloadProgress(event) {
2556
2579
  setModelDownloadProgress(progressToPercentage(event.detail));
@@ -2560,9 +2583,22 @@ function useLoadFocusModel(_a) {
2560
2583
  setModelError(new Error('Model loading time limit exceeded.'));
2561
2584
  }, modelLoadTimeoutMs);
2562
2585
  loadFocusModel(modelPath).then(function (loadedModel) {
2563
- model.current = loadedModel;
2564
- setModelDownloadProgress(100);
2565
- setReady(true);
2586
+ return tslib.__awaiter(_this, void 0, void 0, function () {
2587
+ return tslib.__generator(this, function (_a) {
2588
+ switch (_a.label) {
2589
+ case 0:
2590
+ model.current = loadedModel;
2591
+ setModelDownloadProgress(100);
2592
+ clearTimeout(modelLoadTimeout);
2593
+ return [4 /*yield*/, waitForVideoReady(videoRef)];
2594
+ case 1:
2595
+ _a.sent();
2596
+ loadedModel.classifyForVideo(videoRef.current, performance.now());
2597
+ setReady(true);
2598
+ return [2 /*return*/];
2599
+ }
2600
+ });
2601
+ });
2566
2602
  })["catch"](function (e) {
2567
2603
  setModelError(e);
2568
2604
  })["finally"](function () {
@@ -2572,7 +2608,7 @@ function useLoadFocusModel(_a) {
2572
2608
  clearTimeout(modelLoadTimeout);
2573
2609
  document.removeEventListener('idmission.preloadProgress.focus', handleDownloadProgress);
2574
2610
  };
2575
- }, [modelPath, modelLoadTimeoutMs]);
2611
+ }, [modelPath, modelLoadTimeoutMs, videoRef]);
2576
2612
  React.useEffect(function handleModelError() {
2577
2613
  modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2578
2614
  }, [modelError, onModelError]);
@@ -2752,18 +2788,6 @@ K("FACEDETECTION_TESSELATION",[[127,34],[34,139],[139,127],[11,0],[0,37],[37,11]
2752
2788
  [256,341],[341,452],[452,256],[414,413],[413,463],[463,414],[286,441],[441,414],[414,286],[286,258],[258,441],[441,286],[258,257],[257,442],[442,258],[257,259],[259,443],[443,257],[259,260],[260,444],[444,259],[260,467],[467,445],[445,260],[309,459],[459,250],[250,309],[305,289],[289,290],[290,305],[305,290],[290,460],[460,305],[401,376],[376,435],[435,401],[309,250],[250,392],[392,309],[376,411],[411,433],[433,376],[453,341],[341,464],[464,453],[357,453],[453,465],[465,357],[343,357],[357,412],[412,
2753
2789
  343],[437,343],[343,399],[399,437],[344,360],[360,440],[440,344],[420,437],[437,456],[456,420],[360,420],[420,363],[363,360],[361,401],[401,288],[288,361],[265,372],[372,353],[353,265],[390,339],[339,249],[249,390],[339,448],[448,255],[255,339]]);K("VERSION","0.4.1646425229");}).call(commonjsGlobal);
2754
2790
 
2755
- function convertBoundingBox(box) {
2756
- var _a, _b, _c, _d, _e, _f, _g, _h;
2757
- return {
2758
- xMin: (_a = box === null || box === void 0 ? void 0 : box.originX) !== null && _a !== void 0 ? _a : 0,
2759
- xMax: ((_b = box === null || box === void 0 ? void 0 : box.originX) !== null && _b !== void 0 ? _b : 0) + ((_c = box === null || box === void 0 ? void 0 : box.width) !== null && _c !== void 0 ? _c : 0),
2760
- yMin: (_d = box === null || box === void 0 ? void 0 : box.originY) !== null && _d !== void 0 ? _d : 0,
2761
- yMax: ((_e = box === null || box === void 0 ? void 0 : box.originY) !== null && _e !== void 0 ? _e : 0) + ((_f = box === null || box === void 0 ? void 0 : box.height) !== null && _f !== void 0 ? _f : 0),
2762
- width: (_g = box === null || box === void 0 ? void 0 : box.width) !== null && _g !== void 0 ? _g : 0,
2763
- height: (_h = box === null || box === void 0 ? void 0 : box.height) !== null && _h !== void 0 ? _h : 0
2764
- };
2765
- }
2766
-
2767
2791
  var defaultFaceDetectorModelPath = 'https://websdk-cdn-dev.idmission.com/assets/models/blazeface20240207/blaze_face_short_range.tflite';
2768
2792
  var defaultSelfieCaptureModelLoadTimeoutMs = 45000;
2769
2793
  var detector;
@@ -2789,16 +2813,9 @@ function loadFaceDetector() {
2789
2813
  delegate: modelCapabilities.delegate
2790
2814
  },
2791
2815
  runningMode: 'VIDEO'
2792
- }])
2793
- // const emptyFrame = document.createElement('canvas')
2794
- // detector.detectForVideo(emptyFrame, performance.now())
2795
- // emptyFrame.remove()
2796
- ];
2816
+ }])];
2797
2817
  case 3:
2798
2818
  detector = _c.sent();
2799
- // const emptyFrame = document.createElement('canvas')
2800
- // detector.detectForVideo(emptyFrame, performance.now())
2801
- // emptyFrame.remove()
2802
2819
  return [2 /*return*/, detector];
2803
2820
  }
2804
2821
  });
@@ -2818,7 +2835,9 @@ function useLoadFaceDetector(_a) {
2818
2835
  var _e = React.useState(null),
2819
2836
  modelError = _e[0],
2820
2837
  setModelError = _e[1];
2838
+ var videoRef = React.useContext(CameraStateContext).videoRef;
2821
2839
  React.useEffect(function loadModel() {
2840
+ var _this = this;
2822
2841
  setReady(false);
2823
2842
  var modelLoadTimeout = setTimeout(function () {
2824
2843
  setModelError(new Error('Model loading time limit exceeded.'));
@@ -2828,9 +2847,22 @@ function useLoadFaceDetector(_a) {
2828
2847
  }
2829
2848
  document.addEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
2830
2849
  loadFaceDetector().then(function (model) {
2831
- detector.current = model;
2832
- setModelDownloadProgress(100);
2833
- setReady(true);
2850
+ return tslib.__awaiter(_this, void 0, void 0, function () {
2851
+ return tslib.__generator(this, function (_a) {
2852
+ switch (_a.label) {
2853
+ case 0:
2854
+ detector.current = model;
2855
+ setModelDownloadProgress(100);
2856
+ clearTimeout(modelLoadTimeout);
2857
+ return [4 /*yield*/, waitForVideoReady(videoRef)];
2858
+ case 1:
2859
+ _a.sent();
2860
+ model.detectForVideo(videoRef.current, performance.now());
2861
+ setReady(true);
2862
+ return [2 /*return*/];
2863
+ }
2864
+ });
2865
+ });
2834
2866
  })["catch"](function (e) {
2835
2867
  setModelError(e);
2836
2868
  })["finally"](function () {
@@ -2840,7 +2872,7 @@ function useLoadFaceDetector(_a) {
2840
2872
  clearTimeout(modelLoadTimeout);
2841
2873
  document.removeEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
2842
2874
  };
2843
- }, [modelLoadTimeoutMs]);
2875
+ }, [modelLoadTimeoutMs, videoRef]);
2844
2876
  React.useEffect(function handleModelError() {
2845
2877
  modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2846
2878
  }, [modelError, onModelError]);
@@ -3103,14 +3135,19 @@ function sumUpProgressForDependencies(dependencies) {
3103
3135
  });
3104
3136
  }
3105
3137
 
3106
- var defaultDocumentDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/docdetectmp20240611/model_fp16.tflite";
3138
+ var defaultDocumentDetectorModelPath = "https://websdk-cdn-dev.idmission.com/assets/models/docdetectmp20240614/model_fp16.tflite";
3107
3139
  var defaultDocumentDetectionScoreThreshold = 0.1;
3108
3140
  var defaultDocumentDetectionModelLoadTimeoutMs = 45000;
3109
3141
  var defaultDocumentDetectionThresholds = {
3110
- idCard: 0.8,
3111
- passport: 0.5,
3112
- mrz: 0.5,
3113
- pdf417: 0.15
3142
+ idCardFront: 0.8,
3143
+ idCardBack: 0.8,
3144
+ passport: 0.5
3145
+ };
3146
+ var documentTypeDisplayNames = {
3147
+ idCardFront: 'ID card front',
3148
+ idCardBack: 'ID card back',
3149
+ passport: 'Passport',
3150
+ none: 'None'
3114
3151
  };
3115
3152
  var detectors = {};
3116
3153
  function loadDocumentDetector(modelAssetPath, scoreThreshold) {
@@ -3145,16 +3182,9 @@ function loadDocumentDetector(modelAssetPath, scoreThreshold) {
3145
3182
  },
3146
3183
  scoreThreshold: scoreThreshold,
3147
3184
  runningMode: 'VIDEO'
3148
- }])
3149
- // const emptyFrame = document.createElement('canvas')
3150
- // detectors[id].detectForVideo(emptyFrame, performance.now())
3151
- // emptyFrame.remove()
3152
- ];
3185
+ }])];
3153
3186
  case 3:
3154
3187
  _a[_b] = _e.sent();
3155
- // const emptyFrame = document.createElement('canvas')
3156
- // detectors[id].detectForVideo(emptyFrame, performance.now())
3157
- // emptyFrame.remove()
3158
3188
  return [2 /*return*/, detectors[id]];
3159
3189
  }
3160
3190
  });
@@ -3178,7 +3208,9 @@ function useLoadDocumentDetector(_a) {
3178
3208
  var _g = React.useState(null),
3179
3209
  modelError = _g[0],
3180
3210
  setModelError = _g[1];
3211
+ var videoRef = React.useContext(CameraStateContext).videoRef;
3181
3212
  React.useEffect(function loadModel() {
3213
+ var _this = this;
3182
3214
  setReady(false);
3183
3215
  function handleDownloadProgress(event) {
3184
3216
  setModelDownloadProgress(progressToPercentage(event.detail));
@@ -3188,9 +3220,22 @@ function useLoadDocumentDetector(_a) {
3188
3220
  setModelError(new Error('Model loading time limit exceeded.'));
3189
3221
  }, modelLoadTimeoutMs);
3190
3222
  loadDocumentDetector(modelPath, scoreThreshold).then(function (model) {
3191
- detector.current = model;
3192
- setModelDownloadProgress(100);
3193
- setReady(true);
3223
+ return tslib.__awaiter(_this, void 0, void 0, function () {
3224
+ return tslib.__generator(this, function (_a) {
3225
+ switch (_a.label) {
3226
+ case 0:
3227
+ detector.current = model;
3228
+ setModelDownloadProgress(100);
3229
+ clearTimeout(modelLoadTimeout);
3230
+ return [4 /*yield*/, waitForVideoReady(videoRef)];
3231
+ case 1:
3232
+ _a.sent();
3233
+ model.detectForVideo(videoRef.current, performance.now());
3234
+ setReady(true);
3235
+ return [2 /*return*/];
3236
+ }
3237
+ });
3238
+ });
3194
3239
  })["catch"](function (e) {
3195
3240
  setModelError(e);
3196
3241
  })["finally"](function () {
@@ -3200,7 +3245,7 @@ function useLoadDocumentDetector(_a) {
3200
3245
  clearTimeout(modelLoadTimeout);
3201
3246
  document.removeEventListener('idmission.preloadProgress.documentDetection', handleDownloadProgress);
3202
3247
  };
3203
- }, [modelLoadTimeoutMs, modelPath, scoreThreshold]);
3248
+ }, [modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
3204
3249
  React.useEffect(function handleModelError() {
3205
3250
  modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
3206
3251
  }, [modelError, onModelError]);
@@ -3257,34 +3302,33 @@ function processDocumentDetectorPrediction(prediction, thresholds) {
3257
3302
  return n > 0;
3258
3303
  });
3259
3304
  });
3260
- var bestIdCard = detectedObjects.find(function (obj) {
3305
+ var bestIdCardFront = detectedObjects.find(function (obj) {
3261
3306
  return obj.label === 'Document';
3262
3307
  });
3308
+ var bestIdCardBack = detectedObjects.find(function (obj) {
3309
+ return obj.label === 'Document back';
3310
+ });
3263
3311
  var bestPassportPage = detectedObjects.find(function (obj) {
3264
3312
  return obj.label === 'Passport page';
3265
3313
  });
3266
- var passportDetectionScore = (_a = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _a !== void 0 ? _a : 0;
3267
- var passportDetectionThresholdMet = passportDetectionScore >= ((_b = thresholds.passport) !== null && _b !== void 0 ? _b : 0);
3268
- var bestDocument = passportDetectionThresholdMet ? bestPassportPage : bestIdCard;
3269
- var detectionScore = (_c = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _c !== void 0 ? _c : 0;
3270
- var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : thresholds.idCard;
3314
+ var idCardFrontDetectionScore = (_a = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _a !== void 0 ? _a : 0;
3315
+ var idCardBackDetectionScore = (_b = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _b !== void 0 ? _b : 0;
3316
+ var passportDetectionScore = (_c = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _c !== void 0 ? _c : 0;
3317
+ var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_d = thresholds.idCardFront) !== null && _d !== void 0 ? _d : 0);
3318
+ var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_e = thresholds.idCardBack) !== null && _e !== void 0 ? _e : 0);
3319
+ var passportDetectionThresholdMet = passportDetectionScore >= ((_f = thresholds.passport) !== null && _f !== void 0 ? _f : 0);
3320
+ var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
3321
+ var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
3322
+ var detectionScore = (_g = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _g !== void 0 ? _g : 0;
3271
3323
  var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
3272
3324
  var detectedDocumentType = 'none';
3273
3325
  if (passportDetectionThresholdMet) {
3274
3326
  detectedDocumentType = 'passport';
3327
+ } else if (idCardBackDetectionThresholdMet) {
3328
+ detectedDocumentType = 'idCardBack';
3275
3329
  } else if (detectionThresholdMet) {
3276
- detectedDocumentType = 'idCard';
3330
+ detectedDocumentType = 'idCardFront';
3277
3331
  }
3278
- var bestMrz = detectedObjects.find(function (obj) {
3279
- return obj.label === 'MRZ';
3280
- });
3281
- var mrzDetectionScore = (_d = bestMrz === null || bestMrz === void 0 ? void 0 : bestMrz.score) !== null && _d !== void 0 ? _d : 0;
3282
- var mrzDetectionThresholdMet = mrzDetectionScore >= ((_e = thresholds.mrz) !== null && _e !== void 0 ? _e : 0);
3283
- var bestPdf417 = detectedObjects.find(function (obj) {
3284
- return obj.label === 'PDF417';
3285
- });
3286
- var pdf417DetectionScore = (_f = bestPdf417 === null || bestPdf417 === void 0 ? void 0 : bestPdf417.score) !== null && _f !== void 0 ? _f : 0;
3287
- var pdf417DetectionThresholdMet = pdf417DetectionScore >= ((_g = thresholds.pdf417) !== null && _g !== void 0 ? _g : 0);
3288
3332
  var documentInBounds = false;
3289
3333
  if (bestDocument) {
3290
3334
  var boundaryPx = 20;
@@ -3314,15 +3358,13 @@ function processDocumentDetectorPrediction(prediction, thresholds) {
3314
3358
  detectionTime: time,
3315
3359
  detectionThresholdMet: detectionThresholdMet,
3316
3360
  detectedDocumentType: detectedDocumentType,
3361
+ idCardFrontDetectionScore: idCardFrontDetectionScore,
3362
+ idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
3363
+ idCardBackDetectionScore: idCardBackDetectionScore,
3364
+ idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
3317
3365
  passportDetectionScore: passportDetectionScore,
3318
3366
  passportDetectionThresholdMet: passportDetectionThresholdMet,
3319
- mrzDetectionScore: mrzDetectionScore,
3320
- mrzDetectionThresholdMet: mrzDetectionThresholdMet,
3321
- pdf417DetectionScore: pdf417DetectionScore,
3322
- pdf417DetectionThresholdMet: pdf417DetectionThresholdMet,
3323
3367
  bestDocument: bestDocument,
3324
- bestMrz: bestMrz,
3325
- bestPdf417: bestPdf417,
3326
3368
  documentInBounds: documentInBounds,
3327
3369
  documentTooClose: documentTooClose,
3328
3370
  frameWidth: frameWidth,
@@ -3570,24 +3612,26 @@ function FocusModelProvider(_a) {
3570
3612
  focusModelPath = _b === void 0 ? defaultFocusModelPath : _b,
3571
3613
  _c = _a.focusModelLoadTimeoutMs,
3572
3614
  focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
3573
- onFocusModelError = _a.onFocusModelError;
3615
+ onFocusModelError = _a.onFocusModelError,
3616
+ _d = _a.showCanvases,
3617
+ showCanvases = _d === void 0 ? false : _d;
3574
3618
  var cropCanvas = React.useRef(null);
3575
3619
  var rotateCanvas = React.useRef(null);
3576
- var _d = React.useState({}),
3577
- focusThresholds = _d[0],
3578
- setFocusThresholds = _d[1];
3579
- var _e = React.useState(0),
3580
- focusPredictionTime = _e[0],
3581
- setFocusPredictionTime = _e[1];
3582
- var _f = useLoadFocusModel({
3620
+ var _e = React.useState({}),
3621
+ focusThresholds = _e[0],
3622
+ setFocusThresholds = _e[1];
3623
+ var _f = React.useState(0),
3624
+ focusPredictionTime = _f[0],
3625
+ setFocusPredictionTime = _f[1];
3626
+ var _g = useLoadFocusModel({
3583
3627
  modelPath: focusModelPath,
3584
3628
  modelLoadTimeoutMs: focusModelLoadTimeoutMs,
3585
3629
  onModelError: onFocusModelError
3586
3630
  }),
3587
- model = _f.model,
3588
- ready = _f.ready,
3589
- modelDownloadProgress = _f.modelDownloadProgress,
3590
- modelError = _f.modelError;
3631
+ model = _g.model,
3632
+ ready = _g.ready,
3633
+ modelDownloadProgress = _g.modelDownloadProgress,
3634
+ modelError = _g.modelError;
3591
3635
  var makeFocusPrediction = React.useCallback(function (imageData, box) {
3592
3636
  if (!model.current) return null;
3593
3637
  var prediction = makeFocusModelPrediction(model.current, imageData, cropCanvas.current, rotateCanvas.current, box);
@@ -3608,13 +3652,23 @@ function FocusModelProvider(_a) {
3608
3652
  return /*#__PURE__*/React__default['default'].createElement(FocusModelContext.Provider, {
3609
3653
  value: value
3610
3654
  }, /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
3611
- ref: rotateCanvas
3655
+ ref: rotateCanvas,
3656
+ style: showCanvases ? {
3657
+ display: 'block'
3658
+ } : undefined
3612
3659
  }), /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
3613
- ref: cropCanvas
3660
+ ref: cropCanvas,
3661
+ style: showCanvases ? {
3662
+ display: 'block'
3663
+ } : undefined
3614
3664
  }), children);
3615
3665
  }
3616
3666
 
3617
3667
  var onMobile = isMobile();
3668
+ var defaultIdCaptureThresholds = {
3669
+ detection: defaultDocumentDetectionThresholds,
3670
+ focus: defaultFocusThresholds
3671
+ };
3618
3672
  var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
3619
3673
  ready: false,
3620
3674
  start: function start() {
@@ -3625,7 +3679,7 @@ var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
3625
3679
  },
3626
3680
  modelDownloadProgress: 0,
3627
3681
  modelError: null,
3628
- thresholds: {},
3682
+ thresholds: defaultIdCaptureThresholds,
3629
3683
  setThresholds: function setThresholds() {
3630
3684
  return null;
3631
3685
  },
@@ -3640,6 +3694,10 @@ var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
3640
3694
  },
3641
3695
  resetBestFrame: function resetBestFrame() {
3642
3696
  return null;
3697
+ },
3698
+ requiredDocumentType: 'none',
3699
+ setRequiredDocumentType: function setRequiredDocumentType() {
3700
+ return null;
3643
3701
  }
3644
3702
  });
3645
3703
  function IdCaptureModelsProviderInner(_a) {
@@ -3672,26 +3730,34 @@ function IdCaptureModelsProviderInner(_a) {
3672
3730
  var bestPredictionCanvas = React.useRef(null);
3673
3731
  var bestFocusScore = React.useRef(0);
3674
3732
  var stopDetection = React.useRef(0);
3733
+ var _e = React.useState('none'),
3734
+ requiredDocumentType = _e[0],
3735
+ setRequiredDocumentType = _e[1];
3675
3736
  var thresholds = React.useMemo(function () {
3676
3737
  return tslib.__assign(tslib.__assign({}, documentDetectionThresholds), {
3677
3738
  focus: focusThresholds
3678
3739
  });
3679
3740
  }, [documentDetectionThresholds, focusThresholds]);
3680
3741
  var setThresholds = React.useCallback(function (thresholds) {
3681
- setDocumentDetectionThresholds(thresholds);
3682
- if (thresholds.focus) setFocusThresholds(thresholds.focus);
3742
+ if (thresholds.detection) {
3743
+ setDocumentDetectionThresholds(thresholds.detection);
3744
+ }
3745
+ if (thresholds.focus) {
3746
+ setFocusThresholds(thresholds.focus);
3747
+ }
3683
3748
  }, [setDocumentDetectionThresholds, setFocusThresholds]);
3684
3749
  React.useEffect(function handleDetections() {
3685
3750
  var _this = this;
3686
3751
  onDocumentDetected(function (prediction) {
3687
3752
  return tslib.__awaiter(_this, void 0, void 0, function () {
3688
- var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, focusPrediction, focusThresholdSet, focusThreshold;
3753
+ var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
3689
3754
  var _a, _b, _c, _d, _e;
3690
3755
  return tslib.__generator(this, function (_f) {
3691
3756
  if (!lastPredictionCanvas.current) return [2 /*return*/];
3692
3757
  stopDetectionAtStart = stopDetection.current;
3693
3758
  focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
3694
- if (prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose) {
3759
+ isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType;
3760
+ if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose) {
3695
3761
  focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_a = prediction.bestDocument) === null || _a === void 0 ? void 0 : _a.box);
3696
3762
  if (focusPrediction) {
3697
3763
  focusScore = focusPrediction.score;
@@ -3720,7 +3786,7 @@ function IdCaptureModelsProviderInner(_a) {
3720
3786
  });
3721
3787
  });
3722
3788
  });
3723
- }, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, thresholds.focus]);
3789
+ }, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
3724
3790
  var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
3725
3791
  React.useEffect(function handleModelErrors() {
3726
3792
  modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
@@ -3734,9 +3800,9 @@ function IdCaptureModelsProviderInner(_a) {
3734
3800
  canvas: bestPredictionCanvas.current
3735
3801
  });
3736
3802
  }, [bestFrameDetails]);
3737
- var _e = React.useState(0),
3738
- canvasKey = _e[0],
3739
- setCanvasKey = _e[1];
3803
+ var _f = React.useState(0),
3804
+ canvasKey = _f[0],
3805
+ setCanvasKey = _f[1];
3740
3806
  var resetBestFrame = React.useCallback(function () {
3741
3807
  stopDetection.current += 1;
3742
3808
  setCanvasKey(function (n) {
@@ -3746,6 +3812,9 @@ function IdCaptureModelsProviderInner(_a) {
3746
3812
  setBestFrameDetails(null);
3747
3813
  bestFocusScore.current = 0;
3748
3814
  }, [clearDocumentDetectionLastPredictionCanvas]);
3815
+ React.useEffect(function () {
3816
+ requiredDocumentType && resetBestFrame();
3817
+ }, [requiredDocumentType, resetBestFrame]);
3749
3818
  var value = React.useMemo(function () {
3750
3819
  return {
3751
3820
  ready: documentDetectionModelReady && focusModelReady,
@@ -3760,9 +3829,11 @@ function IdCaptureModelsProviderInner(_a) {
3760
3829
  focusPredictionTime: focusPredictionTime,
3761
3830
  getBestFrame: getBestFrame,
3762
3831
  resetBestFrame: resetBestFrame,
3763
- bestFrameDetails: bestFrameDetails
3832
+ bestFrameDetails: bestFrameDetails,
3833
+ requiredDocumentType: requiredDocumentType,
3834
+ setRequiredDocumentType: setRequiredDocumentType
3764
3835
  };
3765
- }, [bestFrameDetails, detectionTime, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, modelError, onPredictionMade, resetBestFrame, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
3836
+ }, [bestFrameDetails, detectionTime, documentDetectionModelDownloadProgress, documentDetectionModelReady, focusModelDownloadProgress, focusModelReady, focusPredictionTime, getBestFrame, modelError, onPredictionMade, requiredDocumentType, resetBestFrame, setThresholds, startDocumentDetection, stopDocumentDetection, thresholds]);
3766
3837
  return /*#__PURE__*/React__default['default'].createElement(IdCaptureModelsContext.Provider, {
3767
3838
  value: value
3768
3839
  }, /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
@@ -3811,28 +3882,19 @@ var initialState$4 = {
3811
3882
  videoHeight: 0,
3812
3883
  detectedObjects: [],
3813
3884
  bestDocument: undefined,
3814
- bestMrz: undefined,
3815
- bestPdf417: undefined,
3816
- documentType: 'none',
3885
+ detectedDocumentType: 'none',
3886
+ detectionThresholdMet: false,
3817
3887
  documentInBounds: false,
3818
3888
  documentTooClose: false,
3819
- documentDetectionScore: 0,
3820
- documentDetectionThresholdMet: false,
3821
- passportPageDetectionScore: 0,
3822
- passportPageDetectionThresholdMet: false,
3823
- mrzDetectionScore: 0,
3824
- mrzDetectionThresholdMet: false,
3825
- pdf417DetectionScore: 0,
3826
- pdf417DetectionThresholdMet: false,
3889
+ flipRequired: false,
3890
+ idCardFrontDetectionScore: 0,
3891
+ idCardFrontDetectionThresholdMet: false,
3892
+ idCardBackDetectionScore: 0,
3893
+ idCardBackDetectionThresholdMet: false,
3894
+ passportDetectionScore: 0,
3895
+ passportDetectionThresholdMet: false,
3827
3896
  focusScore: 0,
3828
3897
  focusThresholdMet: false,
3829
- barcodeScanningEnabled: false,
3830
- barcodeResult: null,
3831
- waitingForBarcodeScan: false,
3832
- shouldScanBarcode: false,
3833
- autoCaptureBarcodeRequired: 'mobile',
3834
- barcodeScanFailedAttempts: 0,
3835
- maxBarcodeScanAttempts: 10,
3836
3898
  isGoodFrame: false,
3837
3899
  goodFramesCount: 0,
3838
3900
  goodFramesThreshold: 3,
@@ -3846,8 +3908,6 @@ var initialState$4 = {
3846
3908
  capturedDocuments: {},
3847
3909
  captureRequirement: 'idCardOrPassport',
3848
3910
  requestedDocumentType: 'idCardFront',
3849
- detectedDocumentType: 'none',
3850
- differentDocumentTypeDetections: 0,
3851
3911
  operationStartedAt: null,
3852
3912
  captureStartedAt: null
3853
3913
  };
@@ -3882,11 +3942,6 @@ var reducer$4 = function reducer(state, action) {
3882
3942
  newState.operationStartedAt = new Date();
3883
3943
  return newState;
3884
3944
  }
3885
- case 'configureCapture':
3886
- return tslib.__assign(tslib.__assign(tslib.__assign({}, state), action.payload), {
3887
- capturing: false,
3888
- captureFailed: false
3889
- });
3890
3945
  case 'setRequiredDocumentType':
3891
3946
  return tslib.__assign(tslib.__assign({}, state), {
3892
3947
  requiredDocumentType: action.payload
@@ -3923,18 +3978,15 @@ var reducer$4 = function reducer(state, action) {
3923
3978
  case 'objectsDetected':
3924
3979
  var _d = action.payload.prediction,
3925
3980
  detectedObjects = _d.detectedObjects,
3926
- detectionScore = _d.detectionScore,
3927
3981
  detectionThresholdMet = _d.detectionThresholdMet,
3928
3982
  detectedDocumentType = _d.detectedDocumentType,
3983
+ idCardFrontDetectionScore = _d.idCardFrontDetectionScore,
3984
+ idCardFrontDetectionThresholdMet = _d.idCardFrontDetectionThresholdMet,
3985
+ idCardBackDetectionScore = _d.idCardBackDetectionScore,
3986
+ idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
3929
3987
  passportDetectionScore = _d.passportDetectionScore,
3930
3988
  passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
3931
- mrzDetectionScore = _d.mrzDetectionScore,
3932
- mrzDetectionThresholdMet = _d.mrzDetectionThresholdMet,
3933
- pdf417DetectionScore = _d.pdf417DetectionScore,
3934
- pdf417DetectionThresholdMet = _d.pdf417DetectionThresholdMet,
3935
3989
  bestDocument = _d.bestDocument,
3936
- bestMrz = _d.bestMrz,
3937
- bestPdf417 = _d.bestPdf417,
3938
3990
  documentInBounds = _d.documentInBounds,
3939
3991
  documentTooClose = _d.documentTooClose,
3940
3992
  focusScore = _d.focusScore,
@@ -3950,84 +4002,48 @@ var reducer$4 = function reducer(state, action) {
3950
4002
  goodFramesThreshold = Math.ceil(3 * frameCaptureRate);
3951
4003
  }
3952
4004
  }
3953
- var barcodeScanRequired = state.autoCaptureBarcodeRequired === true || state.autoCaptureBarcodeRequired === 'mobile' && isMobile();
3954
- var shouldScanBarcode = state.barcodeScanningEnabled && pdf417DetectionThresholdMet && barcodeScanRequired;
3955
- var waitingForBarcodeScan = shouldScanBarcode && !state.barcodeResult;
3956
- var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && focusThresholdMet;
4005
+ var flipRequired = state.requestedDocumentType === 'idCardBack' && detectedDocumentType === 'idCardFront';
4006
+ var isGoodFrame = detectionThresholdMet && documentInBounds && !documentTooClose && !flipRequired && focusThresholdMet;
3957
4007
  var goodFramesCount = state.goodFramesCount;
3958
4008
  if (isGoodFrame) {
3959
4009
  goodFramesCount += 1;
3960
4010
  }
4011
+ var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
4012
+ var requestedDocumentType = state.requestedDocumentType;
4013
+ if (state.captureRequirement === 'idCardOrPassport') {
4014
+ if (detectedDocumentType === 'passport' && state.requestedDocumentType !== 'passport') {
4015
+ requestedDocumentType = 'passport';
4016
+ }
4017
+ if (requestedDocumentType === 'passport' && passportDetectionScore < 0.3) {
4018
+ requestedDocumentType = 'idCardFront' in state.capturedDocuments ? 'idCardBack' : 'idCardFront';
4019
+ }
4020
+ }
3961
4021
  return tslib.__assign(tslib.__assign({}, state), {
3962
4022
  videoWidth: frameWidth,
3963
4023
  videoHeight: frameHeight,
3964
4024
  detectedObjects: detectedObjects,
3965
4025
  bestDocument: bestDocument,
3966
- bestMrz: bestMrz,
3967
- bestPdf417: bestPdf417,
3968
- documentType: detectedDocumentType,
4026
+ requestedDocumentType: requestedDocumentType,
4027
+ detectedDocumentType: detectedDocumentType,
4028
+ detectionThresholdMet: detectionThresholdMet,
3969
4029
  documentInBounds: documentInBounds,
3970
4030
  documentTooClose: documentTooClose,
3971
- documentDetectionScore: detectionScore,
3972
- documentDetectionThresholdMet: detectionThresholdMet,
3973
- mrzDetectionScore: mrzDetectionScore,
3974
- mrzDetectionThresholdMet: mrzDetectionThresholdMet,
3975
- pdf417DetectionScore: pdf417DetectionScore,
3976
- pdf417DetectionThresholdMet: pdf417DetectionThresholdMet,
3977
- passportPageDetectionScore: passportDetectionScore,
3978
- passportPageDetectionThresholdMet: passportDetectionThresholdMet,
4031
+ flipRequired: flipRequired,
4032
+ idCardFrontDetectionScore: idCardFrontDetectionScore,
4033
+ idCardFrontDetectionThresholdMet: idCardFrontDetectionThresholdMet,
4034
+ idCardBackDetectionScore: idCardBackDetectionScore,
4035
+ idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
4036
+ passportDetectionScore: passportDetectionScore,
4037
+ passportDetectionThresholdMet: passportDetectionThresholdMet,
3979
4038
  focusScore: focusScore,
3980
4039
  focusThresholdMet: focusThresholdMet,
3981
- shouldScanBarcode: shouldScanBarcode,
3982
- waitingForBarcodeScan: waitingForBarcodeScan,
3983
4040
  isGoodFrame: isGoodFrame,
3984
4041
  goodFramesCount: goodFramesCount,
3985
4042
  goodFramesThreshold: goodFramesThreshold,
3986
- goodFramesThresholdMet: goodFramesCount >= goodFramesThreshold,
4043
+ goodFramesThresholdMet: goodFramesThresholdMet,
3987
4044
  lastFrameCapturedAt: frameCapturedAt,
3988
4045
  frameCaptureRate: frameCaptureRate
3989
4046
  });
3990
- case 'predictionMade':
3991
- {
3992
- var _e = action.payload,
3993
- detectedDocumentType_1 = _e.detectedDocumentType,
3994
- passportDetectionScore_1 = _e.passportDetectionScore;
3995
- var requestedDocumentType = state.requestedDocumentType;
3996
- var newState = tslib.__assign(tslib.__assign({}, state), {
3997
- detectedDocumentType: detectedDocumentType_1
3998
- });
3999
- if (state.captureRequirement === 'idCardOrPassport') {
4000
- var predictionIsRequestedType = requestedDocumentType.startsWith(detectedDocumentType_1);
4001
- if (predictionIsRequestedType) {
4002
- newState.differentDocumentTypeDetections = 0;
4003
- }
4004
- if (detectedDocumentType_1 === 'passport' && requestedDocumentType !== 'passport') {
4005
- newState.requestedDocumentType = 'passport';
4006
- }
4007
- if (requestedDocumentType === 'passport' && passportDetectionScore_1 < 0.3) {
4008
- newState.requestedDocumentType = 'idCardFront' in state.capturedDocuments ? 'idCardBack' : 'idCardFront';
4009
- }
4010
- }
4011
- return newState;
4012
- }
4013
- case 'barcodeScanned':
4014
- return tslib.__assign(tslib.__assign({}, state), {
4015
- barcodeResult: action.payload.result,
4016
- waitingForBarcodeScan: false,
4017
- autoCaptureBarcodeRequired: false
4018
- });
4019
- case 'barcodeScanFailed':
4020
- {
4021
- var newState = tslib.__assign(tslib.__assign({}, state), {
4022
- barcodeScanFailedAttempts: state.barcodeScanFailedAttempts + 1
4023
- });
4024
- if (newState.barcodeScanFailedAttempts >= newState.maxBarcodeScanAttempts) {
4025
- newState.autoCaptureBarcodeRequired = false;
4026
- newState.shouldScanBarcode = false;
4027
- newState.waitingForBarcodeScan = false;
4028
- }
4029
- return newState;
4030
- }
4031
4047
  case 'captureStarted':
4032
4048
  return tslib.__assign(tslib.__assign({}, state), {
4033
4049
  captureStartedAt: new Date(),
@@ -4079,8 +4095,9 @@ var reducer$4 = function reducer(state, action) {
4079
4095
  newState_1.requestedDocumentType = remainingRequirements[0];
4080
4096
  if (state.requestedDocumentType === 'idCardFront' && newState_1.requestedDocumentType === 'idCardBack') {
4081
4097
  newState_1.captureState = 'requestingFlip';
4082
- newState_1.documentDetectionThresholdMet = false;
4083
- newState_1.passportPageDetectionThresholdMet = false;
4098
+ newState_1.idCardFrontDetectionThresholdMet = false;
4099
+ newState_1.idCardBackDetectionThresholdMet = false;
4100
+ newState_1.passportDetectionThresholdMet = false;
4084
4101
  }
4085
4102
  }
4086
4103
  return newState_1;
@@ -4111,8 +4128,9 @@ var reducer$4 = function reducer(state, action) {
4111
4128
  newState_2.requestedDocumentType = remainingRequirements[0];
4112
4129
  if (state.requestedDocumentType === 'idCardFront' && newState_2.requestedDocumentType === 'idCardBack') {
4113
4130
  newState_2.captureState = 'requestingFlip';
4114
- newState_2.documentDetectionThresholdMet = false;
4115
- newState_2.passportPageDetectionThresholdMet = false;
4131
+ newState_2.idCardFrontDetectionThresholdMet = false;
4132
+ newState_2.idCardBackDetectionThresholdMet = false;
4133
+ newState_2.passportDetectionThresholdMet = false;
4116
4134
  }
4117
4135
  }
4118
4136
  return newState_2;
@@ -4557,85 +4575,42 @@ var templateObject_1$A, templateObject_2$p;
4557
4575
  var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
4558
4576
 
4559
4577
  var IdCapture = function IdCapture(_a) {
4560
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
4578
+ var _b, _c, _d, _e, _f, _g, _h, _j;
4561
4579
  var requiredDocumentType = _a.requiredDocumentType,
4562
- _m = _a.autoCaptureEnabled,
4563
- autoCaptureEnabled = _m === void 0 ? true : _m,
4564
- _o = _a.autoCaptureBarcodeRequired,
4565
- autoCaptureBarcodeRequired = _o === void 0 ? 'mobile' : _o,
4566
- _p = _a.idCardDetectionThreshold,
4567
- idCardDetectionThreshold = _p === void 0 ? defaultDocumentDetectionThresholds.idCard : _p,
4568
- _q = _a.passportDetectionThreshold,
4569
- passportDetectionThreshold = _q === void 0 ? defaultDocumentDetectionThresholds.passport : _q,
4570
- _r = _a.mrzDetectionScoreThreshold,
4571
- mrzDetectionScoreThreshold = _r === void 0 ? defaultDocumentDetectionThresholds.mrz : _r,
4572
- _s = _a.pdf417DetectionThreshold,
4573
- pdf417DetectionThreshold = _s === void 0 ? defaultDocumentDetectionThresholds.pdf417 : _s,
4574
- _t = _a.idCardFocusScoreThreshold,
4575
- idCardFocusScoreThreshold = _t === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _t,
4576
- _u = _a.passportFocusScoreThreshold,
4577
- passportFocusScoreThreshold = _u === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _u,
4578
- _v = _a.barcodeScanningEnabled,
4579
- barcodeScanningEnabled = _v === void 0 ? true : _v,
4580
- _w = _a.maxBarcodeScanAttempts,
4581
- maxBarcodeScanAttempts = _w === void 0 ? 10 : _w,
4580
+ _k = _a.thresholds,
4581
+ thresholds = _k === void 0 ? defaultIdCaptureThresholds : _k,
4582
4582
  guidanceMessage = _a.guidanceMessage,
4583
4583
  guidanceSatisfied = _a.guidanceSatisfied,
4584
- onPrediction = _a.onPrediction,
4585
4584
  onCapture = _a.onCapture,
4586
- _x = _a.assets,
4587
- assets = _x === void 0 ? {} : _x,
4588
- _y = _a.classNames,
4589
- classNames = _y === void 0 ? {} : _y,
4590
- _z = _a.colors,
4591
- colors = _z === void 0 ? {} : _z,
4592
- _0 = _a.verbiage,
4593
- rawVerbiage = _0 === void 0 ? {} : _0,
4594
- _1 = _a.debugMode,
4595
- debugMode = _1 === void 0 ? false : _1;
4596
- var _2 = useResizeObserver__default['default'](),
4597
- ref = _2.ref,
4598
- _3 = _2.width,
4599
- width = _3 === void 0 ? 1 : _3,
4600
- _4 = _2.height,
4601
- height = _4 === void 0 ? 1 : _4;
4602
- var _5 = useIdCaptureState(),
4603
- state = _5[0],
4604
- dispatch = _5[1];
4585
+ _l = _a.assets,
4586
+ assets = _l === void 0 ? {} : _l,
4587
+ _m = _a.classNames,
4588
+ classNames = _m === void 0 ? {} : _m,
4589
+ _o = _a.colors,
4590
+ colors = _o === void 0 ? {} : _o,
4591
+ _p = _a.verbiage,
4592
+ rawVerbiage = _p === void 0 ? {} : _p,
4593
+ _q = _a.debugMode,
4594
+ debugMode = _q === void 0 ? false : _q;
4595
+ var _r = useResizeObserver__default['default'](),
4596
+ ref = _r.ref,
4597
+ _s = _r.width,
4598
+ width = _s === void 0 ? 1 : _s,
4599
+ _t = _r.height,
4600
+ height = _t === void 0 ? 1 : _t;
4601
+ var _u = useIdCaptureState(),
4602
+ state = _u[0],
4603
+ dispatch = _u[1];
4605
4604
  var cameraRef = React.useContext(CameraStateContext).cameraRef;
4606
- var _6 = React.useContext(IdCaptureModelsContext),
4607
- modelsReady = _6.ready,
4608
- setThresholds = _6.setThresholds,
4609
- onPredictionMade = _6.onPredictionMade,
4610
- detectionTime = _6.detectionTime,
4611
- focusPredictionTime = _6.focusPredictionTime,
4612
- getBestFrame = _6.getBestFrame;
4605
+ var _v = React.useContext(IdCaptureModelsContext),
4606
+ modelsReady = _v.ready,
4607
+ setThresholds = _v.setThresholds,
4608
+ detectionTime = _v.detectionTime,
4609
+ focusPredictionTime = _v.focusPredictionTime,
4610
+ getBestFrame = _v.getBestFrame;
4613
4611
  React.useEffect(function () {
4614
- dispatch({
4615
- type: 'configureCapture',
4616
- payload: {
4617
- autoCaptureBarcodeRequired: autoCaptureBarcodeRequired,
4618
- barcodeScanningEnabled: barcodeScanningEnabled,
4619
- maxBarcodeScanAttempts: maxBarcodeScanAttempts
4620
- }
4621
- });
4622
- }, [autoCaptureBarcodeRequired, barcodeScanningEnabled, dispatch, maxBarcodeScanAttempts]);
4623
- React.useEffect(function () {
4624
- setThresholds({
4625
- idCard: idCardDetectionThreshold,
4626
- passport: passportDetectionThreshold,
4627
- mrz: mrzDetectionScoreThreshold,
4628
- pdf417: pdf417DetectionThreshold,
4629
- focus: {
4630
- idCard: {
4631
- mobile: idCardFocusScoreThreshold
4632
- },
4633
- passport: {
4634
- mobile: passportFocusScoreThreshold
4635
- }
4636
- }
4637
- });
4638
- }, [idCardDetectionThreshold, idCardFocusScoreThreshold, mrzDetectionScoreThreshold, passportDetectionThreshold, passportFocusScoreThreshold, pdf417DetectionThreshold, setThresholds]);
4612
+ setThresholds(thresholds);
4613
+ }, [thresholds, setThresholds]);
4639
4614
  React.useEffect(function () {
4640
4615
  if (!requiredDocumentType) return;
4641
4616
  dispatch({
@@ -4652,18 +4627,7 @@ var IdCapture = function IdCapture(_a) {
4652
4627
  }
4653
4628
  });
4654
4629
  }, [dispatch, height, width]);
4655
- React.useEffect(function () {
4656
- onPredictionMade(function (prediction) {
4657
- dispatch({
4658
- type: 'objectsDetected',
4659
- payload: {
4660
- prediction: prediction
4661
- }
4662
- });
4663
- onPrediction === null || onPrediction === void 0 ? void 0 : onPrediction(prediction);
4664
- });
4665
- }, [dispatch, onPrediction, onPredictionMade]);
4666
- var shouldCapture = autoCaptureEnabled && state.goodFramesThresholdMet && !state.capturing && !state.waitingForBarcodeScan && timeSince(state.captureStartedAt) >= 3000;
4630
+ var shouldCapture = state.goodFramesThresholdMet && !state.capturing && timeSince(state.captureStartedAt) >= 3000;
4667
4631
  React.useEffect(function () {
4668
4632
  if (!shouldCapture) return;
4669
4633
  dispatch({
@@ -4677,29 +4641,13 @@ var IdCapture = function IdCapture(_a) {
4677
4641
  });
4678
4642
  return;
4679
4643
  }
4680
- var originalCanvas = bestFrame.canvas,
4644
+ var canvas = bestFrame.canvas,
4681
4645
  documentType = bestFrame.documentType,
4682
4646
  boundingBox = bestFrame.boundingBox,
4683
4647
  detectionScore = bestFrame.detectionScore,
4684
4648
  focusScore = bestFrame.focusScore;
4685
- var width = originalCanvas.width,
4686
- height = originalCanvas.height;
4687
- var canvas = originalCanvas;
4688
- // resize image to 2k max if barcode is read
4689
- var isGreaterThan2k = width > 1920 && height > 1080 || width > 1080 && height > 1920;
4690
- if (isGreaterThan2k && !!state.barcodeResult) {
4691
- canvas = document.createElement('canvas');
4692
- if (width > height) {
4693
- canvas.width = 1920;
4694
- canvas.height = height * (1920 / width);
4695
- } else {
4696
- canvas.height = 1920;
4697
- canvas.width = width * (1920 / height);
4698
- }
4699
- var ctx2d = canvas.getContext('2d');
4700
- if (!ctx2d) return;
4701
- ctx2d.drawImage(originalCanvas, 0, 0, canvas.width, canvas.height);
4702
- }
4649
+ var width = canvas.width,
4650
+ height = canvas.height;
4703
4651
  var imageUrl = canvas.toDataURL('image/jpeg', 0.95);
4704
4652
  dispatch({
4705
4653
  type: 'frameCaptured',
@@ -4723,18 +4671,17 @@ var IdCapture = function IdCapture(_a) {
4723
4671
  type: 'captured'
4724
4672
  });
4725
4673
  }, 0);
4726
- }, [dispatch, getBestFrame, onCapture, shouldCapture, state.barcodeResult, state.captureStartedAt, state.requestedDocumentType]);
4674
+ }, [dispatch, getBestFrame, onCapture, shouldCapture, state.captureStartedAt, state.requestedDocumentType]);
4727
4675
  assets.portraitGuidesImageUrl || (assets.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Portrait-2.svg"));
4728
4676
  assets.landscapeGuidesImageUrl || (assets.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));
4729
4677
  var theme = styled.useTheme();
4730
- colors.guideBoxUnsatisfiedColor || (colors.guideBoxUnsatisfiedColor = (_f = (_e = (_d = theme.idCapture) === null || _d === void 0 ? void 0 : _d.guideBox) === null || _e === void 0 ? void 0 : _e.unsatisfiedColor) !== null && _f !== void 0 ? _f : 'white');
4731
- colors.guideBoxSatisfiedColor || (colors.guideBoxSatisfiedColor = (_j = (_h = (_g = theme.idCapture) === null || _g === void 0 ? void 0 : _g.guideBox) === null || _h === void 0 ? void 0 : _h.satisfiedColor) !== null && _j !== void 0 ? _j : 'green');
4678
+ colors.guideBoxUnsatisfiedColor || (colors.guideBoxUnsatisfiedColor = (_d = (_c = (_b = theme.idCapture) === null || _b === void 0 ? void 0 : _b.guideBox) === null || _c === void 0 ? void 0 : _c.unsatisfiedColor) !== null && _d !== void 0 ? _d : 'white');
4679
+ colors.guideBoxSatisfiedColor || (colors.guideBoxSatisfiedColor = (_g = (_f = (_e = theme.idCapture) === null || _e === void 0 ? void 0 : _e.guideBox) === null || _f === void 0 ? void 0 : _f.satisfiedColor) !== null && _g !== void 0 ? _g : 'green');
4732
4680
  var verbiage = useTranslations(rawVerbiage, {
4733
4681
  instructionText: 'Scan the front of ID',
4734
4682
  processingIdCardText: 'ID card front captured.',
4735
- capturingText: 'Capturing...',
4736
- captureFailedText: 'Capture failed!',
4737
- guidanceSatisfiedText: 'Document detected, hold still...',
4683
+ guidanceSatisfiedText: "".concat(documentTypeDisplayNames[state.detectedDocumentType], " detected, hold still..."),
4684
+ guidancePleaseFlipText: 'ID card front detected - please flip your ID card',
4738
4685
  guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
4739
4686
  guidanceNotCenteredText: 'Document is not centered',
4740
4687
  guidanceTooCloseText: 'Document too close, please back up',
@@ -4749,10 +4696,10 @@ var IdCapture = function IdCapture(_a) {
4749
4696
  });
4750
4697
  var satisfied = state.isGoodFrame;
4751
4698
  if (typeof guidanceSatisfied === 'boolean') satisfied = guidanceSatisfied;
4752
- guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.documentDetectionThresholdMet ? verbiage.guidanceNotDetectedText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : state.documentTooClose ? verbiage.guidanceTooCloseText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : '');
4699
+ guidanceMessage || (guidanceMessage = satisfied ? verbiage.guidanceSatisfiedText : !state.detectionThresholdMet ? verbiage.guidanceNotDetectedText : state.flipRequired ? verbiage.guidancePleaseFlipText : !state.documentInBounds ? verbiage.guidanceNotCenteredText : state.documentTooClose ? verbiage.guidanceTooCloseText : !state.focusThresholdMet ? verbiage.guidanceTooBlurryText : '');
4753
4700
  return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
4754
4701
  ref: ref,
4755
- className: "flex ".concat((_k = classNames.container) !== null && _k !== void 0 ? _k : '')
4702
+ className: "flex ".concat((_h = classNames.container) !== null && _h !== void 0 ? _h : '')
4756
4703
  }, guidanceMessage !== '' && ( /*#__PURE__*/React__default['default'].createElement(GuidanceMessageContainer, {
4757
4704
  "$top": "",
4758
4705
  "$bottom": "12.5dvh",
@@ -4761,7 +4708,7 @@ var IdCapture = function IdCapture(_a) {
4761
4708
  "$variant": satisfied ? 'positive' : 'default',
4762
4709
  className: classNames.guidanceMessage
4763
4710
  }, guidanceMessage))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugBoundingBoxOverlay, {
4764
- "$flipX": !((_l = cameraRef.current) === null || _l === void 0 ? void 0 : _l.isRearFacing),
4711
+ "$flipX": !((_j = cameraRef.current) === null || _j === void 0 ? void 0 : _j.isRearFacing),
4765
4712
  scaling: debugScalingDetails
4766
4713
  }, state.detectedObjects.map(function (obj, i) {
4767
4714
  var _a;
@@ -4771,7 +4718,7 @@ var IdCapture = function IdCapture(_a) {
4771
4718
  scaling: debugScalingDetails,
4772
4719
  flipX: !((_a = cameraRef.current) === null || _a === void 0 ? void 0 : _a.isRearFacing)
4773
4720
  });
4774
- }))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['default'].createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__default['default'].createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, state.documentDetectionThresholdMet ? '✅' : '❌', " Document Score: ", state.documentDetectionScore.toFixed(3), " (", state.documentType, ")", /*#__PURE__*/React__default['default'].createElement("br", null), state.passportPageDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportPageDetectionScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default['default'].createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold, barcodeScanningEnabled && state.autoCaptureBarcodeRequired ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("br", null), state.barcodeResult ? '✅' : '❌', " Barcode Scanned (", supportsNativeBarcodeScanning() ? 'Native' : 'ZXing', ",", ' ', state.barcodeScanFailedAttempts, "/", state.maxBarcodeScanAttempts, " failed attempts)")) : null)) : ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u274C Models not ready")))));
4721
+ }))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['default'].createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__default['default'].createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default['default'].createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default['default'].createElement("br", null), state.documentInBounds ? '' : '❌', " Document In Bounds", /*#__PURE__*/React__default['default'].createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u274C Models not ready")))));
4775
4722
  };
4776
4723
  var timeSince = function timeSince(t) {
4777
4724
  if (!t) return 0;
@@ -5705,11 +5652,7 @@ var CapturedDocumentImg = function CapturedDocumentImg(_a) {
5705
5652
  setUrl(cropToDetectedObjectBox(imgRef.current, bbox).toDataURL('image/jpeg', 0.95));
5706
5653
  }, 100);
5707
5654
  }
5708
- return /*#__PURE__*/React__default['default'].createElement("div", {
5709
- style: {
5710
- position: 'relative'
5711
- }
5712
- }, /*#__PURE__*/React__default['default'].createElement("img", {
5655
+ return /*#__PURE__*/React__default['default'].createElement("img", {
5713
5656
  ref: imgRef,
5714
5657
  alt: alt,
5715
5658
  className: className,
@@ -5729,13 +5672,12 @@ var CapturedDocumentImg = function CapturedDocumentImg(_a) {
5729
5672
  (_a = link.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(link);
5730
5673
  });
5731
5674
  }
5732
- }));
5675
+ });
5733
5676
  };
5734
5677
 
5735
5678
  var OverlayInstruction = styled__default['default'].p(templateObject_1$u || (templateObject_1$u = tslib.__makeTemplateObject(["\n font-size: 18px;\n margin: 30px 0;\n"], ["\n font-size: 18px;\n margin: 30px 0;\n"])));
5736
5679
  var IdCaptureSuccess = function IdCaptureSuccess(_a) {
5737
5680
  var capturedDocuments = _a.capturedDocuments,
5738
- // barcodeResult,
5739
5681
  onSubmitClick = _a.onSubmitClick,
5740
5682
  onRetryClick = _a.onRetryClick,
5741
5683
  _b = _a.classNames,
@@ -5743,7 +5685,9 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
5743
5685
  _c = _a.colors,
5744
5686
  colors = _c === void 0 ? {} : _c,
5745
5687
  _d = _a.verbiage,
5746
- rawVerbiage = _d === void 0 ? {} : _d;
5688
+ rawVerbiage = _d === void 0 ? {} : _d,
5689
+ _e = _a.debugMode,
5690
+ debugMode = _e === void 0 ? false : _e;
5747
5691
  var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
5748
5692
  var idCardFront = capturedDocuments.idCardFront,
5749
5693
  idCardBack = capturedDocuments.idCardBack,
@@ -5778,7 +5722,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
5778
5722
  image: idCardFront,
5779
5723
  className: classNames.image,
5780
5724
  alt: verbiage.idCardFrontText
5781
- })))), idCardBack && ( /*#__PURE__*/React__default['default'].createElement(ImageCol$1, {
5725
+ })), debugMode && ( /*#__PURE__*/React__default['default'].createElement("pre", null, "Detection Score: ".concat(idCardFront.detectionScore, "\nFocus Score: ").concat(idCardFront.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardFront.boundingBox)))))), idCardBack && ( /*#__PURE__*/React__default['default'].createElement(ImageCol$1, {
5782
5726
  className: classNames.imageCol
5783
5727
  }, /*#__PURE__*/React__default['default'].createElement(ImageHeading, {
5784
5728
  className: classNames.imageHeading
@@ -5788,7 +5732,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
5788
5732
  image: idCardBack,
5789
5733
  className: classNames.image,
5790
5734
  alt: verbiage.idCardBackText
5791
- })))), passport && ( /*#__PURE__*/React__default['default'].createElement(ImageCol$1, {
5735
+ })), debugMode && ( /*#__PURE__*/React__default['default'].createElement("pre", null, "Detection Score: ".concat(idCardBack.detectionScore, "\nFocus Score: ").concat(idCardBack.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardBack.boundingBox)))))), passport && ( /*#__PURE__*/React__default['default'].createElement(ImageCol$1, {
5792
5736
  className: classNames.imageCol
5793
5737
  }, /*#__PURE__*/React__default['default'].createElement(ImageHeading, {
5794
5738
  className: classNames.imageHeading
@@ -5798,7 +5742,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
5798
5742
  image: passport,
5799
5743
  className: classNames.image,
5800
5744
  alt: verbiage.passportText
5801
- })))))), /*#__PURE__*/React__default['default'].createElement(OverlayInstruction, {
5745
+ })), debugMode && ( /*#__PURE__*/React__default['default'].createElement("pre", null, "Detection Score: ".concat(passport.detectionScore, "\nFocus Score: ").concat(passport.focusScore, "\nBounding Box: ").concat(JSON.stringify(passport.boundingBox)))))))), /*#__PURE__*/React__default['default'].createElement(OverlayInstruction, {
5802
5746
  className: classNames.instruction
5803
5747
  }, verbiage.instructionText), /*#__PURE__*/React__default['default'].createElement(ButtonsRow, {
5804
5748
  className: classNames.buttonsRow
@@ -6400,13 +6344,8 @@ function IdCaptureGuides(_a) {
6400
6344
  var cameraRef = React.useContext(CameraStateContext).cameraRef;
6401
6345
  var verbiage = useTranslations(rawVerbiage, {
6402
6346
  instructionText: 'Scan the front of ID',
6403
- processingIdCardText: 'ID card front captured.',
6404
6347
  capturingText: 'Capturing...',
6405
- captureFailedText: 'Capture failed!',
6406
- guidanceSatisfiedText: 'Document detected, hold still...',
6407
- guidanceTooBlurryText: 'Document out of focus – try improving the lighting',
6408
- guidanceNotCenteredText: 'Document is not centered',
6409
- guidanceNotDetectedText: 'Document not detected'
6348
+ captureFailedText: 'Capture failed!'
6410
6349
  });
6411
6350
  var isMobile = window.innerWidth < window.innerHeight;
6412
6351
  var frontImageUrl = portraitGuidesOnMobile && isMobile ? flipIdPromptAssets === null || flipIdPromptAssets === void 0 ? void 0 : flipIdPromptAssets.frontPortraitGuidesImageUrl : flipIdPromptAssets === null || flipIdPromptAssets === void 0 ? void 0 : flipIdPromptAssets.frontLandscapeGuidesImageUrl;
@@ -6420,7 +6359,7 @@ function IdCaptureGuides(_a) {
6420
6359
  landscapeGuidesImageUrl: assets.landscapeGuidesImageUrl,
6421
6360
  isMirrored: !((_b = cameraRef.current) === null || _b === void 0 ? void 0 : _b.isRearFacing),
6422
6361
  borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
6423
- imageVisible: requestingFlip || !state.documentDetectionThresholdMet || !state.documentInBounds || state.documentTooClose
6362
+ imageVisible: requestingFlip || !state.idCardFrontDetectionThresholdMet || !state.documentInBounds || state.documentTooClose
6424
6363
  })), guideType === 'fit' && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureFitGuide, {
6425
6364
  classNames: classNames,
6426
6365
  requestingFlip: requestingFlip,
@@ -6430,7 +6369,7 @@ function IdCaptureGuides(_a) {
6430
6369
  backImageUrl: backImageUrl,
6431
6370
  isMirrored: !((_c = cameraRef.current) === null || _c === void 0 ? void 0 : _c.isRearFacing),
6432
6371
  borderColor: state.isGoodFrame ? colors.guideBoxSatisfiedColor : colors.guideBoxUnsatisfiedColor,
6433
- imageVisible: requestingFlip || !state.documentDetectionThresholdMet || !state.documentInBounds || state.documentTooClose
6372
+ imageVisible: requestingFlip || !state.detectionThresholdMet || !state.documentInBounds || state.documentTooClose || state.flipRequired
6434
6373
  })));
6435
6374
  }
6436
6375
 
@@ -7325,78 +7264,66 @@ var StyledButtonsRow$8 = styled__default['default'](ButtonsRow)(templateObject_6
7325
7264
  var templateObject_1$l, templateObject_2$f, templateObject_3$d, templateObject_4$8, templateObject_5$4, templateObject_6$3;
7326
7265
 
7327
7266
  var IdCaptureWizard = function IdCaptureWizard(_a) {
7328
- var _b, _c, _d, _e, _f, _g, _h, _j;
7329
- var _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
7267
+ var _b, _c, _d, _e, _f, _g;
7268
+ var _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
7330
7269
  var onSuccess = _a.onSuccess,
7331
7270
  onExitCapture = _a.onExitCapture,
7332
7271
  onUserCancel = _a.onUserCancel,
7333
- _v = _a.loadingOverlayMode,
7334
- loadingOverlayMode = _v === void 0 ? 'default' : _v,
7272
+ _t = _a.loadingOverlayMode,
7273
+ loadingOverlayMode = _t === void 0 ? 'default' : _t,
7335
7274
  precapturedDocuments = _a.precapturedDocuments,
7336
- _w = _a.captureRequirement,
7337
- captureRequirement = _w === void 0 ? 'idCardOrPassport' : _w,
7338
- _x = _a.separateIdCardCaptureSequence,
7339
- separateIdCardCaptureSequence = _x === void 0 ? false : _x,
7340
- _y = _a.autoCaptureEnabled,
7341
- autoCaptureEnabled = _y === void 0 ? true : _y,
7342
- _z = _a.autoCaptureBarcodeRequired,
7343
- autoCaptureBarcodeRequired = _z === void 0 ? 'mobile' : _z,
7344
- _0 = _a.barcodeScanningEnabled,
7345
- barcodeScanningEnabled = _0 === void 0 ? false : _0,
7346
- _1 = _a.idCardAutoCaptureScoreThreshold,
7347
- idCardAutoCaptureScoreThreshold = _1 === void 0 ? defaultDocumentDetectionThresholds.idCard : _1,
7348
- _2 = _a.passportAutoCaptureScoreThreshold,
7349
- passportAutoCaptureScoreThreshold = _2 === void 0 ? defaultDocumentDetectionThresholds.passport : _2,
7350
- _3 = _a.mrzDetectionScoreThreshold,
7351
- mrzDetectionScoreThreshold = _3 === void 0 ? defaultDocumentDetectionThresholds.mrz : _3,
7352
- _4 = _a.idCardFocusScoreThreshold,
7353
- idCardFocusScoreThreshold = _4 === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _4,
7354
- _5 = _a.passportFocusScoreThreshold,
7355
- passportFocusScoreThreshold = _5 === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _5,
7356
- _6 = _a.skipSuccessScreen,
7357
- skipSuccessScreen = _6 === void 0 ? false : _6,
7275
+ _u = _a.captureRequirement,
7276
+ captureRequirement = _u === void 0 ? 'idCardOrPassport' : _u,
7277
+ _v = _a.separateIdCardCaptureSequence,
7278
+ separateIdCardCaptureSequence = _v === void 0 ? false : _v,
7279
+ _w = _a.thresholds,
7280
+ thresholds = _w === void 0 ? defaultIdCaptureThresholds : _w,
7281
+ _x = _a.skipSuccessScreen,
7282
+ skipSuccessScreen = _x === void 0 ? false : _x,
7358
7283
  instructions = _a.instructions,
7359
- _7 = _a.releaseCameraAccessOnExit,
7360
- releaseCameraAccessOnExit = _7 === void 0 ? true : _7,
7361
- _8 = _a.guideType,
7362
- guideType = _8 === void 0 ? 'fit' : _8,
7363
- _9 = _a.portraitGuidesOnMobile,
7364
- portraitGuidesOnMobile = _9 === void 0 ? false : _9,
7365
- _10 = _a.rotateLoadingOverlayImageWhenPortrait,
7366
- rotateLoadingOverlayImageWhenPortrait = _10 === void 0 ? true : _10,
7367
- _11 = _a.silentFallback,
7368
- silentFallback = _11 === void 0 ? false : _11,
7369
- _12 = _a.assets,
7370
- assets = _12 === void 0 ? {} : _12,
7371
- _13 = _a.classNames,
7372
- classNames = _13 === void 0 ? {} : _13,
7373
- _14 = _a.colors,
7374
- colors = _14 === void 0 ? {} : _14,
7375
- _15 = _a.verbiage,
7376
- verbiage = _15 === void 0 ? {} : _15,
7377
- _16 = _a.debugMode,
7378
- debugMode = _16 === void 0 ? false : _16;
7379
- var _17 = useIdCaptureState(),
7380
- state = _17[0],
7381
- dispatch = _17[1];
7382
- var _18 = React.useContext(CameraStateContext),
7383
- cameraAccessDenied = _18.cameraAccessDenied,
7384
- releaseCameraAccess = _18.releaseCameraAccess;
7385
- var _19 = React.useState(false),
7386
- overlayDismissed = _19[0],
7387
- setOverlayDismissed = _19[1];
7388
- var _20 = React.useContext(SubmissionContext),
7389
- submissionStatus = _20.submissionStatus,
7390
- setIdFrontImage = _20.setIdFrontImage,
7391
- setIdBackImage = _20.setIdBackImage,
7392
- setPassportImage = _20.setPassportImage,
7393
- logIdFrontCaptureAttempt = _20.logIdFrontCaptureAttempt,
7394
- logIdBackCaptureAttempt = _20.logIdBackCaptureAttempt;
7395
- var _21 = React.useContext(IdCaptureModelsContext),
7396
- start = _21.start,
7397
- stop = _21.stop,
7398
- modelError = _21.modelError,
7399
- resetBestFrame = _21.resetBestFrame;
7284
+ _y = _a.releaseCameraAccessOnExit,
7285
+ releaseCameraAccessOnExit = _y === void 0 ? true : _y,
7286
+ _z = _a.guideType,
7287
+ guideType = _z === void 0 ? 'fit' : _z,
7288
+ _0 = _a.portraitGuidesOnMobile,
7289
+ portraitGuidesOnMobile = _0 === void 0 ? false : _0,
7290
+ _1 = _a.rotateLoadingOverlayImageWhenPortrait,
7291
+ rotateLoadingOverlayImageWhenPortrait = _1 === void 0 ? true : _1,
7292
+ _2 = _a.silentFallback,
7293
+ silentFallback = _2 === void 0 ? false : _2,
7294
+ _3 = _a.assets,
7295
+ assets = _3 === void 0 ? {} : _3,
7296
+ _4 = _a.classNames,
7297
+ classNames = _4 === void 0 ? {} : _4,
7298
+ _5 = _a.colors,
7299
+ colors = _5 === void 0 ? {} : _5,
7300
+ _6 = _a.verbiage,
7301
+ verbiage = _6 === void 0 ? {} : _6,
7302
+ _7 = _a.debugMode,
7303
+ debugMode = _7 === void 0 ? false : _7;
7304
+ var _8 = useIdCaptureState(),
7305
+ state = _8[0],
7306
+ dispatch = _8[1];
7307
+ var _9 = React.useContext(CameraStateContext),
7308
+ cameraAccessDenied = _9.cameraAccessDenied,
7309
+ releaseCameraAccess = _9.releaseCameraAccess;
7310
+ var _10 = React.useState(false),
7311
+ overlayDismissed = _10[0],
7312
+ setOverlayDismissed = _10[1];
7313
+ var _11 = React.useContext(SubmissionContext),
7314
+ submissionStatus = _11.submissionStatus,
7315
+ setIdFrontImage = _11.setIdFrontImage,
7316
+ setIdBackImage = _11.setIdBackImage,
7317
+ setPassportImage = _11.setPassportImage,
7318
+ logIdFrontCaptureAttempt = _11.logIdFrontCaptureAttempt,
7319
+ logIdBackCaptureAttempt = _11.logIdBackCaptureAttempt;
7320
+ var _12 = React.useContext(IdCaptureModelsContext),
7321
+ start = _12.start,
7322
+ stop = _12.stop,
7323
+ onPredictionMade = _12.onPredictionMade,
7324
+ setRequiredDocumentType = _12.setRequiredDocumentType,
7325
+ modelError = _12.modelError,
7326
+ resetBestFrame = _12.resetBestFrame;
7400
7327
  React.useEffect(function () {
7401
7328
  dispatch({
7402
7329
  type: 'configureWizard',
@@ -7421,16 +7348,29 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
7421
7348
  type: 'captureStarted'
7422
7349
  });
7423
7350
  start();
7424
- return function () {
7425
- stop();
7426
- };
7427
- }, [dispatch, overlayDismissed, start, state.captureState, stop]);
7428
- var onPrediction = React.useCallback(function (prediction) {
7429
- dispatch({
7430
- type: 'predictionMade',
7431
- payload: prediction
7351
+ }, [dispatch, overlayDismissed, start, state.captureState]);
7352
+ React.useEffect(function () {
7353
+ onPredictionMade(function (prediction) {
7354
+ if (state.captureState === 'capturing') {
7355
+ dispatch({
7356
+ type: 'objectsDetected',
7357
+ payload: {
7358
+ prediction: prediction
7359
+ }
7360
+ });
7361
+ } else if (state.captureState === 'requestingFlip') {
7362
+ if (prediction.idCardBackDetectionThresholdMet) {
7363
+ resetBestFrame();
7364
+ dispatch({
7365
+ type: 'flipRequestCompleted'
7366
+ });
7367
+ }
7368
+ }
7432
7369
  });
7433
- }, [dispatch]);
7370
+ }, [dispatch, onPredictionMade, resetBestFrame, state.captureState]);
7371
+ React.useEffect(function () {
7372
+ if (state.captureState === 'complete') stop();
7373
+ }, [state.captureState, stop]);
7434
7374
  var onCapture = React.useCallback(function (imageData, width, height, documentType, metadata) {
7435
7375
  logCaptureMetadata(metadata);
7436
7376
  dispatch({
@@ -7440,7 +7380,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
7440
7380
  width: width,
7441
7381
  height: height,
7442
7382
  documentType: documentType,
7443
- boundingBox: metadata.boundingBox
7383
+ boundingBox: metadata.boundingBox,
7384
+ detectionScore: metadata.bestDetectionScore,
7385
+ focusScore: metadata.bestFocusScore
7444
7386
  }
7445
7387
  });
7446
7388
  }, [dispatch, logCaptureMetadata]);
@@ -7470,9 +7412,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
7470
7412
  type: 'resetWizard'
7471
7413
  });
7472
7414
  }, [dispatch]);
7473
- var _22 = React.useState(0),
7474
- attempt = _22[0],
7475
- setAttempt = _22[1];
7415
+ var _13 = React.useState(0),
7416
+ attempt = _13[0],
7417
+ setAttempt = _13[1];
7476
7418
  var onExit = React.useCallback(function () {
7477
7419
  setOverlayDismissed(false);
7478
7420
  setAttempt(function (n) {
@@ -7497,19 +7439,19 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
7497
7439
  }
7498
7440
  }, [cameraAccessDenied]);
7499
7441
  assets.idCardFront || (assets.idCardFront = {});
7500
- (_k = assets.idCardFront).portraitGuidesImageUrl || (_k.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Portrait-2.svg"));
7501
- (_l = assets.idCardFront).landscapeGuidesImageUrl || (_l.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));
7442
+ (_h = assets.idCardFront).portraitGuidesImageUrl || (_h.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Portrait-2.svg"));
7443
+ (_j = assets.idCardFront).landscapeGuidesImageUrl || (_j.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Front-SVG-Landscape-2.svg"));
7502
7444
  assets.idCardBack || (assets.idCardBack = {});
7503
- (_m = assets.idCardBack).portraitGuidesImageUrl || (_m.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Portrait-2.svg"));
7504
- (_o = assets.idCardBack).landscapeGuidesImageUrl || (_o.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));
7445
+ (_k = assets.idCardBack).portraitGuidesImageUrl || (_k.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Portrait-2.svg"));
7446
+ (_l = assets.idCardBack).landscapeGuidesImageUrl || (_l.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-IDCard-Back-SVG-Landscape-2.svg"));
7505
7447
  assets.passport || (assets.passport = {});
7506
- (_p = assets.passport).portraitGuidesImageUrl || (_p.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-Passport-Front-SVG-Portrait-2.svg"));
7507
- (_q = assets.passport).landscapeGuidesImageUrl || (_q.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-Passport-Front-SVG-Landscape-2.svg"));
7448
+ (_m = assets.passport).portraitGuidesImageUrl || (_m.portraitGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-Passport-Front-SVG-Portrait-2.svg"));
7449
+ (_o = assets.passport).landscapeGuidesImageUrl || (_o.landscapeGuidesImageUrl = "".concat(DEFAULT_CDN_URL, "/Shieldout-Passport-Front-SVG-Landscape-2.svg"));
7508
7450
  assets.flipIdPrompt || (assets.flipIdPrompt = {});
7509
- (_r = assets.flipIdPrompt).frontPortraitGuidesImageUrl || (_r.frontPortraitGuidesImageUrl = assets.idCardFront.portraitGuidesImageUrl);
7510
- (_s = assets.flipIdPrompt).frontLandscapeGuidesImageUrl || (_s.frontLandscapeGuidesImageUrl = assets.idCardFront.landscapeGuidesImageUrl);
7511
- (_t = assets.flipIdPrompt).backPortraitGuidesImageUrl || (_t.backPortraitGuidesImageUrl = assets.idCardBack.portraitGuidesImageUrl);
7512
- (_u = assets.flipIdPrompt).backLandscapeGuidesImageUrl || (_u.backLandscapeGuidesImageUrl = assets.idCardBack.landscapeGuidesImageUrl);
7451
+ (_p = assets.flipIdPrompt).frontPortraitGuidesImageUrl || (_p.frontPortraitGuidesImageUrl = assets.idCardFront.portraitGuidesImageUrl);
7452
+ (_q = assets.flipIdPrompt).frontLandscapeGuidesImageUrl || (_q.frontLandscapeGuidesImageUrl = assets.idCardFront.landscapeGuidesImageUrl);
7453
+ (_r = assets.flipIdPrompt).backPortraitGuidesImageUrl || (_r.backPortraitGuidesImageUrl = assets.idCardBack.portraitGuidesImageUrl);
7454
+ (_s = assets.flipIdPrompt).backLandscapeGuidesImageUrl || (_s.backLandscapeGuidesImageUrl = assets.idCardBack.landscapeGuidesImageUrl);
7513
7455
  var idCaptureVerbiages = {
7514
7456
  idCardFront: useTranslations(verbiage.idCardFront, {
7515
7457
  instructionText: 'Scan the front of ID',
@@ -7523,24 +7465,35 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
7523
7465
  })
7524
7466
  };
7525
7467
  var theme = styled.useTheme();
7526
- var _23 = useIdCaptureState()[0],
7527
- guideRectX = _23.guideRectX,
7528
- guideRectY = _23.guideRectY,
7529
- guideRectWidth = _23.guideRectWidth,
7530
- guideRectHeight = _23.guideRectHeight,
7531
- imageUrl = _23.imageUrl;
7468
+ var _14 = useIdCaptureState()[0],
7469
+ guideRectX = _14.guideRectX,
7470
+ guideRectY = _14.guideRectY,
7471
+ guideRectWidth = _14.guideRectWidth,
7472
+ guideRectHeight = _14.guideRectHeight,
7473
+ imageUrl = _14.imageUrl;
7532
7474
  var idCaptureAssets = assets[state.requestedDocumentType];
7533
7475
  var idCaptureVerbiage = idCaptureVerbiages[state.requestedDocumentType];
7534
7476
  React.useEffect(function () {
7535
7477
  if (separateIdCardCaptureSequence) return;
7536
- if (state.captureState === 'requestingFlip') {
7537
- setTimeout(function () {
7538
- dispatch({
7539
- type: 'flipRequestCompleted'
7540
- });
7541
- }, 6000);
7478
+ if (state.captureState !== 'requestingFlip') return;
7479
+ var t = setTimeout(function () {
7480
+ resetBestFrame();
7481
+ dispatch({
7482
+ type: 'flipRequestCompleted'
7483
+ });
7484
+ }, 6000);
7485
+ return function () {
7486
+ clearTimeout(t);
7487
+ };
7488
+ }, [dispatch, resetBestFrame, separateIdCardCaptureSequence, state.captureState]);
7489
+ React.useEffect(function () {
7490
+ if (state.requestedDocumentType === 'idCardBack') {
7491
+ setRequiredDocumentType('idCardBack');
7542
7492
  }
7543
- }, [dispatch, separateIdCardCaptureSequence, state.captureState]);
7493
+ return function () {
7494
+ setRequiredDocumentType('none');
7495
+ };
7496
+ }, [setRequiredDocumentType, state.requestedDocumentType]);
7544
7497
  var handleCapture = React.useCallback(function (imageData) {
7545
7498
  return tslib.__awaiter(void 0, void 0, void 0, function () {
7546
7499
  var base64ImageData;
@@ -7574,7 +7527,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
7574
7527
  });
7575
7528
  }
7576
7529
  return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
7577
- className: "flex ".concat((_d = classNames === null || classNames === void 0 ? void 0 : classNames.container) !== null && _d !== void 0 ? _d : '')
7530
+ className: "flex ".concat((_b = classNames === null || classNames === void 0 ? void 0 : classNames.container) !== null && _b !== void 0 ? _b : '')
7578
7531
  }, state.captureState !== 'complete' && ( /*#__PURE__*/React__default['default'].createElement(CameraFeedWrapper, {
7579
7532
  "$x": guideRectX,
7580
7533
  "$y": guideRectY,
@@ -7585,15 +7538,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
7585
7538
  className: classNames === null || classNames === void 0 ? void 0 : classNames.cameraFeed
7586
7539
  }))), overlayDismissed && state.captureState === 'capturing' && ( /*#__PURE__*/React__default['default'].createElement(IdCapture, {
7587
7540
  requiredDocumentType: state.requestedDocumentType,
7588
- autoCaptureEnabled: autoCaptureEnabled,
7589
- idCardDetectionThreshold: idCardAutoCaptureScoreThreshold,
7590
- passportDetectionThreshold: passportAutoCaptureScoreThreshold,
7591
- idCardFocusScoreThreshold: idCardFocusScoreThreshold,
7592
- passportFocusScoreThreshold: passportFocusScoreThreshold,
7593
- mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
7594
- autoCaptureBarcodeRequired: autoCaptureBarcodeRequired,
7595
- barcodeScanningEnabled: barcodeScanningEnabled && state.requestedDocumentType === 'idCardBack',
7596
- onPrediction: onPrediction,
7541
+ thresholds: thresholds,
7597
7542
  onCapture: onCapture,
7598
7543
  assets: idCaptureAssets,
7599
7544
  classNames: classNames === null || classNames === void 0 ? void 0 : classNames.capture,
@@ -7609,15 +7554,15 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
7609
7554
  assets: idCaptureAssets,
7610
7555
  colors: colors,
7611
7556
  verbiage: idCaptureVerbiage
7612
- }), !((_f = (_e = theme.idCapture) === null || _e === void 0 ? void 0 : _e.capturePreview) === null || _f === void 0 ? void 0 : _f.disabled) && state.captureState === 'requestingFlip' && !separateIdCardCaptureSequence && imageUrl && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureImagePreview, {
7613
- classNames: (_g = classNames.capture) === null || _g === void 0 ? void 0 : _g.imagePreview,
7614
- text: (_h = idCaptureVerbiages === null || idCaptureVerbiages === void 0 ? void 0 : idCaptureVerbiages.idCardFront) === null || _h === void 0 ? void 0 : _h.processingIdCardText,
7557
+ }), !((_d = (_c = theme.idCapture) === null || _c === void 0 ? void 0 : _c.capturePreview) === null || _d === void 0 ? void 0 : _d.disabled) && state.captureState === 'requestingFlip' && !separateIdCardCaptureSequence && imageUrl && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureImagePreview, {
7558
+ classNames: (_e = classNames.capture) === null || _e === void 0 ? void 0 : _e.imagePreview,
7559
+ text: (_f = idCaptureVerbiages === null || idCaptureVerbiages === void 0 ? void 0 : idCaptureVerbiages.idCardFront) === null || _f === void 0 ? void 0 : _f.processingIdCardText,
7615
7560
  imageUrl: imageUrl
7616
7561
  })), state.captureState !== 'complete' && ( /*#__PURE__*/React__default['default'].createElement("div", {
7617
7562
  id: "idmission-above-guides-content"
7618
7563
  })), /*#__PURE__*/React__default['default'].createElement(ExitCaptureButton, {
7619
7564
  onClick: onExit,
7620
- className: (_j = classNames.capture) === null || _j === void 0 ? void 0 : _j.exitCaptureBtn
7565
+ className: (_g = classNames.capture) === null || _g === void 0 ? void 0 : _g.exitCaptureBtn
7621
7566
  }), !overlayDismissed && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureLoadingOverlay, {
7622
7567
  key: attempt,
7623
7568
  mode: loadingOverlayMode,
@@ -7644,12 +7589,12 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
7644
7589
  verbiage: verbiage.success
7645
7590
  })), state.captureState === 'complete' && showSuccessScreen && ( /*#__PURE__*/React__default['default'].createElement(IdCaptureSuccess, {
7646
7591
  capturedDocuments: state.capturedDocuments,
7647
- barcodeResult: state.barcodeResult,
7648
7592
  classNames: classNames.success,
7649
7593
  onSubmitClick: onSubmitClick,
7650
7594
  onRetryClick: onRetryClick,
7651
7595
  colors: colors.success,
7652
- verbiage: verbiage.success
7596
+ verbiage: verbiage.success,
7597
+ debugMode: debugMode
7653
7598
  })));
7654
7599
  };
7655
7600
 
@@ -9718,7 +9663,7 @@ var useVideoRecorder = function useVideoRecorder(camera, audioStream, mergeAVStr
9718
9663
  var processAudio = React.useCallback(function () {
9719
9664
  var _a;
9720
9665
  var audioBlob = new Blob(audioChunks.current, {
9721
- type: 'audio/ogg; codecs=opus'
9666
+ type: 'audio/mp4'
9722
9667
  });
9723
9668
  audioChunks.current = [];
9724
9669
  setAudioUrl(URL.createObjectURL(audioBlob));
@@ -10509,6 +10454,31 @@ var DoneButton = styled__default['default'](LoaderButton)(templateObject_6 || (t
10509
10454
  var templateObject_1$6, templateObject_2$6, templateObject_3$6, templateObject_4$1, templateObject_5, templateObject_6;
10510
10455
 
10511
10456
  var edgeBoundary = 0.05;
10457
+ var defaultVideoIdCaptureThresholds = {
10458
+ detection: {
10459
+ idCardFront: 0.6,
10460
+ idCardBack: 0.6,
10461
+ passport: 1
10462
+ },
10463
+ focus: {
10464
+ idCardFront: {
10465
+ desktop: 0,
10466
+ mobile: 0
10467
+ },
10468
+ idCardBack: {
10469
+ desktop: 0,
10470
+ mobile: 0
10471
+ },
10472
+ passport: {
10473
+ desktop: 0,
10474
+ mobile: 0
10475
+ }
10476
+ },
10477
+ goodFrames: {
10478
+ idCardFront: 1,
10479
+ idCardBack: 1
10480
+ }
10481
+ };
10512
10482
  var IdVideoCapture = function IdVideoCapture(_a) {
10513
10483
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
10514
10484
  var onComplete = _a.onComplete,
@@ -10520,96 +10490,85 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10520
10490
  idCaptureModelsEnabled = _w === void 0 ? true : _w,
10521
10491
  _x = _a.idCardFrontDelay,
10522
10492
  idCardFrontDelay = _x === void 0 ? 1000 : _x,
10523
- _y = _a.idCardFrontDetectionThreshold,
10524
- idCardFrontDetectionThreshold = _y === void 0 ? 0.6 : _y,
10525
- _z = _a.idCardFrontFocusThreshold,
10526
- idCardFrontFocusThreshold = _z === void 0 ? 0 : _z,
10527
- _0 = _a.goodIdCardFrontFramesThreshold,
10528
- goodIdCardFrontFramesThreshold = _0 === void 0 ? 1 : _0,
10529
- _1 = _a.idCardBackDetectionThreshold,
10530
- idCardBackDetectionThreshold = _1 === void 0 ? 0.6 : _1,
10531
- _2 = _a.idCardBackFocusThreshold,
10532
- idCardBackFocusThreshold = _2 === void 0 ? 0 : _2,
10533
- _3 = _a.goodIdCardBackFramesThreshold,
10534
- goodIdCardBackFramesThreshold = _3 === void 0 ? 1 : _3,
10535
- _4 = _a.skipShowIdCardBack,
10536
- skipShowIdCardBack = _4 === void 0 ? false : _4,
10537
- _5 = _a.captureCountdownSeconds,
10538
- captureCountdownSeconds = _5 === void 0 ? 3 : _5,
10493
+ _y = _a.videoIdCaptureThresholds,
10494
+ videoIdCaptureThresholds = _y === void 0 ? defaultVideoIdCaptureThresholds : _y,
10495
+ _z = _a.skipShowIdCardBack,
10496
+ skipShowIdCardBack = _z === void 0 ? false : _z,
10497
+ _0 = _a.captureCountdownSeconds,
10498
+ captureCountdownSeconds = _0 === void 0 ? 3 : _0,
10539
10499
  readTextPrompt = _a.readTextPrompt,
10540
- _6 = _a.readTextTimeoutDurationMs,
10541
- readTextTimeoutDurationMs = _6 === void 0 ? 15000 : _6,
10542
- _7 = _a.readTextMinReadingMs,
10543
- readTextMinReadingMs = _7 === void 0 ? 10000 : _7,
10544
- _8 = _a.disableFaceDetectionWhileAudioCapture,
10545
- disableFaceDetectionWhileAudioCapture = _8 === void 0 ? false : _8,
10546
- _9 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
10547
- disableFaceDetectionWhileAudioCaptureMsDelay = _9 === void 0 ? 2000 : _9,
10548
- _10 = _a.mergeAVStreams,
10549
- mergeAVStreams = _10 === void 0 ? false : _10,
10550
- _11 = _a.assets,
10551
- assets = _11 === void 0 ? {} : _11,
10552
- _12 = _a.classNames,
10553
- classNames = _12 === void 0 ? {} : _12,
10554
- _13 = _a.colors,
10555
- colors = _13 === void 0 ? {} : _13,
10556
- _14 = _a.verbiage,
10557
- rawVerbiage = _14 === void 0 ? {} : _14,
10558
- _15 = _a.debugMode,
10559
- debugMode = _15 === void 0 ? false : _15;
10560
- var _16 = useResizeObserver__default['default'](),
10561
- ref = _16.ref,
10562
- _17 = _16.width,
10563
- width = _17 === void 0 ? 1 : _17,
10564
- _18 = _16.height,
10565
- height = _18 === void 0 ? 1 : _18;
10566
- var _19 = React.useContext(CameraStateContext),
10567
- cameraRef = _19.cameraRef,
10568
- videoRef = _19.videoRef,
10569
- videoLoaded = _19.videoLoaded,
10570
- cameraReady = _19.cameraReady,
10571
- microphoneReady = _19.microphoneReady,
10572
- audioStream = _19.audioStream,
10573
- setVideoLoaded = _19.setVideoLoaded,
10574
- takePhoto = _19.takePhoto;
10575
- var _20 = React.useState([]),
10576
- detectedObjects = _20[0],
10577
- setDetectedObjects = _20[1];
10578
- var _21 = React.useState([]),
10579
- faces = _21[0],
10580
- setFaces = _21[1];
10581
- var _22 = React.useContext(IdCaptureModelsContext),
10582
- idModelsReady = _22.ready,
10583
- startIdModels = _22.start,
10584
- stopIdModels = _22.stop,
10585
- onIdPredictionMade = _22.onPredictionMade,
10586
- setThresholds = _22.setThresholds,
10587
- bestFrameDetails = _22.bestFrameDetails,
10588
- resetBestFrame = _22.resetBestFrame,
10589
- idModelError = _22.modelError;
10590
- var _23 = React.useState(null),
10591
- videoStartsAt = _23[0],
10592
- setVideoStartsAt = _23[1];
10593
- var _24 = React.useContext(SubmissionContext),
10594
- setIdCaptureVideoAudioStartsAt = _24.setIdCaptureVideoAudioStartsAt,
10595
- setExpectedAudioText = _24.setExpectedAudioText;
10596
- var _25 = React.useContext(SelfieGuidanceModelsContext),
10597
- onSelfiePredictionMade = _25.onPredictionMade,
10598
- selfieModelError = _25.error;
10599
- var _26 = useVideoRecorder(cameraRef.current, audioStream, mergeAVStreams),
10600
- isRecordingVideo = _26.isRecordingVideo,
10601
- startRecordingVideo = _26.startRecordingVideo,
10602
- startRecordingAudio = _26.startRecordingAudio,
10603
- stopRecordingVideo = _26.stopRecordingVideo,
10604
- stopRecordingAudio = _26.stopRecordingAudio,
10605
- videoRecordingUnintentionallyStopped = _26.videoRecordingUnintentionallyStopped,
10606
- audioRecordingUnintentionallyStopped = _26.audioRecordingUnintentionallyStopped,
10607
- videoUrl = _26.videoUrl,
10608
- audioUrl = _26.audioUrl;
10500
+ _1 = _a.readTextTimeoutDurationMs,
10501
+ readTextTimeoutDurationMs = _1 === void 0 ? 15000 : _1,
10502
+ _2 = _a.readTextMinReadingMs,
10503
+ readTextMinReadingMs = _2 === void 0 ? 10000 : _2,
10504
+ _3 = _a.disableFaceDetectionWhileAudioCapture,
10505
+ disableFaceDetectionWhileAudioCapture = _3 === void 0 ? false : _3,
10506
+ _4 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
10507
+ disableFaceDetectionWhileAudioCaptureMsDelay = _4 === void 0 ? 2000 : _4,
10508
+ _5 = _a.mergeAVStreams,
10509
+ mergeAVStreams = _5 === void 0 ? false : _5,
10510
+ _6 = _a.assets,
10511
+ assets = _6 === void 0 ? {} : _6,
10512
+ _7 = _a.classNames,
10513
+ classNames = _7 === void 0 ? {} : _7,
10514
+ _8 = _a.colors,
10515
+ colors = _8 === void 0 ? {} : _8,
10516
+ _9 = _a.verbiage,
10517
+ rawVerbiage = _9 === void 0 ? {} : _9,
10518
+ _10 = _a.debugMode,
10519
+ debugMode = _10 === void 0 ? false : _10;
10520
+ var _11 = useResizeObserver__default['default'](),
10521
+ ref = _11.ref,
10522
+ _12 = _11.width,
10523
+ width = _12 === void 0 ? 1 : _12,
10524
+ _13 = _11.height,
10525
+ height = _13 === void 0 ? 1 : _13;
10526
+ var _14 = React.useContext(CameraStateContext),
10527
+ cameraRef = _14.cameraRef,
10528
+ videoRef = _14.videoRef,
10529
+ videoLoaded = _14.videoLoaded,
10530
+ cameraReady = _14.cameraReady,
10531
+ microphoneReady = _14.microphoneReady,
10532
+ audioStream = _14.audioStream,
10533
+ setVideoLoaded = _14.setVideoLoaded;
10534
+ var _15 = React.useState([]),
10535
+ detectedObjects = _15[0],
10536
+ setDetectedObjects = _15[1];
10537
+ var _16 = React.useState([]),
10538
+ faces = _16[0],
10539
+ setFaces = _16[1];
10540
+ var _17 = React.useContext(IdCaptureModelsContext),
10541
+ idModelsReady = _17.ready,
10542
+ startIdModels = _17.start,
10543
+ stopIdModels = _17.stop,
10544
+ onIdPredictionMade = _17.onPredictionMade,
10545
+ setThresholds = _17.setThresholds,
10546
+ bestFrameDetails = _17.bestFrameDetails,
10547
+ resetBestFrame = _17.resetBestFrame,
10548
+ idModelError = _17.modelError;
10549
+ var _18 = React.useState(null),
10550
+ videoStartsAt = _18[0],
10551
+ setVideoStartsAt = _18[1];
10552
+ var _19 = React.useContext(SubmissionContext),
10553
+ setIdCaptureVideoAudioStartsAt = _19.setIdCaptureVideoAudioStartsAt,
10554
+ setExpectedAudioText = _19.setExpectedAudioText;
10555
+ var _20 = React.useContext(SelfieGuidanceModelsContext),
10556
+ onSelfiePredictionMade = _20.onPredictionMade,
10557
+ selfieModelError = _20.error;
10558
+ var _21 = useVideoRecorder(cameraRef.current, audioStream, mergeAVStreams),
10559
+ isRecordingVideo = _21.isRecordingVideo,
10560
+ startRecordingVideo = _21.startRecordingVideo,
10561
+ startRecordingAudio = _21.startRecordingAudio,
10562
+ stopRecordingVideo = _21.stopRecordingVideo,
10563
+ stopRecordingAudio = _21.stopRecordingAudio,
10564
+ videoRecordingUnintentionallyStopped = _21.videoRecordingUnintentionallyStopped,
10565
+ audioRecordingUnintentionallyStopped = _21.audioRecordingUnintentionallyStopped,
10566
+ videoUrl = _21.videoUrl,
10567
+ audioUrl = _21.audioUrl;
10609
10568
  var countdownTimeoutRef = React.useRef(undefined);
10610
- var _27 = React.useState(0),
10611
- countdownRemaining = _27[0],
10612
- setCountdownRemaining = _27[1];
10569
+ var _22 = React.useState(-1),
10570
+ countdownRemaining = _22[0],
10571
+ setCountdownRemaining = _22[1];
10613
10572
  React.useEffect(function () {
10614
10573
  if (!isRecordingVideo && !videoUrl) {
10615
10574
  startRecordingVideo();
@@ -10629,41 +10588,30 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10629
10588
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
10630
10589
  }
10631
10590
  }, [audioRecordingUnintentionallyStopped, onRecordingFailed, videoRecordingUnintentionallyStopped]);
10632
- var shouldCaptureFrames = React.useRef(false);
10633
- React.useEffect(function () {
10634
- shouldCaptureFrames.current = videoLoaded && cameraReady && idModelsReady && !idModelError && (!readTextPrompt || microphoneReady);
10635
- }, [cameraReady, idModelError, idModelsReady, microphoneReady, readTextPrompt, videoLoaded]);
10636
- var _28 = React.useState('SHOW_ID_FRONT'),
10637
- requestedAction = _28[0],
10638
- setRequestedAction = _28[1];
10591
+ var _23 = React.useState('SHOW_ID_FRONT'),
10592
+ requestedAction = _23[0],
10593
+ setRequestedAction = _23[1];
10594
+ var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
10639
10595
  React.useEffect(function startModelsWhenCapturing() {
10640
- if (!shouldCaptureFrames.current && requestedAction !== 'SHOW_ID_FRONT' && requestedAction !== 'SHOW_ID_BACK') return;
10596
+ if (!shouldRunIdModels) return;
10641
10597
  startIdModels();
10642
10598
  return function () {
10643
10599
  stopIdModels();
10644
10600
  };
10645
- }, [requestedAction, startIdModels, stopIdModels]);
10601
+ }, [shouldRunIdModels, startIdModels, stopIdModels]);
10646
10602
  React.useEffect(function () {
10647
- setThresholds({
10648
- idCard: requestedAction === 'SHOW_ID_FRONT' ? idCardFrontDetectionThreshold : requestedAction === 'SHOW_ID_BACK' ? idCardBackDetectionThreshold : 1,
10649
- passport: 1,
10650
- focus: {
10651
- idCard: {
10652
- mobile: requestedAction === 'SHOW_ID_FRONT' ? idCardFrontFocusThreshold : requestedAction === 'SHOW_ID_BACK' ? idCardBackFocusThreshold : 0
10653
- }
10654
- }
10655
- });
10656
- }, [idCardBackDetectionThreshold, idCardBackFocusThreshold, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, requestedAction, setThresholds]);
10657
- var _29 = React.useState(0),
10658
- currentDetectionScore = _29[0],
10659
- setCurrentDetectionScore = _29[1];
10660
- var _30 = React.useState(0),
10661
- currentFocusScore = _30[0],
10662
- setCurrentFocusScore = _30[1];
10663
- var _31 = React.useState(0),
10664
- goodFramesCount = _31[0],
10665
- setGoodFramesCount = _31[1];
10666
- var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? goodIdCardFrontFramesThreshold : goodIdCardBackFramesThreshold;
10603
+ setThresholds(videoIdCaptureThresholds);
10604
+ }, [requestedAction, setThresholds, videoIdCaptureThresholds]);
10605
+ var _24 = React.useState(0),
10606
+ currentDetectionScore = _24[0],
10607
+ setCurrentDetectionScore = _24[1];
10608
+ var _25 = React.useState(0),
10609
+ currentFocusScore = _25[0],
10610
+ setCurrentFocusScore = _25[1];
10611
+ var _26 = React.useState(0),
10612
+ goodFramesCount = _26[0],
10613
+ setGoodFramesCount = _26[1];
10614
+ var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? videoIdCaptureThresholds.goodFrames.idCardFront : videoIdCaptureThresholds.goodFrames.idCardBack;
10667
10615
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
10668
10616
  React.useEffect(function () {
10669
10617
  if (!idCaptureModelsEnabled || idModelError) return;
@@ -10671,18 +10619,19 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10671
10619
  setDetectedObjects(prediction.detectedObjects);
10672
10620
  setCurrentDetectionScore(prediction.detectionScore);
10673
10621
  setCurrentFocusScore(prediction.focusScore);
10674
- if (prediction.detectionThresholdMet && prediction.focusThresholdMet) {
10675
- setGoodFramesCount(function (n) {
10676
- return n + 1;
10677
- });
10678
- } else {
10679
- setGoodFramesCount(0);
10622
+ var detectionThresholdMet = requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
10623
+ var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
10624
+ if (requestedAction === 'FLIP_ID' && isGoodFrame) {
10625
+ return setRequestedAction('SHOW_ID_BACK');
10680
10626
  }
10627
+ setGoodFramesCount(isGoodFrame ? function (n) {
10628
+ return n + 1;
10629
+ } : 0);
10681
10630
  });
10682
- }, [idCaptureModelsEnabled, idCardFrontDetectionThreshold, onIdPredictionMade, idModelError]);
10683
- var _32 = React.useState(null),
10684
- idFrontCaptureStartedAt = _32[0],
10685
- setFirstGoodFrameTime = _32[1];
10631
+ }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction]);
10632
+ var _27 = React.useState(null),
10633
+ idFrontCaptureStartedAt = _27[0],
10634
+ setFirstGoodFrameTime = _27[1];
10686
10635
  React.useEffect(function () {
10687
10636
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
10688
10637
  }, [goodFramesCount]);
@@ -10703,73 +10652,56 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10703
10652
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
10704
10653
  var faceBox = (_f = faces === null || faces === void 0 ? void 0 : faces[0]) === null || _f === void 0 ? void 0 : _f.box;
10705
10654
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
10706
- var _33 = React.useState(),
10707
- countdownStartedAt = _33[0],
10708
- setCountdownStartedAt = _33[1];
10655
+ var _28 = React.useState(),
10656
+ countdownStartedAt = _28[0],
10657
+ setCountdownStartedAt = _28[1];
10658
+ var photoCanvas = React.useRef(null);
10709
10659
  var frameLock = React.useRef(false);
10710
10660
  var captureFrame = React.useCallback(function () {
10711
10661
  return tslib.__awaiter(void 0, void 0, void 0, function () {
10712
- var frame, frameBase64, _a;
10713
- return tslib.__generator(this, function (_b) {
10714
- switch (_b.label) {
10662
+ var frameBase64;
10663
+ return tslib.__generator(this, function (_a) {
10664
+ switch (_a.label) {
10715
10665
  case 0:
10716
10666
  if (frameLock.current) return [2 /*return*/];
10717
10667
  frameLock.current = true;
10718
- return [4 /*yield*/, takePhoto()];
10719
- case 1:
10720
- frame = _b.sent();
10721
- if (!frame) {
10668
+ drawToCanvas(photoCanvas.current, videoRef.current);
10669
+ frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
10670
+ if (!frameBase64) {
10722
10671
  frameLock.current = false;
10723
10672
  return [2 /*return*/];
10724
10673
  }
10725
- _b.label = 2;
10726
- case 2:
10727
- _b.trys.push([2,, 10, 11]);
10728
- _a = frame;
10729
- if (!_a) return [3 /*break*/, 4];
10730
- return [4 /*yield*/, new Promise(function (resolve) {
10731
- var reader = new FileReader();
10732
- reader.onloadend = function () {
10733
- return resolve(reader.result);
10734
- };
10735
- reader.readAsDataURL(frame);
10736
- })];
10737
- case 3:
10738
- _a = _b.sent();
10739
- _b.label = 4;
10740
- case 4:
10741
- frameBase64 = _a;
10742
- if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 8];
10674
+ _a.label = 1;
10675
+ case 1:
10676
+ _a.trys.push([1,, 7, 8]);
10677
+ if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
10743
10678
  if (onIdFrontImageCaptured) {
10744
- frameBase64 && onIdFrontImageCaptured(frameBase64);
10679
+ onIdFrontImageCaptured(frameBase64);
10745
10680
  }
10746
- if (!skipShowIdCardBack) return [3 /*break*/, 7];
10747
- if (!(skipShowIdCardBack === true)) return [3 /*break*/, 5];
10681
+ if (!skipShowIdCardBack) return [3 /*break*/, 4];
10682
+ if (!(skipShowIdCardBack === true)) return [3 /*break*/, 2];
10748
10683
  return [2 /*return*/, onIdBackCaptureComplete()];
10749
- case 5:
10684
+ case 2:
10750
10685
  return [4 /*yield*/, skipShowIdCardBack()];
10751
- case 6:
10752
- if (_b.sent()) {
10686
+ case 3:
10687
+ if (_a.sent()) {
10753
10688
  return [2 /*return*/, onIdBackCaptureComplete()];
10754
10689
  }
10755
- _b.label = 7;
10756
- case 7:
10690
+ _a.label = 4;
10691
+ case 4:
10757
10692
  setRequestedAction('FLIP_ID');
10758
- setTimeout(function () {
10759
- setRequestedAction('SHOW_ID_BACK');
10760
- }, 6000);
10761
- return [3 /*break*/, 9];
10762
- case 8:
10693
+ return [3 /*break*/, 6];
10694
+ case 5:
10763
10695
  if (requestedAction == 'SHOW_ID_BACK') {
10764
10696
  if (onIdBackImageCaptured) {
10765
- frameBase64 && onIdBackImageCaptured(frameBase64);
10697
+ onIdBackImageCaptured(frameBase64);
10766
10698
  }
10767
10699
  onIdBackCaptureComplete();
10768
10700
  }
10769
- _b.label = 9;
10770
- case 9:
10771
- return [3 /*break*/, 11];
10772
- case 10:
10701
+ _a.label = 6;
10702
+ case 6:
10703
+ return [3 /*break*/, 8];
10704
+ case 7:
10773
10705
  setDetectedObjects([]);
10774
10706
  setCurrentDetectionScore(0);
10775
10707
  setCurrentFocusScore(0);
@@ -10781,17 +10713,27 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10781
10713
  clearTimeout(countdownTimeoutRef.current);
10782
10714
  }
10783
10715
  return [7 /*endfinally*/];
10784
- case 11:
10716
+ case 8:
10785
10717
  return [2 /*return*/];
10786
10718
  }
10787
10719
  });
10788
10720
  });
10789
- }, [onIdBackCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, takePhoto]);
10721
+ }, [onIdBackCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
10722
+ var isFlipping = requestedAction === 'FLIP_ID';
10723
+ React.useEffect(function () {
10724
+ if (!isFlipping) return;
10725
+ var t = setTimeout(function () {
10726
+ setRequestedAction('SHOW_ID_BACK');
10727
+ }, 6000);
10728
+ return function () {
10729
+ clearTimeout(t);
10730
+ };
10731
+ }, [isFlipping]);
10790
10732
  var stopRecording = React.useCallback(function () {
10791
10733
  stopRecordingVideo();
10792
10734
  stopRecordingAudio();
10793
10735
  }, [stopRecordingAudio, stopRecordingVideo]);
10794
- var satisfied = goodFramesThresholdMet && faceCentered && delaySatisfied;
10736
+ var satisfied = !isFlipping && goodFramesThresholdMet && faceCentered && delaySatisfied;
10795
10737
  React.useEffect(function () {
10796
10738
  if (satisfied && !countdownStartedAt) {
10797
10739
  setCountdownStartedAt(new Date());
@@ -10811,10 +10753,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10811
10753
  }, 1000);
10812
10754
  return;
10813
10755
  }
10814
- if (countdownStartedAt) {
10815
- captureFrame();
10816
- }
10817
- }, [captureFrame, countdownStartedAt, countdownTimeoutRef]);
10756
+ }, [countdownTimeoutRef]);
10818
10757
  React.useEffect(function () {
10819
10758
  if (!countdownStartedAt) return;
10820
10759
  setCountdownRemaining(captureCountdownSeconds);
@@ -10824,11 +10763,17 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10824
10763
  return function () {
10825
10764
  clearTimeout(countdownTimeoutRef.current);
10826
10765
  };
10827
- }, [captureCountdownSeconds, captureFrame, countdownStartedAt, manualCountdown]);
10766
+ }, [captureCountdownSeconds, countdownStartedAt, manualCountdown]);
10767
+ React.useEffect(function () {
10768
+ if (countdownRemaining === 0) {
10769
+ setCountdownRemaining(-1);
10770
+ captureFrame().then();
10771
+ }
10772
+ }, [captureFrame, countdownRemaining]);
10828
10773
  var timeoutStartedAt = useTimeout(readTextTimeoutDurationMs, stopRecording, requestedAction !== 'READ_TEXT', false, requestedAction === 'READ_TEXT').timeoutStartedAt;
10829
- var _34 = React.useState(0),
10830
- numFramesWithoutFaces = _34[0],
10831
- setNumFramesWithoutFaces = _34[1];
10774
+ var _29 = React.useState(0),
10775
+ numFramesWithoutFaces = _29[0],
10776
+ setNumFramesWithoutFaces = _29[1];
10832
10777
  React.useEffect(function () {
10833
10778
  if (!selfieModelError) {
10834
10779
  onSelfiePredictionMade(function (faces) {
@@ -10846,14 +10791,14 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10846
10791
  }
10847
10792
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
10848
10793
  var theme = styled.useTheme();
10849
- var _35 = useTranslations(rawVerbiage, {
10794
+ var _30 = useTranslations(rawVerbiage, {
10850
10795
  faceNotCenteredText: 'Please move your face to the center...',
10851
10796
  searchingForIdCardText: 'Searching for ID card...',
10852
10797
  captureBtnText: 'Capture'
10853
10798
  }),
10854
- captureBtnText = _35.captureBtnText,
10855
- faceNotCenteredText = _35.faceNotCenteredText,
10856
- searchingForIdCardText = _35.searchingForIdCardText;
10799
+ captureBtnText = _30.captureBtnText,
10800
+ faceNotCenteredText = _30.faceNotCenteredText,
10801
+ searchingForIdCardText = _30.searchingForIdCardText;
10857
10802
  var debugScalingDetails = useDebugScalingDetails({
10858
10803
  enabled: debugMode,
10859
10804
  pageWidth: width,
@@ -10867,7 +10812,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10867
10812
  return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
10868
10813
  ref: ref,
10869
10814
  className: "flex ".concat((_l = classNames.container) !== null && _l !== void 0 ? _l : '')
10870
- }, requestedAction === 'READ_TEXT' ? ( /*#__PURE__*/React__default['default'].createElement(ReadTextPrompt, {
10815
+ }, /*#__PURE__*/React__default['default'].createElement(InvisibleCanvas, {
10816
+ ref: photoCanvas
10817
+ }), requestedAction === 'READ_TEXT' ? ( /*#__PURE__*/React__default['default'].createElement(ReadTextPrompt, {
10871
10818
  text: readTextPrompt,
10872
10819
  startedAt: timeoutStartedAt || undefined,
10873
10820
  durationMs: readTextTimeoutDurationMs,
@@ -10906,7 +10853,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10906
10853
  className: classNames.guidanceMessage,
10907
10854
  "$background": (_q = (_p = (_o = theme.guidanceMessages) === null || _o === void 0 ? void 0 : _o.negative) === null || _p === void 0 ? void 0 : _p.backgroundColor) !== null && _q !== void 0 ? _q : 'red',
10908
10855
  "$textColor": (_t = (_s = (_r = theme.guidanceMessages) === null || _r === void 0 ? void 0 : _r.negative) === null || _s === void 0 ? void 0 : _s.textColor) !== null && _t !== void 0 ? _t : 'white'
10909
- }, guidanceText))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['default'].createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React__default['default'].createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React__default['default'].createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React__default['default'].createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React__default['default'].createElement("br", null), "Best Frame Detection Score: ", (_u = bestFrameDetails === null || bestFrameDetails === void 0 ? void 0 : bestFrameDetails.detectionScore) !== null && _u !== void 0 ? _u : 0, /*#__PURE__*/React__default['default'].createElement("br", null), "Best Frame Focus Score: ", (_v = bestFrameDetails === null || bestFrameDetails === void 0 ? void 0 : bestFrameDetails.focusScore) !== null && _v !== void 0 ? _v : 0)), !!countdownRemaining && capturingId && ( /*#__PURE__*/React__default['default'].createElement(CountdownContainer, {
10856
+ }, guidanceText))), debugMode && ( /*#__PURE__*/React__default['default'].createElement(DebugStatsPane, null, cameraRef.current ? ( /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, "\u2705 Camera: ", cameraRef.current.label, " (", cameraRef.current.width, "x", cameraRef.current.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__default['default'].createElement("br", null), isRecordingVideo ? '✅ Recording' : '❌ Not recording', /*#__PURE__*/React__default['default'].createElement("br", null), goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', goodFramesCount, "/", goodFramesThreshold, /*#__PURE__*/React__default['default'].createElement("br", null), "Detection Score: ", currentDetectionScore, /*#__PURE__*/React__default['default'].createElement("br", null), "Focus Score: ", currentFocusScore, /*#__PURE__*/React__default['default'].createElement("br", null), "Best Frame Detection Score: ", (_u = bestFrameDetails === null || bestFrameDetails === void 0 ? void 0 : bestFrameDetails.detectionScore) !== null && _u !== void 0 ? _u : 0, /*#__PURE__*/React__default['default'].createElement("br", null), "Best Frame Focus Score: ", (_v = bestFrameDetails === null || bestFrameDetails === void 0 ? void 0 : bestFrameDetails.focusScore) !== null && _v !== void 0 ? _v : 0)), countdownRemaining > 0 && capturingId && ( /*#__PURE__*/React__default['default'].createElement(CountdownContainer, {
10910
10857
  className: classNames.countdownContainer
10911
10858
  }, /*#__PURE__*/React__default['default'].createElement(Countdown, {
10912
10859
  className: classNames.countdown
@@ -11061,64 +11008,60 @@ var VideoIdWizard = function VideoIdWizard(_a) {
11061
11008
  faceLivenessProps = _h === void 0 ? {} : _h,
11062
11009
  _j = _a.idCaptureModelsEnabled,
11063
11010
  idCaptureModelsEnabled = _j === void 0 ? true : _j,
11064
- idCardFrontDetectionThreshold = _a.idCardFrontDetectionThreshold,
11065
- idCardBackDetectionThreshold = _a.idCardBackDetectionThreshold,
11066
- idCardFrontFocusThreshold = _a.idCardFrontFocusThreshold,
11067
- idCardBackFocusThreshold = _a.idCardBackFocusThreshold,
11068
- goodIdCardFrontFramesThreshold = _a.goodIdCardFrontFramesThreshold,
11069
- goodIdCardBackFramesThreshold = _a.goodIdCardBackFramesThreshold,
11011
+ _k = _a.videoIdCaptureThresholds,
11012
+ videoIdCaptureThresholds = _k === void 0 ? defaultVideoIdCaptureThresholds : _k,
11070
11013
  readTextPrompt = _a.readTextPrompt,
11071
11014
  readTextTimeoutDurationMs = _a.readTextTimeoutDurationMs,
11072
11015
  readTextMinReadingMs = _a.readTextMinReadingMs,
11073
- _k = _a.skipIdCapture,
11074
- skipIdCapture = _k === void 0 ? false : _k,
11075
- _l = _a.skipShowIdCardBack,
11076
- skipShowIdCardBack = _l === void 0 ? false : _l,
11077
- _m = _a.skipSuccessScreen,
11078
- skipSuccessScreen = _m === void 0 ? false : _m,
11079
- _o = _a.idCaptureLoadingOverlayMode,
11080
- idCaptureLoadingOverlayMode = _o === void 0 ? 'default' : _o,
11081
- _p = _a.idCaptureGuideType,
11082
- idCaptureGuideType = _p === void 0 ? 'fit' : _p,
11083
- _q = _a.idCapturePortraitGuidesOnMobile,
11084
- idCapturePortraitGuidesOnMobile = _q === void 0 ? false : _q,
11085
- _r = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
11086
- idCaptureRotateLoadingOverlayImageWhenPortrait = _r === void 0 ? true : _r,
11087
- _s = _a.idCaptureModelLoadTimeoutMs,
11088
- idCaptureModelLoadTimeoutMs = _s === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _s,
11089
- _t = _a.faceLivenessLoadingOverlayMode,
11090
- faceLivenessLoadingOverlayMode = _t === void 0 ? 'default' : _t,
11091
- _u = _a.disableFaceDetectionWhileAudioCapture,
11092
- disableFaceDetectionWhileAudioCapture = _u === void 0 ? true : _u,
11093
- _v = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
11094
- disableFaceDetectionWhileAudioCaptureMsDelay = _v === void 0 ? 2000 : _v,
11095
- _w = _a.silentFallback,
11096
- silentFallback = _w === void 0 ? false : _w,
11097
- _x = _a.mergeAVStreams,
11098
- mergeAVStreams = _x === void 0 ? false : _x,
11099
- _y = _a.assets,
11100
- assets = _y === void 0 ? {} : _y,
11101
- _z = _a.classNames,
11102
- classNames = _z === void 0 ? {} : _z,
11103
- _0 = _a.colors,
11104
- colors = _0 === void 0 ? {} : _0,
11105
- _1 = _a.verbiage,
11106
- verbiage = _1 === void 0 ? {} : _1,
11107
- _2 = _a.debugMode,
11108
- debugMode = _2 === void 0 ? false : _2;
11109
- var _3 = React.useContext(SubmissionContext),
11110
- submissionStatus = _3.submissionStatus,
11111
- idCaptureVideoUrl = _3.idCaptureVideoUrl,
11112
- idCaptureVideoAudioUrl = _3.idCaptureVideoAudioUrl,
11113
- idCaptureVideoIdFrontImage = _3.idCaptureVideoIdFrontImage,
11114
- idCaptureVideoIdBackImage = _3.idCaptureVideoIdBackImage,
11115
- setIdCaptureVideoUrl = _3.setIdCaptureVideoUrl,
11116
- setIdCaptureVideoIdFrontImage = _3.setIdCaptureVideoIdFrontImage,
11117
- setIdCaptureVideoIdBackImage = _3.setIdCaptureVideoIdBackImage,
11118
- setIdCaptureVideoAudioUrl = _3.setIdCaptureVideoAudioUrl;
11119
- var _4 = React.useState('CAPTURING_ID'),
11120
- captureState = _4[0],
11121
- setCaptureState = _4[1];
11016
+ _l = _a.skipIdCapture,
11017
+ skipIdCapture = _l === void 0 ? false : _l,
11018
+ _m = _a.skipShowIdCardBack,
11019
+ skipShowIdCardBack = _m === void 0 ? false : _m,
11020
+ _o = _a.skipSuccessScreen,
11021
+ skipSuccessScreen = _o === void 0 ? false : _o,
11022
+ _p = _a.idCaptureLoadingOverlayMode,
11023
+ idCaptureLoadingOverlayMode = _p === void 0 ? 'default' : _p,
11024
+ _q = _a.idCaptureGuideType,
11025
+ idCaptureGuideType = _q === void 0 ? 'fit' : _q,
11026
+ _r = _a.idCapturePortraitGuidesOnMobile,
11027
+ idCapturePortraitGuidesOnMobile = _r === void 0 ? false : _r,
11028
+ _s = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
11029
+ idCaptureRotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
11030
+ _t = _a.idCaptureModelLoadTimeoutMs,
11031
+ idCaptureModelLoadTimeoutMs = _t === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _t,
11032
+ _u = _a.faceLivenessLoadingOverlayMode,
11033
+ faceLivenessLoadingOverlayMode = _u === void 0 ? 'default' : _u,
11034
+ _v = _a.disableFaceDetectionWhileAudioCapture,
11035
+ disableFaceDetectionWhileAudioCapture = _v === void 0 ? true : _v,
11036
+ _w = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
11037
+ disableFaceDetectionWhileAudioCaptureMsDelay = _w === void 0 ? 2000 : _w,
11038
+ _x = _a.silentFallback,
11039
+ silentFallback = _x === void 0 ? false : _x,
11040
+ _y = _a.mergeAVStreams,
11041
+ mergeAVStreams = _y === void 0 ? false : _y,
11042
+ _z = _a.assets,
11043
+ assets = _z === void 0 ? {} : _z,
11044
+ _0 = _a.classNames,
11045
+ classNames = _0 === void 0 ? {} : _0,
11046
+ _1 = _a.colors,
11047
+ colors = _1 === void 0 ? {} : _1,
11048
+ _2 = _a.verbiage,
11049
+ verbiage = _2 === void 0 ? {} : _2,
11050
+ _3 = _a.debugMode,
11051
+ debugMode = _3 === void 0 ? false : _3;
11052
+ var _4 = React.useContext(SubmissionContext),
11053
+ submissionStatus = _4.submissionStatus,
11054
+ idCaptureVideoUrl = _4.idCaptureVideoUrl,
11055
+ idCaptureVideoAudioUrl = _4.idCaptureVideoAudioUrl,
11056
+ idCaptureVideoIdFrontImage = _4.idCaptureVideoIdFrontImage,
11057
+ idCaptureVideoIdBackImage = _4.idCaptureVideoIdBackImage,
11058
+ setIdCaptureVideoUrl = _4.setIdCaptureVideoUrl,
11059
+ setIdCaptureVideoIdFrontImage = _4.setIdCaptureVideoIdFrontImage,
11060
+ setIdCaptureVideoIdBackImage = _4.setIdCaptureVideoIdBackImage,
11061
+ setIdCaptureVideoAudioUrl = _4.setIdCaptureVideoAudioUrl;
11062
+ var _5 = React.useState('CAPTURING_ID'),
11063
+ captureState = _5[0],
11064
+ setCaptureState = _5[1];
11122
11065
  React.useEffect(function () {
11123
11066
  if (skipIdCapture && captureState === 'CAPTURING_ID') setCaptureState('CHECKING_LIVENESS');
11124
11067
  }, [captureState, skipIdCapture]);
@@ -11149,9 +11092,9 @@ var VideoIdWizard = function VideoIdWizard(_a) {
11149
11092
  var onVideoCaptureFaceNotDetected = React.useCallback(function () {
11150
11093
  setCaptureState('CHECKING_LIVENESS');
11151
11094
  }, []);
11152
- var _5 = React.useState(0),
11153
- attempt = _5[0],
11154
- setAttempt = _5[1];
11095
+ var _6 = React.useState(0),
11096
+ attempt = _6[0],
11097
+ setAttempt = _6[1];
11155
11098
  var userSuppliedExitAfterFailure = onExitAfterFailure !== null && onExitAfterFailure !== void 0 ? onExitAfterFailure : faceLivenessProps.onExitAfterFailure;
11156
11099
  var onFaceCaptureExitAfterFailure = React.useCallback(function (resp, req) {
11157
11100
  userSuppliedExitAfterFailure === null || userSuppliedExitAfterFailure === void 0 ? void 0 : userSuppliedExitAfterFailure(resp, req);
@@ -11255,12 +11198,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
11255
11198
  onFaceNotDetected: onVideoCaptureFaceNotDetected,
11256
11199
  onRecordingFailed: onRecordingFailed,
11257
11200
  idCaptureModelsEnabled: idCaptureModelsEnabled,
11258
- idCardFrontDetectionThreshold: idCardFrontDetectionThreshold,
11259
- idCardBackDetectionThreshold: idCardBackDetectionThreshold,
11260
- idCardFrontFocusThreshold: idCardFrontFocusThreshold,
11261
- idCardBackFocusThreshold: idCardBackFocusThreshold,
11262
- goodIdCardFrontFramesThreshold: goodIdCardFrontFramesThreshold,
11263
- goodIdCardBackFramesThreshold: goodIdCardBackFramesThreshold,
11201
+ videoIdCaptureThresholds: videoIdCaptureThresholds,
11264
11202
  skipShowIdCardBack: skipShowIdCardBack,
11265
11203
  disableFaceDetectionWhileAudioCapture: disableFaceDetectionWhileAudioCapture,
11266
11204
  disableFaceDetectionWhileAudioCaptureMsDelay: disableFaceDetectionWhileAudioCaptureMsDelay,
@@ -11721,9 +11659,8 @@ var ThemeProvider = function ThemeProvider(_a) {
11721
11659
  * Render a fullscreen ID capture component that instructs the user to photograph both sides of their ID card, or full page of their passport.
11722
11660
  */
11723
11661
  var IdValidation = function IdValidation(_a) {
11724
- var _b, _c;
11725
- var _d = _a.lang,
11726
- lang = _d === void 0 ? 'auto' : _d,
11662
+ var _b = _a.lang,
11663
+ lang = _b === void 0 ? 'auto' : _b,
11727
11664
  sessionId = _a.sessionId,
11728
11665
  clientRequestID = _a.clientRequestID,
11729
11666
  submissionUrl = _a.submissionUrl,
@@ -11746,35 +11683,25 @@ var IdValidation = function IdValidation(_a) {
11746
11683
  webhooksFireOnReview = _a.webhooksFireOnReview,
11747
11684
  sendBase64DocumentsInSwaggerProxy = _a.sendBase64DocumentsInSwaggerProxy,
11748
11685
  precapturedDocuments = _a.precapturedDocuments,
11749
- _e = _a.loadingOverlayMode,
11750
- loadingOverlayMode = _e === void 0 ? 'default' : _e,
11751
- _f = _a.idCaptureRequirement,
11752
- idCaptureRequirement = _f === void 0 ? 'idCardOrPassport' : _f,
11753
- _g = _a.separateIdCardCaptureSequence,
11754
- separateIdCardCaptureSequence = _g === void 0 ? false : _g,
11755
- _h = _a.idAutoCaptureEnabled,
11756
- idAutoCaptureEnabled = _h === void 0 ? true : _h,
11757
- _j = _a.idCardAutoCaptureScoreThreshold,
11758
- idCardAutoCaptureScoreThreshold = _j === void 0 ? defaultDocumentDetectionThresholds.idCard : _j,
11759
- _k = _a.passportAutoCaptureScoreThreshold,
11760
- passportAutoCaptureScoreThreshold = _k === void 0 ? defaultDocumentDetectionThresholds.passport : _k,
11761
- _l = _a.mrzDetectionScoreThreshold,
11762
- mrzDetectionScoreThreshold = _l === void 0 ? defaultDocumentDetectionThresholds.mrz : _l,
11763
- _m = _a.idCardFocusScoreThreshold,
11764
- idCardFocusScoreThreshold = _m === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _m,
11765
- _o = _a.passportFocusScoreThreshold,
11766
- passportFocusScoreThreshold = _o === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _o,
11767
- _p = _a.skipSuccessScreen,
11768
- skipSuccessScreen = _p === void 0 ? false : _p,
11686
+ _c = _a.loadingOverlayMode,
11687
+ loadingOverlayMode = _c === void 0 ? 'default' : _c,
11688
+ _d = _a.idCaptureRequirement,
11689
+ idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
11690
+ _e = _a.separateIdCardCaptureSequence,
11691
+ separateIdCardCaptureSequence = _e === void 0 ? false : _e,
11692
+ _f = _a.idCaptureThresholds,
11693
+ idCaptureThresholds = _f === void 0 ? defaultIdCaptureThresholds : _f,
11694
+ _g = _a.skipSuccessScreen,
11695
+ skipSuccessScreen = _g === void 0 ? false : _g,
11769
11696
  instructions = _a.instructions,
11770
- _q = _a.guideType,
11771
- guideType = _q === void 0 ? 'fit' : _q,
11772
- _r = _a.portraitGuidesOnMobile,
11773
- portraitGuidesOnMobile = _r === void 0 ? false : _r,
11774
- _s = _a.rotateLoadingOverlayImageWhenPortrait,
11775
- rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
11776
- _t = _a.modelLoadTimeoutMs,
11777
- modelLoadTimeoutMs = _t === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _t,
11697
+ _h = _a.guideType,
11698
+ guideType = _h === void 0 ? 'fit' : _h,
11699
+ _j = _a.portraitGuidesOnMobile,
11700
+ portraitGuidesOnMobile = _j === void 0 ? false : _j,
11701
+ _k = _a.rotateLoadingOverlayImageWhenPortrait,
11702
+ rotateLoadingOverlayImageWhenPortrait = _k === void 0 ? true : _k,
11703
+ _l = _a.modelLoadTimeoutMs,
11704
+ modelLoadTimeoutMs = _l === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _l,
11778
11705
  onBeforeSubmit = _a.onBeforeSubmit,
11779
11706
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
11780
11707
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -11788,28 +11715,28 @@ var IdValidation = function IdValidation(_a) {
11788
11715
  onUserCancel = _a.onUserCancel,
11789
11716
  onModelError = _a.onModelError,
11790
11717
  onCameraAccessDenied = _a.onCameraAccessDenied,
11791
- _u = _a.theme,
11792
- theme = _u === void 0 ? 'default' : _u,
11793
- _v = _a.assets,
11794
- assets = _v === void 0 ? {} : _v,
11795
- _w = _a.classNames,
11796
- classNames = _w === void 0 ? {} : _w,
11797
- _x = _a.colors,
11798
- colors = _x === void 0 ? {} : _x,
11799
- _y = _a.verbiage,
11800
- verbiage = _y === void 0 ? {} : _y,
11801
- _z = _a.captureSignature,
11802
- captureSignature = _z === void 0 ? false : _z,
11803
- _0 = _a.captureSignatureVideo,
11804
- captureSignatureVideo = _0 === void 0 ? false : _0,
11805
- _1 = _a.captureAdditionalDocuments,
11806
- captureAdditionalDocuments = _1 === void 0 ? [] : _1,
11807
- _2 = _a.geolocationEnabled,
11808
- geolocationEnabled = _2 === void 0 ? true : _2,
11809
- _3 = _a.geolocationRequired,
11810
- geolocationRequired = _3 === void 0 ? false : _3,
11811
- _4 = _a.debugMode,
11812
- debugMode = _4 === void 0 ? false : _4;
11718
+ _m = _a.theme,
11719
+ theme = _m === void 0 ? 'default' : _m,
11720
+ _o = _a.assets,
11721
+ assets = _o === void 0 ? {} : _o,
11722
+ _p = _a.classNames,
11723
+ classNames = _p === void 0 ? {} : _p,
11724
+ _q = _a.colors,
11725
+ colors = _q === void 0 ? {} : _q,
11726
+ _r = _a.verbiage,
11727
+ verbiage = _r === void 0 ? {} : _r,
11728
+ _s = _a.captureSignature,
11729
+ captureSignature = _s === void 0 ? false : _s,
11730
+ _t = _a.captureSignatureVideo,
11731
+ captureSignatureVideo = _t === void 0 ? false : _t,
11732
+ _u = _a.captureAdditionalDocuments,
11733
+ captureAdditionalDocuments = _u === void 0 ? [] : _u,
11734
+ _v = _a.geolocationEnabled,
11735
+ geolocationEnabled = _v === void 0 ? true : _v,
11736
+ _w = _a.geolocationRequired,
11737
+ geolocationRequired = _w === void 0 ? false : _w,
11738
+ _x = _a.debugMode,
11739
+ debugMode = _x === void 0 ? false : _x;
11813
11740
  useLanguage(lang);
11814
11741
  useDebugLogging(debugMode);
11815
11742
  var idCaptureProps = React.useMemo(function () {
@@ -11820,13 +11747,7 @@ var IdValidation = function IdValidation(_a) {
11820
11747
  precapturedDocuments: precapturedDocuments,
11821
11748
  captureRequirement: idCaptureRequirement,
11822
11749
  separateIdCardCaptureSequence: separateIdCardCaptureSequence,
11823
- autoCaptureEnabled: idAutoCaptureEnabled,
11824
- idCardAutoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
11825
- passportAutoCaptureScoreThreshold: passportAutoCaptureScoreThreshold,
11826
- mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
11827
- idCardFocusScoreThreshold: idCardFocusScoreThreshold,
11828
- passportFocusScoreThreshold: passportFocusScoreThreshold,
11829
- barcodeScanningEnabled: false,
11750
+ thresholds: idCaptureThresholds,
11830
11751
  skipSuccessScreen: skipSuccessScreen,
11831
11752
  loadingOverlayMode: loadingOverlayMode,
11832
11753
  instructions: instructions,
@@ -11840,7 +11761,7 @@ var IdValidation = function IdValidation(_a) {
11840
11761
  verbiage: verbiage,
11841
11762
  debugMode: debugMode
11842
11763
  };
11843
- }, [onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, separateIdCardCaptureSequence, idAutoCaptureEnabled, idCardAutoCaptureScoreThreshold, passportAutoCaptureScoreThreshold, mrzDetectionScoreThreshold, idCardFocusScoreThreshold, passportFocusScoreThreshold, skipSuccessScreen, loadingOverlayMode, instructions, guideType, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, assets, classNames, colors, verbiage, debugMode]);
11764
+ }, [onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, separateIdCardCaptureSequence, idCaptureThresholds, skipSuccessScreen, loadingOverlayMode, instructions, guideType, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, assets, classNames, colors, verbiage, debugMode]);
11844
11765
  var additionalDocumentCaptureProps = React.useMemo(function () {
11845
11766
  return {
11846
11767
  documents: captureAdditionalDocuments,
@@ -12034,9 +11955,8 @@ var FaceValidation = function FaceValidation(_a) {
12034
11955
  * Render a fullscreen capture component that performs `IDValidation` and `FaceValidation` sequentially.
12035
11956
  * */
12036
11957
  var IdAndFaceValidation = function IdAndFaceValidation(_a) {
12037
- var _b, _c;
12038
- var _d = _a.lang,
12039
- lang = _d === void 0 ? 'auto' : _d,
11958
+ var _b = _a.lang,
11959
+ lang = _b === void 0 ? 'auto' : _b,
12040
11960
  sessionId = _a.sessionId,
12041
11961
  authUrl = _a.authUrl,
12042
11962
  submissionUrl = _a.submissionUrl,
@@ -12058,39 +11978,29 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
12058
11978
  webhooksFireOnReview = _a.webhooksFireOnReview,
12059
11979
  sendBase64DocumentsInSwaggerProxy = _a.sendBase64DocumentsInSwaggerProxy,
12060
11980
  precapturedDocuments = _a.precapturedDocuments,
12061
- _e = _a.idCaptureLoadingOverlayMode,
12062
- idCaptureLoadingOverlayMode = _e === void 0 ? 'default' : _e,
12063
- _f = _a.idCaptureRequirement,
12064
- idCaptureRequirement = _f === void 0 ? 'idCardOrPassport' : _f,
12065
- _g = _a.idAutoCaptureEnabled,
12066
- idAutoCaptureEnabled = _g === void 0 ? true : _g,
12067
- _h = _a.idCardAutoCaptureScoreThreshold,
12068
- idCardAutoCaptureScoreThreshold = _h === void 0 ? defaultDocumentDetectionThresholds.idCard : _h,
12069
- _j = _a.passportAutoCaptureScoreThreshold,
12070
- passportAutoCaptureScoreThreshold = _j === void 0 ? defaultDocumentDetectionThresholds.passport : _j,
12071
- _k = _a.mrzDetectionScoreThreshold,
12072
- mrzDetectionScoreThreshold = _k === void 0 ? defaultDocumentDetectionThresholds.mrz : _k,
12073
- _l = _a.idCardFocusScoreThreshold,
12074
- idCardFocusScoreThreshold = _l === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _l,
12075
- _m = _a.passportFocusScoreThreshold,
12076
- passportFocusScoreThreshold = _m === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _m,
12077
- _o = _a.faceLivenessLoadingOverlayMode,
12078
- faceLivenessLoadingOverlayMode = _o === void 0 ? 'default' : _o,
12079
- _p = _a.faceLivenessTimeoutDurationMs,
12080
- faceLivenessTimeoutDurationMs = _p === void 0 ? 15000 : _p,
12081
- _q = _a.skipSuccessScreen,
12082
- skipSuccessScreen = _q === void 0 ? false : _q,
11981
+ _c = _a.idCaptureLoadingOverlayMode,
11982
+ idCaptureLoadingOverlayMode = _c === void 0 ? 'default' : _c,
11983
+ _d = _a.idCaptureRequirement,
11984
+ idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
11985
+ _e = _a.idCaptureThresholds,
11986
+ idCaptureThresholds = _e === void 0 ? defaultIdCaptureThresholds : _e,
11987
+ _f = _a.faceLivenessLoadingOverlayMode,
11988
+ faceLivenessLoadingOverlayMode = _f === void 0 ? 'default' : _f,
11989
+ _g = _a.faceLivenessTimeoutDurationMs,
11990
+ faceLivenessTimeoutDurationMs = _g === void 0 ? 15000 : _g,
11991
+ _h = _a.skipSuccessScreen,
11992
+ skipSuccessScreen = _h === void 0 ? false : _h,
12083
11993
  idCaptureInstructions = _a.idCaptureInstructions,
12084
- _r = _a.idCaptureGuideType,
12085
- idCaptureGuideType = _r === void 0 ? 'fit' : _r,
12086
- _s = _a.idCapturePortraitGuidesOnMobile,
12087
- idCapturePortraitGuidesOnMobile = _s === void 0 ? false : _s,
12088
- _t = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
12089
- idCaptureRotateLoadingOverlayImageWhenPortrait = _t === void 0 ? true : _t,
12090
- _u = _a.idCaptureModelLoadTimeoutMs,
12091
- idCaptureModelLoadTimeoutMs = _u === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _u,
12092
- _v = _a.selfieCaptureModelLoadTimeoutMs,
12093
- selfieCaptureModelLoadTimeoutMs = _v === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _v,
11994
+ _j = _a.idCaptureGuideType,
11995
+ idCaptureGuideType = _j === void 0 ? 'fit' : _j,
11996
+ _k = _a.idCapturePortraitGuidesOnMobile,
11997
+ idCapturePortraitGuidesOnMobile = _k === void 0 ? false : _k,
11998
+ _l = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
11999
+ idCaptureRotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
12000
+ _m = _a.idCaptureModelLoadTimeoutMs,
12001
+ idCaptureModelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
12002
+ _o = _a.selfieCaptureModelLoadTimeoutMs,
12003
+ selfieCaptureModelLoadTimeoutMs = _o === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _o,
12094
12004
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
12095
12005
  onDocumentUploaded = _a.onDocumentUploaded,
12096
12006
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -12107,28 +12017,28 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
12107
12017
  onIdCaptureModelError = _a.onIdCaptureModelError,
12108
12018
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
12109
12019
  onCameraAccessDenied = _a.onCameraAccessDenied,
12110
- _w = _a.captureSignature,
12111
- captureSignature = _w === void 0 ? false : _w,
12112
- _x = _a.captureSignatureVideo,
12113
- captureSignatureVideo = _x === void 0 ? false : _x,
12114
- _y = _a.captureAdditionalDocuments,
12115
- captureAdditionalDocuments = _y === void 0 ? [] : _y,
12116
- _z = _a.theme,
12117
- theme = _z === void 0 ? 'default' : _z,
12118
- _0 = _a.assets,
12119
- assets = _0 === void 0 ? {} : _0,
12120
- _1 = _a.classNames,
12121
- classNames = _1 === void 0 ? {} : _1,
12122
- _2 = _a.colors,
12123
- colors = _2 === void 0 ? {} : _2,
12124
- _3 = _a.verbiage,
12125
- verbiage = _3 === void 0 ? {} : _3,
12126
- _4 = _a.geolocationEnabled,
12127
- geolocationEnabled = _4 === void 0 ? true : _4,
12128
- _5 = _a.geolocationRequired,
12129
- geolocationRequired = _5 === void 0 ? false : _5,
12130
- _6 = _a.debugMode,
12131
- debugMode = _6 === void 0 ? false : _6;
12020
+ _p = _a.captureSignature,
12021
+ captureSignature = _p === void 0 ? false : _p,
12022
+ _q = _a.captureSignatureVideo,
12023
+ captureSignatureVideo = _q === void 0 ? false : _q,
12024
+ _r = _a.captureAdditionalDocuments,
12025
+ captureAdditionalDocuments = _r === void 0 ? [] : _r,
12026
+ _s = _a.theme,
12027
+ theme = _s === void 0 ? 'default' : _s,
12028
+ _t = _a.assets,
12029
+ assets = _t === void 0 ? {} : _t,
12030
+ _u = _a.classNames,
12031
+ classNames = _u === void 0 ? {} : _u,
12032
+ _v = _a.colors,
12033
+ colors = _v === void 0 ? {} : _v,
12034
+ _w = _a.verbiage,
12035
+ verbiage = _w === void 0 ? {} : _w,
12036
+ _x = _a.geolocationEnabled,
12037
+ geolocationEnabled = _x === void 0 ? true : _x,
12038
+ _y = _a.geolocationRequired,
12039
+ geolocationRequired = _y === void 0 ? false : _y,
12040
+ _z = _a.debugMode,
12041
+ debugMode = _z === void 0 ? false : _z;
12132
12042
  useLanguage(lang);
12133
12043
  useDebugLogging(debugMode);
12134
12044
  var idCaptureProps = React.useMemo(function () {
@@ -12142,12 +12052,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
12142
12052
  verbiage: verbiage.idCapture,
12143
12053
  precapturedDocuments: precapturedDocuments,
12144
12054
  captureRequirement: idCaptureRequirement,
12145
- autoCaptureEnabled: idAutoCaptureEnabled,
12146
- idCardAutoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
12147
- passportAutoCaptureScoreThreshold: passportAutoCaptureScoreThreshold,
12148
- mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
12149
- idCardFocusScoreThreshold: idCardFocusScoreThreshold,
12150
- passportFocusScoreThreshold: passportFocusScoreThreshold,
12055
+ thresholds: idCaptureThresholds,
12151
12056
  loadingOverlayMode: idCaptureLoadingOverlayMode,
12152
12057
  instructions: idCaptureInstructions,
12153
12058
  guideType: idCaptureGuideType,
@@ -12157,7 +12062,7 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
12157
12062
  skipSuccessScreen: skipSuccessScreen,
12158
12063
  debugMode: debugMode
12159
12064
  };
12160
- }, [assets.idCapture, classNames.idCapture, colors.idCapture, debugMode, idAutoCaptureEnabled, idCaptureGuideType, idCaptureInstructions, idCaptureLoadingOverlayMode, idCaptureModelLoadTimeoutMs, idCapturePortraitGuidesOnMobile, idCaptureRequirement, idCaptureRotateLoadingOverlayImageWhenPortrait, idCardAutoCaptureScoreThreshold, idCardFocusScoreThreshold, mrzDetectionScoreThreshold, onExitCapture, onIdCaptureModelError, onUserCancel, passportAutoCaptureScoreThreshold, passportFocusScoreThreshold, precapturedDocuments, skipSuccessScreen, verbiage.idCapture]);
12065
+ }, [onExitCapture, onUserCancel, onIdCaptureModelError, assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, precapturedDocuments, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, skipSuccessScreen, debugMode]);
12161
12066
  var faceLivenessProps = React.useMemo(function () {
12162
12067
  return {
12163
12068
  loadingOverlayMode: faceLivenessLoadingOverlayMode,
@@ -12265,10 +12170,9 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
12265
12170
  * Render a fullscreen capture component that performs IDValidation and FaceValidation sequentially, and then stores the results in IDmission's customer database using the supplied `enrollmentId` for later verification or 1:N matching.
12266
12171
  */
12267
12172
  var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollment(_a) {
12268
- var _b, _c;
12269
12173
  var enrollmentId = _a.enrollmentId,
12270
- _d = _a.lang,
12271
- lang = _d === void 0 ? 'auto' : _d,
12174
+ _b = _a.lang,
12175
+ lang = _b === void 0 ? 'auto' : _b,
12272
12176
  sessionId = _a.sessionId,
12273
12177
  authUrl = _a.authUrl,
12274
12178
  submissionUrl = _a.submissionUrl,
@@ -12292,39 +12196,29 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
12292
12196
  webhooksSendProcessedImages = _a.webhooksSendProcessedImages,
12293
12197
  webhooksFireOnReview = _a.webhooksFireOnReview,
12294
12198
  sendBase64DocumentsInSwaggerProxy = _a.sendBase64DocumentsInSwaggerProxy,
12295
- _e = _a.idCaptureLoadingOverlayMode,
12296
- idCaptureLoadingOverlayMode = _e === void 0 ? 'default' : _e,
12297
- _f = _a.idCaptureRequirement,
12298
- idCaptureRequirement = _f === void 0 ? 'idCardOrPassport' : _f,
12299
- _g = _a.idAutoCaptureEnabled,
12300
- idAutoCaptureEnabled = _g === void 0 ? true : _g,
12301
- _h = _a.idCardAutoCaptureScoreThreshold,
12302
- idCardAutoCaptureScoreThreshold = _h === void 0 ? defaultDocumentDetectionThresholds.idCard : _h,
12303
- _j = _a.passportAutoCaptureScoreThreshold,
12304
- passportAutoCaptureScoreThreshold = _j === void 0 ? defaultDocumentDetectionThresholds.passport : _j,
12305
- _k = _a.mrzDetectionScoreThreshold,
12306
- mrzDetectionScoreThreshold = _k === void 0 ? defaultDocumentDetectionThresholds.mrz : _k,
12307
- _l = _a.idCardFocusScoreThreshold,
12308
- idCardFocusScoreThreshold = _l === void 0 ? (_b = defaultFocusThresholds.idCard) === null || _b === void 0 ? void 0 : _b.mobile : _l,
12309
- _m = _a.passportFocusScoreThreshold,
12310
- passportFocusScoreThreshold = _m === void 0 ? (_c = defaultFocusThresholds.passport) === null || _c === void 0 ? void 0 : _c.mobile : _m,
12311
- _o = _a.faceLivenessTimeoutDurationMs,
12312
- faceLivenessTimeoutDurationMs = _o === void 0 ? 15000 : _o,
12313
- _p = _a.faceLivenessLoadingOverlayMode,
12314
- faceLivenessLoadingOverlayMode = _p === void 0 ? 'default' : _p,
12315
- _q = _a.skipSuccessScreen,
12316
- skipSuccessScreen = _q === void 0 ? false : _q,
12199
+ _c = _a.idCaptureLoadingOverlayMode,
12200
+ idCaptureLoadingOverlayMode = _c === void 0 ? 'default' : _c,
12201
+ _d = _a.idCaptureRequirement,
12202
+ idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
12203
+ _e = _a.idCaptureThresholds,
12204
+ idCaptureThresholds = _e === void 0 ? defaultIdCaptureThresholds : _e,
12205
+ _f = _a.faceLivenessTimeoutDurationMs,
12206
+ faceLivenessTimeoutDurationMs = _f === void 0 ? 15000 : _f,
12207
+ _g = _a.faceLivenessLoadingOverlayMode,
12208
+ faceLivenessLoadingOverlayMode = _g === void 0 ? 'default' : _g,
12209
+ _h = _a.skipSuccessScreen,
12210
+ skipSuccessScreen = _h === void 0 ? false : _h,
12317
12211
  idCaptureInstructions = _a.idCaptureInstructions,
12318
- _r = _a.idCaptureGuideType,
12319
- idCaptureGuideType = _r === void 0 ? 'fit' : _r,
12320
- _s = _a.idCapturePortraitGuidesOnMobile,
12321
- idCapturePortraitGuidesOnMobile = _s === void 0 ? false : _s,
12322
- _t = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
12323
- idCaptureRotateLoadingOverlayImageWhenPortrait = _t === void 0 ? true : _t,
12324
- _u = _a.idCaptureModelLoadTimeoutMs,
12325
- idCaptureModelLoadTimeoutMs = _u === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _u,
12326
- _v = _a.selfieCaptureModelLoadTimeoutMs,
12327
- selfieCaptureModelLoadTimeoutMs = _v === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _v,
12212
+ _j = _a.idCaptureGuideType,
12213
+ idCaptureGuideType = _j === void 0 ? 'fit' : _j,
12214
+ _k = _a.idCapturePortraitGuidesOnMobile,
12215
+ idCapturePortraitGuidesOnMobile = _k === void 0 ? false : _k,
12216
+ _l = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
12217
+ idCaptureRotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
12218
+ _m = _a.idCaptureModelLoadTimeoutMs,
12219
+ idCaptureModelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
12220
+ _o = _a.selfieCaptureModelLoadTimeoutMs,
12221
+ selfieCaptureModelLoadTimeoutMs = _o === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _o,
12328
12222
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
12329
12223
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
12330
12224
  onDocumentUploaded = _a.onDocumentUploaded,
@@ -12340,28 +12234,28 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
12340
12234
  onIdCaptureModelError = _a.onIdCaptureModelError,
12341
12235
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
12342
12236
  onCameraAccessDenied = _a.onCameraAccessDenied,
12343
- _w = _a.captureSignature,
12344
- captureSignature = _w === void 0 ? false : _w,
12345
- _x = _a.captureSignatureVideo,
12346
- captureSignatureVideo = _x === void 0 ? false : _x,
12347
- _y = _a.captureAdditionalDocuments,
12348
- captureAdditionalDocuments = _y === void 0 ? [] : _y,
12349
- _z = _a.theme,
12350
- theme = _z === void 0 ? 'default' : _z,
12351
- _0 = _a.assets,
12352
- assets = _0 === void 0 ? {} : _0,
12353
- _1 = _a.classNames,
12354
- classNames = _1 === void 0 ? {} : _1,
12355
- _2 = _a.colors,
12356
- colors = _2 === void 0 ? {} : _2,
12357
- _3 = _a.verbiage,
12358
- verbiage = _3 === void 0 ? {} : _3,
12359
- _4 = _a.geolocationEnabled,
12360
- geolocationEnabled = _4 === void 0 ? true : _4,
12361
- _5 = _a.geolocationRequired,
12362
- geolocationRequired = _5 === void 0 ? false : _5,
12363
- _6 = _a.debugMode,
12364
- debugMode = _6 === void 0 ? false : _6;
12237
+ _p = _a.captureSignature,
12238
+ captureSignature = _p === void 0 ? false : _p,
12239
+ _q = _a.captureSignatureVideo,
12240
+ captureSignatureVideo = _q === void 0 ? false : _q,
12241
+ _r = _a.captureAdditionalDocuments,
12242
+ captureAdditionalDocuments = _r === void 0 ? [] : _r,
12243
+ _s = _a.theme,
12244
+ theme = _s === void 0 ? 'default' : _s,
12245
+ _t = _a.assets,
12246
+ assets = _t === void 0 ? {} : _t,
12247
+ _u = _a.classNames,
12248
+ classNames = _u === void 0 ? {} : _u,
12249
+ _v = _a.colors,
12250
+ colors = _v === void 0 ? {} : _v,
12251
+ _w = _a.verbiage,
12252
+ verbiage = _w === void 0 ? {} : _w,
12253
+ _x = _a.geolocationEnabled,
12254
+ geolocationEnabled = _x === void 0 ? true : _x,
12255
+ _y = _a.geolocationRequired,
12256
+ geolocationRequired = _y === void 0 ? false : _y,
12257
+ _z = _a.debugMode,
12258
+ debugMode = _z === void 0 ? false : _z;
12365
12259
  useLanguage(lang);
12366
12260
  useDebugLogging(debugMode);
12367
12261
  var idCaptureProps = React.useMemo(function () {
@@ -12371,12 +12265,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
12371
12265
  colors: colors.idCapture,
12372
12266
  verbiage: verbiage.idCapture,
12373
12267
  captureRequirement: idCaptureRequirement,
12374
- autoCaptureEnabled: idAutoCaptureEnabled,
12375
- idCardAutoCaptureScoreThreshold: idCardAutoCaptureScoreThreshold,
12376
- passportAutoCaptureScoreThreshold: passportAutoCaptureScoreThreshold,
12377
- mrzDetectionScoreThreshold: mrzDetectionScoreThreshold,
12378
- idCardFocusScoreThreshold: idCardFocusScoreThreshold,
12379
- passportFocusScoreThreshold: passportFocusScoreThreshold,
12268
+ thresholds: idCaptureThresholds,
12380
12269
  loadingOverlayMode: idCaptureLoadingOverlayMode,
12381
12270
  instructions: idCaptureInstructions,
12382
12271
  guideType: idCaptureGuideType,
@@ -12389,7 +12278,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
12389
12278
  skipSuccessScreen: skipSuccessScreen,
12390
12279
  debugMode: debugMode
12391
12280
  };
12392
- }, [assets.idCapture, classNames.idCapture, colors.idCapture, debugMode, idAutoCaptureEnabled, idCaptureGuideType, idCaptureInstructions, idCaptureLoadingOverlayMode, idCaptureModelLoadTimeoutMs, idCapturePortraitGuidesOnMobile, idCaptureRequirement, idCaptureRotateLoadingOverlayImageWhenPortrait, idCardAutoCaptureScoreThreshold, idCardFocusScoreThreshold, mrzDetectionScoreThreshold, onExitCapture, onIdCaptureModelError, onUserCancel, passportAutoCaptureScoreThreshold, passportFocusScoreThreshold, skipSuccessScreen, verbiage.idCapture]);
12281
+ }, [assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, onExitCapture, onUserCancel, onIdCaptureModelError, skipSuccessScreen, debugMode]);
12393
12282
  var faceLivenessProps = React.useMemo(function () {
12394
12283
  return {
12395
12284
  onExitCapture: onExitCapture,
@@ -13727,70 +13616,60 @@ var VideoIdValidation = function VideoIdValidation(_a) {
13727
13616
  faceLivenessProps = _a.faceLivenessProps,
13728
13617
  _c = _a.idCaptureModelsEnabled,
13729
13618
  idCaptureModelsEnabled = _c === void 0 ? true : _c,
13730
- _d = _a.idCardFrontDetectionThreshold,
13731
- idCardFrontDetectionThreshold = _d === void 0 ? 0.6 : _d,
13732
- _e = _a.idCardFrontFocusThreshold,
13733
- idCardFrontFocusThreshold = _e === void 0 ? 0 : _e,
13734
- _f = _a.goodIdCardFrontFramesThreshold,
13735
- goodIdCardFrontFramesThreshold = _f === void 0 ? 1 : _f,
13736
- _g = _a.idCardBackDetectionThreshold,
13737
- idCardBackDetectionThreshold = _g === void 0 ? 0.6 : _g,
13738
- _h = _a.idCardBackFocusThreshold,
13739
- idCardBackFocusThreshold = _h === void 0 ? 0 : _h,
13740
- _j = _a.goodIdCardBackFramesThreshold,
13741
- goodIdCardBackFramesThreshold = _j === void 0 ? 1 : _j,
13619
+ _d = _a.videoIdCaptureThresholds,
13620
+ videoIdCaptureThresholds = _d === void 0 ? defaultVideoIdCaptureThresholds : _d,
13742
13621
  readTextPrompt = _a.readTextPrompt,
13743
- _k = _a.readTextTimeoutDurationMs,
13744
- readTextTimeoutDurationMs = _k === void 0 ? 15000 : _k,
13745
- _l = _a.readTextMinReadingMs,
13746
- readTextMinReadingMs = _l === void 0 ? 10000 : _l,
13747
- _m = _a.skipSuccessScreen,
13748
- skipSuccessScreen = _m === void 0 ? false : _m,
13749
- _o = _a.skipIdCapture,
13750
- skipIdCapture = _o === void 0 ? false : _o,
13751
- _p = _a.skipShowIdCardBack,
13752
- skipShowIdCardBack = _p === void 0 ? false : _p,
13753
- _q = _a.idCaptureLoadingOverlayMode,
13754
- idCaptureLoadingOverlayMode = _q === void 0 ? 'default' : _q,
13755
- _r = _a.idCaptureGuideType,
13756
- idCaptureGuideType = _r === void 0 ? 'fit' : _r,
13757
- _s = _a.idCapturePortraitGuidesOnMobile,
13758
- idCapturePortraitGuidesOnMobile = _s === void 0 ? false : _s,
13759
- _t = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
13760
- idCaptureRotateLoadingOverlayImageWhenPortrait = _t === void 0 ? true : _t,
13622
+ _e = _a.readTextTimeoutDurationMs,
13623
+ readTextTimeoutDurationMs = _e === void 0 ? 15000 : _e,
13624
+ _f = _a.readTextMinReadingMs,
13625
+ readTextMinReadingMs = _f === void 0 ? 10000 : _f,
13626
+ _g = _a.skipSuccessScreen,
13627
+ skipSuccessScreen = _g === void 0 ? false : _g,
13628
+ _h = _a.skipIdCapture,
13629
+ skipIdCapture = _h === void 0 ? false : _h,
13630
+ _j = _a.skipShowIdCardBack,
13631
+ skipShowIdCardBack = _j === void 0 ? false : _j,
13632
+ _k = _a.idCaptureLoadingOverlayMode,
13633
+ idCaptureLoadingOverlayMode = _k === void 0 ? 'default' : _k,
13634
+ _l = _a.idCaptureGuideType,
13635
+ idCaptureGuideType = _l === void 0 ? 'fit' : _l,
13636
+ _m = _a.idCapturePortraitGuidesOnMobile,
13637
+ idCapturePortraitGuidesOnMobile = _m === void 0 ? false : _m,
13638
+ _o = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
13639
+ idCaptureRotateLoadingOverlayImageWhenPortrait = _o === void 0 ? true : _o,
13761
13640
  idCardForFaceMatch = _a.idCardForFaceMatch,
13762
- _u = _a.faceLivenessLoadingOverlayMode,
13763
- faceLivenessLoadingOverlayMode = _u === void 0 ? 'default' : _u,
13764
- _v = _a.disableFaceDetectionWhileAudioCapture,
13765
- disableFaceDetectionWhileAudioCapture = _v === void 0 ? false : _v,
13766
- _w = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
13767
- disableFaceDetectionWhileAudioCaptureMsDelay = _w === void 0 ? 2000 : _w,
13768
- _x = _a.silentFallback,
13769
- silentFallback = _x === void 0 ? false : _x,
13770
- _y = _a.mergeAVStreams,
13771
- mergeAVStreams = _y === void 0 ? false : _y,
13772
- _z = _a.theme,
13773
- theme = _z === void 0 ? 'default' : _z,
13774
- _0 = _a.assets,
13775
- assets = _0 === void 0 ? {} : _0,
13776
- _1 = _a.classNames,
13777
- classNames = _1 === void 0 ? {} : _1,
13778
- _2 = _a.colors,
13779
- colors = _2 === void 0 ? {} : _2,
13780
- _3 = _a.verbiage,
13781
- verbiage = _3 === void 0 ? {} : _3,
13782
- _4 = _a.captureSignature,
13783
- captureSignature = _4 === void 0 ? false : _4,
13784
- _5 = _a.captureSignatureVideo,
13785
- captureSignatureVideo = _5 === void 0 ? false : _5,
13786
- _6 = _a.captureAdditionalDocuments,
13787
- captureAdditionalDocuments = _6 === void 0 ? [] : _6,
13788
- _7 = _a.geolocationEnabled,
13789
- geolocationEnabled = _7 === void 0 ? true : _7,
13790
- _8 = _a.geolocationRequired,
13791
- geolocationRequired = _8 === void 0 ? false : _8,
13792
- _9 = _a.debugMode,
13793
- debugMode = _9 === void 0 ? false : _9;
13641
+ _p = _a.faceLivenessLoadingOverlayMode,
13642
+ faceLivenessLoadingOverlayMode = _p === void 0 ? 'default' : _p,
13643
+ _q = _a.disableFaceDetectionWhileAudioCapture,
13644
+ disableFaceDetectionWhileAudioCapture = _q === void 0 ? false : _q,
13645
+ _r = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
13646
+ disableFaceDetectionWhileAudioCaptureMsDelay = _r === void 0 ? 2000 : _r,
13647
+ _s = _a.silentFallback,
13648
+ silentFallback = _s === void 0 ? false : _s,
13649
+ _t = _a.mergeAVStreams,
13650
+ mergeAVStreams = _t === void 0 ? false : _t,
13651
+ _u = _a.theme,
13652
+ theme = _u === void 0 ? 'default' : _u,
13653
+ _v = _a.assets,
13654
+ assets = _v === void 0 ? {} : _v,
13655
+ _w = _a.classNames,
13656
+ classNames = _w === void 0 ? {} : _w,
13657
+ _x = _a.colors,
13658
+ colors = _x === void 0 ? {} : _x,
13659
+ _y = _a.verbiage,
13660
+ verbiage = _y === void 0 ? {} : _y,
13661
+ _z = _a.captureSignature,
13662
+ captureSignature = _z === void 0 ? false : _z,
13663
+ _0 = _a.captureSignatureVideo,
13664
+ captureSignatureVideo = _0 === void 0 ? false : _0,
13665
+ _1 = _a.captureAdditionalDocuments,
13666
+ captureAdditionalDocuments = _1 === void 0 ? [] : _1,
13667
+ _2 = _a.geolocationEnabled,
13668
+ geolocationEnabled = _2 === void 0 ? true : _2,
13669
+ _3 = _a.geolocationRequired,
13670
+ geolocationRequired = _3 === void 0 ? false : _3,
13671
+ _4 = _a.debugMode,
13672
+ debugMode = _4 === void 0 ? false : _4;
13794
13673
  useLanguage(lang);
13795
13674
  useDebugLogging(debugMode);
13796
13675
  var videoIdCaptureProps = React.useMemo(function () {
@@ -13798,12 +13677,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
13798
13677
  idCaptureProps: idCaptureProps,
13799
13678
  faceLivenessProps: faceLivenessProps,
13800
13679
  idCaptureModelsEnabled: idCaptureModelsEnabled,
13801
- idCardFrontDetectionThreshold: idCardFrontDetectionThreshold,
13802
- idCardFrontFocusThreshold: idCardFrontFocusThreshold,
13803
- goodIdCardFrontFramesThreshold: goodIdCardFrontFramesThreshold,
13804
- idCardBackDetectionThreshold: idCardBackDetectionThreshold,
13805
- idCardBackFocusThreshold: idCardBackFocusThreshold,
13806
- goodIdCardBackFramesThreshold: goodIdCardBackFramesThreshold,
13680
+ videoIdCaptureThresholds: videoIdCaptureThresholds,
13807
13681
  readTextPrompt: readTextPrompt,
13808
13682
  readTextTimeoutDurationMs: readTextTimeoutDurationMs,
13809
13683
  readTextMinReadingMs: readTextMinReadingMs,
@@ -13828,7 +13702,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
13828
13702
  verbiage: verbiage,
13829
13703
  debugMode: debugMode
13830
13704
  };
13831
- }, [idCaptureProps, faceLivenessProps, idCaptureModelsEnabled, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, goodIdCardFrontFramesThreshold, idCardBackDetectionThreshold, idCardBackFocusThreshold, goodIdCardBackFramesThreshold, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, onExitCapture, onExitAfterFailure, onUserCancel, skipSuccessScreen, skipIdCapture, skipShowIdCardBack, idCaptureLoadingOverlayMode, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, faceLivenessLoadingOverlayMode, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, silentFallback, mergeAVStreams, assets, classNames, colors, verbiage, debugMode]);
13705
+ }, [idCaptureProps, faceLivenessProps, idCaptureModelsEnabled, videoIdCaptureThresholds, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, onExitCapture, onExitAfterFailure, onUserCancel, skipSuccessScreen, skipIdCapture, skipShowIdCardBack, idCaptureLoadingOverlayMode, idCaptureGuideType, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, faceLivenessLoadingOverlayMode, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, silentFallback, mergeAVStreams, assets, classNames, colors, verbiage, debugMode]);
13832
13706
  var additionalDocumentCaptureProps = React.useMemo(function () {
13833
13707
  return {
13834
13708
  documents: captureAdditionalDocuments,