idmission-web-sdk 2.2.67 → 2.2.68

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 +3 -3
@@ -211,7 +211,7 @@
211
211
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
212
  };
213
213
 
214
- var webSdkVersion = '2.2.67';
214
+ var webSdkVersion = '2.2.68';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -8339,7 +8339,7 @@
8339
8339
 
8340
8340
  var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
8341
8341
 
8342
- var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20241018_093000.tflite");
8342
+ var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20241212_131026.tflite");
8343
8343
 
8344
8344
  var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
8345
8345
 
@@ -8358,6 +8358,10 @@
8358
8358
  passport: {
8359
8359
  desktop: 0,
8360
8360
  mobile: 0.3
8361
+ },
8362
+ singlePage: {
8363
+ desktop: 0,
8364
+ mobile: 0.3
8361
8365
  }
8362
8366
  };
8363
8367
  var classifier = null;
@@ -8983,16 +8987,19 @@
8983
8987
  idCardFront: 0.6,
8984
8988
  idCardBack: 0.6,
8985
8989
  passport: 0.4,
8990
+ singlePage: 0.4,
8986
8991
  stability: {
8987
8992
  idCardFront: 0.85,
8988
8993
  idCardBack: 0.85,
8989
- passport: 0.5
8994
+ passport: 0.5,
8995
+ singlePage: 0.5
8990
8996
  }
8991
8997
  };
8992
8998
  var documentTypeDisplayNames = {
8993
8999
  idCardFront: 'ID card front',
8994
9000
  idCardBack: 'ID card back',
8995
9001
  passport: 'Passport',
9002
+ singlePage: 'Single page',
8996
9003
  none: 'None'
8997
9004
  };
8998
9005
  var detector = null;
@@ -9181,7 +9188,7 @@
9181
9188
  right: 20
9182
9189
  };
9183
9190
  function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
9184
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
9191
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
9185
9192
  if (boundaries === void 0) {
9186
9193
  boundaries = defaultDocumentDetectionBoundaries;
9187
9194
  }
@@ -9232,18 +9239,25 @@
9232
9239
  var bestPassportPage = detectedObjects.find(function (obj) {
9233
9240
  return obj.label === 'Passport page';
9234
9241
  });
9242
+ var bestSinglePage = detectedObjects.find(function (obj) {
9243
+ return obj.label === 'Single page';
9244
+ });
9235
9245
  var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
9236
9246
  var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
9237
9247
  var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
