idmission-web-sdk 2.2.73 → 2.2.74

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 (48) hide show
  1. package/dist/components/CompositeWizard.d.ts.map +1 -1
  2. package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts +2 -2
  3. package/dist/components/customer_flows/CustomerIdAndBiometricsEnrollment.d.ts.map +1 -1
  4. package/dist/components/customer_flows/IdAndFaceValidation.d.ts +2 -2
  5. package/dist/components/customer_flows/IdAndFaceValidation.d.ts.map +1 -1
  6. package/dist/components/customer_flows/IdValidation.d.ts +3 -5
  7. package/dist/components/customer_flows/IdValidation.d.ts.map +1 -1
  8. package/dist/components/customer_flows/VideoIdValidation.d.ts +2 -2
  9. package/dist/components/customer_flows/VideoIdValidation.d.ts.map +1 -1
  10. package/dist/components/fallback_flows/IdCapture.d.ts.map +1 -1
  11. package/dist/components/id_capture/CapturedDocuments.d.ts +1 -1
  12. package/dist/components/id_capture/CapturedDocuments.d.ts.map +1 -1
  13. package/dist/components/id_capture/IdCapture.d.ts +2 -2
  14. package/dist/components/id_capture/IdCapture.d.ts.map +1 -1
  15. package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +1 -2
  16. package/dist/components/id_capture/IdCaptureModelsProvider.d.ts.map +1 -1
  17. package/dist/components/id_capture/IdCaptureRequirementOption.d.ts +5 -7
  18. package/dist/components/id_capture/IdCaptureRequirementOption.d.ts.map +1 -1
  19. package/dist/components/id_capture/IdCaptureStateProvider.d.ts +0 -4
  20. package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
  21. package/dist/components/id_capture/IdCaptureSuccess.d.ts +4 -0
  22. package/dist/components/id_capture/IdCaptureSuccess.d.ts.map +1 -1
  23. package/dist/components/id_capture/IdCaptureWizard.d.ts +1 -2
  24. package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
  25. package/dist/components/submission/SubmissionProvider.d.ts +1 -1
  26. package/dist/components/submission/SubmissionProvider.d.ts.map +1 -1
  27. package/dist/components/submission/types.d.ts +1 -1
  28. package/dist/components/submission/types.d.ts.map +1 -1
  29. package/dist/components/video_id/IdVideoCapture.d.ts +0 -2
  30. package/dist/components/video_id/IdVideoCapture.d.ts.map +1 -1
  31. package/dist/components/video_id/IdVideoCaptureWizard.d.ts.map +1 -1
  32. package/dist/lib/models/DocumentDetection.d.ts +2 -6
  33. package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
  34. package/dist/lib/models/Focus.d.ts +0 -4
  35. package/dist/lib/models/Focus.d.ts.map +1 -1
  36. package/dist/lib/models/defaults/DocumentDetector.d.ts +1 -1
  37. package/dist/sdk2.cjs.development.js +328 -354
  38. package/dist/sdk2.cjs.development.js.map +1 -1
  39. package/dist/sdk2.cjs.production.js +1 -1
  40. package/dist/sdk2.cjs.production.js.map +1 -1
  41. package/dist/sdk2.esm.js +328 -354
  42. package/dist/sdk2.esm.js.map +1 -1
  43. package/dist/sdk2.umd.development.js +328 -354
  44. package/dist/sdk2.umd.development.js.map +1 -1
  45. package/dist/sdk2.umd.production.js +1 -1
  46. package/dist/sdk2.umd.production.js.map +1 -1
  47. package/dist/version.d.ts +1 -1
  48. package/package.json +3 -3
@@ -234,7 +234,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
234
234
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
235
235
  };
236
236
 
237
- var webSdkVersion = '2.2.73';
237
+ var webSdkVersion = '2.2.74';
238
238
 
239
239
  function getPlatform() {
240
240
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -1464,7 +1464,7 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1464
1464
  },
