idmission-web-sdk 2.2.65 → 2.2.67

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +1 -3
  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 +1 -2
  14. package/dist/components/id_capture/IdCaptureModelsProvider.d.ts.map +1 -1
  15. package/dist/components/id_capture/IdCaptureRequirementOption.d.ts +5 -7
  16. package/dist/components/id_capture/IdCaptureRequirementOption.d.ts.map +1 -1
  17. package/dist/components/id_capture/IdCaptureStateProvider.d.ts +0 -4
  18. package/dist/components/id_capture/IdCaptureStateProvider.d.ts.map +1 -1
  19. package/dist/components/id_capture/IdCaptureSuccess.d.ts +4 -0
  20. package/dist/components/id_capture/IdCaptureSuccess.d.ts.map +1 -1
  21. package/dist/components/id_capture/IdCaptureWizard.d.ts +1 -2
  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 +0 -2
  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 +2 -6
  35. package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
  36. package/dist/lib/models/Focus.d.ts +0 -4
  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 +507 -494
  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 +507 -494
  44. package/dist/sdk2.esm.js.map +1 -1
  45. package/dist/sdk2.umd.development.js +507 -494
  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 +7 -12
  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.65';
237
+ var webSdkVersion = '2.2.67';
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-20241212_131026.tflite");
2300
+ var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20241018_093000.tflite");
2273
2301
 
2274
2302
  var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
2275
2303
 
@@ -2288,10 +2316,6 @@ var defaultFocusThresholds = {
2288
2316
  passport: {
2289
2317
  desktop: 0,
2290
2318
  mobile: 0.3
2291
- },
2292
- singlePage: {
2293
- desktop: 0,
2294
- mobile: 0.3
2295
2319
  }
2296
2320
  };
2297
2321
  var classifier = null;
@@ -2399,7 +2423,7 @@ function useLoadFocusModel(_a) {
2399
2423
  };
2400
2424
  }, [modelPath, modelLoadTimeoutMs, videoRef, shouldLoadModels]);
2401
2425
  React.useEffect(function handleModelError() {
2402
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2426
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2403
2427
  }, [modelError, onModelError]);
2404
2428
  return {
2405
2429
  ready: ready,
@@ -2545,7 +2569,7 @@ function useLoadFaceDetector(_a) {
2545
2569
  };
2546
2570
  }, [modelLoadTimeoutMs, videoRef]);
2547
2571
  React.useEffect(function handleModelError() {
2548
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2572
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2549
2573
  }, [modelError, onModelError]);
