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
@@ -234,7 +234,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
234
234
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
235
235
  };
236
236
 
237
- var webSdkVersion = '2.2.64';
237
+ var webSdkVersion = '2.2.66';
238
238
 
239
239
  function getPlatform() {
240
240
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -1013,7 +1013,7 @@ function debug() {
1013
1013
  parts[_i] = arguments[_i];
1014
1014
  }
1015
1015
  if (logLevel < LogLevel.Debug) return;
1016
- console.debug.apply(console, parts); // eslint-disable-line
1016
+ console.debug.apply(console, parts); // eslint-disable-line no-console
1017
1017
  }
1018
1018
  function log() {
1019
1019
  var parts = [];
@@ -1021,7 +1021,7 @@ function log() {
1021
1021
  parts[_i] = arguments[_i];
1022
1022
  }
1023
1023
  if (logLevel < LogLevel.Info) return;
1024
- console.log.apply(console, parts); // eslint-disable-line
1024
+ console.log.apply(console, parts); // eslint-disable-line no-console
1025
1025
  }
1026
1026
  function warn() {
1027
1027
  var parts = [];
@@ -1029,7 +1029,7 @@ function warn() {
1029
1029
  parts[_i] = arguments[_i];
1030
1030
  }
1031
1031
  if (logLevel < LogLevel.Warn) return;
1032
- console.warn.apply(console, parts); // eslint-disable-line
1032
+ console.warn.apply(console, parts); // eslint-disable-line no-console
1033
1033
  }
1034
1034
  function error() {
1035
1035
  var parts = [];
@@ -1037,7 +1037,7 @@ function error() {
1037
1037
  parts[_i] = arguments[_i];
1038
1038
  }
1039
1039
  if (logLevel < LogLevel.Error) return;
1040
- console.error.apply(console, parts); // eslint-disable-line
1040
+ console.error.apply(console, parts); // eslint-disable-line no-console
1041
1041
  }
1042
1042
 
1043
1043
  exports.defaultSubmissionUrl = 'https://portal-api.idmission.com/swagger';
@@ -1334,82 +1334,33 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1334
1334
  onDocumentUploadFailed.current = userSuppliedOnDocumentUploadFailed;
1335
1335
  }, [userSuppliedOnDocumentUploadFailed]);
