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
@@ -234,7 +234,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
234
234
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
235
235
  };
236
236
 
237
- var webSdkVersion = '2.2.65';
237
+ var webSdkVersion = '2.2.66';
238
238
 
239
239
  function getPlatform() {
240
240
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -1013,7 +1013,7 @@ function debug() {
1013
1013
  parts[_i] = arguments[_i];
1014
1014
  }
1015
1015
  if (logLevel < LogLevel.Debug) return;
1016
- console.debug.apply(console, parts); // eslint-disable-line
1016
+ console.debug.apply(console, parts); // eslint-disable-line no-console
1017
1017
  }
1018
1018
  function log() {
1019
1019
  var parts = [];
@@ -1021,7 +1021,7 @@ function log() {
1021
1021
  parts[_i] = arguments[_i];
1022
1022
  }
1023
1023
  if (logLevel < LogLevel.Info) return;
1024
- console.log.apply(console, parts); // eslint-disable-line
1024
+ console.log.apply(console, parts); // eslint-disable-line no-console
1025
1025
  }
1026
1026
  function warn() {
1027
1027
  var parts = [];
@@ -1029,7 +1029,7 @@ function warn() {
1029
1029
  parts[_i] = arguments[_i];
1030
1030
  }
1031
1031
  if (logLevel < LogLevel.Warn) return;
1032
- console.warn.apply(console, parts); // eslint-disable-line
1032
+ console.warn.apply(console, parts); // eslint-disable-line no-console
1033
1033
  }
1034
1034
  function error() {
1035
1035
  var parts = [];
@@ -1037,7 +1037,7 @@ function error() {
1037
1037
  parts[_i] = arguments[_i];
1038
1038
  }
1039
1039
  if (logLevel < LogLevel.Error) return;
1040
- console.error.apply(console, parts); // eslint-disable-line
1040
+ console.error.apply(console, parts); // eslint-disable-line no-console
1041
1041
  }
1042
1042
 
1043
1043
  exports.defaultSubmissionUrl = 'https://portal-api.idmission.com/swagger';
@@ -1334,82 +1334,33 @@ var SubmissionProvider = function SubmissionProvider(_a) {
1334
1334
  onDocumentUploadFailed.current = userSuppliedOnDocumentUploadFailed;
1335
1335
  }, [userSuppliedOnDocumentUploadFailed]);