1465
1465
  additionalData: {
1466
1466
  uniqueRequestId: new Date().getTime().toString(),
1467
- manualReviewRequired: manualReviewRequired ? 'Y' : 'N',
1467
+ manualReviewRequired: manualReviewRequired === 'forced' ? 'F' : manualReviewRequired ? 'Y' : 'N',
1468
1468
  bypassAgeValidation: bypassAgeValidation ? 'Y' : 'N',
1469
1469
  bypassNameMatching: bypassNameMatching ? 'Y' : 'N',
1470
1470
  postDataAPIRequired: webhooksEnabled ? 'Y' : 'N',
@@ -2297,7 +2297,7 @@ function average(arr) {
2297
2297
 
2298
2298
  var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
2299
2299
 
2300
- var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20250111_090328.tflite");
2300
+ var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20241018_093000.tflite");
2301
2301
 
2302
2302
  var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
2303
2303
 
@@ -2316,10 +2316,6 @@ var defaultFocusThresholds = {
2316
2316
  passport: {
2317
2317
  desktop: 0,
2318
2318
  mobile: 0.3
2319
- },
2320
- singlePage: {
2321
- desktop: 0,
2322
- mobile: 0.3
2323
2319
  }
2324
2320
  };
2325
2321
  var classifier = null;
@@ -2945,19 +2941,16 @@ var defaultDocumentDetectionThresholds = {
2945
2941
  idCardFront: 0.6,
2946
2942
  idCardBack: 0.6,
2947
2943
  passport: 0.4,
2948
- singlePage: 0.4,
2949
2944
  stability: {
2950
2945
  idCardFront: 0.85,
2951
2946
  idCardBack: 0.85,
2952
- passport: 0.5,
2953
- singlePage: 0.5
2947
+ passport: 0.5
2954
2948
  }
2955
2949
  };
2956
2950
  var documentTypeDisplayNames = {
2957
2951
  idCardFront: 'ID card front',
2958
2952
  idCardBack: 'ID card back',
2959
2953
  passport: 'Passport',
2960
- singlePage: 'Single page',
2961
2954
  none: 'None'
2962
2955
  };
2963
2956
  var detector = null;
@@ -3146,7 +3139,7 @@ var defaultDocumentDetectionBoundaries = {
3146
3139
  right: 20
3147
3140
  };
3148
3141
  function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3149
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
3142
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3150
3143
  if (boundaries === void 0) {
3151
3144
  boundaries = defaultDocumentDetectionBoundaries;
3152
3145
  }
@@ -3197,25 +3190,18 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3197
3190
  var bestPassportPage = detectedObjects.find(function (obj) {
3198
3191
  return obj.label === 'Passport page';
3199
3192
  });
3200
- var bestSinglePage = detectedObjects.find(function (obj) {
3201
- return obj.label === 'Single page';
3202
- });
3203
3193
  var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
3204
3194
  var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
3205
3195
  var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
3206
- var singlePageDetectionScore = (_h = bestSinglePage === null || bestSinglePage === void 0 ? void 0 : bestSinglePage.score) !== null && _h !== void 0 ? _h : 0;
3207
- var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_j = thresholds.idCardFront) !== null && _j !== void 0 ? _j : 0);
3208
- var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_k = thresholds.idCardBack) !== null && _k !== void 0 ? _k : 0);
3209
- var passportDetectionThresholdMet = passportDetectionScore >= ((_l = thresholds.passport) !== null && _l !== void 0 ? _l : 0);
3210
- var singlePageDetectionThresholdMet = singlePageDetectionScore >= ((_m = thresholds.singlePage) !== null && _m !== void 0 ? _m : 0);
3211
- var bestDocument = singlePageDetectionThresholdMet ? bestSinglePage : passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
3212
- var detectionThreshold = singlePageDetectionThresholdMet ? thresholds.singlePage : passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
3213
- var detectionScore = (_o = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _o !== void 0 ? _o : 0;
3196
+ var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_h = thresholds.idCardFront) !== null && _h !== void 0 ? _h : 0);
3197
+ var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_j = thresholds.idCardBack) !== null && _j !== void 0 ? _j : 0);
3198
+ var passportDetectionThresholdMet = passportDetectionScore >= ((_k = thresholds.passport) !== null && _k !== void 0 ? _k : 0);
3199
+ var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
3200
+ var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
3201
+ var detectionScore = (_l = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _l !== void 0 ? _l : 0;
3214
3202
  var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
3215
3203
  var detectedDocumentType = 'none';
3216
- if (singlePageDetectionThresholdMet) {
3217
- detectedDocumentType = 'singlePage';
3218
- } else if (passportDetectionThresholdMet) {
3204
+ if (passportDetectionThresholdMet) {
3219
3205
  detectedDocumentType = 'passport';
3220
3206
  } else if (idCardBackDetectionThresholdMet) {
3221
3207
  detectedDocumentType = 'idCardBack';
@@ -3229,12 +3215,12 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3229
3215
  var documentIsStable = false;
3230
3216
  var documentTooClose = false;
3231
3217
  if (bestDocument) {
3232
- var _q = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
3233
- docWidth = _q[0],
3234
- docHeight = _q[1];
3218
+ var _o = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
3219
+ docWidth = _o[0],
3220
+ docHeight = _o[1];
3235
3221
  documentTooClose = docWidth > 0.85 || docHeight > 0.85;
3236
3222
  if (detectionThresholdMet && documentInBounds && !documentTooClose) {
3237
- var thresholdSet = (_p = thresholds.stability) !== null && _p !== void 0 ? _p : defaultDocumentDetectionThresholds.stability;
3223
+ var thresholdSet = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
3238
3224
  var threshold_1 = thresholdSet[detectedDocumentType];
3239
3225
  var framesNeeded = Math.ceil(average(framesNeededSamples));
3240
3226
  trackBox(bestDocument.box, framesNeeded);
@@ -3256,8 +3242,6 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3256
3242
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
3257
3243
  passportDetectionScore: passportDetectionScore,
3258
3244
  passportDetectionThresholdMet: passportDetectionThresholdMet,
3259
- singlePageDetectionScore: singlePageDetectionScore,
3260
- singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
3261
3245
  bestDocument: bestDocument,
3262
3246
  documentInBounds: documentInBounds,
3263
3247
  documentTooClose: documentTooClose,
@@ -4150,39 +4134,37 @@ var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
4150
4134
  });
4151
4135
  function IdCaptureModelsProviderInner(_a) {
4152
4136
  var children = _a.children,
4153
- onModelError = _a.onModelError,
4154
- _b = _a.allowSinglePageIdCapture,
4155
- allowSinglePageIdCapture = _b === void 0 ? false : _b;
4156
- var _c = React.useContext(DocumentDetectionModelContext),
4157
- documentDetectionModelReady = _c.documentDetectionModelReady,
4158
- documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
4159
- startDocumentDetection = _c.startDocumentDetection,
4160
- stopDocumentDetection = _c.stopDocumentDetection,
4161
- lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
4162
- clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
4163
- onDocumentDetected = _c.onDocumentDetected,
4164
- detectionTime = _c.detectionTime,
4165
- documentDetectionThresholds = _c.documentDetectionThresholds,
4166
- setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
4167
- documentDetectionBoundaries = _c.documentDetectionBoundaries,
4168
- setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
4169
- documentDetectionModelError = _c.documentDetectionModelError;
4170
- var _d = React.useContext(FocusModelContext),
4171
- focusModelReady = _d.focusModelReady,
4172
- focusModelDownloadProgress = _d.focusModelDownloadProgress,
4173
- makeFocusPrediction = _d.makeFocusPrediction,
4174
- focusThresholds = _d.focusThresholds,
4175
- setFocusThresholds = _d.setFocusThresholds,
4176
- focusPredictionTime = _d.focusPredictionTime,
4177
- focusModelError = _d.focusModelError;
4137
+ onModelError = _a.onModelError;
4138
+ var _b = React.useContext(DocumentDetectionModelContext),
4139
+ documentDetectionModelReady = _b.documentDetectionModelReady,
4140
+ documentDetectionModelDownloadProgress = _b.documentDetectionModelDownloadProgress,
4141
+ startDocumentDetection = _b.startDocumentDetection,
4142
+ stopDocumentDetection = _b.stopDocumentDetection,
4143
+ lastPredictionCanvas = _b.documentDetectionLastPredictionCanvas,
4144
+ clearDocumentDetectionLastPredictionCanvas = _b.clearDocumentDetectionLastPredictionCanvas,
4145
+ onDocumentDetected = _b.onDocumentDetected,
4146
+ detectionTime = _b.detectionTime,
4147
+ documentDetectionThresholds = _b.documentDetectionThresholds,
4148
+ setDocumentDetectionThresholds = _b.setDocumentDetectionThresholds,
4149
+ documentDetectionBoundaries = _b.documentDetectionBoundaries,
4150
+ setDocumentDetectionBoundaries = _b.setDocumentDetectionBoundaries,
4151
+ documentDetectionModelError = _b.documentDetectionModelError;
4152
+ var _c = React.useContext(FocusModelContext),
4153
+ focusModelReady = _c.focusModelReady,
4154
+ focusModelDownloadProgress = _c.focusModelDownloadProgress,
4155
+ makeFocusPrediction = _c.makeFocusPrediction,
4156
+ focusThresholds = _c.focusThresholds,
4157
+ setFocusThresholds = _c.setFocusThresholds,
4158
+ focusPredictionTime = _c.focusPredictionTime,
4159
+ focusModelError = _c.focusModelError;
4178
4160
  var onPredictionHandler = React.useRef();
4179
4161
  var bestFrameDetails = React.useRef(null);
4180
4162
  var bestPredictionCanvas = React.useRef(null);
4181
4163
  var bestFocusScore = React.useRef(0);
4182
4164
  var stopDetection = React.useRef(0);
4183
- var _e = React.useState('none'),
4184
- requiredDocumentType = _e[0],
4185
- setRequiredDocumentType = _e[1];
4165
+ var _d = React.useState('none'),
4166
+ requiredDocumentType = _d[0],
4167
+ setRequiredDocumentType = _d[1];
4186
4168
  var thresholds = React.useMemo(function () {
4187
4169
  return _assign(_assign({}, documentDetectionThresholds), {
4188
4170
  focus: focusThresholds
@@ -4200,42 +4182,34 @@ function IdCaptureModelsProviderInner(_a) {
4200
4182
  var _this = this;
4201
4183
  onDocumentDetected(function (prediction) {
4202
4184
  return __awaiter(_this, void 0, void 0, function () {
4203
- var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4204
- var _a, _b, _c, _d, _e, _f, _g;
4205
- return __generator(this, function (_h) {
4185
+ var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4186
+ var _a, _b, _c, _d, _e, _f;
4187
+ return __generator(this, function (_g) {
4206
4188
  if (!lastPredictionCanvas.current) return [2 /*return*/];
4207
4189
  stopDetectionAtStart = stopDetection.current;
4208
4190
  focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
4209
- isSinglePage = prediction.detectedDocumentType === 'singlePage';
4210
- if (!allowSinglePageIdCapture && isSinglePage) {
4211
- prediction.detectedDocumentType = 'passport';
4212
- prediction.passportDetectionScore = prediction.singlePageDetectionScore;
4213
- prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
4214
- prediction.singlePageDetectionScore = 0;
4215
- prediction.singlePageDetectionThresholdMet = false;
4216
- }
4217
- isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType)) || allowSinglePageIdCapture && isSinglePage && ((_b = requiredDocumentType.includes) === null || _b === void 0 ? void 0 : _b.call(requiredDocumentType, 'idCardFront'));
4191
+ isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType));
4218
4192
  if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
4219
- focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
4193
+ focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_b = prediction.bestDocument) === null || _b === void 0 ? void 0 : _b.box);
4220
4194
  if (focusPrediction) {
4221
4195
  focusScore = focusPrediction.score;
4222
4196
  focusPredictionTime = focusPrediction.predictionTime;
4223
4197
  }
4224
- focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
4225
- focusThreshold = (_e = onMobile ? focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.mobile : focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.desktop) !== null && _e !== void 0 ? _e : 0;
4198
+ focusThresholdSet = (_c = thresholds.focus) === null || _c === void 0 ? void 0 : _c[prediction.detectedDocumentType];
4199
+ focusThreshold = (_d = onMobile ? focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.mobile : focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.desktop) !== null && _d !== void 0 ? _d : 0;
4226
4200
  focusThresholdMet = focusScore >= focusThreshold;
4227
4201
  if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
4228
4202
  bestFocusScore.current = focusScore;
4229
4203
  drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
4230
4204
  bestFrameDetails.current = {
4231
- boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
4205
+ boundingBox: (_e = prediction.bestDocument) === null || _e === void 0 ? void 0 : _e.box,
4232
4206
  documentType: prediction.detectedDocumentType,
4233
4207
  detectionScore: prediction.detectionScore,
4234
4208
  focusScore: focusScore
4235
4209
  };
4236
4210
  }
4237
4211
  }
4238
- (_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
4212
+ (_f = onPredictionHandler.current) === null || _f === void 0 ? void 0 : _f.call(onPredictionHandler, _assign(_assign({}, prediction), {
4239
4213
  focusScore: focusScore,
4240
4214
  focusPredictionTime: focusPredictionTime,
4241
4215
  focusThresholdMet: focusThresholdMet
@@ -4244,7 +4218,7 @@ function IdCaptureModelsProviderInner(_a) {
4244
4218
  });
4245
4219
  });
4246
4220
  });
4247
- }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4221
+ }, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4248
4222
  var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
4249
4223
  React.useEffect(function handleModelErrors() {
4250
4224
  if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
@@ -4258,9 +4232,9 @@ function IdCaptureModelsProviderInner(_a) {
4258
4232
  canvas: bestPredictionCanvas.current
4259
4233
  });
4260
4234
  }, []);
4261
- var _f = React.useState(0),
4262
- canvasKey = _f[0],
4263
- setCanvasKey = _f[1];
4235
+ var _e = React.useState(0),
4236
+ canvasKey = _e[0],
4237
+ setCanvasKey = _e[1];
4264
4238
  var resetBestFrame = React.useCallback(function () {
4265
4239
  stopDetection.current += 1;
4266
4240
  setCanvasKey(function (n) {
@@ -4307,9 +4281,9 @@ function IdCaptureModelsProvider(_a) {
4307
4281
  return /*#__PURE__*/React__namespace.default.createElement(DocumentDetectionModelProvider, _assign({}, props), /*#__PURE__*/React__namespace.default.createElement(FocusModelProvider, _assign({}, props), /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProviderInner, _assign({}, props), children)));
4308
4282
  }
4309
4283
 
4310
- var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
4284
+ var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'selfie'];
4311
4285
 
4312
- var acceptedDocumentTypesForIdCaptureRequirementOption = {
4286
+ var requiredDocumentsForOption = {
4313
4287
  idCardFront: ['idCardFront'],
4314
4288
  idCardBack: ['idCardBack'],
4315
4289
  passport: ['passport'],
@@ -4317,31 +4291,13 @@ var acceptedDocumentTypesForIdCaptureRequirementOption = {
4317
4291
  idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
4318
4292
  idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
4319
4293
  };
4320
- function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4294
+ function requiredImageCountForOption(idCaptureRequirement) {
4321
4295
  if (idCaptureRequirement === 'idCardOrPassport') return 1;
4322
- return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
4296
+ return requiredDocumentsForOption[idCaptureRequirement].length;
4323
4297
  }
4324
- function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4298
+ function allowedImageCountForOption(idCaptureRequirement) {
4325
4299
  if (idCaptureRequirement === 'idCardOrPassport') return 2;
4326
- return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
4327
- }
4328
- function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
4329
- var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
4330
- if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
4331
- var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
4332
- if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
4333
- acceptedTypes = acceptedTypes.filter(function (v) {
4334
- return !v.includes('idCard');
4335
- });
4336
- }
4337
- if (isIdCardOrPassport) {
4338
- acceptedTypes = acceptedTypes.filter(function (v) {
4339
- return v !== 'passport';
4340
- });
4341
- }
4342
- return acceptedTypes.filter(function (v) {
4343
- return !(v in capturedDocuments);
4344
- });
4300
+ return requiredImageCountForOption(idCaptureRequirement);
4345
4301
  }
4346
4302
 
4347
4303
  var initialState$4 = {
@@ -4380,8 +4336,6 @@ var initialState$4 = {
4380
4336
  idCardBackDetectionThresholdMet: false,
4381
4337
  passportDetectionScore: 0,
4382
4338
  passportDetectionThresholdMet: false,
4383
- singlePageDetectionScore: 0,
4384
- singlePageDetectionThresholdMet: false,
4385
4339
  focusScore: 0,
4386
4340
  focusThresholdMet: false,
4387
4341
  isGoodFrame: false,
@@ -4397,7 +4351,6 @@ var initialState$4 = {
4397
4351
  capturedDocuments: {},
4398
4352
  captureRequirement: 'idCardOrPassport',
4399
4353
  requestedDocumentType: 'idCardFront',
4400
- allowSinglePageIdCapture: false,
4401
4354
  allowIdCardBackToFrontCapture: false,
4402
4355
  operationStartedAt: null,
4403
4356
  captureStartedAt: null
@@ -4412,13 +4365,11 @@ var _reducer = function reducer(state, action) {
4412
4365
  var _c = action.payload,
4413
4366
  captureRequirement = _c.captureRequirement,
4414
4367
  precapturedDocuments = _c.precapturedDocuments,
4415
- allowSinglePageIdCapture = _c.allowSinglePageIdCapture,
4416
4368
  allowIdCardBackToFrontCapture = _c.allowIdCardBackToFrontCapture,
4417
4369
  enableOverrideWrongDocumentTypeDialog = _c.enableOverrideWrongDocumentTypeDialog,
4418
4370
  allowOverrideWrongDocumentTypeAfterMs = _c.allowOverrideWrongDocumentTypeAfterMs;
4419
4371
  var newState = _assign(_assign({}, state), {
4420
4372
  captureRequirement: captureRequirement,
4421
- allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
4422
4373
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
4423
4374
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
4424
4375
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
@@ -4486,8 +4437,6 @@ var _reducer = function reducer(state, action) {
4486
4437
  idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
4487
4438
  passportDetectionScore = _d.passportDetectionScore,
4488
4439
  passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
4489
- singlePageDetectionScore = _d.singlePageDetectionScore,
4490
- singlePageDetectionThresholdMet = _d.singlePageDetectionThresholdMet,
4491
4440
  bestDocument = _d.bestDocument,
4492
4441
  documentInBounds = _d.documentInBounds,
4493
4442
  documentTooClose = _d.documentTooClose,
@@ -4508,8 +4457,7 @@ var _reducer = function reducer(state, action) {
4508
4457
  }
4509
4458
  }
4510
4459
  }
4511
- var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
4512
- var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
4460
+ var idCardDetectedButNotAllowed = detectedDocumentType.includes('idCard') && !state.captureRequirement.includes('idCard');
4513
4461
  var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
4514
4462
  var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
4515
4463
  var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
@@ -4569,8 +4517,6 @@ var _reducer = function reducer(state, action) {
4569
4517
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
4570
4518
  passportDetectionScore: passportDetectionScore,
4571
4519
  passportDetectionThresholdMet: passportDetectionThresholdMet,
4572
- singlePageDetectionScore: singlePageDetectionScore,
4573
- singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
4574
4520
  focusScore: focusScore,
4575
4521
  focusThresholdMet: focusThresholdMet,
4576
4522
  isGoodFrame: isGoodFrame,
@@ -4608,7 +4554,7 @@ var _reducer = function reducer(state, action) {
4608
4554
  });
4609
4555
  case 'documentCaptured':
4610
4556
  {
4611
- var newState = _assign(_assign({}, state), {
4557
+ var newState_1 = _assign(_assign({}, state), {
4612
4558
  capturing: false,
4613
4559
  captureFailed: false,
4614
4560
  allowOverrideFlipRequirement: false,
@@ -4617,42 +4563,64 @@ var _reducer = function reducer(state, action) {
4617
4563
  wrongDocumentTypePredictions: 0,
4618
4564
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
4619
4565
  });
4620
- var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4566
+ var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
4567
+ return !(v in newState_1.capturedDocuments);
4568
+ });
4569
+ if (state.captureRequirement === 'idCardOrPassport') {
4570
+ if (state.requestedDocumentType === 'passport') {
4571
+ remainingRequirements = [];
4572
+ } else {
4573
+ remainingRequirements = remainingRequirements.filter(function (v) {
4574
+ return v !== 'passport';
4575
+ });
4576
+ }
4577
+ }
4621
4578
  if (remainingRequirements.length === 0) {
4622
- newState.captureState = 'complete';
4579
+ newState_1.captureState = 'complete';
4623
4580
  } else {
4624
- newState.requestedDocumentType = remainingRequirements[0];
4625
- if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
4626
- newState.captureState = 'requestingFlip';
4627
- newState.idCardFrontDetectionThresholdMet = false;
4628
- newState.idCardBackDetectionThresholdMet = false;
4629
- newState.passportDetectionThresholdMet = false;
4630
- newState.wrongDocumentTypePredictions = 0;
4581
+ newState_1.requestedDocumentType = remainingRequirements[0];
4582
+ if (state.requestedDocumentType === 'idCardFront' && newState_1.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_1.requestedDocumentType === 'idCardFront') {
4583
+ newState_1.captureState = 'requestingFlip';
4584
+ newState_1.idCardFrontDetectionThresholdMet = false;
4585
+ newState_1.idCardBackDetectionThresholdMet = false;
4586
+ newState_1.passportDetectionThresholdMet = false;
4587
+ newState_1.wrongDocumentTypePredictions = 0;
4631
4588
  }
4632
4589
  }
4633
- return newState;
4590
+ return newState_1;
4634
4591
  }
4635
4592
  case 'documentCapturedManually':
4636
4593
  {
4637
- var newState = _assign(_assign({}, state), {
4594
+ var newState_2 = _assign(_assign({}, state), {
4638
4595
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_b = {}, _b[state.requestedDocumentType] = _assign(_assign({}, action.payload), {
4639
4596
  width: 0,
4640
4597
  height: 0
4641
4598
  }), _b))
4642
4599
  });
4643
- var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4600
+ var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
4601
+ return !(v in newState_2.capturedDocuments);
4602
+ });
4603
+ if (state.captureRequirement === 'idCardOrPassport') {
4604
+ if (state.requestedDocumentType === 'passport') {
4605
+ remainingRequirements = [];
4606
+ } else {
4607
+ remainingRequirements = remainingRequirements.filter(function (v) {
4608
+ return v !== 'passport';
4609
+ });
4610
+ }
4611
+ }
4644
4612
  if (remainingRequirements.length === 0) {
4645
- newState.captureState = 'complete';
4613
+ newState_2.captureState = 'complete';
4646
4614
  } else {
4647
- newState.requestedDocumentType = remainingRequirements[0];
4648
- if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
4649
- newState.captureState = 'requestingFlip';
4650
- newState.idCardFrontDetectionThresholdMet = false;
4651
- newState.idCardBackDetectionThresholdMet = false;
4652
- newState.passportDetectionThresholdMet = false;
4615
+ newState_2.requestedDocumentType = remainingRequirements[0];
4616
+ if (state.requestedDocumentType === 'idCardFront' && newState_2.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_2.requestedDocumentType === 'idCardFront') {
4617
+ newState_2.captureState = 'requestingFlip';
4618
+ newState_2.idCardFrontDetectionThresholdMet = false;
4619
+ newState_2.idCardBackDetectionThresholdMet = false;
4620
+ newState_2.passportDetectionThresholdMet = false;
4653
4621
  }
4654
4622
  }
4655
- return newState;
4623
+ return newState_2;
4656
4624
  }
4657
4625
  case 'flipRequestCompleted':
4658
4626
  return _assign(_assign({}, state), {
@@ -5253,7 +5221,7 @@ var IdCapture = function IdCapture(_a) {
5253
5221
  imageUrl: imageUrl
5254
5222
  }
5255
5223
  });
5256
- var capturedDocumentType = documentType;
5224
+ var capturedDocumentType = documentType === 'passport' ? 'passport' : state.requestedDocumentType;
5257
5225
  setTimeout(function () {
5258
5226
  var _a;
5259
5227
  var captureTime = new Date().getTime() - ((_a = state.captureStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
@@ -5320,7 +5288,7 @@ var IdCapture = function IdCapture(_a) {
5320
5288
  scaling: debugScalingDetails,
5321
5289
  flipX: !isRearFacing
5322
5290
  });
5323
- }))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.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__namespace.default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__namespace.default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u274C Models not ready")))));
5291
+ }))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.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__namespace.default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__namespace.default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u274C Models not ready")))));
5324
5292
  };
5325
5293
  var timeSince = function timeSince(t) {
5326
5294
  if (!t) return 0;
@@ -6359,8 +6327,15 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6359
6327
  _e = _a.debugMode,
6360
6328
  debugMode = _e === void 0 ? false : _e;
6361
6329
  var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
6330
+ var idCardFront = capturedDocuments.idCardFront,
6331
+ idCardBack = capturedDocuments.idCardBack,
6332
+ passport = capturedDocuments.passport;
6362
6333
  var verbiage = useTranslations(rawVerbiage, {
6363
6334
  headingText: 'ID Capture Successful',
6335
+ idCardFrontText: 'ID Card Front',
6336
+ idCardBackText: 'ID Card Back',
6337
+ passportText: 'Passport',
6338
+ instructionText: 'Verify the entire ID was captured clearly with no glare.',
6364
6339
  retryText: 'Retry',
6365
6340
  submittingText: 'Submitting...',
6366
6341
  submitText: 'Done'
@@ -6377,16 +6352,25 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6377
6352
  className: classNames.imageContainer
6378
6353
  }, /*#__PURE__*/React__namespace.default.createElement(ImageRow, {
6379
6354
  className: classNames.imageRow
6380
- }, Object.values(capturedDocuments).map(function (doc) {
6381
- return /*#__PURE__*/React__namespace.default.createElement(ImageCol$1, {
6382
- className: classNames.imageCol,
6383
- key: doc.imageData
6384
- }, /*#__PURE__*/React__namespace.default.createElement(StyledImage, {
6385
- image: doc,
6386
- className: classNames.image,
6387
- alt: doc.documentType
6388
- }), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugPre, null, "Document Type: ".concat(doc.documentType, "\nDetection Score: ").concat(doc.detectionScore, "\nFocus Score: ").concat(doc.focusScore, "\nBounding Box: ").concat(JSON.stringify(doc.boundingBox)))));
6389
- }))), /*#__PURE__*/React__namespace.default.createElement(ButtonsColumn, {
6355
+ }, idCardFront && ( /*#__PURE__*/React__namespace.default.createElement(ImageCol$1, {
6356
+ className: classNames.imageCol
6357
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledImage, {
6358
+ image: idCardFront,
6359
+ className: classNames.image,
6360
+ alt: verbiage.idCardFrontText
6361
+ }), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugPre, null, "Detection Score: ".concat(idCardFront.detectionScore, "\nFocus Score: ").concat(idCardFront.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardFront.boundingBox)))))), idCardBack && ( /*#__PURE__*/React__namespace.default.createElement(ImageCol$1, {
6362
+ className: classNames.imageCol
6363
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledImage, {
6364
+ image: idCardBack,
6365
+ className: classNames.image,
6366
+ alt: verbiage.idCardBackText
6367
+ }), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugPre, null, "Detection Score: ".concat(idCardBack.detectionScore, "\nFocus Score: ").concat(idCardBack.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardBack.boundingBox)))))), passport && ( /*#__PURE__*/React__namespace.default.createElement(ImageCol$1, {
6368
+ className: classNames.imageCol
6369
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledImage, {
6370
+ image: passport,
6371
+ className: classNames.image,
6372
+ alt: verbiage.passportText
6373
+ }), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugPre, null, "Detection Score: ".concat(passport.detectionScore, "\nFocus Score: ").concat(passport.focusScore, "\nBounding Box: ").concat(JSON.stringify(passport.boundingBox)))))))), /*#__PURE__*/React__namespace.default.createElement(ButtonsColumn, {
6390
6374
  className: classNames.buttonsRow
6391
6375
  }, /*#__PURE__*/React__namespace.default.createElement(WideButton, {
6392
6376
  className: classNames.submitBtn,
@@ -6405,7 +6389,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6405
6389
  };
6406
6390
  var Heading$a = styled__default.default.h1(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n font-size: 1.5rem;\n margin-top: 0;\n margin-bottom: 1.5rem;\n"], ["\n font-size: 1.5rem;\n margin-top: 0;\n margin-bottom: 1.5rem;\n"])));
6407
6391
  var ImagesContainer = styled__default.default(OverlayImageContainer)(templateObject_2$q || (templateObject_2$q = __makeTemplateObject(["\n flex-grow: 1;\n overflow-y: auto;\n padding-bottom: 0;\n max-width: 100%;\n"], ["\n flex-grow: 1;\n overflow-y: auto;\n padding-bottom: 0;\n max-width: 100%;\n"])));
6408
- var ImageRow = styled__default.default(OverlayImageRow)(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n"], ["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n"])));
6392
+ var ImageRow = styled__default.default(OverlayImageRow)(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n //grid-template-columns: 1fr 1fr;\n"], ["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n //grid-template-columns: 1fr 1fr;\n"])));
6409
6393
  var ImageCol$1 = styled__default.default.div(templateObject_4$e || (templateObject_4$e = __makeTemplateObject(["\n width: 100%;\n max-height: none !important;\n"], ["\n width: 100%;\n max-height: none !important;\n"])));
6410
6394
  var StyledImage = styled__default.default(CapturedDocumentImg)(templateObject_5$9 || (templateObject_5$9 = __makeTemplateObject(["\n width: 100%;\n border-radius: 12px;\n"], ["\n width: 100%;\n border-radius: 12px;\n"])));
6411
6395
  var DebugPre = styled__default.default.pre(templateObject_6$7 || (templateObject_6$7 = __makeTemplateObject(["\n text-align: left;\n max-width: min(450px, 100dvw - 100px);\n overflow-x: auto;\n"], ["\n text-align: left;\n max-width: min(450px, 100dvw - 100px);\n overflow-x: auto;\n"])));
@@ -8115,8 +8099,8 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8115
8099
  var _j = React.useState(silentFallback),
8116
8100
  useFallback = _j[0],
8117
8101
  setUseFallback = _j[1];
8118
- var minImageCount = minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
8119
- var maxImageCount = maxImageCountForIdCaptureRequirementOption(idCaptureRequirement);
8102
+ var allowedImageCount = allowedImageCountForOption(idCaptureRequirement);
8103
+ var requiredImageCount = requiredImageCountForOption(idCaptureRequirement);
8120
8104
  var _k = useFileState(),
8121
8105
  rawFile = _k.rawFile,
8122
8106
  fileInputOnChange = _k.fileInputOnChange;
@@ -8129,7 +8113,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8129
8113
  var whatToCapture = idCaptureRequirement === 'idCard' ? 'ID card' : idCaptureRequirement === 'passport' ? 'passport' : idCaptureRequirement === 'idCardOrPassport' ? 'ID card or passport' : 'ID card and passport';
8130
8114
  var firstInstructionText = idCaptureRequirement === 'idCard' || idCaptureRequirement === 'idCardAndPassport' ? 'Please capture the front of your ID card.' : idCaptureRequirement === 'passport' ? 'Please capture the ID page of your passport.' : 'Please capture the front of your ID card, or the ID page of your passport.';
8131
8115
  var secondInstructionText = idCaptureRequirement === 'idCardOrPassport' ? 'Please capture the back of your ID card, or click Done if submitting a passport.' : 'Please capture the back of your ID card.';
8132
- var descriptionText = "On-device capture guidance failed, please capture ".concat(minImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
8116
+ var descriptionText = "On-device capture guidance failed, please capture ".concat(requiredImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
8133
8117
  var verbiage = useTranslations(rawVerbiage, {
8134
8118
  headingText: "We're having some trouble.",
8135
8119
  descriptionText: descriptionText,
@@ -8203,7 +8187,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8203
8187
  alt: "",
8204
8188
  className: classNames.image
8205
8189
  }));
8206
- }))), images.length < minImageCount && ( /*#__PURE__*/React__namespace.default.createElement(Instruction, {
8190
+ }))), images.length < requiredImageCount && ( /*#__PURE__*/React__namespace.default.createElement(Instruction, {
8207
8191
  className: classNames.instruction
8208
8192
  }, instructionText)), /*#__PURE__*/React__namespace.default.createElement("input", {
8209
8193
  ref: fileInput,
@@ -8214,7 +8198,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8214
8198
  hidden: true
8215
8199
  }), /*#__PURE__*/React__namespace.default.createElement(StyledButtonsRow$8, {
8216
8200
  className: classNames.buttonsRow
8217
- }, images.length < maxImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8201
+ }, images.length < allowedImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8218
8202
  variant: images.length > 0 ? 'secondary' : 'positive',
8219
8203
  className: images.length > 0 ? classNames.captureMoreBtn : classNames.captureBtn,
8220
8204
  colors: images.length > 0 ? colors.captureMoreBtn : colors.captureBtn,
@@ -8227,7 +8211,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8227
8211
  setDocumentToCapture(instructionText);
8228
8212
  }