9238
- var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_h = thresholds.idCardFront) !== null && _h !== void 0 ? _h : 0);
9239
- var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_j = thresholds.idCardBack) !== null && _j !== void 0 ? _j : 0);
9240
- var passportDetectionThresholdMet = passportDetectionScore >= ((_k = thresholds.passport) !== null && _k !== void 0 ? _k : 0);
9241
- var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
9242
- var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
9243
- var detectionScore = (_l = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _l !== void 0 ? _l : 0;
9248
+ var singlePageDetectionScore = (_h = bestSinglePage === null || bestSinglePage === void 0 ? void 0 : bestSinglePage.score) !== null && _h !== void 0 ? _h : 0;
9249
+ var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_j = thresholds.idCardFront) !== null && _j !== void 0 ? _j : 0);
9250
+ var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_k = thresholds.idCardBack) !== null && _k !== void 0 ? _k : 0);
9251
+ var passportDetectionThresholdMet = passportDetectionScore >= ((_l = thresholds.passport) !== null && _l !== void 0 ? _l : 0);
9252
+ var singlePageDetectionThresholdMet = singlePageDetectionScore >= ((_m = thresholds.singlePage) !== null && _m !== void 0 ? _m : 0);
9253
+ var bestDocument = singlePageDetectionThresholdMet ? bestSinglePage : passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
9254
+ var detectionThreshold = singlePageDetectionThresholdMet ? thresholds.singlePage : passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
9255
+ var detectionScore = (_o = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _o !== void 0 ? _o : 0;
9244
9256
  var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
9245
9257
  var detectedDocumentType = 'none';
9246
- if (passportDetectionThresholdMet) {
9258
+ if (singlePageDetectionThresholdMet) {
9259
+ detectedDocumentType = 'singlePage';
9260
+ } else if (passportDetectionThresholdMet) {
9247
9261
  detectedDocumentType = 'passport';
9248
9262
  } else if (idCardBackDetectionThresholdMet) {
9249
9263
  detectedDocumentType = 'idCardBack';
@@ -9257,12 +9271,12 @@
9257
9271
  var documentIsStable = false;
9258
9272
  var documentTooClose = false;
9259
9273
  if (bestDocument) {
9260
- var _o = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
9261
- docWidth = _o[0],
9262
- docHeight = _o[1];
9274
+ var _q = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
9275
+ docWidth = _q[0],
9276
+ docHeight = _q[1];
9263
9277
  documentTooClose = docWidth > 0.85 || docHeight > 0.85;
9264
9278
  if (detectionThresholdMet && documentInBounds && !documentTooClose) {
9265
- var thresholdSet = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
9279
+ var thresholdSet = (_p = thresholds.stability) !== null && _p !== void 0 ? _p : defaultDocumentDetectionThresholds.stability;
9266
9280
  var threshold_1 = thresholdSet[detectedDocumentType];
9267
9281
  var framesNeeded = Math.ceil(average(framesNeededSamples));
9268
9282
  trackBox(bestDocument.box, framesNeeded);
@@ -9284,6 +9298,8 @@
9284
9298
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
9285
9299
  passportDetectionScore: passportDetectionScore,
9286
9300
  passportDetectionThresholdMet: passportDetectionThresholdMet,
9301
+ singlePageDetectionScore: singlePageDetectionScore,
9302
+ singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
9287
9303
  bestDocument: bestDocument,
9288
9304
  documentInBounds: documentInBounds,
9289
9305
  documentTooClose: documentTooClose,
@@ -10230,37 +10246,39 @@
10230
10246
  });
10231
10247
  function IdCaptureModelsProviderInner(_a) {
10232
10248
  var children = _a.children,
10233
- onModelError = _a.onModelError;
10234
- var _b = React.useContext(DocumentDetectionModelContext),
10235
- documentDetectionModelReady = _b.documentDetectionModelReady,
10236
- documentDetectionModelDownloadProgress = _b.documentDetectionModelDownloadProgress,
10237
- startDocumentDetection = _b.startDocumentDetection,
10238
- stopDocumentDetection = _b.stopDocumentDetection,
10239
- lastPredictionCanvas = _b.documentDetectionLastPredictionCanvas,
10240
- clearDocumentDetectionLastPredictionCanvas = _b.clearDocumentDetectionLastPredictionCanvas,
10241
- onDocumentDetected = _b.onDocumentDetected,
10242
- detectionTime = _b.detectionTime,
10243
- documentDetectionThresholds = _b.documentDetectionThresholds,
10244
- setDocumentDetectionThresholds = _b.setDocumentDetectionThresholds,
10245
- documentDetectionBoundaries = _b.documentDetectionBoundaries,
10246
- setDocumentDetectionBoundaries = _b.setDocumentDetectionBoundaries,
10247
- documentDetectionModelError = _b.documentDetectionModelError;
10248
- var _c = React.useContext(FocusModelContext),
10249
- focusModelReady = _c.focusModelReady,
10250
- focusModelDownloadProgress = _c.focusModelDownloadProgress,
10251
- makeFocusPrediction = _c.makeFocusPrediction,
10252
- focusThresholds = _c.focusThresholds,
10253
- setFocusThresholds = _c.setFocusThresholds,
10254
- focusPredictionTime = _c.focusPredictionTime,
10255
- focusModelError = _c.focusModelError;
10249
+ onModelError = _a.onModelError,
10250
+ _b = _a.allowSinglePageIdCapture,
10251
+ allowSinglePageIdCapture = _b === void 0 ? false : _b;
10252
+ var _c = React.useContext(DocumentDetectionModelContext),
10253
+ documentDetectionModelReady = _c.documentDetectionModelReady,
10254
+ documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
10255
+ startDocumentDetection = _c.startDocumentDetection,
10256
+ stopDocumentDetection = _c.stopDocumentDetection,
10257
+ lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
10258
+ clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
10259
+ onDocumentDetected = _c.onDocumentDetected,
10260
+ detectionTime = _c.detectionTime,
10261
+ documentDetectionThresholds = _c.documentDetectionThresholds,
10262
+ setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
10263
+ documentDetectionBoundaries = _c.documentDetectionBoundaries,
10264
+ setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
10265
+ documentDetectionModelError = _c.documentDetectionModelError;
10266
+ var _d = React.useContext(FocusModelContext),
10267
+ focusModelReady = _d.focusModelReady,
10268
+ focusModelDownloadProgress = _d.focusModelDownloadProgress,
10269
+ makeFocusPrediction = _d.makeFocusPrediction,
10270
+ focusThresholds = _d.focusThresholds,
10271
+ setFocusThresholds = _d.setFocusThresholds,
10272
+ focusPredictionTime = _d.focusPredictionTime,
10273
+ focusModelError = _d.focusModelError;
10256
10274
  var onPredictionHandler = React.useRef();
10257
10275
  var bestFrameDetails = React.useRef(null);
10258
10276
  var bestPredictionCanvas = React.useRef(null);
10259
10277
  var bestFocusScore = React.useRef(0);
10260
10278
  var stopDetection = React.useRef(0);
10261
- var _d = React.useState('none'),
10262
- requiredDocumentType = _d[0],
10263
- setRequiredDocumentType = _d[1];
10279
+ var _e = React.useState('none'),
10280
+ requiredDocumentType = _e[0],
10281
+ setRequiredDocumentType = _e[1];
10264
10282
  var thresholds = React.useMemo(function () {
10265
10283
  return _assign(_assign({}, documentDetectionThresholds), {
10266
10284
  focus: focusThresholds
@@ -10278,34 +10296,42 @@
10278
10296
  var _this = this;
10279
10297
  onDocumentDetected(function (prediction) {
10280
10298
  return __awaiter(_this, void 0, void 0, function () {
10281
- var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
10282
- var _a, _b, _c, _d, _e, _f;
10283
- return __generator(this, function (_g) {
10299
+ var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
10300
+ var _a, _b, _c, _d, _e, _f, _g;
10301
+ return __generator(this, function (_h) {
10284
10302
  if (!lastPredictionCanvas.current) return [2 /*return*/];
10285
10303
  stopDetectionAtStart = stopDetection.current;
10286
10304
  focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
10287
- isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType));
10305
+ isSinglePage = prediction.detectedDocumentType === 'singlePage';
10306
+ if (!allowSinglePageIdCapture && isSinglePage) {
10307
+ prediction.detectedDocumentType = 'passport';
10308
+ prediction.passportDetectionScore = prediction.singlePageDetectionScore;
10309
+ prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
10310
+ prediction.singlePageDetectionScore = 0;
10311
+ prediction.singlePageDetectionThresholdMet = false;
10312
+ }
10313
+ 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'));
10288
10314
  if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
10289
- focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_b = prediction.bestDocument) === null || _b === void 0 ? void 0 : _b.box);
10315
+ focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
10290
10316
  if (focusPrediction) {
10291
10317
  focusScore = focusPrediction.score;
10292
10318
  focusPredictionTime = focusPrediction.predictionTime;
10293
10319
  }
10294
- focusThresholdSet = (_c = thresholds.focus) === null || _c === void 0 ? void 0 : _c[prediction.detectedDocumentType];
10295
- 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;
10320
+ focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
10321
+ 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;
10296
10322
  focusThresholdMet = focusScore >= focusThreshold;
10297
10323
  if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
10298
10324
  bestFocusScore.current = focusScore;
10299
10325
  drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
10300
10326
  bestFrameDetails.current = {
10301
- boundingBox: (_e = prediction.bestDocument) === null || _e === void 0 ? void 0 : _e.box,
10327
+ boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
10302
10328
  documentType: prediction.detectedDocumentType,
10303
10329
  detectionScore: prediction.detectionScore,
10304
10330
  focusScore: focusScore
10305
10331
  };
10306
10332
  }
10307
10333
  }
10308
- (_f = onPredictionHandler.current) === null || _f === void 0 ? void 0 : _f.call(onPredictionHandler, _assign(_assign({}, prediction), {
10334
+ (_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
10309
10335
  focusScore: focusScore,
10310
10336
  focusPredictionTime: focusPredictionTime,
10311
10337
  focusThresholdMet: focusThresholdMet
@@ -10314,7 +10340,7 @@
10314
10340
  });
10315
10341
  });
10316
10342
  });
10317
- }, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
10343
+ }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
10318
10344
  var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
10319
10345
  React.useEffect(function handleModelErrors() {
10320
10346
  if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
@@ -10328,9 +10354,9 @@
10328
10354
  canvas: bestPredictionCanvas.current
10329
10355
  });
10330
10356
  }, []);
10331
- var _e = React.useState(0),
10332
- canvasKey = _e[0],
10333
- setCanvasKey = _e[1];
10357
+ var _f = React.useState(0),
10358
+ canvasKey = _f[0],
10359
+ setCanvasKey = _f[1];
10334
10360
  var resetBestFrame = React.useCallback(function () {
10335
10361
  stopDetection.current += 1;
10336
10362
  setCanvasKey(function (n) {
@@ -10460,9 +10486,9 @@
10460
10486
  });
10461
10487
  }
10462
10488
 
10463
- var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'selfie'];
10489
+ var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
10464
10490
 
10465
- var requiredDocumentsForOption = {
10491
+ var acceptedDocumentTypesForIdCaptureRequirementOption = {
10466
10492
  idCardFront: ['idCardFront'],
10467
10493
  idCardBack: ['idCardBack'],
10468
10494
  passport: ['passport'],
@@ -10470,13 +10496,31 @@
10470
10496
  idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
10471
10497
  idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
10472
10498
  };
10473
- function requiredImageCountForOption(idCaptureRequirement) {
10499
+ function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
10474
10500
  if (idCaptureRequirement === 'idCardOrPassport') return 1;
10475
- return requiredDocumentsForOption[idCaptureRequirement].length;
10501
+ return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
10476
10502
  }
10477
- function allowedImageCountForOption(idCaptureRequirement) {
10503
+ function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
10478
10504
  if (idCaptureRequirement === 'idCardOrPassport') return 2;
10479
- return requiredImageCountForOption(idCaptureRequirement);
10505
+ return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
10506
+ }
10507
+ function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
10508
+ var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
10509
+ if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
10510
+ var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
10511
+ if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
10512
+ acceptedTypes = acceptedTypes.filter(function (v) {
10513
+ return !v.includes('idCard');
10514
+ });
10515
+ }
10516
+ if (isIdCardOrPassport) {
10517
+ acceptedTypes = acceptedTypes.filter(function (v) {
10518
+ return v !== 'passport';
10519
+ });
10520
+ }
10521
+ return acceptedTypes.filter(function (v) {
10522
+ return !(v in capturedDocuments);
10523
+ });
10480
10524
  }
10481
10525
 
10482
10526
  var initialState$4 = {
@@ -10515,6 +10559,8 @@
10515
10559
  idCardBackDetectionThresholdMet: false,
10516
10560
  passportDetectionScore: 0,
10517
10561
  passportDetectionThresholdMet: false,
10562
+ singlePageDetectionScore: 0,
10563
+ singlePageDetectionThresholdMet: false,
10518
10564
  focusScore: 0,
10519
10565
  focusThresholdMet: false,
10520
10566
  isGoodFrame: false,
@@ -10530,6 +10576,7 @@
10530
10576
  capturedDocuments: {},
10531
10577
  captureRequirement: 'idCardOrPassport',
10532
10578
  requestedDocumentType: 'idCardFront',
10579
+ allowSinglePageIdCapture: false,
10533
10580
  allowIdCardBackToFrontCapture: false,
10534
10581
  operationStartedAt: null,
10535
10582
  captureStartedAt: null
@@ -10544,11 +10591,13 @@
10544
10591
  var _c = action.payload,
10545
10592
  captureRequirement = _c.captureRequirement,
10546
10593
  precapturedDocuments = _c.precapturedDocuments,
10594
+ allowSinglePageIdCapture = _c.allowSinglePageIdCapture,
10547
10595
  allowIdCardBackToFrontCapture = _c.allowIdCardBackToFrontCapture,
10548
10596
  enableOverrideWrongDocumentTypeDialog = _c.enableOverrideWrongDocumentTypeDialog,
10549
10597
  allowOverrideWrongDocumentTypeAfterMs = _c.allowOverrideWrongDocumentTypeAfterMs;
10550
10598
  var newState = _assign(_assign({}, state), {
10551
10599
  captureRequirement: captureRequirement,
10600
+ allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
10552
10601
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
10553
10602
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
10554
10603
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
@@ -10616,6 +10665,8 @@
10616
10665
  idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
10617
10666
  passportDetectionScore = _d.passportDetectionScore,
10618
10667
  passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
10668
+ singlePageDetectionScore = _d.singlePageDetectionScore,
10669
+ singlePageDetectionThresholdMet = _d.singlePageDetectionThresholdMet,
10619
10670
  bestDocument = _d.bestDocument,
10620
10671
  documentInBounds = _d.documentInBounds,
10621
10672
  documentTooClose = _d.documentTooClose,
@@ -10636,7 +10687,8 @@
10636
10687
  }
10637
10688
  }
10638
10689
  }
10639
- var idCardDetectedButNotAllowed = detectedDocumentType.includes('idCard') && !state.captureRequirement.includes('idCard');
10690
+ var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
10691
+ var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
10640
10692
  var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
10641
10693
  var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
10642
10694
  var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
@@ -10696,6 +10748,8 @@
10696
10748
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
10697
10749
  passportDetectionScore: passportDetectionScore,
10698
10750
  passportDetectionThresholdMet: passportDetectionThresholdMet,
10751
+ singlePageDetectionScore: singlePageDetectionScore,
10752
+ singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
10699
10753
  focusScore: focusScore,
10700
10754
  focusThresholdMet: focusThresholdMet,
10701
10755
  isGoodFrame: isGoodFrame,
@@ -10733,7 +10787,7 @@
10733
10787
  });
10734
10788
  case 'documentCaptured':
10735
10789
  {
10736
- var newState_1 = _assign(_assign({}, state), {
10790
+ var newState = _assign(_assign({}, state), {
10737
10791
  capturing: false,
10738
10792
  captureFailed: false,
10739
10793
  allowOverrideFlipRequirement: false,
@@ -10742,64 +10796,42 @@
10742
10796
  wrongDocumentTypePredictions: 0,
10743
10797
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
10744
10798
  });
10745
- var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
10746
- return !(v in newState_1.capturedDocuments);
10747
- });
10748
- if (state.captureRequirement === 'idCardOrPassport') {
10749
- if (state.requestedDocumentType === 'passport') {
10750
- remainingRequirements = [];
10751
- } else {
10752
- remainingRequirements = remainingRequirements.filter(function (v) {
10753
- return v !== 'passport';
10754
- });
10755
- }
10756
- }
10799
+ var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
10757
10800
  if (remainingRequirements.length === 0) {
10758
- newState_1.captureState = 'complete';
10801
+ newState.captureState = 'complete';
10759
10802
  } else {
10760
- newState_1.requestedDocumentType = remainingRequirements[0];
10761
- if (state.requestedDocumentType === 'idCardFront' && newState_1.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_1.requestedDocumentType === 'idCardFront') {
10762
- newState_1.captureState = 'requestingFlip';
10763
- newState_1.idCardFrontDetectionThresholdMet = false;
10764
- newState_1.idCardBackDetectionThresholdMet = false;
10765
- newState_1.passportDetectionThresholdMet = false;
10766
- newState_1.wrongDocumentTypePredictions = 0;
10803
+ newState.requestedDocumentType = remainingRequirements[0];
10804
+ if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
10805
+ newState.captureState = 'requestingFlip';
10806
+ newState.idCardFrontDetectionThresholdMet = false;
10807
+ newState.idCardBackDetectionThresholdMet = false;
10808
+ newState.passportDetectionThresholdMet = false;
10809
+ newState.wrongDocumentTypePredictions = 0;
10767
10810
  }
10768
10811
  }
10769
- return newState_1;
10812
+ return newState;
10770
10813
  }
10771
10814
  case 'documentCapturedManually':
10772
10815
  {
10773
- var newState_2 = _assign(_assign({}, state), {
10816
+ var newState = _assign(_assign({}, state), {
10774
10817
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_b = {}, _b[state.requestedDocumentType] = _assign(_assign({}, action.payload), {
10775
10818
  width: 0,
10776
10819
  height: 0
10777
10820
  }), _b))
10778
10821
  });
10779
- var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
10780
- return !(v in newState_2.capturedDocuments);
10781
- });
10782
- if (state.captureRequirement === 'idCardOrPassport') {
10783
- if (state.requestedDocumentType === 'passport') {
10784
- remainingRequirements = [];
10785
- } else {
10786
- remainingRequirements = remainingRequirements.filter(function (v) {
10787
- return v !== 'passport';
10788
- });
10789
- }
10790
- }
10822
+ var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
10791
10823
  if (remainingRequirements.length === 0) {
10792
- newState_2.captureState = 'complete';
10824
+ newState.captureState = 'complete';
10793
10825
  } else {
10794
- newState_2.requestedDocumentType = remainingRequirements[0];
10795
- if (state.requestedDocumentType === 'idCardFront' && newState_2.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_2.requestedDocumentType === 'idCardFront') {
10796
- newState_2.captureState = 'requestingFlip';
10797
- newState_2.idCardFrontDetectionThresholdMet = false;
10798
- newState_2.idCardBackDetectionThresholdMet = false;
10799
- newState_2.passportDetectionThresholdMet = false;
10826
+ newState.requestedDocumentType = remainingRequirements[0];
10827
+ if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
10828
+ newState.captureState = 'requestingFlip';
10829
+ newState.idCardFrontDetectionThresholdMet = false;
10830
+ newState.idCardBackDetectionThresholdMet = false;
10831
+ newState.passportDetectionThresholdMet = false;
10800
10832
  }
10801
10833
  }
