idmission-web-sdk 2.2.64 → 2.2.66

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 (59) hide show
  1. package/dist/components/CompositeWizard.d.ts.map +1 -1
  2. package/dist/components/Example.d.ts +1 -1
  3. package/dist/components/Example.d.ts.map +1 -1
  4. package/dist/components/camera/CameraVideoTag.d.ts.map +1 -1
  5. package/dist/components/customer_flows/IdValidation.d.ts +3 -1
  6. package/dist/components/customer_flows/IdValidation.d.ts.map +1 -1
  7. package/dist/components/document_capture/DocumentCaptureStateProvider.d.ts.map +1 -1
  8. package/dist/components/fallback_flows/IdCapture.d.ts.map +1 -1
  9. package/dist/components/id_capture/CapturedDocuments.d.ts +1 -1
  10. package/dist/components/id_capture/CapturedDocuments.d.ts.map +1 -1
  11. package/dist/components/id_capture/IdCapture.d.ts +2 -2
  12. package/dist/components/id_capture/IdCapture.d.ts.map +1 -1
  13. package/dist/components/id_capture/IdCaptureModelsProvider.d.ts +2 -1
  14. package/dist/components/id_capture/IdCaptureModelsProvider.d.ts.map +1 -1
  15. package/dist/components/id_capture/IdCaptureRequirementOption.d.ts +7 -5
  16. package/dist/components/id_capture/IdCaptureRequirementOption.d.ts.map +1 -1
  17. package/dist/components/id_capture/IdCaptureStateProvider.d.ts +4 -0
  18. package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
  19. package/dist/components/id_capture/IdCaptureSuccess.d.ts +0 -4
  20. package/dist/components/id_capture/IdCaptureSuccess.d.ts.map +1 -1
  21. package/dist/components/id_capture/IdCaptureWizard.d.ts +2 -1
  22. package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
  23. package/dist/components/selfie_capture/SelfieCapture.d.ts.map +1 -1
  24. package/dist/components/signature_capture/SignatureCapture.d.ts.map +1 -1
  25. package/dist/components/submission/SubmissionProvider.d.ts.map +1 -1
  26. package/dist/components/video_id/IdVideoCapture.d.ts +2 -0
  27. package/dist/components/video_id/IdVideoCapture.d.ts.map +1 -1
  28. package/dist/components/video_id/IdVideoCaptureWizard.d.ts.map +1 -1
  29. package/dist/index.d.ts +1 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/lib/camera/Camera.d.ts +0 -43
  32. package/dist/lib/camera/Camera.d.ts.map +1 -1
  33. package/dist/lib/camera/cameraStore.d.ts.map +1 -1
  34. package/dist/lib/models/DocumentDetection.d.ts +6 -2
  35. package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
  36. package/dist/lib/models/Focus.d.ts +4 -0
  37. package/dist/lib/models/Focus.d.ts.map +1 -1
  38. package/dist/lib/models/defaults/DocumentDetector.d.ts +1 -1
  39. package/dist/sdk2.cjs.development.js +533 -464
  40. package/dist/sdk2.cjs.development.js.map +1 -1
  41. package/dist/sdk2.cjs.production.js +1 -1
  42. package/dist/sdk2.cjs.production.js.map +1 -1
  43. package/dist/sdk2.esm.js +533 -464
  44. package/dist/sdk2.esm.js.map +1 -1
  45. package/dist/sdk2.umd.development.js +533 -464
  46. package/dist/sdk2.umd.development.js.map +1 -1
  47. package/dist/sdk2.umd.production.js +1 -1
  48. package/dist/sdk2.umd.production.js.map +1 -1
  49. package/dist/themes/index.d.ts.map +1 -1
  50. package/dist/version.d.ts +1 -1
  51. package/package.json +5 -10
  52. package/dist/lib/barcode/Native.d.ts +0 -2
  53. package/dist/lib/barcode/Native.d.ts.map +0 -1
  54. package/dist/lib/barcode/Scan.d.ts +0 -5
  55. package/dist/lib/barcode/Scan.d.ts.map +0 -1
  56. package/dist/lib/barcode/ZXing.d.ts +0 -2
  57. package/dist/lib/barcode/ZXing.d.ts.map +0 -1
  58. package/dist/lib/camera/videoRefStack.d.ts +0 -6
  59. package/dist/lib/camera/videoRefStack.d.ts.map +0 -1
@@ -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.64';
214
+ var webSdkVersion = '2.2.66';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -1298,7 +1298,7 @@
1298
1298
  parts[_i] = arguments[_i];
1299
1299
  }
1300
1300
  if (logLevel < LogLevel.Debug) return;
1301
- console.debug.apply(console, parts); // eslint-disable-line
1301
+ console.debug.apply(console, parts); // eslint-disable-line no-console
1302
1302
  }
1303
1303
  function log() {
1304
1304
  var parts = [];
@@ -1306,7 +1306,7 @@
1306
1306
  parts[_i] = arguments[_i];
1307
1307
  }
1308
1308
  if (logLevel < LogLevel.Info) return;
1309
- console.log.apply(console, parts); // eslint-disable-line
1309
+ console.log.apply(console, parts); // eslint-disable-line no-console
1310
1310
  }
1311
1311
  function warn() {
1312
1312
  var parts = [];
@@ -1314,7 +1314,7 @@
1314
1314
  parts[_i] = arguments[_i];
1315
1315
  }
1316
1316
  if (logLevel < LogLevel.Warn) return;
1317
- console.warn.apply(console, parts); // eslint-disable-line
1317
+ console.warn.apply(console, parts); // eslint-disable-line no-console
1318
1318
  }
1319
1319
  function error() {
1320
1320
  var parts = [];
@@ -1322,7 +1322,7 @@
1322
1322
  parts[_i] = arguments[_i];
1323
1323
  }
1324
1324
  if (logLevel < LogLevel.Error) return;
1325
- console.error.apply(console, parts); // eslint-disable-line
1325
+ console.error.apply(console, parts); // eslint-disable-line no-console
1326
1326
  }
1327
1327
 
1328
1328
  var sparkMd5 = {exports: {}};
@@ -2275,82 +2275,33 @@
2275
2275
  onDocumentUploadFailed.current = userSuppliedOnDocumentUploadFailed;
2276
2276
  }, [userSuppliedOnDocumentUploadFailed]);