1336
1336
  var uploadDocument = React.useCallback(function (src, metadata) {
1337
- return new Promise(function (resolve, reject) {
1338
- return __awaiter(void 0, void 0, void 0, function () {
1339
- var blob, _a, documentId, upload, _b, _c;
1340
- var _d, _e;
1341
- var _f;
1342
- return __generator(this, function (_g) {
1343
- switch (_g.label) {
1344
- case 0:
1345
- blob = typeof src === 'string' ? convertBase64ToBlob(src) : src;
1346
- _a = onBeforeDocumentUpload.current;
1347
- if (!_a) return [3 /*break*/, 2];
1348
- return [4 /*yield*/, (_f = onBeforeDocumentUpload.current) === null || _f === void 0 ? void 0 : _f.call(onBeforeDocumentUpload, blob, metadata)];
1349
- case 1:
1350
- _a = _g.sent() === false;
1351
- _g.label = 2;
1352
- case 2:
1353
- if (_a) return [2 /*return*/, resolve(blobToB64(blob))];
1354
- _b = createUpload;
1355
- _c = [blob];
1356
- _d = {
1357
- endpoint: documentServiceUrl,
1358
- retryDelays: [0, 1000, 1000, 1000, 3000, 5000, 10000, 20000],
1359
- headers: {
1360
- 'X-Session-Id': sessionId
1361
- }
1362
- };
1363
- _e = {
1364
- filetype: blob.type,
1365
- contentType: blob.type
1366
- };
1367
- return [4 /*yield*/, calculateMd5(blob)];
1368
- case 3:
1369
- upload = _b.apply(void 0, _c.concat([(_d.metadata = _assign.apply(void 0, [(_e.fingerprint = _g.sent(), _e), metadata || {}]), _d.onProgress = function (bytesUploaded, bytesTotal) {
1370
- var _a;
1371
- (_a = onDocumentUploadProgress.current) === null || _a === void 0 ? void 0 : _a.call(onDocumentUploadProgress, {
1372
- bytesUploaded: bytesUploaded,
1373
- bytesTotal: bytesTotal,
1374
- percentage: (bytesUploaded / bytesTotal * 100).toFixed(2) + '%',
1375
- metadata: metadata
1376
- });
1377
- }, _d.onAfterResponse = function (_req, res) {
1378
- var contentType = res.getHeader('Content-Type');
1379
- if (!(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('application/json'))) return;
1380
- var body = res.getBody();
1381
- if (!body) return;
1382
- try {
1383
- var parsedId = JSON.parse(body).id;
1384
- if (parsedId.startsWith('urn:documentsv1:')) {
1385
- documentId = parsedId;
1386
- }
1387
- } catch (e) {
1388
- warn('Failed to parse documents service response body', e);
1389
- }
1390
- }, _d.onSuccess = function () {
1391
- var _a, _b;
1392
- documentId || (documentId = "urn:documentsv1:".concat(getEnvFromUrl(upload.url), ":").concat((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift()));
1393
- (_b = onDocumentUploaded.current) === null || _b === void 0 ? void 0 : _b.call(onDocumentUploaded, documentId, metadata);
1394
- resolve(documentId);
1395
- }, _d.onError = function (error) {
1396
- var _a;
1397
- log('Failed because: ' + error);
1398
- (_a = onDocumentUploadFailed.current) === null || _a === void 0 ? void 0 : _a.call(onDocumentUploadFailed, error, metadata);
1399
- reject(error);
1400
- }, _d)]));
1401
- // Check if there are any previous uploads to continue.
1402
- upload.findPreviousUploads().then(function (previousUploads) {
1403
- // Found previous uploads so we select the first one.
1404
- if (previousUploads.length) {
1405
- upload.resumeFromPreviousUpload(previousUploads[0]);
1406
- }
1407
- // Start the upload
1408
- upload.start();
1409
- });
1410
- return [2 /*return*/];
1411
- }
1412
- });
1337
+ return __awaiter(void 0, void 0, void 0, function () {
1338
+ var blob, _a;
1339
+ var _b;
1340
+ return __generator(this, function (_c) {
1341
+ switch (_c.label) {
1342
+ case 0:
1343
+ blob = typeof src === 'string' ? convertBase64ToBlob(src) : src;
1344
+ _a = onBeforeDocumentUpload.current;
1345
+ if (!_a) return [3 /*break*/, 2];
1346
+ return [4 /*yield*/, (_b = onBeforeDocumentUpload.current) === null || _b === void 0 ? void 0 : _b.call(onBeforeDocumentUpload, blob, metadata)];
1347
+ case 1:
1348
+ _a = _c.sent() === false;
1349
+ _c.label = 2;
1350
+ case 2:
1351
+ if (_a) {
1352
+ return [2 /*return*/, blobToB64(blob)];
1353
+ }
1354
+ return [2 /*return*/, performUpload({
1355
+ blob: blob,
1356
+ endpoint: documentServiceUrl,
1357
+ sessionId: sessionId,
1358
+ metadata: metadata,
1359
+ onDocumentUploadProgress: onDocumentUploadProgress.current,
1360
+ onDocumentUploaded: onDocumentUploaded.current,
1361
+ onDocumentUploadFailed: onDocumentUploadFailed.current
1362
+ })];
1363
+ }
1413
1364
  });
1414
1365
  });
1415
1366
  }, [documentServiceUrl, sessionId]);
@@ -1958,6 +1909,83 @@ function getEnvFromUrl(url) {
1958
1909
  }
1959
1910
  return 'unknown';
1960
1911
  }
1912
+ function performUpload(_a) {
1913
+ return __awaiter(this, arguments, void 0, function (_b) {
1914
+ var fingerprint;
1915
+ var blob = _b.blob,
1916
+ endpoint = _b.endpoint,
1917
+ sessionId = _b.sessionId,
1918
+ metadata = _b.metadata,
1919
+ onDocumentUploadProgress = _b.onDocumentUploadProgress,
1920
+ onDocumentUploaded = _b.onDocumentUploaded,
1921
+ onDocumentUploadFailed = _b.onDocumentUploadFailed;
1922
+ return __generator(this, function (_c) {
1923
+ switch (_c.label) {
1924
+ case 0:
1925
+ return [4 /*yield*/, calculateMd5(blob)];
1926
+ case 1:
1927
+ fingerprint = _c.sent();
1928
+ return [2 /*return*/, new Promise(function (resolve, reject) {
1929
+ var documentId;
1930
+ var upload = createUpload(blob, {
1931
+ endpoint: endpoint,
1932
+ retryDelays: [0, 1000, 1000, 1000, 3000, 5000, 10000, 20000],
1933
+ headers: {
1934
+ 'X-Session-Id': sessionId
1935
+ },
1936
+ metadata: _assign({
1937
+ filetype: blob.type,
1938
+ contentType: blob.type,
1939
+ fingerprint: fingerprint
1940
+ }, metadata || {}),
1941
+ onProgress: function onProgress(bytesUploaded, bytesTotal) {
1942
+ onDocumentUploadProgress === null || onDocumentUploadProgress === void 0 ? void 0 : onDocumentUploadProgress({
1943
+ bytesUploaded: bytesUploaded,
1944
+ bytesTotal: bytesTotal,
1945
+ percentage: (bytesUploaded / bytesTotal * 100).toFixed(2) + '%',
1946
+ metadata: metadata
1947
+ });
1948
+ },
1949
+ onAfterResponse: function onAfterResponse(_req, res) {
1950
+ var contentType = res.getHeader('Content-Type');
1951
+ if (!(contentType === null || contentType === void 0 ? void 0 : contentType.startsWith('application/json'))) return;
1952
+ var body = res.getBody();
1953
+ if (!body) return;
1954
+ try {
1955
+ var parsedId = JSON.parse(body).id;
1956
+ if (parsedId.startsWith('urn:documentsv1:')) {
1957
+ documentId = parsedId;
1958
+ }
1959
+ } catch (e) {
1960
+ warn('Failed to parse documents service response body', e);
1961
+ }
1962
+ },
1963
+ onSuccess: function onSuccess() {
1964
+ var _a;
1965
+ documentId || (documentId = "urn:documentsv1:".concat(getEnvFromUrl(upload.url), ":").concat((_a = upload.url.split('/files/').pop()) === null || _a === void 0 ? void 0 : _a.split('+').shift()));
1966
+ onDocumentUploaded === null || onDocumentUploaded === void 0 ? void 0 : onDocumentUploaded(documentId, metadata);
1967
+ resolve(documentId);
1968
+ },
1969
+ onError: function onError(error) {
1970
+ log('Failed because: ' + error);
1971
+ onDocumentUploadFailed === null || onDocumentUploadFailed === void 0 ? void 0 : onDocumentUploadFailed(error, metadata);
1972
+ reject(error);
1973
+ }
1974
+ });
1975
+ // Check if there are any previous uploads to continue.
1976
+ upload.findPreviousUploads().then(function (previousUploads) {
1977
+ // Found previous uploads so we select the first one.
1978
+ if (previousUploads.length) {
1979
+ upload.resumeFromPreviousUpload(previousUploads[0]);
1980
+ }
1981
+ // Start the upload
1982
+ upload.start();
1983
+ });
1984
+ })];
1985
+ }
1986
+ });
1987
+ });
1988
+ }
1961
1989
 
1962
1990
  var visionTasksBasePath = "https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.7/wasm";
1963
1991
  var visionRuntimePreloading = false;
@@ -2399,7 +2427,7 @@ function useLoadFocusModel(_a) {
2399
2427
  };
2400
2428
  }, [modelPath, modelLoadTimeoutMs, videoRef, shouldLoadModels]);
2401
2429
  React.useEffect(function handleModelError() {
2402
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2430
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2403
2431
  }, [modelError, onModelError]);
2404
2432
  return {
2405
2433
  ready: ready,
@@ -2545,7 +2573,7 @@ function useLoadFaceDetector(_a) {
2545
2573
  };
2546
2574
  }, [modelLoadTimeoutMs, videoRef]);
2547
2575
  React.useEffect(function handleModelError() {
2548
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2576
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
2549
2577
  }, [modelError, onModelError]);
2550
2578
  return {
2551
2579
  ready: ready,
@@ -3044,7 +3072,7 @@ function useLoadDocumentDetector(_a) {
3044
3072
  };
3045
3073
  }, [shouldLoadModels, modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
3046
3074
  React.useEffect(function handleModelError() {
3047
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
3075
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
3048
3076
  }, [modelError, onModelError]);
3049
3077
  return {
3050
3078
  ready: ready,
@@ -3295,8 +3323,8 @@ function useFrameLoop(fn, _a) {
3295
3323
  renderPrediction().then();
3296
3324
  return function () {
3297
3325
  loopId.current += 1;
3298
- frameId.current && cancelAnimationFrame(frameId.current);
3299
- timer && clearTimeout(timer);
3326
+ if (frameId.current) cancelAnimationFrame(frameId.current);
3327
+ if (timer) clearTimeout(timer);
3300
3328
  };
3301
3329
  }, [fn, running, throttleMs]);
3302
3330
  var start = React.useCallback(function () {
@@ -3461,7 +3489,7 @@ var createCameraStore = function createCameraStore(config) {
3461
3489
  },
3462
3490
  requestCameraAccess: function requestCameraAccess() {
3463
3491
  return __awaiter(this, void 0, void 0, function () {
3464
- var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, handleStreamEnded_1, videoTrack_1, camera_1, e_3;
3492
+ var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, e_2, handleStreamEnded_1, videoTrack_1, camera_1, e_3;
3465
3493
  var _b, _c, _d;
3466
3494
  return __generator(this, function (_e) {
3467
3495
  switch (_e.label) {
@@ -3581,13 +3609,13 @@ var createCameraStore = function createCameraStore(config) {
3581
3609
  debug('opened stream with no width and height constraints');
3582
3610
  return [3 /*break*/, 10];
3583
3611
  case 9:
3584
- _e.sent();
3585
- debug('cannot open stream at all');
3612
+ e_2 = _e.sent();
3613
+ debug('cannot open stream at all', e_2);
3586
3614
  return [3 /*break*/, 10];
3587
3615
  case 10:
3588
3616
  if (!stream_1) {
3589
3617
  error('failed to open camera');
3590
- throw new Error('failed to open camera');
3618
+ throw new Error('failed to open camera: ');
3591
3619
  }
3592
3620
  debug('camera access granted with constraints', constraints);
3593
3621
  handleStreamEnded_1 = function handleStreamEnded_1() {
@@ -3668,7 +3696,7 @@ var createCameraStore = function createCameraStore(config) {
3668
3696
  },
3669
3697
  requestMicrophoneAccess: function requestMicrophoneAccess() {
3670
3698
  return __awaiter(this, void 0, void 0, function () {
3671
- var stream_2;
3699
+ var stream_2, e_4;
3672
3700
  return __generator(this, function (_a) {
3673
3701
  switch (_a.label) {
3674
3702
  case 0:
@@ -3707,7 +3735,8 @@ var createCameraStore = function createCameraStore(config) {
3707
3735
  }, 500);
3708
3736
  return [3 /*break*/, 4];
3709
3737
  case 3:
3710
- _a.sent();
3738
+ e_4 = _a.sent();
3739
+ debug('failed to open microphone', e_4);
3711
3740
  set({
3712
3741
  microphoneAccessDenied: true
3713
3742
  });
@@ -4072,9 +4101,7 @@ function evaluateIsMobile(nav) {
4072
4101
  // @ts-ignore
4073
4102
  return navAny.userAgentData && navAny.userAgentData.mobile;
4074
4103
  }
4075
- return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) ||
4076
- // tslint:disable-next-line:max-line-length
4077
- /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
4104
+ return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4));
4078
4105
  }
4079
4106
  return false;
4080
4107
  }
@@ -4220,7 +4247,7 @@ function IdCaptureModelsProviderInner(_a) {
4220
4247
  }, [allowSinglePageIdCapture, lastPredictionCanvas, makeFocusPrediction, onDocumentDetected, requiredDocumentType, thresholds.focus]);
4221
4248
  var modelError = documentDetectionModelError !== null && documentDetectionModelError !== void 0 ? documentDetectionModelError : focusModelError;
4222
4249
  React.useEffect(function handleModelErrors() {
4223
- modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
4250
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
4224
4251
  }, [modelError, onModelError]);
4225
4252
  var onPredictionMade = React.useCallback(function (handler) {
4226
4253
  onPredictionHandler.current = handler;
@@ -4244,7 +4271,7 @@ function IdCaptureModelsProviderInner(_a) {
4244
4271
  bestFocusScore.current = 0;
4245
4272
  }, [clearDocumentDetectionLastPredictionCanvas]);
4246
4273
  React.useEffect(function () {
4247
- requiredDocumentType && resetBestFrame();
4274
+ if (requiredDocumentType) resetBestFrame();
4248
4275
  }, [requiredDocumentType, resetBestFrame]);
4249
4276
  var value = React.useMemo(function () {
4250
4277
  return {
@@ -4302,10 +4329,6 @@ function remainingIdCaptureRequirements(captureRequirement, capturedDocuments, r
4302
4329
  var isIdCardOrPassport = captureRequirement === 'idCardOrPassport';
4303
4330
  if (isIdCardOrPassport && requestedDocumentType === 'passport') return [];
4304
4331
  var acceptedTypes = acceptedDocumentTypesForIdCaptureRequirementOption[captureRequirement];
4305
- console.log({
4306
- capturedDocuments: capturedDocuments,
4307
- captureRequirement: captureRequirement
4308
- });
4309
4332
  if (captureRequirement.includes('idCard') && 'singlePage' in capturedDocuments) {
4310
4333
  acceptedTypes = acceptedTypes.filter(function (v) {
4311
4334
  return !v.includes('idCard');
@@ -6966,7 +6989,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
6966
6989
  });
6967
6990
  }, [setDimensions, wrapperHeight, wrapperWidth]);
6968
6991
  var padding = userSuppliedPadding !== null && userSuppliedPadding !== void 0 ? userSuppliedPadding : isMobile() ? (_g = (_f = (_e = theme.idCapture) === null || _e === void 0 ? void 0 : _e.guideBox) === null || _f === void 0 ? void 0 : _f.mobilePadding) !== null && _g !== void 0 ? _g : 0 : (_k = (_j = (_h = theme.idCapture) === null || _h === void 0 ? void 0 : _h.guideBox) === null || _j === void 0 ? void 0 : _j.desktopPadding) !== null && _k !== void 0 ? _k : 50;
6969
- var paddingAndBorderPx = padding * 2 + borderWidth * 2;
6992
+ var paddingAndBorderPx = padding * 2 + (borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0) * 2;
6970
6993
  var images = useImagesWithBackToFront(userSuppliedImages, isBackToFront);
6971
6994
  var imagesByUrl = useGuideImagesByUrl(images);
6972
6995
  var orientation = getOrientation(portraitGuidesOnMobile);
@@ -7013,7 +7036,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
7013
7036
  "$isMirrored": isMirrored,
7014
7037
  className: classNames.centerRegion
7015
7038
  }, /*#__PURE__*/React__namespace.default.createElement(GuideCenterBorder, {
7016
- "$borderWidth": borderWidth,
7039
+ "$borderWidth": borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0,
7017
7040
  "$borderColor": borderColor,
7018
7041
  "$padding": imagePadding,
7019
7042
  className: classNames.centerRegionBorder
@@ -7213,7 +7236,7 @@ var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
7213
7236
  }, [aspectRatio, borderColor, borderRadius, borderWidth, dispatch, maskColor, padding, redrawing, wrapperHeight, wrapperWidth]);
7214
7237
  return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(CanvasWrapper$1, {
7215
7238
  ref: wrapperRef,
7216
- "$maskColor": maskColor,
7239
+ "$maskColor": maskColor !== null && maskColor !== void 0 ? maskColor : '',
7217
7240
  className: classNames.canvasWrapper
7218
7241
  }, /*#__PURE__*/React__namespace.default.createElement(Canvas$1, {
7219
7242
  ref: canvasRef,
@@ -7508,7 +7531,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7508
7531
  var uploadDocument = React.useContext(SubmissionContext).uploadDocument;
7509
7532
  var uploadCapturedDocument = React.useCallback(function (content, filetype) {
7510
7533
  return __awaiter(void 0, void 0, void 0, function () {
7511
- var documentId_1;
7534
+ var documentId_1, e_1;
7512
7535
  return __generator(this, function (_a) {
7513
7536
  switch (_a.label) {
7514
7537
  case 0:
@@ -7531,7 +7554,8 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7531
7554
  }, 0);
7532
7555
  return [3 /*break*/, 3];
7533
7556
  case 2:
7534
- _a.sent();
7557
+ e_1 = _a.sent();
7558
+ debug('upload failed', e_1);
7535
7559
  dispatch({
7536
7560
  type: 'uploadFailed'
7537
7561
  });
@@ -7566,7 +7590,7 @@ var DocumentCaptureStateProvider = function DocumentCaptureStateProvider(_a) {
7566
7590
  resolvedDocuments.forEach(function (d) {
7567
7591
  if (d.content) {
7568
7592
  d.contentUrl || (d.contentUrl = URL.createObjectURL(d.content));
7569
- uploadCapturedDocument(d.content, d.content.type);
7593
+ void uploadCapturedDocument(d.content, d.content.type);
7570
7594
  }
7571
7595
  });
7572
7596
  }, [aspectRatio, cameraFeedMode, documents, instructions, uploadCapturedDocument]);
@@ -7764,6 +7788,7 @@ var CameraVideoTag = function CameraVideoTag(props) {
7764
7788
  React.useEffect(function attachCameraStreamToVideoTagWhenReady() {
7765
7789
  if (videoRef.current && videoStream) {
7766
7790
  debug('attaching camera stream to video tag');
7791
+ // eslint-disable-next-line react-compiler/react-compiler
7767
7792
  videoRef.current.srcObject = videoStream;
7768
7793
  }
7769
7794
  }, [videoStream, videoRef]);
@@ -8327,12 +8352,16 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8327
8352
  }, [allowIdCardBackToFrontCapture, allowOverrideWrongDocumentTypeAfterMs, allowSinglePageIdCapture, captureRequirement, dispatch, enableOverrideWrongDocumentTypeDialog, precapturedDocuments]);
8328
8353
  var documentCount = Object.keys(state.capturedDocuments).length;
8329
8354
  React.useEffect(function () {
8330
- documentCount && resetBestFrame();
8355
+ if (documentCount) resetBestFrame();
8331
8356
  }, [documentCount, resetBestFrame]);
8332
8357
  var logCaptureMetadata = React.useCallback(function (metadata) {
8333
8358
  var _a;
8334
8359
  metadata.operationTime = new Date().getTime() - ((_a = state.operationStartedAt) !== null && _a !== void 0 ? _a : new Date()).getTime();
8335
- state.requestedDocumentType === 'idCardBack' ? logIdBackCaptureAttempt(metadata) : logIdFrontCaptureAttempt(metadata);
8360
+ if (state.requestedDocumentType === 'idCardBack') {
8361
+ logIdBackCaptureAttempt(metadata);
8362
+ } else {
8363
+ logIdFrontCaptureAttempt(metadata);
8364
+ }
8336
8365
  }, [logIdBackCaptureAttempt, logIdFrontCaptureAttempt, state.operationStartedAt, state.requestedDocumentType]);
8337
8366
  React.useEffect(function startModelsWhenCapturing() {
8338
8367
  if (!overlayDismissed || state.captureState !== 'capturing') return;
@@ -8388,11 +8417,11 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8388
8417
  var idBackImage = idCardBack && dataUrlToBase64Sync(idCardBack.imageData);
8389
8418
  var passportImage = passport && dataUrlToBase64Sync(passport.imageData);
8390
8419
  var singlePageImage = singlePage && dataUrlToBase64Sync(singlePage.imageData);
8391
- idFrontImage && setIdFrontImage(idFrontImage);
8392
- idBackImage && setIdBackImage(idBackImage);
8393
- passportImage && setPassportImage(passportImage);
8394
- singlePageImage && setIdFrontImage(singlePageImage);
8395
- releaseCameraAccessOnExit && releaseCameraAccess();
8420
+ if (idFrontImage) setIdFrontImage(idFrontImage);
8421
+ if (idBackImage) setIdBackImage(idBackImage);
8422
+ if (passportImage) setPassportImage(passportImage);
8423
+ if (singlePageImage) setIdFrontImage(singlePageImage);
8424
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
8396
8425
  setTimeout(function () {
8397
8426
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
8398
8427
  idFrontImage: idFrontImage,
@@ -8424,7 +8453,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
8424
8453
  }, [dispatch, onExitCapture, releaseCameraAccess, requestCameraAccess]);
8425
8454
  React.useEffect(function () {
8426
8455
  if (submissionStatus !== SubmissionStatus.READY) {
8427
- releaseCameraAccessOnExit && releaseCameraAccess();
8456
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
8428
8457
  }
8429
8458
  }, [releaseCameraAccess, releaseCameraAccessOnExit, submissionStatus]);
8430
8459
  React.useEffect(function () {
@@ -9605,19 +9634,25 @@ var SelfieCapture = function SelfieCapture(_a) {
9605
9634
  canvasRef = _v.canvasRef,
9606
9635
  guidanceError = _v.error;
9607
9636
  onPredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (prediction) {
9608
- return new Promise(function (resolve) {
9609
- if (shouldCapture && !busy) {
9610
- drawToCanvas(lastPredictionCanvas.current, canvasRef.current);
9611
- dispatch({
9612
- type: 'facesDetected',
9613
- payload: prediction
9614
- });
9615
- }
9616
- resolve();
9637
+ return __awaiter(void 0, void 0, void 0, function () {
9638
+ return __generator(this, function (_a) {
9639
+ if (shouldCapture && !busy) {
9640
+ drawToCanvas(lastPredictionCanvas.current, canvasRef.current);
9641
+ dispatch({
9642
+ type: 'facesDetected',
9643
+ payload: prediction
9644
+ });
9645
+ }
9646
+ return [2 /*return*/];
9647
+ });
9617
9648
  });
9618
9649
  }, [canvasRef, shouldCapture, busy]), 16));
9619
9650
  React.useEffect(function () {
9620
- (prediction === null || prediction === void 0 ? void 0 : prediction.faceReady) ? onGuidanceSatisfied === null || onGuidanceSatisfied === void 0 ? void 0 : onGuidanceSatisfied() : onGuidanceNotSatisfied === null || onGuidanceNotSatisfied === void 0 ? void 0 : onGuidanceNotSatisfied();
9651
+ if (prediction === null || prediction === void 0 ? void 0 : prediction.faceReady) {
9652
+ onGuidanceSatisfied === null || onGuidanceSatisfied === void 0 ? void 0 : onGuidanceSatisfied();
9653
+ } else {
9654
+ onGuidanceNotSatisfied === null || onGuidanceNotSatisfied === void 0 ? void 0 : onGuidanceNotSatisfied();
9655
+ }
9621
9656
  }, [onGuidanceNotSatisfied, onGuidanceSatisfied, prediction === null || prediction === void 0 ? void 0 : prediction.faceReady]);
9622
9657
  React.useEffect(function () {
9623
9658
  if (!(prediction === null || prediction === void 0 ? void 0 : prediction.faceReady)) return;
@@ -10615,7 +10650,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
10615
10650
  }, [logCaptureMetadata, releaseCameraAccess, requestCameraAccess]);
10616
10651
  var onDoneCallback = React.useCallback(function () {
10617
10652
  logCaptureMetadata();
10618
- releaseCameraAccessOnExit && releaseCameraAccess();
10653
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
10619
10654
  setTimeout(function () {
10620
10655
  onComplete === null || onComplete === void 0 ? void 0 : onComplete(submissionResponse, livenessCheckRequest);
10621
10656
  }, 0);
@@ -10634,7 +10669,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
10634
10669
  onLoadingOverlayDismissed === null || onLoadingOverlayDismissed === void 0 ? void 0 : onLoadingOverlayDismissed();
10635
10670
  }, [onLoadingOverlayDismissed]);
10636
10671
  var onFailureExitClick = React.useCallback(function () {
10637
- releaseCameraAccessOnExit && releaseCameraAccess();
10672
+ if (releaseCameraAccessOnExit) releaseCameraAccess();
10638
10673
  setTimeout(function () {
10639
10674
  onExitAfterFailure === null || onExitAfterFailure === void 0 ? void 0 : onExitAfterFailure(submissionResponse, livenessCheckRequest);
10640
10675
  }, 0);
@@ -10988,16 +11023,15 @@ var SignatureButtonsContainer = styled__default.default(ButtonsRow)(templateObje
10988
11023
  var templateObject_1$b, templateObject_2$9, templateObject_3$9, templateObject_4$4;
10989
11024
 
10990
11025
  var SignatureCapture = function SignatureCapture(_a) {
10991
- var _b;
10992
11026
  var onAccept = _a.onAccept,
10993
- _c = _a.classNames,
10994
- classNames = _c === void 0 ? {} : _c,
10995
- _d = _a.verbiage,
10996
- rawVerbiage = _d === void 0 ? {} : _d;
10997
- var _e = useResizeObserver__default.default(),
10998
- ref = _e.ref,
10999
- width = _e.width,
11000
- height = _e.height;
11027
+ _b = _a.classNames,
11028
+ classNames = _b === void 0 ? {} : _b,
11029
+ _c = _a.verbiage,
11030
+ rawVerbiage = _c === void 0 ? {} : _c;
11031
+ var _d = useResizeObserver__default.default(),
11032
+ ref = _d.ref,
11033
+ width = _d.width,
11034
+ height = _d.height;
11001
11035
  var signaturePad = React.useRef(null);
11002
11036
  var verbiage = useTranslations(rawVerbiage, {
11003
11037
  headingText: 'Please sign the box below',
@@ -11047,8 +11081,11 @@ var SignatureCapture = function SignatureCapture(_a) {
11047
11081
  }, /*#__PURE__*/React__namespace.default.createElement(LoaderButton, {
11048
11082
  variant: "secondary",
11049
11083
  className: classNames.clearBtn,
11050
- onClick: (_b = signaturePad.current) === null || _b === void 0 ? void 0 : _b.clear,
11051
- finished: true
11084
+ finished: true,
11085
+ onClick: function onClick() {
11086
+ var _a;
11087
+ (_a = signaturePad.current) === null || _a === void 0 ? void 0 : _a.clear();
11088
+ }
11052
11089
  }, verbiage.clearBtnText), /*#__PURE__*/React__namespace.default.createElement(AcceptBtn$1, {
11053
11090
  variant: "positive",
11054
11091
  className: classNames.acceptBtn,
@@ -12704,7 +12741,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12704
12741
  return __awaiter(void 0, void 0, void 0, function () {
12705
12742
  return __generator(this, function (_a) {
12706
12743
  setIdCaptureVideoUrl(videoUrl);
12707
- audioUrl && setIdCaptureVideoAudioUrl(audioUrl);
12744
+ if (audioUrl) setIdCaptureVideoAudioUrl(audioUrl);
12708
12745
  setCaptureState('SUCCESS');
12709
12746
  if (skipSuccessScreen) onComplete === null || onComplete === void 0 ? void 0 : onComplete();
12710
12747
  return [2 /*return*/];
@@ -13299,10 +13336,10 @@ var resolveTheme = function resolveTheme(input) {
13299
13336
  var ThemeProvider = function ThemeProvider(_a) {
13300
13337
  var children = _a.children,
13301
13338
  themeInput = _a.theme;
13302
- var themeRef = React.useRef(themeInput);
13339
+ var themeRef = React.useState(themeInput)[0];
13303
13340
  var theme = React.useMemo(function () {
13304
- return resolveTheme(themeRef.current);
13305
- }, []);
13341
+ return resolveTheme(themeRef);
13342
+ }, [themeRef]);
13306
13343
  var colors = theme.colors;
13307
13344
  React.useEffect(function () {
13308
13345
  for (var name_1 in colors) {
@@ -15804,7 +15841,9 @@ function renderElement(component, targetElement) {
15804
15841
  try {
15805
15842
  root.unmount();
15806
15843
  originalRemove_1();
15807
- } catch (e) {}
15844
+ } catch (e) {
15845
+ debug('failed to unmount', e);
15846
+ }
15808
15847
  };
15809
15848
  }
15810
15849
  return targetElement;