idmission-web-sdk 2.2.66 → 2.2.67

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 (38) hide show
  1. package/dist/components/CompositeWizard.d.ts.map +1 -1
  2. package/dist/components/customer_flows/IdValidation.d.ts +1 -3
  3. package/dist/components/customer_flows/IdValidation.d.ts.map +1 -1
  4. package/dist/components/fallback_flows/IdCapture.d.ts.map +1 -1
  5. package/dist/components/id_capture/CapturedDocuments.d.ts +1 -1
  6. package/dist/components/id_capture/CapturedDocuments.d.ts.map +1 -1
  7. package/dist/components/id_capture/IdCapture.d.ts +2 -2
  8. package/dist/components/id_capture/IdCapture.d.ts.map +1 -1
  9. package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +1 -2
  10. package/dist/components/id_capture/IdCaptureModelsProvider.d.ts.map +1 -1
  11. package/dist/components/id_capture/IdCaptureRequirementOption.d.ts +5 -7
  12. package/dist/components/id_capture/IdCaptureRequirementOption.d.ts.map +1 -1
  13. package/dist/components/id_capture/IdCaptureStateProvider.d.ts +0 -4
  14. package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
  15. package/dist/components/id_capture/IdCaptureSuccess.d.ts +4 -0
  16. package/dist/components/id_capture/IdCaptureSuccess.d.ts.map +1 -1
  17. package/dist/components/id_capture/IdCaptureWizard.d.ts +1 -2
  18. package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
  19. package/dist/components/video_id/IdVideoCapture.d.ts +0 -2
  20. package/dist/components/video_id/IdVideoCapture.d.ts.map +1 -1
  21. package/dist/components/video_id/IdVideoCaptureWizard.d.ts.map +1 -1
  22. package/dist/lib/models/DocumentDetection.d.ts +2 -6
  23. package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
  24. package/dist/lib/models/Focus.d.ts +0 -4
  25. package/dist/lib/models/Focus.d.ts.map +1 -1
  26. package/dist/lib/models/defaults/DocumentDetector.d.ts +1 -1
  27. package/dist/sdk2.cjs.development.js +327 -353
  28. package/dist/sdk2.cjs.development.js.map +1 -1
  29. package/dist/sdk2.cjs.production.js +1 -1
  30. package/dist/sdk2.cjs.production.js.map +1 -1
  31. package/dist/sdk2.esm.js +327 -353
  32. package/dist/sdk2.esm.js.map +1 -1
  33. package/dist/sdk2.umd.development.js +327 -353
  34. package/dist/sdk2.umd.development.js.map +1 -1
  35. package/dist/sdk2.umd.production.js +1 -1
  36. package/dist/sdk2.umd.production.js.map +1 -1
  37. package/dist/version.d.ts +1 -1
  38. package/package.json +1 -1
package/dist/sdk2.esm.js CHANGED
@@ -203,7 +203,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
203
203
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
204
204
  };
205
205
 
206
- var webSdkVersion = '2.2.66';
206
+ var webSdkVersion = '2.2.67';
207
207
 
