idmission-web-sdk 2.1.75 → 2.1.77

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.
@@ -38,6 +38,7 @@ export type VideoIdCaptureThresholds = IdCaptureThresholds & {
38
38
  /** Number of good frames of the ID card back that must be captured before moving on during video capture. */
39
39
  idCardBack: number;
40
40
  };
41
+ flipShortcutThreshold: number;
41
42
  };
42
43
  export declare const defaultVideoIdCaptureThresholds: VideoIdCaptureThresholds;
43
44
  export type IdVideoCaptureProps = {
@@ -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.1.75';
237
+ var webSdkVersion = '2.1.77';
238
238
 
239
239
  function getPlatform() {
240
240
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -8435,38 +8435,23 @@ function IdCardBorderSvg(_a) {
8435
8435
  _b = _a.borderOpacity,
8436
8436
  borderOpacity = _b === void 0 ? 1 : _b,
8437
8437
  _c = _a.progress,
8438
- progress = _c === void 0 ? 1 : _c,
8438
+ progress = _c === void 0 ? 0 : _c,
8439
8439
  _d = _a.progressPaused,
8440
8440
  progressPaused = _d === void 0 ? false : _d,
8441
8441
  _e = _a.isProgressBar,
8442
8442
  isProgressBar = _e === void 0 ? false : _e,
8443
8443
  props = __rest(_a, ["borderRadius", "borderColor", "borderWidth", "borderOpacity", "progress", "progressPaused", "isProgressBar"]);
8444
- var rectRef = React.useRef(null);
8445
8444
  var _f = React.useState(0),
8446
8445
  totalLength = _f[0],
8447
8446
  setTotalLength = _f[1];
8448
8447
  var resolvedProgress = progress * totalLength;
8449
- React.useLayoutEffect(function () {
8450
- if (totalLength > 0) return;
8451
- var interval;
8452
- var measuredLength = 0;
8453
- function measureTotalLength() {
8454
- var _a, _b;
8455
- try {
8456
- measuredLength = (_b = (_a = rectRef.current) === null || _a === void 0 ? void 0 : _a.getTotalLength()) !== null && _b !== void 0 ? _b : 0;
8457
- if (measuredLength === 0) return;
8458
- setTotalLength(measuredLength);
8459
- if (interval) clearInterval(interval);
8460
- } catch (e) {
8461
- warn('failed to measure SVG length', e);
8462
- }
8448
+ var rectRef = function rectRef(r) {
8449
+ try {
8450
+ if (isProgressBar && r) setTotalLength(r.getTotalLength());
8451
+ } catch (e) {
8452
+ debug('failed to measure SVG length', e);
8463
8453
  }
8464
- measureTotalLength();
8465
- if (measuredLength === 0) interval = setInterval(measureTotalLength, 250);
8466
- return function () {
8467
- if (interval) clearInterval(interval);
8468
- };
8469
- }, [totalLength]);
8454
+ };
8470
8455
  return /*#__PURE__*/React__namespace.default.createElement(SvgOverlay, _assign({
8471
8456
  height: "100%",
8472
8457
  fill: "none",
@@ -8499,7 +8484,7 @@ function IdCardBorderSvg(_a) {
8499
8484
  }
8500
8485
  var IdCardBorderContainer = styled__default.default.div(templateObject_3$j || (templateObject_3$j = __makeTemplateObject(["\n & > .pulse {\n position: absolute;\n animation: glow-grow 2s ease-out infinite;\n\n &:nth-child(2) {\n animation-delay: 0.66s;\n }\n\n &:nth-child(3) {\n animation-delay: 1.33s;\n }\n }\n\n @keyframes glow-grow {\n 0% {\n opacity: 0;\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n }\n 100% {\n transform: scale(2);\n opacity: 0;\n }\n }\n"], ["\n & > .pulse {\n position: absolute;\n animation: glow-grow 2s ease-out infinite;\n\n &:nth-child(2) {\n animation-delay: 0.66s;\n }\n\n &:nth-child(3) {\n animation-delay: 1.33s;\n }\n }\n\n @keyframes glow-grow {\n 0% {\n opacity: 0;\n transform: scale(1);\n }\n 50% {\n opacity: 1;\n }\n 100% {\n transform: scale(2);\n opacity: 0;\n }\n }\n"])));
8501
8486
  var SvgOverlay = styled__default.default.svg(templateObject_4$d || (templateObject_4$d = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n pointer-events: none;\n"])));
8502
- var IdCardBorderRect = styled__default.default.rect(templateObject_5$8 || (templateObject_5$8 = __makeTemplateObject(["\n &.progress {\n width: 100%;\n height: 100%;\n animation: dash ", "\n ", ";\n }\n\n &.paused {\n animation-play-state: paused;\n }\n\n @keyframes dash {\n to {\n stroke-dashoffset: 0;\n }\n }\n"], ["\n &.progress {\n width: 100%;\n height: 100%;\n animation: dash ", "\n ", ";\n }\n\n &.paused {\n animation-play-state: paused;\n }\n\n @keyframes dash {\n to {\n stroke-dashoffset: 0;\n }\n }\n"])), function (props) {
8487
+ var IdCardBorderRect = styled__default.default.rect(templateObject_5$8 || (templateObject_5$8 = __makeTemplateObject(["\n &.progress {\n animation: dash ", "\n ", ";\n }\n\n &.paused {\n animation-play-state: paused;\n }\n\n @keyframes dash {\n to {\n stroke-dashoffset: 0;\n }\n }\n"], ["\n &.progress {\n animation: dash ", "\n ", ";\n }\n\n &.paused {\n animation-play-state: paused;\n }\n\n @keyframes dash {\n to {\n stroke-dashoffset: 0;\n }\n }\n"])), function (props) {
8503
8488
  var _a;
8504
8489
  return (_a = props.$speed) !== null && _a !== void 0 ? _a : '3s';
8505
8490
  }, function (props) {
@@ -13726,14 +13711,13 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
13726
13711
  idCardGuideStatus = _1 === void 0 ? 'ready' : _1,
13727
13712
  idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
13728
13713
  idCardGuideBorderColor = _a.idCardGuideBorderColor,
13729
- _2 = _a.idCardCaptureProgress,
13730
- idCardCaptureProgress = _2 === void 0 ? 0 : _2,
13731
- _3 = _a.idCardCaptureGuideImages,
13732
- userSuppliedImages = _3 === void 0 ? defaultIdCaptureGuideImages : _3,
13733
- _4 = _a.classNames,
13734
- classNames = _4 === void 0 ? {} : _4,
13735
- _5 = _a.verbiage,
13736
- rawVerbiage = _5 === void 0 ? {} : _5;
13714
+ idCardCaptureProgress = _a.idCardCaptureProgress,
13715
+ _2 = _a.idCardCaptureGuideImages,
13716
+ userSuppliedImages = _2 === void 0 ? defaultIdCaptureGuideImages : _2,
13717
+ _3 = _a.classNames,
13718
+ classNames = _3 === void 0 ? {} : _3,
13719
+ _4 = _a.verbiage,
13720
+ rawVerbiage = _4 === void 0 ? {} : _4;
13737
13721
  var cameraRef = React.useContext(CameraStateContext).cameraRef;
13738
13722
  var verbiage = useTranslations(rawVerbiage, {
13739
13723
  idFrontInstructionText: 'Display the front of your ID card...',
@@ -13747,17 +13731,17 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
13747
13731
  if (faceGuideBorderColor === undefined) faceGuideBorderColor = (_j = satisfied ? (_f = (_e = theme.idVideoCapture) === null || _e === void 0 ? void 0 : _e.faceGuides) === null || _f === void 0 ? void 0 : _f.satisfiedColor : (_h = (_g = theme.idVideoCapture) === null || _g === void 0 ? void 0 : _g.faceGuides) === null || _h === void 0 ? void 0 : _h.unsatisfiedColor) !== null && _j !== void 0 ? _j : '#D6DCE7';
13748
13732
  if (idCardGuideBorderWidth === undefined) idCardGuideBorderWidth = (_m = (_l = (_k = theme.idVideoCapture) === null || _k === void 0 ? void 0 : _k.idCardGuides) === null || _l === void 0 ? void 0 : _l.borderWidth) !== null && _m !== void 0 ? _m : 20;
13749
13733
  if (idCardGuideBorderColor === undefined) idCardGuideBorderColor = (_s = satisfied ? (_p = (_o = theme.idVideoCapture) === null || _o === void 0 ? void 0 : _o.idCardGuides) === null || _p === void 0 ? void 0 : _p.satisfiedColor : (_r = (_q = theme.idVideoCapture) === null || _q === void 0 ? void 0 : _q.idCardGuides) === null || _r === void 0 ? void 0 : _r.unsatisfiedColor) !== null && _s !== void 0 ? _s : '#D6DCE7';
13750
- var _6 = useResizeObserver__default.default(),
13751
- idCardGuideRef = _6.ref,
13752
- _7 = _6.width,
13753
- idCardGuideWidth = _7 === void 0 ? 0 : _7,
13754
- _8 = _6.height,
13755
- idCardGuideHeight = _8 === void 0 ? 0 : _8;
13734
+ var _5 = useResizeObserver__default.default(),
13735
+ idCardGuideRef = _5.ref,
13736
+ _6 = _5.width,
13737
+ idCardGuideWidth = _6 === void 0 ? 0 : _6,
13738
+ _7 = _5.height,
13739
+ idCardGuideHeight = _7 === void 0 ? 0 : _7;
13756
13740
  var idCaptureGuideImages = useGuideImages(userSuppliedImages);
13757
13741
  var idCaptureGuideImagesByUrl = useGuideImagesByUrl(idCaptureGuideImages);
13758
- var _9 = React.useState(undefined),
13759
- aspectRatio = _9[0],
13760
- setAspectRatio = _9[1];
13742
+ var _8 = React.useState(undefined),
13743
+ aspectRatio = _8[0],
13744
+ setAspectRatio = _8[1];
13761
13745
  var onImageLoaded = React.useCallback(function (e) {
13762
13746
  var _a, _b, _c, _d;
13763
13747
  var img = e.currentTarget;
@@ -13799,7 +13783,7 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
13799
13783
  borderColor: idCardGuideBorderColor,
13800
13784
  aspectRatio: aspectRatio,
13801
13785
  "$isVisible": requestedAction !== 'FLIP_ID',
13802
- progress: requestedAction === 'VERIFY_LIVENESS' ? 0 : idCardCaptureProgress
13786
+ progress: requestedAction === 'VERIFY_LIVENESS' ? undefined : idCardCaptureProgress
13803
13787
  }, /*#__PURE__*/React__namespace.default.createElement(IdCardGuideImage, {
13804
13788
  alt: "",
13805
13789
  className: classNames.idCardGuideImage,
@@ -13939,7 +13923,7 @@ var edgeBoundary = 0.05;
13939
13923
  var defaultVideoIdCaptureThresholds = {
13940
13924
  detection: {
13941
13925
  idCardFront: 0.4,
13942
- idCardBack: 0.4,
13926
+ idCardBack: 0.5,
13943
13927
  passport: 1
13944
13928
  },
13945
13929
  focus: {
@@ -13959,7 +13943,8 @@ var defaultVideoIdCaptureThresholds = {
13959
13943
  goodFrames: {
13960
13944
  idCardFront: 1,
13961
13945
  idCardBack: 1
13962
- }
13946
+ },
13947
+ flipShortcutThreshold: 0.7
13963
13948
  };
13964
13949
  var IdVideoCapture = function IdVideoCapture(_a) {
13965
13950
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
@@ -14115,14 +14100,15 @@ var IdVideoCapture = function IdVideoCapture(_a) {
14115
14100
  setCurrentFocusScore(prediction.focusScore);
14116
14101
  var detectionThresholdMet = requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
14117
14102
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
14118
- if (requestedAction === 'FLIP_ID' && isGoodFrame) {
14103
+ var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= videoIdCaptureThresholds.flipShortcutThreshold;
14104
+ if (shouldShortcutFlipAnimation) {
14119
14105
  return setRequestedAction('SHOW_ID_BACK');
14120
14106
  }
14121
14107
  setGoodFramesCount(isGoodFrame ? function (n) {
14122
14108
  return n + 1;
14123
14109
  } : 0);
14124
14110
  });
14125
- }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction]);
14111
+ }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, videoIdCaptureThresholds.flipShortcutThreshold]);
14126
14112
  var _29 = React.useState(null),
14127
14113
  idFrontCaptureStartedAt = _29[0],
14128
14114
  setFirstGoodFrameTime = _29[1];
@@ -14324,7 +14310,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
14324
14310
  requestedAction: requestedAction,
14325
14311
  satisfied: satisfied,
14326
14312
  idCardGuideStatus: countdownStartedAt ? 'capturing' : 'ready',
14327
- idCardCaptureProgress: countdownStartedAt ? 1 : 0,
14313
+ idCardCaptureProgress: !!countdownStartedAt ? 1 : 0,
14328
14314
  idCardCaptureGuideImages: idCardCaptureGuideImages,
14329
14315
  faceGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor,
14330
14316
  idCardGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor