idmission-web-sdk 2.2.26 → 2.2.28

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.
package/dist/sdk2.esm.js CHANGED
@@ -201,7 +201,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
201
201
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
202
202
  };
203
203
 
204
- var webSdkVersion = '2.2.26';
204
+ var webSdkVersion = '2.2.28';
205
205
 
206
206
  function getPlatform() {
207
207
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2821,6 +2821,15 @@ function loadFocusModel() {
2821
2821
  });
2822
2822
  });
2823
2823
  }
2824
+ function closeFocusModel(modelAssetPath) {
2825
+ if (modelAssetPath === void 0) {
2826
+ modelAssetPath = defaultFocusModelPath;
2827
+ }
2828
+ var id = "".concat(modelAssetPath);
2829
+ if (!models[id]) return;
2830
+ models[id].close();
2831
+ delete models[id];
2832
+ }
2824
2833
  function useLoadFocusModel(_a) {
2825
2834
  var _b = _a.modelPath,
2826
2835
  modelPath = _b === void 0 ? defaultFocusModelPath : _b,
@@ -2873,6 +2882,9 @@ function useLoadFocusModel(_a) {
2873
2882
  clearTimeout(modelLoadTimeout);
2874
2883
  });
2875
2884
  return function () {
2885
+ log('unloading focus model', model.current);
2886
+ model.current = null;
2887
+ closeFocusModel(modelPath);
2876
2888
  clearTimeout(modelLoadTimeout);
2877
2889
  document.removeEventListener('idmission.preloadProgress.focus', handleDownloadProgress);
2878
2890
  };
@@ -2926,38 +2938,53 @@ function cropIfNecessary(imageData, cropCanvas, rotateCanvas, box) {
2926
2938
  }
2927
2939
 
2928
2940
  var defaultSelfieCaptureModelLoadTimeoutMs = 45000;