2277
2277
  var uploadDocument = React.useCallback(function (src, metadata) {
2278
- return new Promise(function (resolve, reject) {
2279
- return __awaiter(void 0, void 0, void 0, function () {
2280
- var blob, _a, documentId, upload, _b, _c;
2281
- var _d, _e;
2282
- var _f;
2283
- return __generator(this, function (_g) {
2284
- switch (_g.label) {
2285
- case 0:
2286
- blob = typeof src === 'string' ? convertBase64ToBlob(src) : src;
2287
- _a = onBeforeDocumentUpload.current;
2288
- if (!_a) return [3 /*break*/, 2];
2289
- return [4 /*yield*/, (_f = onBeforeDocumentUpload.current) === null || _f === void 0 ? void 0 : _f.call(onBeforeDocumentUpload, blob, metadata)];
2290
- case 1:
2291
- _a = _g.sent() === false;
2292
- _g.label = 2;
2293
- case 2:
2294
- if (_a) return [2 /*return*/, resolve(blobToB64(blob))];
2295
- _b = createUpload;
2296
- _c = [blob];
2297
- _d = {
2298
- endpoint: documentServiceUrl,
2299
- retryDelays: [0, 1000, 1000, 1000, 3000, 5000, 10000, 20000],
2300
- headers: {
2301
- 'X-Session-Id': sessionId
2302
- }
2303
- };
2304
- _e = {
2305
- filetype: blob.type,
2306
- contentType: blob.type
2307
- };
2308
- return [4 /*yield*/, calculateMd5(blob)];
2309
- case 3:
2310
- upload = _b.apply(void 0, _c.concat([(_d.metadata = _assign.apply(void 0, [(_e.fingerprint = _g.sent(), _e), metadata || {}]), _d.onProgress = function (bytesUploaded, bytesTotal) {
2311
- var _a;
2312
- (_a = onDocumentUploadProgress.current) === null || _a === void 0 ? void 0 : _a.call(onDocumentUploadProgress, {
2313
- bytesUploaded: bytesUploaded,
2314
- bytesTotal: bytesTotal,
2315
- percentage: (bytesUploaded / bytesTotal * 100).toFixed(2) + '%',
2316
- metadata: metadata
2317
- });
2318
- }, _d.onAfterResponse = function (_req, res) {
2319
- var contentType = res.getHeader('Content-Type');
2320
- if (!(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('application/json'))) return;
2321
- var body = res.getBody();
2322
- if (!body) return;
2323
- try {
2324
- var parsedId = JSON.parse(body).id;
2325
- if (parsedId.startsWith('urn:documentsv1:')) {
2326
- documentId = parsedId;
2327
- }
2328
- } catch (e) {
2329
- warn('Failed to parse documents service response body', e);
2330
- }
2331
- }, _d.onSuccess = function () {
2332
- var _a, _b;
2333
- documentId || (documentId = "urn:documentsv1:".concat(getEnvFromUrl(upload.url), ":").concat((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift()));
2334
- (_b = onDocumentUploaded.current) === null || _b === void 0 ? void 0 : _b.call(onDocumentUploaded, documentId, metadata);
2335
- resolve(documentId);
2336
- }, _d.onError = function (error) {
2337
- var _a;
2338
- log('Failed because: ' + error);
2339
- (_a = onDocumentUploadFailed.current) === null || _a === void 0 ? void 0 : _a.call(onDocumentUploadFailed, error, metadata);
2340
- reject(error);
2341
- }, _d)]));
2342
- // Check if there are any previous uploads to continue.
2343
- upload.findPreviousUploads().then(function (previousUploads) {
2344
- // Found previous uploads so we select the first one.
2345
- if (previousUploads.length) {
2346
- upload.resumeFromPreviousUpload(previousUploads[0]);
2347
- }
2348
- // Start the upload
2349
- upload.start();
2350
- });
2351
- return [2 /*return*/];
2352
- }
2353
- });
2278
+ return __awaiter(void 0, void 0, void 0, function () {
2279
+ var blob, _a;
2280
+ var _b;
2281
+ return __generator(this, function (_c) {
2282
+ switch (_c.label) {
2283
+ case 0:
2284
+ blob = typeof src === 'string' ? convertBase64ToBlob(src) : src;
2285
+ _a = onBeforeDocumentUpload.current;
2286
+ if (!_a) return [3 /*break*/, 2];
2287
+ return [4 /*yield*/, (_b = onBeforeDocumentUpload.current) === null || _b === void 0 ? void 0 : _b.call(onBeforeDocumentUpload, blob, metadata)];
2288
+ case 1:
2289
+ _a = _c.sent() === false;
2290
+ _c.label = 2;
2291
+ case 2:
2292
+ if (_a) {
2293
+ return [2 /*return*/, blobToB64(blob)];
2294
+ }
2295
+ return [2 /*return*/, performUpload({
2296
+ blob: blob,
2297
+ endpoint: documentServiceUrl,
2298
+ sessionId: sessionId,
2299
+ metadata: metadata,
2300
+ onDocumentUploadProgress: onDocumentUploadProgress.current,
2301
+ onDocumentUploaded: onDocumentUploaded.current,
2302
+ onDocumentUploadFailed: onDocumentUploadFailed.current
2303
+ })];
2304
+ }
2354
2305
  });
2355
2306
  });
2356
2307
  }, [documentServiceUrl, sessionId]);
@@ -2899,6 +2850,83 @@
2899
2850
  }
2900
2851
  return 'unknown';
2901
2852
  }
2853
+ function performUpload(_a) {
2854
+ return __awaiter(this, arguments, void 0, function (_b) {
2855
+ var fingerprint;
2856
+ var blob = _b.blob,
2857
+ endpoint = _b.endpoint,
2858
+ sessionId = _b.sessionId,
2859
+ metadata = _b.metadata,
2860
+ onDocumentUploadProgress = _b.onDocumentUploadProgress,
2861
+ onDocumentUploaded = _b.onDocumentUploaded,
2862
+ onDocumentUploadFailed = _b.onDocumentUploadFailed;
2863
+ return __generator(this, function (_c) {
2864
+ switch (_c.label) {
2865
+ case 0:
2866
+ return [4 /*yield*/, calculateMd5(blob)];
2867
+ case 1:
2868
+ fingerprint = _c.sent();
2869
+ return [2 /*return*/, new Promise(function (resolve, reject) {
2870
+ var documentId;
2871
+ var upload = createUpload(blob, {
2872
+ endpoint: endpoint,
2873
+ retryDelays: [0, 1000, 1000, 1000, 3000, 5000, 10000, 20000],
2874
+ headers: {
2875
+ 'X-Session-Id': sessionId
2876
+ },
2877
+ metadata: _assign({
2878
+ filetype: blob.type,
2879
+ contentType: blob.type,
2880
+ fingerprint: fingerprint
2881
+ }, metadata || {}),
2882
+ onProgress: function onProgress(bytesUploaded, bytesTotal) {
2883
+ onDocumentUploadProgress === null || onDocumentUploadProgress === void 0 ? void 0 : onDocumentUploadProgress({
2884
+ bytesUploaded: bytesUploaded,
2885
+ bytesTotal: bytesTotal,
2886
+ percentage: (bytesUploaded / bytesTotal * 100).toFixed(2) + '%',
2887
+ metadata: metadata
2888
+ });
2889
+ },
2890
+ onAfterResponse: function onAfterResponse(_req, res) {
2891
+ var contentType = res.getHeader('Content-Type');
2892
+ if (!(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('application/json'))) return;
2893
+ var body = res.getBody();
2894
+ if (!body) return;
2895
+ try {
2896
+ var parsedId = JSON.parse(body).id;
2897
+ if (parsedId.startsWith('urn:documentsv1:')) {
2898
+ documentId = parsedId;
2899
+ }
2900
+ } catch (e) {
2901
+ warn('Failed to parse documents service response body', e);
2902
+ }
2903
+ },
2904
+ onSuccess: function onSuccess() {
2905
+ var _a;
2906
+ documentId || (documentId = "urn:documentsv1:".concat(getEnvFromUrl(upload.url), ":").concat((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift()));
2907
+ onDocumentUploaded === null || onDocumentUploaded === void 0 ? void 0 : onDocumentUploaded(documentId, metadata);
2908
+ resolve(documentId);
2909
+ },
2910
+ onError: function onError(error) {
2911
+ log('Failed because: ' + error);
2912
+ onDocumentUploadFailed === null || onDocumentUploadFailed === void 0 ? void 0 : onDocumentUploadFailed(error, metadata);
2913
+ reject(error);
2914
+ }
2915
+ });
2916
+ // Check if there are any previous uploads to continue.
2917
+ upload.findPreviousUploads().then(function (previousUploads) {
2918
+ // Found previous uploads so we select the first one.
2919
+ if (previousUploads.length) {
2920
+ upload.resumeFromPreviousUpload(previousUploads[0]);
2921
+ }
2922
+ // Start the upload
2923
+ upload.start();
2924
+ });
2925
+ })];
2926
+ }
2927
+ });
2928
+ });
2929
+ }
2902
2930
 
2903
2931
  // This could've been more streamlined with internal state instead of abusing
2904
2932
  // refs to such extent, but then composing hooks and components could not opt out of unnecessary renders.
@@ -8311,7 +8339,7 @@
8311
8339
 
8312
8340
  var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
8313
8341
 
8314
- 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");
8315
8343
 
8316
8344
  var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
8317
8345
 
@@ -8330,6 +8358,10 @@
8330
8358
  passport: {
8331
8359
  desktop: 0,
8332
8360
  mobile: 0.3
8361
+ },
8362
+ singlePage: {
8363
+ desktop: 0,
8364
+ mobile: 0.3
8333
8365
  }
8334
8366
  };
8335
8367
  var classifier = null;
@@ -8437,7 +8469,7 @@
8437
8469
  };
8438
8470
  }, [modelPath, modelLoadTimeoutMs, videoRef, shouldLoadModels]);
8439
8471
  React.useEffect(function handleModelError() {
8440
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
8472
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
8441
8473
  }, [modelError, onModelError]);
8442
8474
  return {
8443
8475
  ready: ready,
@@ -8583,7 +8615,7 @@
8583
8615
  };
8584
8616
  }, [modelLoadTimeoutMs, videoRef]);
8585
8617
  React.useEffect(function handleModelError() {
8586
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
8618
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
8587
8619
  }, [modelError, onModelError]);
8588
8620
  return {
8589
8621
  ready: ready,
@@ -8955,16 +8987,19 @@
8955
8987
  idCardFront: 0.6,
8956
8988
  idCardBack: 0.6,
8957
8989
  passport: 0.4,
8990
+ singlePage: 0.4,
8958
8991
  stability: {
8959
8992
  idCardFront: 0.85,
8960
8993
  idCardBack: 0.85,
8961
- passport: 0.5
8994
+ passport: 0.5,
8995
+ singlePage: 0.5
8962
8996
  }
8963
8997
  };
8964
8998
  var documentTypeDisplayNames = {
8965
8999
  idCardFront: 'ID card front',
8966
9000
  idCardBack: 'ID card back',
8967
9001
  passport: 'Passport',
9002
+ singlePage: 'Single page',
8968
9003
  none: 'None'
8969
9004
  };
8970
9005
  var detector = null;
@@ -9079,7 +9114,7 @@
9079
9114
  };
9080
9115
  }, [shouldLoadModels, modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
9081
9116
  React.useEffect(function handleModelError() {
9082
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
9117
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
9083
9118
  }, [modelError, onModelError]);
9084
9119
  return {
9085
9120
  ready: ready,
@@ -9153,7 +9188,7 @@
9153
9188
  right: 20
9154
9189
  };
9155
9190
  function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
9156
- 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;
9157
9192
  if (boundaries === void 0) {
9158
9193
  boundaries = defaultDocumentDetectionBoundaries;
9159
9194
  }
@@ -9204,18 +9239,25 @@
9204
9239
  var bestPassportPage = detectedObjects.find(function (obj) {
9205
9240
  return obj.label === 'Passport page';
9206
9241
  });
9242
+ var bestSinglePage = detectedObjects.find(function (obj) {
9243
+ return obj.label === 'Single page';
9244
+ });
9207
9245
  var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
9208
9246
  var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
9209
9247
  var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
9210
- var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_h = thresholds.idCardFront) !== null && _h !== void 0 ? _h : 0);
9211
- var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_j = thresholds.idCardBack) !== null && _j !== void 0 ? _j : 0);
9212
- var passportDetectionThresholdMet = passportDetectionScore >= ((_k = thresholds.passport) !== null && _k !== void 0 ? _k : 0);
9213
- var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
9214
- var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
9215
- 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;
9216
9256
  var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
9217
9257
  var detectedDocumentType = 'none';