2550
2574
  return {
2551
2575
  ready: ready,
@@ -2917,19 +2941,16 @@ var defaultDocumentDetectionThresholds = {
2917
2941
  idCardFront: 0.6,
2918
2942
  idCardBack: 0.6,
2919
2943
  passport: 0.4,
2920
- singlePage: 0.4,
2921
2944
  stability: {
2922
2945
  idCardFront: 0.85,
2923
2946
  idCardBack: 0.85,
2924
- passport: 0.5,
2925
- singlePage: 0.5
2947
+ passport: 0.5
2926
2948
  }
2927
2949
  };
2928
2950
  var documentTypeDisplayNames = {
2929
2951
  idCardFront: 'ID card front',
2930
2952
  idCardBack: 'ID card back',
2931
2953
  passport: 'Passport',
2932
- singlePage: 'Single page',
2933
2954
  none: 'None'
2934
2955
  };
2935
2956
  var detector = null;
@@ -3044,7 +3065,7 @@ function useLoadDocumentDetector(_a) {
3044
3065
  };
3045
3066
  }, [shouldLoadModels, modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
3046
3067
  React.useEffect(function handleModelError() {
3047
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
3068
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
3048
3069
  }, [modelError, onModelError]);
3049
3070
  return {
3050
3071
  ready: ready,
@@ -3118,7 +3139,7 @@ var defaultDocumentDetectionBoundaries = {
3118
3139
  right: 20
3119
3140
  };
3120
3141
  function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3121
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
3142
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3122
3143
  if (boundaries === void 0) {
3123
3144
  boundaries = defaultDocumentDetectionBoundaries;
3124
3145
  }
@@ -3169,25 +3190,18 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3169
3190
  var bestPassportPage = detectedObjects.find(function (obj) {
3170
3191
  return obj.label === 'Passport page';
3171
3192
  });
3172
- var bestSinglePage = detectedObjects.find(function (obj) {
3173
- return obj.label === 'Single page';
3174
- });
3175
3193
  var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
3176
3194
  var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
3177
3195
  var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
3178
- var singlePageDetectionScore = (_h = bestSinglePage === null || bestSinglePage === void 0 ? void 0 : bestSinglePage.score) !== null && _h !== void 0 ? _h : 0;
3179
- var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_j = thresholds.idCardFront) !== null && _j !== void 0 ? _j : 0);
3180
- var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_k = thresholds.idCardBack) !== null && _k !== void 0 ? _k : 0);
3181
- var passportDetectionThresholdMet = passportDetectionScore >= ((_l = thresholds.passport) !== null && _l !== void 0 ? _l : 0);
3182
- var singlePageDetectionThresholdMet = singlePageDetectionScore >= ((_m = thresholds.singlePage) !== null && _m !== void 0 ? _m : 0);
3183
- var bestDocument = singlePageDetectionThresholdMet ? bestSinglePage : passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
3184
- var detectionThreshold = singlePageDetectionThresholdMet ? thresholds.singlePage : passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
3185
- var detectionScore = (_o = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _o !== void 0 ? _o : 0;
3196
+ var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_h = thresholds.idCardFront) !== null && _h !== void 0 ? _h : 0);
3197
+ var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_j = thresholds.idCardBack) !== null && _j !== void 0 ? _j : 0);
3198
+ var passportDetectionThresholdMet = passportDetectionScore >= ((_k = thresholds.passport) !== null && _k !== void 0 ? _k : 0);
3199
+ var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
3200
+ var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
3201
+ var detectionScore = (_l = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _l !== void 0 ? _l : 0;
3186
3202
  var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
3187
3203
  var detectedDocumentType = 'none';
3188
- if (singlePageDetectionThresholdMet) {
3189
- detectedDocumentType = 'singlePage';
3190
- } else if (passportDetectionThresholdMet) {
3204
+ if (passportDetectionThresholdMet) {
3191
3205
  detectedDocumentType = 'passport';
3192
3206
  } else if (idCardBackDetectionThresholdMet) {
3193
3207
  detectedDocumentType = 'idCardBack';
@@ -3201,12 +3215,12 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3201
3215
  var documentIsStable = false;
3202
3216
  var documentTooClose = false;
3203
3217
  if (bestDocument) {
3204
- var _q = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
3205
- docWidth = _q[0],
3206
- docHeight = _q[1];
3218
+ var _o = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
3219
+ docWidth = _o[0],
3220
+ docHeight = _o[1];
3207
3221
  documentTooClose = docWidth > 0.85 || docHeight > 0.85;
3208
3222
  if (detectionThresholdMet && documentInBounds && !documentTooClose) {
3209
- var thresholdSet = (_p = thresholds.stability) !== null && _p !== void 0 ? _p : defaultDocumentDetectionThresholds.stability;
3223
+ var thresholdSet = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
3210
3224
  var threshold_1 = thresholdSet[detectedDocumentType];
3211
3225
  var framesNeeded = Math.ceil(average(framesNeededSamples));
3212
3226
  trackBox(bestDocument.box, framesNeeded);
@@ -3228,8 +3242,6 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3228
3242
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
3229
3243
  passportDetectionScore: passportDetectionScore,
3230
3244
  passportDetectionThresholdMet: passportDetectionThresholdMet,
3231
- singlePageDetectionScore: singlePageDetectionScore,
3232
- singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
3233
3245
  bestDocument: bestDocument,
3234
3246
  documentInBounds: documentInBounds,
3235
3247
  documentTooClose: documentTooClose,
@@ -3295,8 +3307,8 @@ function useFrameLoop(fn, _a) {
3295
3307
  renderPrediction().then();
3296
3308
  return function () {
3297
3309
  loopId.current += 1;
3298
- frameId.current && cancelAnimationFrame(frameId.current);
3299
- timer && clearTimeout(timer);
3310
+ if (frameId.current) cancelAnimationFrame(frameId.current);
3311
+ if (timer) clearTimeout(timer);
3300
3312
  };
3301
3313
  }, [fn, running, throttleMs]);
3302
3314
  var start = React.useCallback(function () {
@@ -3461,7 +3473,7 @@ var createCameraStore = function createCameraStore(config) {
3461
3473
  },
3462
3474
  requestCameraAccess: function requestCameraAccess() {
3463
3475
  return __awaiter(this, void 0, void 0, function () {
3464
- 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;
3476
+ 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;
3465
3477
  var _b, _c, _d;
3466
3478
  return __generator(this, function (_e) {
3467
3479
  switch (_e.label) {
@@ -3581,13 +3593,13 @@ var createCameraStore = function createCameraStore(config) {
3581
3593
  debug('opened stream with no width and height constraints');
3582
3594
  return [3 /*break*/, 10];
3583
3595
  case 9:
3584
- _e.sent();
3585
- debug('cannot open stream at all');
3596
+ e_2 = _e.sent();
3597
+ debug('cannot open stream at all', e_2);
3586
3598
  return [3 /*break*/, 10];
3587
3599
  case 10:
3588
3600
  if (!stream_1) {
3589
3601
  error('failed to open camera');
3590
- throw new Error('failed to open camera');
3602
+ throw new Error('failed to open camera: ');
3591
3603
  }
3592
3604
  debug('camera access granted with constraints', constraints);
3593
3605
  handleStreamEnded_1 = function handleStreamEnded_1() {
@@ -3668,7 +3680,7 @@ var createCameraStore = function createCameraStore(config) {
3668
3680
  },
3669
3681
  requestMicrophoneAccess: function requestMicrophoneAccess() {
3670
3682
  return __awaiter(this, void 0, void 0, function () {
3671
- var stream_2;
3683
+ var stream_2, e_4;
3672
3684
  return __generator(this, function (_a) {
3673
3685
  switch (_a.label) {
3674
3686
  case 0:
@@ -3707,7 +3719,8 @@ var createCameraStore = function createCameraStore(config) {
3707
3719
  }, 500);
3708
3720
  return [3 /*break*/, 4];
3709
3721
  case 3:
3710
- _a.sent();
3722
+ e_4 = _a.sent();
3723
+ debug('failed to open microphone', e_4);
3711
3724
  set({
3712
3725
  microphoneAccessDenied: true
3713
3726
  });
@@ -4072,9 +4085,7 @@ function evaluateIsMobile(nav) {
4072
4085
  // @ts-ignore
4073
4086
  return navAny.userAgentData && navAny.userAgentData.mobile;
4074
4087
  }
4075
- 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) ||
4076
- // tslint:disable-next-line:max-line-length
4077
- /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));
4088
+ 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));
4078
4089
  }
4079
4090
  return false;
4080
4091
  }
@@ -4123,39 +4134,37 @@ var IdCaptureModelsContext = /*#__PURE__*/React.createContext({
4123
4134
  });
4124
4135
  function IdCaptureModelsProviderInner(_a) {
4125
4136
  var children = _a.children,
4126
- onModelError = _a.onModelError,
4127
- _b = _a.allowSinglePageIdCapture,
4128
- allowSinglePageIdCapture = _b === void 0 ? false : _b;
4129
- var _c = React.useContext(DocumentDetectionModelContext),
4130
- documentDetectionModelReady = _c.documentDetectionModelReady,
4131
- documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
4132
- startDocumentDetection = _c.startDocumentDetection,
4133
- stopDocumentDetection = _c.stopDocumentDetection,
4134
- lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
4135
- clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
4136
- onDocumentDetected = _c.onDocumentDetected,
4137
- detectionTime = _c.detectionTime,
4138
- documentDetectionThresholds = _c.documentDetectionThresholds,
4139
- setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
4140
- documentDetectionBoundaries = _c.documentDetectionBoundaries,
4141
- setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
4142
- documentDetectionModelError = _c.documentDetectionModelError;
4143
- var _d = React.useContext(FocusModelContext),
4144
- focusModelReady = _d.focusModelReady,
4145
- focusModelDownloadProgress = _d.focusModelDownloadProgress,
4146
- makeFocusPrediction = _d.makeFocusPrediction,
4147
- focusThresholds = _d.focusThresholds,
4148
- setFocusThresholds = _d.setFocusThresholds,
4149
- focusPredictionTime = _d.focusPredictionTime,
4150
- focusModelError = _d.focusModelError;
4137
+ onModelError = _a.onModelError;
4138
+ var _b = React.useContext(DocumentDetectionModelContext),
4139
+ documentDetectionModelReady = _b.documentDetectionModelReady,
4140
+ documentDetectionModelDownloadProgress = _b.documentDetectionModelDownloadProgress,
4141
+ startDocumentDetection = _b.startDocumentDetection,
4142
+ stopDocumentDetection = _b.stopDocumentDetection,
4143
+ lastPredictionCanvas = _b.documentDetectionLastPredictionCanvas,
4144
+ clearDocumentDetectionLastPredictionCanvas = _b.clearDocumentDetectionLastPredictionCanvas,
4145
+ onDocumentDetected = _b.onDocumentDetected,
4146
+ detectionTime = _b.detectionTime,
4147
+ documentDetectionThresholds = _b.documentDetectionThresholds,
4148
+ setDocumentDetectionThresholds = _b.setDocumentDetectionThresholds,
4149
+ documentDetectionBoundaries = _b.documentDetectionBoundaries,
4150
+ setDocumentDetectionBoundaries = _b.setDocumentDetectionBoundaries,
4151
+ documentDetectionModelError = _b.documentDetectionModelError;
4152
+ var _c = React.useContext(FocusModelContext),
4153
+ focusModelReady = _c.focusModelReady,
4154
+ focusModelDownloadProgress = _c.focusModelDownloadProgress,
4155
+ makeFocusPrediction = _c.makeFocusPrediction,
4156
+ focusThresholds = _c.focusThresholds,
4157
+ setFocusThresholds = _c.setFocusThresholds,
4158
+ focusPredictionTime = _c.focusPredictionTime,
4159
+ focusModelError = _c.focusModelError;
4151
4160
  var onPredictionHandler = React.useRef();
4152
4161
  var bestFrameDetails = React.useRef(null);
4153
4162
  var bestPredictionCanvas = React.useRef(null);
4154
4163
  var bestFocusScore = React.useRef(0);
4155
4164
  var stopDetection = React.useRef(0);
4156
- var _e = React.useState('none'),
4157
- requiredDocumentType = _e[0],
4158
- setRequiredDocumentType = _e[1];
4165
+ var _d = React.useState('none'),
4166
+ requiredDocumentType = _d[0],
4167
+ setRequiredDocumentType = _d[1];
4159
4168
  var thresholds = React.useMemo(function () {
4160
4169
  return _assign(_assign({}, documentDetectionThresholds), {
4161
4170
  focus: focusThresholds
@@ -4173,42 +4182,34 @@ function IdCaptureModelsProviderInner(_a) {
4173
4182
  var _this = this;
4174
4183
  onDocumentDetected(function (prediction) {
4175
4184
  return __awaiter(_this, void 0, void 0, function () {
4176
- var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4177
- var _a, _b, _c, _d, _e, _f, _g;
4178
- return __generator(this, function (_h) {
4185
+ var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4186
+ var _a, _b, _c, _d, _e, _f;
4187
+ return __generator(this, function (_g) {
4179
4188
  if (!lastPredictionCanvas.current) return [2 /*return*/];
4180
4189
  stopDetectionAtStart = stopDetection.current;
4181
4190
  focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
4182
- isSinglePage = prediction.detectedDocumentType === 'singlePage';
4183
- if (!allowSinglePageIdCapture && isSinglePage) {
4184
- prediction.detectedDocumentType = 'passport';
4185
- prediction.passportDetectionScore = prediction.singlePageDetectionScore;
4186
- prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
4187
- prediction.singlePageDetectionScore = 0;
4188
- prediction.singlePageDetectionThresholdMet = false;
4189
- }
4190
- 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'));
4191
+ isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType));
4191
4192
  if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
4192
- focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
4193
+ focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_b = prediction.bestDocument) === null || _b === void 0 ? void 0 : _b.box);
4193
4194
  if (focusPrediction) {
4194
4195
  focusScore = focusPrediction.score;
4195
4196
  focusPredictionTime = focusPrediction.predictionTime;
4196
4197
  }
4197
- focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
4198
- 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;
4198
+ focusThresholdSet = (_c = thresholds.focus) === null || _c === void 0 ? void 0 : _c[prediction.detectedDocumentType];
4199
+ focusThreshold = (_d = onMobile ? focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.mobile : focusThresholdSet === null || focusThresholdSet === void 0 ? void 0 : focusThresholdSet.desktop) !== null && _d !== void 0 ? _d : 0;
4199
4200
  focusThresholdMet = focusScore >= focusThreshold;
4200
4201
  if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
4201
4202
  bestFocusScore.current = focusScore;
4202
4203
  drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
4203
4204
  bestFrameDetails.current = {
4204
- boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
4205
+ boundingBox: (_e = prediction.bestDocument) === null || _e === void 0 ? void 0 : _e.box,
4205
4206
  documentType: prediction.detectedDocumentType,
4206
4207
  detectionScore: prediction.detectionScore,
4207
4208
  focusScore: focusScore
4208
4209
  };
4209
4210
  }
4210
4211
  }
4211
- (_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
4212
+ (_f = onPredictionHandler.current) === null || _f === void 0 ? void 0 : _f.call(onPredictionHandler, _assign(_assign({}, prediction), {
4212
4213
  focusScore: focusScore,
4213
4214
  focusPredictionTime: focusPredictionTime,
4214
4215
  focusThresholdMet: focusThresholdMet
@@ -4217,10 +4218,10 @@ function IdCaptureModelsProviderInner(_a) {
4217
4218
  });
4218
4219
  });
4219
4220
  });
4220
- }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4221
+ }, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4221
4222
  var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
4222
4223
  React.useEffect(function handleModelErrors() {
4223
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
4224
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
4224
4225
  }, [modelError, onModelError]);
4225
4226
  var onPredictionMade = React.useCallback(function (handler) {
4226
4227
  onPredictionHandler.current = handler;
@@ -4231,9 +4232,9 @@ function IdCaptureModelsProviderInner(_a) {
4231
4232
  canvas: bestPredictionCanvas.current
4232
4233
  });
4233
4234
  }, []);
4234
- var _f = React.useState(0),
4235
- canvasKey = _f[0],
4236
- setCanvasKey = _f[1];
4235
+ var _e = React.useState(0),
4236
+ canvasKey = _e[0],
4237
+ setCanvasKey = _e[1];
4237
4238
  var resetBestFrame = React.useCallback(function () {
4238
4239
  stopDetection.current += 1;
4239
4240
  setCanvasKey(function (n) {
@@ -4244,7 +4245,7 @@ function IdCaptureModelsProviderInner(_a) {
4244
4245
  bestFocusScore.current = 0;
4245
4246
  }, [clearDocumentDetectionLastPredictionCanvas]);
4246
4247
  React.useEffect(function () {
4247
- requiredDocumentType && resetBestFrame();
4248
+ if (requiredDocumentType) resetBestFrame();
4248
4249
  }, [requiredDocumentType, resetBestFrame]);
4249
4250
  var value = React.useMemo(function () {
4250
4251
  return {
@@ -4280,9 +4281,9 @@ function IdCaptureModelsProvider(_a) {
4280
4281
  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)));
4281
4282
  }
4282
4283
 
4283
- var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
4284
+ var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'selfie'];
4284
4285
 
4285
- var acceptedDocumentTypesForIdCaptureRequirementOption = {
4286
+ var requiredDocumentsForOption = {
4286
4287
  idCardFront: ['idCardFront'],
4287
4288
  idCardBack: ['idCardBack'],
4288
4289
  passport: ['passport'],
@@ -4290,35 +4291,13 @@ var acceptedDocumentTypesForIdCaptureRequirementOption = {
4290
4291
  idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
4291
4292
  idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
4292
4293
  };
4293
- function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4294
+ function requiredImageCountForOption(idCaptureRequirement) {
4294
4295
  if (idCaptureRequirement === 'idCardOrPassport') return 1;
4295
- return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
4296
+ return requiredDocumentsForOption[idCaptureRequirement].length;
4296
4297
  }
4297
- function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4298
+ function allowedImageCountForOption(idCaptureRequirement) {
4298
4299
  if (idCaptureRequirement === 'idCardOrPassport') return 2;
4299
- return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
4300
- }
4301
- function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
4302
- var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
4303
- if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
4304
- var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
4305
- console.log({
4306
- capturedDocuments: capturedDocuments,
4307
- captureRequirement: captureRequirement
4308
- });
4309
- if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
4310
- acceptedTypes = acceptedTypes.filter(function (v) {
4311
- return !v.includes('idCard');
4312
- });
4313
- }
4314
- if (isIdCardOrPassport) {
4315
- acceptedTypes = acceptedTypes.filter(function (v) {
4316
- return v !== 'passport';
4317
- });
4318
- }
4319
- return acceptedTypes.filter(function (v) {
4320
- return !(v in capturedDocuments);
4321
- });
4300
+ return requiredImageCountForOption(idCaptureRequirement);
4322
4301
  }
4323
4302
 
4324
4303
  var initialState$4 = {
@@ -4357,8 +4336,6 @@ var initialState$4 = {
4357
4336
  idCardBackDetectionThresholdMet: false,
4358
4337
  passportDetectionScore: 0,
4359
4338
  passportDetectionThresholdMet: false,
4360
- singlePageDetectionScore: 0,
4361
- singlePageDetectionThresholdMet: false,
4362
4339
  focusScore: 0,
4363
4340
  focusThresholdMet: false,
4364
4341
  isGoodFrame: false,
@@ -4374,7 +4351,6 @@ var initialState$4 = {
4374
4351
  capturedDocuments: {},
4375
4352
  captureRequirement: 'idCardOrPassport',
4376
4353
  requestedDocumentType: 'idCardFront',
4377
- allowSinglePageIdCapture: false,
4378
4354
  allowIdCardBackToFrontCapture: false,
4379
4355
  operationStartedAt: null,
4380
4356
  captureStartedAt: null
@@ -4389,13 +4365,11 @@ var _reducer = function reducer(state, action) {
4389
4365
  var _c = action.payload,
4390
4366
  captureRequirement = _c.captureRequirement,
4391
4367
  precapturedDocuments = _c.precapturedDocuments,
4392
- allowSinglePageIdCapture = _c.allowSinglePageIdCapture,
4393
4368
  allowIdCardBackToFrontCapture = _c.allowIdCardBackToFrontCapture,
4394
4369
  enableOverrideWrongDocumentTypeDialog = _c.enableOverrideWrongDocumentTypeDialog,
4395
4370
  allowOverrideWrongDocumentTypeAfterMs = _c.allowOverrideWrongDocumentTypeAfterMs;
4396
4371
  var newState = _assign(_assign({}, state), {
4397
4372
  captureRequirement: captureRequirement,
4398
- allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
4399
4373
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
4400
4374
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
4401
4375
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
@@ -4463,8 +4437,6 @@ var _reducer = function reducer(state, action) {
4463
4437
  idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
4464
4438
  passportDetectionScore = _d.passportDetectionScore,
4465
4439
  passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
4466
- singlePageDetectionScore = _d.singlePageDetectionScore,
4467
- singlePageDetectionThresholdMet = _d.singlePageDetectionThresholdMet,
4468
4440
  bestDocument = _d.bestDocument,
4469
4441
  documentInBounds = _d.documentInBounds,
4470
4442
  documentTooClose = _d.documentTooClose,
@@ -4485,8 +4457,7 @@ var _reducer = function reducer(state, action) {
4485
4457
  }
4486
4458
  }
4487
4459
  }
4488
- var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
4489
- var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
4460
+ var idCardDetectedButNotAllowed = detectedDocumentType.includes('idCard') && !state.captureRequirement.includes('idCard');
4490
4461
  var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
4491
4462
  var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
4492
4463
  var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
@@ -4546,8 +4517,6 @@ var _reducer = function reducer(state, action) {
4546
4517
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
4547
4518
  passportDetectionScore: passportDetectionScore,
4548
4519
  passportDetectionThresholdMet: passportDetectionThresholdMet,
4549
- singlePageDetectionScore: singlePageDetectionScore,
4550
- singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
4551
4520
  focusScore: focusScore,
4552
4521
  focusThresholdMet: focusThresholdMet,
4553
4522
  isGoodFrame: isGoodFrame,
@@ -4585,7 +4554,7 @@ var _reducer = function reducer(state, action) {
4585
4554
  });
4586
4555
  case 'documentCaptured':
4587
4556
  {
4588
- var newState = _assign(_assign({}, state), {
4557
+ var newState_1 = _assign(_assign({}, state), {
4589
4558
  capturing: false,
4590
4559
  captureFailed: false,
4591
4560
  allowOverrideFlipRequirement: false,
@@ -4594,42 +4563,64 @@ var _reducer = function reducer(state, action) {
4594
4563
  wrongDocumentTypePredictions: 0,
4595
4564
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
4596
4565
  });
4597
- var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4566
+ var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
4567
+ return !(v in newState_1.capturedDocuments);
4568
+ });
4569
+ if (state.captureRequirement === 'idCardOrPassport') {
4570
+ if (state.requestedDocumentType === 'passport') {
4571
+ remainingRequirements = [];
4572
+ } else {
4573
+ remainingRequirements = remainingRequirements.filter(function (v) {
4574
+ return v !== 'passport';
4575
+ });
4576
+ }
4577
+ }
4598
4578
  if (remainingRequirements.length === 0) {
4599
- newState.captureState = 'complete';
4579
+ newState_1.captureState = 'complete';
4600
4580
  } else {
4601
- newState.requestedDocumentType = remainingRequirements[0];
4602
- if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
4603
- newState.captureState = 'requestingFlip';
4604
- newState.idCardFrontDetectionThresholdMet = false;
4605
- newState.idCardBackDetectionThresholdMet = false;
4606
- newState.passportDetectionThresholdMet = false;
4607
- newState.wrongDocumentTypePredictions = 0;
4581
+ newState_1.requestedDocumentType = remainingRequirements[0];
4582
+ if (state.requestedDocumentType === 'idCardFront' && newState_1.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_1.requestedDocumentType === 'idCardFront') {
4583
+ newState_1.captureState = 'requestingFlip';
4584
+ newState_1.idCardFrontDetectionThresholdMet = false;
4585
+ newState_1.idCardBackDetectionThresholdMet = false;
4586
+ newState_1.passportDetectionThresholdMet = false;
4587
+ newState_1.wrongDocumentTypePredictions = 0;
4608
4588
  }
4609
4589
  }
4610
- return newState;
4590
+ return newState_1;
4611
4591
  }
4612
4592
  case 'documentCapturedManually':
4613
4593
  {
4614
- var newState = _assign(_assign({}, state), {
4594
+ var newState_2 = _assign(_assign({}, state), {
4615
4595
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_b = {}, _b[state.requestedDocumentType] = _assign(_assign({}, action.payload), {
4616
4596
  width: 0,
4617
4597
  height: 0
4618
4598
  }), _b))
4619
4599
  });
4620
- var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4600
+ var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
4601
+ return !(v in newState_2.capturedDocuments);
4602
+ });
4603
+ if (state.captureRequirement === 'idCardOrPassport') {
4604
+ if (state.requestedDocumentType === 'passport') {
4605
+ remainingRequirements = [];
4606
+ } else {
4607
+ remainingRequirements = remainingRequirements.filter(function (v) {
4608
+ return v !== 'passport';
4609
+ });
4610
+ }
4611
+ }
4621
4612
  if (remainingRequirements.length === 0) {
4622
- newState.captureState = 'complete';
4613
+ newState_2.captureState = 'complete';
4623
4614
  } else {
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;
4615
+ newState_2.requestedDocumentType = remainingRequirements[0];
4616
+ if (state.requestedDocumentType === 'idCardFront' && newState_2.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_2.requestedDocumentType === 'idCardFront') {
4617
+ newState_2.captureState = 'requestingFlip';
4618
+ newState_2.idCardFrontDetectionThresholdMet = false;
4619
+ newState_2.idCardBackDetectionThresholdMet = false;
4620
+ newState_2.passportDetectionThresholdMet = false;
4630
4621
  }
4631
4622
  }
4632
- return newState;
4623
+ return newState_2;
4633
4624
  }
4634
4625
  case 'flipRequestCompleted':
4635
4626
  return _assign(_assign({}, state), {
@@ -5230,7 +5221,7 @@ var IdCapture = function IdCapture(_a) {
5230
5221
  imageUrl: imageUrl
5231
5222
  }
5232
5223
  });
5233
- var capturedDocumentType = documentType;
5224
+ var capturedDocumentType = documentType === 'passport' ? 'passport' : state.requestedDocumentType;
5234
5225
  setTimeout(function () {
5235
5226
  var _a;
5236
5227
  var captureTime = new Date().getTime() - ((_a = state.captureStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
@@ -5297,7 +5288,7 @@ var IdCapture = function IdCapture(_a) {
5297
5288
  scaling: debugScalingDetails,
5298
5289
  flipX: !isRearFacing
5299
5290
  });
5300
- }))), 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")))));
5291
+ }))), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__namespace.default.createElement("br", null), state.frameCaptureRate > 0.75 ? '✅' : '👎', " Frame Rate:", ' ', Math.round((state.frameCaptureRate + Number.EPSILON) * 1000) / 1000, ' ', "fps (", detectionTime, "ms doc detect, ", focusPredictionTime, "ms focus)", /*#__PURE__*/React__namespace.default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__namespace.default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__namespace.default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, "\u274C Models not ready")))));
5301
5292
  };
5302
5293
  var timeSince = function timeSince(t) {
5303
5294
  if (!t) return 0;
@@ -6336,8 +6327,15 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6336
6327
  _e = _a.debugMode,
6337
6328
  debugMode = _e === void 0 ? false : _e;
6338
6329
  var submissionStatus = React.useContext(SubmissionContext).submissionStatus;
6330
+ var idCardFront = capturedDocuments.idCardFront,
6331
+ idCardBack = capturedDocuments.idCardBack,
6332
+ passport = capturedDocuments.passport;
6339
6333
  var verbiage = useTranslations(rawVerbiage, {
6340
6334
  headingText: 'ID Capture Successful',
6335
+ idCardFrontText: 'ID Card Front',
6336
+ idCardBackText: 'ID Card Back',
6337
+ passportText: 'Passport',
6338
+ instructionText: 'Verify the entire ID was captured clearly with no glare.',
6341
6339
  retryText: 'Retry',
6342
6340
  submittingText: 'Submitting...',
6343
6341
  submitText: 'Done'
@@ -6354,16 +6352,25 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6354
6352
  className: classNames.imageContainer
6355
6353
  }, /*#__PURE__*/React__namespace.default.createElement(ImageRow, {
6356
6354
  className: classNames.imageRow
6357
- }, Object.values(capturedDocuments).map(function (doc) {
6358
- return /*#__PURE__*/React__namespace.default.createElement(ImageCol$1, {
6359
- className: classNames.imageCol,
6360
- key: doc.imageData
6361
- }, /*#__PURE__*/React__namespace.default.createElement(StyledImage, {
6362
- image: doc,
6363
- className: classNames.image,
6364
- alt: doc.documentType
6365
- }), 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)))));
6366
- }))), /*#__PURE__*/React__namespace.default.createElement(ButtonsColumn, {
6355
+ }, idCardFront && ( /*#__PURE__*/React__namespace.default.createElement(ImageCol$1, {
6356
+ className: classNames.imageCol
6357
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledImage, {
6358
+ image: idCardFront,
6359
+ className: classNames.image,
6360
+ alt: verbiage.idCardFrontText
6361
+ }), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugPre, null, "Detection Score: ".concat(idCardFront.detectionScore, "\nFocus Score: ").concat(idCardFront.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardFront.boundingBox)))))), idCardBack && ( /*#__PURE__*/React__namespace.default.createElement(ImageCol$1, {
6362
+ className: classNames.imageCol
6363
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledImage, {
6364
+ image: idCardBack,
6365
+ className: classNames.image,
6366
+ alt: verbiage.idCardBackText
6367
+ }), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugPre, null, "Detection Score: ".concat(idCardBack.detectionScore, "\nFocus Score: ").concat(idCardBack.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardBack.boundingBox)))))), passport && ( /*#__PURE__*/React__namespace.default.createElement(ImageCol$1, {
6368
+ className: classNames.imageCol
6369
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledImage, {
6370
+ image: passport,
6371
+ className: classNames.image,
6372
+ alt: verbiage.passportText
6373
+ }), debugMode && ( /*#__PURE__*/React__namespace.default.createElement(DebugPre, null, "Detection Score: ".concat(passport.detectionScore, "\nFocus Score: ").concat(passport.focusScore, "\nBounding Box: ").concat(JSON.stringify(passport.boundingBox)))))))), /*#__PURE__*/React__namespace.default.createElement(ButtonsColumn, {
6367
6374
  className: classNames.buttonsRow
6368
6375
  }, /*#__PURE__*/React__namespace.default.createElement(WideButton, {
6369
6376
  className: classNames.submitBtn,
@@ -6382,7 +6389,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6382
6389
  };
6383
6390
  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"])));
6384
6391
  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"])));
6385
- 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"])));
6392
+ var ImageRow = styled__default.default(OverlayImageRow)(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n //grid-template-columns: 1fr 1fr;\n"], ["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n //grid-template-columns: 1fr 1fr;\n"])));
6386
6393
  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"])));
6387
6394
  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"])));
6388
6395
  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"])));
@@ -6966,7 +6973,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
6966
6973
  });
6967
6974
  }, [setDimensions, wrapperHeight, wrapperWidth]);