2929
- var detector;
2941
+ var detectors$1 = {};
2930
2942
  function loadFaceDetector() {
2931
- return __awaiter(this, void 0, void 0, function () {
2932
- var _a, _b;
2933
- return __generator(this, function (_c) {
2934
- switch (_c.label) {
2943
+ return __awaiter(this, arguments, void 0, function (modelAssetPath) {
2944
+ var id, _a, _b, _c, _d;
2945
+ if (modelAssetPath === void 0) {
2946
+ modelAssetPath = defaultFaceDetectorModelPath;
2947
+ }
2948
+ return __generator(this, function (_e) {
2949
+ switch (_e.label) {
2935
2950
  case 0:
2936
- if (detector) return [2 /*return*/, detector];
2951
+ id = "".concat(modelAssetPath);
2952
+ if (detectors$1[id]) return [2 /*return*/, detectors$1[id]];
2937
2953
  return [4 /*yield*/, preloadFaceDetectorDependencies()];
2938
2954
  case 1:
2939
- _c.sent();
2955
+ _e.sent();
2940
2956
  if (modelCapabilities.delegate === 'NONE') {
2941
2957
  throw new Error('No available delegate for face detector.');
2942
2958
  }
2943
- _b = (_a = FaceDetector).createFromOptions;
2959
+ _a = detectors$1;
2960
+ _b = id;
2961
+ _d = (_c = FaceDetector).createFromOptions;
2944
2962
  return [4 /*yield*/, FilesetResolver.forVisionTasks(visionTasksBasePath)];
2945
2963
  case 2:
2946
- return [4 /*yield*/, _b.apply(_a, [_c.sent(), {
2964
+ return [4 /*yield*/, _d.apply(_c, [_e.sent(), {
2947
2965
  // canvas: document.createElement('canvas'),
2948
2966
  baseOptions: {
2949
- modelAssetPath: defaultFaceDetectorModelPath,
2967
+ modelAssetPath: modelAssetPath,
2950
2968
  delegate: modelCapabilities.delegate
2951
2969
  },
2952
2970
  runningMode: 'VIDEO'
2953
2971
  }])];
2954
2972
  case 3:
2955
- detector = _c.sent();
2956
- return [2 /*return*/, detector];
2973
+ _a[_b] = _e.sent();
2974
+ return [2 /*return*/, detectors$1[id]];
2957
2975
  }
2958
2976
  });
2959
2977
  });
2960
2978
  }
2979
+ function closeFaceDetector(modelAssetPath) {
2980
+ if (modelAssetPath === void 0) {
2981
+ modelAssetPath = defaultFaceDetectorModelPath;
2982
+ }
2983
+ var id = "".concat(modelAssetPath);
2984
+ if (!detectors$1[id]) return;
2985
+ detectors$1[id].close();
2986
+ delete detectors$1[id];
2987
+ }
2961
2988
  function useLoadFaceDetector(_a) {
2962
2989
  var onModelError = _a.onModelError,
2963
2990
  _b = _a.modelLoadTimeoutMs,
@@ -3006,6 +3033,9 @@ function useLoadFaceDetector(_a) {
3006
3033
  clearTimeout(modelLoadTimeout);
3007
3034
  });
3008
3035
  return function () {
3036
+ log('unloading face detection model', detector.current);
3037
+ detector.current = null;
3038
+ closeFaceDetector();
3009
3039
  clearTimeout(modelLoadTimeout);
3010
3040
  document.removeEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
3011
3041
  };
@@ -3428,6 +3458,18 @@ function loadDocumentDetector() {
3428
3458
  });
3429
3459
  });
3430
3460
  }
3461
+ function closeDocumentDetector(modelAssetPath, scoreThreshold) {
3462
+ if (modelAssetPath === void 0) {
3463
+ modelAssetPath = defaultDocumentDetectorModelPath;
3464
+ }
3465
+ if (scoreThreshold === void 0) {
3466
+ scoreThreshold = defaultDocumentDetectionScoreThreshold;
3467
+ }
3468
+ var id = "".concat(modelAssetPath, ":").concat(scoreThreshold);
3469
+ if (!detectors[id]) return;
3470
+ detectors[id].close();
3471
+ delete detectors[id];
3472
+ }
3431
3473
  function useLoadDocumentDetector(_a) {
3432
3474
  var _b = _a.modelPath,
3433
3475
  modelPath = _b === void 0 ? defaultDocumentDetectorModelPath : _b,
@@ -3482,6 +3524,9 @@ function useLoadDocumentDetector(_a) {
3482
3524
  clearTimeout(modelLoadTimeout);
3483
3525
  });
3484
3526
  return function () {
3527
+ log('unloading document detection model');
3528
+ detector.current = null;
3529
+ closeDocumentDetector(modelPath, scoreThreshold);
3485
3530
  clearTimeout(modelLoadTimeout);
3486
3531
  document.removeEventListener('idmission.preloadProgress.documentDetection', handleDownloadProgress);
3487
3532
  };
@@ -13537,14 +13582,16 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
13537
13582
  idCaptureRotateLoadingOverlayImageWhenPortrait = _m === void 0 ? true : _m,
13538
13583
  _o = _a.idCaptureModelLoadTimeoutMs,
13539
13584
  idCaptureModelLoadTimeoutMs = _o === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _o,
13540
- _p = _a.selfieCaptureModelLoadTimeoutMs,
13541
- selfieCaptureModelLoadTimeoutMs = _p === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _p,
13542
- _q = _a.allowIdCardBackToFrontCapture,
13543
- allowIdCardBackToFrontCapture = _q === void 0 ? false : _q,
13544
- _r = _a.enableOverrideWrongDocumentTypeDialog,
13545
- enableOverrideWrongDocumentTypeDialog = _r === void 0 ? false : _r,
13546
- _s = _a.allowOverrideWrongDocumentTypeAfterMs,
13547
- allowOverrideWrongDocumentTypeAfterMs = _s === void 0 ? 8000 : _s,
13585
+ _p = _a.idCaptureForceFallbackMode,
13586
+ idCaptureForceFallbackMode = _p === void 0 ? false : _p,
13587
+ _q = _a.selfieCaptureModelLoadTimeoutMs,
13588
+ selfieCaptureModelLoadTimeoutMs = _q === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _q,
13589
+ _r = _a.allowIdCardBackToFrontCapture,
13590
+ allowIdCardBackToFrontCapture = _r === void 0 ? false : _r,
13591
+ _s = _a.enableOverrideWrongDocumentTypeDialog,
13592
+ enableOverrideWrongDocumentTypeDialog = _s === void 0 ? false : _s,
13593
+ _t = _a.allowOverrideWrongDocumentTypeAfterMs,
13594
+ allowOverrideWrongDocumentTypeAfterMs = _t === void 0 ? 8000 : _t,
13548
13595
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
13549
13596
  onDocumentUploaded = _a.onDocumentUploaded,
13550
13597
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
@@ -13561,28 +13608,28 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
13561
13608
  onIdCaptureModelError = _a.onIdCaptureModelError,
13562
13609
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
13563
13610
  onCameraAccessDenied = _a.onCameraAccessDenied,
13564
- _t = _a.captureSignature,
13565
- captureSignature = _t === void 0 ? false : _t,
13566
- _u = _a.captureSignatureVideo,
13567
- captureSignatureVideo = _u === void 0 ? false : _u,
13568
- _v = _a.captureAdditionalDocuments,
13569
- captureAdditionalDocuments = _v === void 0 ? [] : _v,
13570
- _w = _a.theme,
13571
- theme = _w === void 0 ? 'default' : _w,
13572
- _x = _a.assets,
13573
- assets = _x === void 0 ? {} : _x,
13574
- _y = _a.classNames,
13575
- classNames = _y === void 0 ? {} : _y,
13576
- _z = _a.colors,
13577
- colors = _z === void 0 ? {} : _z,
13578
- _0 = _a.verbiage,
13579
- verbiage = _0 === void 0 ? {} : _0,
13580
- _1 = _a.geolocationEnabled,
13581
- geolocationEnabled = _1 === void 0 ? true : _1,
13582
- _2 = _a.geolocationRequired,
13583
- geolocationRequired = _2 === void 0 ? false : _2,
13584
- _3 = _a.debugMode,
13585
- debugMode = _3 === void 0 ? false : _3;
13611
+ _u = _a.captureSignature,
13612
+ captureSignature = _u === void 0 ? false : _u,
13613
+ _v = _a.captureSignatureVideo,
13614
+ captureSignatureVideo = _v === void 0 ? false : _v,
13615
+ _w = _a.captureAdditionalDocuments,
13616
+ captureAdditionalDocuments = _w === void 0 ? [] : _w,
13617
+ _x = _a.theme,
13618
+ theme = _x === void 0 ? 'default' : _x,
13619
+ _y = _a.assets,
13620
+ assets = _y === void 0 ? {} : _y,
13621
+ _z = _a.classNames,
13622
+ classNames = _z === void 0 ? {} : _z,
13623
+ _0 = _a.colors,
13624
+ colors = _0 === void 0 ? {} : _0,
13625
+ _1 = _a.verbiage,
13626
+ verbiage = _1 === void 0 ? {} : _1,
13627
+ _2 = _a.geolocationEnabled,
13628
+ geolocationEnabled = _2 === void 0 ? true : _2,
13629
+ _3 = _a.geolocationRequired,
13630
+ geolocationRequired = _3 === void 0 ? false : _3,
13631
+ _4 = _a.debugMode,
13632
+ debugMode = _4 === void 0 ? false : _4;
13586
13633
  useLanguage(lang);
13587
13634
  useDebugLogging(debugMode);
13588
13635
  var idCaptureProps = useMemo(function () {
@@ -13607,10 +13654,11 @@ var IdAndFaceValidation = function IdAndFaceValidation(_a) {
13607
13654
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
13608
13655
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
13609
13656
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
13657
+ forceFallbackMode: idCaptureForceFallbackMode,
13610
13658
  skipSuccessScreen: skipSuccessScreen,
13611
13659
  debugMode: debugMode
13612
13660
  };
13613
- }, [onExitCapture, onUserCancel, onIdCaptureModelError, assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, precapturedDocuments, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCaptureGuideImages, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, allowIdCardBackToFrontCapture, enableOverrideWrongDocumentTypeDialog, allowOverrideWrongDocumentTypeAfterMs, skipSuccessScreen, debugMode]);
13661
+ }, [onExitCapture, onUserCancel, onIdCaptureModelError, assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, precapturedDocuments, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCaptureGuideImages, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, allowIdCardBackToFrontCapture, enableOverrideWrongDocumentTypeDialog, allowOverrideWrongDocumentTypeAfterMs, idCaptureForceFallbackMode, skipSuccessScreen, debugMode]);
13614
13662
  var faceLivenessProps = useMemo(function () {
13615
13663
  return {
13616
13664
  loadingOverlayMode: faceLivenessLoadingOverlayMode,
@@ -13771,14 +13819,16 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
13771
13819
  idCaptureRotateLoadingOverlayImageWhenPortrait = _m === void 0 ? true : _m,
13772
13820
  _o = _a.idCaptureModelLoadTimeoutMs,
13773
13821
  idCaptureModelLoadTimeoutMs = _o === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _o,
13774
- _p = _a.selfieCaptureModelLoadTimeoutMs,
13775
- selfieCaptureModelLoadTimeoutMs = _p === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _p,
13776
- _q = _a.allowIdCardBackToFrontCapture,
13777
- allowIdCardBackToFrontCapture = _q === void 0 ? false : _q,
13778
- _r = _a.enableOverrideWrongDocumentTypeDialog,
13779
- enableOverrideWrongDocumentTypeDialog = _r === void 0 ? false : _r,
13780
- _s = _a.allowOverrideWrongDocumentTypeAfterMs,
13781
- allowOverrideWrongDocumentTypeAfterMs = _s === void 0 ? 8000 : _s,
13822
+ _p = _a.idCaptureForceFallbackMode,
13823
+ idCaptureForceFallbackMode = _p === void 0 ? false : _p,
13824
+ _q = _a.selfieCaptureModelLoadTimeoutMs,
13825
+ selfieCaptureModelLoadTimeoutMs = _q === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _q,
13826
+ _r = _a.allowIdCardBackToFrontCapture,
13827
+ allowIdCardBackToFrontCapture = _r === void 0 ? false : _r,
13828
+ _s = _a.enableOverrideWrongDocumentTypeDialog,
13829
+ enableOverrideWrongDocumentTypeDialog = _s === void 0 ? false : _s,
13830
+ _t = _a.allowOverrideWrongDocumentTypeAfterMs,
13831
+ allowOverrideWrongDocumentTypeAfterMs = _t === void 0 ? 8000 : _t,
13782
13832
  onBeforeDocumentUpload = _a.onBeforeDocumentUpload,
13783
13833
  onDocumentUploadProgress = _a.onDocumentUploadProgress,
13784
13834
  onDocumentUploaded = _a.onDocumentUploaded,
@@ -13794,31 +13844,31 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
13794
13844
  onIdCaptureModelError = _a.onIdCaptureModelError,
13795
13845
  onSelfieCaptureModelError = _a.onSelfieCaptureModelError,
13796
13846
  onCameraAccessDenied = _a.onCameraAccessDenied,
13797
- _t = _a.captureSignature,
13798
- captureSignature = _t === void 0 ? false : _t,
13799
- _u = _a.captureSignatureVideo,
13800
- captureSignatureVideo = _u === void 0 ? false : _u,
13801
- _v = _a.captureAdditionalDocuments,
13802
- captureAdditionalDocuments = _v === void 0 ? [] : _v,
13803
- _w = _a.captureVideoId,
13804
- captureVideoId = _w === void 0 ? false : _w,
13847
+ _u = _a.captureSignature,
13848
+ captureSignature = _u === void 0 ? false : _u,
13849
+ _v = _a.captureSignatureVideo,
13850
+ captureSignatureVideo = _v === void 0 ? false : _v,
13851
+ _w = _a.captureAdditionalDocuments,
13852
+ captureAdditionalDocuments = _w === void 0 ? [] : _w,
13853
+ _x = _a.captureVideoId,
13854
+ captureVideoId = _x === void 0 ? false : _x,
13805
13855
  captureVideoIdProps = _a.captureVideoIdProps,
13806
- _x = _a.theme,
13807
- theme = _x === void 0 ? 'default' : _x,
13808
- _y = _a.assets,
13809
- assets = _y === void 0 ? {} : _y,
13810
- _z = _a.classNames,
13811
- classNames = _z === void 0 ? {} : _z,
13812
- _0 = _a.colors,
13813
- colors = _0 === void 0 ? {} : _0,
13814
- _1 = _a.verbiage,
13815
- verbiage = _1 === void 0 ? {} : _1,
13816
- _2 = _a.geolocationEnabled,
13817
- geolocationEnabled = _2 === void 0 ? true : _2,
13818
- _3 = _a.geolocationRequired,
13819
- geolocationRequired = _3 === void 0 ? false : _3,
13820
- _4 = _a.debugMode,
13821
- debugMode = _4 === void 0 ? false : _4;
13856
+ _y = _a.theme,
13857
+ theme = _y === void 0 ? 'default' : _y,
13858
+ _z = _a.assets,
13859
+ assets = _z === void 0 ? {} : _z,
13860
+ _0 = _a.classNames,
13861
+ classNames = _0 === void 0 ? {} : _0,
13862
+ _1 = _a.colors,
13863
+ colors = _1 === void 0 ? {} : _1,
13864
+ _2 = _a.verbiage,
13865
+ verbiage = _2 === void 0 ? {} : _2,
13866
+ _3 = _a.geolocationEnabled,
13867
+ geolocationEnabled = _3 === void 0 ? true : _3,
13868
+ _4 = _a.geolocationRequired,
13869
+ geolocationRequired = _4 === void 0 ? false : _4,
13870
+ _5 = _a.debugMode,
13871
+ debugMode = _5 === void 0 ? false : _5;
13822
13872
  useLanguage(lang);
13823
13873
  useDebugLogging(debugMode);
13824
13874
  var idCaptureProps = useMemo(function () {
@@ -13837,6 +13887,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
13837
13887
  rotateLoadingOverlayImageWhenPortrait: idCaptureRotateLoadingOverlayImageWhenPortrait,
13838
13888
  modelLoadTimeoutMs: idCaptureModelLoadTimeoutMs,
13839
13889
  allowIdCardBackToFrontCapture: allowIdCardBackToFrontCapture,
13890
+ forceFallbackMode: idCaptureForceFallbackMode,
13840
13891
  enableOverrideWrongDocumentTypeDialog: enableOverrideWrongDocumentTypeDialog,
13841
13892
  allowOverrideWrongDocumentTypeAfterMs: allowOverrideWrongDocumentTypeAfterMs,
13842
13893
  onExitCapture: onExitCapture,
@@ -13845,7 +13896,7 @@ var CustomerIdAndBiometricsEnrollment = function CustomerIdAndBiometricsEnrollme
13845
13896
  skipSuccessScreen: skipSuccessScreen,
13846
13897
  debugMode: debugMode
13847
13898
  };
13848
- }, [assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCaptureGuideImages, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, allowIdCardBackToFrontCapture, enableOverrideWrongDocumentTypeDialog, allowOverrideWrongDocumentTypeAfterMs, onExitCapture, onUserCancel, onIdCaptureModelError, skipSuccessScreen, debugMode]);
13899
+ }, [assets.idCapture, classNames.idCapture, colors.idCapture, verbiage.idCapture, idCaptureRequirement, idCaptureThresholds, idCaptureLoadingOverlayMode, idCaptureInstructions, idCaptureGuideType, idCaptureGuideImages, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, idCaptureModelLoadTimeoutMs, allowIdCardBackToFrontCapture, idCaptureForceFallbackMode, enableOverrideWrongDocumentTypeDialog, allowOverrideWrongDocumentTypeAfterMs, onExitCapture, onUserCancel, onIdCaptureModelError, skipSuccessScreen, debugMode]);
13849
13900
  var faceLivenessProps = useMemo(function () {
13850
13901
  return {
13851
13902
  onExitCapture: onExitCapture,