9218
- if (passportDetectionThresholdMet) {
9258
+ if (singlePageDetectionThresholdMet) {
9259
+ detectedDocumentType = 'singlePage';
9260
+ } else if (passportDetectionThresholdMet) {
9219
9261
  detectedDocumentType = 'passport';
9220
9262
  } else if (idCardBackDetectionThresholdMet) {
9221
9263
  detectedDocumentType = 'idCardBack';
@@ -9229,12 +9271,12 @@
9229
9271
  var documentIsStable = false;
9230
9272
  var documentTooClose = false;
9231
9273
  if (bestDocument) {
9232
- var _o = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
9233
- docWidth = _o[0],
9234
- docHeight = _o[1];
9274
+ var _q = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
9275
+ docWidth = _q[0],
9276
+ docHeight = _q[1];
9235
9277
  documentTooClose = docWidth > 0.85 || docHeight > 0.85;
9236
9278
  if (detectionThresholdMet && documentInBounds && !documentTooClose) {
9237
- 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;
9238
9280
  var threshold_1 = thresholdSet[detectedDocumentType];
9239
9281
  var framesNeeded = Math.ceil(average(framesNeededSamples));
9240
9282
  trackBox(bestDocument.box, framesNeeded);
@@ -9256,6 +9298,8 @@
9256
9298
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
9257
9299
  passportDetectionScore: passportDetectionScore,
9258
9300
  passportDetectionThresholdMet: passportDetectionThresholdMet,
9301
+ singlePageDetectionScore: singlePageDetectionScore,
9302
+ singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
9259
9303
  bestDocument: bestDocument,
9260
9304
  documentInBounds: documentInBounds,
9261
9305
  documentTooClose: documentTooClose,
@@ -9321,8 +9365,8 @@
9321
9365
  renderPrediction().then();
9322
9366
  return function () {
9323
9367
  loopId.current += 1;
9324
- frameId.current && cancelAnimationFrame(frameId.current);
9325
- timer && clearTimeout(timer);
9368
+ if (frameId.current) cancelAnimationFrame(frameId.current);
9369
+ if (timer) clearTimeout(timer);
9326
9370
  };
9327
9371
  }, [fn, running, throttleMs]);
9328
9372
  var start = React.useCallback(function () {
@@ -9541,7 +9585,7 @@
9541
9585
  },
9542
9586
  requestCameraAccess: function requestCameraAccess() {
9543
9587
  return __awaiter(this, void 0, void 0, function () {
9544
- var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, handleStreamEnded_1, videoTrack_1, camera_1, e_3;
9588
+ var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, e_2, handleStreamEnded_1, videoTrack_1, camera_1, e_3;
9545
9589
  var _b, _c, _d;
9546
9590
  return __generator(this, function (_e) {
9547
9591
  switch (_e.label) {
@@ -9661,13 +9705,13 @@
9661
9705
  debug('opened stream with no width and height constraints');
9662
9706
  return [3 /*break*/, 10];
9663
9707
  case 9:
9664
- _e.sent();
9665
- debug('cannot open stream at all');
9708
+ e_2 = _e.sent();
9709
+ debug('cannot open stream at all', e_2);
9666
9710
  return [3 /*break*/, 10];
9667
9711
  case 10:
9668
9712
  if (!stream_1) {
9669
9713
  error('failed to open camera');
9670
- throw new Error('failed to open camera');
9714
+ throw new Error('failed to open camera: ');
9671
9715
  }
9672
9716
  debug('camera access granted with constraints', constraints);
9673
9717
  handleStreamEnded_1 = function handleStreamEnded_1() {
@@ -9748,7 +9792,7 @@
9748
9792
  },
9749
9793
  requestMicrophoneAccess: function requestMicrophoneAccess() {
9750
9794
  return __awaiter(this, void 0, void 0, function () {
9751
- var stream_2;
9795
+ var stream_2, e_4;
9752
9796
  return __generator(this, function (_a) {
9753
9797
  switch (_a.label) {
9754
9798
  case 0:
@@ -9787,7 +9831,8 @@
9787
9831
  }, 500);
9788
9832
  return [3 /*break*/, 4];
9789
9833
  case 3:
9790
- _a.sent();
9834
+ e_4 = _a.sent();
9835
+ debug('failed to open microphone', e_4);
9791
9836
  set({
9792
9837
  microphoneAccessDenied: true
9793
9838
  });
@@ -10152,9 +10197,7 @@
10152
10197
  // @ts-ignore
10153
10198
  return navAny.userAgentData && navAny.userAgentData.mobile;
10154
10199
  }
10155
- return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) ||
10156
- // tslint:disable-next-line:max-line-length
10157
- /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
10200
+ return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
10158
10201
  }
10159
10202
  return false;
10160
10203
  }
@@ -10203,37 +10246,39 @@
10203
10246
  });
10204
10247
  function IdCaptureModelsProviderInner(_a) {
10205
10248
  var children = _a.children,
10206
- onModelError = _a.onModelError;
10207
- var _b = React.useContext(DocumentDetectionModelContext),
10208
- documentDetectionModelReady = _b.documentDetectionModelReady,
10209
- documentDetectionModelDownloadProgress = _b.documentDetectionModelDownloadProgress,
10210
- startDocumentDetection = _b.startDocumentDetection,
10211
- stopDocumentDetection = _b.stopDocumentDetection,
10212
- lastPredictionCanvas = _b.documentDetectionLastPredictionCanvas,
10213
- clearDocumentDetectionLastPredictionCanvas = _b.clearDocumentDetectionLastPredictionCanvas,
10214
- onDocumentDetected = _b.onDocumentDetected,
10215
- detectionTime = _b.detectionTime,
10216
- documentDetectionThresholds = _b.documentDetectionThresholds,
10217
- setDocumentDetectionThresholds = _b.setDocumentDetectionThresholds,
10218
- documentDetectionBoundaries = _b.documentDetectionBoundaries,
10219
- setDocumentDetectionBoundaries = _b.setDocumentDetectionBoundaries,
10220
- documentDetectionModelError = _b.documentDetectionModelError;
10221
- var _c = React.useContext(FocusModelContext),
10222
- focusModelReady = _c.focusModelReady,
10223
- focusModelDownloadProgress = _c.focusModelDownloadProgress,
10224
- makeFocusPrediction = _c.makeFocusPrediction,
10225
- focusThresholds = _c.focusThresholds,
10226
- setFocusThresholds = _c.setFocusThresholds,
10227
- focusPredictionTime = _c.focusPredictionTime,
10228
- 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;
10229
10274
  var onPredictionHandler = React.useRef();
10230
10275
  var bestFrameDetails = React.useRef(null);
10231
10276
  var bestPredictionCanvas = React.useRef(null);
10232
10277
  var bestFocusScore = React.useRef(0);
10233
10278
  var stopDetection = React.useRef(0);
10234
- var _d = React.useState('none'),
10235
- requiredDocumentType = _d[0],
10236
- setRequiredDocumentType = _d[1];
10279
+ var _e = React.useState('none'),
10280
+ requiredDocumentType = _e[0],
10281
+ setRequiredDocumentType = _e[1];
10237
10282
  var thresholds = React.useMemo(function () {
10238
10283
  return _assign(_assign({}, documentDetectionThresholds), {
10239
10284
  focus: focusThresholds
@@ -10251,34 +10296,42 @@
10251
10296
  var _this = this;
10252
10297
  onDocumentDetected(function (prediction) {
10253
10298
  return __awaiter(_this, void 0, void 0, function () {
10254
- var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
10255
- var _a, _b, _c, _d, _e, _f;
10256
- 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) {
10257
10302
  if (!lastPredictionCanvas.current) return [2 /*return*/];
10258
10303
  stopDetectionAtStart = stopDetection.current;
10259
10304
  focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
10260
- 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'));
10261
10314
  if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
10262
- 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);
10263
10316
  if (focusPrediction) {
10264
10317
  focusScore = focusPrediction.score;
10265
10318
  focusPredictionTime = focusPrediction.predictionTime;
10266
10319
  }
10267
- focusThresholdSet = (_c = thresholds.focus) === null || _c === void 0 ? void 0 : _c[prediction.detectedDocumentType];
10268
- 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;
10269
10322
  focusThresholdMet = focusScore >= focusThreshold;
10270
10323
  if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
10271
10324
  bestFocusScore.current = focusScore;
10272
10325
  drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
10273
10326
  bestFrameDetails.current = {
10274
- 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,
10275
10328
  documentType: prediction.detectedDocumentType,
10276
10329
  detectionScore: prediction.detectionScore,
10277
10330
  focusScore: focusScore
10278
10331
  };
10279
10332
  }
10280
10333
  }
10281
- (_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), {
10282
10335
  focusScore: focusScore,
10283
10336
  focusPredictionTime: focusPredictionTime,
10284
10337
  focusThresholdMet: focusThresholdMet
@@ -10287,10 +10340,10 @@
10287
10340
  });
10288
10341
  });
10289
10342
  });
10290
- }, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
10343
+ }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
10291
10344
  var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
10292
10345
  React.useEffect(function handleModelErrors() {
10293
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
10346
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
10294
10347
  }, [modelError, onModelError]);
10295
10348
  var onPredictionMade = React.useCallback(function (handler) {
10296
10349
  onPredictionHandler.current = handler;
@@ -10301,9 +10354,9 @@
10301
10354
  canvas: bestPredictionCanvas.current
10302
10355
  });
10303
10356
  }, []);
10304
- var _e = React.useState(0),
10305
- canvasKey = _e[0],
10306
- setCanvasKey = _e[1];
10357
+ var _f = React.useState(0),
10358
+ canvasKey = _f[0],
10359
+ setCanvasKey = _f[1];
10307
10360
  var resetBestFrame = React.useCallback(function () {
10308
10361
  stopDetection.current += 1;
10309
10362
  setCanvasKey(function (n) {
@@ -10314,7 +10367,7 @@
10314
10367
  bestFocusScore.current = 0;
10315
10368
  }, [clearDocumentDetectionLastPredictionCanvas]);
10316
10369
  React.useEffect(function () {
10317
- requiredDocumentType && resetBestFrame();
10370
+ if (requiredDocumentType) resetBestFrame();
10318
10371
  }, [requiredDocumentType, resetBestFrame]);
10319
10372
  var value = React.useMemo(function () {
10320
10373
  return {
@@ -10433,9 +10486,9 @@
10433
10486
  });
10434
10487
  }
10435
10488
 
10436
- var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'selfie'];
10489
+ var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
10437
10490
 
10438
- var requiredDocumentsForOption = {
10491
+ var acceptedDocumentTypesForIdCaptureRequirementOption = {
10439
10492
  idCardFront: ['idCardFront'],
10440
10493
  idCardBack: ['idCardBack'],
10441
10494
  passport: ['passport'],
@@ -10443,13 +10496,31 @@
10443
10496
  idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
10444
10497
  idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
10445
10498
  };
10446
- function requiredImageCountForOption(idCaptureRequirement) {
10499
+ function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
10447
10500
  if (idCaptureRequirement === 'idCardOrPassport') return 1;
10448
- return requiredDocumentsForOption[idCaptureRequirement].length;
10501
+ return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
10449
10502
  }
10450
- function allowedImageCountForOption(idCaptureRequirement) {
10503
+ function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
10451
10504
  if (idCaptureRequirement === 'idCardOrPassport') return 2;
10452
- 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
+ });
10453
10524
  }
10454
10525
 
10455
10526
  var initialState$4 = {
@@ -10488,6 +10559,8 @@
10488
10559
  idCardBackDetectionThresholdMet: false,
10489
10560
  passportDetectionScore: 0,
10490
10561
  passportDetectionThresholdMet: false,
10562
+ singlePageDetectionScore: 0,
10563
+ singlePageDetectionThresholdMet: false,
10491
10564
  focusScore: 0,
10492
10565
  focusThresholdMet: false,
10493
10566
  isGoodFrame: false,
@@ -10503,6 +10576,7 @@
10503
10576
  capturedDocuments: {},
10504
10577
  captureRequirement: 'idCardOrPassport',
10505
10578
  requestedDocumentType: 'idCardFront',
10579
+ allowSinglePageIdCapture: false,
10506
10580
  allowIdCardBackToFrontCapture: false,
10507
10581
  operationStartedAt: null,
10508
10582
  captureStartedAt: null
@@ -10517,11 +10591,13 @@
10517
10591
  var _c = action.payload,
10518
10592
  captureRequirement = _c.captureRequirement,
10519
10593
  precapturedDocuments = _c.precapturedDocuments,
10594
+ allowSinglePageIdCapture = _c.allowSinglePageIdCapture,
10520
10595
  allowIdCardBackToFrontCapture = _c.allowIdCardBackToFrontCapture,
10521
10596
  enableOverrideWrongDocumentTypeDialog = _c.enableOverrideWrongDocumentTypeDialog,
10522
10597
  allowOverrideWrongDocumentTypeAfterMs = _c.allowOverrideWrongDocumentTypeAfterMs;
10523
10598
  var newState = _assign(_assign({}, state), {
10524
10599
  captureRequirement: captureRequirement,
10600
+ allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
10525
10601
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
10526
10602
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
10527
10603
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
@@ -10589,6 +10665,8 @@
10589
10665
  idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
10590
10666
  passportDetectionScore = _d.passportDetectionScore,
10591
10667
  passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
10668
+ singlePageDetectionScore = _d.singlePageDetectionScore,
10669
+ singlePageDetectionThresholdMet = _d.singlePageDetectionThresholdMet,
10592
10670
  bestDocument = _d.bestDocument,
10593
10671
  documentInBounds = _d.documentInBounds,
10594
10672
  documentTooClose = _d.documentTooClose,
@@ -10609,7 +10687,8 @@
10609
10687
  }
10610
10688
  }
10611
10689
  }
10612
- 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');
10613
10692
  var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
10614
10693
  var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
10615
10694
  var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
@@ -10669,6 +10748,8 @@
10669
10748
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
10670
10749
  passportDetectionScore: passportDetectionScore,
10671
10750
  passportDetectionThresholdMet: passportDetectionThresholdMet,
10751
+ singlePageDetectionScore: singlePageDetectionScore,
10752
+ singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
10672
10753
  focusScore: focusScore,
10673
10754
  focusThresholdMet: focusThresholdMet,
10674
10755
  isGoodFrame: isGoodFrame,
@@ -10706,7 +10787,7 @@
10706
10787
  });
10707
10788
  case 'documentCaptured':
10708
10789
  {
10709
- var newState_1 = _assign(_assign({}, state), {
10790
+ var newState = _assign(_assign({}, state), {
10710
10791
  capturing: false,
10711
10792
  captureFailed: false,
10712
10793
  allowOverrideFlipRequirement: false,
@@ -10715,64 +10796,42 @@
10715
10796
  wrongDocumentTypePredictions: 0,
10716
10797
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
10717
10798
  });
10718
- var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
10719
- return !(v in newState_1.capturedDocuments);
10720
- });
10721
- if (state.captureRequirement === 'idCardOrPassport') {
10722
- if (state.requestedDocumentType === 'passport') {
10723
- remainingRequirements = [];
10724
- } else {
10725
- remainingRequirements = remainingRequirements.filter(function (v) {
10726
- return v !== 'passport';
10727
- });
10728
- }
10729
- }
10799
+ var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
10730
10800
  if (remainingRequirements.length === 0) {
10731
- newState_1.captureState = 'complete';
10801
+ newState.captureState = 'complete';
10732
10802
  } else {
10733
- newState_1.requestedDocumentType = remainingRequirements[0];
10734
- if (state.requestedDocumentType === 'idCardFront' && newState_1.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_1.requestedDocumentType === 'idCardFront') {
10735
- newState_1.captureState = 'requestingFlip';
10736
- newState_1.idCardFrontDetectionThresholdMet = false;
10737
- newState_1.idCardBackDetectionThresholdMet = false;
10738
- newState_1.passportDetectionThresholdMet = false;
10739
- 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;
10740
10810
  }
10741
10811
  }
10742
- return newState_1;
10812
+ return newState;
10743
10813
  }
10744
10814
  case 'documentCapturedManually':
10745
10815
  {
10746
- var newState_2 = _assign(_assign({}, state), {
10816
+ var newState = _assign(_assign({}, state), {
10747
10817
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_b = {}, _b[state.requestedDocumentType] = _assign(_assign({}, action.payload), {
10748
10818
  width: 0,
10749
10819
  height: 0
10750
10820
  }), _b))
10751
10821
  });
10752
- var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
10753
- return !(v in newState_2.capturedDocuments);
10754
- });
10755
- if (state.captureRequirement === 'idCardOrPassport') {
10756
- if (state.requestedDocumentType === 'passport') {
10757
- remainingRequirements = [];
10758
- } else {
10759
- remainingRequirements = remainingRequirements.filter(function (v) {
10760
- return v !== 'passport';
10761
- });
10762
- }
10763
- }
10822
+ var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
10764
10823
  if (remainingRequirements.length === 0) {
10765
- newState_2.captureState = 'complete';
10824
+ newState.captureState = 'complete';
10766
10825
  } else {
10767
- newState_2.requestedDocumentType = remainingRequirements[0];
10768
- if (state.requestedDocumentType === 'idCardFront' && newState_2.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_2.requestedDocumentType === 'idCardFront') {
10769
- newState_2.captureState = 'requestingFlip';
10770
- newState_2.idCardFrontDetectionThresholdMet = false;
10771
- newState_2.idCardBackDetectionThresholdMet = false;
10772
- 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;
10773
10832
  }
10774
10833
  }
10775
- return newState_2;
10834
+ return newState;
10776
10835
  }