8229
8213
  }
8230
- }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= minImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8214
+ }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= requiredImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8231
8215
  variant: "positive",
8232
8216
  className: classNames.doneBtn,
8233
8217
  colors: colors.doneBtn,
@@ -8274,82 +8258,79 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8274
8258
  precapturedDocuments = _a.precapturedDocuments,
8275
8259
  _j = _a.captureRequirement,
8276
8260
  captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
8277
- _k = _a.allowSinglePageIdCapture,
8278
- allowSinglePageIdCapture = _k === void 0 ? false : _k,
8279
- _l = _a.separateIdCardCaptureSequence,
8280
- separateIdCardCaptureSequence = _l === void 0 ? false : _l,
8281
- _m = _a.thresholds,
8282
- thresholds = _m === void 0 ? defaultIdCaptureThresholds : _m,
8283
- _o = _a.skipSuccessScreen,
8284
- skipSuccessScreen = _o === void 0 ? false : _o,
8261
+ _k = _a.separateIdCardCaptureSequence,
8262
+ separateIdCardCaptureSequence = _k === void 0 ? false : _k,
8263
+ _l = _a.thresholds,
8264
+ thresholds = _l === void 0 ? defaultIdCaptureThresholds : _l,
8265
+ _m = _a.skipSuccessScreen,
8266
+ skipSuccessScreen = _m === void 0 ? false : _m,
8285
8267
  instructions = _a.instructions,
