idmission-web-sdk 2.2.65 → 2.2.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/components/Example.d.ts +1 -1
  2. package/dist/components/Example.d.ts.map +1 -1
  3. package/dist/components/camera/CameraVideoTag.d.ts.map +1 -1
  4. package/dist/components/document_capture/DocumentCaptureStateProvider.d.ts.map +1 -1
  5. package/dist/components/id_capture/IdCaptureRequirementOption.d.ts.map +1 -1
  6. package/dist/components/id_capture/IdCaptureWizard.d.ts.map +1 -1
  7. package/dist/components/selfie_capture/SelfieCapture.d.ts.map +1 -1
  8. package/dist/components/signature_capture/SignatureCapture.d.ts.map +1 -1
  9. package/dist/components/submission/SubmissionProvider.d.ts.map +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/lib/camera/Camera.d.ts +0 -43
  13. package/dist/lib/camera/Camera.d.ts.map +1 -1
  14. package/dist/lib/camera/cameraStore.d.ts.map +1 -1
  15. package/dist/sdk2.cjs.development.js +182 -143
  16. package/dist/sdk2.cjs.development.js.map +1 -1
  17. package/dist/sdk2.cjs.production.js +1 -1
  18. package/dist/sdk2.cjs.production.js.map +1 -1
  19. package/dist/sdk2.esm.js +182 -143
  20. package/dist/sdk2.esm.js.map +1 -1
  21. package/dist/sdk2.umd.development.js +182 -143
  22. package/dist/sdk2.umd.development.js.map +1 -1
  23. package/dist/sdk2.umd.production.js +1 -1
  24. package/dist/sdk2.umd.production.js.map +1 -1
  25. package/dist/themes/index.d.ts.map +1 -1
  26. package/dist/version.d.ts +1 -1
  27. package/package.json +7 -12
  28. package/dist/lib/barcode/Native.d.ts +0 -2
  29. package/dist/lib/barcode/Native.d.ts.map +0 -1
  30. package/dist/lib/barcode/Scan.d.ts +0 -5
  31. package/dist/lib/barcode/Scan.d.ts.map +0 -1
  32. package/dist/lib/barcode/ZXing.d.ts +0 -2
  33. package/dist/lib/barcode/ZXing.d.ts.map +0 -1
  34. package/dist/lib/camera/videoRefStack.d.ts +0 -6
  35. 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.66';
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;
@@ -2368,7 +2396,7 @@ function useLoadFocusModel(_a) {
2368
2396
  };
2369
2397
  }, [modelPath, modelLoadTimeoutMs, videoRef, shouldLoadModels]);
2370
2398
  useEffect(function handleModelError() {
2371
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2399
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2372
2400
  }, [modelError, onModelError]);
2373
2401
  return {
2374
2402
  ready: ready,
@@ -2514,7 +2542,7 @@ function useLoadFaceDetector(_a) {
2514
2542
  };
2515
2543
  }, [modelLoadTimeoutMs, videoRef]);
2516
2544
  useEffect(function handleModelError() {
2517
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2545
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2518
2546
  }, [modelError, onModelError]);