10777
10836
  case 'flipRequestCompleted':
10778
10837
  return _assign(_assign({}, state), {
@@ -14163,7 +14222,7 @@
14163
14222
  imageUrl: imageUrl
14164
14223
  }
14165
14224
  });
14166
- var capturedDocumentType = documentType === 'passport' ? 'passport' : state.requestedDocumentType;
14225
+ var capturedDocumentType = documentType;
14167
14226
  setTimeout(function () {
14168
14227
  var _a;
14169
14228
  var captureTime = new Date().getTime() - ((_a = state.captureStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
@@ -14230,7 +14289,7 @@
14230
14289
  scaling: debugScalingDetails,
14231
14290
  flipX: !isRearFacing
14232
14291
  });
14233
- }))), 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")))));
14234
14293
  };
14235
14294
  var timeSince = function timeSince(t) {
14236
14295
  if (!t) return 0;
@@ -15343,15 +15402,8 @@
15343
15402
  _e = _a.debugMode,
15344
15403
  debugMode = _e === void 0 ? false : _e;
15345
15404
  var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
15346
- var idCardFront = capturedDocuments.idCardFront,
15347
- idCardBack = capturedDocuments.idCardBack,
15348
- passport = capturedDocuments.passport;
15349
15405
  var verbiage = useTranslations(rawVerbiage, {
15350
15406
  headingText: 'ID Capture Successful',
15351
- idCardFrontText: 'ID Card Front',
15352
- idCardBackText: 'ID Card Back',
15353
- passportText: 'Passport',
15354
- instructionText: 'Verify the entire ID was captured clearly with no glare.',
15355
15407
  retryText: 'Retry',
15356
15408
  submittingText: 'Submitting...',
15357
15409
  submitText: 'Done'
@@ -15368,25 +15420,16 @@
15368
15420
  className: classNames.imageContainer
15369
15421
  }, /*#__PURE__*/React.createElement(ImageRow, {
15370
15422
  className: classNames.imageRow
15371
- }, idCardFront && ( /*#__PURE__*/React.createElement(ImageCol$1, {
15372
- className: classNames.imageCol
15373
- }, /*#__PURE__*/React.createElement(StyledImage, {
15374
- image: idCardFront,
15375
- className: classNames.image,
15376
- alt: verbiage.idCardFrontText
15377
- }), 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, {
15378
- className: classNames.imageCol
15379
- }, /*#__PURE__*/React.createElement(StyledImage, {
15380
- image: idCardBack,
15381
- className: classNames.image,
15382
- alt: verbiage.idCardBackText
15383
- }), 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, {
15384
- className: classNames.imageCol
15385
- }, /*#__PURE__*/React.createElement(StyledImage, {
15386
- image: passport,
15387
- className: classNames.image,
15388
- alt: verbiage.passportText
15389
- }), 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, {
15390
15433
  className: classNames.buttonsRow
15391
15434
  }, /*#__PURE__*/React.createElement(WideButton, {
15392
15435
  className: classNames.submitBtn,
@@ -15405,7 +15448,7 @@
15405
15448
  };
15406
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"])));
15407
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"])));
15408
- 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"])));
15409
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"])));
15410
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"])));
15411
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"])));
@@ -15989,7 +16032,7 @@
15989
16032
  });
15990
16033
  }, [setDimensions, wrapperHeight, wrapperWidth]);
15991
16034
  var padding = userSuppliedPadding !== null && userSuppliedPadding !== void 0 ? userSuppliedPadding : isMobile() ? (_g = (_f = (_e = theme.idCapture) === null || _e === void 0 ? void 0 : _e.guideBox) === null || _f === void 0 ? void 0 : _f.mobilePadding) !== null && _g !== void 0 ? _g : 0 : (_k = (_j = (_h = theme.idCapture) === null || _h === void 0 ? void 0 : _h.guideBox) === null || _j === void 0 ? void 0 : _j.desktopPadding) !== null && _k !== void 0 ? _k : 50;
15992
- var paddingAndBorderPx = padding * 2 + borderWidth * 2;
16035
+ var paddingAndBorderPx = padding * 2 + (borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0) * 2;
15993
16036
  var images = useImagesWithBackToFront(userSuppliedImages, isBackToFront);
15994
16037
  var imagesByUrl = useGuideImagesByUrl(images);
15995
16038
  var orientation = getOrientation(portraitGuidesOnMobile);
@@ -16036,7 +16079,7 @@
16036
16079
  "$isMirrored": isMirrored,
16037
16080
  className: classNames.centerRegion
16038
16081
  }, /*#__PURE__*/React.createElement(GuideCenterBorder, {
16039
- "$borderWidth": borderWidth,
16082
+ "$borderWidth": borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0,
16040
16083
  "$borderColor": borderColor,
16041
16084
  "$padding": imagePadding,
16042
16085
  className: classNames.centerRegionBorder
@@ -16236,7 +16279,7 @@
16236
16279
  }, [aspectRatio, borderColor, borderRadius, borderWidth, dispatch, maskColor, padding, redrawing, wrapperHeight, wrapperWidth]);
16237
16280
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CanvasWrapper$1, {
16238
16281
  ref: wrapperRef,
16239
- "$maskColor": maskColor,
16282
+ "$maskColor": maskColor !== null && maskColor !== void 0 ? maskColor : '',
16240
16283
  className: classNames.canvasWrapper
16241
16284
  }, /*#__PURE__*/React.createElement(Canvas$1, {
16242
16285
  ref: canvasRef,
@@ -16531,7 +16574,7 @@
16531
16574
  var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
16532
16575
  var uploadCapturedDocument = React.useCallback(function (content, filetype) {
16533
16576
  return __awaiter(void 0, void 0, void 0, function () {
16534
- var documentId_1;
16577
+ var documentId_1, e_1;
16535
16578
  return __generator(this, function (_a) {
16536
16579
  switch (_a.label) {
16537
16580
  case 0:
@@ -16554,7 +16597,8 @@
16554
16597
  }, 0);
16555
16598
  return [3 /*break*/, 3];
16556
16599
  case 2:
16557
- _a.sent();
16600
+ e_1 = _a.sent();
16601
+ debug('upload failed', e_1);
16558
16602
  dispatch({
16559
16603
  type: 'uploadFailed'
16560
16604
  });
@@ -16589,7 +16633,7 @@
16589
16633
  resolvedDocuments.forEach(function (d) {
16590
16634
  if (d.content) {
16591
16635
  d.contentUrl || (d.contentUrl = URL.createObjectURL(d.content));
16592
- uploadCapturedDocument(d.content, d.content.type);
16636
+ void uploadCapturedDocument(d.content, d.content.type);
16593
16637
  }
16594
16638
  });
16595
16639
  }, [aspectRatio, cameraFeedMode, documents, instructions, uploadCapturedDocument]);
@@ -16787,6 +16831,7 @@
16787
16831
  React.useEffect(function attachCameraStreamToVideoTagWhenReady() {
16788
16832
  if (videoRef.current && videoStream) {
16789
16833
  debug('attaching camera stream to video tag');
16834
+ // eslint-disable-next-line react-compiler/react-compiler
16790
16835
  videoRef.current.srcObject = videoStream;
16791
16836
  }
16792
16837
  }, [videoStream, videoRef]);
@@ -17113,8 +17158,8 @@
17113
17158
  var _j = React.useState(silentFallback),
17114
17159
  useFallback = _j[0],
17115
17160
  setUseFallback = _j[1];
17116
- var allowedImageCount = allowedImageCountForOption(idCaptureRequirement);
17117
- var requiredImageCount = requiredImageCountForOption(idCaptureRequirement);
17161
+ var minImageCount = minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
17162
+ var maxImageCount = maxImageCountForIdCaptureRequirementOption(idCaptureRequirement);
17118
17163
  var _k = useFileState(),
17119
17164
  rawFile = _k.rawFile,
17120
17165
  fileInputOnChange = _k.fileInputOnChange;
@@ -17127,7 +17172,7 @@
17127
17172
  var whatToCapture = idCaptureRequirement === 'idCard' ? 'ID card' : idCaptureRequirement === 'passport' ? 'passport' : idCaptureRequirement === 'idCardOrPassport' ? 'ID card or passport' : 'ID card and passport';
17128
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.';
17129
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.';
17130
- 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.");
17131
17176
  var verbiage = useTranslations(rawVerbiage, {
17132
17177
  headingText: "We're having some trouble.",
17133
17178
  descriptionText: descriptionText,
@@ -17201,7 +17246,7 @@
17201
17246
  alt: "",
17202
17247
  className: classNames.image
17203
17248
  }));
17204
- }))), images.length < requiredImageCount && ( /*#__PURE__*/React.createElement(Instruction, {
17249
+ }))), images.length < minImageCount && ( /*#__PURE__*/React.createElement(Instruction, {
17205
17250
  className: classNames.instruction
17206
17251
  }, instructionText)), /*#__PURE__*/React.createElement("input", {
17207
17252
  ref: fileInput,
@@ -17212,7 +17257,7 @@
17212
17257
  hidden: true
17213
17258
  }), /*#__PURE__*/React.createElement(StyledButtonsRow$8, {
17214
17259
  className: classNames.buttonsRow
17215
- }, images.length < allowedImageCount && ( /*#__PURE__*/React.createElement(LoaderButton, {
17260
+ }, images.length < maxImageCount && ( /*#__PURE__*/React.createElement(LoaderButton, {
17216
17261
  variant: images.length > 0 ? 'secondary' : 'positive',
17217
17262
  className: images.length > 0 ? classNames.captureMoreBtn : classNames.captureBtn,
17218
17263
  colors: images.length > 0 ? colors.captureMoreBtn : colors.captureBtn,
@@ -17225,7 +17270,7 @@
17225
17270
  setDocumentToCapture(instructionText);
17226
17271
  }
17227
17272
  }
17228
- }, 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, {
17229
17274
  variant: "positive",
17230
17275
  className: classNames.doneBtn,
17231
17276
  colors: colors.doneBtn,
@@ -17272,87 +17317,94 @@
17272
17317
  precapturedDocuments = _a.precapturedDocuments,
17273
17318
  _j = _a.captureRequirement,
17274
17319
  captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
17275
- _k = _a.separateIdCardCaptureSequence,
17276
- separateIdCardCaptureSequence = _k === void 0 ? false : _k,
17277
- _l = _a.thresholds,
17278
- thresholds = _l === void 0 ? defaultIdCaptureThresholds : _l,
17279
- _m = _a.skipSuccessScreen,
17280
- 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,
17281
17328
  instructions = _a.instructions,
17282
- _o = _a.releaseCameraAccessOnExit,
17283
- releaseCameraAccessOnExit = _o === void 0 ? true : _o,
17284
- _p = _a.guideType,
17285
- guideType = _p === void 0 ? 'fit' : _p,
17286
- _q = _a.portraitGuidesOnMobile,
17287
- portraitGuidesOnMobile = _q === void 0 ? true : _q,
17288
- _r = _a.rotateLoadingOverlayImageWhenPortrait,
17289
- rotateLoadingOverlayImageWhenPortrait = _r === void 0 ? true : _r,
17290
- _s = _a.silentFallback,
17291
- silentFallback = _s === void 0 ? false : _s,
17292
- _t = _a.forceFallbackMode,
17293
- forceFallbackMode = _t === void 0 ? false : _t,
17294
- _u = _a.allowIdCardBackToFrontCapture,
17295
- allowIdCardBackToFrontCapture = _u === void 0 ? false : _u,
17296
- _v = _a.enableOverrideWrongDocumentTypeDialog,
17297
- enableOverrideWrongDocumentTypeDialog = _v === void 0 ? false : _v,
17298
- _w = _a.allowOverrideWrongDocumentTypeAfterMs,
17299
- allowOverrideWrongDocumentTypeAfterMs = _w === void 0 ? 8000 : _w,
17300
- _x = _a.guideImages,
17301
- guideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
17302
- _y = _a.assets,
17303
- assets = _y === void 0 ? {} : _y,
17304
- _z = _a.classNames,
17305
- classNames = _z === void 0 ? {} : _z,
17306
- _0 = _a.colors,
17307
- colors = _0 === void 0 ? {} : _0,
17308
- _1 = _a.verbiage,
17309
- verbiage = _1 === void 0 ? {} : _1,
17310
- _2 = _a.debugMode,
17311
- debugMode = _2 === void 0 ? false : _2;
17312
- var _3 = useIdCaptureState(),
17313
- state = _3[0],
17314
- dispatch = _3[1];
17315
- var _4 = useCameraStore(),
17316
- cameraAccessDenied = _4.cameraAccessDenied,
17317
- requestCameraAccess = _4.requestCameraAccess,
17318
- releaseCameraAccess = _4.releaseCameraAccess;
17319
- var _5 = React.useState(false),
17320
- overlayDismissed = _5[0],
17321
- setOverlayDismissed = _5[1];
17322
- var _6 = React.useContext(SubmissionContext),
17323
- submissionStatus = _6.submissionStatus,
17324
- setIdFrontImage = _6.setIdFrontImage,
17325
- setIdBackImage = _6.setIdBackImage,
17326
- setPassportImage = _6.setPassportImage,
17327
- logIdFrontCaptureAttempt = _6.logIdFrontCaptureAttempt,
17328
- logIdBackCaptureAttempt = _6.logIdBackCaptureAttempt;
17329
- var _7 = React.useContext(IdCaptureModelsContext),
17330
- start = _7.start,
17331
- stop = _7.stop,
17332
- onPredictionMade = _7.onPredictionMade,
17333
- setRequiredDocumentType = _7.setRequiredDocumentType,
17334
- modelError = _7.modelError,
17335
- 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;
17336
17383
  React.useEffect(function () {
17337
17384
  dispatch({
17338
17385
  type: 'configureWizard',
17339
17386
  payload: {
17340
17387
  captureRequirement: captureRequirement,
17341
17388
  precapturedDocuments: precapturedDocuments,
17389
+ allowSinglePageIdCapture: allowSinglePageIdCapture,
17342
17390
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
17343
17391
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
17344
17392
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
17345
17393
  }
17346
17394
  });
17347
- }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
17395
+ }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
17348
17396
  var documentCount = Object.keys(state.capturedDocuments).length;
17349
17397
  React.useEffect(function () {
17350
- documentCount && resetBestFrame();
17398
+ if (documentCount) resetBestFrame();
17351
17399
  }, [documentCount, resetBestFrame]);
17352
17400
  var logCaptureMetadata = React.useCallback(function (metadata) {
17353
17401
  var _a;
17354
17402
  metadata.operationTime = new Date().getTime() - ((_a = state.operationStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
17355
- state.requestedDocumentType === 'idCardBack' ? logIdBackCaptureAttempt(metadata) : logIdFrontCaptureAttempt(metadata);
17403
+ if (state.requestedDocumentType === 'idCardBack') {
17404
+ logIdBackCaptureAttempt(metadata);
17405
+ } else {
17406
+ logIdFrontCaptureAttempt(metadata);
17407
+ }
17356
17408
  }, [logIdBackCaptureAttempt, logIdFrontCaptureAttempt, state.operationStartedAt, state.requestedDocumentType]);
17357
17409
  React.useEffect(function startModelsWhenCapturing() {
17358
17410
  if (!overlayDismissed || state.captureState !== 'capturing') return;
@@ -17402,14 +17454,17 @@
17402
17454
  var _a = state.capturedDocuments,
17403
17455
  idCardFront = _a.idCardFront,
17404
17456
  idCardBack = _a.idCardBack,
17405
- passport = _a.passport;
17457
+ passport = _a.passport,
17458
+ singlePage = _a.singlePage;
17406
17459
  var idFrontImage = idCardFront && dataUrlToBase64Sync(idCardFront.imageData);
17407
17460
  var idBackImage = idCardBack && dataUrlToBase64Sync(idCardBack.imageData);
17408
17461
  var passportImage = passport && dataUrlToBase64Sync(passport.imageData);
17409
- idFrontImage && setIdFrontImage(idFrontImage);
17410
- idBackImage && setIdBackImage(idBackImage);
17411
- passportImage && setPassportImage(passportImage);
17412
- releaseCameraAccessOnExit && releaseCameraAccess();
17462
+ var singlePageImage = singlePage && dataUrlToBase64Sync(singlePage.imageData);
17463
+ if (idFrontImage) setIdFrontImage(idFrontImage);
17464
+ if (idBackImage) setIdBackImage(idBackImage);
17465
+ if (passportImage) setPassportImage(passportImage);
17466
+ if (singlePageImage) setIdFrontImage(singlePageImage);
17467
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
17413
17468
  setTimeout(function () {
17414
17469
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
17415
17470
  idFrontImage: idFrontImage,
@@ -17424,9 +17479,9 @@
17424
17479
  type: 'resetWizard'
17425
17480
  });
17426
17481
  }, [dispatch]);
17427
- var _8 = React.useState(0),
17428
- attempt = _8[0],
17429
- setAttempt = _8[1];
17482
+ var _9 = React.useState(0),
17483
+ attempt = _9[0],
17484
+ setAttempt = _9[1];
17430
17485
  var onExit = React.useCallback(function () {
17431
17486
  releaseCameraAccess();
17432
17487
  setOverlayDismissed(false);
@@ -17441,7 +17496,7 @@
17441
17496
  }, [dispatch, onExitCapture, releaseCameraAccess, requestCameraAccess]);
17442
17497
  React.useEffect(function () {
17443
17498
  if (submissionStatus !== SubmissionStatus.READY) {
17444
- releaseCameraAccessOnExit && releaseCameraAccess();
17499
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
17445
17500
  }
17446
17501
  }, [releaseCameraAccess, releaseCameraAccessOnExit, submissionStatus]);
17447
17502
  React.useEffect(function () {
@@ -17517,9 +17572,9 @@
17517
17572
  });
17518
17573
  });
17519
17574
  }, [dispatch]);
17520
- var _9 = React.useState(false),
17521
- progressStarted = _9[0],
17522
- setProgressStarted = _9[1];
17575
+ var _10 = React.useState(false),
17576
+ progressStarted = _10[0],
17577
+ setProgressStarted = _10[1];
17523
17578
  React.useEffect(function () {
17524
17579
  if (state.captureState === 'capturing') {
17525
17580
  setProgressStarted(false);
@@ -18622,19 +18677,25 @@
18622
18677
  canvasRef = _v.canvasRef,
18623
18678
  guidanceError = _v.error;
18624
18679
  onPredictionMade(f(React.useCallback(function (prediction) {
18625
- return new Promise(function (resolve) {
18626
- if (shouldCapture && !busy) {
18627
- drawToCanvas(lastPredictionCanvas.current, canvasRef.current);
18628
- dispatch({
18629
- type: 'facesDetected',
18630
- payload: prediction
18631
- });
18632
- }
18633
- resolve();
18680
+ return __awaiter(void 0, void 0, void 0, function () {
18681
+ return __generator(this, function (_a) {
18682
+ if (shouldCapture && !busy) {
18683
+ drawToCanvas(lastPredictionCanvas.current, canvasRef.current);
18684
+ dispatch({
18685
+ type: 'facesDetected',
18686
+ payload: prediction
18687
+ });
18688
+ }
18689
+ return [2 /*return*/];
18690
+ });
18634
18691
  });
18635
18692
  }, [canvasRef, shouldCapture, busy]), 16));
18636
18693
  React.useEffect(function () {
18637
- (prediction === null || prediction === void 0 ? void 0 : prediction.faceReady) ? onGuidanceSatisfied === null || onGuidanceSatisfied === void 0 ? void 0 : onGuidanceSatisfied() : onGuidanceNotSatisfied === null || onGuidanceNotSatisfied === void 0 ? void 0 : onGuidanceNotSatisfied();
18694
+ if (prediction === null || prediction === void 0 ? void 0 : prediction.faceReady) {
18695
+ onGuidanceSatisfied === null || onGuidanceSatisfied === void 0 ? void 0 : onGuidanceSatisfied();
18696
+ } else {
18697
+ onGuidanceNotSatisfied === null || onGuidanceNotSatisfied === void 0 ? void 0 : onGuidanceNotSatisfied();
18698
+ }
18638
18699
  }, [onGuidanceNotSatisfied, onGuidanceSatisfied, prediction === null || prediction === void 0 ? void 0 : prediction.faceReady]);
18639
18700
  React.useEffect(function () {
18640
18701
  if (!(prediction === null || prediction === void 0 ? void 0 : prediction.faceReady)) return;
@@ -19632,7 +19693,7 @@
19632
19693
  }, [logCaptureMetadata, releaseCameraAccess, requestCameraAccess]);
19633
19694
  var onDoneCallback = React.useCallback(function () {
19634
19695
  logCaptureMetadata();
19635
- releaseCameraAccessOnExit && releaseCameraAccess();
19696
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
19636
19697
  setTimeout(function () {
19637
19698
  onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse, livenessCheckRequest);
19638
19699
  }, 0);
@@ -19651,7 +19712,7 @@
19651
19712
  onLoadingOverlayDismissed === null || onLoadingOverlayDismissed === void 0 ? void 0 : onLoadingOverlayDismissed();
19652
19713
  }, [onLoadingOverlayDismissed]);
19653
19714
  var onFailureExitClick = React.useCallback(function () {
19654
- releaseCameraAccessOnExit && releaseCameraAccess();
19715
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
19655
19716
  setTimeout(function () {
19656
19717
  onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure(submissionResponse, livenessCheckRequest);
19657
19718
  }, 0);
@@ -20773,16 +20834,15 @@
20773
20834
  var templateObject_1$b, templateObject_2$9, templateObject_3$9, templateObject_4$4;
20774
20835
 
20775
20836
  var SignatureCapture = function SignatureCapture(_a) {
20776
- var _b;
20777
20837
  var onAccept = _a.onAccept,
20778
- _c = _a.classNames,
20779
- classNames = _c === void 0 ? {} : _c,
20780
- _d = _a.verbiage,
20781
- rawVerbiage = _d === void 0 ? {} : _d;
20782
- var _e = useResizeObserver(),
20783
- ref = _e.ref,
20784
- width = _e.width,
20785
- height = _e.height;
20838
+ _b = _a.classNames,
20839
+ classNames = _b === void 0 ? {} : _b,
20840
+ _c = _a.verbiage,
20841
+ rawVerbiage = _c === void 0 ? {} : _c;
20842
+ var _d = useResizeObserver(),
20843
+ ref = _d.ref,
20844
+ width = _d.width,
20845
+ height = _d.height;
20786
20846
  var signaturePad = React.useRef(null);
20787
20847
  var verbiage = useTranslations(rawVerbiage, {
20788
20848
  headingText: 'Please sign the box below',
@@ -20832,8 +20892,11 @@
20832
20892
  }, /*#__PURE__*/React.createElement(LoaderButton, {
20833
20893
  variant: "secondary",
20834
20894
  className: classNames.clearBtn,
20835
- onClick: (_b = signaturePad.current) === null || _b === void 0 ? void 0 : _b.clear,
20836
- finished: true
20895
+ finished: true,
20896
+ onClick: function onClick() {
20897
+ var _a;
20898
+ (_a = signaturePad.current) === null || _a === void 0 ? void 0 : _a.clear();
20899
+ }
20837
20900
  }, verbiage.clearBtnText), /*#__PURE__*/React.createElement(AcceptBtn$1, {
20838
20901
  variant: "positive",
20839
20902
  className: classNames.acceptBtn,
@@ -21811,7 +21874,8 @@
21811
21874
  detection: {
21812
21875
  idCardFront: 0.4,
21813
21876
  idCardBack: 0.5,
21814
- passport: 0.3
21877
+ passport: 0.3,
21878
+ singlePage: 0.3
21815
21879
  },
21816
21880
  focus: {
21817
21881
  idCardFront: {
@@ -21825,12 +21889,17 @@
21825
21889
  passport: {
21826
21890
  desktop: 0,
21827
21891
  mobile: 0
21892
+ },
21893
+ singlePage: {
21894
+ desktop: 0,
21895
+ mobile: 0
21828
21896
  }
21829
21897
  },
21830
21898
  goodFrames: {
21831
21899
  idCardFront: 1,
21832
21900
  idCardBack: 1,
21833
- passport: 1
21901
+ passport: 1,
21902
+ singlePage: 1
21834
21903
  },
21835
21904
  flipShortcutThreshold: 0.7
21836
21905
  };
@@ -21902,6 +21971,7 @@
21902
21971
  stopIdModels = _18.stop,
21903
21972
  onIdPredictionMade = _18.onPredictionMade,
21904
21973
  setThresholds = _18.setThresholds,
21974
+ setRequiredDocumentType = _18.setRequiredDocumentType,
21905
21975
  setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
21906
21976
  bestFrameDetails = _18.bestFrameDetails,
21907
21977
  resetBestFrame = _18.resetBestFrame,
@@ -21980,6 +22050,9 @@
21980
22050
  React.useEffect(function () {
21981
22051
  setThresholds(adjustedThresholds);
21982
22052
  }, [requestedAction, setThresholds, adjustedThresholds]);
22053
+ React.useEffect(function () {
22054
+ setRequiredDocumentType(requestedAction === 'SHOW_PASSPORT' ? 'passport' : requestedAction === 'SHOW_ID_BACK' ? 'idCardBack' : 'idCardFront');
22055
+ }, [requestedAction, setRequiredDocumentType]);
21983
22056
  React.useEffect(function () {
21984
22057
  setDocumentDetectionBoundaries({
21985
22058
  top: 20,
@@ -22002,6 +22075,9 @@
22002
22075
  setGoodFramesCount = _28[1];
22003
22076
  var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
22004
22077
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
22078
+ var _29 = React.useState(false),
22079
+ isSinglePage = _29[0],
22080
+ setIsSinglePage = _29[1];
22005
22081
  React.useEffect(function () {
22006
22082
  if (!idCaptureModelsEnabled || idModelError) return;
22007
22083
  onIdPredictionMade(function (prediction) {
@@ -22009,7 +22085,8 @@
22009
22085
  setCurrentDetectionScore(prediction.detectionScore);
22010
22086
  setCurrentDetectedDocumentType(prediction.detectedDocumentType);
22011
22087
  setCurrentFocusScore(prediction.focusScore);
22012
- 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;
22013
22090
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
22014
22091
  var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
22015
22092
  if (shouldShortcutFlipAnimation) {
@@ -22020,9 +22097,9 @@
22020
22097
  } : 0);
22021
22098
  });
22022
22099
  }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
22023
- var _29 = React.useState(null),
22024
- idFrontCaptureStartedAt = _29[0],
22025
- setFirstGoodFrameTime = _29[1];
22100
+ var _30 = React.useState(null),
22101
+ idFrontCaptureStartedAt = _30[0],
22102
+ setFirstGoodFrameTime = _30[1];
22026
22103
  React.useEffect(function () {
22027
22104
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
22028
22105
  }, [goodFramesCount]);
@@ -22043,80 +22120,60 @@
22043
22120
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
22044
22121
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
22045
22122
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
22046
- var _30 = React.useState(),
22047
- countdownStartedAt = _30[0],
22048
- setCountdownStartedAt = _30[1];
22123
+ var _31 = React.useState(),
22124
+ countdownStartedAt = _31[0],
22125
+ setCountdownStartedAt = _31[1];
22049
22126
  var photoCanvas = React.useRef(null);
22050
22127
  var frameLock = React.useRef(false);
22051
22128
  var captureFrame = React.useCallback(function () {
22052
22129
  return __awaiter(void 0, void 0, void 0, function () {
22053
- var frameBase64, _a;
22054
- return __generator(this, function (_b) {
22055
- switch (_b.label) {
22056
- case 0:
22057
- if (frameLock.current) return [2 /*return*/];
22058
- frameLock.current = true;
22059
- drawToCanvas(photoCanvas.current, videoRef.current);
22060
- frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
22061
- if (!frameBase64) {
22062
- frameLock.current = false;
22063
- return [2 /*return*/];
22064
- }
22065
- _b.label = 1;
22066
- case 1:
22067
- _b.trys.push([1,, 7, 8]);
22068
- 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') {
22069
22142
  if (onIdFrontImageCaptured) {
22070
22143
  onIdFrontImageCaptured(frameBase64);
22071
22144
  }
22072
- if (!skipShowIdCardBack) return [3 /*break*/, 4];
22073
- _a = skipShowIdCardBack === true;
22074
- if (_a) return [3 /*break*/, 3];
22075
- return [4 /*yield*/, skipShowIdCardBack()];
22076
- case 2:
22077
- _a = _b.sent();
22078
- _b.label = 3;
22079
- case 3:
22080
- if (_a) {
22145
+ if (isSinglePage || evaluateShouldSkip(skipShowIdCardBack)) {
22081
22146
  return [2 /*return*/, onIdCaptureComplete()];
22082
22147
  }
22083
- _b.label = 4;
22084
- case 4:
22085
22148
  setRequestedAction('FLIP_ID');
22086
- return [3 /*break*/, 6];
22087
- case 5:
22088
- if (requestedAction == 'SHOW_ID_BACK') {
22089
- if (onIdBackImageCaptured) {
22090
- onIdBackImageCaptured(frameBase64);
22091
- }
22092
- onIdCaptureComplete();
22093
- } else if (requestedAction == 'SHOW_PASSPORT') {
22094
- if (onIdFrontImageCaptured) {
22095
- onIdFrontImageCaptured(frameBase64);
22096
- }
22097
- onIdCaptureComplete();
22149
+ } else if (requestedAction == 'SHOW_ID_BACK') {
22150
+ if (onIdBackImageCaptured) {
22151
+ onIdBackImageCaptured(frameBase64);
22098
22152
  }
22099
- _b.label = 6;
22100
- case 6:
22101
- return [3 /*break*/, 8];
22102
- case 7:
22103
- setDetectedObjects([]);
22104
- setCurrentDetectionScore(0);
22105
- setCurrentFocusScore(0);
22106
- setGoodFramesCount(0);
22107
- setCountdownStartedAt(undefined);
22108
- resetBestFrame();
22109
- frameLock.current = false;
22110
- if (countdownTimeoutRef.current) {
22111
- clearTimeout(countdownTimeoutRef.current);
22153
+ onIdCaptureComplete();
22154
+ } else if (requestedAction == 'SHOW_PASSPORT') {
22155
+ if (onIdFrontImageCaptured) {
22156
+ onIdFrontImageCaptured(frameBase64);
22112
22157
  }
22113
- return [7 /*endfinally*/];
22114
- case 8:
22115
- 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
+ }
22116
22172
  }
22173
+ return [2 /*return*/];
22117
22174
  });
22118
22175
  });
22119
- }, [onIdCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
22176
+ }, [videoRef, requestedAction, onIdFrontImageCaptured, isSinglePage, skipShowIdCardBack, onIdCaptureComplete, onIdBackImageCaptured, resetBestFrame]);
22120
22177
  var isFlipping = requestedAction === 'FLIP_ID';
22121
22178
  React.useEffect(function () {
22122
22179
  if (!isFlipping) return;
@@ -22175,9 +22232,9 @@
22175
22232
  stopSelfieGuidance();
22176
22233
  };
22177
22234
  }, [startSelfieGuidance, stopSelfieGuidance]);
22178
- var _31 = React.useState(0),
22179
- numFramesWithoutFaces = _31[0],
22180
- setNumFramesWithoutFaces = _31[1];
22235
+ var _32 = React.useState(0),
22236
+ numFramesWithoutFaces = _32[0],
22237
+ setNumFramesWithoutFaces = _32[1];
22181
22238
  onSelfiePredictionMade(f(React.useCallback(function (_a) {
22182
22239
  var face = _a.face;
22183
22240
  if (selfieModelError) return;
@@ -22193,12 +22250,12 @@
22193
22250
  }
22194
22251
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
22195
22252
  var theme = styled.useTheme();
22196
- var _32 = useTranslations(rawVerbiage, {
22253
+ var _33 = useTranslations(rawVerbiage, {
22197
22254
  faceNotCenteredText: 'Please move your face to the center...',
22198
22255
  captureBtnText: 'Capture'
22199
22256
  }),
22200
- captureBtnText = _32.captureBtnText,
22201
- faceNotCenteredText = _32.faceNotCenteredText;
22257
+ captureBtnText = _33.captureBtnText,
22258
+ faceNotCenteredText = _33.faceNotCenteredText;
22202
22259
  var debugScalingDetails = useDebugScalingDetails({
22203
22260
  enabled: debugMode,
22204
22261
  pageWidth: width,
@@ -22273,6 +22330,11 @@
22273
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"])));
22274
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"])));
22275
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
+ }
22276
22338
  var templateObject_1$5, templateObject_2$5, templateObject_3$5, templateObject_4;
22277
22339
 
22278
22340
  var IdVideoCaptureSuccess = function IdVideoCaptureSuccess(_a) {
@@ -22490,7 +22552,7 @@
22490
22552
  return __awaiter(void 0, void 0, void 0, function () {
22491
22553
  return __generator(this, function (_a) {
22492
22554
  setIdCaptureVideoUrl(videoUrl);
22493
- audioUrl && setIdCaptureVideoAudioUrl(audioUrl);
22555
+ if (audioUrl) setIdCaptureVideoAudioUrl(audioUrl);
22494
22556
  setCaptureState('SUCCESS');
22495
22557
  if (skipSuccessScreen) onComplete === null || onComplete === void 0 ? void 0 : onComplete();
22496
22558
  return [2 /*return*/];
@@ -22566,7 +22628,8 @@
22566
22628
  documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
22567
22629
  focusModelUrl: (_j = (_h = idCaptureProps.assets) === null || _h === void 0 ? void 0 : _h.focusModelUrl) !== null && _j !== void 0 ? _j : '',
22568
22630
  onModelError: onIdCaptureModelError,
22569
- modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs
22631
+ modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
22632
+ allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
22570
22633
  }, /*#__PURE__*/React.createElement(SelfieGuidanceModelsProvider, {
22571
22634
  autoStart: false,
22572
22635
  onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
@@ -22816,7 +22879,8 @@
22816
22879
  documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
22817
22880
  focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
22818
22881
  onModelError: idCaptureProps.onModelError,
22819
- modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs
22882
+ modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
22883
+ allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
22820
22884
  }, /*#__PURE__*/React.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React.createElement(IdCaptureWizard, _assign({}, idCaptureProps, {
22821
22885
  onSuccess: onIdCaptureSuccess
22822
22886
  }))))));
@@ -23083,10 +23147,10 @@
23083
23147
  var ThemeProvider = function ThemeProvider(_a) {
23084
23148
  var children = _a.children,
23085
23149
  themeInput = _a.theme;
23086
- var themeRef = React.useRef(themeInput);
23150
+ var themeRef = React.useState(themeInput)[0];
23087
23151
  var theme = React.useMemo(function () {
23088
- return resolveTheme(themeRef.current);
23089
- }, []);
23152
+ return resolveTheme(themeRef);
23153
+ }, [themeRef]);
23090
23154
  var colors = theme.colors;
23091
23155
  React.useEffect(function () {
23092
23156
  for (var name_1 in colors) {
@@ -23138,31 +23202,33 @@
23138
23202
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
23139
23203
  _d = _a.idCaptureRequirement,
23140
23204
  idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
23141
- _e = _a.separateIdCardCaptureSequence,
23142
- separateIdCardCaptureSequence = _e === void 0 ? false : _e,
23143
- _f = _a.idCaptureThresholds,
23144
- idCaptureThresholds = _f === void 0 ? defaultIdCaptureThresholds : _f,
23145
- _g = _a.skipSuccessScreen,
23146
- 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,
23147
23213
  instructions = _a.instructions,
23148
- _h = _a.guideType,
23149
- guideType = _h === void 0 ? 'fit' : _h,
23150
- _j = _a.guideImages,
23151
- guideImages = _j === void 0 ? defaultIdCaptureGuideImages : _j,
23152
- _k = _a.portraitGuidesOnMobile,
23153
- portraitGuidesOnMobile = _k === void 0 ? true : _k,
23154
- _l = _a.rotateLoadingOverlayImageWhenPortrait,
23155
- rotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
23156
- _m = _a.modelLoadTimeoutMs,
23157
- modelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
23158
- _o = _a.forceFallbackMode,
23159
- forceFallbackMode = _o === void 0 ? false : _o,
23160
- _p = _a.allowIdCardBackToFrontCapture,
23161
- allowIdCardBackToFrontCapture = _p === void 0 ? false : _p,
23162
- _q = _a.enableOverrideWrongDocumentTypeDialog,
23163
- enableOverrideWrongDocumentTypeDialog = _q === void 0 ? false : _q,
23164
- _r = _a.allowOverrideWrongDocumentTypeAfterMs,
23165
- 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,
23166
23232
  onBeforeSubmit = _a.onBeforeSubmit,
23167
23233
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
23168
23234
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -23176,28 +23242,28 @@
23176
23242
  onUserCancel = _a.onUserCancel,
23177
23243
  onModelError = _a.onModelError,
23178
23244
  onCameraAccessDenied = _a.onCameraAccessDenied,
23179
- _s = _a.theme,
23180
- theme = _s === void 0 ? 'default' : _s,
23181
- _t = _a.assets,
23182
- assets = _t === void 0 ? {} : _t,
23183
- _u = _a.classNames,
23184
- classNames = _u === void 0 ? {} : _u,
23185
- _v = _a.colors,
23186
- colors = _v === void 0 ? {} : _v,
23187
- _w = _a.verbiage,
23188
- verbiage = _w === void 0 ? {} : _w,
23189
- _x = _a.captureSignature,
23190
- captureSignature = _x === void 0 ? false : _x,
23191
- _y = _a.captureSignatureVideo,
23192
- captureSignatureVideo = _y === void 0 ? false : _y,
23193
- _z = _a.captureAdditionalDocuments,
23194
- captureAdditionalDocuments = _z === void 0 ? [] : _z,
23195
- _0 = _a.geolocationEnabled,
23196
- geolocationEnabled = _0 === void 0 ? true : _0,
23197
- _1 = _a.geolocationRequired,
23198
- geolocationRequired = _1 === void 0 ? false : _1,
23199
- _2 = _a.debugMode,
23200
- 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;
23201
23267
  useLanguage(lang);
23202
23268
  useDebugLogging(debugMode);
23203
23269
  var idCaptureProps = React.useMemo(function () {
@@ -23207,6 +23273,7 @@
23207
23273
  onModelError: onModelError,
23208
23274
  precapturedDocuments: precapturedDocuments,
23209
23275
  captureRequirement: idCaptureRequirement,
23276
+ allowSinglePageIdCapture: allowSinglePageIdCapture,
23210
23277
  separateIdCardCaptureSequence: separateIdCardCaptureSequence,
23211
23278
  thresholds: idCaptureThresholds,
23212
23279
  skipSuccessScreen: skipSuccessScreen,
@@ -23229,7 +23296,7 @@
23229
23296
  verbiage: verbiage,
23230
23297
  debugMode: debugMode
23231
23298
  };
23232
- }, [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]);
23233
23300
  var additionalDocumentCaptureProps = React.useMemo(function () {
23234
23301
  return {
23235
23302
  documents: captureAdditionalDocuments,
@@ -25585,7 +25652,9 @@
25585
25652
  try {
25586
25653
  root.unmount();
25587
25654
  originalRemove_1();
25588
- } catch (e) {}
25655
+ } catch (e) {
25656
+ debug('failed to unmount', e);
25657
+ }
25589
25658
  };
25590
25659
  }
25591
25660
  return targetElement;