8286
- _p = _a.releaseCameraAccessOnExit,
8287
- releaseCameraAccessOnExit = _p === void 0 ? true : _p,
8288
- _q = _a.guideType,
8289
- guideType = _q === void 0 ? 'fit' : _q,
8290
- _r = _a.portraitGuidesOnMobile,
8291
- portraitGuidesOnMobile = _r === void 0 ? true : _r,
8292
- _s = _a.rotateLoadingOverlayImageWhenPortrait,
8293
- rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
8294
- _t = _a.silentFallback,
8295
- silentFallback = _t === void 0 ? false : _t,
8296
- _u = _a.forceFallbackMode,
8297
- forceFallbackMode = _u === void 0 ? false : _u,
8298
- _v = _a.allowIdCardBackToFrontCapture,
8299
- allowIdCardBackToFrontCapture = _v === void 0 ? false : _v,
8300
- _w = _a.enableOverrideWrongDocumentTypeDialog,
8301
- enableOverrideWrongDocumentTypeDialog = _w === void 0 ? false : _w,
8302
- _x = _a.allowOverrideWrongDocumentTypeAfterMs,
8303
- allowOverrideWrongDocumentTypeAfterMs = _x === void 0 ? 8000 : _x,
8304
- _y = _a.guideImages,
8305
- guideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
8306
- _z = _a.assets,
8307
- assets = _z === void 0 ? {} : _z,
8308
- _0 = _a.classNames,
8309
- classNames = _0 === void 0 ? {} : _0,
8310
- _1 = _a.colors,
8311
- colors = _1 === void 0 ? {} : _1,
8312
- _2 = _a.verbiage,
8313
- verbiage = _2 === void 0 ? {} : _2,
8314
- _3 = _a.debugMode,
8315
- debugMode = _3 === void 0 ? false : _3;
8316
- var _4 = useIdCaptureState(),
8317
- state = _4[0],
8318
- dispatch = _4[1];
8319
- var _5 = useCameraStore(),
8320
- cameraAccessDenied = _5.cameraAccessDenied,
8321
- requestCameraAccess = _5.requestCameraAccess,
8322
- releaseCameraAccess = _5.releaseCameraAccess;
8323
- var _6 = React.useState(false),
8324
- overlayDismissed = _6[0],
8325
- setOverlayDismissed = _6[1];
8326
- var _7 = React.useContext(SubmissionContext),
8327
- submissionStatus = _7.submissionStatus,
8328
- setIdFrontImage = _7.setIdFrontImage,
8329
- setIdBackImage = _7.setIdBackImage,
8330
- setPassportImage = _7.setPassportImage,
8331
- logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
8332
- logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
8333
- var _8 = React.useContext(IdCaptureModelsContext),
8334
- start = _8.start,
8335
- stop = _8.stop,
8336
- onPredictionMade = _8.onPredictionMade,
8337
- setRequiredDocumentType = _8.setRequiredDocumentType,
8338
- modelError = _8.modelError,
8339
- resetBestFrame = _8.resetBestFrame;
8268
+ _o = _a.releaseCameraAccessOnExit,
8269
+ releaseCameraAccessOnExit = _o === void 0 ? true : _o,
8270
+ _p = _a.guideType,
8271
+ guideType = _p === void 0 ? 'fit' : _p,
8272
+ _q = _a.portraitGuidesOnMobile,
8273
+ portraitGuidesOnMobile = _q === void 0 ? true : _q,
8274
+ _r = _a.rotateLoadingOverlayImageWhenPortrait,
8275
+ rotateLoadingOverlayImageWhenPortrait = _r === void 0 ? true : _r,
8276
+ _s = _a.silentFallback,
8277
+ silentFallback = _s === void 0 ? false : _s,
8278
+ _t = _a.forceFallbackMode,
8279
+ forceFallbackMode = _t === void 0 ? false : _t,
8280
+ _u = _a.allowIdCardBackToFrontCapture,
8281
+ allowIdCardBackToFrontCapture = _u === void 0 ? false : _u,
8282
+ _v = _a.enableOverrideWrongDocumentTypeDialog,
8283
+ enableOverrideWrongDocumentTypeDialog = _v === void 0 ? false : _v,
8284
+ _w = _a.allowOverrideWrongDocumentTypeAfterMs,
8285
+ allowOverrideWrongDocumentTypeAfterMs = _w === void 0 ? 8000 : _w,
8286
+ _x = _a.guideImages,
8287
+ guideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
8288
+ _y = _a.assets,
8289
+ assets = _y === void 0 ? {} : _y,
8290
+ _z = _a.classNames,
8291
+ classNames = _z === void 0 ? {} : _z,
8292
+ _0 = _a.colors,
8293
+ colors = _0 === void 0 ? {} : _0,
8294
+ _1 = _a.verbiage,
8295
+ verbiage = _1 === void 0 ? {} : _1,
8296
+ _2 = _a.debugMode,
8297
+ debugMode = _2 === void 0 ? false : _2;
8298
+ var _3 = useIdCaptureState(),
8299
+ state = _3[0],
8300
+ dispatch = _3[1];
8301
+ var _4 = useCameraStore(),
8302
+ cameraAccessDenied = _4.cameraAccessDenied,
8303
+ requestCameraAccess = _4.requestCameraAccess,
8304
+ releaseCameraAccess = _4.releaseCameraAccess;
8305
+ var _5 = React.useState(false),
8306
+ overlayDismissed = _5[0],
8307
+ setOverlayDismissed = _5[1];
8308
+ var _6 = React.useContext(SubmissionContext),
8309
+ submissionStatus = _6.submissionStatus,
8310
+ setIdFrontImage = _6.setIdFrontImage,
8311
+ setIdBackImage = _6.setIdBackImage,
8312
+ setPassportImage = _6.setPassportImage,
8313
+ logIdFrontCaptureAttempt = _6.logIdFrontCaptureAttempt,
8314
+ logIdBackCaptureAttempt = _6.logIdBackCaptureAttempt;
8315
+ var _7 = React.useContext(IdCaptureModelsContext),
8316
+ start = _7.start,
8317
+ stop = _7.stop,
8318
+ onPredictionMade = _7.onPredictionMade,
8319
+ setRequiredDocumentType = _7.setRequiredDocumentType,
8320
+ modelError = _7.modelError,
8321
+ resetBestFrame = _7.resetBestFrame;
8340
8322
  React.useEffect(function () {
8341
8323
  dispatch({
8342
8324
  type: 'configureWizard',
8343
8325
  payload: {
8344
8326
  captureRequirement: captureRequirement,
8345
8327
  precapturedDocuments: precapturedDocuments,
8346
- allowSinglePageIdCapture: allowSinglePageIdCapture,
8347
8328
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
8348
8329
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
8349
8330
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
8350
8331
  }
8351
8332
  });
8352
- }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8333
+ }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8353
8334
  var documentCount = Object.keys(state.capturedDocuments).length;