6968
6975
  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;
6969
- var paddingAndBorderPx = padding * 2 + borderWidth * 2;
6976
+ var paddingAndBorderPx = padding * 2 + (borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0) * 2;
6970
6977
  var images = useImagesWithBackToFront(userSuppliedImages, isBackToFront);
6971
6978
  var imagesByUrl = useGuideImagesByUrl(images);
6972
6979
  var orientation = getOrientation(portraitGuidesOnMobile);
@@ -7013,7 +7020,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
7013
7020
  "$isMirrored": isMirrored,
7014
7021
  className: classNames.centerRegion
7015
7022
  }, /*#__PURE__*/React__namespace.default.createElement(GuideCenterBorder, {
7016
- "$borderWidth": borderWidth,
7023
+ "$borderWidth": borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0,
7017
7024
  "$borderColor": borderColor,
7018
7025
  "$padding": imagePadding,
7019
7026
  className: classNames.centerRegionBorder
@@ -7213,7 +7220,7 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
7213
7220
  }, [aspectRatio, borderColor, borderRadius, borderWidth, dispatch, maskColor, padding, redrawing, wrapperHeight, wrapperWidth]);
7214
7221
  return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(CanvasWrapper$1, {
7215
7222
  ref: wrapperRef,
7216
- "$maskColor": maskColor,
7223
+ "$maskColor": maskColor !== null && maskColor !== void 0 ? maskColor : '',
7217
7224
  className: classNames.canvasWrapper
7218
7225
  }, /*#__PURE__*/React__namespace.default.createElement(Canvas$1, {
7219
7226
  ref: canvasRef,
@@ -7508,7 +7515,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7508
7515
  var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
7509
7516
  var uploadCapturedDocument = React.useCallback(function (content, filetype) {
7510
7517
  return __awaiter(void 0, void 0, void 0, function () {
7511
- var documentId_1;
7518
+ var documentId_1, e_1;
7512
7519
  return __generator(this, function (_a) {
7513
7520
  switch (_a.label) {
7514
7521
  case 0:
@@ -7531,7 +7538,8 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7531
7538
  }, 0);
7532
7539
  return [3 /*break*/, 3];
7533
7540
  case 2:
7534
- _a.sent();
7541
+ e_1 = _a.sent();
7542
+ debug('upload failed', e_1);
7535
7543
  dispatch({
7536
7544
  type: 'uploadFailed'
7537
7545
  });
@@ -7566,7 +7574,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7566
7574
  resolvedDocuments.forEach(function (d) {
7567
7575
  if (d.content) {
7568
7576
  d.contentUrl || (d.contentUrl = URL.createObjectURL(d.content));
7569
- uploadCapturedDocument(d.content, d.content.type);
7577
+ void uploadCapturedDocument(d.content, d.content.type);
7570
7578
  }
7571
7579
  });
7572
7580
  }, [aspectRatio, cameraFeedMode, documents, instructions, uploadCapturedDocument]);
@@ -7764,6 +7772,7 @@ var CameraVideoTag = function CameraVideoTag(props) {
7764
7772
  React.useEffect(function attachCameraStreamToVideoTagWhenReady() {
7765
7773
  if (videoRef.current && videoStream) {
7766
7774
  debug('attaching camera stream to video tag');
7775
+ // eslint-disable-next-line react-compiler/react-compiler
7767
7776
  videoRef.current.srcObject = videoStream;
7768
7777
  }
7769
7778
  }, [videoStream, videoRef]);
@@ -8090,8 +8099,8 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8090
8099
  var _j = React.useState(silentFallback),
8091
8100
  useFallback = _j[0],
8092
8101
  setUseFallback = _j[1];
8093
- var minImageCount = minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
8094
- var maxImageCount = maxImageCountForIdCaptureRequirementOption(idCaptureRequirement);
8102
+ var allowedImageCount = allowedImageCountForOption(idCaptureRequirement);
8103
+ var requiredImageCount = requiredImageCountForOption(idCaptureRequirement);
8095
8104
  var _k = useFileState(),
8096
8105
  rawFile = _k.rawFile,
8097
8106
  fileInputOnChange = _k.fileInputOnChange;
@@ -8104,7 +8113,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8104
8113
  var whatToCapture = idCaptureRequirement === 'idCard' ? 'ID card' : idCaptureRequirement === 'passport' ? 'passport' : idCaptureRequirement === 'idCardOrPassport' ? 'ID card or passport' : 'ID card and passport';
8105
8114
  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.';
8106
8115
  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.';
8107
- var descriptionText = "On-device capture guidance failed, please capture ".concat(minImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
8116
+ var descriptionText = "On-device capture guidance failed, please capture ".concat(requiredImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
8108
8117
  var verbiage = useTranslations(rawVerbiage, {
8109
8118
  headingText: "We're having some trouble.",
8110
8119
  descriptionText: descriptionText,
@@ -8178,7 +8187,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8178
8187
  alt: "",
8179
8188
  className: classNames.image
8180
8189
  }));
8181
- }))), images.length < minImageCount && ( /*#__PURE__*/React__namespace.default.createElement(Instruction, {
8190
+ }))), images.length < requiredImageCount && ( /*#__PURE__*/React__namespace.default.createElement(Instruction, {
8182
8191
  className: classNames.instruction
8183
8192
  }, instructionText)), /*#__PURE__*/React__namespace.default.createElement("input", {
8184
8193
  ref: fileInput,
@@ -8189,7 +8198,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8189
8198
  hidden: true
8190
8199
  }), /*#__PURE__*/React__namespace.default.createElement(StyledButtonsRow$8, {
8191
8200
  className: classNames.buttonsRow
8192
- }, images.length < maxImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8201
+ }, images.length < allowedImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8193
8202
  variant: images.length > 0 ? 'secondary' : 'positive',
8194
8203
  className: images.length > 0 ? classNames.captureMoreBtn : classNames.captureBtn,
8195
8204
  colors: images.length > 0 ? colors.captureMoreBtn : colors.captureBtn,
@@ -8202,7 +8211,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8202
8211
  setDocumentToCapture(instructionText);
8203
8212
  }
8204
8213
  }
8205
- }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= minImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8214
+ }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= requiredImageCount && ( /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
8206
8215
  variant: "positive",
8207
8216
  className: classNames.doneBtn,
8208
8217
  colors: colors.doneBtn,
@@ -8249,90 +8258,91 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8249
8258
  precapturedDocuments = _a.precapturedDocuments,
8250
8259
  _j = _a.captureRequirement,
8251
8260
  captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
8252
- _k = _a.allowSinglePageIdCapture,
8253
- allowSinglePageIdCapture = _k === void 0 ? false : _k,
8254
- _l = _a.separateIdCardCaptureSequence,
8255
- separateIdCardCaptureSequence = _l === void 0 ? false : _l,
8256
- _m = _a.thresholds,
8257
- thresholds = _m === void 0 ? defaultIdCaptureThresholds : _m,
8258
- _o = _a.skipSuccessScreen,
8259
- skipSuccessScreen = _o === void 0 ? false : _o,
8261
+ _k = _a.separateIdCardCaptureSequence,
8262
+ separateIdCardCaptureSequence = _k === void 0 ? false : _k,
8263
+ _l = _a.thresholds,
8264
+ thresholds = _l === void 0 ? defaultIdCaptureThresholds : _l,
8265
+ _m = _a.skipSuccessScreen,
8266
+ skipSuccessScreen = _m === void 0 ? false : _m,
8260
8267
  instructions = _a.instructions,
8261
- _p = _a.releaseCameraAccessOnExit,
8262
- releaseCameraAccessOnExit = _p === void 0 ? true : _p,
8263
- _q = _a.guideType,
8264
- guideType = _q === void 0 ? 'fit' : _q,
8265
- _r = _a.portraitGuidesOnMobile,
8266
- portraitGuidesOnMobile = _r === void 0 ? true : _r,
8267
- _s = _a.rotateLoadingOverlayImageWhenPortrait,
8268
- rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
8269
- _t = _a.silentFallback,
8270
- silentFallback = _t === void 0 ? false : _t,
8271
- _u = _a.forceFallbackMode,
8272
- forceFallbackMode = _u === void 0 ? false : _u,
8273
- _v = _a.allowIdCardBackToFrontCapture,
8274
- allowIdCardBackToFrontCapture = _v === void 0 ? false : _v,
8275
- _w = _a.enableOverrideWrongDocumentTypeDialog,
8276
- enableOverrideWrongDocumentTypeDialog = _w === void 0 ? false : _w,
8277
- _x = _a.allowOverrideWrongDocumentTypeAfterMs,
8278
- allowOverrideWrongDocumentTypeAfterMs = _x === void 0 ? 8000 : _x,
8279
- _y = _a.guideImages,
8280
- guideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
8281
- _z = _a.assets,
8282
- assets = _z === void 0 ? {} : _z,
8283
- _0 = _a.classNames,
8284
- classNames = _0 === void 0 ? {} : _0,
8285
- _1 = _a.colors,
8286
- colors = _1 === void 0 ? {} : _1,
8287
- _2 = _a.verbiage,
8288
- verbiage = _2 === void 0 ? {} : _2,
8289
- _3 = _a.debugMode,
8290
- debugMode = _3 === void 0 ? false : _3;
8291
- var _4 = useIdCaptureState(),
8292
- state = _4[0],
8293
- dispatch = _4[1];
8294
- var _5 = useCameraStore(),
8295
- cameraAccessDenied = _5.cameraAccessDenied,
8296
- requestCameraAccess = _5.requestCameraAccess,
8297
- releaseCameraAccess = _5.releaseCameraAccess;
8298
- var _6 = React.useState(false),
8299
- overlayDismissed = _6[0],
8300
- setOverlayDismissed = _6[1];
8301
- var _7 = React.useContext(SubmissionContext),
8302
- submissionStatus = _7.submissionStatus,
8303
- setIdFrontImage = _7.setIdFrontImage,
8304
- setIdBackImage = _7.setIdBackImage,
8305
- setPassportImage = _7.setPassportImage,
8306
- logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
8307
- logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
8308
- var _8 = React.useContext(IdCaptureModelsContext),
8309
- start = _8.start,
8310
- stop = _8.stop,
8311
- onPredictionMade = _8.onPredictionMade,
8312
- setRequiredDocumentType = _8.setRequiredDocumentType,
8313
- modelError = _8.modelError,
8314
- resetBestFrame = _8.resetBestFrame;
8268
+ _o = _a.releaseCameraAccessOnExit,
8269
+ releaseCameraAccessOnExit = _o === void 0 ? true : _o,
8270
+ _p = _a.guideType,
8271
+ guideType = _p === void 0 ? 'fit' : _p,
8272
+ _q = _a.portraitGuidesOnMobile,
8273
+ portraitGuidesOnMobile = _q === void 0 ? true : _q,
8274
+ _r = _a.rotateLoadingOverlayImageWhenPortrait,
8275
+ rotateLoadingOverlayImageWhenPortrait = _r === void 0 ? true : _r,
8276
+ _s = _a.silentFallback,
8277
+ silentFallback = _s === void 0 ? false : _s,
8278
+ _t = _a.forceFallbackMode,
8279
+ forceFallbackMode = _t === void 0 ? false : _t,
8280
+ _u = _a.allowIdCardBackToFrontCapture,
8281
+ allowIdCardBackToFrontCapture = _u === void 0 ? false : _u,
8282
+ _v = _a.enableOverrideWrongDocumentTypeDialog,
8283
+ enableOverrideWrongDocumentTypeDialog = _v === void 0 ? false : _v,
8284
+ _w = _a.allowOverrideWrongDocumentTypeAfterMs,
8285
+ allowOverrideWrongDocumentTypeAfterMs = _w === void 0 ? 8000 : _w,
8286
+ _x = _a.guideImages,
8287
+ guideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
8288
+ _y = _a.assets,
8289
+ assets = _y === void 0 ? {} : _y,
8290
+ _z = _a.classNames,
8291
+ classNames = _z === void 0 ? {} : _z,
8292
+ _0 = _a.colors,
8293
+ colors = _0 === void 0 ? {} : _0,
8294
+ _1 = _a.verbiage,
8295
+ verbiage = _1 === void 0 ? {} : _1,
8296
+ _2 = _a.debugMode,
8297
+ debugMode = _2 === void 0 ? false : _2;
8298
+ var _3 = useIdCaptureState(),
8299
+ state = _3[0],
8300
+ dispatch = _3[1];
8301
+ var _4 = useCameraStore(),
8302
+ cameraAccessDenied = _4.cameraAccessDenied,
8303
+ requestCameraAccess = _4.requestCameraAccess,
8304
+ releaseCameraAccess = _4.releaseCameraAccess;
8305
+ var _5 = React.useState(false),
8306
+ overlayDismissed = _5[0],
8307
+ setOverlayDismissed = _5[1];
8308
+ var _6 = React.useContext(SubmissionContext),
8309
+ submissionStatus = _6.submissionStatus,
8310
+ setIdFrontImage = _6.setIdFrontImage,
8311
+ setIdBackImage = _6.setIdBackImage,
8312
+ setPassportImage = _6.setPassportImage,
8313
+ logIdFrontCaptureAttempt = _6.logIdFrontCaptureAttempt,
8314
+ logIdBackCaptureAttempt = _6.logIdBackCaptureAttempt;
8315
+ var _7 = React.useContext(IdCaptureModelsContext),
8316
+ start = _7.start,
8317
+ stop = _7.stop,
8318
+ onPredictionMade = _7.onPredictionMade,
8319
+ setRequiredDocumentType = _7.setRequiredDocumentType,
8320
+ modelError = _7.modelError,
8321
+ resetBestFrame = _7.resetBestFrame;
8315
8322
  React.useEffect(function () {
8316
8323
  dispatch({
8317
8324
  type: 'configureWizard',
8318
8325
  payload: {
8319
8326
  captureRequirement: captureRequirement,
8320
8327
  precapturedDocuments: precapturedDocuments,
8321
- allowSinglePageIdCapture: allowSinglePageIdCapture,
8322
8328
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
8323
8329
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
8324
8330
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
8325
8331
  }
8326
8332
  });
8327
- }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8333
+ }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8328
8334
  var documentCount = Object.keys(state.capturedDocuments).length;
8329
8335
  React.useEffect(function () {
8330
- documentCount && resetBestFrame();
8336
+ if (documentCount) resetBestFrame();
8331
8337
  }, [documentCount, resetBestFrame]);
8332
8338
  var logCaptureMetadata = React.useCallback(function (metadata) {
8333
8339
  var _a;
8334
8340
  metadata.operationTime = new Date().getTime() - ((_a = state.operationStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
8335
- state.requestedDocumentType === 'idCardBack' ? logIdBackCaptureAttempt(metadata) : logIdFrontCaptureAttempt(metadata);
8341
+ if (state.requestedDocumentType === 'idCardBack') {
8342
+ logIdBackCaptureAttempt(metadata);
8343
+ } else {
8344
+ logIdFrontCaptureAttempt(metadata);
8345
+ }
8336
8346
  }, [logIdBackCaptureAttempt, logIdFrontCaptureAttempt, state.operationStartedAt, state.requestedDocumentType]);
8337
8347
  React.useEffect(function startModelsWhenCapturing() {
8338
8348
  if (!overlayDismissed || state.captureState !== 'capturing') return;
@@ -8382,17 +8392,14 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8382
8392
  var _a = state.capturedDocuments,
8383
8393
  idCardFront = _a.idCardFront,
8384
8394
  idCardBack = _a.idCardBack,
8385
- passport = _a.passport,
8386
- singlePage = _a.singlePage;
8395
+ passport = _a.passport;
8387
8396
  var idFrontImage = idCardFront && dataUrlToBase64Sync(idCardFront.imageData);
8388
8397
  var idBackImage = idCardBack && dataUrlToBase64Sync(idCardBack.imageData);
8389
8398
  var passportImage = passport && dataUrlToBase64Sync(passport.imageData);
8390
- var singlePageImage = singlePage && dataUrlToBase64Sync(singlePage.imageData);
8391
- idFrontImage && setIdFrontImage(idFrontImage);
8392
- idBackImage && setIdBackImage(idBackImage);
8393
- passportImage && setPassportImage(passportImage);
8394
- singlePageImage && setIdFrontImage(singlePageImage);
8395
- releaseCameraAccessOnExit && releaseCameraAccess();
8399
+ if (idFrontImage) setIdFrontImage(idFrontImage);
8400
+ if (idBackImage) setIdBackImage(idBackImage);
8401
+ if (passportImage) setPassportImage(passportImage);
8402
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
8396
8403
  setTimeout(function () {
8397
8404
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
8398
8405
  idFrontImage: idFrontImage,
@@ -8407,9 +8414,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8407
8414
  type: 'resetWizard'
8408
8415
  });
8409
8416
  }, [dispatch]);
8410
- var _9 = React.useState(0),
8411
- attempt = _9[0],
8412
- setAttempt = _9[1];
8417
+ var _8 = React.useState(0),
8418
+ attempt = _8[0],
8419
+ setAttempt = _8[1];
8413
8420
  var onExit = React.useCallback(function () {
8414
8421
  releaseCameraAccess();
8415
8422
  setOverlayDismissed(false);
@@ -8424,7 +8431,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8424
8431
  }, [dispatch, onExitCapture, releaseCameraAccess, requestCameraAccess]);
8425
8432
  React.useEffect(function () {
8426
8433
  if (submissionStatus !== SubmissionStatus.READY) {
8427
- releaseCameraAccessOnExit && releaseCameraAccess();
8434
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
8428
8435
  }
8429
8436
  }, [releaseCameraAccess, releaseCameraAccessOnExit, submissionStatus]);
8430
8437
  React.useEffect(function () {
@@ -8500,9 +8507,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8500
8507
  });
8501
8508
  });
8502
8509
  }, [dispatch]);
