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
package/dist/sdk2.esm.js CHANGED
@@ -203,7 +203,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
203
203
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
204
204
  };
205
205
 
206
- var webSdkVersion = '2.2.65';
206
+ var webSdkVersion = '2.2.67';
207
207
 
208
208
  function getPlatform() {
209
209
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -982,7 +982,7 @@ function debug() {
982
982
  parts[_i] = arguments[_i];
983
983
  }
984
984
  if (logLevel < LogLevel.Debug) return;
985
- console.debug.apply(console, parts); // eslint-disable-line
985
+ console.debug.apply(console, parts); // eslint-disable-line no-console
986
986
  }
987
987
  function log() {
988
988
  var parts = [];
@@ -990,7 +990,7 @@ function log() {
990
990
  parts[_i] = arguments[_i];
991
991
  }
992
992
  if (logLevel < LogLevel.Info) return;
993
- console.log.apply(console, parts); // eslint-disable-line
993
+ console.log.apply(console, parts); // eslint-disable-line no-console
994
994
  }
995
995
  function warn() {
996
996
  var parts = [];
@@ -998,7 +998,7 @@ function warn() {
998
998
  parts[_i] = arguments[_i];
999
999
  }
1000
1000
  if (logLevel < LogLevel.Warn) return;
1001
- console.warn.apply(console, parts); // eslint-disable-line
1001
+ console.warn.apply(console, parts); // eslint-disable-line no-console
1002
1002
  }
1003
1003
  function error() {
1004
1004
  var parts = [];
@@ -1006,7 +1006,7 @@ function error() {
1006
1006
  parts[_i] = arguments[_i];
1007
1007
  }
1008
1008
  if (logLevel < LogLevel.Error) return;
1009
- console.error.apply(console, parts); // eslint-disable-line
1009
+ console.error.apply(console, parts); // eslint-disable-line no-console
1010
1010
  }
1011
1011
 
1012
1012
  var defaultSubmissionUrl = 'https://portal-api.idmission.com/swagger';
@@ -1303,82 +1303,33 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1303
1303
  onDocumentUploadFailed.current = userSuppliedOnDocumentUploadFailed;
1304
1304
  }, [userSuppliedOnDocumentUploadFailed]);