8354
8335
  React.useEffect(function () {
8355
8336
  if (documentCount) resetBestFrame();
@@ -8411,16 +8392,13 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8411
8392
  var _a = state.capturedDocuments,
8412
8393
  idCardFront = _a.idCardFront,
8413
8394
  idCardBack = _a.idCardBack,
8414
- passport = _a.passport,
8415
- singlePage = _a.singlePage;
8395
+ passport = _a.passport;
8416
8396
  var idFrontImage = idCardFront && dataUrlToBase64Sync(idCardFront.imageData);
8417
8397
  var idBackImage = idCardBack && dataUrlToBase64Sync(idCardBack.imageData);
8418
8398
  var passportImage = passport && dataUrlToBase64Sync(passport.imageData);
8419
- var singlePageImage = singlePage && dataUrlToBase64Sync(singlePage.imageData);
8420
8399
  if (idFrontImage) setIdFrontImage(idFrontImage);
8421
8400
  if (idBackImage) setIdBackImage(idBackImage);
8422
8401
  if (passportImage) setPassportImage(passportImage);
8423
- if (singlePageImage) setIdFrontImage(singlePageImage);
8424
8402
  if (releaseCameraAccessOnExit) releaseCameraAccess();
8425
8403
  setTimeout(function () {
8426
8404
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
@@ -8436,9 +8414,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8436
8414
  type: 'resetWizard'
8437
8415
  });
8438
8416
  }, [dispatch]);
