idmission-web-sdk 2.2.69 → 2.2.70

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 +3 -1
  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 +2 -1
  10. package/dist/components/id_capture/IdCaptureModelsProvider.d.ts.map +1 -1
  11. package/dist/components/id_capture/IdCaptureRequirementOption.d.ts +7 -5
  12. package/dist/components/id_capture/IdCaptureRequirementOption.d.ts.map +1 -1
  13. package/dist/components/id_capture/IdCaptureStateProvider.d.ts +4 -0
  14. package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
  15. package/dist/components/id_capture/IdCaptureSuccess.d.ts +0 -4
  16. package/dist/components/id_capture/IdCaptureSuccess.d.ts.map +1 -1
  17. package/dist/components/id_capture/IdCaptureWizard.d.ts +2 -1
  18. package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
  19. package/dist/components/video_id/IdVideoCapture.d.ts +2 -0
  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 +6 -2
  23. package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
  24. package/dist/lib/models/Focus.d.ts +4 -0
  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 +353 -327
  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 +353 -327
  32. package/dist/sdk2.esm.js.map +1 -1
  33. package/dist/sdk2.umd.development.js +353 -327
  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
@@ -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.69';
237
+ var webSdkVersion = '2.2.70';
238
238
 
239
239
  function getPlatform() {
240
240
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -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-20241018_093000.tflite");
2300
+ var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20250108_165023.tflite");
2301
2301
 
2302
2302
  var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
2303
2303
 
@@ -2316,6 +2316,10 @@ var defaultFocusThresholds = {
2316
2316
  passport: {
2317
2317
  desktop: 0,
2318
2318
  mobile: 0.3
2319
+ },
2320
+ singlePage: {
2321
+ desktop: 0,
2322
+ mobile: 0.3
2319
2323
  }
2320
2324
  };
2321
2325
  var classifier = null;
@@ -2941,16 +2945,19 @@ var defaultDocumentDetectionThresholds = {
2941
2945
  idCardFront: 0.6,
2942
2946
  idCardBack: 0.6,
2943
2947
  passport: 0.4,
2948
+ singlePage: 0.4,
2944
2949
  stability: {
2945
2950
  idCardFront: 0.85,
2946
2951
  idCardBack: 0.85,
2947
- passport: 0.5
2952
+ passport: 0.5,
2953
+ singlePage: 0.5
2948
2954
  }
2949
2955
  };
2950
2956
  var documentTypeDisplayNames = {
2951
2957
  idCardFront: 'ID card front',
2952
2958
  idCardBack: 'ID card back',
2953
2959
  passport: 'Passport',
2960
+ singlePage: 'Single page',
2954
2961
  none: 'None'
2955
2962
  };
2956
2963
  var detector = null;
@@ -3139,7 +3146,7 @@ var defaultDocumentDetectionBoundaries = {
3139
3146
  right: 20
3140
3147
  };
3141
3148
  function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3142
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3149
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
3143
3150
  if (boundaries === void 0) {
3144
3151
  boundaries = defaultDocumentDetectionBoundaries;
3145
3152
  }
@@ -3190,18 +3197,25 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3190
3197
  var bestPassportPage = detectedObjects.find(function (obj) {
3191
3198
  return obj.label === 'Passport page';
3192
3199
  });
3200
+ var bestSinglePage = detectedObjects.find(function (obj) {
3201
+ return obj.label === 'Single page';
3202
+ });
3193
3203
  var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
3194
3204
  var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
3195
3205
  var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 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;
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;
3202
3214
  var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
3203
3215
  var detectedDocumentType = 'none';
3204
- if (passportDetectionThresholdMet) {
3216
+ if (singlePageDetectionThresholdMet) {
3217
+ detectedDocumentType = 'singlePage';
3218
+ } else if (passportDetectionThresholdMet) {
3205
3219
  detectedDocumentType = 'passport';
3206
3220
  } else if (idCardBackDetectionThresholdMet) {
3207
3221
  detectedDocumentType = 'idCardBack';
@@ -3215,12 +3229,12 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3215
3229
  var documentIsStable = false;
3216
3230
  var documentTooClose = false;
3217
3231
  if (bestDocument) {
3218
- var _o = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
3219
- docWidth = _o[0],
3220
- docHeight = _o[1];
3232
+ var _q = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
3233
+ docWidth = _q[0],
3234
+ docHeight = _q[1];
3221
3235
  documentTooClose = docWidth > 0.85 || docHeight > 0.85;
3222
3236
  if (detectionThresholdMet && documentInBounds && !documentTooClose) {
3223
- var thresholdSet = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
3237
+ var thresholdSet = (_p = thresholds.stability) !== null && _p !== void 0 ? _p : defaultDocumentDetectionThresholds.stability;
3224
3238
  var threshold_1 = thresholdSet[detectedDocumentType];
3225
3239
  var framesNeeded = Math.ceil(average(framesNeededSamples));
3226
3240
  trackBox(bestDocument.box, framesNeeded);
@@ -3242,6 +3256,8 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3242
3256
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
3243
3257
  passportDetectionScore: passportDetectionScore,
3244
3258
  passportDetectionThresholdMet: passportDetectionThresholdMet,
3259
+ singlePageDetectionScore: singlePageDetectionScore,
3260
+ singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
3245
3261
  bestDocument: bestDocument,
3246
3262
  documentInBounds: documentInBounds,
3247
3263
  documentTooClose: documentTooClose,
@@ -4134,37 +4150,39 @@ var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
4134
4150
  });
4135
4151
  function IdCaptureModelsProviderInner(_a) {
4136
4152
  var children = _a.children,
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;
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;
4160
4178
  var onPredictionHandler = React.useRef();
4161
4179
  var bestFrameDetails = React.useRef(null);
4162
4180
  var bestPredictionCanvas = React.useRef(null);
4163
4181
  var bestFocusScore = React.useRef(0);
4164
4182
  var stopDetection = React.useRef(0);
4165
- var _d = React.useState('none'),
4166
- requiredDocumentType = _d[0],
4167
- setRequiredDocumentType = _d[1];
4183
+ var _e = React.useState('none'),
4184
+ requiredDocumentType = _e[0],
4185
+ setRequiredDocumentType = _e[1];
4168
4186
  var thresholds = React.useMemo(function () {
4169
4187
  return _assign(_assign({}, documentDetectionThresholds), {
4170
4188
  focus: focusThresholds
@@ -4182,34 +4200,42 @@ function IdCaptureModelsProviderInner(_a) {
4182
4200
  var _this = this;
4183
4201
  onDocumentDetected(function (prediction) {
4184
4202
  return __awaiter(_this, void 0, void 0, function () {
4185
- var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4186
- var _a, _b, _c, _d, _e, _f;
4187
- return __generator(this, function (_g) {
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) {
4188
4206
  if (!lastPredictionCanvas.current) return [2 /*return*/];
4189
4207
  stopDetectionAtStart = stopDetection.current;
4190
4208
  focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
4191
- isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType));
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'));
4192
4218
  if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
4193
- focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_b = prediction.bestDocument) === null || _b === void 0 ? void 0 : _b.box);
4219
+ focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
4194
4220
  if (focusPrediction) {
4195
4221
  focusScore = focusPrediction.score;
4196
4222
  focusPredictionTime = focusPrediction.predictionTime;
4197
4223
  }
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;
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;
4200
4226
  focusThresholdMet = focusScore >= focusThreshold;
4201
4227
  if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
4202
4228
  bestFocusScore.current = focusScore;
4203
4229
  drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
4204
4230
  bestFrameDetails.current = {
4205
- boundingBox: (_e = prediction.bestDocument) === null || _e === void 0 ? void 0 : _e.box,
4231
+ boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
4206
4232
  documentType: prediction.detectedDocumentType,
4207
4233
  detectionScore: prediction.detectionScore,
4208
4234
  focusScore: focusScore
4209
4235
  };
4210
4236
  }
4211
4237
  }
4212
- (_f = onPredictionHandler.current) === null || _f === void 0 ? void 0 : _f.call(onPredictionHandler, _assign(_assign({}, prediction), {
4238
+ (_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
4213
4239
  focusScore: focusScore,
4214
4240
  focusPredictionTime: focusPredictionTime,
4215
4241
  focusThresholdMet: focusThresholdMet
@@ -4218,7 +4244,7 @@ function IdCaptureModelsProviderInner(_a) {
4218
4244
  });
4219
4245
  });
4220
4246
  });
4221
- }, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4247
+ }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4222
4248
  var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
4223
4249
  React.useEffect(function handleModelErrors() {
4224
4250
  if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
@@ -4232,9 +4258,9 @@ function IdCaptureModelsProviderInner(_a) {
4232
4258
  canvas: bestPredictionCanvas.current
4233
4259
  });
4234
4260
  }, []);
4235
- var _e = React.useState(0),
4236
- canvasKey = _e[0],
4237
- setCanvasKey = _e[1];
4261
+ var _f = React.useState(0),
4262
+ canvasKey = _f[0],
4263
+ setCanvasKey = _f[1];
4238
4264
  var resetBestFrame = React.useCallback(function () {
4239
4265
  stopDetection.current += 1;
4240
4266
  setCanvasKey(function (n) {
@@ -4281,9 +4307,9 @@ function IdCaptureModelsProvider(_a) {
4281
4307
  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)));
4282
4308
  }
4283
4309
 
4284
- var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'selfie'];
4310
+ var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
4285
4311
 
4286
- var requiredDocumentsForOption = {
4312
+ var acceptedDocumentTypesForIdCaptureRequirementOption = {
4287
4313
  idCardFront: ['idCardFront'],
4288
4314
  idCardBack: ['idCardBack'],
4289
4315
  passport: ['passport'],
@@ -4291,13 +4317,31 @@ var requiredDocumentsForOption = {
4291
4317
  idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
4292
4318
  idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
4293
4319
  };
4294
- function requiredImageCountForOption(idCaptureRequirement) {
4320
+ function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4295
4321
  if (idCaptureRequirement === 'idCardOrPassport') return 1;
4296
- return requiredDocumentsForOption[idCaptureRequirement].length;
4322
+ return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
4297
4323
  }
4298
- function allowedImageCountForOption(idCaptureRequirement) {
4324
+ function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4299
4325
  if (idCaptureRequirement === 'idCardOrPassport') return 2;
4300
- return requiredImageCountForOption(idCaptureRequirement);
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
+ });
4301
4345
  }
4302
4346
 
4303
4347
  var initialState$4 = {
@@ -4336,6 +4380,8 @@ var initialState$4 = {
4336
4380
  idCardBackDetectionThresholdMet: false,
4337
4381
  passportDetectionScore: 0,
4338
4382
  passportDetectionThresholdMet: false,
4383
+ singlePageDetectionScore: 0,
4384
+ singlePageDetectionThresholdMet: false,
4339
4385
  focusScore: 0,
4340
4386
  focusThresholdMet: false,
4341
4387
  isGoodFrame: false,
@@ -4351,6 +4397,7 @@ var initialState$4 = {
4351
4397
  capturedDocuments: {},
4352
4398
  captureRequirement: 'idCardOrPassport',
4353
4399
  requestedDocumentType: 'idCardFront',
4400
+ allowSinglePageIdCapture: false,
4354
4401
  allowIdCardBackToFrontCapture: false,
4355
4402
  operationStartedAt: null,
4356
4403
  captureStartedAt: null
@@ -4365,11 +4412,13 @@ var _reducer = function reducer(state, action) {
4365
4412
  var _c = action.payload,
4366
4413
  captureRequirement = _c.captureRequirement,
4367
4414
  precapturedDocuments = _c.precapturedDocuments,
4415
+ allowSinglePageIdCapture = _c.allowSinglePageIdCapture,
4368
4416
  allowIdCardBackToFrontCapture = _c.allowIdCardBackToFrontCapture,
4369
4417
  enableOverrideWrongDocumentTypeDialog = _c.enableOverrideWrongDocumentTypeDialog,
4370
4418
  allowOverrideWrongDocumentTypeAfterMs = _c.allowOverrideWrongDocumentTypeAfterMs;
4371
4419
  var newState = _assign(_assign({}, state), {
4372
4420
  captureRequirement: captureRequirement,
4421
+ allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
4373
4422
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
4374
4423
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
4375
4424
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
@@ -4437,6 +4486,8 @@ var _reducer = function reducer(state, action) {
4437
4486
  idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
4438
4487
  passportDetectionScore = _d.passportDetectionScore,
4439
4488
  passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
4489
+ singlePageDetectionScore = _d.singlePageDetectionScore,
4490
+ singlePageDetectionThresholdMet = _d.singlePageDetectionThresholdMet,
4440
4491
  bestDocument = _d.bestDocument,
4441
4492
  documentInBounds = _d.documentInBounds,
4442
4493
  documentTooClose = _d.documentTooClose,
@@ -4457,7 +4508,8 @@ var _reducer = function reducer(state, action) {
4457
4508
  }
4458
4509
  }
4459
4510
  }
4460
- var idCardDetectedButNotAllowed = detectedDocumentType.includes('idCard') && !state.captureRequirement.includes('idCard');
4511
+ var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
4512
+ var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
4461
4513
  var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
4462
4514
  var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
4463
4515
  var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
@@ -4517,6 +4569,8 @@ var _reducer = function reducer(state, action) {
4517
4569
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
4518
4570
  passportDetectionScore: passportDetectionScore,
4519
4571
  passportDetectionThresholdMet: passportDetectionThresholdMet,
4572
+ singlePageDetectionScore: singlePageDetectionScore,
4573
+ singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
4520
4574
  focusScore: focusScore,
4521
4575
  focusThresholdMet: focusThresholdMet,
4522
4576
  isGoodFrame: isGoodFrame,
@@ -4554,7 +4608,7 @@ var _reducer = function reducer(state, action) {
4554
4608
  });
4555
4609
  case 'documentCaptured':
4556
4610
  {
4557
- var newState_1 = _assign(_assign({}, state), {
4611
+ var newState = _assign(_assign({}, state), {
4558
4612
  capturing: false,
4559
4613
  captureFailed: false,
4560
4614
  allowOverrideFlipRequirement: false,
@@ -4563,64 +4617,42 @@ var _reducer = function reducer(state, action) {
4563
4617
  wrongDocumentTypePredictions: 0,
4564
4618
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
4565
4619
  });
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
- }
4620
+ var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4578
4621
  if (remainingRequirements.length === 0) {
4579
- newState_1.captureState = 'complete';
4622
+ newState.captureState = 'complete';
4580
4623
  } else {
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;
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;
4588
4631
  }
4589
4632
  }
4590
- return newState_1;
4633
+ return newState;
4591
4634
  }
4592
4635
  case 'documentCapturedManually':
4593
4636
  {
4594
- var newState_2 = _assign(_assign({}, state), {
4637
+ var newState = _assign(_assign({}, state), {
4595
4638
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_b = {}, _b[state.requestedDocumentType] = _assign(_assign({}, action.payload), {
4596
4639
  width: 0,
4597
4640
  height: 0
4598
4641
  }), _b))
4599
4642
  });
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
- }
4643
+ var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4612
4644
  if (remainingRequirements.length === 0) {
4613
- newState_2.captureState = 'complete';
4645
+ newState.captureState = 'complete';
4614
4646
  } else {
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;
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;
4621
4653
  }
4622
4654
  }
4623
- return newState_2;
4655
+ return newState;
4624
4656
  }
4625
4657
  case 'flipRequestCompleted':
4626
4658
  return _assign(_assign({}, state), {
@@ -5221,7 +5253,7 @@ var IdCapture = function IdCapture(_a) {
5221
5253
  imageUrl: imageUrl
5222
5254
  }
5223
5255
  });
5224
- var capturedDocumentType = documentType === 'passport' ? 'passport' : state.requestedDocumentType;
5256
+ var capturedDocumentType = documentType;
5225
5257
  setTimeout(function () {
5226
5258
  var _a;
5227
5259
  var captureTime = new Date().getTime() - ((_a = state.captureStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
@@ -5288,7 +5320,7 @@ var IdCapture = function IdCapture(_a) {
5288
5320
  scaling: debugScalingDetails,
5289
5321
  flipX: !isRearFacing
5290
5322
  });
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")))));
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")))));
5292
5324
  };
5293
5325
  var timeSince = function timeSince(t) {
5294
5326
  if (!t) return 0;
@@ -6327,15 +6359,8 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6327
6359
  _e = _a.debugMode,
6328
6360
  debugMode = _e === void 0 ? false : _e;
6329
6361
  var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
6330
- var idCardFront = capturedDocuments.idCardFront,
6331
- idCardBack = capturedDocuments.idCardBack,
6332
- passport = capturedDocuments.passport;
6333
6362
  var verbiage = useTranslations(rawVerbiage, {
6334
6363
  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.',
6339
6364
  retryText: 'Retry',
6340
6365
  submittingText: 'Submitting...',
6341
6366
  submitText: 'Done'
@@ -6352,25 +6377,16 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6352
6377
  className: classNames.imageContainer
6353
6378
  }, /*#__PURE__*/React__namespace.default.createElement(ImageRow, {
6354
6379
  className: classNames.imageRow
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, {
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, {
6374
6390
  className: classNames.buttonsRow
6375
6391
  }, /*#__PURE__*/React__namespace.default.createElement(WideButton, {
6376
6392
  className: classNames.submitBtn,
@@ -6389,7 +6405,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6389
6405
  };
6390
6406
  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"])));
6391
6407
  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"])));
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"])));
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"])));
6393
6409
  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"])));
6394
6410
  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"])));
6395
6411
  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"])));
@@ -8099,8 +8115,8 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8099
8115
  var _j = React.useState(silentFallback),
8100
8116
  useFallback = _j[0],
8101
8117
  setUseFallback = _j[1];
8102
- var allowedImageCount = allowedImageCountForOption(idCaptureRequirement);
8103
- var requiredImageCount = requiredImageCountForOption(idCaptureRequirement);
8118
+ var minImageCount = minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
8119
+ var maxImageCount = maxImageCountForIdCaptureRequirementOption(idCaptureRequirement);
8104
8120
  var _k = useFileState(),
8105
8121
  rawFile = _k.rawFile,
8106
8122
  fileInputOnChange = _k.fileInputOnChange;
@@ -8113,7 +8129,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8113
8129
  var whatToCapture = idCaptureRequirement === 'idCard' ? 'ID card' : idCaptureRequirement === 'passport' ? 'passport' : idCaptureRequirement === 'idCardOrPassport' ? 'ID card or passport' : 'ID card and passport';
8114
8130
  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.';
8115
8131
  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.';
8116
- var descriptionText = "On-device capture guidance failed, please capture ".concat(requiredImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
8132
+ var descriptionText = "On-device capture guidance failed, please capture ".concat(minImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
8117
8133
  var verbiage = useTranslations(rawVerbiage, {
8118
8134
  headingText: "We're having some trouble.",
8119
8135
  descriptionText: descriptionText,
@@ -8187,7 +8203,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8187
8203
  alt: "",
8188
8204
  className: classNames.image
8189
8205
  }));
8190
- }))), images.length < requiredImageCount && ( /*#__PURE__*/React__namespace.default.createElement(Instruction, {
8206
+ }))), images.length < minImageCount && ( /*#__PURE__*/React__namespace.default.createElement(Instruction, {
8191
8207
  className: classNames.instruction
8192
8208
  }, instructionText)), /*#__PURE__*/React__namespace.default.createElement("input", {
8193
8209
  ref: fileInput,
@@ -8198,7 +8214,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8198
8214
  hidden: true
8199
8215
  }), /*#__PURE__*/React__namespace.default.createElement(StyledButtonsRow$8, {
8200
8216
  className: classNames.buttonsRow
8201
- }, images.length < allowedImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8217
+ }, images.length < maxImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8202
8218
  variant: images.length > 0 ? 'secondary' : 'positive',
8203
8219
  className: images.length > 0 ? classNames.captureMoreBtn : classNames.captureBtn,
8204
8220
  colors: images.length > 0 ? colors.captureMoreBtn : colors.captureBtn,
@@ -8211,7 +8227,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8211
8227
  setDocumentToCapture(instructionText);
8212
8228
  }
8213
8229
  }
8214
- }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= requiredImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8230
+ }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= minImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8215
8231
  variant: "positive",
8216
8232
  className: classNames.doneBtn,
8217
8233
  colors: colors.doneBtn,
@@ -8258,79 +8274,82 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8258
8274
  precapturedDocuments = _a.precapturedDocuments,
8259
8275
  _j = _a.captureRequirement,
8260
8276
  captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
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,
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,
8267
8285
  instructions = _a.instructions,
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;
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;
8322
8340
  React.useEffect(function () {
8323
8341
  dispatch({
8324
8342
  type: 'configureWizard',
8325
8343
  payload: {
8326
8344
  captureRequirement: captureRequirement,
8327
8345
  precapturedDocuments: precapturedDocuments,
8346
+ allowSinglePageIdCapture: allowSinglePageIdCapture,
8328
8347
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
8329
8348
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
8330
8349
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
8331
8350
  }
8332
8351
  });
8333
- }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8352
+ }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8334
8353
  var documentCount = Object.keys(state.capturedDocuments).length;
8335
8354
  React.useEffect(function () {
8336
8355
  if (documentCount) resetBestFrame();
@@ -8392,13 +8411,16 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8392
8411
  var _a = state.capturedDocuments,
8393
8412
  idCardFront = _a.idCardFront,
8394
8413
  idCardBack = _a.idCardBack,
8395
- passport = _a.passport;
8414
+ passport = _a.passport,
8415
+ singlePage = _a.singlePage;
8396
8416
  var idFrontImage = idCardFront && dataUrlToBase64Sync(idCardFront.imageData);
8397
8417
  var idBackImage = idCardBack && dataUrlToBase64Sync(idCardBack.imageData);
8398
8418
  var passportImage = passport && dataUrlToBase64Sync(passport.imageData);
8419
+ var singlePageImage = singlePage && dataUrlToBase64Sync(singlePage.imageData);
8399
8420
  if (idFrontImage) setIdFrontImage(idFrontImage);
8400
8421
  if (idBackImage) setIdBackImage(idBackImage);
8401
8422
  if (passportImage) setPassportImage(passportImage);
8423
+ if (singlePageImage) setIdFrontImage(singlePageImage);
8402
8424
  if (releaseCameraAccessOnExit) releaseCameraAccess();
8403
8425
  setTimeout(function () {
8404
8426
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
@@ -8414,9 +8436,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8414
8436
  type: 'resetWizard'
8415
8437
  });
8416
8438
  }, [dispatch]);
8417
- var _8 = React.useState(0),
8418
- attempt = _8[0],
8419
- setAttempt = _8[1];
8439
+ var _9 = React.useState(0),
8440
+ attempt = _9[0],
8441
+ setAttempt = _9[1];
8420
8442
  var onExit = React.useCallback(function () {
8421
8443
  releaseCameraAccess();
8422
8444
  setOverlayDismissed(false);
@@ -8507,9 +8529,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8507
8529
  });
8508
8530
  });
8509
8531
  }, [dispatch]);
8510
- var _9 = React.useState(false),
8511
- progressStarted = _9[0],
8512
- setProgressStarted = _9[1];
8532
+ var _10 = React.useState(false),
8533
+ progressStarted = _10[0],
8534
+ setProgressStarted = _10[1];
8513
8535
  React.useEffect(function () {
8514
8536
  if (state.captureState === 'capturing') {
8515
8537
  setProgressStarted(false);
@@ -12041,7 +12063,8 @@ var defaultVideoIdCaptureThresholds = {
12041
12063
  detection: {
12042
12064
  idCardFront: 0.4,
12043
12065
  idCardBack: 0.5,
12044
- passport: 0.3
12066
+ passport: 0.3,
12067
+ singlePage: 0.3
12045
12068
  },
12046
12069
  focus: {
12047
12070
  idCardFront: {
@@ -12055,12 +12078,17 @@ var defaultVideoIdCaptureThresholds = {
12055
12078
  passport: {
12056
12079
  desktop: 0,
12057
12080
  mobile: 0
12081
+ },
12082
+ singlePage: {
12083
+ desktop: 0,
12084
+ mobile: 0
12058
12085
  }
12059
12086
  },
12060
12087
  goodFrames: {
12061
12088
  idCardFront: 1,
12062
12089
  idCardBack: 1,
12063
- passport: 1
12090
+ passport: 1,
12091
+ singlePage: 1
12064
12092
  },
12065
12093
  flipShortcutThreshold: 0.7
12066
12094
  };
@@ -12132,6 +12160,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12132
12160
  stopIdModels = _18.stop,
12133
12161
  onIdPredictionMade = _18.onPredictionMade,
12134
12162
  setThresholds = _18.setThresholds,
12163
+ setRequiredDocumentType = _18.setRequiredDocumentType,
12135
12164
  setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
12136
12165
  bestFrameDetails = _18.bestFrameDetails,
12137
12166
  resetBestFrame = _18.resetBestFrame,
@@ -12210,6 +12239,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12210
12239
  React.useEffect(function () {
12211
12240
  setThresholds(adjustedThresholds);
12212
12241
  }, [requestedAction, setThresholds, adjustedThresholds]);
12242
+ React.useEffect(function () {
12243
+ setRequiredDocumentType(requestedAction === 'SHOW_PASSPORT' ? 'passport' : requestedAction === 'SHOW_ID_BACK' ? 'idCardBack' : 'idCardFront');
12244
+ }, [requestedAction, setRequiredDocumentType]);
12213
12245
  React.useEffect(function () {
12214
12246
  setDocumentDetectionBoundaries({
12215
12247
  top: 20,
@@ -12232,6 +12264,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12232
12264
  setGoodFramesCount = _28[1];
12233
12265
  var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
12234
12266
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
12267
+ var _29 = React.useState(false),
12268
+ isSinglePage = _29[0],
12269
+ setIsSinglePage = _29[1];
12235
12270
  React.useEffect(function () {
12236
12271
  if (!idCaptureModelsEnabled || idModelError) return;
12237
12272
  onIdPredictionMade(function (prediction) {
@@ -12239,7 +12274,8 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12239
12274
  setCurrentDetectionScore(prediction.detectionScore);
12240
12275
  setCurrentDetectedDocumentType(prediction.detectedDocumentType);
12241
12276
  setCurrentFocusScore(prediction.focusScore);
12242
- var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
12277
+ setIsSinglePage(prediction.singlePageDetectionThresholdMet);
12278
+ var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_BACK' ? prediction.idCardBackDetectionThresholdMet : prediction.idCardFrontDetectionThresholdMet || prediction.singlePageDetectionThresholdMet;
12243
12279
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
12244
12280
  var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
12245
12281
  if (shouldShortcutFlipAnimation) {
@@ -12250,9 +12286,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12250
12286
  } : 0);
12251
12287
  });
12252
12288
  }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
12253
- var _29 = React.useState(null),
12254
- idFrontCaptureStartedAt = _29[0],
12255
- setFirstGoodFrameTime = _29[1];
12289
+ var _30 = React.useState(null),
12290
+ idFrontCaptureStartedAt = _30[0],
12291
+ setFirstGoodFrameTime = _30[1];
12256
12292
  React.useEffect(function () {
12257
12293
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
12258
12294
  }, [goodFramesCount]);
@@ -12273,80 +12309,60 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12273
12309
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
12274
12310
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
12275
12311
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
12276
- var _30 = React.useState(),
12277
- countdownStartedAt = _30[0],
12278
- setCountdownStartedAt = _30[1];
12312
+ var _31 = React.useState(),
12313
+ countdownStartedAt = _31[0],
12314
+ setCountdownStartedAt = _31[1];
12279
12315
  var photoCanvas = React.useRef(null);
12280
12316
  var frameLock = React.useRef(false);
12281
12317
  var captureFrame = React.useCallback(function () {
12282
12318
  return __awaiter(void 0, void 0, void 0, function () {
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];
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') {
12299
12331
  if (onIdFrontImageCaptured) {
12300
12332
  onIdFrontImageCaptured(frameBase64);
12301
12333
  }
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) {
12334
+ if (isSinglePage || evaluateShouldSkip(skipShowIdCardBack)) {
12311
12335
  return [2 /*return*/, onIdCaptureComplete()];
12312
12336
  }
12313
- _b.label = 4;
12314
- case 4:
12315
12337
  setRequestedAction('FLIP_ID');
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();
12338
+ } else if (requestedAction == 'SHOW_ID_BACK') {
12339
+ if (onIdBackImageCaptured) {
12340
+ onIdBackImageCaptured(frameBase64);
12328
12341
  }
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);
12342
+ onIdCaptureComplete();
12343
+ } else if (requestedAction == 'SHOW_PASSPORT') {
12344
+ if (onIdFrontImageCaptured) {
12345
+ onIdFrontImageCaptured(frameBase64);
12342
12346
  }
12343
- return [7 /*endfinally*/];
12344
- case 8:
12345
- return [2 /*return*/];
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
+ }
12346
12361
  }
12362
+ return [2 /*return*/];
12347
12363
  });
12348
12364
  });
12349
- }, [onIdCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
12365
+ }, [videoRef, requestedAction, onIdFrontImageCaptured, isSinglePage, skipShowIdCardBack, onIdCaptureComplete, onIdBackImageCaptured, resetBestFrame]);
12350
12366
  var isFlipping = requestedAction === 'FLIP_ID';
12351
12367
  React.useEffect(function () {
12352
12368
  if (!isFlipping) return;
@@ -12405,9 +12421,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12405
12421
  stopSelfieGuidance();
12406
12422
  };
12407
12423
  }, [startSelfieGuidance, stopSelfieGuidance]);
12408
- var _31 = React.useState(0),
12409
- numFramesWithoutFaces = _31[0],
12410
- setNumFramesWithoutFaces = _31[1];
12424
+ var _32 = React.useState(0),
12425
+ numFramesWithoutFaces = _32[0],
12426
+ setNumFramesWithoutFaces = _32[1];
12411
12427
  onSelfiePredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (_a) {
12412
12428
  var face = _a.face;
12413
12429
  if (selfieModelError) return;
@@ -12423,12 +12439,12 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12423
12439
  }
12424
12440
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
12425
12441
  var theme = styled.useTheme();
12426
- var _32 = useTranslations(rawVerbiage, {
12442
+ var _33 = useTranslations(rawVerbiage, {
12427
12443
  faceNotCenteredText: 'Please move your face to the center...',
12428
12444
  captureBtnText: 'Capture'
12429
12445
  }),
12430
- captureBtnText = _32.captureBtnText,
12431
- faceNotCenteredText = _32.faceNotCenteredText;
12446
+ captureBtnText = _33.captureBtnText,
12447
+ faceNotCenteredText = _33.faceNotCenteredText;
12432
12448
  var debugScalingDetails = useDebugScalingDetails({
12433
12449
  enabled: debugMode,
12434
12450
  pageWidth: width,
@@ -12503,6 +12519,11 @@ var CountdownContainer = styled__default.default.div(templateObject_1$5 || (temp
12503
12519
  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"])));
12504
12520
  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"])));
12505
12521
  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
+ }
12506
12527
  var templateObject_1$5, templateObject_2$5, templateObject_3$5, templateObject_4;
12507
12528
 
12508
12529
  var IdVideoCaptureSuccess = function IdVideoCaptureSuccess(_a) {
@@ -12800,7 +12821,8 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12800
12821
  documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
12801
12822
  focusModelUrl: (_j = (_h = idCaptureProps.assets) === null || _h === void 0 ? void 0 : _h.focusModelUrl) !== null && _j !== void 0 ? _j : '',
12802
12823
  onModelError: onIdCaptureModelError,
12803
- modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs
12824
+ modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
12825
+ allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
12804
12826
  }, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
12805
12827
  autoStart: false,
12806
12828
  onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
@@ -13050,7 +13072,8 @@ function CompositeWizard(_a) {
13050
13072
  documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
13051
13073
  focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
13052
13074
  onModelError: idCaptureProps.onModelError,
13053
- modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs
13075
+ modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
13076
+ allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
13054
13077
  }, /*#__PURE__*/React__namespace.default.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React__namespace.default.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React__namespace.default.createElement(IdCaptureWizard, _assign({}, idCaptureProps, {
13055
13078
  onSuccess: onIdCaptureSuccess
13056
13079
  }))))));
@@ -13372,31 +13395,33 @@ var IdValidation = function IdValidation(_a) {
13372
13395
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
13373
13396
  _d = _a.idCaptureRequirement,
13374
13397
  idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
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,
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,
13381
13406
  instructions = _a.instructions,
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,
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,
13400
13425
  onBeforeSubmit = _a.onBeforeSubmit,
13401
13426
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
13402
13427
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -13410,28 +13435,28 @@ var IdValidation = function IdValidation(_a) {
13410
13435
  onUserCancel = _a.onUserCancel,
13411
13436
  onModelError = _a.onModelError,
13412
13437
  onCameraAccessDenied = _a.onCameraAccessDenied,
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;
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;
13435
13460
  useLanguage(lang);
13436
13461
  useDebugLogging(debugMode);
13437
13462
  var idCaptureProps = React.useMemo(function () {
@@ -13441,6 +13466,7 @@ var IdValidation = function IdValidation(_a) {
13441
13466
  onModelError: onModelError,
13442
13467
  precapturedDocuments: precapturedDocuments,
13443
13468
  captureRequirement: idCaptureRequirement,
13469
+ allowSinglePageIdCapture: allowSinglePageIdCapture,
13444
13470
  separateIdCardCaptureSequence: separateIdCardCaptureSequence,
13445
13471
  thresholds: idCaptureThresholds,
13446
13472
  skipSuccessScreen: skipSuccessScreen,
@@ -13463,7 +13489,7 @@ var IdValidation = function IdValidation(_a) {
13463
13489
  verbiage: verbiage,
13464
13490
  debugMode: debugMode
13465
13491
  };
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]);
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]);
13467
13493
  var additionalDocumentCaptureProps = React.useMemo(function () {
13468
13494
  return {
13469
13495
  documents: captureAdditionalDocuments,