1305
1305
  var uploadDocument = useCallback(function (src, metadata) {
1306
- return new Promise(function (resolve, reject) {
1307
- return __awaiter(void 0, void 0, void 0, function () {
1308
- var blob, _a, documentId, upload, _b, _c;
1309
- var _d, _e;
1310
- var _f;
1311
- return __generator(this, function (_g) {
1312
- switch (_g.label) {
1313
- case 0:
1314
- blob = typeof src === 'string' ? convertBase64ToBlob(src) : src;
1315
- _a = onBeforeDocumentUpload.current;
1316
- if (!_a) return [3 /*break*/, 2];
1317
- return [4 /*yield*/, (_f = onBeforeDocumentUpload.current) === null || _f === void 0 ? void 0 : _f.call(onBeforeDocumentUpload, blob, metadata)];
1318
- case 1:
1319
- _a = _g.sent() === false;
1320
- _g.label = 2;
1321
- case 2:
1322
- if (_a) return [2 /*return*/, resolve(blobToB64(blob))];
1323
- _b = createUpload;
1324
- _c = [blob];
1325
- _d = {
1326
- endpoint: documentServiceUrl,
1327
- retryDelays: [0, 1000, 1000, 1000, 3000, 5000, 10000, 20000],
1328
- headers: {
1329
- 'X-Session-Id': sessionId
1330
- }
1331
- };
1332
- _e = {
1333
- filetype: blob.type,
1334
- contentType: blob.type
1335
- };
1336
- return [4 /*yield*/, calculateMd5(blob)];
1337
- case 3:
1338
- upload = _b.apply(void 0, _c.concat([(_d.metadata = _assign.apply(void 0, [(_e.fingerprint = _g.sent(), _e), metadata || {}]), _d.onProgress = function (bytesUploaded, bytesTotal) {
1339
- var _a;
1340
- (_a = onDocumentUploadProgress.current) === null || _a === void 0 ? void 0 : _a.call(onDocumentUploadProgress, {
1341
- bytesUploaded: bytesUploaded,
1342
- bytesTotal: bytesTotal,
1343
- percentage: (bytesUploaded / bytesTotal * 100).toFixed(2) + '%',
1344
- metadata: metadata
1345
- });
1346
- }, _d.onAfterResponse = function (_req, res) {
1347
- var contentType = res.getHeader('Content-Type');
1348
- if (!(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('application/json'))) return;
1349
- var body = res.getBody();
1350
- if (!body) return;
1351
- try {
1352
- var parsedId = JSON.parse(body).id;
1353
- if (parsedId.startsWith('urn:documentsv1:')) {
1354
- documentId = parsedId;
1355
- }
1356
- } catch (e) {
1357
- warn('Failed to parse documents service response body', e);
1358
- }
1359
- }, _d.onSuccess = function () {
1360
- var _a, _b;
1361
- documentId || (documentId = "urn:documentsv1:".concat(getEnvFromUrl(upload.url), ":").concat((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift()));
1362
- (_b = onDocumentUploaded.current) === null || _b === void 0 ? void 0 : _b.call(onDocumentUploaded, documentId, metadata);
1363
- resolve(documentId);
1364
- }, _d.onError = function (error) {
1365
- var _a;
1366
- log('Failed because: ' + error);
1367
- (_a = onDocumentUploadFailed.current) === null || _a === void 0 ? void 0 : _a.call(onDocumentUploadFailed, error, metadata);
1368
- reject(error);
1369
- }, _d)]));
1370
- // Check if there are any previous uploads to continue.
1371
- upload.findPreviousUploads().then(function (previousUploads) {
1372
- // Found previous uploads so we select the first one.
1373
- if (previousUploads.length) {
1374
- upload.resumeFromPreviousUpload(previousUploads[0]);
1375
- }
1376
- // Start the upload
1377
- upload.start();
1378
- });
1379
- return [2 /*return*/];
1380
- }
1381
- });
1306
+ return __awaiter(void 0, void 0, void 0, function () {
1307
+ var blob, _a;
1308
+ var _b;
1309
+ return __generator(this, function (_c) {
1310
+ switch (_c.label) {
1311
+ case 0:
1312
+ blob = typeof src === 'string' ? convertBase64ToBlob(src) : src;
1313
+ _a = onBeforeDocumentUpload.current;
1314
+ if (!_a) return [3 /*break*/, 2];
1315
+ return [4 /*yield*/, (_b = onBeforeDocumentUpload.current) === null || _b === void 0 ? void 0 : _b.call(onBeforeDocumentUpload, blob, metadata)];
1316
+ case 1:
1317
+ _a = _c.sent() === false;
1318
+ _c.label = 2;
1319
+ case 2:
1320
+ if (_a) {
1321
+ return [2 /*return*/, blobToB64(blob)];
1322
+ }
1323
+ return [2 /*return*/, performUpload({
1324
+ blob: blob,
1325
+ endpoint: documentServiceUrl,
1326
+ sessionId: sessionId,
1327
+ metadata: metadata,
1328
+ onDocumentUploadProgress: onDocumentUploadProgress.current,
1329
+ onDocumentUploaded: onDocumentUploaded.current,
1330
+ onDocumentUploadFailed: onDocumentUploadFailed.current
1331
+ })];
1332
+ }
1382
1333
  });
1383
1334
  });
1384
1335
  }, [documentServiceUrl, sessionId]);
@@ -1927,6 +1878,83 @@ function getEnvFromUrl(url) {
1927
1878
  }
1928
1879
  return 'unknown';
1929
1880
  }
1881
+ function performUpload(_a) {
1882
+ return __awaiter(this, arguments, void 0, function (_b) {
1883
+ var fingerprint;
1884
+ var blob = _b.blob,
1885
+ endpoint = _b.endpoint,
1886
+ sessionId = _b.sessionId,
1887
+ metadata = _b.metadata,
1888
+ onDocumentUploadProgress = _b.onDocumentUploadProgress,
1889
+ onDocumentUploaded = _b.onDocumentUploaded,
1890
+ onDocumentUploadFailed = _b.onDocumentUploadFailed;
1891
+ return __generator(this, function (_c) {
1892
+ switch (_c.label) {
1893
+ case 0:
1894
+ return [4 /*yield*/, calculateMd5(blob)];
1895
+ case 1:
1896
+ fingerprint = _c.sent();
1897
+ return [2 /*return*/, new Promise(function (resolve, reject) {
1898
+ var documentId;
1899
+ var upload = createUpload(blob, {
1900
+ endpoint: endpoint,
1901
+ retryDelays: [0, 1000, 1000, 1000, 3000, 5000, 10000, 20000],
1902
+ headers: {
1903
+ 'X-Session-Id': sessionId
1904
+ },
1905
+ metadata: _assign({
1906
+ filetype: blob.type,
1907
+ contentType: blob.type,
1908
+ fingerprint: fingerprint
1909
+ }, metadata || {}),
1910
+ onProgress: function onProgress(bytesUploaded, bytesTotal) {
1911
+ onDocumentUploadProgress === null || onDocumentUploadProgress === void 0 ? void 0 : onDocumentUploadProgress({
1912
+ bytesUploaded: bytesUploaded,
1913
+ bytesTotal: bytesTotal,
1914
+ percentage: (bytesUploaded / bytesTotal * 100).toFixed(2) + '%',
1915
+ metadata: metadata
1916
+ });
1917
+ },
1918
+ onAfterResponse: function onAfterResponse(_req, res) {
1919
+ var contentType = res.getHeader('Content-Type');
1920
+ if (!(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('application/json'))) return;
1921
+ var body = res.getBody();
1922
+ if (!body) return;
1923
+ try {
1924
+ var parsedId = JSON.parse(body).id;
1925
+ if (parsedId.startsWith('urn:documentsv1:')) {
1926
+ documentId = parsedId;
1927
+ }
1928
+ } catch (e) {
1929
+ warn('Failed to parse documents service response body', e);
1930
+ }
1931
+ },
1932
+ onSuccess: function onSuccess() {
1933
+ var _a;
1934
+ documentId || (documentId = "urn:documentsv1:".concat(getEnvFromUrl(upload.url), ":").concat((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift()));
1935
+ onDocumentUploaded === null || onDocumentUploaded === void 0 ? void 0 : onDocumentUploaded(documentId, metadata);
1936
+ resolve(documentId);
1937
+ },
1938
+ onError: function onError(error) {
1939
+ log('Failed because: ' + error);
1940
+ onDocumentUploadFailed === null || onDocumentUploadFailed === void 0 ? void 0 : onDocumentUploadFailed(error, metadata);
1941
+ reject(error);
1942
+ }
1943
+ });
1944
+ // Check if there are any previous uploads to continue.
1945
+ upload.findPreviousUploads().then(function (previousUploads) {
1946
+ // Found previous uploads so we select the first one.
1947
+ if (previousUploads.length) {
1948
+ upload.resumeFromPreviousUpload(previousUploads[0]);
1949
+ }
1950
+ // Start the upload
1951
+ upload.start();
1952
+ });
1953
+ })];
1954
+ }
1955
+ });
1956
+ });
1957
+ }
1930
1958
 
1931
1959
  var visionTasksBasePath = "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.7/wasm";
1932
1960
  var visionRuntimePreloading = false;
@@ -2238,7 +2266,7 @@ function average(arr) {
2238
2266
 
2239
2267
  var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
2240
2268
 
2241
- var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20241212_131026.tflite");
2269
+ var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20241018_093000.tflite");
2242
2270
 
2243
2271
  var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
2244
2272
 
@@ -2257,10 +2285,6 @@ var defaultFocusThresholds = {
2257
2285
  passport: {
2258
2286
  desktop: 0,
2259
2287
  mobile: 0.3
2260
- },
2261
- singlePage: {
2262
- desktop: 0,
2263
- mobile: 0.3
2264
2288
  }
2265
2289
  };
2266
2290
  var classifier = null;
@@ -2368,7 +2392,7 @@ function useLoadFocusModel(_a) {
2368
2392
  };
2369
2393
  }, [modelPath, modelLoadTimeoutMs, videoRef, shouldLoadModels]);
2370
2394
  useEffect(function handleModelError() {
2371
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2395
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2372
2396
  }, [modelError, onModelError]);
2373
2397
  return {
2374
2398
  ready: ready,
@@ -2514,7 +2538,7 @@ function useLoadFaceDetector(_a) {
2514
2538
  };
2515
2539
  }, [modelLoadTimeoutMs, videoRef]);
2516
2540
  useEffect(function handleModelError() {
2517
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2541
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2518
2542
  }, [modelError, onModelError]);
2519
2543
  return {
2520
2544
  ready: ready,
@@ -2886,19 +2910,16 @@ var defaultDocumentDetectionThresholds = {
2886
2910
  idCardFront: 0.6,
2887
2911
  idCardBack: 0.6,
2888
2912
  passport: 0.4,
2889
- singlePage: 0.4,
2890
2913
  stability: {
2891
2914
  idCardFront: 0.85,
2892
2915
  idCardBack: 0.85,
2893
- passport: 0.5,
2894
- singlePage: 0.5
2916
+ passport: 0.5
2895
2917
  }
2896
2918
  };
2897
2919
  var documentTypeDisplayNames = {
2898
2920
  idCardFront: 'ID card front',
2899
2921
  idCardBack: 'ID card back',
2900
2922
  passport: 'Passport',
2901
- singlePage: 'Single page',
2902
2923
  none: 'None'
2903
2924
  };
2904
2925
  var detector = null;
@@ -3013,7 +3034,7 @@ function useLoadDocumentDetector(_a) {
3013
3034
  };
3014
3035
  }, [shouldLoadModels, modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
3015
3036
  useEffect(function handleModelError() {
3016
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
3037
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
3017
3038
  }, [modelError, onModelError]);
3018
3039
  return {
3019
3040
  ready: ready,
@@ -3087,7 +3108,7 @@ var defaultDocumentDetectionBoundaries = {
3087
3108
  right: 20
3088
3109
  };
3089
3110
  function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3090
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
3111
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3091
3112
  if (boundaries === void 0) {
3092
3113
  boundaries = defaultDocumentDetectionBoundaries;
3093
3114
  }
@@ -3138,25 +3159,18 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3138
3159
  var bestPassportPage = detectedObjects.find(function (obj) {
3139
3160
  return obj.label === 'Passport page';
3140
3161
  });
3141
- var bestSinglePage = detectedObjects.find(function (obj) {
3142
- return obj.label === 'Single page';
3143
- });
3144
3162
  var idCardFrontDetectionScore = (_e = bestIdCardFront === null || bestIdCardFront === void 0 ? void 0 : bestIdCardFront.score) !== null && _e !== void 0 ? _e : 0;
3145
3163
  var idCardBackDetectionScore = (_f = bestIdCardBack === null || bestIdCardBack === void 0 ? void 0 : bestIdCardBack.score) !== null && _f !== void 0 ? _f : 0;
3146
3164
  var passportDetectionScore = (_g = bestPassportPage === null || bestPassportPage === void 0 ? void 0 : bestPassportPage.score) !== null && _g !== void 0 ? _g : 0;
3147
- var singlePageDetectionScore = (_h = bestSinglePage === null || bestSinglePage === void 0 ? void 0 : bestSinglePage.score) !== null && _h !== void 0 ? _h : 0;
3148
- var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_j = thresholds.idCardFront) !== null && _j !== void 0 ? _j : 0);
3149
- var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_k = thresholds.idCardBack) !== null && _k !== void 0 ? _k : 0);
3150
- var passportDetectionThresholdMet = passportDetectionScore >= ((_l = thresholds.passport) !== null && _l !== void 0 ? _l : 0);
3151
- var singlePageDetectionThresholdMet = singlePageDetectionScore >= ((_m = thresholds.singlePage) !== null && _m !== void 0 ? _m : 0);
3152
- var bestDocument = singlePageDetectionThresholdMet ? bestSinglePage : passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
3153
- var detectionThreshold = singlePageDetectionThresholdMet ? thresholds.singlePage : passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
3154
- var detectionScore = (_o = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _o !== void 0 ? _o : 0;
3165
+ var idCardFrontDetectionThresholdMet = idCardFrontDetectionScore >= ((_h = thresholds.idCardFront) !== null && _h !== void 0 ? _h : 0);
3166
+ var idCardBackDetectionThresholdMet = idCardBackDetectionScore >= ((_j = thresholds.idCardBack) !== null && _j !== void 0 ? _j : 0);
3167
+ var passportDetectionThresholdMet = passportDetectionScore >= ((_k = thresholds.passport) !== null && _k !== void 0 ? _k : 0);
3168
+ var bestDocument = passportDetectionThresholdMet ? bestPassportPage : idCardBackDetectionThresholdMet ? bestIdCardBack : bestIdCardFront;
3169
+ var detectionThreshold = passportDetectionThresholdMet ? thresholds.passport : idCardBackDetectionThresholdMet ? thresholds.idCardBack : thresholds.idCardFront;
3170
+ var detectionScore = (_l = bestDocument === null || bestDocument === void 0 ? void 0 : bestDocument.score) !== null && _l !== void 0 ? _l : 0;
3155
3171
  var detectionThresholdMet = detectionScore >= (detectionThreshold !== null && detectionThreshold !== void 0 ? detectionThreshold : 0);
3156
3172
  var detectedDocumentType = 'none';
3157
- if (singlePageDetectionThresholdMet) {
3158
- detectedDocumentType = 'singlePage';
3159
- } else if (passportDetectionThresholdMet) {
3173
+ if (passportDetectionThresholdMet) {
3160
3174
  detectedDocumentType = 'passport';
3161
3175
  } else if (idCardBackDetectionThresholdMet) {
3162
3176
  detectedDocumentType = 'idCardBack';
@@ -3170,12 +3184,12 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3170
3184
  var documentIsStable = false;
3171
3185
  var documentTooClose = false;
3172
3186
  if (bestDocument) {
3173
- var _q = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
3174
- docWidth = _q[0],
3175
- docHeight = _q[1];
3187
+ var _o = [bestDocument.box.width / frameWidth, bestDocument.box.height / frameHeight],
3188
+ docWidth = _o[0],
3189
+ docHeight = _o[1];
3176
3190
  documentTooClose = docWidth > 0.85 || docHeight > 0.85;
3177
3191
  if (detectionThresholdMet && documentInBounds && !documentTooClose) {
3178
- var thresholdSet = (_p = thresholds.stability) !== null && _p !== void 0 ? _p : defaultDocumentDetectionThresholds.stability;
3192
+ var thresholdSet = (_m = thresholds.stability) !== null && _m !== void 0 ? _m : defaultDocumentDetectionThresholds.stability;
3179
3193
  var threshold_1 = thresholdSet[detectedDocumentType];
3180
3194
  var framesNeeded = Math.ceil(average(framesNeededSamples));
3181
3195
  trackBox(bestDocument.box, framesNeeded);
@@ -3197,8 +3211,6 @@ function processDocumentDetectorPrediction(prediction, thresholds, boundaries) {
3197
3211
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
3198
3212
  passportDetectionScore: passportDetectionScore,
3199
3213
  passportDetectionThresholdMet: passportDetectionThresholdMet,
3200
- singlePageDetectionScore: singlePageDetectionScore,
3201
- singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
3202
3214
  bestDocument: bestDocument,
3203
3215
  documentInBounds: documentInBounds,
3204
3216
  documentTooClose: documentTooClose,
@@ -3264,8 +3276,8 @@ function useFrameLoop(fn, _a) {
3264
3276
  renderPrediction().then();
3265
3277
  return function () {
3266
3278
  loopId.current += 1;
3267
- frameId.current && cancelAnimationFrame(frameId.current);
3268
- timer && clearTimeout(timer);
3279
+ if (frameId.current) cancelAnimationFrame(frameId.current);
3280
+ if (timer) clearTimeout(timer);
3269
3281
  };
3270
3282
  }, [fn, running, throttleMs]);
3271
3283
  var start = useCallback(function () {
@@ -3430,7 +3442,7 @@ var createCameraStore = function createCameraStore(config) {
3430
3442
  },
3431
3443
  requestCameraAccess: function requestCameraAccess() {
3432
3444
  return __awaiter(this, void 0, void 0, function () {
3433
- 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;
3445
+ 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;
3434
3446
  var _b, _c, _d;
3435
3447
  return __generator(this, function (_e) {
3436
3448
  switch (_e.label) {
@@ -3550,13 +3562,13 @@ var createCameraStore = function createCameraStore(config) {
3550
3562
  debug('opened stream with no width and height constraints');
3551
3563
  return [3 /*break*/, 10];
3552
3564
  case 9:
3553
- _e.sent();
3554
- debug('cannot open stream at all');
3565
+ e_2 = _e.sent();
3566
+ debug('cannot open stream at all', e_2);
3555
3567
  return [3 /*break*/, 10];
3556
3568
  case 10:
3557
3569
  if (!stream_1) {
3558
3570
  error('failed to open camera');
3559
- throw new Error('failed to open camera');
3571
+ throw new Error('failed to open camera: ');
3560
3572
  }
3561
3573
  debug('camera access granted with constraints', constraints);
3562
3574
  handleStreamEnded_1 = function handleStreamEnded_1() {
@@ -3637,7 +3649,7 @@ var createCameraStore = function createCameraStore(config) {
3637
3649
  },
3638
3650
  requestMicrophoneAccess: function requestMicrophoneAccess() {
3639
3651
  return __awaiter(this, void 0, void 0, function () {
3640
- var stream_2;
3652
+ var stream_2, e_4;
3641
3653
  return __generator(this, function (_a) {
3642
3654
  switch (_a.label) {
3643
3655
  case 0:
@@ -3676,7 +3688,8 @@ var createCameraStore = function createCameraStore(config) {
3676
3688
  }, 500);
3677
3689
  return [3 /*break*/, 4];
3678
3690
  case 3:
3679
- _a.sent();
3691
+ e_4 = _a.sent();
3692
+ debug('failed to open microphone', e_4);
3680
3693
  set({
3681
3694
  microphoneAccessDenied: true
3682
3695
  });
@@ -4041,9 +4054,7 @@ function evaluateIsMobile(nav) {
4041
4054
  // @ts-ignore
4042
4055
  return navAny.userAgentData && navAny.userAgentData.mobile;
4043
4056
  }
4044
- 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) ||
4045
- // tslint:disable-next-line:max-line-length
4046
- /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));
4057
+ 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));
4047
4058
  }
4048
4059
  return false;
4049
4060
  }
@@ -4092,39 +4103,37 @@ var IdCaptureModelsContext = /*#__PURE__*/createContext({
4092
4103
  });
4093
4104
  function IdCaptureModelsProviderInner(_a) {
4094
4105
  var children = _a.children,
4095
- onModelError = _a.onModelError,
4096
- _b = _a.allowSinglePageIdCapture,
4097
- allowSinglePageIdCapture = _b === void 0 ? false : _b;
4098
- var _c = useContext(DocumentDetectionModelContext),
4099
- documentDetectionModelReady = _c.documentDetectionModelReady,
4100
- documentDetectionModelDownloadProgress = _c.documentDetectionModelDownloadProgress,
4101
- startDocumentDetection = _c.startDocumentDetection,
4102
- stopDocumentDetection = _c.stopDocumentDetection,
4103
- lastPredictionCanvas = _c.documentDetectionLastPredictionCanvas,
4104
- clearDocumentDetectionLastPredictionCanvas = _c.clearDocumentDetectionLastPredictionCanvas,
4105
- onDocumentDetected = _c.onDocumentDetected,
4106
- detectionTime = _c.detectionTime,
4107
- documentDetectionThresholds = _c.documentDetectionThresholds,
4108
- setDocumentDetectionThresholds = _c.setDocumentDetectionThresholds,
4109
- documentDetectionBoundaries = _c.documentDetectionBoundaries,
4110
- setDocumentDetectionBoundaries = _c.setDocumentDetectionBoundaries,
4111
- documentDetectionModelError = _c.documentDetectionModelError;
4112
- var _d = useContext(FocusModelContext),
4113
- focusModelReady = _d.focusModelReady,
4114
- focusModelDownloadProgress = _d.focusModelDownloadProgress,
4115
- makeFocusPrediction = _d.makeFocusPrediction,
4116
- focusThresholds = _d.focusThresholds,
4117
- setFocusThresholds = _d.setFocusThresholds,
4118
- focusPredictionTime = _d.focusPredictionTime,
4119
- focusModelError = _d.focusModelError;
4106
+ onModelError = _a.onModelError;
4107
+ var _b = useContext(DocumentDetectionModelContext),
4108
+ documentDetectionModelReady = _b.documentDetectionModelReady,
4109
+ documentDetectionModelDownloadProgress = _b.documentDetectionModelDownloadProgress,
4110
+ startDocumentDetection = _b.startDocumentDetection,
4111
+ stopDocumentDetection = _b.stopDocumentDetection,
4112
+ lastPredictionCanvas = _b.documentDetectionLastPredictionCanvas,
4113
+ clearDocumentDetectionLastPredictionCanvas = _b.clearDocumentDetectionLastPredictionCanvas,
4114
+ onDocumentDetected = _b.onDocumentDetected,
4115
+ detectionTime = _b.detectionTime,
4116
+ documentDetectionThresholds = _b.documentDetectionThresholds,
4117
+ setDocumentDetectionThresholds = _b.setDocumentDetectionThresholds,
4118
+ documentDetectionBoundaries = _b.documentDetectionBoundaries,
4119
+ setDocumentDetectionBoundaries = _b.setDocumentDetectionBoundaries,
4120
+ documentDetectionModelError = _b.documentDetectionModelError;
4121
+ var _c = useContext(FocusModelContext),
4122
+ focusModelReady = _c.focusModelReady,
4123
+ focusModelDownloadProgress = _c.focusModelDownloadProgress,
4124
+ makeFocusPrediction = _c.makeFocusPrediction,
4125
+ focusThresholds = _c.focusThresholds,
4126
+ setFocusThresholds = _c.setFocusThresholds,
4127
+ focusPredictionTime = _c.focusPredictionTime,
4128
+ focusModelError = _c.focusModelError;
4120
4129
  var onPredictionHandler = useRef();
4121
4130
  var bestFrameDetails = useRef(null);
4122
4131
  var bestPredictionCanvas = useRef(null);
4123
4132
  var bestFocusScore = useRef(0);
4124
4133
  var stopDetection = useRef(0);
4125
- var _e = useState('none'),
4126
- requiredDocumentType = _e[0],
4127
- setRequiredDocumentType = _e[1];
4134
+ var _d = useState('none'),
4135
+ requiredDocumentType = _d[0],
4136
+ setRequiredDocumentType = _d[1];
4128
4137
  var thresholds = useMemo(function () {
4129
4138
  return _assign(_assign({}, documentDetectionThresholds), {
4130
4139
  focus: focusThresholds
@@ -4142,42 +4151,34 @@ function IdCaptureModelsProviderInner(_a) {
4142
4151
  var _this = this;
4143
4152
  onDocumentDetected(function (prediction) {
4144
4153
  return __awaiter(_this, void 0, void 0, function () {
4145
- var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isSinglePage, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4146
- var _a, _b, _c, _d, _e, _f, _g;
4147
- return __generator(this, function (_h) {
4154
+ var stopDetectionAtStart, focusPredictionTime, focusScore, focusThresholdMet, isRequiredDocumentType, focusPrediction, focusThresholdSet, focusThreshold;
4155
+ var _a, _b, _c, _d, _e, _f;
4156
+ return __generator(this, function (_g) {
4148
4157
  if (!lastPredictionCanvas.current) return [2 /*return*/];
4149
4158
  stopDetectionAtStart = stopDetection.current;
4150
4159
  focusPredictionTime = 0, focusScore = 0, focusThresholdMet = false;
4151
- isSinglePage = prediction.detectedDocumentType === 'singlePage';
4152
- if (!allowSinglePageIdCapture && isSinglePage) {
4153
- prediction.detectedDocumentType = 'passport';
4154
- prediction.passportDetectionScore = prediction.singlePageDetectionScore;
4155
- prediction.passportDetectionThresholdMet = prediction.singlePageDetectionThresholdMet;
4156
- prediction.singlePageDetectionScore = 0;
4157
- prediction.singlePageDetectionThresholdMet = false;
4158
- }
4159
- 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'));
4160
+ isRequiredDocumentType = requiredDocumentType === 'none' || prediction.detectedDocumentType === requiredDocumentType || ((_a = requiredDocumentType.includes) === null || _a === void 0 ? void 0 : _a.call(requiredDocumentType, prediction.detectedDocumentType));
4160
4161
  if (isRequiredDocumentType && prediction.detectedDocumentType !== 'none' && prediction.detectionThresholdMet && prediction.documentInBounds && !prediction.documentTooClose && prediction.documentIsStable) {
4161
- focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_c = prediction.bestDocument) === null || _c === void 0 ? void 0 : _c.box);
4162
+ focusPrediction = makeFocusPrediction(lastPredictionCanvas.current, (_b = prediction.bestDocument) === null || _b === void 0 ? void 0 : _b.box);
4162
4163
  if (focusPrediction) {
4163
4164
  focusScore = focusPrediction.score;
4164
4165
  focusPredictionTime = focusPrediction.predictionTime;
4165
4166
  }
4166
- focusThresholdSet = (_d = thresholds.focus) === null || _d === void 0 ? void 0 : _d[prediction.detectedDocumentType];
4167
- 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;
4167
+ focusThresholdSet = (_c = thresholds.focus) === null || _c === void 0 ? void 0 : _c[prediction.detectedDocumentType];
4168
+ 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;
4168
4169
  focusThresholdMet = focusScore >= focusThreshold;
4169
4170
  if (bestFocusScore.current <= focusScore && stopDetectionAtStart === stopDetection.current) {
4170
4171
  bestFocusScore.current = focusScore;
4171
4172
  drawToCanvas(bestPredictionCanvas.current, lastPredictionCanvas.current);
4172
4173
  bestFrameDetails.current = {
4173
- boundingBox: (_f = prediction.bestDocument) === null || _f === void 0 ? void 0 : _f.box,
4174
+ boundingBox: (_e = prediction.bestDocument) === null || _e === void 0 ? void 0 : _e.box,
4174
4175
  documentType: prediction.detectedDocumentType,
4175
4176
  detectionScore: prediction.detectionScore,
4176
4177
  focusScore: focusScore
4177
4178
  };
4178
4179
  }
4179
4180
  }
4180
- (_g = onPredictionHandler.current) === null || _g === void 0 ? void 0 : _g.call(onPredictionHandler, _assign(_assign({}, prediction), {
4181
+ (_f = onPredictionHandler.current) === null || _f === void 0 ? void 0 : _f.call(onPredictionHandler, _assign(_assign({}, prediction), {
4181
4182
  focusScore: focusScore,
4182
4183
  focusPredictionTime: focusPredictionTime,
4183
4184
  focusThresholdMet: focusThresholdMet
@@ -4186,10 +4187,10 @@ function IdCaptureModelsProviderInner(_a) {
4186
4187
  });
4187
4188
  });
4188
4189
  });
4189
- }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4190
+ }, [lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4190
4191
  var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
4191
4192
  useEffect(function handleModelErrors() {
4192
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
4193
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
4193
4194
  }, [modelError, onModelError]);
4194
4195
  var onPredictionMade = useCallback(function (handler) {
4195
4196
  onPredictionHandler.current = handler;
@@ -4200,9 +4201,9 @@ function IdCaptureModelsProviderInner(_a) {
4200
4201
  canvas: bestPredictionCanvas.current
4201
4202
  });
4202
4203
  }, []);
4203
- var _f = useState(0),
4204
- canvasKey = _f[0],
4205
- setCanvasKey = _f[1];
4204
+ var _e = useState(0),
4205
+ canvasKey = _e[0],
4206
+ setCanvasKey = _e[1];
4206
4207
  var resetBestFrame = useCallback(function () {
4207
4208
  stopDetection.current += 1;
4208
4209
  setCanvasKey(function (n) {
@@ -4213,7 +4214,7 @@ function IdCaptureModelsProviderInner(_a) {
4213
4214
  bestFocusScore.current = 0;
4214
4215
  }, [clearDocumentDetectionLastPredictionCanvas]);
4215
4216
  useEffect(function () {
4216
- requiredDocumentType && resetBestFrame();
4217
+ if (requiredDocumentType) resetBestFrame();
4217
4218
  }, [requiredDocumentType, resetBestFrame]);
4218
4219
  var value = useMemo(function () {
4219
4220
  return {
@@ -4249,9 +4250,9 @@ function IdCaptureModelsProvider(_a) {
4249
4250
  return /*#__PURE__*/React__default.createElement(DocumentDetectionModelProvider, _assign({}, props), /*#__PURE__*/React__default.createElement(FocusModelProvider, _assign({}, props), /*#__PURE__*/React__default.createElement(IdCaptureModelsProviderInner, _assign({}, props), children)));
4250
4251
  }
4251
4252
 
4252
- var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'singlePage', 'selfie'];
4253
+ var CapturedDocumentTypeValues = ['idCardFront', 'idCardBack', 'passport', 'selfie'];
4253
4254
 
4254
- var acceptedDocumentTypesForIdCaptureRequirementOption = {
4255
+ var requiredDocumentsForOption = {
4255
4256
  idCardFront: ['idCardFront'],
4256
4257
  idCardBack: ['idCardBack'],
4257
4258
  passport: ['passport'],
@@ -4259,35 +4260,13 @@ var acceptedDocumentTypesForIdCaptureRequirementOption = {
4259
4260
  idCardAndPassport: ['idCardFront', 'idCardBack', 'passport'],
4260
4261
  idCardOrPassport: ['idCardFront', 'idCardBack', 'passport'] // this one is so weird
4261
4262
  };
4262
- function minImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4263
+ function requiredImageCountForOption(idCaptureRequirement) {
4263
4264
  if (idCaptureRequirement === 'idCardOrPassport') return 1;
4264
- return acceptedDocumentTypesForIdCaptureRequirementOption[idCaptureRequirement].length;
4265
+ return requiredDocumentsForOption[idCaptureRequirement].length;
4265
4266
  }
4266
- function maxImageCountForIdCaptureRequirementOption(idCaptureRequirement) {
4267
+ function allowedImageCountForOption(idCaptureRequirement) {
4267
4268
  if (idCaptureRequirement === 'idCardOrPassport') return 2;
4268
- return minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
4269
- }
4270
- function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, requestedDocumentType) {
4271
- var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
4272
- if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
4273
- var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
4274
- console.log({
4275
- capturedDocuments: capturedDocuments,
4276
- captureRequirement: captureRequirement
4277
- });
4278
- if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
4279
- acceptedTypes = acceptedTypes.filter(function (v) {
4280
- return !v.includes('idCard');
4281
- });
4282
- }
4283
- if (isIdCardOrPassport) {
4284
- acceptedTypes = acceptedTypes.filter(function (v) {
4285
- return v !== 'passport';
4286
- });
4287
- }
4288
- return acceptedTypes.filter(function (v) {
4289
- return !(v in capturedDocuments);
4290
- });
4269
+ return requiredImageCountForOption(idCaptureRequirement);
4291
4270
  }
4292
4271
 
4293
4272
  var initialState$4 = {
@@ -4326,8 +4305,6 @@ var initialState$4 = {
4326
4305
  idCardBackDetectionThresholdMet: false,
4327
4306
  passportDetectionScore: 0,
4328
4307
  passportDetectionThresholdMet: false,
4329
- singlePageDetectionScore: 0,
4330
- singlePageDetectionThresholdMet: false,
4331
4308
  focusScore: 0,
4332
4309
  focusThresholdMet: false,
4333
4310
  isGoodFrame: false,
@@ -4343,7 +4320,6 @@ var initialState$4 = {
4343
4320
  capturedDocuments: {},
4344
4321
  captureRequirement: 'idCardOrPassport',
4345
4322
  requestedDocumentType: 'idCardFront',
4346
- allowSinglePageIdCapture: false,
4347
4323
  allowIdCardBackToFrontCapture: false,
4348
4324
  operationStartedAt: null,
4349
4325
  captureStartedAt: null
@@ -4358,13 +4334,11 @@ var _reducer = function reducer(state, action) {
4358
4334
  var _c = action.payload,
4359
4335
  captureRequirement = _c.captureRequirement,
4360
4336
  precapturedDocuments = _c.precapturedDocuments,
4361
- allowSinglePageIdCapture = _c.allowSinglePageIdCapture,
4362
4337
  allowIdCardBackToFrontCapture = _c.allowIdCardBackToFrontCapture,
4363
4338
  enableOverrideWrongDocumentTypeDialog = _c.enableOverrideWrongDocumentTypeDialog,
4364
4339
  allowOverrideWrongDocumentTypeAfterMs = _c.allowOverrideWrongDocumentTypeAfterMs;
4365
4340
  var newState = _assign(_assign({}, state), {
4366
4341
  captureRequirement: captureRequirement,
4367
- allowSinglePageIdCapture: allowSinglePageIdCapture !== null && allowSinglePageIdCapture !== void 0 ? allowSinglePageIdCapture : false,
4368
4342
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture !== null && allowIdCardBackToFrontCapture !== void 0 ? allowIdCardBackToFrontCapture : false,
4369
4343
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
4370
4344
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
@@ -4432,8 +4406,6 @@ var _reducer = function reducer(state, action) {
4432
4406
  idCardBackDetectionThresholdMet = _d.idCardBackDetectionThresholdMet,
4433
4407
  passportDetectionScore = _d.passportDetectionScore,
4434
4408
  passportDetectionThresholdMet = _d.passportDetectionThresholdMet,
4435
- singlePageDetectionScore = _d.singlePageDetectionScore,
4436
- singlePageDetectionThresholdMet = _d.singlePageDetectionThresholdMet,
4437
4409
  bestDocument = _d.bestDocument,
4438
4410
  documentInBounds = _d.documentInBounds,
4439
4411
  documentTooClose = _d.documentTooClose,
@@ -4454,8 +4426,7 @@ var _reducer = function reducer(state, action) {
4454
4426
  }
4455
4427
  }
4456
4428
  }
4457
- var idCardDetected = detectedDocumentType.includes('idCard') || detectedDocumentType === 'singlePage';
4458
- var idCardDetectedButNotAllowed = idCardDetected && !state.captureRequirement.includes('idCard');
4429
+ var idCardDetectedButNotAllowed = detectedDocumentType.includes('idCard') && !state.captureRequirement.includes('idCard');
4459
4430
  var passportNotAllowed = !state.captureRequirement.toLowerCase().includes('passport');
4460
4431
  var idCardFrontWasCaptured = 'idCardFront' in state.capturedDocuments;
4461
4432
  var idCardBackWasCaptured = 'idCardBack' in state.capturedDocuments;
@@ -4515,8 +4486,6 @@ var _reducer = function reducer(state, action) {
4515
4486
  idCardBackDetectionThresholdMet: idCardBackDetectionThresholdMet,
4516
4487
  passportDetectionScore: passportDetectionScore,
4517
4488
  passportDetectionThresholdMet: passportDetectionThresholdMet,
4518
- singlePageDetectionScore: singlePageDetectionScore,
4519
- singlePageDetectionThresholdMet: singlePageDetectionThresholdMet,
4520
4489
  focusScore: focusScore,
4521
4490
  focusThresholdMet: focusThresholdMet,
4522
4491
  isGoodFrame: isGoodFrame,
@@ -4554,7 +4523,7 @@ var _reducer = function reducer(state, action) {
4554
4523
  });
4555
4524
  case 'documentCaptured':
4556
4525
  {
4557
- var newState = _assign(_assign({}, state), {
4526
+ var newState_1 = _assign(_assign({}, state), {
4558
4527
  capturing: false,
4559
4528
  captureFailed: false,
4560
4529
  allowOverrideFlipRequirement: false,
@@ -4563,42 +4532,64 @@ var _reducer = function reducer(state, action) {
4563
4532
  wrongDocumentTypePredictions: 0,
4564
4533
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_a = {}, _a[action.payload.documentType] = action.payload, _a))
4565
4534
  });
4566
- var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4535
+ var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
4536
+ return !(v in newState_1.capturedDocuments);
4537
+ });
4538
+ if (state.captureRequirement === 'idCardOrPassport') {
4539
+ if (state.requestedDocumentType === 'passport') {
4540
+ remainingRequirements = [];
4541
+ } else {
4542
+ remainingRequirements = remainingRequirements.filter(function (v) {
4543
+ return v !== 'passport';
4544
+ });
4545
+ }
4546
+ }
4567
4547
  if (remainingRequirements.length === 0) {
4568
- newState.captureState = 'complete';
4548
+ newState_1.captureState = 'complete';
4569
4549
  } else {
4570
- newState.requestedDocumentType = remainingRequirements[0];
4571
- if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
4572
- newState.captureState = 'requestingFlip';
4573
- newState.idCardFrontDetectionThresholdMet = false;
4574
- newState.idCardBackDetectionThresholdMet = false;
4575
- newState.passportDetectionThresholdMet = false;
4576
- newState.wrongDocumentTypePredictions = 0;
4550
+ newState_1.requestedDocumentType = remainingRequirements[0];
4551
+ if (state.requestedDocumentType === 'idCardFront' && newState_1.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_1.requestedDocumentType === 'idCardFront') {
4552
+ newState_1.captureState = 'requestingFlip';
4553
+ newState_1.idCardFrontDetectionThresholdMet = false;
4554
+ newState_1.idCardBackDetectionThresholdMet = false;
4555
+ newState_1.passportDetectionThresholdMet = false;
4556
+ newState_1.wrongDocumentTypePredictions = 0;
4577
4557
  }
4578
4558
  }
4579
- return newState;
4559
+ return newState_1;
4580
4560
  }
4581
4561
  case 'documentCapturedManually':
4582
4562
  {
4583
- var newState = _assign(_assign({}, state), {
4563
+ var newState_2 = _assign(_assign({}, state), {
4584
4564
  capturedDocuments: _assign(_assign({}, state.capturedDocuments), (_b = {}, _b[state.requestedDocumentType] = _assign(_assign({}, action.payload), {
4585
4565
  width: 0,
4586
4566
  height: 0
4587
4567
  }), _b))
4588
4568
  });
4589
- var remainingRequirements = remainingIdCaptureRequirements(state.captureRequirement, newState.capturedDocuments, state.requestedDocumentType);
4569
+ var remainingRequirements = requiredDocumentsForOption[state.captureRequirement].filter(function (v) {
4570
+ return !(v in newState_2.capturedDocuments);
4571
+ });
4572
+ if (state.captureRequirement === 'idCardOrPassport') {
4573
+ if (state.requestedDocumentType === 'passport') {
4574
+ remainingRequirements = [];
4575
+ } else {
4576
+ remainingRequirements = remainingRequirements.filter(function (v) {
4577
+ return v !== 'passport';
4578
+ });
4579
+ }
4580
+ }
4590
4581
  if (remainingRequirements.length === 0) {
4591
- newState.captureState = 'complete';
4582
+ newState_2.captureState = 'complete';
4592
4583
  } else {
4593
- newState.requestedDocumentType = remainingRequirements[0];
4594
- if (state.requestedDocumentType === 'idCardFront' && newState.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState.requestedDocumentType === 'idCardFront') {
4595
- newState.captureState = 'requestingFlip';
4596
- newState.idCardFrontDetectionThresholdMet = false;
4597
- newState.idCardBackDetectionThresholdMet = false;
4598
- newState.passportDetectionThresholdMet = false;
4584
+ newState_2.requestedDocumentType = remainingRequirements[0];
4585
+ if (state.requestedDocumentType === 'idCardFront' && newState_2.requestedDocumentType === 'idCardBack' || state.requestedDocumentType === 'idCardBack' && newState_2.requestedDocumentType === 'idCardFront') {
4586
+ newState_2.captureState = 'requestingFlip';
4587
+ newState_2.idCardFrontDetectionThresholdMet = false;
4588
+ newState_2.idCardBackDetectionThresholdMet = false;
4589
+ newState_2.passportDetectionThresholdMet = false;
4599
4590
  }
4600
4591
  }
4601
- return newState;
4592
+ return newState_2;
4602
4593
  }
4603
4594
  case 'flipRequestCompleted':
4604
4595
  return _assign(_assign({}, state), {
@@ -5199,7 +5190,7 @@ var IdCapture = function IdCapture(_a) {
5199
5190
  imageUrl: imageUrl
5200
5191
  }
5201
5192
  });
5202
- var capturedDocumentType = documentType;
5193
+ var capturedDocumentType = documentType === 'passport' ? 'passport' : state.requestedDocumentType;
5203
5194
  setTimeout(function () {
5204
5195
  var _a;
5205
5196
  var captureTime = new Date().getTime() - ((_a = state.captureStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
@@ -5266,7 +5257,7 @@ var IdCapture = function IdCapture(_a) {
5266
5257
  scaling: debugScalingDetails,
5267
5258
  flipX: !isRearFacing
5268
5259
  });
5269
- }))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__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__default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.singlePageDetectionThresholdMet ? '✅' : '❌', " Single Page Score: ", state.singlePageDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u274C Models not ready")))));
5260
+ }))), debugMode && ( /*#__PURE__*/React__default.createElement(DebugStatsPane, null, camera ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u2705 Camera: ", camera.label, " (", camera.width, "x", camera.height, ")")) : '❌ Camera not ready', /*#__PURE__*/React__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__default.createElement("br", null), modelsReady ? ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, state.detectionThresholdMet ? '✅' : '❌', " Detected Document Type: ", state.detectedDocumentType, /*#__PURE__*/React__default.createElement("br", null), state.idCardFrontDetectionThresholdMet ? '✅' : '❌', " ID Card Front Score: ", state.idCardFrontDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.idCardBackDetectionThresholdMet ? '✅' : '❌', " ID Card Back Score: ", state.idCardBackDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.passportDetectionThresholdMet ? '✅' : '❌', " Passport Score: ", state.passportDetectionScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.focusThresholdMet ? '✅' : '❌', " Focus Score:", ' ', state.focusScore.toFixed(3), /*#__PURE__*/React__default.createElement("br", null), state.documentInBounds ? '✅' : '❌', " Document In Bounds", /*#__PURE__*/React__default.createElement("br", null), state.documentIsStable ? '✅' : '❌', " Document Is Stable", /*#__PURE__*/React__default.createElement("br", null), state.goodFramesThresholdMet ? '✅' : '❌', " Good Frame Count:", ' ', state.goodFramesCount, "/", state.goodFramesThreshold)) : ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, "\u274C Models not ready")))));
5270
5261
  };
5271
5262
  var timeSince = function timeSince(t) {
5272
5263
  if (!t) return 0;
@@ -6305,8 +6296,15 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6305
6296
  _e = _a.debugMode,
6306
6297
  debugMode = _e === void 0 ? false : _e;
6307
6298
  var submissionStatus = useContext(SubmissionContext).submissionStatus;
6299
+ var idCardFront = capturedDocuments.idCardFront,
6300
+ idCardBack = capturedDocuments.idCardBack,
6301
+ passport = capturedDocuments.passport;
6308
6302
  var verbiage = useTranslations(rawVerbiage, {
6309
6303
  headingText: 'ID Capture Successful',
6304
+ idCardFrontText: 'ID Card Front',
6305
+ idCardBackText: 'ID Card Back',
6306
+ passportText: 'Passport',
6307
+ instructionText: 'Verify the entire ID was captured clearly with no glare.',
6310
6308
  retryText: 'Retry',
6311
6309
  submittingText: 'Submitting...',
6312
6310
  submitText: 'Done'
@@ -6323,16 +6321,25 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6323
6321
  className: classNames.imageContainer
6324
6322
  }, /*#__PURE__*/React__default.createElement(ImageRow, {
6325
6323
  className: classNames.imageRow
6326
- }, Object.values(capturedDocuments).map(function (doc) {
6327
- return /*#__PURE__*/React__default.createElement(ImageCol$1, {
6328
- className: classNames.imageCol,
6329
- key: doc.imageData
6330
- }, /*#__PURE__*/React__default.createElement(StyledImage, {
6331
- image: doc,
6332
- className: classNames.image,
6333
- alt: doc.documentType
6334
- }), debugMode && ( /*#__PURE__*/React__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)))));
6335
- }))), /*#__PURE__*/React__default.createElement(ButtonsColumn, {
6324
+ }, idCardFront && ( /*#__PURE__*/React__default.createElement(ImageCol$1, {
6325
+ className: classNames.imageCol
6326
+ }, /*#__PURE__*/React__default.createElement(StyledImage, {
6327
+ image: idCardFront,
6328
+ className: classNames.image,
6329
+ alt: verbiage.idCardFrontText
6330
+ }), debugMode && ( /*#__PURE__*/React__default.createElement(DebugPre, null, "Detection Score: ".concat(idCardFront.detectionScore, "\nFocus Score: ").concat(idCardFront.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardFront.boundingBox)))))), idCardBack && ( /*#__PURE__*/React__default.createElement(ImageCol$1, {
6331
+ className: classNames.imageCol
6332
+ }, /*#__PURE__*/React__default.createElement(StyledImage, {
6333
+ image: idCardBack,
6334
+ className: classNames.image,
6335
+ alt: verbiage.idCardBackText
6336
+ }), debugMode && ( /*#__PURE__*/React__default.createElement(DebugPre, null, "Detection Score: ".concat(idCardBack.detectionScore, "\nFocus Score: ").concat(idCardBack.focusScore, "\nBounding Box: ").concat(JSON.stringify(idCardBack.boundingBox)))))), passport && ( /*#__PURE__*/React__default.createElement(ImageCol$1, {
6337
+ className: classNames.imageCol
6338
+ }, /*#__PURE__*/React__default.createElement(StyledImage, {
6339
+ image: passport,
6340
+ className: classNames.image,
6341
+ alt: verbiage.passportText
6342
+ }), debugMode && ( /*#__PURE__*/React__default.createElement(DebugPre, null, "Detection Score: ".concat(passport.detectionScore, "\nFocus Score: ").concat(passport.focusScore, "\nBounding Box: ").concat(JSON.stringify(passport.boundingBox)))))))), /*#__PURE__*/React__default.createElement(ButtonsColumn, {
6336
6343
  className: classNames.buttonsRow
6337
6344
  }, /*#__PURE__*/React__default.createElement(WideButton, {
6338
6345
  className: classNames.submitBtn,
@@ -6351,7 +6358,7 @@ var IdCaptureSuccess = function IdCaptureSuccess(_a) {
6351
6358
  };
6352
6359
  var Heading$a = styled.h1(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n font-size: 1.5rem;\n margin-top: 0;\n margin-bottom: 1.5rem;\n"], ["\n font-size: 1.5rem;\n margin-top: 0;\n margin-bottom: 1.5rem;\n"])));
6353
6360
  var ImagesContainer = styled(OverlayImageContainer)(templateObject_2$q || (templateObject_2$q = __makeTemplateObject(["\n flex-grow: 1;\n overflow-y: auto;\n padding-bottom: 0;\n max-width: 100%;\n"], ["\n flex-grow: 1;\n overflow-y: auto;\n padding-bottom: 0;\n max-width: 100%;\n"])));
6354
- var ImageRow = styled(OverlayImageRow)(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n"], ["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n"])));
6361
+ var ImageRow = styled(OverlayImageRow)(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n //grid-template-columns: 1fr 1fr;\n"], ["\n max-width: 100%;\n flex-direction: column;\n display: grid;\n grid-gap: 12px;\n //grid-template-columns: 1fr 1fr;\n"])));
6355
6362
  var ImageCol$1 = styled.div(templateObject_4$e || (templateObject_4$e = __makeTemplateObject(["\n width: 100%;\n max-height: none !important;\n"], ["\n width: 100%;\n max-height: none !important;\n"])));
6356
6363
  var StyledImage = styled(CapturedDocumentImg)(templateObject_5$9 || (templateObject_5$9 = __makeTemplateObject(["\n width: 100%;\n border-radius: 12px;\n"], ["\n width: 100%;\n border-radius: 12px;\n"])));
6357
6364
  var DebugPre = styled.pre(templateObject_6$7 || (templateObject_6$7 = __makeTemplateObject(["\n text-align: left;\n max-width: min(450px, 100dvw - 100px);\n overflow-x: auto;\n"], ["\n text-align: left;\n max-width: min(450px, 100dvw - 100px);\n overflow-x: auto;\n"])));
@@ -6935,7 +6942,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
6935
6942
  });
6936
6943
  }, [setDimensions, wrapperHeight, wrapperWidth]);
6937
6944
  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;
6938
- var paddingAndBorderPx = padding * 2 + borderWidth * 2;
6945
+ var paddingAndBorderPx = padding * 2 + (borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0) * 2;
6939
6946
  var images = useImagesWithBackToFront(userSuppliedImages, isBackToFront);
6940
6947
  var imagesByUrl = useGuideImagesByUrl(images);
6941
6948
  var orientation = getOrientation(portraitGuidesOnMobile);
@@ -6982,7 +6989,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
6982
6989
  "$isMirrored": isMirrored,
6983
6990
  className: classNames.centerRegion
6984
6991
  }, /*#__PURE__*/React__default.createElement(GuideCenterBorder, {
6985
- "$borderWidth": borderWidth,
6992
+ "$borderWidth": borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0,
6986
6993
  "$borderColor": borderColor,
6987
6994
  "$padding": imagePadding,
6988
6995
  className: classNames.centerRegionBorder
@@ -7182,7 +7189,7 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
7182
7189
  }, [aspectRatio, borderColor, borderRadius, borderWidth, dispatch, maskColor, padding, redrawing, wrapperHeight, wrapperWidth]);
7183
7190
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CanvasWrapper$1, {
7184
7191
  ref: wrapperRef,
7185
- "$maskColor": maskColor,
7192
+ "$maskColor": maskColor !== null && maskColor !== void 0 ? maskColor : '',
7186
7193
  className: classNames.canvasWrapper
7187
7194
  }, /*#__PURE__*/React__default.createElement(Canvas$1, {
7188
7195
  ref: canvasRef,
@@ -7477,7 +7484,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7477
7484
  var uploadDocument = useContext(SubmissionContext).uploadDocument;
7478
7485
  var uploadCapturedDocument = useCallback(function (content, filetype) {
7479
7486
  return __awaiter(void 0, void 0, void 0, function () {
7480
- var documentId_1;
7487
+ var documentId_1, e_1;
7481
7488
  return __generator(this, function (_a) {
7482
7489
  switch (_a.label) {
7483
7490
  case 0:
@@ -7500,7 +7507,8 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7500
7507
  }, 0);
7501
7508
  return [3 /*break*/, 3];
7502
7509
  case 2:
7503
- _a.sent();
7510
+ e_1 = _a.sent();
7511
+ debug('upload failed', e_1);
7504
7512
  dispatch({
7505
7513
  type: 'uploadFailed'
7506
7514
  });
@@ -7535,7 +7543,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7535
7543
  resolvedDocuments.forEach(function (d) {
7536
7544
  if (d.content) {
7537
7545
  d.contentUrl || (d.contentUrl = URL.createObjectURL(d.content));
7538
- uploadCapturedDocument(d.content, d.content.type);
7546
+ void uploadCapturedDocument(d.content, d.content.type);
7539
7547
  }
7540
7548
  });
7541
7549
  }, [aspectRatio, cameraFeedMode, documents, instructions, uploadCapturedDocument]);
@@ -7733,6 +7741,7 @@ var CameraVideoTag = function CameraVideoTag(props) {
7733
7741
  useEffect(function attachCameraStreamToVideoTagWhenReady() {
7734
7742
  if (videoRef.current && videoStream) {
7735
7743
  debug('attaching camera stream to video tag');
7744
+ // eslint-disable-next-line react-compiler/react-compiler
7736
7745
  videoRef.current.srcObject = videoStream;
7737
7746
  }
7738
7747
  }, [videoStream, videoRef]);
@@ -8059,8 +8068,8 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8059
8068
  var _j = useState(silentFallback),
8060
8069
  useFallback = _j[0],
8061
8070
  setUseFallback = _j[1];
8062
- var minImageCount = minImageCountForIdCaptureRequirementOption(idCaptureRequirement);
8063
- var maxImageCount = maxImageCountForIdCaptureRequirementOption(idCaptureRequirement);
8071
+ var allowedImageCount = allowedImageCountForOption(idCaptureRequirement);
8072
+ var requiredImageCount = requiredImageCountForOption(idCaptureRequirement);
8064
8073
  var _k = useFileState(),
8065
8074
  rawFile = _k.rawFile,
8066
8075
  fileInputOnChange = _k.fileInputOnChange;
@@ -8073,7 +8082,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8073
8082
  var whatToCapture = idCaptureRequirement === 'idCard' ? 'ID card' : idCaptureRequirement === 'passport' ? 'passport' : idCaptureRequirement === 'idCardOrPassport' ? 'ID card or passport' : 'ID card and passport';
8074
8083
  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.';
8075
8084
  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.';
8076
- var descriptionText = "On-device capture guidance failed, please capture ".concat(minImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
8085
+ var descriptionText = "On-device capture guidance failed, please capture ".concat(requiredImageCount > 1 ? 'photos' : ' a photo', " of your ").concat(whatToCapture, " manually.");
8077
8086
  var verbiage = useTranslations(rawVerbiage, {
8078
8087
  headingText: "We're having some trouble.",
8079
8088
  descriptionText: descriptionText,
@@ -8147,7 +8156,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8147
8156
  alt: "",
8148
8157
  className: classNames.image
8149
8158
  }));
8150
- }))), images.length < minImageCount && ( /*#__PURE__*/React__default.createElement(Instruction, {
8159
+ }))), images.length < requiredImageCount && ( /*#__PURE__*/React__default.createElement(Instruction, {
8151
8160
  className: classNames.instruction
8152
8161
  }, instructionText)), /*#__PURE__*/React__default.createElement("input", {
8153
8162
  ref: fileInput,
@@ -8158,7 +8167,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8158
8167
  hidden: true
8159
8168
  }), /*#__PURE__*/React__default.createElement(StyledButtonsRow$8, {
8160
8169
  className: classNames.buttonsRow
8161
- }, images.length < maxImageCount && ( /*#__PURE__*/React__default.createElement(LoaderButton, {
8170
+ }, images.length < allowedImageCount && ( /*#__PURE__*/React__default.createElement(LoaderButton, {
8162
8171
  variant: images.length > 0 ? 'secondary' : 'positive',
8163
8172
  className: images.length > 0 ? classNames.captureMoreBtn : classNames.captureBtn,
8164
8173
  colors: images.length > 0 ? colors.captureMoreBtn : colors.captureBtn,
@@ -8171,7 +8180,7 @@ var IdCaptureFallback = function IdCaptureFallback(_a) {
8171
8180
  setDocumentToCapture(instructionText);
8172
8181
  }
8173
8182
  }
8174
- }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= minImageCount && ( /*#__PURE__*/React__default.createElement(LoaderButton, {
8183
+ }, images.length > 0 ? verbiage.captureMoreBtnText : verbiage.captureBtnText)), images.length >= requiredImageCount && ( /*#__PURE__*/React__default.createElement(LoaderButton, {
8175
8184
  variant: "positive",
8176
8185
  className: classNames.doneBtn,
8177
8186
  colors: colors.doneBtn,
@@ -8218,90 +8227,91 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8218
8227
  precapturedDocuments = _a.precapturedDocuments,
8219
8228
  _j = _a.captureRequirement,
8220
8229
  captureRequirement = _j === void 0 ? 'idCardOrPassport' : _j,
8221
- _k = _a.allowSinglePageIdCapture,
8222
- allowSinglePageIdCapture = _k === void 0 ? false : _k,
8223
- _l = _a.separateIdCardCaptureSequence,
8224
- separateIdCardCaptureSequence = _l === void 0 ? false : _l,
8225
- _m = _a.thresholds,
8226
- thresholds = _m === void 0 ? defaultIdCaptureThresholds : _m,
8227
- _o = _a.skipSuccessScreen,
8228
- skipSuccessScreen = _o === void 0 ? false : _o,
8230
+ _k = _a.separateIdCardCaptureSequence,
8231
+ separateIdCardCaptureSequence = _k === void 0 ? false : _k,
8232
+ _l = _a.thresholds,
8233
+ thresholds = _l === void 0 ? defaultIdCaptureThresholds : _l,
8234
+ _m = _a.skipSuccessScreen,
8235
+ skipSuccessScreen = _m === void 0 ? false : _m,
8229
8236
  instructions = _a.instructions,
8230
- _p = _a.releaseCameraAccessOnExit,
8231
- releaseCameraAccessOnExit = _p === void 0 ? true : _p,
8232
- _q = _a.guideType,
8233
- guideType = _q === void 0 ? 'fit' : _q,
8234
- _r = _a.portraitGuidesOnMobile,
8235
- portraitGuidesOnMobile = _r === void 0 ? true : _r,
8236
- _s = _a.rotateLoadingOverlayImageWhenPortrait,
8237
- rotateLoadingOverlayImageWhenPortrait = _s === void 0 ? true : _s,
8238
- _t = _a.silentFallback,
8239
- silentFallback = _t === void 0 ? false : _t,
8240
- _u = _a.forceFallbackMode,
8241
- forceFallbackMode = _u === void 0 ? false : _u,
8242
- _v = _a.allowIdCardBackToFrontCapture,
8243
- allowIdCardBackToFrontCapture = _v === void 0 ? false : _v,
8244
- _w = _a.enableOverrideWrongDocumentTypeDialog,
8245
- enableOverrideWrongDocumentTypeDialog = _w === void 0 ? false : _w,
8246
- _x = _a.allowOverrideWrongDocumentTypeAfterMs,
8247
- allowOverrideWrongDocumentTypeAfterMs = _x === void 0 ? 8000 : _x,
8248
- _y = _a.guideImages,
8249
- guideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
8250
- _z = _a.assets,
8251
- assets = _z === void 0 ? {} : _z,
8252
- _0 = _a.classNames,
8253
- classNames = _0 === void 0 ? {} : _0,
8254
- _1 = _a.colors,
8255
- colors = _1 === void 0 ? {} : _1,
8256
- _2 = _a.verbiage,
8257
- verbiage = _2 === void 0 ? {} : _2,
8258
- _3 = _a.debugMode,
8259
- debugMode = _3 === void 0 ? false : _3;
8260
- var _4 = useIdCaptureState(),
8261
- state = _4[0],
8262
- dispatch = _4[1];
8263
- var _5 = useCameraStore(),
8264
- cameraAccessDenied = _5.cameraAccessDenied,
8265
- requestCameraAccess = _5.requestCameraAccess,
8266
- releaseCameraAccess = _5.releaseCameraAccess;
8267
- var _6 = useState(false),
8268
- overlayDismissed = _6[0],
8269
- setOverlayDismissed = _6[1];
8270
- var _7 = useContext(SubmissionContext),
8271
- submissionStatus = _7.submissionStatus,
8272
- setIdFrontImage = _7.setIdFrontImage,
8273
- setIdBackImage = _7.setIdBackImage,
8274
- setPassportImage = _7.setPassportImage,
8275
- logIdFrontCaptureAttempt = _7.logIdFrontCaptureAttempt,
8276
- logIdBackCaptureAttempt = _7.logIdBackCaptureAttempt;
8277
- var _8 = useContext(IdCaptureModelsContext),
8278
- start = _8.start,
8279
- stop = _8.stop,
8280
- onPredictionMade = _8.onPredictionMade,
8281
- setRequiredDocumentType = _8.setRequiredDocumentType,
8282
- modelError = _8.modelError,
8283
- resetBestFrame = _8.resetBestFrame;
8237
+ _o = _a.releaseCameraAccessOnExit,
8238
+ releaseCameraAccessOnExit = _o === void 0 ? true : _o,
8239
+ _p = _a.guideType,
8240
+ guideType = _p === void 0 ? 'fit' : _p,
8241
+ _q = _a.portraitGuidesOnMobile,
8242
+ portraitGuidesOnMobile = _q === void 0 ? true : _q,
8243
+ _r = _a.rotateLoadingOverlayImageWhenPortrait,
8244
+ rotateLoadingOverlayImageWhenPortrait = _r === void 0 ? true : _r,
8245
+ _s = _a.silentFallback,
8246
+ silentFallback = _s === void 0 ? false : _s,
8247
+ _t = _a.forceFallbackMode,
8248
+ forceFallbackMode = _t === void 0 ? false : _t,
8249
+ _u = _a.allowIdCardBackToFrontCapture,
8250
+ allowIdCardBackToFrontCapture = _u === void 0 ? false : _u,
8251
+ _v = _a.enableOverrideWrongDocumentTypeDialog,
8252
+ enableOverrideWrongDocumentTypeDialog = _v === void 0 ? false : _v,
8253
+ _w = _a.allowOverrideWrongDocumentTypeAfterMs,
8254
+ allowOverrideWrongDocumentTypeAfterMs = _w === void 0 ? 8000 : _w,
8255
+ _x = _a.guideImages,
8256
+ guideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
8257
+ _y = _a.assets,
8258
+ assets = _y === void 0 ? {} : _y,
8259
+ _z = _a.classNames,
8260
+ classNames = _z === void 0 ? {} : _z,
8261
+ _0 = _a.colors,
8262
+ colors = _0 === void 0 ? {} : _0,
8263
+ _1 = _a.verbiage,
8264
+ verbiage = _1 === void 0 ? {} : _1,
8265
+ _2 = _a.debugMode,
8266
+ debugMode = _2 === void 0 ? false : _2;
8267
+ var _3 = useIdCaptureState(),
8268
+ state = _3[0],
8269
+ dispatch = _3[1];
8270
+ var _4 = useCameraStore(),
8271
+ cameraAccessDenied = _4.cameraAccessDenied,
8272
+ requestCameraAccess = _4.requestCameraAccess,
8273
+ releaseCameraAccess = _4.releaseCameraAccess;
8274
+ var _5 = useState(false),
8275
+ overlayDismissed = _5[0],
8276
+ setOverlayDismissed = _5[1];
8277
+ var _6 = useContext(SubmissionContext),
8278
+ submissionStatus = _6.submissionStatus,
8279
+ setIdFrontImage = _6.setIdFrontImage,
8280
+ setIdBackImage = _6.setIdBackImage,
8281
+ setPassportImage = _6.setPassportImage,
8282
+ logIdFrontCaptureAttempt = _6.logIdFrontCaptureAttempt,
8283
+ logIdBackCaptureAttempt = _6.logIdBackCaptureAttempt;
8284
+ var _7 = useContext(IdCaptureModelsContext),
8285
+ start = _7.start,
8286
+ stop = _7.stop,
8287
+ onPredictionMade = _7.onPredictionMade,
8288
+ setRequiredDocumentType = _7.setRequiredDocumentType,
8289
+ modelError = _7.modelError,
8290
+ resetBestFrame = _7.resetBestFrame;
8284
8291
  useEffect(function () {
8285
8292
  dispatch({
8286
8293
  type: 'configureWizard',
8287
8294
  payload: {
8288
8295
  captureRequirement: captureRequirement,
8289
8296
  precapturedDocuments: precapturedDocuments,
8290
- allowSinglePageIdCapture: allowSinglePageIdCapture,
8291
8297
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
8292
8298
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
8293
8299
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs
8294
8300
  }
8295
8301
  });
8296
- }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8302
+ }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8297
8303
  var documentCount = Object.keys(state.capturedDocuments).length;
8298
8304
  useEffect(function () {
8299
- documentCount && resetBestFrame();
8305
+ if (documentCount) resetBestFrame();
8300
8306
  }, [documentCount, resetBestFrame]);
8301
8307
  var logCaptureMetadata = useCallback(function (metadata) {
8302
8308
  var _a;
8303
8309
  metadata.operationTime = new Date().getTime() - ((_a = state.operationStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
8304
- state.requestedDocumentType === 'idCardBack' ? logIdBackCaptureAttempt(metadata) : logIdFrontCaptureAttempt(metadata);
8310
+ if (state.requestedDocumentType === 'idCardBack') {
8311
+ logIdBackCaptureAttempt(metadata);
8312
+ } else {
8313
+ logIdFrontCaptureAttempt(metadata);
8314
+ }
8305
8315
  }, [logIdBackCaptureAttempt, logIdFrontCaptureAttempt, state.operationStartedAt, state.requestedDocumentType]);
8306
8316
  useEffect(function startModelsWhenCapturing() {
8307
8317
  if (!overlayDismissed || state.captureState !== 'capturing') return;
@@ -8351,17 +8361,14 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8351
8361
  var _a = state.capturedDocuments,
8352
8362
  idCardFront = _a.idCardFront,
8353
8363
  idCardBack = _a.idCardBack,
8354
- passport = _a.passport,
8355
- singlePage = _a.singlePage;
8364
+ passport = _a.passport;
8356
8365
  var idFrontImage = idCardFront && dataUrlToBase64Sync(idCardFront.imageData);
8357
8366
  var idBackImage = idCardBack && dataUrlToBase64Sync(idCardBack.imageData);
8358
8367
  var passportImage = passport && dataUrlToBase64Sync(passport.imageData);
8359
- var singlePageImage = singlePage && dataUrlToBase64Sync(singlePage.imageData);
8360
- idFrontImage && setIdFrontImage(idFrontImage);
8361
- idBackImage && setIdBackImage(idBackImage);
8362
- passportImage && setPassportImage(passportImage);
8363
- singlePageImage && setIdFrontImage(singlePageImage);
8364
- releaseCameraAccessOnExit && releaseCameraAccess();
8368
+ if (idFrontImage) setIdFrontImage(idFrontImage);
8369
+ if (idBackImage) setIdBackImage(idBackImage);
8370
+ if (passportImage) setPassportImage(passportImage);
8371
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
8365
8372
  setTimeout(function () {
8366
8373
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
8367
8374
  idFrontImage: idFrontImage,
@@ -8376,9 +8383,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8376
8383
  type: 'resetWizard'
8377
8384
  });
8378
8385
  }, [dispatch]);
8379
- var _9 = useState(0),
8380
- attempt = _9[0],
8381
- setAttempt = _9[1];
8386
+ var _8 = useState(0),
8387
+ attempt = _8[0],
8388
+ setAttempt = _8[1];
8382
8389
  var onExit = useCallback(function () {
8383
8390
  releaseCameraAccess();
8384
8391
  setOverlayDismissed(false);
@@ -8393,7 +8400,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8393
8400
  }, [dispatch, onExitCapture, releaseCameraAccess, requestCameraAccess]);
8394
8401
  useEffect(function () {
8395
8402
  if (submissionStatus !== SubmissionStatus.READY) {
8396
- releaseCameraAccessOnExit && releaseCameraAccess();
8403
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
8397
8404
  }
8398
8405
  }, [releaseCameraAccess, releaseCameraAccessOnExit, submissionStatus]);
8399
8406
  useEffect(function () {
@@ -8469,9 +8476,9 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8469
8476
  });
8470
8477
  });
8471
8478
  }, [dispatch]);
8472
- var _10 = useState(false),
8473
- progressStarted = _10[0],
8474
- setProgressStarted = _10[1];
8479
+ var _9 = useState(false),
8480
+ progressStarted = _9[0],
8481
+ setProgressStarted = _9[1];
8475
8482
  useEffect(function () {
8476
8483
  if (state.captureState === 'capturing') {
8477
8484
  setProgressStarted(false);
@@ -9574,19 +9581,25 @@ var SelfieCapture = function SelfieCapture(_a) {
9574
9581
  canvasRef = _v.canvasRef,
9575
9582
  guidanceError = _v.error;
9576
9583
  onPredictionMade(useThrottledCallback(useCallback(function (prediction) {
9577
- return new Promise(function (resolve) {
9578
- if (shouldCapture && !busy) {
9579
- drawToCanvas(lastPredictionCanvas.current, canvasRef.current);
9580
- dispatch({
9581
- type: 'facesDetected',
9582
- payload: prediction
9583
- });
9584
- }
9585
- resolve();
9584
+ return __awaiter(void 0, void 0, void 0, function () {
9585
+ return __generator(this, function (_a) {
9586
+ if (shouldCapture && !busy) {
9587
+ drawToCanvas(lastPredictionCanvas.current, canvasRef.current);
9588
+ dispatch({
9589
+ type: 'facesDetected',
9590
+ payload: prediction
9591
+ });
9592
+ }
9593
+ return [2 /*return*/];
9594
+ });
9586
9595
  });
9587
9596
  }, [canvasRef, shouldCapture, busy]), 16));
9588
9597
  useEffect(function () {
9589
- (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();
9598
+ if (prediction === null || prediction === void 0 ? void 0 : prediction.faceReady) {
9599
+ onGuidanceSatisfied === null || onGuidanceSatisfied === void 0 ? void 0 : onGuidanceSatisfied();
9600
+ } else {
9601
+ onGuidanceNotSatisfied === null || onGuidanceNotSatisfied === void 0 ? void 0 : onGuidanceNotSatisfied();
9602
+ }
9590
9603
  }, [onGuidanceNotSatisfied, onGuidanceSatisfied, prediction === null || prediction === void 0 ? void 0 : prediction.faceReady]);
9591
9604
  useEffect(function () {
9592
9605
  if (!(prediction === null || prediction === void 0 ? void 0 : prediction.faceReady)) return;
@@ -10584,7 +10597,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
10584
10597
  }, [logCaptureMetadata, releaseCameraAccess, requestCameraAccess]);
10585
10598
  var onDoneCallback = useCallback(function () {
10586
10599
  logCaptureMetadata();
10587
- releaseCameraAccessOnExit && releaseCameraAccess();
10600
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
10588
10601
  setTimeout(function () {
10589
10602
  onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse, livenessCheckRequest);
10590
10603
  }, 0);
@@ -10603,7 +10616,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
10603
10616
  onLoadingOverlayDismissed === null || onLoadingOverlayDismissed === void 0 ? void 0 : onLoadingOverlayDismissed();
10604
10617
  }, [onLoadingOverlayDismissed]);
10605
10618
  var onFailureExitClick = useCallback(function () {
10606
- releaseCameraAccessOnExit && releaseCameraAccess();
10619
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
10607
10620
  setTimeout(function () {
10608
10621
  onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure(submissionResponse, livenessCheckRequest);
10609
10622
  }, 0);
@@ -10957,16 +10970,15 @@ var SignatureButtonsContainer = styled(ButtonsRow)(templateObject_4$4 || (templa
10957
10970
  var templateObject_1$b, templateObject_2$9, templateObject_3$9, templateObject_4$4;
10958
10971
 
10959
10972
  var SignatureCapture = function SignatureCapture(_a) {
10960
- var _b;
10961
10973
  var onAccept = _a.onAccept,
10962
- _c = _a.classNames,
10963
- classNames = _c === void 0 ? {} : _c,
10964
- _d = _a.verbiage,
10965
- rawVerbiage = _d === void 0 ? {} : _d;
10966
- var _e = useResizeObserver(),
10967
- ref = _e.ref,
10968
- width = _e.width,
10969
- height = _e.height;
10974
+ _b = _a.classNames,
10975
+ classNames = _b === void 0 ? {} : _b,
10976
+ _c = _a.verbiage,
10977
+ rawVerbiage = _c === void 0 ? {} : _c;
10978
+ var _d = useResizeObserver(),
10979
+ ref = _d.ref,
10980
+ width = _d.width,
10981
+ height = _d.height;
10970
10982
  var signaturePad = useRef(null);
10971
10983
  var verbiage = useTranslations(rawVerbiage, {
10972
10984
  headingText: 'Please sign the box below',
@@ -11016,8 +11028,11 @@ var SignatureCapture = function SignatureCapture(_a) {
11016
11028
  }, /*#__PURE__*/React__default.createElement(LoaderButton, {
11017
11029
  variant: "secondary",
11018
11030
  className: classNames.clearBtn,
11019
- onClick: (_b = signaturePad.current) === null || _b === void 0 ? void 0 : _b.clear,
11020
- finished: true
11031
+ finished: true,
11032
+ onClick: function onClick() {
11033
+ var _a;
11034
+ (_a = signaturePad.current) === null || _a === void 0 ? void 0 : _a.clear();
11035
+ }
11021
11036
  }, verbiage.clearBtnText), /*#__PURE__*/React__default.createElement(AcceptBtn$1, {
11022
11037
  variant: "positive",
11023
11038
  className: classNames.acceptBtn,
@@ -11995,8 +12010,7 @@ var defaultVideoIdCaptureThresholds = {
11995
12010
  detection: {
11996
12011
  idCardFront: 0.4,
11997
12012
  idCardBack: 0.5,
11998
- passport: 0.3,
11999
- singlePage: 0.3
12013
+ passport: 0.3
12000
12014
  },
12001
12015
  focus: {
12002
12016
  idCardFront: {
@@ -12010,17 +12024,12 @@ var defaultVideoIdCaptureThresholds = {
12010
12024
  passport: {
12011
12025
  desktop: 0,
12012
12026
  mobile: 0
12013
- },
12014
- singlePage: {
12015
- desktop: 0,
12016
- mobile: 0
12017
12027
  }
12018
12028
  },
12019
12029
  goodFrames: {
12020
12030
  idCardFront: 1,
12021
12031
  idCardBack: 1,
12022
- passport: 1,
12023
- singlePage: 1
12032
+ passport: 1
12024
12033
  },
12025
12034
  flipShortcutThreshold: 0.7
12026
12035
  };
@@ -12092,7 +12101,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12092
12101
  stopIdModels = _18.stop,
12093
12102
  onIdPredictionMade = _18.onPredictionMade,
12094
12103
  setThresholds = _18.setThresholds,
12095
- setRequiredDocumentType = _18.setRequiredDocumentType,
12096
12104
  setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
12097
12105
  bestFrameDetails = _18.bestFrameDetails,
12098
12106
  resetBestFrame = _18.resetBestFrame,
@@ -12171,9 +12179,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12171
12179
  useEffect(function () {
12172
12180
  setThresholds(adjustedThresholds);
12173
12181
  }, [requestedAction, setThresholds, adjustedThresholds]);
12174
- useEffect(function () {
12175
- setRequiredDocumentType(requestedAction === 'SHOW_PASSPORT' ? 'passport' : requestedAction === 'SHOW_ID_BACK' ? 'idCardBack' : 'idCardFront');
12176
- }, [requestedAction, setRequiredDocumentType]);
12177
12182
  useEffect(function () {
12178
12183
  setDocumentDetectionBoundaries({
12179
12184
  top: 20,
@@ -12196,9 +12201,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12196
12201
  setGoodFramesCount = _28[1];
12197
12202
  var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
12198
12203
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
12199
- var _29 = useState(false),
12200
- isSinglePage = _29[0],
12201
- setIsSinglePage = _29[1];
12202
12204
  useEffect(function () {
12203
12205
  if (!idCaptureModelsEnabled || idModelError) return;
12204
12206
  onIdPredictionMade(function (prediction) {
@@ -12206,8 +12208,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12206
12208
  setCurrentDetectionScore(prediction.detectionScore);
12207
12209
  setCurrentDetectedDocumentType(prediction.detectedDocumentType);
12208
12210
  setCurrentFocusScore(prediction.focusScore);
12209
- setIsSinglePage(prediction.singlePageDetectionThresholdMet);
12210
- var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_BACK' ? prediction.idCardBackDetectionThresholdMet : prediction.idCardFrontDetectionThresholdMet || prediction.singlePageDetectionThresholdMet;
12211
+ var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
12211
12212
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
12212
12213
  var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
12213
12214
  if (shouldShortcutFlipAnimation) {
@@ -12218,9 +12219,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12218
12219
  } : 0);
12219
12220
  });
12220
12221
  }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
12221
- var _30 = useState(null),
12222
- idFrontCaptureStartedAt = _30[0],
12223
- setFirstGoodFrameTime = _30[1];
12222
+ var _29 = useState(null),
12223
+ idFrontCaptureStartedAt = _29[0],
12224
+ setFirstGoodFrameTime = _29[1];
12224
12225
  useEffect(function () {
12225
12226
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
12226
12227
  }, [goodFramesCount]);
@@ -12241,60 +12242,80 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12241
12242
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
12242
12243
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
12243
12244
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
12244
- var _31 = useState(),
12245
- countdownStartedAt = _31[0],
12246
- setCountdownStartedAt = _31[1];
12245
+ var _30 = useState(),
12246
+ countdownStartedAt = _30[0],
12247
+ setCountdownStartedAt = _30[1];
12247
12248
  var photoCanvas = useRef(null);
12248
12249
  var frameLock = useRef(false);
12249
12250
  var captureFrame = useCallback(function () {
12250
12251
  return __awaiter(void 0, void 0, void 0, function () {
12251
- var frameBase64;
12252
- return __generator(this, function (_a) {
12253
- if (frameLock.current) return [2 /*return*/];
12254
- frameLock.current = true;
12255
- drawToCanvas(photoCanvas.current, videoRef.current);
12256
- frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
12257
- if (!frameBase64) {
12258
- frameLock.current = false;
12259
- return [2 /*return*/];
12260
- }
12261
- try {
12262
- if (requestedAction == 'SHOW_ID_FRONT') {
12252
+ var frameBase64, _a;
12253
+ return __generator(this, function (_b) {
12254
+ switch (_b.label) {
12255
+ case 0:
12256
+ if (frameLock.current) return [2 /*return*/];
12257
+ frameLock.current = true;
12258
+ drawToCanvas(photoCanvas.current, videoRef.current);
12259
+ frameBase64 = photoCanvas.current.toDataURL('image/jpeg');
12260
+ if (!frameBase64) {
12261
+ frameLock.current = false;
12262
+ return [2 /*return*/];
12263
+ }
12264
+ _b.label = 1;
12265
+ case 1:
12266
+ _b.trys.push([1,, 7, 8]);
12267
+ if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
12263
12268
  if (onIdFrontImageCaptured) {
12264
12269
  onIdFrontImageCaptured(frameBase64);
12265
12270
  }
12266
- if (isSinglePage || evaluateShouldSkip(skipShowIdCardBack)) {
12271
+ if (!skipShowIdCardBack) return [3 /*break*/, 4];
12272
+ _a = skipShowIdCardBack === true;
12273
+ if (_a) return [3 /*break*/, 3];
12274
+ return [4 /*yield*/, skipShowIdCardBack()];
12275
+ case 2:
12276
+ _a = _b.sent();
12277
+ _b.label = 3;
12278
+ case 3:
12279
+ if (_a) {
12267
12280
  return [2 /*return*/, onIdCaptureComplete()];
12268
12281
  }
12282
+ _b.label = 4;
12283
+ case 4:
12269
12284
  setRequestedAction('FLIP_ID');
12270
- } else if (requestedAction == 'SHOW_ID_BACK') {
12271
- if (onIdBackImageCaptured) {
12272
- onIdBackImageCaptured(frameBase64);
12285
+ return [3 /*break*/, 6];
12286
+ case 5:
12287
+ if (requestedAction == 'SHOW_ID_BACK') {
12288
+ if (onIdBackImageCaptured) {
12289
+ onIdBackImageCaptured(frameBase64);
12290
+ }
12291
+ onIdCaptureComplete();
12292
+ } else if (requestedAction == 'SHOW_PASSPORT') {
12293
+ if (onIdFrontImageCaptured) {
12294
+ onIdFrontImageCaptured(frameBase64);
12295
+ }
12296
+ onIdCaptureComplete();
12273
12297
  }
12274
- onIdCaptureComplete();
12275
- } else if (requestedAction == 'SHOW_PASSPORT') {
12276
- if (onIdFrontImageCaptured) {
12277
- onIdFrontImageCaptured(frameBase64);
12298
+ _b.label = 6;
12299
+ case 6:
12300
+ return [3 /*break*/, 8];
12301
+ case 7:
12302
+ setDetectedObjects([]);
12303
+ setCurrentDetectionScore(0);
12304
+ setCurrentFocusScore(0);
12305
+ setGoodFramesCount(0);
12306
+ setCountdownStartedAt(undefined);
12307
+ resetBestFrame();
12308
+ frameLock.current = false;
12309
+ if (countdownTimeoutRef.current) {
12310
+ clearTimeout(countdownTimeoutRef.current);
12278
12311
  }
12279
- onIdCaptureComplete();
12280
- }
12281
- } finally {
12282
- setDetectedObjects([]);
12283
- setCurrentDetectionScore(0);
12284
- setCurrentFocusScore(0);
12285
- setGoodFramesCount(0);
12286
- setCountdownStartedAt(undefined);
12287
- setIsSinglePage(false);
12288
- resetBestFrame();
12289
- frameLock.current = false;
12290
- if (countdownTimeoutRef.current) {
12291
- clearTimeout(countdownTimeoutRef.current);
12292
- }
12312
+ return [7 /*endfinally*/];
12313
+ case 8:
12314
+ return [2 /*return*/];
12293
12315
  }
12294
- return [2 /*return*/];
12295
12316
  });
12296
12317
  });
12297
- }, [videoRef, requestedAction, onIdFrontImageCaptured, isSinglePage, skipShowIdCardBack, onIdCaptureComplete, onIdBackImageCaptured, resetBestFrame]);
12318
+ }, [onIdCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
12298
12319
  var isFlipping = requestedAction === 'FLIP_ID';
12299
12320
  useEffect(function () {
12300
12321
  if (!isFlipping) return;
@@ -12353,9 +12374,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12353
12374
  stopSelfieGuidance();
12354
12375
  };
12355
12376
  }, [startSelfieGuidance, stopSelfieGuidance]);
12356
- var _32 = useState(0),
12357
- numFramesWithoutFaces = _32[0],
12358
- setNumFramesWithoutFaces = _32[1];
12377
+ var _31 = useState(0),
12378
+ numFramesWithoutFaces = _31[0],
12379
+ setNumFramesWithoutFaces = _31[1];
12359
12380
  onSelfiePredictionMade(useThrottledCallback(useCallback(function (_a) {
12360
12381
  var face = _a.face;
12361
12382
  if (selfieModelError) return;
@@ -12371,12 +12392,12 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12371
12392
  }
12372
12393
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
12373
12394
  var theme = useTheme();
12374
- var _33 = useTranslations(rawVerbiage, {
12395
+ var _32 = useTranslations(rawVerbiage, {
12375
12396
  faceNotCenteredText: 'Please move your face to the center...',
12376
12397
  captureBtnText: 'Capture'
12377
12398
  }),
12378
- captureBtnText = _33.captureBtnText,
12379
- faceNotCenteredText = _33.faceNotCenteredText;
12399
+ captureBtnText = _32.captureBtnText,
12400
+ faceNotCenteredText = _32.faceNotCenteredText;
12380
12401
  var debugScalingDetails = useDebugScalingDetails({
12381
12402
  enabled: debugMode,
12382
12403
  pageWidth: width,
@@ -12451,11 +12472,6 @@ var CountdownContainer = styled.div(templateObject_1$5 || (templateObject_1$5 =
12451
12472
  var Countdown = styled.div(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"], ["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"])));
12452
12473
  var CaptureButtonContainer = styled.div(templateObject_3$5 || (templateObject_3$5 = __makeTemplateObject(["\n position: fixed;\n bottom: 0;\n width: 100dvw;\n display: flex;\n z-index: 100000;\n"], ["\n position: fixed;\n bottom: 0;\n width: 100dvw;\n display: flex;\n z-index: 100000;\n"])));
12453
12474
  var CaptureButton = styled(LoaderButton)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n margin: 0 auto 25px;\n"], ["\n margin: 0 auto 25px;\n"])));
12454
- function evaluateShouldSkip(value) {
12455
- if (value === true) return true;
12456
- if (typeof value === 'function') return value();
12457
- return false;
12458
- }
12459
12475
  var templateObject_1$5, templateObject_2$5, templateObject_3$5, templateObject_4;
12460
12476
 
12461
12477
  var IdVideoCaptureSuccess = function IdVideoCaptureSuccess(_a) {
@@ -12673,7 +12689,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12673
12689
  return __awaiter(void 0, void 0, void 0, function () {
12674
12690
  return __generator(this, function (_a) {
12675
12691
  setIdCaptureVideoUrl(videoUrl);
12676
- audioUrl && setIdCaptureVideoAudioUrl(audioUrl);
12692
+ if (audioUrl) setIdCaptureVideoAudioUrl(audioUrl);
12677
12693
  setCaptureState('SUCCESS');
12678
12694
  if (skipSuccessScreen) onComplete === null || onComplete === void 0 ? void 0 : onComplete();
12679
12695
  return [2 /*return*/];
@@ -12749,8 +12765,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12749
12765
  documentDetectionModelUrl: (_g = (_f = idCaptureProps.assets) === null || _f === void 0 ? void 0 : _f.documentDetectionModelUrl) !== null && _g !== void 0 ? _g : '',
12750
12766
  focusModelUrl: (_j = (_h = idCaptureProps.assets) === null || _h === void 0 ? void 0 : _h.focusModelUrl) !== null && _j !== void 0 ? _j : '',
12751
12767
  onModelError: onIdCaptureModelError,
12752
- modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
12753
- allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
12768
+ modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs
12754
12769
  }, /*#__PURE__*/React__default.createElement(SelfieGuidanceModelsProvider, {
12755
12770
  autoStart: false,
12756
12771
  onModelError: faceLivenessProps === null || faceLivenessProps === void 0 ? void 0 : faceLivenessProps.onModelError,
@@ -13000,8 +13015,7 @@ function CompositeWizard(_a) {
13000
13015
  documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
13001
13016
  focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
13002
13017
  onModelError: idCaptureProps.onModelError,
13003
- modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs,
13004
- allowSinglePageIdCapture: idCaptureProps.allowSinglePageIdCapture
13018
+ modelLoadTimeoutMs: idCaptureProps.modelLoadTimeoutMs
13005
13019
  }, /*#__PURE__*/React__default.createElement(IdCaptureStateProvider, null, /*#__PURE__*/React__default.createElement(GuideOrientationContextProvider, null, /*#__PURE__*/React__default.createElement(IdCaptureWizard, _assign({}, idCaptureProps, {
13006
13020
  onSuccess: onIdCaptureSuccess
13007
13021
  }))))));
@@ -13268,10 +13282,10 @@ var resolveTheme = function resolveTheme(input) {
13268
13282
  var ThemeProvider = function ThemeProvider(_a) {
13269
13283
  var children = _a.children,
13270
13284
  themeInput = _a.theme;
13271
- var themeRef = useRef(themeInput);
13285
+ var themeRef = useState(themeInput)[0];
13272
13286
  var theme = useMemo(function () {
13273
- return resolveTheme(themeRef.current);
13274
- }, []);
13287
+ return resolveTheme(themeRef);
13288
+ }, [themeRef]);
13275
13289
  var colors = theme.colors;
13276
13290
  useEffect(function () {
13277
13291
  for (var name_1 in colors) {
@@ -13323,33 +13337,31 @@ var IdValidation = function IdValidation(_a) {
13323
13337
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
13324
13338
  _d = _a.idCaptureRequirement,
13325
13339
  idCaptureRequirement = _d === void 0 ? 'idCardOrPassport' : _d,
13326
- _e = _a.allowSinglePageIdCapture,
13327
- allowSinglePageIdCapture = _e === void 0 ? false : _e,
13328
- _f = _a.separateIdCardCaptureSequence,
13329
- separateIdCardCaptureSequence = _f === void 0 ? false : _f,
13330
- _g = _a.idCaptureThresholds,
13331
- idCaptureThresholds = _g === void 0 ? defaultIdCaptureThresholds : _g,
13332
- _h = _a.skipSuccessScreen,
13333
- skipSuccessScreen = _h === void 0 ? false : _h,
13340
+ _e = _a.separateIdCardCaptureSequence,
13341
+ separateIdCardCaptureSequence = _e === void 0 ? false : _e,
13342
+ _f = _a.idCaptureThresholds,
13343
+ idCaptureThresholds = _f === void 0 ? defaultIdCaptureThresholds : _f,
13344
+ _g = _a.skipSuccessScreen,
13345
+ skipSuccessScreen = _g === void 0 ? false : _g,
13334
13346
  instructions = _a.instructions,
13335
- _j = _a.guideType,
13336
- guideType = _j === void 0 ? 'fit' : _j,
13337
- _k = _a.guideImages,
13338
- guideImages = _k === void 0 ? defaultIdCaptureGuideImages : _k,
13339
- _l = _a.portraitGuidesOnMobile,
13340
- portraitGuidesOnMobile = _l === void 0 ? true : _l,
13341
- _m = _a.rotateLoadingOverlayImageWhenPortrait,
13342
- rotateLoadingOverlayImageWhenPortrait = _m === void 0 ? true : _m,
13343
- _o = _a.modelLoadTimeoutMs,
13344
- modelLoadTimeoutMs = _o === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _o,
13345
- _p = _a.forceFallbackMode,
13346
- forceFallbackMode = _p === void 0 ? false : _p,
13347
- _q = _a.allowIdCardBackToFrontCapture,
13348
- allowIdCardBackToFrontCapture = _q === void 0 ? false : _q,
13349
- _r = _a.enableOverrideWrongDocumentTypeDialog,
13350
- enableOverrideWrongDocumentTypeDialog = _r === void 0 ? false : _r,
13351
- _s = _a.allowOverrideWrongDocumentTypeAfterMs,
13352
- allowOverrideWrongDocumentTypeAfterMs = _s === void 0 ? 8000 : _s,
13347
+ _h = _a.guideType,
13348
+ guideType = _h === void 0 ? 'fit' : _h,
13349
+ _j = _a.guideImages,
13350
+ guideImages = _j === void 0 ? defaultIdCaptureGuideImages : _j,
13351
+ _k = _a.portraitGuidesOnMobile,
13352
+ portraitGuidesOnMobile = _k === void 0 ? true : _k,
13353
+ _l = _a.rotateLoadingOverlayImageWhenPortrait,
13354
+ rotateLoadingOverlayImageWhenPortrait = _l === void 0 ? true : _l,
13355
+ _m = _a.modelLoadTimeoutMs,
13356
+ modelLoadTimeoutMs = _m === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _m,
13357
+ _o = _a.forceFallbackMode,
13358
+ forceFallbackMode = _o === void 0 ? false : _o,
13359
+ _p = _a.allowIdCardBackToFrontCapture,
13360
+ allowIdCardBackToFrontCapture = _p === void 0 ? false : _p,
13361
+ _q = _a.enableOverrideWrongDocumentTypeDialog,
13362
+ enableOverrideWrongDocumentTypeDialog = _q === void 0 ? false : _q,
13363
+ _r = _a.allowOverrideWrongDocumentTypeAfterMs,
13364
+ allowOverrideWrongDocumentTypeAfterMs = _r === void 0 ? 8000 : _r,
13353
13365
  onBeforeSubmit = _a.onBeforeSubmit,
13354
13366
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
13355
13367
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -13363,28 +13375,28 @@ var IdValidation = function IdValidation(_a) {
13363
13375
  onUserCancel = _a.onUserCancel,
13364
13376
  onModelError = _a.onModelError,
13365
13377
  onCameraAccessDenied = _a.onCameraAccessDenied,
13366
- _t = _a.theme,
13367
- theme = _t === void 0 ? 'default' : _t,
13368
- _u = _a.assets,
13369
- assets = _u === void 0 ? {} : _u,
13370
- _v = _a.classNames,
13371
- classNames = _v === void 0 ? {} : _v,
13372
- _w = _a.colors,
13373
- colors = _w === void 0 ? {} : _w,
13374
- _x = _a.verbiage,
13375
- verbiage = _x === void 0 ? {} : _x,
13376
- _y = _a.captureSignature,
13377
- captureSignature = _y === void 0 ? false : _y,
13378
- _z = _a.captureSignatureVideo,
13379
- captureSignatureVideo = _z === void 0 ? false : _z,
13380
- _0 = _a.captureAdditionalDocuments,
13381
- captureAdditionalDocuments = _0 === void 0 ? [] : _0,
13382
- _1 = _a.geolocationEnabled,
13383
- geolocationEnabled = _1 === void 0 ? true : _1,
13384
- _2 = _a.geolocationRequired,
13385
- geolocationRequired = _2 === void 0 ? false : _2,
13386
- _3 = _a.debugMode,
13387
- debugMode = _3 === void 0 ? false : _3;
13378
+ _s = _a.theme,
13379
+ theme = _s === void 0 ? 'default' : _s,
13380
+ _t = _a.assets,
13381
+ assets = _t === void 0 ? {} : _t,
13382
+ _u = _a.classNames,
13383
+ classNames = _u === void 0 ? {} : _u,
13384
+ _v = _a.colors,
13385
+ colors = _v === void 0 ? {} : _v,
13386
+ _w = _a.verbiage,
13387
+ verbiage = _w === void 0 ? {} : _w,
13388
+ _x = _a.captureSignature,
13389
+ captureSignature = _x === void 0 ? false : _x,
13390
+ _y = _a.captureSignatureVideo,
13391
+ captureSignatureVideo = _y === void 0 ? false : _y,
13392
+ _z = _a.captureAdditionalDocuments,
13393
+ captureAdditionalDocuments = _z === void 0 ? [] : _z,
13394
+ _0 = _a.geolocationEnabled,
13395
+ geolocationEnabled = _0 === void 0 ? true : _0,
13396
+ _1 = _a.geolocationRequired,
13397
+ geolocationRequired = _1 === void 0 ? false : _1,
13398
+ _2 = _a.debugMode,
13399
+ debugMode = _2 === void 0 ? false : _2;
13388
13400
  useLanguage(lang);
13389
13401
  useDebugLogging(debugMode);
13390
13402
  var idCaptureProps = useMemo(function () {
@@ -13394,7 +13406,6 @@ var IdValidation = function IdValidation(_a) {
13394
13406
  onModelError: onModelError,
13395
13407
  precapturedDocuments: precapturedDocuments,
13396
13408
  captureRequirement: idCaptureRequirement,
13397
- allowSinglePageIdCapture: allowSinglePageIdCapture,
13398
13409
  separateIdCardCaptureSequence: separateIdCardCaptureSequence,
13399
13410
  thresholds: idCaptureThresholds,
13400
13411
  skipSuccessScreen: skipSuccessScreen,
@@ -13417,7 +13428,7 @@ var IdValidation = function IdValidation(_a) {
13417
13428
  verbiage: verbiage,
13418
13429
  debugMode: debugMode
13419
13430
  };
13420
- }, [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]);
13431
+ }, [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]);
13421
13432
  var additionalDocumentCaptureProps = useMemo(function () {
13422
13433
  return {
13423
13434
  documents: captureAdditionalDocuments,
@@ -15773,7 +15784,9 @@ function renderElement(component, targetElement) {
15773
15784
  try {
15774
15785
  root.unmount();
15775
15786
  originalRemove_1();
15776
- } catch (e) {}
15787
+ } catch (e) {
15788
+ debug('failed to unmount', e);
15789
+ }
15777
15790
  };
15778
15791
  }
15779
15792
  return targetElement;