1336
1336
  var uploadDocument = React.useCallback(function (src, metadata) {
1337
- return new Promise(function (resolve, reject) {
1338
- return __awaiter(void 0, void 0, void 0, function () {
1339
- var blob, _a, documentId, upload, _b, _c;
1340
- var _d, _e;
1341
- var _f;
1342
- return __generator(this, function (_g) {
1343
- switch (_g.label) {
1344
- case 0:
1345
- blob = typeof src === 'string' ? convertBase64ToBlob(src) : src;
1346
- _a = onBeforeDocumentUpload.current;
1347
- if (!_a) return [3 /*break*/, 2];
1348
- return [4 /*yield*/, (_f = onBeforeDocumentUpload.current) === null || _f === void 0 ? void 0 : _f.call(onBeforeDocumentUpload, blob, metadata)];
1349
- case 1:
1350
- _a = _g.sent() === false;
1351
- _g.label = 2;
1352
- case 2:
1353
- if (_a) return [2 /*return*/, resolve(blobToB64(blob))];
1354
- _b = createUpload;
1355
- _c = [blob];
1356
- _d = {
1357
- endpoint: documentServiceUrl,
1358
- retryDelays: [0, 1000, 1000, 1000, 3000, 5000, 10000, 20000],
1359
- headers: {
1360
- 'X-Session-Id': sessionId
1361
- }
1362
- };
1363
- _e = {
1364
- filetype: blob.type,
1365
- contentType: blob.type
1366
- };
1367
- return [4 /*yield*/, calculateMd5(blob)];
1368
- case 3:
1369
- upload = _b.apply(void 0, _c.concat([(_d.metadata = _assign.apply(void 0, [(_e.fingerprint = _g.sent(), _e), metadata || {}]), _d.onProgress = function (bytesUploaded, bytesTotal) {
1370
- var _a;
1371
- (_a = onDocumentUploadProgress.current) === null || _a === void 0 ? void 0 : _a.call(onDocumentUploadProgress, {
1372
- bytesUploaded: bytesUploaded,
1373
- bytesTotal: bytesTotal,
1374
- percentage: (bytesUploaded / bytesTotal * 100).toFixed(2) + '%',
1375
- metadata: metadata
1376
- });
1377
- }, _d.onAfterResponse = function (_req, res) {
1378
- var contentType = res.getHeader('Content-Type');
1379
- if (!(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('application/json'))) return;
1380
- var body = res.getBody();
1381
- if (!body) return;
1382
- try {
1383
- var parsedId = JSON.parse(body).id;
1384
- if (parsedId.startsWith('urn:documentsv1:')) {
1385
- documentId = parsedId;
1386
- }
1387
- } catch (e) {
1388
- warn('Failed to parse documents service response body', e);
1389
- }
1390
- }, _d.onSuccess = function () {
1391
- var _a, _b;
1392
- documentId || (documentId = "urn:documentsv1:".concat(getEnvFromUrl(upload.url), ":").concat((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift()));
1393
- (_b = onDocumentUploaded.current) === null || _b === void 0 ? void 0 : _b.call(onDocumentUploaded, documentId, metadata);
1394
- resolve(documentId);
1395
- }, _d.onError = function (error) {
1396
- var _a;
1397
- log('Failed because: ' + error);
1398
- (_a = onDocumentUploadFailed.current) === null || _a === void 0 ? void 0 : _a.call(onDocumentUploadFailed, error, metadata);
1399
- reject(error);
1400
- }, _d)]));
1401
- // Check if there are any previous uploads to continue.
1402
- upload.findPreviousUploads().then(function (previousUploads) {
1403
- // Found previous uploads so we select the first one.
1404
- if (previousUploads.length) {
1405
- upload.resumeFromPreviousUpload(previousUploads[0]);
1406
- }
1407
- // Start the upload
1408
- upload.start();
1409
- });
1410
- return [2 /*return*/];
1411
- }
1412
- });
1337
+ return __awaiter(void 0, void 0, void 0, function () {
1338
+ var blob, _a;
1339
+ var _b;
1340
+ return __generator(this, function (_c) {
1341
+ switch (_c.label) {
1342
+ case 0:
1343
+ blob = typeof src === 'string' ? convertBase64ToBlob(src) : src;
1344
+ _a = onBeforeDocumentUpload.current;
1345
+ if (!_a) return [3 /*break*/, 2];
1346
+ return [4 /*yield*/, (_b = onBeforeDocumentUpload.current) === null || _b === void 0 ? void 0 : _b.call(onBeforeDocumentUpload, blob, metadata)];
1347
+ case 1:
1348
+ _a = _c.sent() === false;
1349
+ _c.label = 2;
1350
+ case 2:
1351
+ if (_a) {
1352
+ return [2 /*return*/, blobToB64(blob)];
1353
+ }
1354
+ return [2 /*return*/, performUpload({
1355
+ blob: blob,
1356
+ endpoint: documentServiceUrl,
1357
+ sessionId: sessionId,
1358
+ metadata: metadata,
1359
+ onDocumentUploadProgress: onDocumentUploadProgress.current,
1360
+ onDocumentUploaded: onDocumentUploaded.current,
1361
+ onDocumentUploadFailed: onDocumentUploadFailed.current
1362
+ })];
1363
+ }
1413
1364
  });
1414
1365
  });
1415
1366
  }, [documentServiceUrl, sessionId]);
@@ -1958,6 +1909,83 @@ function getEnvFromUrl(url) {
1958
1909
  }
1959
1910
  return 'unknown';
1960
1911
  }
1912
+ function performUpload(_a) {
1913
+ return __awaiter(this, arguments, void 0, function (_b) {
1914
+ var fingerprint;
1915
+ var blob = _b.blob,
1916
+ endpoint = _b.endpoint,
1917
+ sessionId = _b.sessionId,
1918
+ metadata = _b.metadata,
1919
+ onDocumentUploadProgress = _b.onDocumentUploadProgress,
1920
+ onDocumentUploaded = _b.onDocumentUploaded,
1921
+ onDocumentUploadFailed = _b.onDocumentUploadFailed;
1922
+ return __generator(this, function (_c) {
1923
+ switch (_c.label) {
1924
+ case 0:
1925
+ return [4 /*yield*/, calculateMd5(blob)];
1926
+ case 1:
1927
+ fingerprint = _c.sent();
1928
+ return [2 /*return*/, new Promise(function (resolve, reject) {
1929
+ var documentId;
1930
+ var upload = createUpload(blob, {
1931
+ endpoint: endpoint,
1932
+ retryDelays: [0, 1000, 1000, 1000, 3000, 5000, 10000, 20000],
1933
+ headers: {
1934
+ 'X-Session-Id': sessionId
1935
+ },
1936
+ metadata: _assign({
1937
+ filetype: blob.type,
1938
+ contentType: blob.type,
1939
+ fingerprint: fingerprint
1940
+ }, metadata || {}),
1941
+ onProgress: function onProgress(bytesUploaded, bytesTotal) {
1942
+ onDocumentUploadProgress === null || onDocumentUploadProgress === void 0 ? void 0 : onDocumentUploadProgress({
1943
+ bytesUploaded: bytesUploaded,
1944
+ bytesTotal: bytesTotal,
1945
+ percentage: (bytesUploaded / bytesTotal * 100).toFixed(2) + '%',
1946
+ metadata: metadata
1947
+ });
1948
+ },
1949
+ onAfterResponse: function onAfterResponse(_req, res) {
1950
+ var contentType = res.getHeader('Content-Type');
1951
+ if (!(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('application/json'))) return;
1952
+ var body = res.getBody();
1953
+ if (!body) return;
1954
+ try {
1955
+ var parsedId = JSON.parse(body).id;
1956
+ if (parsedId.startsWith('urn:documentsv1:')) {
1957
+ documentId = parsedId;
1958
+ }
1959
+ } catch (e) {
1960
+ warn('Failed to parse documents service response body', e);
1961
+ }
1962
+ },
1963
+ onSuccess: function onSuccess() {
1964
+ var _a;
1965
+ documentId || (documentId = "urn:documentsv1:".concat(getEnvFromUrl(upload.url), ":").concat((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift()));
1966
+ onDocumentUploaded === null || onDocumentUploaded === void 0 ? void 0 : onDocumentUploaded(documentId, metadata);
1967
+ resolve(documentId);
1968
+ },
1969
+ onError: function onError(error) {
1970
+ log('Failed because: ' + error);
1971
+ onDocumentUploadFailed === null || onDocumentUploadFailed === void 0 ? void 0 : onDocumentUploadFailed(error, metadata);
1972
+ reject(error);
1973
+ }
1974
+ });
1975
+ // Check if there are any previous uploads to continue.
1976
+ upload.findPreviousUploads().then(function (previousUploads) {
1977
+ // Found previous uploads so we select the first one.
1978
+ if (previousUploads.length) {
1979
+ upload.resumeFromPreviousUpload(previousUploads[0]);
1980
+ }
1981
+ // Start the upload
1982
+ upload.start();
1983
+ });
1984
+ })];
1985
+ }
1986
+ });
1987
+ });
1988
+ }
1961
1989
 
1962
1990
  var visionTasksBasePath = "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.7/wasm";
1963
1991
  var visionRuntimePreloading = false;
@@ -2269,7 +2297,7 @@ function average(arr) {
2269
2297
 
2270
2298
  var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
2271
2299
 
2272
- var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20241018_093000.tflite");
2300
+ var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20241212_131026.tflite");
2273
2301
 
2274
2302
  var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
2275
2303
 
@@ -2288,6 +2316,10 @@ var defaultFocusThresholds = {
2288
2316
  passport: {
2289
2317
  desktop: 0,
2290
2318
  mobile: 0.3
2319
+ },
2320
+ singlePage: {
2321
+ desktop: 0,
2322
+ mobile: 0.3
2291
2323
  }
2292
2324
  };
2293
2325
  var classifier = null;
@@ -2395,7 +2427,7 @@ function useLoadFocusModel(_a) {
2395
2427
  };
2396
2428
  }, [modelPath, modelLoadTimeoutMs, videoRef, shouldLoadModels]);
2397
2429
  React.useEffect(function handleModelError() {
2398
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2430
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2399
2431
  }, [modelError, onModelError]);
2400
2432
  return {
2401
2433
  ready: ready,
@@ -2541,7 +2573,7 @@ function useLoadFaceDetector(_a) {
2541
2573
  };
2542
2574
  }, [modelLoadTimeoutMs, videoRef]);
2543
2575
  React.useEffect(function handleModelError() {
2544
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2576
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2545
2577
  }, [modelError, onModelError]);
2546
2578
  return {
2547
2579
  ready: ready,
@@ -2913,16 +2945,19 @@ var defaultDocumentDetectionThresholds = {
2913
2945
  idCardFront: 0.6,
2914
2946
  idCardBack: 0.6,
2915
2947
  passport: 0.4,
2948
+ singlePage: 0.4,
2916
2949
  stability: {
2917
2950
  idCardFront: 0.85,
2918
2951
  idCardBack: 0.85,
2919
- passport: 0.5
2952
+ passport: 0.5,
2953
+ singlePage: 0.5
2920
2954
  }
2921
2955
  };
2922
2956
  var documentTypeDisplayNames = {
2923
2957
  idCardFront: 'ID card front',
2924
2958
  idCardBack: 'ID card back',
2925
2959
  passport: 'Passport',
2960
+ singlePage: 'Single page',
2926
2961
  none: 'None'
2927
2962
  };
2928
2963
  var detector = null;
@@ -3037,7 +3072,7 @@ function useLoadDocumentDetector(_a) {
3037
3072
  };
3038
3073
  }, [shouldLoadModels, modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
3039
3074
  React.useEffect(function handleModelError() {
3040
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
3075
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
3041
3076
  }, [modelError, onModelError]);
3042
3077
  return {
3043
3078
  ready: ready,
@@ -3111,7 +3146,7 @@ var defaultDocumentDetectionBoundaries = {
3111
3146
  right: 20
3112
3147
  };
3113
3148
  function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3114
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3149
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
3115
3150
  if (boundaries === void 0) {
3116
3151
  boundaries = defaultDocumentDetectionBoundaries;
3117
3152
  }
@@ -3162,18 +3197,25 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3162
3197
  var bestPassportPage = detectedObjects.find(function (obj) {
3163
3198
  return obj.label === 'Passport page';
3164
3199
  });
3200
+ var bestSinglePage = detectedObjects.find(function (obj) {
3201
+ return obj.label === 'Single page';
3202
+ });
3165
3203
  var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
3166
3204
  var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
3167
3205
  var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
3168
- var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_h = thresholds.idCardFront) !== null && _h !== void 0 ? _h : 0);
3169
- var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_j = thresholds.idCardBack) !== null && _j !== void 0 ? _j : 0);
3170
- var passportDetectionThresholdMet = passportDetectionScore >= ((_k = thresholds.passport) !== null && _k !== void 0 ? _k : 0);
3171
- var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
3172
- var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
3173
- var detectionScore = (_l = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _l !== void 0 ? _l : 0;
3206
+ var singlePageDetectionScore = (_h = bestSinglePage === null || bestSinglePage === void 0 ? void 0 : bestSinglePage.score) !== null && _h !== void 0 ? _h : 0;
3207
+ var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_j = thresholds.idCardFront) !== null && _j !== void 0 ? _j : 0);
3208
+ var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_k = thresholds.idCardBack) !== null && _k !== void 0 ? _k : 0);
3209
+ var passportDetectionThresholdMet = passportDetectionScore >= ((_l = thresholds.passport) !== null && _l !== void 0 ? _l : 0);
3210
+ var singlePageDetectionThresholdMet = singlePageDetectionScore >= ((_m = thresholds.singlePage) !== null && _m !== void 0 ? _m : 0);
3211
+ var bestDocument = singlePageDetectionThresholdMet ? bestSinglePage : passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
3212
+ var detectionThreshold = singlePageDetectionThresholdMet ? thresholds.singlePage : passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
3213
+ var detectionScore = (_o = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _o !== void 0 ? _o : 0;
3174
3214
  var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
3175
3215
  var detectedDocumentType = 'none';
3176
- if (passportDetectionThresholdMet) {
3216
+ if (singlePageDetectionThresholdMet) {
3217
+ detectedDocumentType = 'singlePage';
3218
+ } else if (passportDetectionThresholdMet) {
3177
3219
  detectedDocumentType = 'passport';
3178
3220
  } else if (idCardBackDetectionThresholdMet) {
3179
3221
  detectedDocumentType = 'idCardBack';
@@ -3187,12 +3229,12 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3187
3229
  var documentIsStable = false;
3188
3230
  var documentTooClose = false;
3189
3231
  if (bestDocument) {
3190
- var _o = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
3191
- docWidth = _o[0],
3192
- docHeight = _o[1];
3232
+ var _q = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
3233
+ docWidth = _q[0],
3234
+ docHeight = _q[1];
3193
3235
  documentTooClose = docWidth > 0.85 || docHeight > 0.85;
3194
3236
  if (detectionThresholdMet && documentInBounds && !documentTooClose) {
3195
- var thresholdSet = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
3237
+ var thresholdSet = (_p = thresholds.stability) !== null && _p !== void 0 ? _p : defaultDocumentDetectionThresholds.stability;
3196
3238
  var threshold_1 = thresholdSet[detectedDocumentType];
3197
3239
  var framesNeeded = Math.ceil(average(framesNeededSamples));
3198
3240
  trackBox(bestDocument.box, framesNeeded);
@@ -3214,6 +3256,8 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3214
3256
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
3215
3257
  passportDetectionScore: passportDetectionScore,
3216
3258
  passportDetectionThresholdMet: passportDetectionThresholdMet,
3259
+ singlePageDetectionScore: singlePageDetectionScore,
3260
+ singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
3217
3261
  bestDocument: bestDocument,
3218
3262
  documentInBounds: documentInBounds,
3219
3263
  documentTooClose: documentTooClose,
@@ -3279,8 +3323,8 @@ function useFrameLoop(fn, _a) {
3279
3323
  renderPrediction().then();
3280
3324
  return function () {
3281
3325
  loopId.current += 1;
3282
- frameId.current && cancelAnimationFrame(frameId.current);
3283
- timer && clearTimeout(timer);
3326
+ if (frameId.current) cancelAnimationFrame(frameId.current);
3327
+ if (timer) clearTimeout(timer);
3284
3328
  };
3285
3329
  }, [fn, running, throttleMs]);
3286
3330
  var start = React.useCallback(function () {
@@ -3445,7 +3489,7 @@ var createCameraStore = function createCameraStore(config) {
3445
3489
  },
3446
3490
  requestCameraAccess: function requestCameraAccess() {
3447
3491
  return __awaiter(this, void 0, void 0, function () {
3448
- 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;
3492
+ 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;
3449
3493
  var _b, _c, _d;
3450
3494
  return __generator(this, function (_e) {
3451
3495
  switch (_e.label) {
@@ -3565,13 +3609,13 @@ var createCameraStore = function createCameraStore(config) {
3565
3609
  debug('opened stream with no width and height constraints');
3566
3610
  return [3 /*break*/, 10];
3567
3611
  case 9:
3568
- _e.sent();
3569
- debug('cannot open stream at all');
3612
+ e_2 = _e.sent();
3613
+ debug('cannot open stream at all', e_2);
3570
3614
  return [3 /*break*/, 10];
3571
3615
  case 10:
3572
3616
  if (!stream_1) {
3573
3617
  error('failed to open camera');
3574
- throw new Error('failed to open camera');
3618
+ throw new Error('failed to open camera: ');
3575
3619
  }
3576
3620
  debug('camera access granted with constraints', constraints);
3577
3621
  handleStreamEnded_1 = function handleStreamEnded_1() {
@@ -3652,7 +3696,7 @@ var createCameraStore = function createCameraStore(config) {
3652
3696
  },
3653
3697
  requestMicrophoneAccess: function requestMicrophoneAccess() {
3654
3698
  return __awaiter(this, void 0, void 0, function () {
3655
- var stream_2;
3699
+ var stream_2, e_4;
3656
3700
  return __generator(this, function (_a) {
3657
3701
  switch (_a.label) {
3658
3702
  case 0:
@@ -3691,7 +3735,8 @@ var createCameraStore = function createCameraStore(config) {
3691
3735
  }, 500);
3692
3736
  return [3 /*break*/, 4];
3693
3737
  case 3:
3694
- _a.sent();
3738
+ e_4 = _a.sent();
3739
+ debug('failed to open microphone', e_4);
3695
3740
  set({
3696
3741
  microphoneAccessDenied: true
3697
3742
  });
@@ -4056,9 +4101,7 @@ function evaluateIsMobile(nav) {
4056
4101
  // @ts-ignore
4057
4102
  return navAny.userAgentData && navAny.userAgentData.mobile;
4058
4103
  }
4059
- 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) ||
4060
- // tslint:disable-next-line:max-line-length
4061
- /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));
4104
+ 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));
4062
4105
  }
4063
4106
  return false;
4064
4107
  }
@@ -4107,37 +4150,39 @@ var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
4107
4150
  });
4108
4151
  function IdCaptureModelsProviderInner(_a) {
4109
4152
  var children = _a.children,
4110
- onModelError = _a.onModelError;
4111
- var _b = React.useContext(DocumentDetectionModelContext),
4112
- documentDetectionModelReady = _b.documentDetectionModelReady,
4113
- documentDetectionModelDownloadProgress = _b.documentDetectionModelDownloadProgress,
4114
- startDocumentDetection = _b.startDocumentDetection,
4115
- stopDocumentDetection = _b.stopDocumentDetection,
4116
- lastPredictionCanvas = _b.documentDetectionLastPredictionCanvas,
4117
- clearDocumentDetectionLastPredictionCanvas = _b.clearDocumentDetectionLastPredictionCanvas,
4118
- onDocumentDetected = _b.onDocumentDetected,
4119
- detectionTime = _b.detectionTime,
4120
- documentDetectionThresholds = _b.documentDetectionThresholds,
4121
- setDocumentDetectionThresholds = _b.setDocumentDetectionThresholds,
4122
- documentDetectionBoundaries = _b.documentDetectionBoundaries,
4123
- setDocumentDetectionBoundaries = _b.setDocumentDetectionBoundaries,
4124
- documentDetectionModelError = _b.documentDetectionModelError;
4125
- var _c = React.useContext(FocusModelContext),
4126
- focusModelReady = _c.focusModelReady,
4127
- focusModelDownloadProgress = _c.focusModelDownloadProgress,
4128
- makeFocusPrediction = _c.makeFocusPrediction,
4129
- focusThresholds = _c.focusThresholds,
4130
- setFocusThresholds = _c.setFocusThresholds,
4131
- focusPredictionTime = _c.focusPredictionTime,
4132
- focusModelError = _c.focusModelError;
4153
+ onModelError = _a.onModelError,
4154
+ _b = _a.allowSinglePageIdCapture,
4155
+ allowSinglePageIdCapture = _b === void 0 ? false : _b;
4156
+ var _c = React.useContext(DocumentDetectionModelContext),
4157
+ documentDetectionModelReady = _c.documentDetectionModelReady,
4158
+ documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
4159
+ startDocumentDetection = _c.startDocumentDetection,
4160
+ stopDocumentDetection = _c.stopDocumentDetection,
4161
+ lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
4162
+ clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
4163
+ onDocumentDetected = _c.onDocumentDetected,
4164
+ detectionTime = _c.detectionTime,
4165
+ documentDetectionThresholds = _c.documentDetectionThresholds,
4166
+ setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
4167
+ documentDetectionBoundaries = _c.documentDetectionBoundaries,
4168
+ setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
4169
+ documentDetectionModelError = _c.documentDetectionModelError;
4170
+ var _d = React.useContext(FocusModelContext),
4171
+ focusModelReady = _d.focusModelReady,
4172
+ focusModelDownloadProgress = _d.focusModelDownloadProgress,
4173
+ makeFocusPrediction = _d.makeFocusPrediction,
4174
+ focusThresholds = _d.focusThresholds,
4175
+ setFocusThresholds = _d.setFocusThresholds,
4176
+ focusPredictionTime = _d.focusPredictionTime,
4177
+ focusModelError = _d.focusModelError;
4133
4178
  var onPredictionHandler = React.useRef();
4134
4179
  var bestFrameDetails = React.useRef(null);
4135
4180
  var bestPredictionCanvas = React.useRef(null);
4136
4181
  var bestFocusScore = React.useRef(0);
4137
4182
  var stopDetection = React.useRef(0);
4138
- var _d = React.useState('none'),
4139
- requiredDocumentType = _d[0],
4140
- setRequiredDocumentType = _d[1];
4183
+ var _e = React.useState('none'),
4184
+ requiredDocumentType = _e[0],
4185
+ setRequiredDocumentType = _e[1];
4141
4186
  var thresholds = React.useMemo(function () {
4142
4187
  return _assign(_assign({}, documentDetectionThresholds), {
4143
4188
  focus: focusThresholds
@@ -4155,34 +4200,42 @@ function IdCaptureModelsProviderInner(_a) {
4155
4200
  var _this = this;
4156
4201
  onDocumentDetected(function (prediction) {
4157
4202
  return __awaiter(_this, void 0, void 0, function () {
4158
- var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4159
- var _a, _b, _c, _d, _e, _f;
4160
- return __generator(this, function (_g) {
4203
+ var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4204
+ var _a, _b, _c, _d, _e, _f, _g;
4205
+ return __generator(this, function (_h) {
4161
4206
  if (!lastPredictionCanvas.current) return [2 /*return*/];
4162
4207
  stopDetectionAtStart = stopDetection.current;
4163
4208
  focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
4164
- isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType));
4209
+ isSinglePage = prediction.detectedDocumentType === 'singlePage';
4210
+ if (!allowSinglePageIdCapture && isSinglePage) {
4211
+ prediction.detectedDocumentType = 'passport';
4212
+ prediction.passportDetectionScore = prediction.singlePageDetectionScore;
4213
+ prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
4214
+ prediction.singlePageDetectionScore = 0;
4215
+ prediction.singlePageDetectionThresholdMet = false;
4216
+ }
4217
+ isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType)) || allowSinglePageIdCapture && isSinglePage && ((_b = requiredDocumentType.includes) === null || _b === void 0 ? void 0 : _b.call(requiredDocumentType, 'idCardFront'));
4165
4218
  if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
4166
- focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_b = prediction.bestDocument) === null || _b === void 0 ? void 0 : _b.box);
4219
+ focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
4167
4220
  if (focusPrediction) {
4168
4221
  focusScore = focusPrediction.score;
4169
4222
  focusPredictionTime = focusPrediction.predictionTime;
4170
4223
  }
4171
- focusThresholdSet = (_c = thresholds.focus) === null || _c === void 0 ? void 0 : _c[prediction.detectedDocumentType];
4172
- focusThreshold = (_d = onMobile ? focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.mobile : focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.desktop) !== null && _d !== void 0 ? _d : 0;
4224
+ focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
4225
+ focusThreshold = (_e = onMobile ? focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.mobile : focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.desktop) !== null && _e !== void 0 ? _e : 0;
4173
4226
  focusThresholdMet = focusScore >= focusThreshold;
4174
4227
  if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
4175
4228
  bestFocusScore.current = focusScore;
4176
4229
  drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
4177
4230
  bestFrameDetails.current = {
4178
- boundingBox: (_e = prediction.bestDocument) === null || _e === void 0 ? void 0 : _e.box,
4231
+ boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
4179
4232
  documentType: prediction.detectedDocumentType,
4180
4233
  detectionScore: prediction.detectionScore,
4181
4234
  focusScore: focusScore
4182
4235
  };
4183
4236
  }
4184
4237
  }
4185
- (_f = onPredictionHandler.current) === null || _f === void 0 ? void 0 : _f.call(onPredictionHandler, _assign(_assign({}, prediction), {
4238
+ (_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
4186
4239
  focusScore: focusScore,
4187
4240
  focusPredictionTime: focusPredictionTime,
4188
4241
  focusThresholdMet: focusThresholdMet
@@ -4191,10 +4244,10 @@ function IdCaptureModelsProviderInner(_a) {
4191
4244
  });
4192
4245
  });
4193
4246
  });
4194
- }, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4247
+ }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4195
4248
  var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
4196
4249
  React.useEffect(function handleModelErrors() {
4197
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
4250
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
4198
4251
  }, [modelError, onModelError]);
4199
4252
  var onPredictionMade = React.useCallback(function (handler) {
4200
4253
  onPredictionHandler.current = handler;
@@ -4205,9 +4258,9 @@ function IdCaptureModelsProviderInner(_a) {
4205
4258
  canvas: bestPredictionCanvas.current
4206
4259
  });
4207
4260
  }, []);
4208
- var _e = React.useState(0),
4209
- canvasKey = _e[0],
4210
- setCanvasKey = _e[1];
4261
+ var _f = React.useState(0),
4262
+ canvasKey = _f[0],
4263
+ setCanvasKey = _f[1];
4211
4264
  var resetBestFrame = React.useCallback(function () {
4212
4265
  stopDetection.current += 1;
4213
4266
  setCanvasKey(function (n) {
@@ -4218,7 +4271,7 @@ function IdCaptureModelsProviderInner(_a) {
4218
4271
  bestFocusScore.current = 0;
4219
4272
  }, [clearDocumentDetectionLastPredictionCanvas]);
4220
4273
  React.useEffect(function () {
4221
- requiredDocumentType && resetBestFrame();
4274
+ if (requiredDocumentType) resetBestFrame();
4222
4275
  }, [requiredDocumentType, resetBestFrame]);
4223
4276
  var value = React.useMemo(function () {
4224
4277
  return {
@@ -4254,9 +4307,9 @@ function IdCaptureModelsProvider(_a) {
4254
4307
  return /*#__PURE__*/React__namespace.default.createElement(DocumentDetectionModelProvider, _assign({}, props), /*#__PURE__*/React__namespace.default.createElement(FocusModelProvider, _assign({}, props), /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProviderInner, _assign({}, props), children)));
4255
4308
  }
4256
4309
 
4257
- var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'selfie'];
4310
+ var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
4258
4311
 
4259
- var requiredDocumentsForOption = {
4312
+ var acceptedDocumentTypesForIdCaptureRequirementOption = {
4260
4313
  idCardFront: ['idCardFront'],
4261
4314
  idCardBack: ['idCardBack'],
4262
4315
  passport: ['passport'],
@@ -4264,13 +4317,31 @@ var requiredDocumentsForOption = {
4264
4317
  idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
4265
4318
  idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
4266
4319
  };
4267
- function requiredImageCountForOption(idCaptureRequirement) {
4320
+ function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4268
4321
  if (idCaptureRequirement === 'idCardOrPassport') return 1;
4269
- return requiredDocumentsForOption[idCaptureRequirement].length;
4322
+ return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
4270
4323
  }
4271
- function allowedImageCountForOption(idCaptureRequirement) {
4324
+ function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4272
4325
  if (idCaptureRequirement === 'idCardOrPassport') return 2;
4273
- return requiredImageCountForOption(idCaptureRequirement);
4326
+ return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
4327
+ }
4328
+ function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
4329
+ var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
4330
+ if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
4331
+ var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
4332
+ if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
4333
+ acceptedTypes = acceptedTypes.filter(function (v) {
4334
+ return !v.includes('idCard');
4335
+ });
4336
+ }
4337
+ if (isIdCardOrPassport) {
4338
+ acceptedTypes = acceptedTypes.filter(function (v) {
4339
+ return v !== 'passport';
4340
+ });
4341
+ }
4342
+ return acceptedTypes.filter(function (v) {
4343
+ return !(v in capturedDocuments);
4344
+ });
4274
4345
  }
4275
4346
 
4276
4347
  var initialState$4 = {
@@ -4309,6 +4380,8 @@ var initialState$4 = {
4309
4380
  idCardBackDetectionThresholdMet: false,
4310
4381
  passportDetectionScore: 0,
4311
4382
  passportDetectionThresholdMet: false,
4383
+ singlePageDetectionScore: 0,
4384
+ singlePageDetectionThresholdMet: false,
4312
4385
  focusScore: 0,
4313
4386
  focusThresholdMet: false,
4314
4387
  isGoodFrame: false,
@@ -4324,6 +4397,7 @@ var initialState$4 = {
4324
4397
  capturedDocuments: {},
4325
4398
  captureRequirement: 'idCardOrPassport',
4326
4399
  requestedDocumentType: 'idCardFront',
4400
+ allowSinglePageIdCapture: false,
4327
4401
  allowIdCardBackToFrontCapture: false,
4328
4402
  operationStartedAt: null,
4329
4403
  captureStartedAt: null
@@ -4338,11 +4412,13 @@ var _reducer = function reducer(state, action) {
4338
4412
  var _c = action.payload,
4339
4413
  captureRequirement = _c.captureRequirement,
4340
4414
  precapturedDocuments = _c.precapturedDocuments,
4415
+ allowSinglePageIdCapture = _c.allowSinglePageIdCapture,
4341
4416
  allowIdCardBackToFrontCapture = _c.allowIdCardBackToFrontCapture,
4342
4417
  enableOverrideWrongDocumentTypeDialog = _c.enableOverrideWrongDocumentTypeDialog,
4343
4418
  allowOverrideWrongDocumentTypeAfterMs = _c.allowOverrideWrongDocumentTypeAfterMs;
4344
4419
  var newState = _assign(_assign({}, state), {
4345
4420
  captureRequirement: captureRequirement,
4421
+ allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
4346
4422
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
4347
4423
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
4348
4424
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
@@ -4410,6 +4486,8 @@ var _reducer = function reducer(state, action) {
4410
4486
  idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
4411
4487
  passportDetectionScore = _d.passportDetectionScore,
4412
4488
  passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
4489
+ singlePageDetectionScore = _d.singlePageDetectionScore,
4490
+ singlePageDetectionThresholdMet = _d.singlePageDetectionThresholdMet,
4413
4491
  bestDocument = _d.bestDocument,
4414
4492
  documentInBounds = _d.documentInBounds,
4415
4493
  documentTooClose = _d.documentTooClose,
@@ -4430,7 +4508,8 @@ var _reducer = function reducer(state, action) {
4430
4508
  }
4431
4509
  }
4432
4510
  }
4433
- var idCardDetectedButNotAllowed = detectedDocumentType.includes('idCard') && !state.captureRequirement.includes('idCard');
4511
+ var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
4512
+ var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
4434
4513
  var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
4435
4514
  var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
4436
4515
  var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
@@ -4490,6 +4569,8 @@ var _reducer = function reducer(state, action) {
4490
4569
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
4491
4570
  passportDetectionScore: passportDetectionScore,
4492
4571
  passportDetectionThresholdMet: passportDetectionThresholdMet,
4572
+ singlePageDetectionScore: singlePageDetectionScore,
4573
+ singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
4493
4574
  focusScore: focusScore,
4494
4575
  focusThresholdMet: focusThresholdMet,
4495
4576
  isGoodFrame: isGoodFrame,
@@ -4527,7 +4608,7 @@ var _reducer = function reducer(state, action) {
4527
4608
  });
4528
4609
  case 'documentCaptured':
4529
4610
  {
4530
- var newState_1 = _assign(_assign({}, state), {
4611
+ var newState = _assign(_assign({}, state), {
4531
4612
  capturing: false,
4532
4613
  captureFailed: false,
4533
4614
  allowOverrideFlipRequirement: false,
@@ -4536,64 +4617,42 @@ var _reducer = function reducer(state, action) {
4536
4617
  wrongDocumentTypePredictions: 0,
4537
4618
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
4538
4619
  });
4539
- var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
4540
- return !(v in newState_1.capturedDocuments);
4541
- });
4542
- if (state.captureRequirement === 'idCardOrPassport') {
4543
- if (state.requestedDocumentType === 'passport') {
4544
- remainingRequirements = [];
4545
- } else {
4546
- remainingRequirements = remainingRequirements.filter(function (v) {
4547
- return v !== 'passport';
4548
- });
4549
- }
4550
- }
4620
+ var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4551
4621
  if (remainingRequirements.length === 0) {
4552
- newState_1.captureState = 'complete';
4622
+ newState.captureState = 'complete';
4553
4623
  } else {
4554
- newState_1.requestedDocumentType = remainingRequirements[0];
4555
- if (state.requestedDocumentType === 'idCardFront' && newState_1.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_1.requestedDocumentType === 'idCardFront') {
4556
- newState_1.captureState = 'requestingFlip';
4557
- newState_1.idCardFrontDetectionThresholdMet = false;
4558
- newState_1.idCardBackDetectionThresholdMet = false;
4559
- newState_1.passportDetectionThresholdMet = false;
4560
- newState_1.wrongDocumentTypePredictions = 0;
4624
+ newState.requestedDocumentType = remainingRequirements[0];
4625
+ if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
4626
+ newState.captureState = 'requestingFlip';
4627
+ newState.idCardFrontDetectionThresholdMet = false;
4628
+ newState.idCardBackDetectionThresholdMet = false;
4629
+ newState.passportDetectionThresholdMet = false;
4630
+ newState.wrongDocumentTypePredictions = 0;
4561
4631
  }
4562
4632
  }
4563
- return newState_1;
4633
+ return newState;
4564
4634
  }
4565
4635
  case 'documentCapturedManually':
4566
4636
  {
4567
- var newState_2 = _assign(_assign({}, state), {
4637
+ var newState = _assign(_assign({}, state), {
4568
4638
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_b = {}, _b[state.requestedDocumentType] = _assign(_assign({}, action.payload), {
4569
4639
  width: 0,
4570
4640
  height: 0
4571
4641
  }), _b))
4572
4642
  });
4573
- var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
4574
- return !(v in newState_2.capturedDocuments);
4575
- });
4576
- if (state.captureRequirement === 'idCardOrPassport') {
4577
- if (state.requestedDocumentType === 'passport') {
4578
- remainingRequirements = [];
4579
- } else {
4580
- remainingRequirements = remainingRequirements.filter(function (v) {
4581
- return v !== 'passport';
4582
- });
4583
- }
4584
- }
4643
+ var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4585
4644
  if (remainingRequirements.length === 0) {
4586
- newState_2.captureState = 'complete';
4645
+ newState.captureState = 'complete';
4587
4646
  } else {
4588
- newState_2.requestedDocumentType = remainingRequirements[0];
4589
- if (state.requestedDocumentType === 'idCardFront' && newState_2.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_2.requestedDocumentType === 'idCardFront') {
4590
- newState_2.captureState = 'requestingFlip';
4591
- newState_2.idCardFrontDetectionThresholdMet = false;
4592
- newState_2.idCardBackDetectionThresholdMet = false;
4593
- newState_2.passportDetectionThresholdMet = false;
4647
+ newState.requestedDocumentType = remainingRequirements[0];
4648
+ if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
4649
+ newState.captureState = 'requestingFlip';
4650
+ newState.idCardFrontDetectionThresholdMet = false;
4651
+ newState.idCardBackDetectionThresholdMet = false;
4652
+ newState.passportDetectionThresholdMet = false;
4594
4653
  }
4595
4654
  }
4596
- return newState_2;
4655
+ return newState;
4597
4656
  }
4598
4657
  case 'flipRequestCompleted':
4599
4658
  return _assign(_assign({}, state), {
@@ -5194,7 +5253,7 @@ var IdCapture = function IdCapture(_a) {
5194
5253
  imageUrl: imageUrl
5195
5254
  }
5196
5255
  });
5197
- var capturedDocumentType = documentType === 'passport' ? 'passport' : state.requestedDocumentType;
5256
+ var capturedDocumentType = documentType;
5198
5257
  setTimeout(function () {
5199
5258
  var _a;
5200
5259
  var captureTime = new Date().getTime() - ((_a = state.captureStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
@@ -5261,7 +5320,7 @@ var IdCapture = function IdCapture(_a) {
5261
5320
  scaling: debugScalingDetails,
5262
5321
  flipX: !isRearFacing
5263
5322
  });
5264
- }))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__namespace.default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__namespace.default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u274C Models not ready")))));
5323
+ }))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__namespace.default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__namespace.default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u274C Models not ready")))));
5265
5324
  };
5266
5325
  var timeSince = function timeSince(t) {
5267
5326
  if (!t) return 0;
@@ -6300,15 +6359,8 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6300
6359
  _e = _a.debugMode,
6301
6360
  debugMode = _e === void 0 ? false : _e;
6302
6361
  var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
6303
- var idCardFront = capturedDocuments.idCardFront,
6304
- idCardBack = capturedDocuments.idCardBack,
6305
- passport = capturedDocuments.passport;
6306
6362
  var verbiage = useTranslations(rawVerbiage, {
6307
6363
  headingText: 'ID Capture Successful',
6308
- idCardFrontText: 'ID Card Front',
6309
- idCardBackText: 'ID Card Back',
6310
- passportText: 'Passport',
6311
- instructionText: 'Verify the entire ID was captured clearly with no glare.',
6312
6364
  retryText: 'Retry',
6313
6365
  submittingText: 'Submitting...',
6314
6366
  submitText: 'Done'
@@ -6325,25 +6377,16 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6325
6377
  className: classNames.imageContainer
6326
6378
  }, /*#__PURE__*/React__namespace.default.createElement(ImageRow, {
6327
6379
  className: classNames.imageRow
6328
- }, idCardFront && ( /*#__PURE__*/React__namespace.default.createElement(ImageCol$1, {
6329
- className: classNames.imageCol
6330
- }, /*#__PURE__*/React__namespace.default.createElement(StyledImage, {
6331
- image: idCardFront,
6332
- className: classNames.image,
6333
- alt: verbiage.idCardFrontText
6334
- }), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugPre, null, "Detection Score: ".concat(idCardFront.detectionScore, "\nFocus Score: ").concat(idCardFront.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardFront.boundingBox)))))), idCardBack && ( /*#__PURE__*/React__namespace.default.createElement(ImageCol$1, {
6335
- className: classNames.imageCol
6336
- }, /*#__PURE__*/React__namespace.default.createElement(StyledImage, {
6337
- image: idCardBack,
6338
- className: classNames.image,
6339
- alt: verbiage.idCardBackText
6340
- }), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugPre, null, "Detection Score: ".concat(idCardBack.detectionScore, "\nFocus Score: ").concat(idCardBack.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardBack.boundingBox)))))), passport && ( /*#__PURE__*/React__namespace.default.createElement(ImageCol$1, {
6341
- className: classNames.imageCol
6342
- }, /*#__PURE__*/React__namespace.default.createElement(StyledImage, {
6343
- image: passport,
6344
- className: classNames.image,
6345
- alt: verbiage.passportText
6346
- }), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugPre, null, "Detection Score: ".concat(passport.detectionScore, "\nFocus Score: ").concat(passport.focusScore, "\nBounding Box: ").concat(JSON.stringify(passport.boundingBox)))))))), /*#__PURE__*/React__namespace.default.createElement(ButtonsColumn, {
6380
+ }, Object.values(capturedDocuments).map(function (doc) {
6381
+ return /*#__PURE__*/React__namespace.default.createElement(ImageCol$1, {
6382
+ className: classNames.imageCol,
6383
+ key: doc.imageData
6384
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledImage, {
6385
+ image: doc,
6386
+ className: classNames.image,
6387
+ alt: doc.documentType
6388
+ }), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugPre, null, "Document Type: ".concat(doc.documentType, "\nDetection Score: ").concat(doc.detectionScore, "\nFocus Score: ").concat(doc.focusScore, "\nBounding Box: ").concat(JSON.stringify(doc.boundingBox)))));
6389
+ }))), /*#__PURE__*/React__namespace.default.createElement(ButtonsColumn, {
6347
6390
  className: classNames.buttonsRow
6348
6391
  }, /*#__PURE__*/React__namespace.default.createElement(WideButton, {
6349
6392
  className: classNames.submitBtn,
@@ -6362,7 +6405,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6362
6405
  };
6363
6406
  var Heading$a = styled__default.default.h1(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n font-size: 1.5rem;\n margin-top: 0;\n margin-bottom: 1.5rem;\n"], ["\n font-size: 1.5rem;\n margin-top: 0;\n margin-bottom: 1.5rem;\n"])));
6364
6407
  var ImagesContainer = styled__default.default(OverlayImageContainer)(templateObject_2$q || (templateObject_2$q = __makeTemplateObject(["\n flex-grow: 1;\n overflow-y: auto;\n padding-bottom: 0;\n max-width: 100%;\n"], ["\n flex-grow: 1;\n overflow-y: auto;\n padding-bottom: 0;\n max-width: 100%;\n"])));
6365
- var ImageRow = styled__default.default(OverlayImageRow)(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n //grid-template-columns: 1fr 1fr;\n"], ["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n //grid-template-columns: 1fr 1fr;\n"])));
6408
+ var ImageRow = styled__default.default(OverlayImageRow)(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n"], ["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n"])));
6366
6409
  var ImageCol$1 = styled__default.default.div(templateObject_4$e || (templateObject_4$e = __makeTemplateObject(["\n width: 100%;\n max-height: none !important;\n"], ["\n width: 100%;\n max-height: none !important;\n"])));
6367
6410
  var StyledImage = styled__default.default(CapturedDocumentImg)(templateObject_5$9 || (templateObject_5$9 = __makeTemplateObject(["\n width: 100%;\n border-radius: 12px;\n"], ["\n width: 100%;\n border-radius: 12px;\n"])));
6368
6411
  var DebugPre = styled__default.default.pre(templateObject_6$7 || (templateObject_6$7 = __makeTemplateObject(["\n text-align: left;\n max-width: min(450px, 100dvw - 100px);\n overflow-x: auto;\n"], ["\n text-align: left;\n max-width: min(450px, 100dvw - 100px);\n overflow-x: auto;\n"])));
@@ -6946,7 +6989,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
6946
6989
  });
6947
6990
  }, [setDimensions, wrapperHeight, wrapperWidth]);
6948
6991
  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;
6949
- var paddingAndBorderPx = padding * 2 + borderWidth * 2;
6992
+ var paddingAndBorderPx = padding * 2 + (borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0) * 2;
6950
6993
  var images = useImagesWithBackToFront(userSuppliedImages, isBackToFront);
6951
6994
  var imagesByUrl = useGuideImagesByUrl(images);
6952
6995
  var orientation = getOrientation(portraitGuidesOnMobile);
@@ -6993,7 +7036,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
6993
7036
  "$isMirrored": isMirrored,
6994
7037
  className: classNames.centerRegion
6995
7038
  }, /*#__PURE__*/React__namespace.default.createElement(GuideCenterBorder, {
6996
- "$borderWidth": borderWidth,
7039
+ "$borderWidth": borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0,
6997
7040
  "$borderColor": borderColor,
6998
7041
  "$padding": imagePadding,
6999
7042
  className: classNames.centerRegionBorder
@@ -7193,7 +7236,7 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
7193
7236
  }, [aspectRatio, borderColor, borderRadius, borderWidth, dispatch, maskColor, padding, redrawing, wrapperHeight, wrapperWidth]);
7194
7237
  return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(CanvasWrapper$1, {
7195
7238
  ref: wrapperRef,
7196
- "$maskColor": maskColor,
7239
+ "$maskColor": maskColor !== null && maskColor !== void 0 ? maskColor : '',
7197
7240
  className: classNames.canvasWrapper
7198
7241
  }, /*#__PURE__*/React__namespace.default.createElement(Canvas$1, {
7199
7242
  ref: canvasRef,
@@ -7488,7 +7531,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7488
7531
  var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
7489
7532
  var uploadCapturedDocument = React.useCallback(function (content, filetype) {
7490
7533
  return __awaiter(void 0, void 0, void 0, function () {
7491
- var documentId_1;
7534
+ var documentId_1, e_1;
7492
7535
  return __generator(this, function (_a) {
7493
7536
  switch (_a.label) {
7494
7537
  case 0:
@@ -7511,7 +7554,8 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7511
7554
  }, 0);
7512
7555
  return [3 /*break*/, 3];
7513
7556
  case 2:
7514
- _a.sent();
7557
+ e_1 = _a.sent();
7558
+ debug('upload failed', e_1);
7515
7559
  dispatch({
7516
7560
  type: 'uploadFailed'
7517
7561
  });
@@ -7546,7 +7590,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7546
7590
  resolvedDocuments.forEach(function (d) {
7547
7591
  if (d.content) {
7548
7592
  d.contentUrl || (d.contentUrl = URL.createObjectURL(d.content));
7549
- uploadCapturedDocument(d.content, d.content.type);
7593
+ void uploadCapturedDocument(d.content, d.content.type);
7550
7594
  }
7551
7595
  });
7552
7596
  }, [aspectRatio, cameraFeedMode, documents, instructions, uploadCapturedDocument]);
@@ -7744,6 +7788,7 @@ var CameraVideoTag = function CameraVideoTag(props) {
7744
7788
  React.useEffect(function attachCameraStreamToVideoTagWhenReady() {
7745
7789
  if (videoRef.current && videoStream) {
7746
7790
  debug('attaching camera stream to video tag');
7791
+ // eslint-disable-next-line react-compiler/react-compiler
7747
7792
  videoRef.current.srcObject = videoStream;
7748
7793
  }
7749
7794
  }, [videoStream, videoRef]);
@@ -8070,8 +8115,8 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8070
8115
  var _j = React.useState(silentFallback),
8071
8116
  useFallback = _j[0],
8072
8117
  setUseFallback = _j[1];
8073
- var allowedImageCount = allowedImageCountForOption(idCaptureRequirement);
8074
- var requiredImageCount = requiredImageCountForOption(idCaptureRequirement);
8118
+ var minImageCount = minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
8119
+ var maxImageCount = maxImageCountForIdCaptureRequirementOption(idCaptureRequirement);
8075
8120
  var _k = useFileState(),
8076
8121
  rawFile = _k.rawFile,
8077
8122
  fileInputOnChange = _k.fileInputOnChange;
@@ -8084,7 +8129,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8084
8129
  var whatToCapture = idCaptureRequirement === 'idCard' ? 'ID card' : idCaptureRequirement === 'passport' ? 'passport' : idCaptureRequirement === 'idCardOrPassport' ? 'ID card or passport' : 'ID card and passport';
8085
8130
  var firstInstructionText = idCaptureRequirement === 'idCard' || idCaptureRequirement === 'idCardAndPassport' ? 'Please capture the front of your ID card.' : idCaptureRequirement === 'passport' ? 'Please capture the ID page of your passport.' : 'Please capture the front of your ID card, or the ID page of your passport.';
8086
8131
  var secondInstructionText = idCaptureRequirement === 'idCardOrPassport' ? 'Please capture the back of your ID card, or click Done if submitting a passport.' : 'Please capture the back of your ID card.';
8087
- var descriptionText = "On-device capture guidance failed, please capture ".concat(requiredImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
8132
+ var descriptionText = "On-device capture guidance failed, please capture ".concat(minImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
8088
8133
  var verbiage = useTranslations(rawVerbiage, {
8089
8134
  headingText: "We're having some trouble.",
8090
8135
  descriptionText: descriptionText,
@@ -8158,7 +8203,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8158
8203
  alt: "",
8159
8204
  className: classNames.image
8160
8205
  }));
8161
- }))), images.length < requiredImageCount && ( /*#__PURE__*/React__namespace.default.createElement(Instruction, {
8206
+ }))), images.length < minImageCount && ( /*#__PURE__*/React__namespace.default.createElement(Instruction, {
8162
8207
  className: classNames.instruction
8163
8208
  }, instructionText)), /*#__PURE__*/React__namespace.default.createElement("input", {
8164
8209
  ref: fileInput,
@@ -8169,7 +8214,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8169
8214
  hidden: true
8170
8215
  }), /*#__PURE__*/React__namespace.default.createElement(StyledButtonsRow$8, {
8171
8216
  className: classNames.buttonsRow
8172
- }, images.length < allowedImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8217
+ }, images.length < maxImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8173
8218
  variant: images.length > 0 ? 'secondary' : 'positive',
8174
8219
  className: images.length > 0 ? classNames.captureMoreBtn : classNames.captureBtn,
8175
8220
  colors: images.length > 0 ? colors.captureMoreBtn : colors.captureBtn,
@@ -8182,7 +8227,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8182
8227
  setDocumentToCapture(instructionText);
8183
8228
  }
8184
8229
  }
8185
- }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= requiredImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8230
+ }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= minImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8186
8231
  variant: "positive",
8187
8232
  className: classNames.doneBtn,
8188
8233
  colors: colors.doneBtn,
@@ -8229,87 +8274,94 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8229
8274
  precapturedDocuments = _a.precapturedDocuments,
8230
8275
  _j = _a.captureRequirement,
8231
8276
  captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
8232
- _k = _a.separateIdCardCaptureSequence,
8233
- separateIdCardCaptureSequence = _k === void 0 ? false : _k,
8234
- _l = _a.thresholds,
8235
- thresholds = _l === void 0 ? defaultIdCaptureThresholds : _l,
8236
- _m = _a.skipSuccessScreen,
8237
- skipSuccessScreen = _m === void 0 ? false : _m,
8277
+ _k = _a.allowSinglePageIdCapture,
8278
+ allowSinglePageIdCapture = _k === void 0 ? false : _k,
8279
+ _l = _a.separateIdCardCaptureSequence,
8280
+ separateIdCardCaptureSequence = _l === void 0 ? false : _l,
8281
+ _m = _a.thresholds,
8282
+ thresholds = _m === void 0 ? defaultIdCaptureThresholds : _m,
8283
+ _o = _a.skipSuccessScreen,
8284
+ skipSuccessScreen = _o === void 0 ? false : _o,
8238
8285
  instructions = _a.instructions,
8239
- _o = _a.releaseCameraAccessOnExit,
8240
- releaseCameraAccessOnExit = _o === void 0 ? true : _o,
8241
- _p = _a.guideType,
8242
- guideType = _p === void 0 ? 'fit' : _p,
8243
- _q = _a.portraitGuidesOnMobile,
8244
- portraitGuidesOnMobile = _q === void 0 ? true : _q,
8245
- _r = _a.rotateLoadingOverlayImageWhenPortrait,
8246
- rotateLoadingOverlayImageWhenPortrait = _r === void 0 ? true : _r,
8247
- _s = _a.silentFallback,
8248
- silentFallback = _s === void 0 ? false : _s,
8249
- _t = _a.forceFallbackMode,
8250
- forceFallbackMode = _t === void 0 ? false : _t,
8251
- _u = _a.allowIdCardBackToFrontCapture,
8252
- allowIdCardBackToFrontCapture = _u === void 0 ? false : _u,
8253
- _v = _a.enableOverrideWrongDocumentTypeDialog,
8254
- enableOverrideWrongDocumentTypeDialog = _v === void 0 ? false : _v,
8255
- _w = _a.allowOverrideWrongDocumentTypeAfterMs,
8256
- allowOverrideWrongDocumentTypeAfterMs = _w === void 0 ? 8000 : _w,
8257
- _x = _a.guideImages,
8258
- guideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
8259
- _y = _a.assets,
8260
- assets = _y === void 0 ? {} : _y,
8261
- _z = _a.classNames,
8262
- classNames = _z === void 0 ? {} : _z,
8263
- _0 = _a.colors,
8264
- colors = _0 === void 0 ? {} : _0,
8265
- _1 = _a.verbiage,
8266
- verbiage = _1 === void 0 ? {} : _1,
8267
- _2 = _a.debugMode,
8268
- debugMode = _2 === void 0 ? false : _2;
8269
- var _3 = useIdCaptureState(),
8270
- state = _3[0],
8271
- dispatch = _3[1];
8272
- var _4 = useCameraStore(),
8273
- cameraAccessDenied = _4.cameraAccessDenied,
8274
- requestCameraAccess = _4.requestCameraAccess,
8275
- releaseCameraAccess = _4.releaseCameraAccess;
8276
- var _5 = React.useState(false),
8277
- overlayDismissed = _5[0],
8278
- setOverlayDismissed = _5[1];
8279
- var _6 = React.useContext(SubmissionContext),
8280
- submissionStatus = _6.submissionStatus,
8281
- setIdFrontImage = _6.setIdFrontImage,
8282
- setIdBackImage = _6.setIdBackImage,
8283
- setPassportImage = _6.setPassportImage,
8284
- logIdFrontCaptureAttempt = _6.logIdFrontCaptureAttempt,
8285
- logIdBackCaptureAttempt = _6.logIdBackCaptureAttempt;
8286
- var _7 = React.useContext(IdCaptureModelsContext),
8287
- start = _7.start,
8288
- stop = _7.stop,
8289
- onPredictionMade = _7.onPredictionMade,
8290
- setRequiredDocumentType = _7.setRequiredDocumentType,
8291
- modelError = _7.modelError,
8292
- resetBestFrame = _7.resetBestFrame;
8286
+ _p = _a.releaseCameraAccessOnExit,
8287
+ releaseCameraAccessOnExit = _p === void 0 ? true : _p,
8288
+ _q = _a.guideType,
8289
+ guideType = _q === void 0 ? 'fit' : _q,
8290
+ _r = _a.portraitGuidesOnMobile,
8291
+ portraitGuidesOnMobile = _r === void 0 ? true : _r,
8292
+ _s = _a.rotateLoadingOverlayImageWhenPortrait,
8293
+ rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
8294
+ _t = _a.silentFallback,
8295
+ silentFallback = _t === void 0 ? false : _t,
8296
+ _u = _a.forceFallbackMode,
8297
+ forceFallbackMode = _u === void 0 ? false : _u,
8298
+ _v = _a.allowIdCardBackToFrontCapture,
8299
+ allowIdCardBackToFrontCapture = _v === void 0 ? false : _v,
8300
+ _w = _a.enableOverrideWrongDocumentTypeDialog,
8301
+ enableOverrideWrongDocumentTypeDialog = _w === void 0 ? false : _w,
8302
+ _x = _a.allowOverrideWrongDocumentTypeAfterMs,
8303
+ allowOverrideWrongDocumentTypeAfterMs = _x === void 0 ? 8000 : _x,
8304
+ _y = _a.guideImages,
8305
+ guideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
8306
+ _z = _a.assets,
8307
+ assets = _z === void 0 ? {} : _z,
8308
+ _0 = _a.classNames,
8309
+ classNames = _0 === void 0 ? {} : _0,
8310
+ _1 = _a.colors,
8311
+ colors = _1 === void 0 ? {} : _1,
8312
+ _2 = _a.verbiage,
8313
+ verbiage = _2 === void 0 ? {} : _2,
8314
+ _3 = _a.debugMode,
8315
+ debugMode = _3 === void 0 ? false : _3;
8316
+ var _4 = useIdCaptureState(),
8317
+ state = _4[0],
8318
+ dispatch = _4[1];
8319
+ var _5 = useCameraStore(),
8320
+ cameraAccessDenied = _5.cameraAccessDenied,
8321
+ requestCameraAccess = _5.requestCameraAccess,
8322
+ releaseCameraAccess = _5.releaseCameraAccess;
8323
+ var _6 = React.useState(false),
8324
+ overlayDismissed = _6[0],
8325
+ setOverlayDismissed = _6[1];
8326
+ var _7 = React.useContext(SubmissionContext),
8327
+ submissionStatus = _7.submissionStatus,
8328
+ setIdFrontImage = _7.setIdFrontImage,
8329
+ setIdBackImage = _7.setIdBackImage,
8330
+ setPassportImage = _7.setPassportImage,
8331
+ logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
8332
+ logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
8333
+ var _8 = React.useContext(IdCaptureModelsContext),
8334
+ start = _8.start,
8335
+ stop = _8.stop,
8336
+ onPredictionMade = _8.onPredictionMade,
8337
+ setRequiredDocumentType = _8.setRequiredDocumentType,
8338
+ modelError = _8.modelError,
8339
+ resetBestFrame = _8.resetBestFrame;
8293
8340
  React.useEffect(function () {
8294
8341
  dispatch({
8295
8342
  type: 'configureWizard',
8296
8343
  payload: {
8297
8344
  captureRequirement: captureRequirement,
8298
8345
  precapturedDocuments: precapturedDocuments,
8346
+ allowSinglePageIdCapture: allowSinglePageIdCapture,
8299
8347
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
8300
8348
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
8301
8349
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
8302
8350
  }
8303
8351
  });
8304
- }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8352
+ }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8305
8353
  var documentCount = Object.keys(state.capturedDocuments).length;
8306
8354
  React.useEffect(function () {
8307
- documentCount && resetBestFrame();
8355
+ if (documentCount) resetBestFrame();
8308
8356
  }, [documentCount, resetBestFrame]);
8309
8357
  var logCaptureMetadata = React.useCallback(function (metadata) {
8310
8358
  var _a;
8311
8359
  metadata.operationTime = new Date().getTime() - ((_a = state.operationStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
8312
- state.requestedDocumentType === 'idCardBack' ? logIdBackCaptureAttempt(metadata) : logIdFrontCaptureAttempt(metadata);
8360
+ if (state.requestedDocumentType === 'idCardBack') {
8361
+ logIdBackCaptureAttempt(metadata);
8362
+ } else {
8363
+ logIdFrontCaptureAttempt(metadata);
8364
+ }
8313
8365
  }, [logIdBackCaptureAttempt, logIdFrontCaptureAttempt, state.operationStartedAt, state.requestedDocumentType]);
8314
8366
  React.useEffect(function startModelsWhenCapturing() {
8315
8367
  if (!overlayDismissed || state.captureState !== 'capturing') return;
@@ -8359,14 +8411,17 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8359
8411
  var _a = state.capturedDocuments,
8360
8412
  idCardFront = _a.idCardFront,
8361
8413
  idCardBack = _a.idCardBack,
8362
- passport = _a.passport;
8414
+ passport = _a.passport,
8415
+ singlePage = _a.singlePage;
8363
8416
  var idFrontImage = idCardFront && dataUrlToBase64Sync(idCardFront.imageData);
8364
8417
  var idBackImage = idCardBack && dataUrlToBase64Sync(idCardBack.imageData);
8365
8418
  var passportImage = passport && dataUrlToBase64Sync(passport.imageData);
8366
- idFrontImage && setIdFrontImage(idFrontImage);
8367
- idBackImage && setIdBackImage(idBackImage);
8368
- passportImage && setPassportImage(passportImage);
8369
- releaseCameraAccessOnExit && releaseCameraAccess();
8419
+ var singlePageImage = singlePage && dataUrlToBase64Sync(singlePage.imageData);
8420
+ if (idFrontImage) setIdFrontImage(idFrontImage);
8421
+ if (idBackImage) setIdBackImage(idBackImage);
8422
+ if (passportImage) setPassportImage(passportImage);
8423
+ if (singlePageImage) setIdFrontImage(singlePageImage);
8424
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
8370
8425
  setTimeout(function () {
8371
8426
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
8372
8427
  idFrontImage: idFrontImage,
@@ -8381,9 +8436,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8381
8436
  type: 'resetWizard'
8382
8437
  });
8383
8438
  }, [dispatch]);
8384
- var _8 = React.useState(0),
8385
- attempt = _8[0],
8386
- setAttempt = _8[1];
8439
+ var _9 = React.useState(0),
8440
+ attempt = _9[0],
8441
+ setAttempt = _9[1];
8387
8442
  var onExit = React.useCallback(function () {
8388
8443
  releaseCameraAccess();
8389
8444
  setOverlayDismissed(false);
@@ -8398,7 +8453,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8398
8453
  }, [dispatch, onExitCapture, releaseCameraAccess, requestCameraAccess]);
8399
8454
  React.useEffect(function () {
8400
8455
  if (submissionStatus !== SubmissionStatus.READY) {
8401
- releaseCameraAccessOnExit && releaseCameraAccess();
8456
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
8402
8457
  }
8403
8458
  }, [releaseCameraAccess, releaseCameraAccessOnExit, submissionStatus]);
8404
8459
  React.useEffect(function () {
@@ -8474,9 +8529,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8474
8529
  });
8475
8530
  });
8476
8531
  }, [dispatch]);
8477
- var _9 = React.useState(false),
8478
- progressStarted = _9[0],
8479
- setProgressStarted = _9[1];
8532
+ var _10 = React.useState(false),
8533
+ progressStarted = _10[0],
8534
+ setProgressStarted = _10[1];
8480
8535
  React.useEffect(function () {
8481
8536
  if (state.captureState === 'capturing') {
8482
8537
  setProgressStarted(false);
@@ -9579,19 +9634,25 @@ var SelfieCapture = function SelfieCapture(_a) {
9579
9634
  canvasRef = _v.canvasRef,
9580
9635
  guidanceError = _v.error;
9581
9636
  onPredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (prediction) {
9582
- return new Promise(function (resolve) {
9583
- if (shouldCapture && !busy) {
9584
- drawToCanvas(lastPredictionCanvas.current, canvasRef.current);
9585
- dispatch({
9586
- type: 'facesDetected',
9587
- payload: prediction
9588
- });
9589
- }
9590
- resolve();
9637
+ return __awaiter(void 0, void 0, void 0, function () {
9638
+ return __generator(this, function (_a) {
9639
+ if (shouldCapture && !busy) {
9640
+ drawToCanvas(lastPredictionCanvas.current, canvasRef.current);
9641
+ dispatch({
9642
+ type: 'facesDetected',
9643
+ payload: prediction
9644
+ });
9645
+ }
9646
+ return [2 /*return*/];
9647
+ });
9591
9648
  });
9592
9649
  }, [canvasRef, shouldCapture, busy]), 16));
9593
9650
  React.useEffect(function () {
9594
- (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();
9651
+ if (prediction === null || prediction === void 0 ? void 0 : prediction.faceReady) {
9652
+ onGuidanceSatisfied === null || onGuidanceSatisfied === void 0 ? void 0 : onGuidanceSatisfied();
9653
+ } else {
9654
+ onGuidanceNotSatisfied === null || onGuidanceNotSatisfied === void 0 ? void 0 : onGuidanceNotSatisfied();
9655
+ }
9595
9656
  }, [onGuidanceNotSatisfied, onGuidanceSatisfied, prediction === null || prediction === void 0 ? void 0 : prediction.faceReady]);
9596
9657
  React.useEffect(function () {
9597
9658
  if (!(prediction === null || prediction === void 0 ? void 0 : prediction.faceReady)) return;
@@ -10589,7 +10650,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
10589
10650
  }, [logCaptureMetadata, releaseCameraAccess, requestCameraAccess]);
10590
10651
  var onDoneCallback = React.useCallback(function () {
10591
10652
  logCaptureMetadata();
10592
- releaseCameraAccessOnExit && releaseCameraAccess();
10653
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
10593
10654
  setTimeout(function () {
10594
10655
  onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse, livenessCheckRequest);
10595
10656
  }, 0);
@@ -10608,7 +10669,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
10608
10669
  onLoadingOverlayDismissed === null || onLoadingOverlayDismissed === void 0 ? void 0 : onLoadingOverlayDismissed();
10609
10670
  }, [onLoadingOverlayDismissed]);
10610
10671
  var onFailureExitClick = React.useCallback(function () {
10611
- releaseCameraAccessOnExit && releaseCameraAccess();
10672
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
10612
10673
  setTimeout(function () {
10613
10674
  onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure(submissionResponse, livenessCheckRequest);
10614
10675
  }, 0);
@@ -10962,16 +11023,15 @@ var SignatureButtonsContainer = styled__default.default(ButtonsRow)(templateObje
10962
11023
  var templateObject_1$b, templateObject_2$9, templateObject_3$9, templateObject_4$4;
10963
11024
 
10964
11025
  var SignatureCapture = function SignatureCapture(_a) {
10965
- var _b;
10966
11026
  var onAccept = _a.onAccept,
10967
- _c = _a.classNames,
10968
- classNames = _c === void 0 ? {} : _c,
10969
- _d = _a.verbiage,
10970
- rawVerbiage = _d === void 0 ? {} : _d;
10971
- var _e = useResizeObserver__default.default(),
10972
- ref = _e.ref,
10973
- width = _e.width,
10974
- height = _e.height;
11027
+ _b = _a.classNames,
11028
+ classNames = _b === void 0 ? {} : _b,
11029
+ _c = _a.verbiage,
11030
+ rawVerbiage = _c === void 0 ? {} : _c;
11031
+ var _d = useResizeObserver__default.default(),
11032
+ ref = _d.ref,
11033
+ width = _d.width,
11034
+ height = _d.height;
10975
11035
  var signaturePad = React.useRef(null);
10976
11036
  var verbiage = useTranslations(rawVerbiage, {
10977
11037
  headingText: 'Please sign the box below',
@@ -11021,8 +11081,11 @@ var SignatureCapture = function SignatureCapture(_a) {
11021
11081
  }, /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
11022
11082
  variant: "secondary",
11023
11083
  className: classNames.clearBtn,
11024
- onClick: (_b = signaturePad.current) === null || _b === void 0 ? void 0 : _b.clear,
11025
- finished: true
11084
+ finished: true,
11085
+ onClick: function onClick() {
11086
+ var _a;
11087
+ (_a = signaturePad.current) === null || _a === void 0 ? void 0 : _a.clear();
11088
+ }
11026
11089
  }, verbiage.clearBtnText), /*#__PURE__*/React__namespace.default.createElement(AcceptBtn$1, {
11027
11090
  variant: "positive",
11028
11091
  className: classNames.acceptBtn,
@@ -12000,7 +12063,8 @@ var defaultVideoIdCaptureThresholds = {
12000
12063
  detection: {
12001
12064
  idCardFront: 0.4,
12002
12065
  idCardBack: 0.5,
12003
- passport: 0.3
12066
+ passport: 0.3,
12067
+ singlePage: 0.3
12004
12068
  },
12005
12069
  focus: {
12006
12070
  idCardFront: {
@@ -12014,12 +12078,17 @@ var defaultVideoIdCaptureThresholds = {
12014
12078
  passport: {
12015
12079
  desktop: 0,
12016
12080
  mobile: 0
12081
+ },
12082
+ singlePage: {
12083
+ desktop: 0,
12084
+ mobile: 0
12017
12085
  }
12018
12086
  },
12019
12087
  goodFrames: {
12020
12088
  idCardFront: 1,
12021
12089
  idCardBack: 1,
12022
- passport: 1
12090
+ passport: 1,
12091
+ singlePage: 1
12023
12092
  },
12024
12093
  flipShortcutThreshold: 0.7
12025
12094
  };
@@ -12091,6 +12160,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12091
12160
  stopIdModels = _18.stop,
12092
12161
  onIdPredictionMade = _18.onPredictionMade,
12093
12162
  setThresholds = _18.setThresholds,
12163
+ setRequiredDocumentType = _18.setRequiredDocumentType,
12094
12164
  setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
12095
12165
  bestFrameDetails = _18.bestFrameDetails,
12096
12166
  resetBestFrame = _18.resetBestFrame,
@@ -12169,6 +12239,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12169
12239
  React.useEffect(function () {
12170
12240
  setThresholds(adjustedThresholds);
12171
12241
  }, [requestedAction, setThresholds, adjustedThresholds]);
12242
+ React.useEffect(function () {
12243
+ setRequiredDocumentType(requestedAction === 'SHOW_PASSPORT' ? 'passport' : requestedAction === 'SHOW_ID_BACK' ? 'idCardBack' : 'idCardFront');
12244
+ }, [requestedAction, setRequiredDocumentType]);
12172
12245
  React.useEffect(function () {
12173
12246
  setDocumentDetectionBoundaries({
12174
12247
  top: 20,
@@ -12191,6 +12264,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12191
12264
  setGoodFramesCount = _28[1];
12192
12265
  var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
12193
12266
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
12267
+ var _29 = React.useState(false),
12268
+ isSinglePage = _29[0],
12269
+ setIsSinglePage = _29[1];
12194
12270
  React.useEffect(function () {
12195
12271
  if (!idCaptureModelsEnabled || idModelError) return;
12196
12272
  onIdPredictionMade(function (prediction) {
@@ -12198,7 +12274,8 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12198
12274
  setCurrentDetectionScore(prediction.detectionScore);
12199
12275
  setCurrentDetectedDocumentType(prediction.detectedDocumentType);
12200
12276
  setCurrentFocusScore(prediction.focusScore);
12201
- var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
12277
+ setIsSinglePage(prediction.singlePageDetectionThresholdMet);
12278
+ var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_BACK' ? prediction.idCardBackDetectionThresholdMet : prediction.idCardFrontDetectionThresholdMet || prediction.singlePageDetectionThresholdMet;
12202
12279
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
12203
12280
  var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
12204
12281
  if (shouldShortcutFlipAnimation) {
@@ -12209,9 +12286,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12209
12286
  } : 0);
12210
12287
  });
12211
12288
  }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
12212
- var _29 = React.useState(null),
12213
- idFrontCaptureStartedAt = _29[0],
12214
- setFirstGoodFrameTime = _29[1];
12289
+ var _30 = React.useState(null),
12290
+ idFrontCaptureStartedAt = _30[0],
12291
+ setFirstGoodFrameTime = _30[1];
12215
12292
  React.useEffect(function () {
12216
12293
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
12217
12294
  }, [goodFramesCount]);
@@ -12232,80 +12309,60 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12232
12309
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
12233
12310
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
12234
12311
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
12235
- var _30 = React.useState(),
12236
- countdownStartedAt = _30[0],
12237
- setCountdownStartedAt = _30[1];
12312
+ var _31 = React.useState(),
12313
+ countdownStartedAt = _31[0],
12314
+ setCountdownStartedAt = _31[1];
12238
12315
  var photoCanvas = React.useRef(null);
12239
12316
  var frameLock = React.useRef(false);
12240
12317
  var captureFrame = React.useCallback(function () {
12241
12318
  return __awaiter(void 0, void 0, void 0, function () {
12242
- var frameBase64, _a;
12243
- return __generator(this, function (_b) {
12244
- switch (_b.label) {
12245
- case 0:
12246
- if (frameLock.current) return [2 /*return*/];
12247
- frameLock.current = true;
12248
- drawToCanvas(photoCanvas.current, videoRef.current);
12249
- frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
12250
- if (!frameBase64) {
12251
- frameLock.current = false;
12252
- return [2 /*return*/];
12253
- }
12254
- _b.label = 1;
12255
- case 1:
12256
- _b.trys.push([1,, 7, 8]);
12257
- if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
12319
+ var frameBase64;
12320
+ return __generator(this, function (_a) {
12321
+ if (frameLock.current) return [2 /*return*/];
12322
+ frameLock.current = true;
12323
+ drawToCanvas(photoCanvas.current, videoRef.current);
12324
+ frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
12325
+ if (!frameBase64) {
12326
+ frameLock.current = false;
12327
+ return [2 /*return*/];
12328
+ }
12329
+ try {
12330
+ if (requestedAction == 'SHOW_ID_FRONT') {
12258
12331
  if (onIdFrontImageCaptured) {
12259
12332
  onIdFrontImageCaptured(frameBase64);
12260
12333
  }
12261
- if (!skipShowIdCardBack) return [3 /*break*/, 4];
12262
- _a = skipShowIdCardBack === true;
12263
- if (_a) return [3 /*break*/, 3];
12264
- return [4 /*yield*/, skipShowIdCardBack()];
12265
- case 2:
12266
- _a = _b.sent();
12267
- _b.label = 3;
12268
- case 3:
12269
- if (_a) {
12334
+ if (isSinglePage || evaluateShouldSkip(skipShowIdCardBack)) {
12270
12335
  return [2 /*return*/, onIdCaptureComplete()];
12271
12336
  }
12272
- _b.label = 4;
12273
- case 4:
12274
12337
  setRequestedAction('FLIP_ID');
12275
- return [3 /*break*/, 6];
12276
- case 5:
12277
- if (requestedAction == 'SHOW_ID_BACK') {
12278
- if (onIdBackImageCaptured) {
12279
- onIdBackImageCaptured(frameBase64);
12280
- }
12281
- onIdCaptureComplete();
12282
- } else if (requestedAction == 'SHOW_PASSPORT') {
12283
- if (onIdFrontImageCaptured) {
12284
- onIdFrontImageCaptured(frameBase64);
12285
- }
12286
- onIdCaptureComplete();
12338
+ } else if (requestedAction == 'SHOW_ID_BACK') {
12339
+ if (onIdBackImageCaptured) {
12340
+ onIdBackImageCaptured(frameBase64);
12287
12341
  }
12288
- _b.label = 6;
12289
- case 6:
12290
- return [3 /*break*/, 8];
12291
- case 7:
12292
- setDetectedObjects([]);
12293
- setCurrentDetectionScore(0);
12294
- setCurrentFocusScore(0);
12295
- setGoodFramesCount(0);
12296
- setCountdownStartedAt(undefined);
12297
- resetBestFrame();
12298
- frameLock.current = false;
12299
- if (countdownTimeoutRef.current) {
12300
- clearTimeout(countdownTimeoutRef.current);
12342
+ onIdCaptureComplete();
12343
+ } else if (requestedAction == 'SHOW_PASSPORT') {
12344
+ if (onIdFrontImageCaptured) {
12345
+ onIdFrontImageCaptured(frameBase64);
12301
12346
  }
12302
- return [7 /*endfinally*/];
12303
- case 8:
12304
- return [2 /*return*/];
12347
+ onIdCaptureComplete();
12348
+ }
12349
+ } finally {
12350
+ setDetectedObjects([]);
12351
+ setCurrentDetectionScore(0);
12352
+ setCurrentFocusScore(0);
12353
+ setGoodFramesCount(0);
12354
+ setCountdownStartedAt(undefined);
12355
+ setIsSinglePage(false);
12356
+ resetBestFrame();
12357
+ frameLock.current = false;
12358
+ if (countdownTimeoutRef.current) {
12359
+ clearTimeout(countdownTimeoutRef.current);
12360
+ }
12305
12361
  }
12362
+ return [2 /*return*/];
12306
12363
  });
12307
12364
  });
12308
- }, [onIdCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
12365
+ }, [videoRef, requestedAction, onIdFrontImageCaptured, isSinglePage, skipShowIdCardBack, onIdCaptureComplete, onIdBackImageCaptured, resetBestFrame]);
12309
12366
  var isFlipping = requestedAction === 'FLIP_ID';
12310
12367
  React.useEffect(function () {
12311
12368
  if (!isFlipping) return;
@@ -12364,9 +12421,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12364
12421
  stopSelfieGuidance();
12365
12422
  };
12366
12423
  }, [startSelfieGuidance, stopSelfieGuidance]);
12367
- var _31 = React.useState(0),
12368
- numFramesWithoutFaces = _31[0],
12369
- setNumFramesWithoutFaces = _31[1];
12424
+ var _32 = React.useState(0),
12425
+ numFramesWithoutFaces = _32[0],
12426
+ setNumFramesWithoutFaces = _32[1];
12370
12427
  onSelfiePredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (_a) {
12371
12428
  var face = _a.face;
12372
12429
  if (selfieModelError) return;
@@ -12382,12 +12439,12 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12382
12439
  }
12383
12440
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
12384
12441
  var theme = styled.useTheme();
12385
- var _32 = useTranslations(rawVerbiage, {
12442
+ var _33 = useTranslations(rawVerbiage, {
12386
12443
  faceNotCenteredText: 'Please move your face to the center...',
12387
12444
  captureBtnText: 'Capture'
12388
12445
  }),
12389
- captureBtnText = _32.captureBtnText,
12390
- faceNotCenteredText = _32.faceNotCenteredText;
12446
+ captureBtnText = _33.captureBtnText,
12447
+ faceNotCenteredText = _33.faceNotCenteredText;
12391
12448
  var debugScalingDetails = useDebugScalingDetails({
12392
12449
  enabled: debugMode,
12393
12450
  pageWidth: width,
@@ -12462,6 +12519,11 @@ var CountdownContainer = styled__default.default.div(templateObject_1$5 || (temp
12462
12519
  var Countdown = styled__default.default.div(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"], ["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"])));
12463
12520
  var CaptureButtonContainer = styled__default.default.div(templateObject_3$5 || (templateObject_3$5 = __makeTemplateObject(["\n position: fixed;\n bottom: 0;\n width: 100dvw;\n display: flex;\n z-index: 100000;\n"], ["\n position: fixed;\n bottom: 0;\n width: 100dvw;\n display: flex;\n z-index: 100000;\n"])));
12464
12521
  var CaptureButton = styled__default.default(LoaderButton)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin: 0 auto 25px;\n"], ["\n margin: 0 auto 25px;\n"])));
12522
+ function evaluateShouldSkip(value) {
12523
+ if (value === true) return true;
12524
+ if (typeof value === 'function') return value();
12525
+ return false;
12526
+ }
12465
12527
  var templateObject_1$5, templateObject_2$5, templateObject_3$5, templateObject_4;
12466
12528
 
12467
12529
  var IdVideoCaptureSuccess = function IdVideoCaptureSuccess(_a) {
@@ -12679,7 +12741,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12679
12741
  return __awaiter(void 0, void 0, void 0, function () {
12680
12742
  return __generator(this, function (_a) {
12681
12743
  setIdCaptureVideoUrl(videoUrl);
12682
- audioUrl && setIdCaptureVideoAudioUrl(audioUrl);
12744
+ if (audioUrl) setIdCaptureVideoAudioUrl(audioUrl);
12683
12745
  setCaptureState('SUCCESS');
12684
12746
  if (skipSuccessScreen) onComplete === null || onComplete === void 0 ? void 0 : onComplete();
12685
12747
  return [2 /*return*/];
@@ -12755,7 +12817,8 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12755
12817
  documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
12756
12818
  focusModelUrl: (_j = (_h = idCaptureProps.assets) === null || _h === void 0 ? void 0 : _h.focusModelUrl) !== null && _j !== void 0 ? _j : '',
12757
12819
  onModelError: onIdCaptureModelError,
12758
- modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs
12820
+ modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
12821
+ allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
12759
12822
  }, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
12760
12823
  autoStart: false,
12761
12824
  onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
@@ -13005,7 +13068,8 @@ function CompositeWizard(_a) {
13005
13068
  documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
13006
13069
  focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
13007
13070
  onModelError: idCaptureProps.onModelError,
13008
- modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs
13071
+ modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
13072
+ allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
13009
13073
  }, /*#__PURE__*/React__namespace.default.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React__namespace.default.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React__namespace.default.createElement(IdCaptureWizard, _assign({}, idCaptureProps, {
13010
13074
  onSuccess: onIdCaptureSuccess
13011
13075
  }))))));
@@ -13272,10 +13336,10 @@ var resolveTheme = function resolveTheme(input) {
13272
13336
  var ThemeProvider = function ThemeProvider(_a) {
13273
13337
  var children = _a.children,
13274
13338
  themeInput = _a.theme;
13275
- var themeRef = React.useRef(themeInput);
13339
+ var themeRef = React.useState(themeInput)[0];
13276
13340
  var theme = React.useMemo(function () {
13277
- return resolveTheme(themeRef.current);
13278
- }, []);
13341
+ return resolveTheme(themeRef);
13342
+ }, [themeRef]);
13279
13343
  var colors = theme.colors;
13280
13344
  React.useEffect(function () {
13281
13345
  for (var name_1 in colors) {
@@ -13327,31 +13391,33 @@ var IdValidation = function IdValidation(_a) {
13327
13391
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
13328
13392
  _d = _a.idCaptureRequirement,
13329
13393
  idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
13330
- _e = _a.separateIdCardCaptureSequence,
13331
- separateIdCardCaptureSequence = _e === void 0 ? false : _e,
13332
- _f = _a.idCaptureThresholds,
13333
- idCaptureThresholds = _f === void 0 ? defaultIdCaptureThresholds : _f,
13334
- _g = _a.skipSuccessScreen,
13335
- skipSuccessScreen = _g === void 0 ? false : _g,
13394
+ _e = _a.allowSinglePageIdCapture,
13395
+ allowSinglePageIdCapture = _e === void 0 ? false : _e,
13396
+ _f = _a.separateIdCardCaptureSequence,
13397
+ separateIdCardCaptureSequence = _f === void 0 ? false : _f,
13398
+ _g = _a.idCaptureThresholds,
13399
+ idCaptureThresholds = _g === void 0 ? defaultIdCaptureThresholds : _g,
13400
+ _h = _a.skipSuccessScreen,
13401
+ skipSuccessScreen = _h === void 0 ? false : _h,
13336
13402
  instructions = _a.instructions,
13337
- _h = _a.guideType,
13338
- guideType = _h === void 0 ? 'fit' : _h,
13339
- _j = _a.guideImages,
13340
- guideImages = _j === void 0 ? defaultIdCaptureGuideImages : _j,
13341
- _k = _a.portraitGuidesOnMobile,
13342
- portraitGuidesOnMobile = _k === void 0 ? true : _k,
13343
- _l = _a.rotateLoadingOverlayImageWhenPortrait,
13344
- rotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
13345
- _m = _a.modelLoadTimeoutMs,
13346
- modelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
13347
- _o = _a.forceFallbackMode,
13348
- forceFallbackMode = _o === void 0 ? false : _o,
13349
- _p = _a.allowIdCardBackToFrontCapture,
13350
- allowIdCardBackToFrontCapture = _p === void 0 ? false : _p,
13351
- _q = _a.enableOverrideWrongDocumentTypeDialog,
13352
- enableOverrideWrongDocumentTypeDialog = _q === void 0 ? false : _q,
13353
- _r = _a.allowOverrideWrongDocumentTypeAfterMs,
13354
- allowOverrideWrongDocumentTypeAfterMs = _r === void 0 ? 8000 : _r,
13403
+ _j = _a.guideType,
13404
+ guideType = _j === void 0 ? 'fit' : _j,
13405
+ _k = _a.guideImages,
13406
+ guideImages = _k === void 0 ? defaultIdCaptureGuideImages : _k,
13407
+ _l = _a.portraitGuidesOnMobile,
13408
+ portraitGuidesOnMobile = _l === void 0 ? true : _l,
13409
+ _m = _a.rotateLoadingOverlayImageWhenPortrait,
13410
+ rotateLoadingOverlayImageWhenPortrait = _m === void 0 ? true : _m,
13411
+ _o = _a.modelLoadTimeoutMs,
13412
+ modelLoadTimeoutMs = _o === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _o,
13413
+ _p = _a.forceFallbackMode,
13414
+ forceFallbackMode = _p === void 0 ? false : _p,
13415
+ _q = _a.allowIdCardBackToFrontCapture,
13416
+ allowIdCardBackToFrontCapture = _q === void 0 ? false : _q,
13417
+ _r = _a.enableOverrideWrongDocumentTypeDialog,
13418
+ enableOverrideWrongDocumentTypeDialog = _r === void 0 ? false : _r,
13419
+ _s = _a.allowOverrideWrongDocumentTypeAfterMs,
13420
+ allowOverrideWrongDocumentTypeAfterMs = _s === void 0 ? 8000 : _s,
13355
13421
  onBeforeSubmit = _a.onBeforeSubmit,
13356
13422
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
13357
13423
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -13365,28 +13431,28 @@ var IdValidation = function IdValidation(_a) {
13365
13431
  onUserCancel = _a.onUserCancel,
13366
13432
  onModelError = _a.onModelError,
13367
13433
  onCameraAccessDenied = _a.onCameraAccessDenied,
13368
- _s = _a.theme,
13369
- theme = _s === void 0 ? 'default' : _s,
13370
- _t = _a.assets,
13371
- assets = _t === void 0 ? {} : _t,
13372
- _u = _a.classNames,
13373
- classNames = _u === void 0 ? {} : _u,
13374
- _v = _a.colors,
13375
- colors = _v === void 0 ? {} : _v,
13376
- _w = _a.verbiage,
13377
- verbiage = _w === void 0 ? {} : _w,
13378
- _x = _a.captureSignature,
13379
- captureSignature = _x === void 0 ? false : _x,
13380
- _y = _a.captureSignatureVideo,
13381
- captureSignatureVideo = _y === void 0 ? false : _y,
13382
- _z = _a.captureAdditionalDocuments,
13383
- captureAdditionalDocuments = _z === void 0 ? [] : _z,
13384
- _0 = _a.geolocationEnabled,
13385
- geolocationEnabled = _0 === void 0 ? true : _0,
13386
- _1 = _a.geolocationRequired,
13387
- geolocationRequired = _1 === void 0 ? false : _1,
13388
- _2 = _a.debugMode,
13389
- debugMode = _2 === void 0 ? false : _2;
13434
+ _t = _a.theme,
13435
+ theme = _t === void 0 ? 'default' : _t,
13436
+ _u = _a.assets,
13437
+ assets = _u === void 0 ? {} : _u,
13438
+ _v = _a.classNames,
13439
+ classNames = _v === void 0 ? {} : _v,
13440
+ _w = _a.colors,
13441
+ colors = _w === void 0 ? {} : _w,
13442
+ _x = _a.verbiage,
13443
+ verbiage = _x === void 0 ? {} : _x,
13444
+ _y = _a.captureSignature,
13445
+ captureSignature = _y === void 0 ? false : _y,
13446
+ _z = _a.captureSignatureVideo,
13447
+ captureSignatureVideo = _z === void 0 ? false : _z,
13448
+ _0 = _a.captureAdditionalDocuments,
13449
+ captureAdditionalDocuments = _0 === void 0 ? [] : _0,
13450
+ _1 = _a.geolocationEnabled,
13451
+ geolocationEnabled = _1 === void 0 ? true : _1,
13452
+ _2 = _a.geolocationRequired,
13453
+ geolocationRequired = _2 === void 0 ? false : _2,
13454
+ _3 = _a.debugMode,
13455
+ debugMode = _3 === void 0 ? false : _3;
13390
13456
  useLanguage(lang);
13391
13457
  useDebugLogging(debugMode);
13392
13458
  var idCaptureProps = React.useMemo(function () {
@@ -13396,6 +13462,7 @@ var IdValidation = function IdValidation(_a) {
13396
13462
  onModelError: onModelError,
13397
13463
  precapturedDocuments: precapturedDocuments,
13398
13464
  captureRequirement: idCaptureRequirement,
13465
+ allowSinglePageIdCapture: allowSinglePageIdCapture,
13399
13466
  separateIdCardCaptureSequence: separateIdCardCaptureSequence,
13400
13467
  thresholds: idCaptureThresholds,
13401
13468
  skipSuccessScreen: skipSuccessScreen,
@@ -13418,7 +13485,7 @@ var IdValidation = function IdValidation(_a) {
13418
13485
  verbiage: verbiage,
13419
13486
  debugMode: debugMode
13420
13487
  };
13421
- }, [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]);
13488
+ }, [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]);
13422
13489
  var additionalDocumentCaptureProps = React.useMemo(function () {
13423
13490
  return {
13424
13491
  documents: captureAdditionalDocuments,
@@ -15774,7 +15841,9 @@ function renderElement(component, targetElement) {
15774
15841
  try {
15775
15842
  root.unmount();
15776
15843
  originalRemove_1();
15777
- } catch (e) {}
15844
+ } catch (e) {
15845
+ debug('failed to unmount', e);
15846
+ }
15778
15847
  };
15779
15848
  }
15780
15849
  return targetElement;