2519
2547
  return {
2520
2548
  ready: ready,
@@ -3013,7 +3041,7 @@ function useLoadDocumentDetector(_a) {
3013
3041
  };
3014
3042
  }, [shouldLoadModels, modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
3015
3043
  useEffect(function handleModelError() {
3016
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
3044
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
3017
3045
  }, [modelError, onModelError]);
3018
3046
  return {
3019
3047
  ready: ready,
@@ -3264,8 +3292,8 @@ function useFrameLoop(fn, _a) {
3264
3292
  renderPrediction().then();
3265
3293
  return function () {
3266
3294
  loopId.current += 1;
3267
- frameId.current && cancelAnimationFrame(frameId.current);
3268
- timer && clearTimeout(timer);
3295
+ if (frameId.current) cancelAnimationFrame(frameId.current);
3296
+ if (timer) clearTimeout(timer);
3269
3297
  };
3270
3298
  }, [fn, running, throttleMs]);
3271
3299
  var start = useCallback(function () {
@@ -3430,7 +3458,7 @@ var createCameraStore = function createCameraStore(config) {
3430
3458
  },
3431
3459
  requestCameraAccess: function requestCameraAccess() {
3432
3460
  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;
3461
+ 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
3462
  var _b, _c, _d;
3435
3463
  return __generator(this, function (_e) {
3436
3464
  switch (_e.label) {
@@ -3550,13 +3578,13 @@ var createCameraStore = function createCameraStore(config) {
3550
3578
  debug('opened stream with no width and height constraints');
3551
3579
  return [3 /*break*/, 10];
3552
3580
  case 9:
3553
- _e.sent();
3554
- debug('cannot open stream at all');
3581
+ e_2 = _e.sent();
3582
+ debug('cannot open stream at all', e_2);
3555
3583
  return [3 /*break*/, 10];
3556
3584
  case 10:
3557
3585
  if (!stream_1) {
3558
3586
  error('failed to open camera');
3559
- throw new Error('failed to open camera');
3587
+ throw new Error('failed to open camera: ');
3560
3588
  }
3561
3589
  debug('camera access granted with constraints', constraints);
3562
3590
  handleStreamEnded_1 = function handleStreamEnded_1() {
@@ -3637,7 +3665,7 @@ var createCameraStore = function createCameraStore(config) {
3637
3665
  },
3638
3666
  requestMicrophoneAccess: function requestMicrophoneAccess() {
3639
3667
  return __awaiter(this, void 0, void 0, function () {
3640
- var stream_2;
3668
+ var stream_2, e_4;
3641
3669
  return __generator(this, function (_a) {
3642
3670
  switch (_a.label) {
3643
3671
  case 0:
@@ -3676,7 +3704,8 @@ var createCameraStore = function createCameraStore(config) {
3676
3704
  }, 500);
3677
3705
  return [3 /*break*/, 4];
3678
3706
  case 3:
3679
- _a.sent();
3707
+ e_4 = _a.sent();
3708
+ debug('failed to open microphone', e_4);
3680
3709
  set({
3681
3710
  microphoneAccessDenied: true
3682
3711
  });
@@ -4041,9 +4070,7 @@ function evaluateIsMobile(nav) {
4041
4070
  // @ts-ignore
4042
4071
  return navAny.userAgentData && navAny.userAgentData.mobile;
4043
4072
  }
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));
4073
+ 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
4074
  }
4048
4075
  return false;
4049
4076
  }
@@ -4189,7 +4216,7 @@ function IdCaptureModelsProviderInner(_a) {
4189
4216
  }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4190
4217
  var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
4191
4218
  useEffect(function handleModelErrors() {
4192
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
4219
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
4193
4220
  }, [modelError, onModelError]);
4194
4221
  var onPredictionMade = useCallback(function (handler) {
4195
4222
  onPredictionHandler.current = handler;
@@ -4213,7 +4240,7 @@ function IdCaptureModelsProviderInner(_a) {
4213
4240
  bestFocusScore.current = 0;
4214
4241
  }, [clearDocumentDetectionLastPredictionCanvas]);
4215
4242
  useEffect(function () {
4216
- requiredDocumentType && resetBestFrame();
4243
+ if (requiredDocumentType) resetBestFrame();
4217
4244
  }, [requiredDocumentType, resetBestFrame]);
4218
4245
  var value = useMemo(function () {
4219
4246
  return {
@@ -4271,10 +4298,6 @@ function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, r
4271
4298
  var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
4272
4299
  if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
4273
4300
  var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
4274
- console.log({
4275
- capturedDocuments: capturedDocuments,
4276
- captureRequirement: captureRequirement
4277
- });
4278
4301
  if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
4279
4302
  acceptedTypes = acceptedTypes.filter(function (v) {
4280
4303
  return !v.includes('idCard');
@@ -6935,7 +6958,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
6935
6958
  });
6936
6959
  }, [setDimensions, wrapperHeight, wrapperWidth]);
6937
6960
  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;
6961
+ var paddingAndBorderPx = padding * 2 + (borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0) * 2;
6939
6962
  var images = useImagesWithBackToFront(userSuppliedImages, isBackToFront);
6940
6963
  var imagesByUrl = useGuideImagesByUrl(images);
6941
6964
  var orientation = getOrientation(portraitGuidesOnMobile);
@@ -6982,7 +7005,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
6982
7005
  "$isMirrored": isMirrored,
6983
7006
  className: classNames.centerRegion
6984
7007
  }, /*#__PURE__*/React__default.createElement(GuideCenterBorder, {
6985
- "$borderWidth": borderWidth,
7008
+ "$borderWidth": borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0,
6986
7009
  "$borderColor": borderColor,
6987
7010
  "$padding": imagePadding,
6988
7011
  className: classNames.centerRegionBorder
@@ -7182,7 +7205,7 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
7182
7205
  }, [aspectRatio, borderColor, borderRadius, borderWidth, dispatch, maskColor, padding, redrawing, wrapperHeight, wrapperWidth]);
7183
7206
  return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(CanvasWrapper$1, {
7184
7207
  ref: wrapperRef,
7185
- "$maskColor": maskColor,
7208
+ "$maskColor": maskColor !== null && maskColor !== void 0 ? maskColor : '',
7186
7209
  className: classNames.canvasWrapper
7187
7210
  }, /*#__PURE__*/React__default.createElement(Canvas$1, {
7188
7211
  ref: canvasRef,
@@ -7477,7 +7500,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7477
7500
  var uploadDocument = useContext(SubmissionContext).uploadDocument;
7478
7501
  var uploadCapturedDocument = useCallback(function (content, filetype) {
7479
7502
  return __awaiter(void 0, void 0, void 0, function () {
7480
- var documentId_1;
7503
+ var documentId_1, e_1;
7481
7504
  return __generator(this, function (_a) {
7482
7505
  switch (_a.label) {
7483
7506
  case 0:
@@ -7500,7 +7523,8 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7500
7523
  }, 0);
7501
7524
  return [3 /*break*/, 3];
7502
7525
  case 2:
7503
- _a.sent();
7526
+ e_1 = _a.sent();
7527
+ debug('upload failed', e_1);
7504
7528
  dispatch({
7505
7529
  type: 'uploadFailed'
7506
7530
  });
@@ -7535,7 +7559,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7535
7559
  resolvedDocuments.forEach(function (d) {
7536
7560
  if (d.content) {
7537
7561
  d.contentUrl || (d.contentUrl = URL.createObjectURL(d.content));
7538
- uploadCapturedDocument(d.content, d.content.type);
7562
+ void uploadCapturedDocument(d.content, d.content.type);
7539
7563
  }
7540
7564
  });
7541
7565
  }, [aspectRatio, cameraFeedMode, documents, instructions, uploadCapturedDocument]);
@@ -7733,6 +7757,7 @@ var CameraVideoTag = function CameraVideoTag(props) {
7733
7757
  useEffect(function attachCameraStreamToVideoTagWhenReady() {
7734
7758
  if (videoRef.current && videoStream) {
7735
7759
  debug('attaching camera stream to video tag');
7760
+ // eslint-disable-next-line react-compiler/react-compiler
7736
7761
  videoRef.current.srcObject = videoStream;
7737
7762
  }
7738
7763
  }, [videoStream, videoRef]);
@@ -8296,12 +8321,16 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8296
8321
  }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8297
8322
  var documentCount = Object.keys(state.capturedDocuments).length;
8298
8323
  useEffect(function () {
8299
- documentCount && resetBestFrame();
8324
+ if (documentCount) resetBestFrame();
8300
8325
  }, [documentCount, resetBestFrame]);
8301
8326
  var logCaptureMetadata = useCallback(function (metadata) {
8302
8327
  var _a;
8303
8328
  metadata.operationTime = new Date().getTime() - ((_a = state.operationStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
8304
- state.requestedDocumentType === 'idCardBack' ? logIdBackCaptureAttempt(metadata) : logIdFrontCaptureAttempt(metadata);
8329
+ if (state.requestedDocumentType === 'idCardBack') {
8330
+ logIdBackCaptureAttempt(metadata);
8331
+ } else {
8332
+ logIdFrontCaptureAttempt(metadata);
8333
+ }
8305
8334
  }, [logIdBackCaptureAttempt, logIdFrontCaptureAttempt, state.operationStartedAt, state.requestedDocumentType]);
8306
8335
  useEffect(function startModelsWhenCapturing() {
8307
8336
  if (!overlayDismissed || state.captureState !== 'capturing') return;
@@ -8357,11 +8386,11 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8357
8386
  var idBackImage = idCardBack && dataUrlToBase64Sync(idCardBack.imageData);
8358
8387
  var passportImage = passport && dataUrlToBase64Sync(passport.imageData);
8359
8388
  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();
8389
+ if (idFrontImage) setIdFrontImage(idFrontImage);
8390
+ if (idBackImage) setIdBackImage(idBackImage);
8391
+ if (passportImage) setPassportImage(passportImage);
8392
+ if (singlePageImage) setIdFrontImage(singlePageImage);
8393
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
8365
8394
  setTimeout(function () {
8366
8395
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
8367
8396
  idFrontImage: idFrontImage,
@@ -8393,7 +8422,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8393
8422
  }, [dispatch, onExitCapture, releaseCameraAccess, requestCameraAccess]);
8394
8423
  useEffect(function () {
8395
8424
  if (submissionStatus !== SubmissionStatus.READY) {
8396
- releaseCameraAccessOnExit && releaseCameraAccess();
8425
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
8397
8426
  }
8398
8427
  }, [releaseCameraAccess, releaseCameraAccessOnExit, submissionStatus]);
8399
8428
  useEffect(function () {
@@ -9574,19 +9603,25 @@ var SelfieCapture = function SelfieCapture(_a) {
9574
9603
  canvasRef = _v.canvasRef,
9575
9604
  guidanceError = _v.error;
9576
9605
  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();
9606
+ return __awaiter(void 0, void 0, void 0, function () {
9607
+ return __generator(this, function (_a) {
9608
+ if (shouldCapture && !busy) {
9609
+ drawToCanvas(lastPredictionCanvas.current, canvasRef.current);
9610
+ dispatch({
9611
+ type: 'facesDetected',
9612
+ payload: prediction
9613
+ });
9614
+ }
9615
+ return [2 /*return*/];
9616
+ });
9586
9617
  });
9587
9618
  }, [canvasRef, shouldCapture, busy]), 16));
9588
9619
  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();
9620
+ if (prediction === null || prediction === void 0 ? void 0 : prediction.faceReady) {
9621
+ onGuidanceSatisfied === null || onGuidanceSatisfied === void 0 ? void 0 : onGuidanceSatisfied();
9622
+ } else {
9623
+ onGuidanceNotSatisfied === null || onGuidanceNotSatisfied === void 0 ? void 0 : onGuidanceNotSatisfied();
9624
+ }
9590
9625
  }, [onGuidanceNotSatisfied, onGuidanceSatisfied, prediction === null || prediction === void 0 ? void 0 : prediction.faceReady]);
9591
9626
  useEffect(function () {
9592
9627
  if (!(prediction === null || prediction === void 0 ? void 0 : prediction.faceReady)) return;
@@ -10584,7 +10619,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
10584
10619
  }, [logCaptureMetadata, releaseCameraAccess, requestCameraAccess]);
10585
10620
  var onDoneCallback = useCallback(function () {
10586
10621
  logCaptureMetadata();
10587
- releaseCameraAccessOnExit && releaseCameraAccess();
10622
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
10588
10623
  setTimeout(function () {
10589
10624
  onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse, livenessCheckRequest);
10590
10625
  }, 0);
@@ -10603,7 +10638,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
10603
10638
  onLoadingOverlayDismissed === null || onLoadingOverlayDismissed === void 0 ? void 0 : onLoadingOverlayDismissed();
10604
10639
  }, [onLoadingOverlayDismissed]);
10605
10640
  var onFailureExitClick = useCallback(function () {
10606
- releaseCameraAccessOnExit && releaseCameraAccess();
10641
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
10607
10642
  setTimeout(function () {
10608
10643
  onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure(submissionResponse, livenessCheckRequest);
10609
10644
  }, 0);
@@ -10957,16 +10992,15 @@ var SignatureButtonsContainer = styled(ButtonsRow)(templateObject_4$4 || (templa
10957
10992
  var templateObject_1$b, templateObject_2$9, templateObject_3$9, templateObject_4$4;
10958
10993
 
10959
10994
  var SignatureCapture = function SignatureCapture(_a) {
10960
- var _b;
10961
10995
  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;
10996
+ _b = _a.classNames,
10997
+ classNames = _b === void 0 ? {} : _b,
10998
+ _c = _a.verbiage,
10999
+ rawVerbiage = _c === void 0 ? {} : _c;
11000
+ var _d = useResizeObserver(),
11001
+ ref = _d.ref,
11002
+ width = _d.width,
11003
+ height = _d.height;
10970
11004
  var signaturePad = useRef(null);
10971
11005
  var verbiage = useTranslations(rawVerbiage, {
10972
11006
  headingText: 'Please sign the box below',
@@ -11016,8 +11050,11 @@ var SignatureCapture = function SignatureCapture(_a) {
11016
11050
  }, /*#__PURE__*/React__default.createElement(LoaderButton, {
11017
11051
  variant: "secondary",
11018
11052
  className: classNames.clearBtn,
11019
- onClick: (_b = signaturePad.current) === null || _b === void 0 ? void 0 : _b.clear,
11020
- finished: true
11053
+ finished: true,
11054
+ onClick: function onClick() {
11055
+ var _a;
11056
+ (_a = signaturePad.current) === null || _a === void 0 ? void 0 : _a.clear();
11057
+ }
11021
11058
  }, verbiage.clearBtnText), /*#__PURE__*/React__default.createElement(AcceptBtn$1, {
11022
11059
  variant: "positive",
11023
11060
  className: classNames.acceptBtn,
@@ -12673,7 +12710,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12673
12710
  return __awaiter(void 0, void 0, void 0, function () {
12674
12711
  return __generator(this, function (_a) {
12675
12712
  setIdCaptureVideoUrl(videoUrl);
12676
- audioUrl && setIdCaptureVideoAudioUrl(audioUrl);
12713
+ if (audioUrl) setIdCaptureVideoAudioUrl(audioUrl);
12677
12714
  setCaptureState('SUCCESS');
12678
12715
  if (skipSuccessScreen) onComplete === null || onComplete === void 0 ? void 0 : onComplete();
12679
12716
  return [2 /*return*/];
@@ -13268,10 +13305,10 @@ var resolveTheme = function resolveTheme(input) {
13268
13305
  var ThemeProvider = function ThemeProvider(_a) {
13269
13306
  var children = _a.children,
13270
13307
  themeInput = _a.theme;
13271
- var themeRef = useRef(themeInput);
13308
+ var themeRef = useState(themeInput)[0];
13272
13309
  var theme = useMemo(function () {
13273
- return resolveTheme(themeRef.current);
13274
- }, []);
13310
+ return resolveTheme(themeRef);
13311
+ }, [themeRef]);
13275
13312
  var colors = theme.colors;
13276
13313
  useEffect(function () {
13277
13314
  for (var name_1 in colors) {
@@ -15773,7 +15810,9 @@ function renderElement(component, targetElement) {
15773
15810
  try {
15774
15811
  root.unmount();
15775
15812
  originalRemove_1();
15776
- } catch (e) {}
15813
+ } catch (e) {
15814
+ debug('failed to unmount', e);
15815
+ }
15777
15816
  };
15778
15817
  }
15779
15818
  return targetElement;