10802
- return newState_2;
10834
+ return newState;
10803
10835
  }
10804
10836
  case 'flipRequestCompleted':
10805
10837
  return _assign(_assign({}, state), {
@@ -14190,7 +14222,7 @@
14190
14222
  imageUrl: imageUrl
14191
14223
  }
14192
14224
  });
14193
- var capturedDocumentType = documentType === 'passport' ? 'passport' : state.requestedDocumentType;
14225
+ var capturedDocumentType = documentType;
14194
14226
  setTimeout(function () {
14195
14227
  var _a;
14196
14228
  var captureTime = new Date().getTime() - ((_a = state.captureStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
@@ -14257,7 +14289,7 @@
14257
14289
  scaling: debugScalingDetails,
14258
14290
  flipX: !isRearFacing
14259
14291
  });
14260
- }))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.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.createElement("br", null), modelsReady ? ( /*#__PURE__*/React.createElement(React.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u274C Models not ready")))));
14292
+ }))), debugMode && ( /*#__PURE__*/React.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React.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.createElement("br", null), modelsReady ? ( /*#__PURE__*/React.createElement(React.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React.createElement(React.Fragment, null, "\u274C Models not ready")))));
14261
14293
  };
14262
14294
  var timeSince = function timeSince(t) {
14263
14295
  if (!t) return 0;
@@ -15370,15 +15402,8 @@
15370
15402
  _e = _a.debugMode,
15371
15403
  debugMode = _e === void 0 ? false : _e;
15372
15404
  var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
15373
- var idCardFront = capturedDocuments.idCardFront,
15374
- idCardBack = capturedDocuments.idCardBack,
15375
- passport = capturedDocuments.passport;
15376
15405
  var verbiage = useTranslations(rawVerbiage, {
15377
15406
  headingText: 'ID Capture Successful',
15378
- idCardFrontText: 'ID Card Front',
15379
- idCardBackText: 'ID Card Back',
15380
- passportText: 'Passport',
15381
- instructionText: 'Verify the entire ID was captured clearly with no glare.',
15382
15407
  retryText: 'Retry',
15383
15408
  submittingText: 'Submitting...',
15384
15409
  submitText: 'Done'
@@ -15395,25 +15420,16 @@
15395
15420
  className: classNames.imageContainer
15396
15421
  }, /*#__PURE__*/React.createElement(ImageRow, {
15397
15422
  className: classNames.imageRow
15398
- }, idCardFront && ( /*#__PURE__*/React.createElement(ImageCol$1, {
15399
- className: classNames.imageCol
15400
- }, /*#__PURE__*/React.createElement(StyledImage, {
15401
- image: idCardFront,
15402
- className: classNames.image,
15403
- alt: verbiage.idCardFrontText
15404
- }), debugMode && ( /*#__PURE__*/React.createElement(DebugPre, null, "Detection Score: ".concat(idCardFront.detectionScore, "\nFocus Score: ").concat(idCardFront.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardFront.boundingBox)))))), idCardBack && ( /*#__PURE__*/React.createElement(ImageCol$1, {
15405
- className: classNames.imageCol
15406
- }, /*#__PURE__*/React.createElement(StyledImage, {
15407
- image: idCardBack,
15408
- className: classNames.image,
15409
- alt: verbiage.idCardBackText
15410
- }), debugMode && ( /*#__PURE__*/React.createElement(DebugPre, null, "Detection Score: ".concat(idCardBack.detectionScore, "\nFocus Score: ").concat(idCardBack.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardBack.boundingBox)))))), passport && ( /*#__PURE__*/React.createElement(ImageCol$1, {
15411
- className: classNames.imageCol
15412
- }, /*#__PURE__*/React.createElement(StyledImage, {
15413
- image: passport,
15414
- className: classNames.image,
15415
- alt: verbiage.passportText
15416
- }), debugMode && ( /*#__PURE__*/React.createElement(DebugPre, null, "Detection Score: ".concat(passport.detectionScore, "\nFocus Score: ").concat(passport.focusScore, "\nBounding Box: ").concat(JSON.stringify(passport.boundingBox)))))))), /*#__PURE__*/React.createElement(ButtonsColumn, {
15423
+ }, Object.values(capturedDocuments).map(function (doc) {
15424
+ return /*#__PURE__*/React.createElement(ImageCol$1, {
15425
+ className: classNames.imageCol,
15426
+ key: doc.imageData
15427
+ }, /*#__PURE__*/React.createElement(StyledImage, {
15428
+ image: doc,
15429
+ className: classNames.image,
15430
+ alt: doc.documentType
15431
+ }), debugMode && ( /*#__PURE__*/React.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)))));
15432
+ }))), /*#__PURE__*/React.createElement(ButtonsColumn, {
15417
15433
  className: classNames.buttonsRow
15418
15434
  }, /*#__PURE__*/React.createElement(WideButton, {
15419
15435
  className: classNames.submitBtn,
@@ -15432,7 +15448,7 @@
15432
15448
  };
15433
15449
  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"])));
15434
15450
  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"])));
15435
- 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"])));
15451
+ 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"])));
15436
15452
  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"])));
15437
15453
  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"])));
15438
15454
  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"])));
@@ -17142,8 +17158,8 @@
17142
17158
  var _j = React.useState(silentFallback),
17143
17159
  useFallback = _j[0],
17144
17160
  setUseFallback = _j[1];
17145
- var allowedImageCount = allowedImageCountForOption(idCaptureRequirement);
17146
- var requiredImageCount = requiredImageCountForOption(idCaptureRequirement);
17161
+ var minImageCount = minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
17162
+ var maxImageCount = maxImageCountForIdCaptureRequirementOption(idCaptureRequirement);
17147
17163
  var _k = useFileState(),
17148
17164
  rawFile = _k.rawFile,
17149
17165
  fileInputOnChange = _k.fileInputOnChange;
@@ -17156,7 +17172,7 @@
17156
17172
  var whatToCapture = idCaptureRequirement === 'idCard' ? 'ID card' : idCaptureRequirement === 'passport' ? 'passport' : idCaptureRequirement === 'idCardOrPassport' ? 'ID card or passport' : 'ID card and passport';
17157
17173
  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.';
17158
17174
  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.';
17159
- var descriptionText = "On-device capture guidance failed, please capture ".concat(requiredImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
17175
+ var descriptionText = "On-device capture guidance failed, please capture ".concat(minImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
17160
17176
  var verbiage = useTranslations(rawVerbiage, {
17161
17177
  headingText: "We're having some trouble.",
17162
17178
  descriptionText: descriptionText,
@@ -17230,7 +17246,7 @@
17230
17246
  alt: "",
17231
17247
  className: classNames.image
17232
17248
  }));
17233
- }))), images.length < requiredImageCount && ( /*#__PURE__*/React.createElement(Instruction, {
17249
+ }))), images.length < minImageCount && ( /*#__PURE__*/React.createElement(Instruction, {
17234
17250
  className: classNames.instruction
17235
17251
  }, instructionText)), /*#__PURE__*/React.createElement("input", {
17236
17252
  ref: fileInput,
@@ -17241,7 +17257,7 @@
17241
17257
  hidden: true
17242
17258
  }), /*#__PURE__*/React.createElement(StyledButtonsRow$8, {
17243
17259
  className: classNames.buttonsRow
17244
- }, images.length < allowedImageCount && ( /*#__PURE__*/React.createElement(LoaderButton, {
17260
+ }, images.length < maxImageCount && ( /*#__PURE__*/React.createElement(LoaderButton, {
17245
17261
  variant: images.length > 0 ? 'secondary' : 'positive',
17246
17262
  className: images.length > 0 ? classNames.captureMoreBtn : classNames.captureBtn,
17247
17263
  colors: images.length > 0 ? colors.captureMoreBtn : colors.captureBtn,
@@ -17254,7 +17270,7 @@
17254
17270
  setDocumentToCapture(instructionText);
17255
17271
  }
17256
17272
  }
17257
- }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= requiredImageCount && ( /*#__PURE__*/React.createElement(LoaderButton, {
17273
+ }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= minImageCount && ( /*#__PURE__*/React.createElement(LoaderButton, {
17258
17274
  variant: "positive",
17259
17275
  className: classNames.doneBtn,
17260
17276
  colors: colors.doneBtn,
@@ -17301,79 +17317,82 @@
17301
17317
  precapturedDocuments = _a.precapturedDocuments,
17302
17318
  _j = _a.captureRequirement,
17303
17319
  captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
17304
- _k = _a.separateIdCardCaptureSequence,
17305
- separateIdCardCaptureSequence = _k === void 0 ? false : _k,
17306
- _l = _a.thresholds,
17307
- thresholds = _l === void 0 ? defaultIdCaptureThresholds : _l,
17308
- _m = _a.skipSuccessScreen,
17309
- skipSuccessScreen = _m === void 0 ? false : _m,
17320
+ _k = _a.allowSinglePageIdCapture,
17321
+ allowSinglePageIdCapture = _k === void 0 ? false : _k,
17322
+ _l = _a.separateIdCardCaptureSequence,
17323
+ separateIdCardCaptureSequence = _l === void 0 ? false : _l,
17324
+ _m = _a.thresholds,
17325
+ thresholds = _m === void 0 ? defaultIdCaptureThresholds : _m,
17326
+ _o = _a.skipSuccessScreen,
17327
+ skipSuccessScreen = _o === void 0 ? false : _o,
17310
17328
  instructions = _a.instructions,
17311
- _o = _a.releaseCameraAccessOnExit,
17312
- releaseCameraAccessOnExit = _o === void 0 ? true : _o,
17313
- _p = _a.guideType,
17314
- guideType = _p === void 0 ? 'fit' : _p,
17315
- _q = _a.portraitGuidesOnMobile,
17316
- portraitGuidesOnMobile = _q === void 0 ? true : _q,
17317
- _r = _a.rotateLoadingOverlayImageWhenPortrait,
17318
- rotateLoadingOverlayImageWhenPortrait = _r === void 0 ? true : _r,
17319
- _s = _a.silentFallback,
17320
- silentFallback = _s === void 0 ? false : _s,
17321
- _t = _a.forceFallbackMode,
17322
- forceFallbackMode = _t === void 0 ? false : _t,
17323
- _u = _a.allowIdCardBackToFrontCapture,
17324
- allowIdCardBackToFrontCapture = _u === void 0 ? false : _u,
17325
- _v = _a.enableOverrideWrongDocumentTypeDialog,
17326
- enableOverrideWrongDocumentTypeDialog = _v === void 0 ? false : _v,
17327
- _w = _a.allowOverrideWrongDocumentTypeAfterMs,
17328
- allowOverrideWrongDocumentTypeAfterMs = _w === void 0 ? 8000 : _w,
17329
- _x = _a.guideImages,
17330
- guideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
17331
- _y = _a.assets,
17332
- assets = _y === void 0 ? {} : _y,
17333
- _z = _a.classNames,
17334
- classNames = _z === void 0 ? {} : _z,
17335
- _0 = _a.colors,
17336
- colors = _0 === void 0 ? {} : _0,
17337
- _1 = _a.verbiage,
17338
- verbiage = _1 === void 0 ? {} : _1,
17339
- _2 = _a.debugMode,
17340
- debugMode = _2 === void 0 ? false : _2;
17341
- var _3 = useIdCaptureState(),
17342
- state = _3[0],
17343
- dispatch = _3[1];
17344
- var _4 = useCameraStore(),
17345
- cameraAccessDenied = _4.cameraAccessDenied,
17346
- requestCameraAccess = _4.requestCameraAccess,
17347
- releaseCameraAccess = _4.releaseCameraAccess;
17348
- var _5 = React.useState(false),
17349
- overlayDismissed = _5[0],
17350
- setOverlayDismissed = _5[1];
17351
- var _6 = React.useContext(SubmissionContext),
17352
- submissionStatus = _6.submissionStatus,
17353
- setIdFrontImage = _6.setIdFrontImage,
17354
- setIdBackImage = _6.setIdBackImage,
17355
- setPassportImage = _6.setPassportImage,
17356
- logIdFrontCaptureAttempt = _6.logIdFrontCaptureAttempt,
17357
- logIdBackCaptureAttempt = _6.logIdBackCaptureAttempt;
17358
- var _7 = React.useContext(IdCaptureModelsContext),
17359
- start = _7.start,
17360
- stop = _7.stop,
17361
- onPredictionMade = _7.onPredictionMade,
17362
- setRequiredDocumentType = _7.setRequiredDocumentType,
17363
- modelError = _7.modelError,
17364
- resetBestFrame = _7.resetBestFrame;
17329
+ _p = _a.releaseCameraAccessOnExit,
17330
+ releaseCameraAccessOnExit = _p === void 0 ? true : _p,
17331
+ _q = _a.guideType,
17332
+ guideType = _q === void 0 ? 'fit' : _q,
17333
+ _r = _a.portraitGuidesOnMobile,
17334
+ portraitGuidesOnMobile = _r === void 0 ? true : _r,
17335
+ _s = _a.rotateLoadingOverlayImageWhenPortrait,
17336
+ rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
17337
+ _t = _a.silentFallback,
17338
+ silentFallback = _t === void 0 ? false : _t,
17339
+ _u = _a.forceFallbackMode,
17340
+ forceFallbackMode = _u === void 0 ? false : _u,
17341
+ _v = _a.allowIdCardBackToFrontCapture,
17342
+ allowIdCardBackToFrontCapture = _v === void 0 ? false : _v,
17343
+ _w = _a.enableOverrideWrongDocumentTypeDialog,
17344
+ enableOverrideWrongDocumentTypeDialog = _w === void 0 ? false : _w,
17345
+ _x = _a.allowOverrideWrongDocumentTypeAfterMs,
17346
+ allowOverrideWrongDocumentTypeAfterMs = _x === void 0 ? 8000 : _x,
17347
+ _y = _a.guideImages,
17348
+ guideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
17349
+ _z = _a.assets,
17350
+ assets = _z === void 0 ? {} : _z,
17351
+ _0 = _a.classNames,
17352
+ classNames = _0 === void 0 ? {} : _0,
17353
+ _1 = _a.colors,
17354
+ colors = _1 === void 0 ? {} : _1,
17355
+ _2 = _a.verbiage,
17356
+ verbiage = _2 === void 0 ? {} : _2,
17357
+ _3 = _a.debugMode,
17358
+ debugMode = _3 === void 0 ? false : _3;
17359
+ var _4 = useIdCaptureState(),
17360
+ state = _4[0],
17361
+ dispatch = _4[1];
17362
+ var _5 = useCameraStore(),
17363
+ cameraAccessDenied = _5.cameraAccessDenied,
17364
+ requestCameraAccess = _5.requestCameraAccess,
17365
+ releaseCameraAccess = _5.releaseCameraAccess;
17366
+ var _6 = React.useState(false),
17367
+ overlayDismissed = _6[0],
17368
+ setOverlayDismissed = _6[1];
17369
+ var _7 = React.useContext(SubmissionContext),
17370
+ submissionStatus = _7.submissionStatus,
17371
+ setIdFrontImage = _7.setIdFrontImage,
17372
+ setIdBackImage = _7.setIdBackImage,
17373
+ setPassportImage = _7.setPassportImage,
17374
+ logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
17375
+ logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
17376
+ var _8 = React.useContext(IdCaptureModelsContext),
17377
+ start = _8.start,
17378
+ stop = _8.stop,
17379
+ onPredictionMade = _8.onPredictionMade,
17380
+ setRequiredDocumentType = _8.setRequiredDocumentType,
17381
+ modelError = _8.modelError,
17382
+ resetBestFrame = _8.resetBestFrame;
17365
17383
  React.useEffect(function () {
17366
17384
  dispatch({
17367
17385
  type: 'configureWizard',
17368
17386
  payload: {
17369
17387
  captureRequirement: captureRequirement,
17370
17388
  precapturedDocuments: precapturedDocuments,
17389
+ allowSinglePageIdCapture: allowSinglePageIdCapture,
17371
17390
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
17372
17391
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
17373
17392
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
17374
17393
  }
17375
17394
  });
17376
- }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
17395
+ }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
17377
17396
  var documentCount = Object.keys(state.capturedDocuments).length;
17378
17397
  React.useEffect(function () {
17379
17398
  if (documentCount) resetBestFrame();
@@ -17435,13 +17454,16 @@
17435
17454
  var _a = state.capturedDocuments,
17436
17455
  idCardFront = _a.idCardFront,
17437
17456
  idCardBack = _a.idCardBack,
17438
- passport = _a.passport;
17457
+ passport = _a.passport,
17458
+ singlePage = _a.singlePage;
17439
17459
  var idFrontImage = idCardFront && dataUrlToBase64Sync(idCardFront.imageData);
17440
17460
  var idBackImage = idCardBack && dataUrlToBase64Sync(idCardBack.imageData);
17441
17461
  var passportImage = passport && dataUrlToBase64Sync(passport.imageData);
17462
+ var singlePageImage = singlePage && dataUrlToBase64Sync(singlePage.imageData);
17442
17463
  if (idFrontImage) setIdFrontImage(idFrontImage);
17443
17464
  if (idBackImage) setIdBackImage(idBackImage);
17444
17465
  if (passportImage) setPassportImage(passportImage);
17466
+ if (singlePageImage) setIdFrontImage(singlePageImage);
17445
17467
  if (releaseCameraAccessOnExit) releaseCameraAccess();
17446
17468
  setTimeout(function () {
17447
17469
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
@@ -17457,9 +17479,9 @@
17457
17479
  type: 'resetWizard'
17458
17480
  });
17459
17481
  }, [dispatch]);
17460
- var _8 = React.useState(0),
17461
- attempt = _8[0],
17462
- setAttempt = _8[1];
17482
+ var _9 = React.useState(0),
17483
+ attempt = _9[0],
17484
+ setAttempt = _9[1];
17463
17485
  var onExit = React.useCallback(function () {
17464
17486
  releaseCameraAccess();
17465
17487
  setOverlayDismissed(false);
@@ -17550,9 +17572,9 @@
17550
17572
  });
17551
17573
  });
17552
17574
  }, [dispatch]);
17553
- var _9 = React.useState(false),
17554
- progressStarted = _9[0],
17555
- setProgressStarted = _9[1];
17575
+ var _10 = React.useState(false),
17576
+ progressStarted = _10[0],
17577
+ setProgressStarted = _10[1];
17556
17578
  React.useEffect(function () {
17557
17579
  if (state.captureState === 'capturing') {
17558
17580
  setProgressStarted(false);
@@ -21852,7 +21874,8 @@
21852
21874
  detection: {
21853
21875
  idCardFront: 0.4,
21854
21876
  idCardBack: 0.5,
21855
- passport: 0.3
21877
+ passport: 0.3,
21878
+ singlePage: 0.3
21856
21879
  },
21857
21880
  focus: {
21858
21881
  idCardFront: {
@@ -21866,12 +21889,17 @@
21866
21889
  passport: {
21867
21890
  desktop: 0,
21868
21891
  mobile: 0
21892
+ },
21893
+ singlePage: {
21894
+ desktop: 0,
21895
+ mobile: 0
21869
21896
  }
21870
21897
  },
21871
21898
  goodFrames: {
21872
21899
  idCardFront: 1,
21873
21900
  idCardBack: 1,
21874
- passport: 1
21901
+ passport: 1,
21902
+ singlePage: 1
21875
21903
  },
21876
21904
  flipShortcutThreshold: 0.7
21877
21905
  };
@@ -21943,6 +21971,7 @@
21943
21971
  stopIdModels = _18.stop,
21944
21972
  onIdPredictionMade = _18.onPredictionMade,
21945
21973
  setThresholds = _18.setThresholds,
21974
+ setRequiredDocumentType = _18.setRequiredDocumentType,
21946
21975
  setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
21947
21976
  bestFrameDetails = _18.bestFrameDetails,
21948
21977
  resetBestFrame = _18.resetBestFrame,
@@ -22021,6 +22050,9 @@
22021
22050
  React.useEffect(function () {
22022
22051
  setThresholds(adjustedThresholds);
22023
22052
  }, [requestedAction, setThresholds, adjustedThresholds]);
22053
+ React.useEffect(function () {
22054
+ setRequiredDocumentType(requestedAction === 'SHOW_PASSPORT' ? 'passport' : requestedAction === 'SHOW_ID_BACK' ? 'idCardBack' : 'idCardFront');
22055
+ }, [requestedAction, setRequiredDocumentType]);
22024
22056
  React.useEffect(function () {
22025
22057
  setDocumentDetectionBoundaries({
22026
22058
  top: 20,
@@ -22043,6 +22075,9 @@
22043
22075
  setGoodFramesCount = _28[1];
22044
22076
  var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
22045
22077
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
22078
+ var _29 = React.useState(false),
22079
+ isSinglePage = _29[0],
22080
+ setIsSinglePage = _29[1];
22046
22081
  React.useEffect(function () {
22047
22082
  if (!idCaptureModelsEnabled || idModelError) return;
22048
22083
  onIdPredictionMade(function (prediction) {
@@ -22050,7 +22085,8 @@
22050
22085
  setCurrentDetectionScore(prediction.detectionScore);
22051
22086
  setCurrentDetectedDocumentType(prediction.detectedDocumentType);
22052
22087
  setCurrentFocusScore(prediction.focusScore);
22053
- var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
22088
+ setIsSinglePage(prediction.singlePageDetectionThresholdMet);
22089
+ var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_BACK' ? prediction.idCardBackDetectionThresholdMet : prediction.idCardFrontDetectionThresholdMet || prediction.singlePageDetectionThresholdMet;
22054
22090
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
22055
22091
  var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
22056
22092
  if (shouldShortcutFlipAnimation) {
@@ -22061,9 +22097,9 @@
22061
22097
  } : 0);
22062
22098
  });
22063
22099
  }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
22064
- var _29 = React.useState(null),
22065
- idFrontCaptureStartedAt = _29[0],
22066
- setFirstGoodFrameTime = _29[1];
22100
+ var _30 = React.useState(null),
22101
+ idFrontCaptureStartedAt = _30[0],
22102
+ setFirstGoodFrameTime = _30[1];
22067
22103
  React.useEffect(function () {
22068
22104
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
22069
22105
  }, [goodFramesCount]);
@@ -22084,80 +22120,60 @@
22084
22120
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
22085
22121
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
22086
22122
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
22087
- var _30 = React.useState(),
22088
- countdownStartedAt = _30[0],
22089
- setCountdownStartedAt = _30[1];
22123
+ var _31 = React.useState(),
22124
+ countdownStartedAt = _31[0],
22125
+ setCountdownStartedAt = _31[1];
22090
22126
  var photoCanvas = React.useRef(null);
22091
22127
  var frameLock = React.useRef(false);
22092
22128
  var captureFrame = React.useCallback(function () {
22093
22129
  return __awaiter(void 0, void 0, void 0, function () {
22094
- var frameBase64, _a;
22095
- return __generator(this, function (_b) {
22096
- switch (_b.label) {
22097
- case 0:
22098
- if (frameLock.current) return [2 /*return*/];
22099
- frameLock.current = true;
22100
- drawToCanvas(photoCanvas.current, videoRef.current);
22101
- frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
22102
- if (!frameBase64) {
22103
- frameLock.current = false;
22104
- return [2 /*return*/];
22105
- }
22106
- _b.label = 1;
22107
- case 1:
22108
- _b.trys.push([1,, 7, 8]);
22109
- if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
22130
+ var frameBase64;
22131
+ return __generator(this, function (_a) {
22132
+ if (frameLock.current) return [2 /*return*/];
22133
+ frameLock.current = true;
22134
+ drawToCanvas(photoCanvas.current, videoRef.current);
22135
+ frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
22136
+ if (!frameBase64) {
22137
+ frameLock.current = false;
22138
+ return [2 /*return*/];
22139
+ }
22140
+ try {
22141
+ if (requestedAction == 'SHOW_ID_FRONT') {
22110
22142
  if (onIdFrontImageCaptured) {
22111
22143
  onIdFrontImageCaptured(frameBase64);
22112
22144
  }
22113
- if (!skipShowIdCardBack) return [3 /*break*/, 4];
22114
- _a = skipShowIdCardBack === true;
22115
- if (_a) return [3 /*break*/, 3];
22116
- return [4 /*yield*/, skipShowIdCardBack()];
22117
- case 2:
22118
- _a = _b.sent();
22119
- _b.label = 3;
22120
- case 3:
22121
- if (_a) {
22145
+ if (isSinglePage || evaluateShouldSkip(skipShowIdCardBack)) {
22122
22146
  return [2 /*return*/, onIdCaptureComplete()];
22123
22147
  }
22124
- _b.label = 4;
22125
- case 4:
22126
22148
  setRequestedAction('FLIP_ID');
22127
- return [3 /*break*/, 6];
22128
- case 5:
22129
- if (requestedAction == 'SHOW_ID_BACK') {
22130
- if (onIdBackImageCaptured) {
22131
- onIdBackImageCaptured(frameBase64);
22132
- }
22133
- onIdCaptureComplete();
22134
- } else if (requestedAction == 'SHOW_PASSPORT') {
22135
- if (onIdFrontImageCaptured) {
22136
- onIdFrontImageCaptured(frameBase64);
22137
- }
22138
- onIdCaptureComplete();
22149
+ } else if (requestedAction == 'SHOW_ID_BACK') {
22150
+ if (onIdBackImageCaptured) {
22151
+ onIdBackImageCaptured(frameBase64);
22139
22152
  }
22140
- _b.label = 6;
22141
- case 6:
22142
- return [3 /*break*/, 8];
22143
- case 7:
22144
- setDetectedObjects([]);
22145
- setCurrentDetectionScore(0);
22146
- setCurrentFocusScore(0);
22147
- setGoodFramesCount(0);
22148
- setCountdownStartedAt(undefined);
22149
- resetBestFrame();
22150
- frameLock.current = false;
22151
- if (countdownTimeoutRef.current) {
22152
- clearTimeout(countdownTimeoutRef.current);
22153
+ onIdCaptureComplete();
22154
+ } else if (requestedAction == 'SHOW_PASSPORT') {
22155
+ if (onIdFrontImageCaptured) {
22156
+ onIdFrontImageCaptured(frameBase64);
22153
22157
  }
22154
- return [7 /*endfinally*/];
22155
- case 8:
22156
- return [2 /*return*/];
22158
+ onIdCaptureComplete();
22159
+ }
22160
+ } finally {
22161
+ setDetectedObjects([]);
22162
+ setCurrentDetectionScore(0);
22163
+ setCurrentFocusScore(0);
22164
+ setGoodFramesCount(0);
22165
+ setCountdownStartedAt(undefined);
22166
+ setIsSinglePage(false);
22167
+ resetBestFrame();
22168
+ frameLock.current = false;
22169
+ if (countdownTimeoutRef.current) {
22170
+ clearTimeout(countdownTimeoutRef.current);
22171
+ }
22157
22172
  }
22173
+ return [2 /*return*/];
22158
22174
  });
22159
22175
  });
22160
- }, [onIdCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
22176
+ }, [videoRef, requestedAction, onIdFrontImageCaptured, isSinglePage, skipShowIdCardBack, onIdCaptureComplete, onIdBackImageCaptured, resetBestFrame]);
22161
22177
  var isFlipping = requestedAction === 'FLIP_ID';
22162
22178
  React.useEffect(function () {
22163
22179
  if (!isFlipping) return;
@@ -22216,9 +22232,9 @@
22216
22232
  stopSelfieGuidance();
22217
22233
  };
22218
22234
  }, [startSelfieGuidance, stopSelfieGuidance]);
22219
- var _31 = React.useState(0),
22220
- numFramesWithoutFaces = _31[0],
22221
- setNumFramesWithoutFaces = _31[1];
22235
+ var _32 = React.useState(0),
22236
+ numFramesWithoutFaces = _32[0],
22237
+ setNumFramesWithoutFaces = _32[1];
22222
22238
  onSelfiePredictionMade(f(React.useCallback(function (_a) {
22223
22239
  var face = _a.face;
22224
22240
  if (selfieModelError) return;
@@ -22234,12 +22250,12 @@
22234
22250
  }
22235
22251
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
22236
22252
  var theme = styled.useTheme();
22237
- var _32 = useTranslations(rawVerbiage, {
22253
+ var _33 = useTranslations(rawVerbiage, {
22238
22254
  faceNotCenteredText: 'Please move your face to the center...',
22239
22255
  captureBtnText: 'Capture'
22240
22256
  }),
22241
- captureBtnText = _32.captureBtnText,
22242
- faceNotCenteredText = _32.faceNotCenteredText;
22257
+ captureBtnText = _33.captureBtnText,
22258
+ faceNotCenteredText = _33.faceNotCenteredText;
22243
22259
  var debugScalingDetails = useDebugScalingDetails({
22244
22260
  enabled: debugMode,
22245
22261
  pageWidth: width,
@@ -22314,6 +22330,11 @@
22314
22330
  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"])));
22315
22331
  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"])));
22316
22332
  var CaptureButton = styled(LoaderButton)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin: 0 auto 25px;\n"], ["\n margin: 0 auto 25px;\n"])));
22333
+ function evaluateShouldSkip(value) {
22334
+ if (value === true) return true;
22335
+ if (typeof value === 'function') return value();
22336
+ return false;
22337
+ }
22317
22338
  var templateObject_1$5, templateObject_2$5, templateObject_3$5, templateObject_4;
22318
22339
 
22319
22340
  var IdVideoCaptureSuccess = function IdVideoCaptureSuccess(_a) {
@@ -22607,7 +22628,8 @@
22607
22628
  documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
22608
22629
  focusModelUrl: (_j = (_h = idCaptureProps.assets) === null || _h === void 0 ? void 0 : _h.focusModelUrl) !== null && _j !== void 0 ? _j : '',
22609
22630
  onModelError: onIdCaptureModelError,
22610
- modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs
22631
+ modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
22632
+ allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
22611
22633
  }, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
22612
22634
  autoStart: false,
22613
22635
  onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
@@ -22857,7 +22879,8 @@
22857
22879
  documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
22858
22880
  focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
22859
22881
  onModelError: idCaptureProps.onModelError,
22860
- modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs
22882
+ modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
22883
+ allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
22861
22884
  }, /*#__PURE__*/React.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React.createElement(IdCaptureWizard, _assign({}, idCaptureProps, {
22862
22885
  onSuccess: onIdCaptureSuccess
22863
22886
  }))))));
@@ -23179,31 +23202,33 @@
23179
23202
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
23180
23203
  _d = _a.idCaptureRequirement,
23181
23204
  idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
23182
- _e = _a.separateIdCardCaptureSequence,
23183
- separateIdCardCaptureSequence = _e === void 0 ? false : _e,
23184
- _f = _a.idCaptureThresholds,
23185
- idCaptureThresholds = _f === void 0 ? defaultIdCaptureThresholds : _f,
23186
- _g = _a.skipSuccessScreen,
23187
- skipSuccessScreen = _g === void 0 ? false : _g,
23205
+ _e = _a.allowSinglePageIdCapture,
23206
+ allowSinglePageIdCapture = _e === void 0 ? false : _e,
23207
+ _f = _a.separateIdCardCaptureSequence,
23208
+ separateIdCardCaptureSequence = _f === void 0 ? false : _f,
23209
+ _g = _a.idCaptureThresholds,
23210
+ idCaptureThresholds = _g === void 0 ? defaultIdCaptureThresholds : _g,
23211
+ _h = _a.skipSuccessScreen,
23212
+ skipSuccessScreen = _h === void 0 ? false : _h,
23188
23213
  instructions = _a.instructions,
23189
- _h = _a.guideType,
23190
- guideType = _h === void 0 ? 'fit' : _h,
23191
- _j = _a.guideImages,
23192
- guideImages = _j === void 0 ? defaultIdCaptureGuideImages : _j,
23193
- _k = _a.portraitGuidesOnMobile,
23194
- portraitGuidesOnMobile = _k === void 0 ? true : _k,
23195
- _l = _a.rotateLoadingOverlayImageWhenPortrait,
23196
- rotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
23197
- _m = _a.modelLoadTimeoutMs,
23198
- modelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
23199
- _o = _a.forceFallbackMode,
23200
- forceFallbackMode = _o === void 0 ? false : _o,
23201
- _p = _a.allowIdCardBackToFrontCapture,
23202
- allowIdCardBackToFrontCapture = _p === void 0 ? false : _p,
23203
- _q = _a.enableOverrideWrongDocumentTypeDialog,
23204
- enableOverrideWrongDocumentTypeDialog = _q === void 0 ? false : _q,
23205
- _r = _a.allowOverrideWrongDocumentTypeAfterMs,
23206
- allowOverrideWrongDocumentTypeAfterMs = _r === void 0 ? 8000 : _r,
23214
+ _j = _a.guideType,
23215
+ guideType = _j === void 0 ? 'fit' : _j,
23216
+ _k = _a.guideImages,
23217
+ guideImages = _k === void 0 ? defaultIdCaptureGuideImages : _k,
23218
+ _l = _a.portraitGuidesOnMobile,
23219
+ portraitGuidesOnMobile = _l === void 0 ? true : _l,
23220
+ _m = _a.rotateLoadingOverlayImageWhenPortrait,
23221
+ rotateLoadingOverlayImageWhenPortrait = _m === void 0 ? true : _m,
23222
+ _o = _a.modelLoadTimeoutMs,
23223
+ modelLoadTimeoutMs = _o === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _o,
23224
+ _p = _a.forceFallbackMode,
23225
+ forceFallbackMode = _p === void 0 ? false : _p,
23226
+ _q = _a.allowIdCardBackToFrontCapture,
23227
+ allowIdCardBackToFrontCapture = _q === void 0 ? false : _q,
23228
+ _r = _a.enableOverrideWrongDocumentTypeDialog,
23229
+ enableOverrideWrongDocumentTypeDialog = _r === void 0 ? false : _r,
23230
+ _s = _a.allowOverrideWrongDocumentTypeAfterMs,
23231
+ allowOverrideWrongDocumentTypeAfterMs = _s === void 0 ? 8000 : _s,
23207
23232
  onBeforeSubmit = _a.onBeforeSubmit,
23208
23233
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
23209
23234
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -23217,28 +23242,28 @@
23217
23242
  onUserCancel = _a.onUserCancel,
23218
23243
  onModelError = _a.onModelError,
23219
23244
  onCameraAccessDenied = _a.onCameraAccessDenied,
23220
- _s = _a.theme,
23221
- theme = _s === void 0 ? 'default' : _s,
23222
- _t = _a.assets,
23223
- assets = _t === void 0 ? {} : _t,
23224
- _u = _a.classNames,
23225
- classNames = _u === void 0 ? {} : _u,
23226
- _v = _a.colors,
23227
- colors = _v === void 0 ? {} : _v,
23228
- _w = _a.verbiage,
23229
- verbiage = _w === void 0 ? {} : _w,
23230
- _x = _a.captureSignature,
23231
- captureSignature = _x === void 0 ? false : _x,
23232
- _y = _a.captureSignatureVideo,
23233
- captureSignatureVideo = _y === void 0 ? false : _y,
23234
- _z = _a.captureAdditionalDocuments,
23235
- captureAdditionalDocuments = _z === void 0 ? [] : _z,
23236
- _0 = _a.geolocationEnabled,
23237
- geolocationEnabled = _0 === void 0 ? true : _0,
23238
- _1 = _a.geolocationRequired,
23239
- geolocationRequired = _1 === void 0 ? false : _1,
23240
- _2 = _a.debugMode,
23241
- debugMode = _2 === void 0 ? false : _2;
23245
+ _t = _a.theme,
23246
+ theme = _t === void 0 ? 'default' : _t,
23247
+ _u = _a.assets,
23248
+ assets = _u === void 0 ? {} : _u,
23249
+ _v = _a.classNames,
23250
+ classNames = _v === void 0 ? {} : _v,
23251
+ _w = _a.colors,
23252
+ colors = _w === void 0 ? {} : _w,
23253
+ _x = _a.verbiage,
23254
+ verbiage = _x === void 0 ? {} : _x,
23255
+ _y = _a.captureSignature,
23256
+ captureSignature = _y === void 0 ? false : _y,
23257
+ _z = _a.captureSignatureVideo,
23258
+ captureSignatureVideo = _z === void 0 ? false : _z,
23259
+ _0 = _a.captureAdditionalDocuments,
23260
+ captureAdditionalDocuments = _0 === void 0 ? [] : _0,
23261
+ _1 = _a.geolocationEnabled,
23262
+ geolocationEnabled = _1 === void 0 ? true : _1,
23263
+ _2 = _a.geolocationRequired,
23264
+ geolocationRequired = _2 === void 0 ? false : _2,
23265
+ _3 = _a.debugMode,
23266
+ debugMode = _3 === void 0 ? false : _3;
23242
23267
  useLanguage(lang);
23243
23268
  useDebugLogging(debugMode);
23244
23269
  var idCaptureProps = React.useMemo(function () {
@@ -23248,6 +23273,7 @@
23248
23273
  onModelError: onModelError,
23249
23274
  precapturedDocuments: precapturedDocuments,
23250
23275
  captureRequirement: idCaptureRequirement,
23276
+ allowSinglePageIdCapture: allowSinglePageIdCapture,
23251
23277
  separateIdCardCaptureSequence: separateIdCardCaptureSequence,
23252
23278
  thresholds: idCaptureThresholds,
23253
23279
  skipSuccessScreen: skipSuccessScreen,
@@ -23270,7 +23296,7 @@
23270
23296
  verbiage: verbiage,
23271
23297
  debugMode: debugMode
23272
23298
  };
23273
- }, [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]);
23299
+ }, [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]);
23274
23300
  var additionalDocumentCaptureProps = React.useMemo(function () {
23275
23301
  return {
23276
23302
  documents: captureAdditionalDocuments,