8439
- var _9 = React.useState(0),
8440
- attempt = _9[0],
8441
- setAttempt = _9[1];
8417
+ var _8 = React.useState(0),
8418
+ attempt = _8[0],
8419
+ setAttempt = _8[1];
8442
8420
  var onExit = React.useCallback(function () {
8443
8421
  releaseCameraAccess();
8444
8422
  setOverlayDismissed(false);
@@ -8529,9 +8507,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8529
8507
  });
8530
8508
  });
8531
8509
  }, [dispatch]);
8532
- var _10 = React.useState(false),
8533
- progressStarted = _10[0],
8534
- setProgressStarted = _10[1];
8510
+ var _9 = React.useState(false),
8511
+ progressStarted = _9[0],
8512
+ setProgressStarted = _9[1];
8535
8513
  React.useEffect(function () {
8536
8514
  if (state.captureState === 'capturing') {
8537
8515
  setProgressStarted(false);
@@ -12063,8 +12041,7 @@ var defaultVideoIdCaptureThresholds = {
12063
12041
  detection: {
12064
12042
  idCardFront: 0.4,
12065
12043
  idCardBack: 0.5,
12066
- passport: 0.3,
12067
- singlePage: 0.3
12044
+ passport: 0.3
12068
12045
  },
12069
12046
  focus: {
12070
12047
  idCardFront: {
@@ -12078,17 +12055,12 @@ var defaultVideoIdCaptureThresholds = {
12078
12055
  passport: {
12079
12056
  desktop: 0,
12080
12057
  mobile: 0
12081
- },
12082
- singlePage: {
12083
- desktop: 0,
12084
- mobile: 0
12085
12058
  }
12086
12059
  },
12087
12060
  goodFrames: {
12088
12061
  idCardFront: 1,
12089
12062
  idCardBack: 1,
12090
- passport: 1,
12091
- singlePage: 1
12063
+ passport: 1
12092
12064
  },
12093
12065
  flipShortcutThreshold: 0.7
12094
12066
  };
@@ -12160,7 +12132,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12160
12132
  stopIdModels = _18.stop,
12161
12133
  onIdPredictionMade = _18.onPredictionMade,
12162
12134
  setThresholds = _18.setThresholds,
12163
- setRequiredDocumentType = _18.setRequiredDocumentType,
12164
12135
  setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
12165
12136
  bestFrameDetails = _18.bestFrameDetails,
12166
12137
  resetBestFrame = _18.resetBestFrame,
@@ -12239,9 +12210,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12239
12210
  React.useEffect(function () {
12240
12211
  setThresholds(adjustedThresholds);
12241
12212
  }, [requestedAction, setThresholds, adjustedThresholds]);
12242
- React.useEffect(function () {
12243
- setRequiredDocumentType(requestedAction === 'SHOW_PASSPORT' ? 'passport' : requestedAction === 'SHOW_ID_BACK' ? 'idCardBack' : 'idCardFront');
12244
- }, [requestedAction, setRequiredDocumentType]);
12245
12213
  React.useEffect(function () {
12246
12214
  setDocumentDetectionBoundaries({
12247
12215
  top: 20,
@@ -12264,9 +12232,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12264
12232
  setGoodFramesCount = _28[1];
12265
12233
  var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
12266
12234
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
12267
- var _29 = React.useState(false),
12268
- isSinglePage = _29[0],
12269
- setIsSinglePage = _29[1];
12270
12235
  React.useEffect(function () {
12271
12236
  if (!idCaptureModelsEnabled || idModelError) return;
12272
12237
  onIdPredictionMade(function (prediction) {
@@ -12274,8 +12239,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12274
12239
  setCurrentDetectionScore(prediction.detectionScore);
12275
12240
  setCurrentDetectedDocumentType(prediction.detectedDocumentType);
12276
12241
  setCurrentFocusScore(prediction.focusScore);
12277
- setIsSinglePage(prediction.singlePageDetectionThresholdMet);
12278
- var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_BACK' ? prediction.idCardBackDetectionThresholdMet : prediction.idCardFrontDetectionThresholdMet || prediction.singlePageDetectionThresholdMet;
12242
+ var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
12279
12243
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
12280
12244
  var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
12281
12245
  if (shouldShortcutFlipAnimation) {
@@ -12286,9 +12250,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12286
12250
  } : 0);
12287
12251
  });
12288
12252
  }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
12289
- var _30 = React.useState(null),
12290
- idFrontCaptureStartedAt = _30[0],
12291
- setFirstGoodFrameTime = _30[1];
12253
+ var _29 = React.useState(null),
12254
+ idFrontCaptureStartedAt = _29[0],
12255
+ setFirstGoodFrameTime = _29[1];
12292
12256
  React.useEffect(function () {
12293
12257
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
12294
12258
  }, [goodFramesCount]);
@@ -12309,60 +12273,80 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12309
12273
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
12310
12274
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
12311
12275
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
12312
- var _31 = React.useState(),
12313
- countdownStartedAt = _31[0],
12314
- setCountdownStartedAt = _31[1];
12276
+ var _30 = React.useState(),
12277
+ countdownStartedAt = _30[0],
12278
+ setCountdownStartedAt = _30[1];
12315
12279
  var photoCanvas = React.useRef(null);
12316
12280
  var frameLock = React.useRef(false);
12317
12281
  var captureFrame = React.useCallback(function () {
12318
12282
  return __awaiter(void 0, void 0, void 0, function () {
12319
- var frameBase64;
12320
- return __generator(this, function (_a) {
12321
- if (frameLock.current) return [2 /*return*/];
12322
- frameLock.current = true;
12323
- drawToCanvas(photoCanvas.current, videoRef.current);
12324
- frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
12325
- if (!frameBase64) {
12326
- frameLock.current = false;
12327
- return [2 /*return*/];
12328
- }
12329
- try {
12330
- if (requestedAction == 'SHOW_ID_FRONT') {
12283
+ var frameBase64, _a;
12284
+ return __generator(this, function (_b) {
12285
+ switch (_b.label) {
12286
+ case 0:
12287
+ if (frameLock.current) return [2 /*return*/];
12288
+ frameLock.current = true;
12289
+ drawToCanvas(photoCanvas.current, videoRef.current);
12290
+ frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
12291
+ if (!frameBase64) {
12292
+ frameLock.current = false;
12293
+ return [2 /*return*/];
12294
+ }
12295
+ _b.label = 1;
12296
+ case 1:
12297
+ _b.trys.push([1,, 7, 8]);
12298
+ if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
12331
12299
  if (onIdFrontImageCaptured) {
12332
12300
  onIdFrontImageCaptured(frameBase64);
12333
12301
  }
12334
- if (isSinglePage || evaluateShouldSkip(skipShowIdCardBack)) {
12302
+ if (!skipShowIdCardBack) return [3 /*break*/, 4];
12303
+ _a = skipShowIdCardBack === true;
12304
+ if (_a) return [3 /*break*/, 3];
12305
+ return [4 /*yield*/, skipShowIdCardBack()];
12306
+ case 2:
12307
+ _a = _b.sent();
12308
+ _b.label = 3;
12309
+ case 3:
12310
+ if (_a) {
12335
12311
  return [2 /*return*/, onIdCaptureComplete()];
12336
12312
  }
12313
+ _b.label = 4;
12314
+ case 4:
12337
12315
  setRequestedAction('FLIP_ID');
12338
- } else if (requestedAction == 'SHOW_ID_BACK') {
12339
- if (onIdBackImageCaptured) {
12340
- onIdBackImageCaptured(frameBase64);
12316
+ return [3 /*break*/, 6];
12317
+ case 5:
12318
+ if (requestedAction == 'SHOW_ID_BACK') {
12319
+ if (onIdBackImageCaptured) {
12320
+ onIdBackImageCaptured(frameBase64);
12321
+ }
12322
+ onIdCaptureComplete();
12323
+ } else if (requestedAction == 'SHOW_PASSPORT') {
12324
+ if (onIdFrontImageCaptured) {
12325
+ onIdFrontImageCaptured(frameBase64);
12326
+ }
12327
+ onIdCaptureComplete();
12341
12328
  }
12342
- onIdCaptureComplete();
12343
- } else if (requestedAction == 'SHOW_PASSPORT') {
12344
- if (onIdFrontImageCaptured) {
12345
- onIdFrontImageCaptured(frameBase64);
12329
+ _b.label = 6;
12330
+ case 6:
12331
+ return [3 /*break*/, 8];
12332
+ case 7:
12333
+ setDetectedObjects([]);
12334
+ setCurrentDetectionScore(0);
12335
+ setCurrentFocusScore(0);
12336
+ setGoodFramesCount(0);
12337
+ setCountdownStartedAt(undefined);
12338
+ resetBestFrame();
12339
+ frameLock.current = false;
12340
+ if (countdownTimeoutRef.current) {
12341
+ clearTimeout(countdownTimeoutRef.current);
12346
12342
  }
12347
- onIdCaptureComplete();
12348
- }
12349
- } finally {
12350
- setDetectedObjects([]);
12351
- setCurrentDetectionScore(0);
12352
- setCurrentFocusScore(0);
12353
- setGoodFramesCount(0);
12354
- setCountdownStartedAt(undefined);
12355
- setIsSinglePage(false);
12356
- resetBestFrame();
12357
- frameLock.current = false;
12358
- if (countdownTimeoutRef.current) {
12359
- clearTimeout(countdownTimeoutRef.current);
12360
- }
12343
+ return [7 /*endfinally*/];
12344
+ case 8:
12345
+ return [2 /*return*/];
12361
12346
  }
12362
- return [2 /*return*/];
12363
12347
  });
12364
12348
  });
12365
- }, [videoRef, requestedAction, onIdFrontImageCaptured, isSinglePage, skipShowIdCardBack, onIdCaptureComplete, onIdBackImageCaptured, resetBestFrame]);
12349
+ }, [onIdCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
12366
12350
  var isFlipping = requestedAction === 'FLIP_ID';
12367
12351
  React.useEffect(function () {
12368
12352
  if (!isFlipping) return;
@@ -12421,9 +12405,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12421
12405
  stopSelfieGuidance();
12422
12406
  };
12423
12407
  }, [startSelfieGuidance, stopSelfieGuidance]);
12424
- var _32 = React.useState(0),
12425
- numFramesWithoutFaces = _32[0],
12426
- setNumFramesWithoutFaces = _32[1];
12408
+ var _31 = React.useState(0),
12409
+ numFramesWithoutFaces = _31[0],
12410
+ setNumFramesWithoutFaces = _31[1];
12427
12411
  onSelfiePredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (_a) {
12428
12412
  var face = _a.face;
12429
12413
  if (selfieModelError) return;
@@ -12439,12 +12423,12 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12439
12423
  }
12440
12424
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
12441
12425
  var theme = styled.useTheme();
12442
- var _33 = useTranslations(rawVerbiage, {
12426
+ var _32 = useTranslations(rawVerbiage, {
12443
12427
  faceNotCenteredText: 'Please move your face to the center...',
12444
12428
  captureBtnText: 'Capture'
12445
12429
  }),
12446
- captureBtnText = _33.captureBtnText,
12447
- faceNotCenteredText = _33.faceNotCenteredText;
12430
+ captureBtnText = _32.captureBtnText,
12431
+ faceNotCenteredText = _32.faceNotCenteredText;
12448
12432
  var debugScalingDetails = useDebugScalingDetails({
12449
12433
  enabled: debugMode,
12450
12434
  pageWidth: width,
@@ -12519,11 +12503,6 @@ var CountdownContainer = styled__default.default.div(templateObject_1$5 || (temp
12519
12503
  var Countdown = styled__default.default.div(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"], ["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"])));
12520
12504
  var CaptureButtonContainer = styled__default.default.div(templateObject_3$5 || (templateObject_3$5 = __makeTemplateObject(["\n position: fixed;\n bottom: 0;\n width: 100dvw;\n display: flex;\n z-index: 100000;\n"], ["\n position: fixed;\n bottom: 0;\n width: 100dvw;\n display: flex;\n z-index: 100000;\n"])));
12521
12505
  var CaptureButton = styled__default.default(LoaderButton)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin: 0 auto 25px;\n"], ["\n margin: 0 auto 25px;\n"])));
12522
- function evaluateShouldSkip(value) {
12523
- if (value === true) return true;
12524
- if (typeof value === 'function') return value();
12525
- return false;
12526
- }
12527
12506
  var templateObject_1$5, templateObject_2$5, templateObject_3$5, templateObject_4;
12528
12507
 
12529
12508
  var IdVideoCaptureSuccess = function IdVideoCaptureSuccess(_a) {
@@ -12821,8 +12800,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12821
12800
  documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
12822
12801
  focusModelUrl: (_j = (_h = idCaptureProps.assets) === null || _h === void 0 ? void 0 : _h.focusModelUrl) !== null && _j !== void 0 ? _j : '',
12823
12802
  onModelError: onIdCaptureModelError,
12824
- modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
12825
- allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
12803
+ modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs
12826
12804
  }, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
12827
12805
  autoStart: false,
12828
12806
  onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
@@ -13072,8 +13050,7 @@ function CompositeWizard(_a) {
13072
13050
  documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
13073
13051
  focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
13074
13052
  onModelError: idCaptureProps.onModelError,
13075
- modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
13076
- allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
13053
+ modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs
13077
13054
  }, /*#__PURE__*/React__namespace.default.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React__namespace.default.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React__namespace.default.createElement(IdCaptureWizard, _assign({}, idCaptureProps, {
13078
13055
  onSuccess: onIdCaptureSuccess
13079
13056
  }))))));
@@ -13395,33 +13372,31 @@ var IdValidation = function IdValidation(_a) {
13395
13372
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
13396
13373
  _d = _a.idCaptureRequirement,
13397
13374
  idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
13398
- _e = _a.allowSinglePageIdCapture,
13399
- allowSinglePageIdCapture = _e === void 0 ? false : _e,
13400
- _f = _a.separateIdCardCaptureSequence,
13401
- separateIdCardCaptureSequence = _f === void 0 ? false : _f,
13402
- _g = _a.idCaptureThresholds,
13403
- idCaptureThresholds = _g === void 0 ? defaultIdCaptureThresholds : _g,
13404
- _h = _a.skipSuccessScreen,
13405
- skipSuccessScreen = _h === void 0 ? false : _h,
13375
+ _e = _a.separateIdCardCaptureSequence,
13376
+ separateIdCardCaptureSequence = _e === void 0 ? false : _e,
13377
+ _f = _a.idCaptureThresholds,
13378
+ idCaptureThresholds = _f === void 0 ? defaultIdCaptureThresholds : _f,
13379
+ _g = _a.skipSuccessScreen,
13380
+ skipSuccessScreen = _g === void 0 ? false : _g,
13406
13381
  instructions = _a.instructions,
13407
- _j = _a.guideType,
13408
- guideType = _j === void 0 ? 'fit' : _j,
13409
- _k = _a.guideImages,
13410
- guideImages = _k === void 0 ? defaultIdCaptureGuideImages : _k,
13411
- _l = _a.portraitGuidesOnMobile,
13412
- portraitGuidesOnMobile = _l === void 0 ? true : _l,
13413
- _m = _a.rotateLoadingOverlayImageWhenPortrait,
13414
- rotateLoadingOverlayImageWhenPortrait = _m === void 0 ? true : _m,
13415
- _o = _a.modelLoadTimeoutMs,
13416
- modelLoadTimeoutMs = _o === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _o,
13417
- _p = _a.forceFallbackMode,
13418
- forceFallbackMode = _p === void 0 ? false : _p,
13419
- _q = _a.allowIdCardBackToFrontCapture,
13420
- allowIdCardBackToFrontCapture = _q === void 0 ? false : _q,
13421
- _r = _a.enableOverrideWrongDocumentTypeDialog,
13422
- enableOverrideWrongDocumentTypeDialog = _r === void 0 ? false : _r,
13423
- _s = _a.allowOverrideWrongDocumentTypeAfterMs,
13424
- allowOverrideWrongDocumentTypeAfterMs = _s === void 0 ? 8000 : _s,
13382
+ _h = _a.guideType,
13383
+ guideType = _h === void 0 ? 'fit' : _h,
13384
+ _j = _a.guideImages,
13385
+ guideImages = _j === void 0 ? defaultIdCaptureGuideImages : _j,
13386
+ _k = _a.portraitGuidesOnMobile,
13387
+ portraitGuidesOnMobile = _k === void 0 ? true : _k,
13388
+ _l = _a.rotateLoadingOverlayImageWhenPortrait,
13389
+ rotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
13390
+ _m = _a.modelLoadTimeoutMs,
13391
+ modelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
13392
+ _o = _a.forceFallbackMode,
13393
+ forceFallbackMode = _o === void 0 ? false : _o,
13394
+ _p = _a.allowIdCardBackToFrontCapture,
13395
+ allowIdCardBackToFrontCapture = _p === void 0 ? false : _p,
13396
+ _q = _a.enableOverrideWrongDocumentTypeDialog,
13397
+ enableOverrideWrongDocumentTypeDialog = _q === void 0 ? false : _q,
13398
+ _r = _a.allowOverrideWrongDocumentTypeAfterMs,
13399
+ allowOverrideWrongDocumentTypeAfterMs = _r === void 0 ? 8000 : _r,
13425
13400
  onBeforeSubmit = _a.onBeforeSubmit,
13426
13401
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
13427
13402
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -13435,28 +13410,28 @@ var IdValidation = function IdValidation(_a) {
13435
13410
  onUserCancel = _a.onUserCancel,
13436
13411
  onModelError = _a.onModelError,
13437
13412
  onCameraAccessDenied = _a.onCameraAccessDenied,
13438
- _t = _a.theme,
13439
- theme = _t === void 0 ? 'default' : _t,
13440
- _u = _a.assets,
13441
- assets = _u === void 0 ? {} : _u,
13442
- _v = _a.classNames,
13443
- classNames = _v === void 0 ? {} : _v,
13444
- _w = _a.colors,
13445
- colors = _w === void 0 ? {} : _w,
13446
- _x = _a.verbiage,
13447
- verbiage = _x === void 0 ? {} : _x,
13448
- _y = _a.captureSignature,
13449
- captureSignature = _y === void 0 ? false : _y,
13450
- _z = _a.captureSignatureVideo,
13451
- captureSignatureVideo = _z === void 0 ? false : _z,
13452
- _0 = _a.captureAdditionalDocuments,
13453
- captureAdditionalDocuments = _0 === void 0 ? [] : _0,
13454
- _1 = _a.geolocationEnabled,
13455
- geolocationEnabled = _1 === void 0 ? true : _1,
13456
- _2 = _a.geolocationRequired,
13457
- geolocationRequired = _2 === void 0 ? false : _2,
13458
- _3 = _a.debugMode,
13459
- debugMode = _3 === void 0 ? false : _3;
13413
+ _s = _a.theme,
13414
+ theme = _s === void 0 ? 'default' : _s,
13415
+ _t = _a.assets,
13416
+ assets = _t === void 0 ? {} : _t,
13417
+ _u = _a.classNames,
13418
+ classNames = _u === void 0 ? {} : _u,
13419
+ _v = _a.colors,
13420
+ colors = _v === void 0 ? {} : _v,
13421
+ _w = _a.verbiage,
13422
+ verbiage = _w === void 0 ? {} : _w,
13423
+ _x = _a.captureSignature,
13424
+ captureSignature = _x === void 0 ? false : _x,
13425
+ _y = _a.captureSignatureVideo,
13426
+ captureSignatureVideo = _y === void 0 ? false : _y,
13427
+ _z = _a.captureAdditionalDocuments,
13428
+ captureAdditionalDocuments = _z === void 0 ? [] : _z,
13429
+ _0 = _a.geolocationEnabled,
13430
+ geolocationEnabled = _0 === void 0 ? true : _0,
13431
+ _1 = _a.geolocationRequired,
13432
+ geolocationRequired = _1 === void 0 ? false : _1,
13433
+ _2 = _a.debugMode,
13434
+ debugMode = _2 === void 0 ? false : _2;
13460
13435
  useLanguage(lang);
13461
13436
  useDebugLogging(debugMode);
13462
13437
  var idCaptureProps = React.useMemo(function () {
@@ -13466,7 +13441,6 @@ var IdValidation = function IdValidation(_a) {
13466
13441
  onModelError: onModelError,
13467
13442
  precapturedDocuments: precapturedDocuments,
13468
13443
  captureRequirement: idCaptureRequirement,
13469
- allowSinglePageIdCapture: allowSinglePageIdCapture,
13470
13444
  separateIdCardCaptureSequence: separateIdCardCaptureSequence,
13471
13445
  thresholds: idCaptureThresholds,
13472
13446
  skipSuccessScreen: skipSuccessScreen,
@@ -13489,7 +13463,7 @@ var IdValidation = function IdValidation(_a) {
13489
13463
  verbiage: verbiage,
13490
13464
  debugMode: debugMode
13491
13465
  };
13492
- }, [onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, allowSinglePageIdCapture, separateIdCardCaptureSequence, idCaptureThresholds, skipSuccessScreen, loadingOverlayMode, customOverlayContent, onLoadingOverlayDismissed, forceFallbackMode, allowIdCardBackToFrontCapture, instructions, guideType, guideImages, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, enableOverrideWrongDocumentTypeDialog, allowOverrideWrongDocumentTypeAfterMs, assets, classNames, colors, verbiage, debugMode]);
13466
+ }, [onExitCapture, onUserCancel, onModelError, precapturedDocuments, idCaptureRequirement, separateIdCardCaptureSequence, idCaptureThresholds, skipSuccessScreen, loadingOverlayMode, customOverlayContent, onLoadingOverlayDismissed, forceFallbackMode, allowIdCardBackToFrontCapture, instructions, guideType, guideImages, portraitGuidesOnMobile, rotateLoadingOverlayImageWhenPortrait, modelLoadTimeoutMs, enableOverrideWrongDocumentTypeDialog, allowOverrideWrongDocumentTypeAfterMs, assets, classNames, colors, verbiage, debugMode]);
13493
13467
  var additionalDocumentCaptureProps = React.useMemo(function () {
13494
13468
  return {
13495
13469
  documents: captureAdditionalDocuments,