8503
- var _10 = React.useState(false),
8504
- progressStarted = _10[0],
8505
- setProgressStarted = _10[1];
8510
+ var _9 = React.useState(false),
8511
+ progressStarted = _9[0],
8512
+ setProgressStarted = _9[1];
8506
8513
  React.useEffect(function () {
8507
8514
  if (state.captureState === 'capturing') {
8508
8515
  setProgressStarted(false);
@@ -9605,19 +9612,25 @@ var SelfieCapture = function SelfieCapture(_a) {
9605
9612
  canvasRef = _v.canvasRef,
9606
9613
  guidanceError = _v.error;
9607
9614
  onPredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (prediction) {
9608
- return new Promise(function (resolve) {
9609
- if (shouldCapture && !busy) {
9610
- drawToCanvas(lastPredictionCanvas.current, canvasRef.current);
9611
- dispatch({
9612
- type: 'facesDetected',
9613
- payload: prediction
9614
- });
9615
- }
9616
- resolve();
9615
+ return __awaiter(void 0, void 0, void 0, function () {
9616
+ return __generator(this, function (_a) {
9617
+ if (shouldCapture && !busy) {
9618
+ drawToCanvas(lastPredictionCanvas.current, canvasRef.current);
9619
+ dispatch({
9620
+ type: 'facesDetected',
9621
+ payload: prediction
9622
+ });
9623
+ }
9624
+ return [2 /*return*/];
9625
+ });
9617
9626
  });
9618
9627
  }, [canvasRef, shouldCapture, busy]), 16));
9619
9628
  React.useEffect(function () {
9620
- (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();
9629
+ if (prediction === null || prediction === void 0 ? void 0 : prediction.faceReady) {
9630
+ onGuidanceSatisfied === null || onGuidanceSatisfied === void 0 ? void 0 : onGuidanceSatisfied();
9631
+ } else {
9632
+ onGuidanceNotSatisfied === null || onGuidanceNotSatisfied === void 0 ? void 0 : onGuidanceNotSatisfied();
9633
+ }
9621
9634
  }, [onGuidanceNotSatisfied, onGuidanceSatisfied, prediction === null || prediction === void 0 ? void 0 : prediction.faceReady]);
9622
9635
  React.useEffect(function () {
9623
9636
  if (!(prediction === null || prediction === void 0 ? void 0 : prediction.faceReady)) return;
@@ -10615,7 +10628,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
10615
10628
  }, [logCaptureMetadata, releaseCameraAccess, requestCameraAccess]);
10616
10629
  var onDoneCallback = React.useCallback(function () {
10617
10630
  logCaptureMetadata();
10618
- releaseCameraAccessOnExit && releaseCameraAccess();
10631
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
10619
10632
  setTimeout(function () {
10620
10633
  onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse, livenessCheckRequest);
10621
10634
  }, 0);
@@ -10634,7 +10647,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
10634
10647
  onLoadingOverlayDismissed === null || onLoadingOverlayDismissed === void 0 ? void 0 : onLoadingOverlayDismissed();
10635
10648
  }, [onLoadingOverlayDismissed]);
10636
10649
  var onFailureExitClick = React.useCallback(function () {
10637
- releaseCameraAccessOnExit && releaseCameraAccess();
10650
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
10638
10651
  setTimeout(function () {
10639
10652
  onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure(submissionResponse, livenessCheckRequest);
10640
10653
  }, 0);
@@ -10988,16 +11001,15 @@ var SignatureButtonsContainer = styled__default.default(ButtonsRow)(templateObje
10988
11001
  var templateObject_1$b, templateObject_2$9, templateObject_3$9, templateObject_4$4;
10989
11002
 
10990
11003
  var SignatureCapture = function SignatureCapture(_a) {
10991
- var _b;
10992
11004
  var onAccept = _a.onAccept,
10993
- _c = _a.classNames,
10994
- classNames = _c === void 0 ? {} : _c,
10995
- _d = _a.verbiage,
10996
- rawVerbiage = _d === void 0 ? {} : _d;
10997
- var _e = useResizeObserver__default.default(),
10998
- ref = _e.ref,
10999
- width = _e.width,
11000
- height = _e.height;
11005
+ _b = _a.classNames,
11006
+ classNames = _b === void 0 ? {} : _b,
11007
+ _c = _a.verbiage,
11008
+ rawVerbiage = _c === void 0 ? {} : _c;
11009
+ var _d = useResizeObserver__default.default(),
11010
+ ref = _d.ref,
11011
+ width = _d.width,
11012
+ height = _d.height;
11001
11013
  var signaturePad = React.useRef(null);
11002
11014
  var verbiage = useTranslations(rawVerbiage, {
11003
11015
  headingText: 'Please sign the box below',
@@ -11047,8 +11059,11 @@ var SignatureCapture = function SignatureCapture(_a) {
11047
11059
  }, /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
11048
11060
  variant: "secondary",
11049
11061
  className: classNames.clearBtn,
11050
- onClick: (_b = signaturePad.current) === null || _b === void 0 ? void 0 : _b.clear,
11051
- finished: true
11062
+ finished: true,
11063
+ onClick: function onClick() {
11064
+ var _a;
11065
+ (_a = signaturePad.current) === null || _a === void 0 ? void 0 : _a.clear();
11066
+ }
11052
11067
  }, verbiage.clearBtnText), /*#__PURE__*/React__namespace.default.createElement(AcceptBtn$1, {
11053
11068
  variant: "positive",
11054
11069
  className: classNames.acceptBtn,
@@ -12026,8 +12041,7 @@ var defaultVideoIdCaptureThresholds = {
12026
12041
  detection: {
12027
12042
  idCardFront: 0.4,
12028
12043
  idCardBack: 0.5,
12029
- passport: 0.3,
12030
- singlePage: 0.3
12044
+ passport: 0.3
12031
12045
  },
12032
12046
  focus: {
12033
12047
  idCardFront: {
@@ -12041,17 +12055,12 @@ var defaultVideoIdCaptureThresholds = {
12041
12055
  passport: {
12042
12056
  desktop: 0,
12043
12057
  mobile: 0
12044
- },
12045
- singlePage: {
12046
- desktop: 0,
12047
- mobile: 0
12048
12058
  }
12049
12059
  },
12050
12060
  goodFrames: {
12051
12061
  idCardFront: 1,
12052
12062
  idCardBack: 1,
12053
- passport: 1,
12054
- singlePage: 1
12063
+ passport: 1
12055
12064
  },
12056
12065
  flipShortcutThreshold: 0.7
12057
12066
  };
@@ -12123,7 +12132,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12123
12132
  stopIdModels = _18.stop,
12124
12133
  onIdPredictionMade = _18.onPredictionMade,
12125
12134
  setThresholds = _18.setThresholds,
12126
- setRequiredDocumentType = _18.setRequiredDocumentType,
12127
12135
  setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
12128
12136
  bestFrameDetails = _18.bestFrameDetails,
12129
12137
  resetBestFrame = _18.resetBestFrame,
@@ -12202,9 +12210,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12202
12210
  React.useEffect(function () {
12203
12211
  setThresholds(adjustedThresholds);
12204
12212
  }, [requestedAction, setThresholds, adjustedThresholds]);
12205
- React.useEffect(function () {
12206
- setRequiredDocumentType(requestedAction === 'SHOW_PASSPORT' ? 'passport' : requestedAction === 'SHOW_ID_BACK' ? 'idCardBack' : 'idCardFront');
12207
- }, [requestedAction, setRequiredDocumentType]);
12208
12213
  React.useEffect(function () {
12209
12214
  setDocumentDetectionBoundaries({
12210
12215
  top: 20,
@@ -12227,9 +12232,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12227
12232
  setGoodFramesCount = _28[1];
12228
12233
  var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
12229
12234
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
12230
- var _29 = React.useState(false),
12231
- isSinglePage = _29[0],
12232
- setIsSinglePage = _29[1];
12233
12235
  React.useEffect(function () {
12234
12236
  if (!idCaptureModelsEnabled || idModelError) return;
12235
12237
  onIdPredictionMade(function (prediction) {
@@ -12237,8 +12239,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12237
12239
  setCurrentDetectionScore(prediction.detectionScore);
12238
12240
  setCurrentDetectedDocumentType(prediction.detectedDocumentType);
12239
12241
  setCurrentFocusScore(prediction.focusScore);
12240
- setIsSinglePage(prediction.singlePageDetectionThresholdMet);
12241
- var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_BACK' ? prediction.idCardBackDetectionThresholdMet : prediction.idCardFrontDetectionThresholdMet || prediction.singlePageDetectionThresholdMet;
12242
+ var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
12242
12243
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
12243
12244
  var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
12244
12245
  if (shouldShortcutFlipAnimation) {
@@ -12249,9 +12250,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12249
12250
  } : 0);
12250
12251
  });
12251
12252
  }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
12252
- var _30 = React.useState(null),
12253
- idFrontCaptureStartedAt = _30[0],
12254
- setFirstGoodFrameTime = _30[1];
12253
+ var _29 = React.useState(null),
12254
+ idFrontCaptureStartedAt = _29[0],
12255
+ setFirstGoodFrameTime = _29[1];
12255
12256
  React.useEffect(function () {
12256
12257
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
12257
12258
  }, [goodFramesCount]);
@@ -12272,60 +12273,80 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12272
12273
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
12273
12274
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
12274
12275
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
12275
- var _31 = React.useState(),
12276
- countdownStartedAt = _31[0],
12277
- setCountdownStartedAt = _31[1];
12276
+ var _30 = React.useState(),
12277
+ countdownStartedAt = _30[0],
12278
+ setCountdownStartedAt = _30[1];
12278
12279
  var photoCanvas = React.useRef(null);
12279
12280
  var frameLock = React.useRef(false);
12280
12281
  var captureFrame = React.useCallback(function () {
12281
12282
  return __awaiter(void 0, void 0, void 0, function () {
12282
- var frameBase64;
12283
- return __generator(this, function (_a) {
12284
- if (frameLock.current) return [2 /*return*/];
12285
- frameLock.current = true;
12286
- drawToCanvas(photoCanvas.current, videoRef.current);
12287
- frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
12288
- if (!frameBase64) {
12289
- frameLock.current = false;
12290
- return [2 /*return*/];
12291
- }
12292
- try {
12293
- if (requestedAction == 'SHOW_ID_FRONT') {
12283
+ var frameBase64, _a;
12284
+ return __generator(this, function (_b) {
12285
+ switch (_b.label) {
12286
+ case 0:
12287
+ if (frameLock.current) return [2 /*return*/];
12288
+ frameLock.current = true;
12289
+ drawToCanvas(photoCanvas.current, videoRef.current);
12290
+ frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
12291
+ if (!frameBase64) {
12292
+ frameLock.current = false;
12293
+ return [2 /*return*/];
12294
+ }
12295
+ _b.label = 1;
12296
+ case 1:
12297
+ _b.trys.push([1,, 7, 8]);
12298
+ if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
12294
12299
  if (onIdFrontImageCaptured) {
12295
12300
  onIdFrontImageCaptured(frameBase64);
12296
12301
  }
12297
- if (isSinglePage || evaluateShouldSkip(skipShowIdCardBack)) {
12302
+ if (!skipShowIdCardBack) return [3 /*break*/, 4];
12303
+ _a = skipShowIdCardBack === true;
12304
+ if (_a) return [3 /*break*/, 3];
12305
+ return [4 /*yield*/, skipShowIdCardBack()];
12306
+ case 2:
12307
+ _a = _b.sent();
12308
+ _b.label = 3;
12309
+ case 3:
12310
+ if (_a) {
12298
12311
  return [2 /*return*/, onIdCaptureComplete()];
12299
12312
  }
12313
+ _b.label = 4;
12314
+ case 4:
12300
12315
  setRequestedAction('FLIP_ID');
12301
- } else if (requestedAction == 'SHOW_ID_BACK') {
12302
- if (onIdBackImageCaptured) {
12303
- onIdBackImageCaptured(frameBase64);
12316
+ return [3 /*break*/, 6];
12317
+ case 5:
12318
+ if (requestedAction == 'SHOW_ID_BACK') {
12319
+ if (onIdBackImageCaptured) {
12320
+ onIdBackImageCaptured(frameBase64);
12321
+ }
12322
+ onIdCaptureComplete();
12323
+ } else if (requestedAction == 'SHOW_PASSPORT') {
12324
+ if (onIdFrontImageCaptured) {
12325
+ onIdFrontImageCaptured(frameBase64);
12326
+ }
12327
+ onIdCaptureComplete();
12304
12328
  }
12305
- onIdCaptureComplete();
12306
- } else if (requestedAction == 'SHOW_PASSPORT') {
12307
- if (onIdFrontImageCaptured) {
12308
- onIdFrontImageCaptured(frameBase64);
12329
+ _b.label = 6;
12330
+ case 6:
12331
+ return [3 /*break*/, 8];
12332
+ case 7:
12333
+ setDetectedObjects([]);
12334
+ setCurrentDetectionScore(0);
12335
+ setCurrentFocusScore(0);
12336
+ setGoodFramesCount(0);
12337
+ setCountdownStartedAt(undefined);
12338
+ resetBestFrame();
12339
+ frameLock.current = false;
12340
+ if (countdownTimeoutRef.current) {
12341
+ clearTimeout(countdownTimeoutRef.current);
12309
12342
  }
12310
- onIdCaptureComplete();
12311
- }
12312
- } finally {
12313
- setDetectedObjects([]);
12314
- setCurrentDetectionScore(0);
12315
- setCurrentFocusScore(0);
12316
- setGoodFramesCount(0);
12317
- setCountdownStartedAt(undefined);
12318
- setIsSinglePage(false);
12319
- resetBestFrame();
12320
- frameLock.current = false;
12321
- if (countdownTimeoutRef.current) {
12322
- clearTimeout(countdownTimeoutRef.current);
12323
- }
12343
+ return [7 /*endfinally*/];
12344
+ case 8:
12345
+ return [2 /*return*/];
12324
12346
  }
12325
- return [2 /*return*/];
12326
12347
  });
12327
12348
  });
12328
- }, [videoRef, requestedAction, onIdFrontImageCaptured, isSinglePage, skipShowIdCardBack, onIdCaptureComplete, onIdBackImageCaptured, resetBestFrame]);
12349
+ }, [onIdCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
12329
12350
  var isFlipping = requestedAction === 'FLIP_ID';
12330
12351
  React.useEffect(function () {
12331
12352
  if (!isFlipping) return;
@@ -12384,9 +12405,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12384
12405
  stopSelfieGuidance();
12385
12406
  };
12386
12407
  }, [startSelfieGuidance, stopSelfieGuidance]);
12387
- var _32 = React.useState(0),
12388
- numFramesWithoutFaces = _32[0],
12389
- setNumFramesWithoutFaces = _32[1];
12408
+ var _31 = React.useState(0),
12409
+ numFramesWithoutFaces = _31[0],
12410
+ setNumFramesWithoutFaces = _31[1];
12390
12411
  onSelfiePredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (_a) {
12391
12412
  var face = _a.face;
12392
12413
  if (selfieModelError) return;
@@ -12402,12 +12423,12 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12402
12423
  }
12403
12424
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
12404
12425
  var theme = styled.useTheme();
12405
- var _33 = useTranslations(rawVerbiage, {
12426
+ var _32 = useTranslations(rawVerbiage, {
12406
12427
  faceNotCenteredText: 'Please move your face to the center...',
12407
12428
  captureBtnText: 'Capture'
12408
12429
  }),
12409
- captureBtnText = _33.captureBtnText,
12410
- faceNotCenteredText = _33.faceNotCenteredText;
12430
+ captureBtnText = _32.captureBtnText,
12431
+ faceNotCenteredText = _32.faceNotCenteredText;
12411
12432
  var debugScalingDetails = useDebugScalingDetails({
12412
12433
  enabled: debugMode,
12413
12434
  pageWidth: width,
@@ -12482,11 +12503,6 @@ var CountdownContainer = styled__default.default.div(templateObject_1$5 || (temp
12482
12503
  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"])));
12483
12504
  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"])));
12484
12505
  var CaptureButton = styled__default.default(LoaderButton)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin: 0 auto 25px;\n"], ["\n margin: 0 auto 25px;\n"])));
12485
- function evaluateShouldSkip(value) {
12486
- if (value === true) return true;
12487
- if (typeof value === 'function') return value();
12488
- return false;
12489
- }
12490
12506
  var templateObject_1$5, templateObject_2$5, templateObject_3$5, templateObject_4;
12491
12507
 
12492
12508
  var IdVideoCaptureSuccess = function IdVideoCaptureSuccess(_a) {
@@ -12704,7 +12720,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12704
12720
  return __awaiter(void 0, void 0, void 0, function () {
12705
12721
  return __generator(this, function (_a) {
12706
12722
  setIdCaptureVideoUrl(videoUrl);
12707
- audioUrl && setIdCaptureVideoAudioUrl(audioUrl);
12723
+ if (audioUrl) setIdCaptureVideoAudioUrl(audioUrl);
12708
12724
  setCaptureState('SUCCESS');
12709
12725
  if (skipSuccessScreen) onComplete === null || onComplete === void 0 ? void 0 : onComplete();
12710
12726
  return [2 /*return*/];
@@ -12780,8 +12796,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12780
12796
  documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
12781
12797
  focusModelUrl: (_j = (_h = idCaptureProps.assets) === null || _h === void 0 ? void 0 : _h.focusModelUrl) !== null && _j !== void 0 ? _j : '',
12782
12798
  onModelError: onIdCaptureModelError,
12783
- modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
12784
- allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
12799
+ modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs
12785
12800
  }, /*#__PURE__*/React__namespace.default.createElement(SelfieGuidanceModelsProvider, {
12786
12801
  autoStart: false,
12787
12802
  onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
@@ -13031,8 +13046,7 @@ function CompositeWizard(_a) {
13031
13046
  documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
13032
13047
  focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
13033
13048
  onModelError: idCaptureProps.onModelError,
13034
- modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
13035
- allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
13049
+ modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs
13036
13050
  }, /*#__PURE__*/React__namespace.default.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React__namespace.default.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React__namespace.default.createElement(IdCaptureWizard, _assign({}, idCaptureProps, {
13037
13051
  onSuccess: onIdCaptureSuccess
13038
13052
  }))))));
@@ -13299,10 +13313,10 @@ var resolveTheme = function resolveTheme(input) {
13299
13313
  var ThemeProvider = function ThemeProvider(_a) {
13300
13314
  var children = _a.children,
13301
13315
  themeInput = _a.theme;
13302
- var themeRef = React.useRef(themeInput);
13316
+ var themeRef = React.useState(themeInput)[0];
13303
13317
  var theme = React.useMemo(function () {
13304
- return resolveTheme(themeRef.current);
13305
- }, []);
13318
+ return resolveTheme(themeRef);
13319
+ }, [themeRef]);
13306
13320
  var colors = theme.colors;
13307
13321
  React.useEffect(function () {
13308
13322
  for (var name_1 in colors) {
@@ -13354,33 +13368,31 @@ var IdValidation = function IdValidation(_a) {
13354
13368
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
13355
13369
  _d = _a.idCaptureRequirement,
13356
13370
  idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
13357
- _e = _a.allowSinglePageIdCapture,
13358
- allowSinglePageIdCapture = _e === void 0 ? false : _e,
13359
- _f = _a.separateIdCardCaptureSequence,
13360
- separateIdCardCaptureSequence = _f === void 0 ? false : _f,
13361
- _g = _a.idCaptureThresholds,
13362
- idCaptureThresholds = _g === void 0 ? defaultIdCaptureThresholds : _g,
13363
- _h = _a.skipSuccessScreen,
13364
- skipSuccessScreen = _h === void 0 ? false : _h,
13371
+ _e = _a.separateIdCardCaptureSequence,
13372
+ separateIdCardCaptureSequence = _e === void 0 ? false : _e,
13373
+ _f = _a.idCaptureThresholds,
13374
+ idCaptureThresholds = _f === void 0 ? defaultIdCaptureThresholds : _f,
13375
+ _g = _a.skipSuccessScreen,
13376
+ skipSuccessScreen = _g === void 0 ? false : _g,
13365
13377
  instructions = _a.instructions,
13366
- _j = _a.guideType,
13367
- guideType = _j === void 0 ? 'fit' : _j,
13368
- _k = _a.guideImages,
13369
- guideImages = _k === void 0 ? defaultIdCaptureGuideImages : _k,
13370
- _l = _a.portraitGuidesOnMobile,
13371
- portraitGuidesOnMobile = _l === void 0 ? true : _l,
13372
- _m = _a.rotateLoadingOverlayImageWhenPortrait,
13373
- rotateLoadingOverlayImageWhenPortrait = _m === void 0 ? true : _m,
13374
- _o = _a.modelLoadTimeoutMs,
13375
- modelLoadTimeoutMs = _o === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _o,
13376
- _p = _a.forceFallbackMode,
13377
- forceFallbackMode = _p === void 0 ? false : _p,
13378
- _q = _a.allowIdCardBackToFrontCapture,
13379
- allowIdCardBackToFrontCapture = _q === void 0 ? false : _q,
13380
- _r = _a.enableOverrideWrongDocumentTypeDialog,
13381
- enableOverrideWrongDocumentTypeDialog = _r === void 0 ? false : _r,
13382
- _s = _a.allowOverrideWrongDocumentTypeAfterMs,
13383
- allowOverrideWrongDocumentTypeAfterMs = _s === void 0 ? 8000 : _s,
13378
+ _h = _a.guideType,
13379
+ guideType = _h === void 0 ? 'fit' : _h,
13380
+ _j = _a.guideImages,
13381
+ guideImages = _j === void 0 ? defaultIdCaptureGuideImages : _j,
13382
+ _k = _a.portraitGuidesOnMobile,
13383
+ portraitGuidesOnMobile = _k === void 0 ? true : _k,
13384
+ _l = _a.rotateLoadingOverlayImageWhenPortrait,
13385
+ rotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
13386
+ _m = _a.modelLoadTimeoutMs,
13387
+ modelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
13388
+ _o = _a.forceFallbackMode,
13389
+ forceFallbackMode = _o === void 0 ? false : _o,
13390
+ _p = _a.allowIdCardBackToFrontCapture,
13391
+ allowIdCardBackToFrontCapture = _p === void 0 ? false : _p,
13392
+ _q = _a.enableOverrideWrongDocumentTypeDialog,
13393
+ enableOverrideWrongDocumentTypeDialog = _q === void 0 ? false : _q,
13394
+ _r = _a.allowOverrideWrongDocumentTypeAfterMs,
13395
+ allowOverrideWrongDocumentTypeAfterMs = _r === void 0 ? 8000 : _r,
13384
13396
  onBeforeSubmit = _a.onBeforeSubmit,
13385
13397
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
13386
13398
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -13394,28 +13406,28 @@ var IdValidation = function IdValidation(_a) {
13394
13406
  onUserCancel = _a.onUserCancel,
13395
13407
  onModelError = _a.onModelError,
13396
13408
  onCameraAccessDenied = _a.onCameraAccessDenied,
13397
- _t = _a.theme,
13398
- theme = _t === void 0 ? 'default' : _t,
13399
- _u = _a.assets,
13400
- assets = _u === void 0 ? {} : _u,
13401
- _v = _a.classNames,
13402
- classNames = _v === void 0 ? {} : _v,
13403
- _w = _a.colors,
13404
- colors = _w === void 0 ? {} : _w,
13405
- _x = _a.verbiage,
13406
- verbiage = _x === void 0 ? {} : _x,
13407
- _y = _a.captureSignature,
13408
- captureSignature = _y === void 0 ? false : _y,
13409
- _z = _a.captureSignatureVideo,
13410
- captureSignatureVideo = _z === void 0 ? false : _z,
13411
- _0 = _a.captureAdditionalDocuments,
13412
- captureAdditionalDocuments = _0 === void 0 ? [] : _0,
13413
- _1 = _a.geolocationEnabled,
13414
- geolocationEnabled = _1 === void 0 ? true : _1,
13415
- _2 = _a.geolocationRequired,
13416
- geolocationRequired = _2 === void 0 ? false : _2,
13417
- _3 = _a.debugMode,
13418
- debugMode = _3 === void 0 ? false : _3;
13409
+ _s = _a.theme,
13410
+ theme = _s === void 0 ? 'default' : _s,
13411
+ _t = _a.assets,
13412
+ assets = _t === void 0 ? {} : _t,
13413
+ _u = _a.classNames,
13414
+ classNames = _u === void 0 ? {} : _u,
13415
+ _v = _a.colors,
13416
+ colors = _v === void 0 ? {} : _v,
13417
+ _w = _a.verbiage,
13418
+ verbiage = _w === void 0 ? {} : _w,
13419
+ _x = _a.captureSignature,
13420
+ captureSignature = _x === void 0 ? false : _x,
13421
+ _y = _a.captureSignatureVideo,
13422
+ captureSignatureVideo = _y === void 0 ? false : _y,
13423
+ _z = _a.captureAdditionalDocuments,
13424
+ captureAdditionalDocuments = _z === void 0 ? [] : _z,
13425
+ _0 = _a.geolocationEnabled,
13426
+ geolocationEnabled = _0 === void 0 ? true : _0,
13427
+ _1 = _a.geolocationRequired,
13428
+ geolocationRequired = _1 === void 0 ? false : _1,
13429
+ _2 = _a.debugMode,
13430
+ debugMode = _2 === void 0 ? false : _2;
13419
13431
  useLanguage(lang);
13420
13432
  useDebugLogging(debugMode);
13421
13433
  var idCaptureProps = React.useMemo(function () {
@@ -13425,7 +13437,6 @@ var IdValidation = function IdValidation(_a) {
13425
13437
  onModelError: onModelError,
13426
13438
  precapturedDocuments: precapturedDocuments,
13427
13439
  captureRequirement: idCaptureRequirement,
13428
- allowSinglePageIdCapture: allowSinglePageIdCapture,
13429
13440
  separateIdCardCaptureSequence: separateIdCardCaptureSequence,
13430
13441
  thresholds: idCaptureThresholds,
13431
13442
  skipSuccessScreen: skipSuccessScreen,
@@ -13448,7 +13459,7 @@ var IdValidation = function IdValidation(_a) {
13448
13459
  verbiage: verbiage,
13449
13460
  debugMode: debugMode
13450
13461
  };
13451
- }, [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]);
13462
+ }, [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]);
13452
13463
  var additionalDocumentCaptureProps = React.useMemo(function () {
13453
13464
  return {
13454
13465
  documents: captureAdditionalDocuments,
@@ -15804,7 +15815,9 @@ function renderElement(component, targetElement) {
15804
15815
  try {
15805
15816
  root.unmount();
15806
15817
  originalRemove_1();
15807
- } catch (e) {}
15818
+ } catch (e) {
15819
+ debug('failed to unmount', e);
15820
+ }
15808
15821
  };
15809
15822
  }
15810
15823
  return targetElement;