208
208
  function getPlatform() {
209
209
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2266,7 +2266,7 @@ function average(arr) {
2266
2266
 
2267
2267
  var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
2268
2268
 
2269
- var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20241212_131026.tflite");
2269
+ var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20241018_093000.tflite");
2270
2270
 
2271
2271
  var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
2272
2272
 
@@ -2285,10 +2285,6 @@ var defaultFocusThresholds = {
2285
2285
  passport: {
2286
2286
  desktop: 0,
2287
2287
  mobile: 0.3
2288
- },
2289
- singlePage: {
2290
- desktop: 0,
2291
- mobile: 0.3
2292
2288
  }
2293
2289
  };
2294
2290
  var classifier = null;
@@ -2914,19 +2910,16 @@ var defaultDocumentDetectionThresholds = {
2914
2910
  idCardFront: 0.6,
2915
2911
  idCardBack: 0.6,
2916
2912
  passport: 0.4,
2917
- singlePage: 0.4,
2918
2913
  stability: {
2919
2914
  idCardFront: 0.85,
2920
2915
  idCardBack: 0.85,
2921
- passport: 0.5,
2922
- singlePage: 0.5
2916
+ passport: 0.5
2923
2917
  }
2924
2918
  };
2925
2919
  var documentTypeDisplayNames = {
2926
2920
  idCardFront: 'ID card front',
2927
2921
  idCardBack: 'ID card back',
2928
2922
  passport: 'Passport',
2929
- singlePage: 'Single page',
2930
2923
  none: 'None'
2931
2924
  };
2932
2925
  var detector = null;
@@ -3115,7 +3108,7 @@ var defaultDocumentDetectionBoundaries = {
3115
3108
  right: 20
3116
3109
  };
3117
3110
  function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3118
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
3111
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3119
3112
  if (boundaries === void 0) {
3120
3113
  boundaries = defaultDocumentDetectionBoundaries;
3121
3114
  }
@@ -3166,25 +3159,18 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3166
3159
  var bestPassportPage = detectedObjects.find(function (obj) {
3167
3160
  return obj.label === 'Passport page';
3168
3161
  });
3169
- var bestSinglePage = detectedObjects.find(function (obj) {
3170
- return obj.label === 'Single page';
3171
- });
3172
3162
  var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
3173
3163
  var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
3174
3164
  var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
3175
- var singlePageDetectionScore = (_h = bestSinglePage === null || bestSinglePage === void 0 ? void 0 : bestSinglePage.score) !== null && _h !== void 0 ? _h : 0;
3176
- var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_j = thresholds.idCardFront) !== null && _j !== void 0 ? _j : 0);
3177
- var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_k = thresholds.idCardBack) !== null && _k !== void 0 ? _k : 0);
3178
- var passportDetectionThresholdMet = passportDetectionScore >= ((_l = thresholds.passport) !== null && _l !== void 0 ? _l : 0);
3179
- var singlePageDetectionThresholdMet = singlePageDetectionScore >= ((_m = thresholds.singlePage) !== null && _m !== void 0 ? _m : 0);
3180
- var bestDocument = singlePageDetectionThresholdMet ? bestSinglePage : passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
3181
- var detectionThreshold = singlePageDetectionThresholdMet ? thresholds.singlePage : passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
3182
- var detectionScore = (_o = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _o !== void 0 ? _o : 0;
3165
+ var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_h = thresholds.idCardFront) !== null && _h !== void 0 ? _h : 0);
3166
+ var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_j = thresholds.idCardBack) !== null && _j !== void 0 ? _j : 0);
3167
+ var passportDetectionThresholdMet = passportDetectionScore >= ((_k = thresholds.passport) !== null && _k !== void 0 ? _k : 0);
3168
+ var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
3169
+ var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
3170
+ var detectionScore = (_l = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _l !== void 0 ? _l : 0;
3183
3171
  var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
3184
3172
  var detectedDocumentType = 'none';
3185
- if (singlePageDetectionThresholdMet) {
3186
- detectedDocumentType = 'singlePage';
3187
- } else if (passportDetectionThresholdMet) {
3173
+ if (passportDetectionThresholdMet) {
3188
3174
  detectedDocumentType = 'passport';
3189
3175
  } else if (idCardBackDetectionThresholdMet) {
3190
3176
  detectedDocumentType = 'idCardBack';
@@ -3198,12 +3184,12 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3198
3184
  var documentIsStable = false;
3199
3185
  var documentTooClose = false;
3200
3186
  if (bestDocument) {
3201
- var _q = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
3202
- docWidth = _q[0],
3203
- docHeight = _q[1];
3187
+ var _o = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
3188
+ docWidth = _o[0],
3189
+ docHeight = _o[1];
3204
3190
  documentTooClose = docWidth > 0.85 || docHeight > 0.85;
3205
3191
  if (detectionThresholdMet && documentInBounds && !documentTooClose) {
3206
- var thresholdSet = (_p = thresholds.stability) !== null && _p !== void 0 ? _p : defaultDocumentDetectionThresholds.stability;
3192
+ var thresholdSet = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
3207
3193
  var threshold_1 = thresholdSet[detectedDocumentType];
3208
3194
  var framesNeeded = Math.ceil(average(framesNeededSamples));
3209
3195
  trackBox(bestDocument.box, framesNeeded);
@@ -3225,8 +3211,6 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3225
3211
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
3226
3212
  passportDetectionScore: passportDetectionScore,
3227
3213
  passportDetectionThresholdMet: passportDetectionThresholdMet,
3228
- singlePageDetectionScore: singlePageDetectionScore,
3229
- singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
3230
3214
  bestDocument: bestDocument,
3231
3215
  documentInBounds: documentInBounds,
3232
3216
  documentTooClose: documentTooClose,
@@ -4119,39 +4103,37 @@ var IdCaptureModelsContext = /*#__PURE__*/createContext({
4119
4103
  });
4120
4104
  function IdCaptureModelsProviderInner(_a) {
4121
4105
  var children = _a.children,
4122
- onModelError = _a.onModelError,
4123
- _b = _a.allowSinglePageIdCapture,
4124
- allowSinglePageIdCapture = _b === void 0 ? false : _b;
4125
- var _c = useContext(DocumentDetectionModelContext),
4126
- documentDetectionModelReady = _c.documentDetectionModelReady,
4127
- documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
4128
- startDocumentDetection = _c.startDocumentDetection,
4129
- stopDocumentDetection = _c.stopDocumentDetection,
4130
- lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
4131
- clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
4132
- onDocumentDetected = _c.onDocumentDetected,
4133
- detectionTime = _c.detectionTime,
4134
- documentDetectionThresholds = _c.documentDetectionThresholds,
4135
- setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
4136
- documentDetectionBoundaries = _c.documentDetectionBoundaries,
4137
- setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
4138
- documentDetectionModelError = _c.documentDetectionModelError;
4139
- var _d = useContext(FocusModelContext),
4140
- focusModelReady = _d.focusModelReady,
4141
- focusModelDownloadProgress = _d.focusModelDownloadProgress,
4142
- makeFocusPrediction = _d.makeFocusPrediction,
4143
- focusThresholds = _d.focusThresholds,
4144
- setFocusThresholds = _d.setFocusThresholds,
4145
- focusPredictionTime = _d.focusPredictionTime,
4146
- focusModelError = _d.focusModelError;
4106
+ onModelError = _a.onModelError;
4107
+ var _b = useContext(DocumentDetectionModelContext),
4108
+ documentDetectionModelReady = _b.documentDetectionModelReady,
4109
+ documentDetectionModelDownloadProgress = _b.documentDetectionModelDownloadProgress,
4110
+ startDocumentDetection = _b.startDocumentDetection,
4111
+ stopDocumentDetection = _b.stopDocumentDetection,
4112
+ lastPredictionCanvas = _b.documentDetectionLastPredictionCanvas,
4113
+ clearDocumentDetectionLastPredictionCanvas = _b.clearDocumentDetectionLastPredictionCanvas,
4114
+ onDocumentDetected = _b.onDocumentDetected,
4115
+ detectionTime = _b.detectionTime,
4116
+ documentDetectionThresholds = _b.documentDetectionThresholds,
4117
+ setDocumentDetectionThresholds = _b.setDocumentDetectionThresholds,
4118
+ documentDetectionBoundaries = _b.documentDetectionBoundaries,
4119
+ setDocumentDetectionBoundaries = _b.setDocumentDetectionBoundaries,
4120
+ documentDetectionModelError = _b.documentDetectionModelError;
4121
+ var _c = useContext(FocusModelContext),
4122
+ focusModelReady = _c.focusModelReady,
4123
+ focusModelDownloadProgress = _c.focusModelDownloadProgress,
4124
+ makeFocusPrediction = _c.makeFocusPrediction,
4125
+ focusThresholds = _c.focusThresholds,
4126
+ setFocusThresholds = _c.setFocusThresholds,
4127
+ focusPredictionTime = _c.focusPredictionTime,
4128
+ focusModelError = _c.focusModelError;
4147
4129
  var onPredictionHandler = useRef();
4148
4130
  var bestFrameDetails = useRef(null);
4149
4131
  var bestPredictionCanvas = useRef(null);
4150
4132
  var bestFocusScore = useRef(0);
4151
4133
  var stopDetection = useRef(0);
4152
- var _e = useState('none'),
4153
- requiredDocumentType = _e[0],
4154
- setRequiredDocumentType = _e[1];
4134
+ var _d = useState('none'),
4135
+ requiredDocumentType = _d[0],
4136
+ setRequiredDocumentType = _d[1];
4155
4137
  var thresholds = useMemo(function () {
4156
4138
  return _assign(_assign({}, documentDetectionThresholds), {
4157
4139
  focus: focusThresholds
@@ -4169,42 +4151,34 @@ function IdCaptureModelsProviderInner(_a) {
4169
4151
  var _this = this;
4170
4152
  onDocumentDetected(function (prediction) {
4171
4153
  return __awaiter(_this, void 0, void 0, function () {
4172
- var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4173
- var _a, _b, _c, _d, _e, _f, _g;
4174
- return __generator(this, function (_h) {
4154
+ var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4155
+ var _a, _b, _c, _d, _e, _f;
4156
+ return __generator(this, function (_g) {
4175
4157
  if (!lastPredictionCanvas.current) return [2 /*return*/];
4176
4158
  stopDetectionAtStart = stopDetection.current;
4177
4159
  focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
4178
- isSinglePage = prediction.detectedDocumentType === 'singlePage';
4179
- if (!allowSinglePageIdCapture && isSinglePage) {
4180
- prediction.detectedDocumentType = 'passport';
4181
- prediction.passportDetectionScore = prediction.singlePageDetectionScore;
4182
- prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
4183
- prediction.singlePageDetectionScore = 0;
4184
- prediction.singlePageDetectionThresholdMet = false;
4185
- }
4186
- 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'));
4160
+ isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType));
4187
4161
  if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
4188
- focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
4162
+ focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_b = prediction.bestDocument) === null || _b === void 0 ? void 0 : _b.box);
4189
4163
  if (focusPrediction) {
4190
4164
  focusScore = focusPrediction.score;
4191
4165
  focusPredictionTime = focusPrediction.predictionTime;
4192
4166
  }
4193
- focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
4194
- 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;
4167
+ focusThresholdSet = (_c = thresholds.focus) === null || _c === void 0 ? void 0 : _c[prediction.detectedDocumentType];
4168
+ 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;
4195
4169
  focusThresholdMet = focusScore >= focusThreshold;
4196
4170
  if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
4197
4171
  bestFocusScore.current = focusScore;
4198
4172
  drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
4199
4173
  bestFrameDetails.current = {
4200
- boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
4174
+ boundingBox: (_e = prediction.bestDocument) === null || _e === void 0 ? void 0 : _e.box,
4201
4175
  documentType: prediction.detectedDocumentType,
4202
4176
  detectionScore: prediction.detectionScore,
4203
4177
  focusScore: focusScore
4204
4178
  };
4205
4179
  }
4206
4180
  }
4207
- (_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
4181
+ (_f = onPredictionHandler.current) === null || _f === void 0 ? void 0 : _f.call(onPredictionHandler, _assign(_assign({}, prediction), {
4208
4182
  focusScore: focusScore,
4209
4183
  focusPredictionTime: focusPredictionTime,
4210
4184
  focusThresholdMet: focusThresholdMet
@@ -4213,7 +4187,7 @@ function IdCaptureModelsProviderInner(_a) {
4213
4187
  });
4214
4188
  });
4215
4189
  });
4216
- }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4190
+ }, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4217
4191
  var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
4218
4192
  useEffect(function handleModelErrors() {
4219
4193
  if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
@@ -4227,9 +4201,9 @@ function IdCaptureModelsProviderInner(_a) {
4227
4201
  canvas: bestPredictionCanvas.current
4228
4202
  });
4229
4203
  }, []);
4230
- var _f = useState(0),
4231
- canvasKey = _f[0],
4232
- setCanvasKey = _f[1];
4204
+ var _e = useState(0),
4205
+ canvasKey = _e[0],
4206
+ setCanvasKey = _e[1];
4233
4207
  var resetBestFrame = useCallback(function () {
4234
4208
  stopDetection.current += 1;
4235
4209
  setCanvasKey(function (n) {
@@ -4276,9 +4250,9 @@ function IdCaptureModelsProvider(_a) {
4276
4250
  return /*#__PURE__*/React__default.createElement(DocumentDetectionModelProvider, _assign({}, props), /*#__PURE__*/React__default.createElement(FocusModelProvider, _assign({}, props), /*#__PURE__*/React__default.createElement(IdCaptureModelsProviderInner, _assign({}, props), children)));
4277
4251
  }
4278
4252
 
4279
- var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
4253
+ var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'selfie'];
4280
4254
 
4281
- var acceptedDocumentTypesForIdCaptureRequirementOption = {
4255
+ var requiredDocumentsForOption = {
4282
4256
  idCardFront: ['idCardFront'],
4283
4257
  idCardBack: ['idCardBack'],
4284
4258
  passport: ['passport'],
@@ -4286,31 +4260,13 @@ var acceptedDocumentTypesForIdCaptureRequirementOption = {
4286
4260
  idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
4287
4261
  idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
4288
4262
  };
4289
- function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4263
+ function requiredImageCountForOption(idCaptureRequirement) {
4290
4264
  if (idCaptureRequirement === 'idCardOrPassport') return 1;
4291
- return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
4265
+ return requiredDocumentsForOption[idCaptureRequirement].length;
4292
4266
  }
4293
- function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4267
+ function allowedImageCountForOption(idCaptureRequirement) {
4294
4268
  if (idCaptureRequirement === 'idCardOrPassport') return 2;
4295
- return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
4296
- }
4297
- function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
4298
- var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
4299
- if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
4300
- var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
4301
- if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
4302
- acceptedTypes = acceptedTypes.filter(function (v) {
4303
- return !v.includes('idCard');
4304
- });
4305
- }
4306
- if (isIdCardOrPassport) {
4307
- acceptedTypes = acceptedTypes.filter(function (v) {
4308
- return v !== 'passport';
4309
- });
4310
- }
4311
- return acceptedTypes.filter(function (v) {
4312
- return !(v in capturedDocuments);
4313
- });
4269
+ return requiredImageCountForOption(idCaptureRequirement);
4314
4270
  }
4315
4271
 
4316
4272
  var initialState$4 = {
@@ -4349,8 +4305,6 @@ var initialState$4 = {
4349
4305
  idCardBackDetectionThresholdMet: false,
4350
4306
  passportDetectionScore: 0,
4351
4307
  passportDetectionThresholdMet: false,
4352
- singlePageDetectionScore: 0,
4353
- singlePageDetectionThresholdMet: false,
4354
4308
  focusScore: 0,
4355
4309
  focusThresholdMet: false,
4356
4310
  isGoodFrame: false,
@@ -4366,7 +4320,6 @@ var initialState$4 = {
4366
4320
  capturedDocuments: {},
4367
4321
  captureRequirement: 'idCardOrPassport',
4368
4322
  requestedDocumentType: 'idCardFront',
4369
- allowSinglePageIdCapture: false,
4370
4323
  allowIdCardBackToFrontCapture: false,
4371
4324
  operationStartedAt: null,
4372
4325
  captureStartedAt: null
@@ -4381,13 +4334,11 @@ var _reducer = function reducer(state, action) {
4381
4334
  var _c = action.payload,
4382
4335
  captureRequirement = _c.captureRequirement,
4383
4336
  precapturedDocuments = _c.precapturedDocuments,
4384
- allowSinglePageIdCapture = _c.allowSinglePageIdCapture,
4385
4337
  allowIdCardBackToFrontCapture = _c.allowIdCardBackToFrontCapture,
4386
4338
  enableOverrideWrongDocumentTypeDialog = _c.enableOverrideWrongDocumentTypeDialog,
4387
4339
  allowOverrideWrongDocumentTypeAfterMs = _c.allowOverrideWrongDocumentTypeAfterMs;
4388
4340
  var newState = _assign(_assign({}, state), {
4389
4341
  captureRequirement: captureRequirement,
4390
- allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
4391
4342
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
4392
4343
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
4393
4344
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
@@ -4455,8 +4406,6 @@ var _reducer = function reducer(state, action) {
4455
4406
  idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
4456
4407
  passportDetectionScore = _d.passportDetectionScore,
4457
4408
  passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
4458
- singlePageDetectionScore = _d.singlePageDetectionScore,
4459
- singlePageDetectionThresholdMet = _d.singlePageDetectionThresholdMet,
4460
4409
  bestDocument = _d.bestDocument,
4461
4410
  documentInBounds = _d.documentInBounds,
4462
4411
  documentTooClose = _d.documentTooClose,
@@ -4477,8 +4426,7 @@ var _reducer = function reducer(state, action) {
4477
4426
  }
4478
4427
  }
4479
4428
  }
4480
- var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
4481
- var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
4429
+ var idCardDetectedButNotAllowed = detectedDocumentType.includes('idCard') && !state.captureRequirement.includes('idCard');
4482
4430
  var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
4483
4431
  var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
4484
4432
  var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
@@ -4538,8 +4486,6 @@ var _reducer = function reducer(state, action) {
4538
4486
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
4539
4487
  passportDetectionScore: passportDetectionScore,
4540
4488
  passportDetectionThresholdMet: passportDetectionThresholdMet,
4541
- singlePageDetectionScore: singlePageDetectionScore,
4542
- singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
4543
4489
  focusScore: focusScore,
4544
4490
  focusThresholdMet: focusThresholdMet,
4545
4491
  isGoodFrame: isGoodFrame,
@@ -4577,7 +4523,7 @@ var _reducer = function reducer(state, action) {
4577
4523
  });
4578
4524
  case 'documentCaptured':
4579
4525
  {
4580
- var newState = _assign(_assign({}, state), {
4526
+ var newState_1 = _assign(_assign({}, state), {
4581
4527
  capturing: false,
4582
4528
  captureFailed: false,
4583
4529
  allowOverrideFlipRequirement: false,
@@ -4586,42 +4532,64 @@ var _reducer = function reducer(state, action) {
4586
4532
  wrongDocumentTypePredictions: 0,
4587
4533
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
4588
4534
  });
4589
- var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4535
+ var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
4536
+ return !(v in newState_1.capturedDocuments);
4537
+ });
4538
+ if (state.captureRequirement === 'idCardOrPassport') {
4539
+ if (state.requestedDocumentType === 'passport') {
4540
+ remainingRequirements = [];
4541
+ } else {
4542
+ remainingRequirements = remainingRequirements.filter(function (v) {
4543
+ return v !== 'passport';
4544
+ });
4545
+ }
4546
+ }
4590
4547
  if (remainingRequirements.length === 0) {
4591
- newState.captureState = 'complete';
4548
+ newState_1.captureState = 'complete';
4592
4549
  } else {
4593
- newState.requestedDocumentType = remainingRequirements[0];
4594
- if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
4595
- newState.captureState = 'requestingFlip';
4596
- newState.idCardFrontDetectionThresholdMet = false;
4597
- newState.idCardBackDetectionThresholdMet = false;
4598
- newState.passportDetectionThresholdMet = false;
4599
- newState.wrongDocumentTypePredictions = 0;
4550
+ newState_1.requestedDocumentType = remainingRequirements[0];
4551
+ if (state.requestedDocumentType === 'idCardFront' && newState_1.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_1.requestedDocumentType === 'idCardFront') {
4552
+ newState_1.captureState = 'requestingFlip';
4553
+ newState_1.idCardFrontDetectionThresholdMet = false;
4554
+ newState_1.idCardBackDetectionThresholdMet = false;
4555
+ newState_1.passportDetectionThresholdMet = false;
4556
+ newState_1.wrongDocumentTypePredictions = 0;
4600
4557
  }
4601
4558
  }
4602
- return newState;
4559
+ return newState_1;
4603
4560
  }
4604
4561
  case 'documentCapturedManually':
4605
4562
  {
4606
- var newState = _assign(_assign({}, state), {
4563
+ var newState_2 = _assign(_assign({}, state), {
4607
4564
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_b = {}, _b[state.requestedDocumentType] = _assign(_assign({}, action.payload), {
4608
4565
  width: 0,
4609
4566
  height: 0
4610
4567
  }), _b))
4611
4568
  });
4612
- var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4569
+ var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
4570
+ return !(v in newState_2.capturedDocuments);
4571
+ });
4572
+ if (state.captureRequirement === 'idCardOrPassport') {
4573
+ if (state.requestedDocumentType === 'passport') {
4574
+ remainingRequirements = [];
4575
+ } else {
4576
+ remainingRequirements = remainingRequirements.filter(function (v) {
4577
+ return v !== 'passport';
4578
+ });
4579
+ }
4580
+ }
4613
4581
  if (remainingRequirements.length === 0) {
4614
- newState.captureState = 'complete';
4582
+ newState_2.captureState = 'complete';
4615
4583
  } else {
4616
- newState.requestedDocumentType = remainingRequirements[0];
4617
- if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
4618
- newState.captureState = 'requestingFlip';
4619
- newState.idCardFrontDetectionThresholdMet = false;
4620
- newState.idCardBackDetectionThresholdMet = false;
4621
- newState.passportDetectionThresholdMet = false;
4584
+ newState_2.requestedDocumentType = remainingRequirements[0];
4585
+ if (state.requestedDocumentType === 'idCardFront' && newState_2.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_2.requestedDocumentType === 'idCardFront') {
4586
+ newState_2.captureState = 'requestingFlip';
4587
+ newState_2.idCardFrontDetectionThresholdMet = false;
4588
+ newState_2.idCardBackDetectionThresholdMet = false;
4589
+ newState_2.passportDetectionThresholdMet = false;
4622
4590
  }
4623
4591
  }
4624
- return newState;
4592
+ return newState_2;
4625
4593
  }
4626
4594
  case 'flipRequestCompleted':
4627
4595
  return _assign(_assign({}, state), {
@@ -5222,7 +5190,7 @@ var IdCapture = function IdCapture(_a) {
5222
5190
  imageUrl: imageUrl
5223
5191
  }
5224
5192
  });
5225
- var capturedDocumentType = documentType;
5193
+ var capturedDocumentType = documentType === 'passport' ? 'passport' : state.requestedDocumentType;
5226
5194
  setTimeout(function () {
5227
5195
  var _a;
5228
5196
  var captureTime = new Date().getTime() - ((_a = state.captureStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
@@ -5289,7 +5257,7 @@ var IdCapture = function IdCapture(_a) {
5289
5257
  scaling: debugScalingDetails,
5290
5258
  flipX: !isRearFacing
5291
5259
  });
5292
- }))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__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.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u274C Models not ready")))));
5260
+ }))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__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.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u274C Models not ready")))));
5293
5261
  };
5294
5262
  var timeSince = function timeSince(t) {
5295
5263
  if (!t) return 0;
@@ -6328,8 +6296,15 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6328
6296
  _e = _a.debugMode,
6329
6297
  debugMode = _e === void 0 ? false : _e;
6330
6298
  var submissionStatus = useContext(SubmissionContext).submissionStatus;
6299
+ var idCardFront = capturedDocuments.idCardFront,
6300
+ idCardBack = capturedDocuments.idCardBack,
6301
+ passport = capturedDocuments.passport;
6331
6302
  var verbiage = useTranslations(rawVerbiage, {
6332
6303
  headingText: 'ID Capture Successful',
6304
+ idCardFrontText: 'ID Card Front',
6305
+ idCardBackText: 'ID Card Back',
6306
+ passportText: 'Passport',
6307
+ instructionText: 'Verify the entire ID was captured clearly with no glare.',
6333
6308
  retryText: 'Retry',
6334
6309
  submittingText: 'Submitting...',
6335
6310
  submitText: 'Done'
@@ -6346,16 +6321,25 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6346
6321
  className: classNames.imageContainer
6347
6322
  }, /*#__PURE__*/React__default.createElement(ImageRow, {
6348
6323
  className: classNames.imageRow
6349
- }, Object.values(capturedDocuments).map(function (doc) {
6350
- return /*#__PURE__*/React__default.createElement(ImageCol$1, {
6351
- className: classNames.imageCol,
6352
- key: doc.imageData
6353
- }, /*#__PURE__*/React__default.createElement(StyledImage, {
6354
- image: doc,
6355
- className: classNames.image,
6356
- alt: doc.documentType
6357
- }), debugMode && ( /*#__PURE__*/React__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)))));
6358
- }))), /*#__PURE__*/React__default.createElement(ButtonsColumn, {
6324
+ }, idCardFront && ( /*#__PURE__*/React__default.createElement(ImageCol$1, {
6325
+ className: classNames.imageCol
6326
+ }, /*#__PURE__*/React__default.createElement(StyledImage, {
6327
+ image: idCardFront,
6328
+ className: classNames.image,
6329
+ alt: verbiage.idCardFrontText
6330
+ }), debugMode && ( /*#__PURE__*/React__default.createElement(DebugPre, null, "Detection Score: ".concat(idCardFront.detectionScore, "\nFocus Score: ").concat(idCardFront.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardFront.boundingBox)))))), idCardBack && ( /*#__PURE__*/React__default.createElement(ImageCol$1, {
6331
+ className: classNames.imageCol
6332
+ }, /*#__PURE__*/React__default.createElement(StyledImage, {
6333
+ image: idCardBack,
6334
+ className: classNames.image,
6335
+ alt: verbiage.idCardBackText
6336
+ }), debugMode && ( /*#__PURE__*/React__default.createElement(DebugPre, null, "Detection Score: ".concat(idCardBack.detectionScore, "\nFocus Score: ").concat(idCardBack.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardBack.boundingBox)))))), passport && ( /*#__PURE__*/React__default.createElement(ImageCol$1, {
6337
+ className: classNames.imageCol
6338
+ }, /*#__PURE__*/React__default.createElement(StyledImage, {
6339
+ image: passport,
6340
+ className: classNames.image,
6341
+ alt: verbiage.passportText
6342
+ }), debugMode && ( /*#__PURE__*/React__default.createElement(DebugPre, null, "Detection Score: ".concat(passport.detectionScore, "\nFocus Score: ").concat(passport.focusScore, "\nBounding Box: ").concat(JSON.stringify(passport.boundingBox)))))))), /*#__PURE__*/React__default.createElement(ButtonsColumn, {
6359
6343
  className: classNames.buttonsRow
6360
6344
  }, /*#__PURE__*/React__default.createElement(WideButton, {
6361
6345
  className: classNames.submitBtn,
@@ -6374,7 +6358,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6374
6358
  };
6375
6359
  var Heading$a = styled.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"])));
6376
6360
  var ImagesContainer = styled(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"])));
6377
- var ImageRow = styled(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"])));
6361
+ var ImageRow = styled(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"])));
6378
6362
  var ImageCol$1 = styled.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"])));
6379
6363
  var StyledImage = styled(CapturedDocumentImg)(templateObject_5$9 || (templateObject_5$9 = __makeTemplateObject(["\n width: 100%;\n border-radius: 12px;\n"], ["\n width: 100%;\n border-radius: 12px;\n"])));
6380
6364
  var DebugPre = styled.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"])));
@@ -8084,8 +8068,8 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8084
8068
  var _j = useState(silentFallback),
8085
8069
  useFallback = _j[0],
8086
8070
  setUseFallback = _j[1];
8087
- var minImageCount = minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
8088
- var maxImageCount = maxImageCountForIdCaptureRequirementOption(idCaptureRequirement);
8071
+ var allowedImageCount = allowedImageCountForOption(idCaptureRequirement);
8072
+ var requiredImageCount = requiredImageCountForOption(idCaptureRequirement);
8089
8073
  var _k = useFileState(),
8090
8074
  rawFile = _k.rawFile,
8091
8075
  fileInputOnChange = _k.fileInputOnChange;
@@ -8098,7 +8082,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8098
8082
  var whatToCapture = idCaptureRequirement === 'idCard' ? 'ID card' : idCaptureRequirement === 'passport' ? 'passport' : idCaptureRequirement === 'idCardOrPassport' ? 'ID card or passport' : 'ID card and passport';
8099
8083
  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.';
8100
8084
  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.';
8101
- var descriptionText = "On-device capture guidance failed, please capture ".concat(minImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
8085
+ var descriptionText = "On-device capture guidance failed, please capture ".concat(requiredImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
8102
8086
  var verbiage = useTranslations(rawVerbiage, {
8103
8087
  headingText: "We're having some trouble.",
8104
8088
  descriptionText: descriptionText,
@@ -8172,7 +8156,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8172
8156
  alt: "",
8173
8157
  className: classNames.image
8174
8158
  }));
8175
- }))), images.length < minImageCount && ( /*#__PURE__*/React__default.createElement(Instruction, {
8159
+ }))), images.length < requiredImageCount && ( /*#__PURE__*/React__default.createElement(Instruction, {
8176
8160
  className: classNames.instruction
8177
8161
  }, instructionText)), /*#__PURE__*/React__default.createElement("input", {
8178
8162
  ref: fileInput,
@@ -8183,7 +8167,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8183
8167
  hidden: true
8184
8168
  }), /*#__PURE__*/React__default.createElement(StyledButtonsRow$8, {
8185
8169
  className: classNames.buttonsRow
8186
- }, images.length < maxImageCount && ( /*#__PURE__*/React__default.createElement(LoaderButton, {
8170
+ }, images.length < allowedImageCount && ( /*#__PURE__*/React__default.createElement(LoaderButton, {
8187
8171
  variant: images.length > 0 ? 'secondary' : 'positive',
8188
8172
  className: images.length > 0 ? classNames.captureMoreBtn : classNames.captureBtn,
8189
8173
  colors: images.length > 0 ? colors.captureMoreBtn : colors.captureBtn,
@@ -8196,7 +8180,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8196
8180
  setDocumentToCapture(instructionText);
8197
8181
  }
8198
8182
  }
8199
- }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= minImageCount && ( /*#__PURE__*/React__default.createElement(LoaderButton, {
8183
+ }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= requiredImageCount && ( /*#__PURE__*/React__default.createElement(LoaderButton, {
8200
8184
  variant: "positive",
8201
8185
  className: classNames.doneBtn,
8202
8186
  colors: colors.doneBtn,
@@ -8243,82 +8227,79 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8243
8227
  precapturedDocuments = _a.precapturedDocuments,
8244
8228
  _j = _a.captureRequirement,
8245
8229
  captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
8246
- _k = _a.allowSinglePageIdCapture,
8247
- allowSinglePageIdCapture = _k === void 0 ? false : _k,
8248
- _l = _a.separateIdCardCaptureSequence,
8249
- separateIdCardCaptureSequence = _l === void 0 ? false : _l,
8250
- _m = _a.thresholds,
8251
- thresholds = _m === void 0 ? defaultIdCaptureThresholds : _m,
8252
- _o = _a.skipSuccessScreen,
8253
- skipSuccessScreen = _o === void 0 ? false : _o,
8230
+ _k = _a.separateIdCardCaptureSequence,
8231
+ separateIdCardCaptureSequence = _k === void 0 ? false : _k,
8232
+ _l = _a.thresholds,
8233
+ thresholds = _l === void 0 ? defaultIdCaptureThresholds : _l,
8234
+ _m = _a.skipSuccessScreen,
8235
+ skipSuccessScreen = _m === void 0 ? false : _m,
8254
8236
  instructions = _a.instructions,
8255
- _p = _a.releaseCameraAccessOnExit,
8256
- releaseCameraAccessOnExit = _p === void 0 ? true : _p,
8257
- _q = _a.guideType,
8258
- guideType = _q === void 0 ? 'fit' : _q,
8259
- _r = _a.portraitGuidesOnMobile,
8260
- portraitGuidesOnMobile = _r === void 0 ? true : _r,
8261
- _s = _a.rotateLoadingOverlayImageWhenPortrait,
8262
- rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
8263
- _t = _a.silentFallback,
8264
- silentFallback = _t === void 0 ? false : _t,
8265
- _u = _a.forceFallbackMode,
8266
- forceFallbackMode = _u === void 0 ? false : _u,
8267
- _v = _a.allowIdCardBackToFrontCapture,
8268
- allowIdCardBackToFrontCapture = _v === void 0 ? false : _v,
8269
- _w = _a.enableOverrideWrongDocumentTypeDialog,
8270
- enableOverrideWrongDocumentTypeDialog = _w === void 0 ? false : _w,
8271
- _x = _a.allowOverrideWrongDocumentTypeAfterMs,
8272
- allowOverrideWrongDocumentTypeAfterMs = _x === void 0 ? 8000 : _x,
8273
- _y = _a.guideImages,
8274
- guideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
8275
- _z = _a.assets,
8276
- assets = _z === void 0 ? {} : _z,
8277
- _0 = _a.classNames,
8278
- classNames = _0 === void 0 ? {} : _0,
8279
- _1 = _a.colors,
8280
- colors = _1 === void 0 ? {} : _1,
8281
- _2 = _a.verbiage,
8282
- verbiage = _2 === void 0 ? {} : _2,
8283
- _3 = _a.debugMode,
8284
- debugMode = _3 === void 0 ? false : _3;
8285
- var _4 = useIdCaptureState(),
8286
- state = _4[0],
8287
- dispatch = _4[1];
8288
- var _5 = useCameraStore(),
8289
- cameraAccessDenied = _5.cameraAccessDenied,
8290
- requestCameraAccess = _5.requestCameraAccess,
8291
- releaseCameraAccess = _5.releaseCameraAccess;
8292
- var _6 = useState(false),
8293
- overlayDismissed = _6[0],
8294
- setOverlayDismissed = _6[1];
8295
- var _7 = useContext(SubmissionContext),
8296
- submissionStatus = _7.submissionStatus,
8297
- setIdFrontImage = _7.setIdFrontImage,
8298
- setIdBackImage = _7.setIdBackImage,
8299
- setPassportImage = _7.setPassportImage,
8300
- logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
8301
- logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
8302
- var _8 = useContext(IdCaptureModelsContext),
8303
- start = _8.start,
8304
- stop = _8.stop,
8305
- onPredictionMade = _8.onPredictionMade,
8306
- setRequiredDocumentType = _8.setRequiredDocumentType,
8307
- modelError = _8.modelError,
8308
- resetBestFrame = _8.resetBestFrame;
8237
+ _o = _a.releaseCameraAccessOnExit,
8238
+ releaseCameraAccessOnExit = _o === void 0 ? true : _o,
8239
+ _p = _a.guideType,
8240
+ guideType = _p === void 0 ? 'fit' : _p,
8241
+ _q = _a.portraitGuidesOnMobile,
8242
+ portraitGuidesOnMobile = _q === void 0 ? true : _q,
8243
+ _r = _a.rotateLoadingOverlayImageWhenPortrait,
8244
+ rotateLoadingOverlayImageWhenPortrait = _r === void 0 ? true : _r,
8245
+ _s = _a.silentFallback,
8246
+ silentFallback = _s === void 0 ? false : _s,
8247
+ _t = _a.forceFallbackMode,
8248
+ forceFallbackMode = _t === void 0 ? false : _t,
8249
+ _u = _a.allowIdCardBackToFrontCapture,
8250
+ allowIdCardBackToFrontCapture = _u === void 0 ? false : _u,
8251
+ _v = _a.enableOverrideWrongDocumentTypeDialog,
8252
+ enableOverrideWrongDocumentTypeDialog = _v === void 0 ? false : _v,
8253
+ _w = _a.allowOverrideWrongDocumentTypeAfterMs,
8254
+ allowOverrideWrongDocumentTypeAfterMs = _w === void 0 ? 8000 : _w,
8255
+ _x = _a.guideImages,
8256
+ guideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
8257
+ _y = _a.assets,
8258
+ assets = _y === void 0 ? {} : _y,
8259
+ _z = _a.classNames,
8260
+ classNames = _z === void 0 ? {} : _z,
8261
+ _0 = _a.colors,
8262
+ colors = _0 === void 0 ? {} : _0,
8263
+ _1 = _a.verbiage,
8264
+ verbiage = _1 === void 0 ? {} : _1,
8265
+ _2 = _a.debugMode,
8266
+ debugMode = _2 === void 0 ? false : _2;
8267
+ var _3 = useIdCaptureState(),
8268
+ state = _3[0],
8269
+ dispatch = _3[1];
8270
+ var _4 = useCameraStore(),
8271
+ cameraAccessDenied = _4.cameraAccessDenied,
8272
+ requestCameraAccess = _4.requestCameraAccess,
8273
+ releaseCameraAccess = _4.releaseCameraAccess;
8274
+ var _5 = useState(false),
8275
+ overlayDismissed = _5[0],
8276
+ setOverlayDismissed = _5[1];
8277
+ var _6 = useContext(SubmissionContext),
8278
+ submissionStatus = _6.submissionStatus,
8279
+ setIdFrontImage = _6.setIdFrontImage,
8280
+ setIdBackImage = _6.setIdBackImage,
8281
+ setPassportImage = _6.setPassportImage,
8282
+ logIdFrontCaptureAttempt = _6.logIdFrontCaptureAttempt,
8283
+ logIdBackCaptureAttempt = _6.logIdBackCaptureAttempt;
8284
+ var _7 = useContext(IdCaptureModelsContext),
8285
+ start = _7.start,
8286
+ stop = _7.stop,
8287
+ onPredictionMade = _7.onPredictionMade,
8288
+ setRequiredDocumentType = _7.setRequiredDocumentType,
8289
+ modelError = _7.modelError,
8290
+ resetBestFrame = _7.resetBestFrame;
8309
8291
  useEffect(function () {
8310
8292
  dispatch({
8311
8293
  type: 'configureWizard',
8312
8294
  payload: {
8313
8295
  captureRequirement: captureRequirement,
8314
8296
  precapturedDocuments: precapturedDocuments,
8315
- allowSinglePageIdCapture: allowSinglePageIdCapture,
8316
8297
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
8317
8298
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
8318
8299
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
8319
8300
  }
8320
8301
  });
8321
- }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8302
+ }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8322
8303
  var documentCount = Object.keys(state.capturedDocuments).length;
8323
8304
  useEffect(function () {
8324
8305
  if (documentCount) resetBestFrame();
@@ -8380,16 +8361,13 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8380
8361
  var _a = state.capturedDocuments,
8381
8362
  idCardFront = _a.idCardFront,
8382
8363
  idCardBack = _a.idCardBack,
8383
- passport = _a.passport,
8384
- singlePage = _a.singlePage;
8364
+ passport = _a.passport;
8385
8365
  var idFrontImage = idCardFront && dataUrlToBase64Sync(idCardFront.imageData);
8386
8366
  var idBackImage = idCardBack && dataUrlToBase64Sync(idCardBack.imageData);
8387
8367
  var passportImage = passport && dataUrlToBase64Sync(passport.imageData);
8388
- var singlePageImage = singlePage && dataUrlToBase64Sync(singlePage.imageData);
8389
8368
  if (idFrontImage) setIdFrontImage(idFrontImage);
8390
8369
  if (idBackImage) setIdBackImage(idBackImage);
8391
8370
  if (passportImage) setPassportImage(passportImage);
8392
- if (singlePageImage) setIdFrontImage(singlePageImage);
8393
8371
  if (releaseCameraAccessOnExit) releaseCameraAccess();
8394
8372
  setTimeout(function () {
8395
8373
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
@@ -8405,9 +8383,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8405
8383
  type: 'resetWizard'
8406
8384
  });
8407
8385
  }, [dispatch]);
8408
- var _9 = useState(0),
8409
- attempt = _9[0],
8410
- setAttempt = _9[1];
8386
+ var _8 = useState(0),
8387
+ attempt = _8[0],
8388
+ setAttempt = _8[1];
8411
8389
  var onExit = useCallback(function () {
8412
8390
  releaseCameraAccess();
8413
8391
  setOverlayDismissed(false);
@@ -8498,9 +8476,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8498
8476
  });
8499
8477
  });
8500
8478
  }, [dispatch]);
8501
- var _10 = useState(false),
8502
- progressStarted = _10[0],
8503
- setProgressStarted = _10[1];
8479
+ var _9 = useState(false),
8480
+ progressStarted = _9[0],
8481
+ setProgressStarted = _9[1];
8504
8482
  useEffect(function () {
8505
8483
  if (state.captureState === 'capturing') {
8506
8484
  setProgressStarted(false);
@@ -12032,8 +12010,7 @@ var defaultVideoIdCaptureThresholds = {
12032
12010
  detection: {
12033
12011
  idCardFront: 0.4,
12034
12012
  idCardBack: 0.5,
12035
- passport: 0.3,
12036
- singlePage: 0.3
12013
+ passport: 0.3
12037
12014
  },
12038
12015
  focus: {
12039
12016
  idCardFront: {
@@ -12047,17 +12024,12 @@ var defaultVideoIdCaptureThresholds = {
12047
12024
  passport: {
12048
12025
  desktop: 0,
12049
12026
  mobile: 0
12050
- },
12051
- singlePage: {
12052
- desktop: 0,
12053
- mobile: 0
12054
12027
  }
12055
12028
  },
12056
12029
  goodFrames: {
12057
12030
  idCardFront: 1,
12058
12031
  idCardBack: 1,
12059
- passport: 1,
12060
- singlePage: 1
12032
+ passport: 1
12061
12033
  },
12062
12034
  flipShortcutThreshold: 0.7
12063
12035
  };
@@ -12129,7 +12101,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12129
12101
  stopIdModels = _18.stop,
12130
12102
  onIdPredictionMade = _18.onPredictionMade,
12131
12103
  setThresholds = _18.setThresholds,
12132
- setRequiredDocumentType = _18.setRequiredDocumentType,
12133
12104
  setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
12134
12105
  bestFrameDetails = _18.bestFrameDetails,
12135
12106
  resetBestFrame = _18.resetBestFrame,
@@ -12208,9 +12179,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12208
12179
  useEffect(function () {
12209
12180
  setThresholds(adjustedThresholds);
12210
12181
  }, [requestedAction, setThresholds, adjustedThresholds]);
12211
- useEffect(function () {
12212
- setRequiredDocumentType(requestedAction === 'SHOW_PASSPORT' ? 'passport' : requestedAction === 'SHOW_ID_BACK' ? 'idCardBack' : 'idCardFront');
12213
- }, [requestedAction, setRequiredDocumentType]);
12214
12182
  useEffect(function () {
12215
12183
  setDocumentDetectionBoundaries({
12216
12184
  top: 20,
@@ -12233,9 +12201,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12233
12201
  setGoodFramesCount = _28[1];
12234
12202
  var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
12235
12203
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
12236
- var _29 = useState(false),
12237
- isSinglePage = _29[0],
12238
- setIsSinglePage = _29[1];
12239
12204
  useEffect(function () {
12240
12205
  if (!idCaptureModelsEnabled || idModelError) return;
12241
12206
  onIdPredictionMade(function (prediction) {
@@ -12243,8 +12208,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12243
12208
  setCurrentDetectionScore(prediction.detectionScore);
12244
12209
  setCurrentDetectedDocumentType(prediction.detectedDocumentType);
12245
12210
  setCurrentFocusScore(prediction.focusScore);
12246
- setIsSinglePage(prediction.singlePageDetectionThresholdMet);
12247
- var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_BACK' ? prediction.idCardBackDetectionThresholdMet : prediction.idCardFrontDetectionThresholdMet || prediction.singlePageDetectionThresholdMet;
12211
+ var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
12248
12212
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
12249
12213
  var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
12250
12214
  if (shouldShortcutFlipAnimation) {
@@ -12255,9 +12219,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12255
12219
  } : 0);
12256
12220
  });
12257
12221
  }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
12258
- var _30 = useState(null),
12259
- idFrontCaptureStartedAt = _30[0],
12260
- setFirstGoodFrameTime = _30[1];
12222
+ var _29 = useState(null),
12223
+ idFrontCaptureStartedAt = _29[0],
12224
+ setFirstGoodFrameTime = _29[1];
12261
12225
  useEffect(function () {
12262
12226
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
12263
12227
  }, [goodFramesCount]);
@@ -12278,60 +12242,80 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12278
12242
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
12279
12243
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
12280
12244
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
12281
- var _31 = useState(),
12282
- countdownStartedAt = _31[0],
12283
- setCountdownStartedAt = _31[1];
12245
+ var _30 = useState(),
12246
+ countdownStartedAt = _30[0],
12247
+ setCountdownStartedAt = _30[1];
12284
12248
  var photoCanvas = useRef(null);
12285
12249
  var frameLock = useRef(false);
12286
12250
  var captureFrame = useCallback(function () {
12287
12251
  return __awaiter(void 0, void 0, void 0, function () {
12288
- var frameBase64;
12289
- return __generator(this, function (_a) {
12290
- if (frameLock.current) return [2 /*return*/];
12291
- frameLock.current = true;
12292
- drawToCanvas(photoCanvas.current, videoRef.current);
12293
- frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
12294
- if (!frameBase64) {
12295
- frameLock.current = false;
12296
- return [2 /*return*/];
12297
- }
12298
- try {
12299
- if (requestedAction == 'SHOW_ID_FRONT') {
12252
+ var frameBase64, _a;
12253
+ return __generator(this, function (_b) {
12254
+ switch (_b.label) {
12255
+ case 0:
12256
+ if (frameLock.current) return [2 /*return*/];
12257
+ frameLock.current = true;
12258
+ drawToCanvas(photoCanvas.current, videoRef.current);
12259
+ frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
12260
+ if (!frameBase64) {
12261
+ frameLock.current = false;
12262
+ return [2 /*return*/];
12263
+ }
12264
+ _b.label = 1;
12265
+ case 1:
12266
+ _b.trys.push([1,, 7, 8]);
12267
+ if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
12300
12268
  if (onIdFrontImageCaptured) {
12301
12269
  onIdFrontImageCaptured(frameBase64);
12302
12270
  }
12303
- if (isSinglePage || evaluateShouldSkip(skipShowIdCardBack)) {
12271
+ if (!skipShowIdCardBack) return [3 /*break*/, 4];
12272
+ _a = skipShowIdCardBack === true;
12273
+ if (_a) return [3 /*break*/, 3];
12274
+ return [4 /*yield*/, skipShowIdCardBack()];
12275
+ case 2:
12276
+ _a = _b.sent();
12277
+ _b.label = 3;
12278
+ case 3:
12279
+ if (_a) {
12304
12280
  return [2 /*return*/, onIdCaptureComplete()];
12305
12281
  }
12282
+ _b.label = 4;
12283
+ case 4:
12306
12284
  setRequestedAction('FLIP_ID');
12307
- } else if (requestedAction == 'SHOW_ID_BACK') {
12308
- if (onIdBackImageCaptured) {
12309
- onIdBackImageCaptured(frameBase64);
12285
+ return [3 /*break*/, 6];
12286
+ case 5:
12287
+ if (requestedAction == 'SHOW_ID_BACK') {
12288
+ if (onIdBackImageCaptured) {
12289
+ onIdBackImageCaptured(frameBase64);
12290
+ }
12291
+ onIdCaptureComplete();
12292
+ } else if (requestedAction == 'SHOW_PASSPORT') {
12293
+ if (onIdFrontImageCaptured) {
12294
+ onIdFrontImageCaptured(frameBase64);
12295
+ }
12296
+ onIdCaptureComplete();
12310
12297
  }
12311
- onIdCaptureComplete();
12312
- } else if (requestedAction == 'SHOW_PASSPORT') {
12313
- if (onIdFrontImageCaptured) {
12314
- onIdFrontImageCaptured(frameBase64);
12298
+ _b.label = 6;
12299
+ case 6:
12300
+ return [3 /*break*/, 8];
12301
+ case 7:
12302
+ setDetectedObjects([]);
12303
+ setCurrentDetectionScore(0);
12304
+ setCurrentFocusScore(0);
12305
+ setGoodFramesCount(0);
12306
+ setCountdownStartedAt(undefined);
12307
+ resetBestFrame();
12308
+ frameLock.current = false;
12309
+ if (countdownTimeoutRef.current) {
12310
+ clearTimeout(countdownTimeoutRef.current);
12315
12311
  }
12316
- onIdCaptureComplete();
12317
- }
12318
- } finally {
12319
- setDetectedObjects([]);
12320
- setCurrentDetectionScore(0);
12321
- setCurrentFocusScore(0);
12322
- setGoodFramesCount(0);
12323
- setCountdownStartedAt(undefined);
12324
- setIsSinglePage(false);
12325
- resetBestFrame();
12326
- frameLock.current = false;
12327
- if (countdownTimeoutRef.current) {
12328
- clearTimeout(countdownTimeoutRef.current);
12329
- }
12312
+ return [7 /*endfinally*/];
12313
+ case 8:
12314
+ return [2 /*return*/];
12330
12315
  }
12331
- return [2 /*return*/];
12332
12316
  });
12333
12317
  });
12334
- }, [videoRef, requestedAction, onIdFrontImageCaptured, isSinglePage, skipShowIdCardBack, onIdCaptureComplete, onIdBackImageCaptured, resetBestFrame]);
12318
+ }, [onIdCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
12335
12319
  var isFlipping = requestedAction === 'FLIP_ID';
12336
12320
  useEffect(function () {
12337
12321
  if (!isFlipping) return;
@@ -12390,9 +12374,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12390
12374
  stopSelfieGuidance();
12391
12375
  };
12392
12376
  }, [startSelfieGuidance, stopSelfieGuidance]);
12393
- var _32 = useState(0),
12394
- numFramesWithoutFaces = _32[0],
12395
- setNumFramesWithoutFaces = _32[1];
12377
+ var _31 = useState(0),
12378
+ numFramesWithoutFaces = _31[0],
12379
+ setNumFramesWithoutFaces = _31[1];
12396
12380
  onSelfiePredictionMade(useThrottledCallback(useCallback(function (_a) {
12397
12381
  var face = _a.face;
12398
12382
  if (selfieModelError) return;
@@ -12408,12 +12392,12 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12408
12392
  }
12409
12393
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
12410
12394
  var theme = useTheme();
12411
- var _33 = useTranslations(rawVerbiage, {
12395
+ var _32 = useTranslations(rawVerbiage, {
12412
12396
  faceNotCenteredText: 'Please move your face to the center...',
12413
12397
  captureBtnText: 'Capture'
12414
12398
  }),
12415
- captureBtnText = _33.captureBtnText,
12416
- faceNotCenteredText = _33.faceNotCenteredText;
12399
+ captureBtnText = _32.captureBtnText,
12400
+ faceNotCenteredText = _32.faceNotCenteredText;
12417
12401
  var debugScalingDetails = useDebugScalingDetails({
12418
12402
  enabled: debugMode,
12419
12403
  pageWidth: width,
@@ -12488,11 +12472,6 @@ var CountdownContainer = styled.div(templateObject_1$5 || (templateObject_1$5 =
12488
12472
  var Countdown = styled.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"])));
12489
12473
  var CaptureButtonContainer = styled.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"])));
12490
12474
  var CaptureButton = styled(LoaderButton)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin: 0 auto 25px;\n"], ["\n margin: 0 auto 25px;\n"])));
12491
- function evaluateShouldSkip(value) {
12492
- if (value === true) return true;
12493
- if (typeof value === 'function') return value();
12494
- return false;
12495
- }
12496
12475
  var templateObject_1$5, templateObject_2$5, templateObject_3$5, templateObject_4;
12497
12476
 
12498
12477
  var IdVideoCaptureSuccess = function IdVideoCaptureSuccess(_a) {
@@ -12786,8 +12765,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12786
12765
  documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
12787
12766
  focusModelUrl: (_j = (_h = idCaptureProps.assets) === null || _h === void 0 ? void 0 : _h.focusModelUrl) !== null && _j !== void 0 ? _j : '',
12788
12767
  onModelError: onIdCaptureModelError,
12789
- modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
12790
- allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
12768
+ modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs
12791
12769
  }, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
12792
12770
  autoStart: false,
12793
12771
  onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
@@ -13037,8 +13015,7 @@ function CompositeWizard(_a) {
13037
13015
  documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
13038
13016
  focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
13039
13017
  onModelError: idCaptureProps.onModelError,
13040
- modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
13041
- allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
13018
+ modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs
13042
13019
  }, /*#__PURE__*/React__default.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React__default.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React__default.createElement(IdCaptureWizard, _assign({}, idCaptureProps, {
13043
13020
  onSuccess: onIdCaptureSuccess
13044
13021
  }))))));
@@ -13360,33 +13337,31 @@ var IdValidation = function IdValidation(_a) {
13360
13337
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
13361
13338
  _d = _a.idCaptureRequirement,
13362
13339
  idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
13363
- _e = _a.allowSinglePageIdCapture,
13364
- allowSinglePageIdCapture = _e === void 0 ? false : _e,
13365
- _f = _a.separateIdCardCaptureSequence,
13366
- separateIdCardCaptureSequence = _f === void 0 ? false : _f,
13367
- _g = _a.idCaptureThresholds,
13368
- idCaptureThresholds = _g === void 0 ? defaultIdCaptureThresholds : _g,
13369
- _h = _a.skipSuccessScreen,
13370
- skipSuccessScreen = _h === void 0 ? false : _h,
13340
+ _e = _a.separateIdCardCaptureSequence,
13341
+ separateIdCardCaptureSequence = _e === void 0 ? false : _e,
13342
+ _f = _a.idCaptureThresholds,
13343
+ idCaptureThresholds = _f === void 0 ? defaultIdCaptureThresholds : _f,
13344
+ _g = _a.skipSuccessScreen,
13345
+ skipSuccessScreen = _g === void 0 ? false : _g,
13371
13346
  instructions = _a.instructions,
13372
- _j = _a.guideType,
13373
- guideType = _j === void 0 ? 'fit' : _j,
13374
- _k = _a.guideImages,
13375
- guideImages = _k === void 0 ? defaultIdCaptureGuideImages : _k,
13376
- _l = _a.portraitGuidesOnMobile,
13377
- portraitGuidesOnMobile = _l === void 0 ? true : _l,
13378
- _m = _a.rotateLoadingOverlayImageWhenPortrait,
13379
- rotateLoadingOverlayImageWhenPortrait = _m === void 0 ? true : _m,
13380
- _o = _a.modelLoadTimeoutMs,
13381
- modelLoadTimeoutMs = _o === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _o,
13382
- _p = _a.forceFallbackMode,
13383
- forceFallbackMode = _p === void 0 ? false : _p,
13384
- _q = _a.allowIdCardBackToFrontCapture,
13385
- allowIdCardBackToFrontCapture = _q === void 0 ? false : _q,
13386
- _r = _a.enableOverrideWrongDocumentTypeDialog,
13387
- enableOverrideWrongDocumentTypeDialog = _r === void 0 ? false : _r,
13388
- _s = _a.allowOverrideWrongDocumentTypeAfterMs,
13389
- allowOverrideWrongDocumentTypeAfterMs = _s === void 0 ? 8000 : _s,
13347
+ _h = _a.guideType,
13348
+ guideType = _h === void 0 ? 'fit' : _h,
13349
+ _j = _a.guideImages,
13350
+ guideImages = _j === void 0 ? defaultIdCaptureGuideImages : _j,
13351
+ _k = _a.portraitGuidesOnMobile,
13352
+ portraitGuidesOnMobile = _k === void 0 ? true : _k,
13353
+ _l = _a.rotateLoadingOverlayImageWhenPortrait,
13354
+ rotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
13355
+ _m = _a.modelLoadTimeoutMs,
13356
+ modelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
13357
+ _o = _a.forceFallbackMode,
13358
+ forceFallbackMode = _o === void 0 ? false : _o,
13359
+ _p = _a.allowIdCardBackToFrontCapture,
13360
+ allowIdCardBackToFrontCapture = _p === void 0 ? false : _p,
13361
+ _q = _a.enableOverrideWrongDocumentTypeDialog,
13362
+ enableOverrideWrongDocumentTypeDialog = _q === void 0 ? false : _q,
13363
+ _r = _a.allowOverrideWrongDocumentTypeAfterMs,
13364
+ allowOverrideWrongDocumentTypeAfterMs = _r === void 0 ? 8000 : _r,
13390
13365
  onBeforeSubmit = _a.onBeforeSubmit,
13391
13366
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
13392
13367
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -13400,28 +13375,28 @@ var IdValidation = function IdValidation(_a) {
13400
13375
  onUserCancel = _a.onUserCancel,
13401
13376
  onModelError = _a.onModelError,
13402
13377
  onCameraAccessDenied = _a.onCameraAccessDenied,
13403
- _t = _a.theme,
13404
- theme = _t === void 0 ? 'default' : _t,
13405
- _u = _a.assets,
13406
- assets = _u === void 0 ? {} : _u,
13407
- _v = _a.classNames,
13408
- classNames = _v === void 0 ? {} : _v,
13409
- _w = _a.colors,
13410
- colors = _w === void 0 ? {} : _w,
13411
- _x = _a.verbiage,
13412
- verbiage = _x === void 0 ? {} : _x,
13413
- _y = _a.captureSignature,
13414
- captureSignature = _y === void 0 ? false : _y,
13415
- _z = _a.captureSignatureVideo,
13416
- captureSignatureVideo = _z === void 0 ? false : _z,
13417
- _0 = _a.captureAdditionalDocuments,
13418
- captureAdditionalDocuments = _0 === void 0 ? [] : _0,
13419
- _1 = _a.geolocationEnabled,
13420
- geolocationEnabled = _1 === void 0 ? true : _1,
13421
- _2 = _a.geolocationRequired,
13422
- geolocationRequired = _2 === void 0 ? false : _2,
13423
- _3 = _a.debugMode,
13424
- debugMode = _3 === void 0 ? false : _3;
13378
+ _s = _a.theme,
13379
+ theme = _s === void 0 ? 'default' : _s,
13380
+ _t = _a.assets,
13381
+ assets = _t === void 0 ? {} : _t,
13382
+ _u = _a.classNames,
13383
+ classNames = _u === void 0 ? {} : _u,
13384
+ _v = _a.colors,
13385
+ colors = _v === void 0 ? {} : _v,
13386
+ _w = _a.verbiage,
13387
+ verbiage = _w === void 0 ? {} : _w,
13388
+ _x = _a.captureSignature,
13389
+ captureSignature = _x === void 0 ? false : _x,
13390
+ _y = _a.captureSignatureVideo,
13391
+ captureSignatureVideo = _y === void 0 ? false : _y,
13392
+ _z = _a.captureAdditionalDocuments,
13393
+ captureAdditionalDocuments = _z === void 0 ? [] : _z,
13394
+ _0 = _a.geolocationEnabled,
13395
+ geolocationEnabled = _0 === void 0 ? true : _0,
13396
+ _1 = _a.geolocationRequired,
13397
+ geolocationRequired = _1 === void 0 ? false : _1,
13398
+ _2 = _a.debugMode,
13399
+ debugMode = _2 === void 0 ? false : _2;
13425
13400
  useLanguage(lang);
13426
13401
  useDebugLogging(debugMode);
13427
13402
  var idCaptureProps = useMemo(function () {
@@ -13431,7 +13406,6 @@ var IdValidation = function IdValidation(_a) {
13431
13406
  onModelError: onModelError,
13432
13407
  precapturedDocuments: precapturedDocuments,
13433
13408
  captureRequirement: idCaptureRequirement,
13434
- allowSinglePageIdCapture: allowSinglePageIdCapture,
13435
13409
  separateIdCardCaptureSequence: separateIdCardCaptureSequence,
13436
13410
  thresholds: idCaptureThresholds,
13437
13411
  skipSuccessScreen: skipSuccessScreen,
@@ -13454,7 +13428,7 @@ var IdValidation = function IdValidation(_a) {
13454
13428
  verbiage: verbiage,
13455
13429
  debugMode: debugMode
13456
13430
  };
13457
- }, [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]);
13431
+ }, [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]);
13458
13432
  var additionalDocumentCaptureProps = useMemo(function () {
13459
13433
  return {
13460
13434
  documents: captureAdditionalDocuments,