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.
@@ -215,7 +215,7 @@
215
215
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
216
216
  };
217
217
 
218
- var webSdkVersion = '2.1.75';
218
+ var webSdkVersion = '2.1.77';
219
219
 
220
220
  function getPlatform() {
221
221
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -17269,38 +17269,23 @@
17269
17269
  _b = _a.borderOpacity,
17270
17270
  borderOpacity = _b === void 0 ? 1 : _b,
17271
17271
  _c = _a.progress,
17272
- progress = _c === void 0 ? 1 : _c,
17272
+ progress = _c === void 0 ? 0 : _c,
17273
17273
  _d = _a.progressPaused,
17274
17274
  progressPaused = _d === void 0 ? false : _d,
17275
17275
  _e = _a.isProgressBar,
17276
17276
  isProgressBar = _e === void 0 ? false : _e,
17277
17277
  props = __rest(_a, ["borderRadius", "borderColor", "borderWidth", "borderOpacity", "progress", "progressPaused", "isProgressBar"]);
17278
- var rectRef = React.useRef(null);
17279
17278
  var _f = React.useState(0),
17280
17279
  totalLength = _f[0],
17281
17280
  setTotalLength = _f[1];
17282
17281
  var resolvedProgress = progress * totalLength;
17283
- React.useLayoutEffect(function () {
17284
- if (totalLength > 0) return;
17285
- var interval;
17286
- var measuredLength = 0;
17287
- function measureTotalLength() {
17288
- var _a, _b;
17289
- try {
17290
- measuredLength = (_b = (_a = rectRef.current) === null || _a === void 0 ? void 0 : _a.getTotalLength()) !== null && _b !== void 0 ? _b : 0;
17291
- if (measuredLength === 0) return;
17292
- setTotalLength(measuredLength);
17293
- if (interval) clearInterval(interval);
17294
- } catch (e) {
17295
- warn('failed to measure SVG length', e);
17296
- }
17282
+ var rectRef = function rectRef(r) {
17283
+ try {
17284
+ if (isProgressBar && r) setTotalLength(r.getTotalLength());
17285
+ } catch (e) {
17286
+ debug('failed to measure SVG length', e);
17297
17287
  }
17298
- measureTotalLength();
17299
- if (measuredLength === 0) interval = setInterval(measureTotalLength, 250);
17300
- return function () {
17301
- if (interval) clearInterval(interval);
17302
- };
17303
- }, [totalLength]);
17288
+ };
17304
17289
  return /*#__PURE__*/React.createElement(SvgOverlay, _assign({
17305
17290
  height: "100%",
17306
17291
  fill: "none",
@@ -17333,7 +17318,7 @@
17333
17318
  }
17334
17319
  var IdCardBorderContainer = styled.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"])));
17335
17320
  var SvgOverlay = styled.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"])));
17336
- var IdCardBorderRect = styled.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) {
17321
+ var IdCardBorderRect = styled.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) {
17337
17322
  var _a;
17338
17323
  return (_a = props.$speed) !== null && _a !== void 0 ? _a : '3s';
17339
17324
  }, function (props) {
@@ -23328,14 +23313,13 @@
23328
23313
  idCardGuideStatus = _1 === void 0 ? 'ready' : _1,
23329
23314
  idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
23330
23315
  idCardGuideBorderColor = _a.idCardGuideBorderColor,
23331
- _2 = _a.idCardCaptureProgress,
23332
- idCardCaptureProgress = _2 === void 0 ? 0 : _2,
23333
- _3 = _a.idCardCaptureGuideImages,
23334
- userSuppliedImages = _3 === void 0 ? defaultIdCaptureGuideImages : _3,
23335
- _4 = _a.classNames,
23336
- classNames = _4 === void 0 ? {} : _4,
23337
- _5 = _a.verbiage,
23338
- rawVerbiage = _5 === void 0 ? {} : _5;
23316
+ idCardCaptureProgress = _a.idCardCaptureProgress,
23317
+ _2 = _a.idCardCaptureGuideImages,
23318
+ userSuppliedImages = _2 === void 0 ? defaultIdCaptureGuideImages : _2,
23319
+ _3 = _a.classNames,
23320
+ classNames = _3 === void 0 ? {} : _3,
23321
+ _4 = _a.verbiage,
23322
+ rawVerbiage = _4 === void 0 ? {} : _4;
23339
23323
  var cameraRef = React.useContext(CameraStateContext).cameraRef;
23340
23324
  var verbiage = useTranslations(rawVerbiage, {
23341
23325
  idFrontInstructionText: 'Display the front of your ID card...',
@@ -23349,17 +23333,17 @@
23349
23333
  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';
23350
23334
  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;
23351
23335
  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';
23352
- var _6 = useResizeObserver(),
23353
- idCardGuideRef = _6.ref,
23354
- _7 = _6.width,
23355
- idCardGuideWidth = _7 === void 0 ? 0 : _7,
23356
- _8 = _6.height,
23357
- idCardGuideHeight = _8 === void 0 ? 0 : _8;
23336
+ var _5 = useResizeObserver(),
23337
+ idCardGuideRef = _5.ref,
23338
+ _6 = _5.width,
23339
+ idCardGuideWidth = _6 === void 0 ? 0 : _6,
23340
+ _7 = _5.height,
23341
+ idCardGuideHeight = _7 === void 0 ? 0 : _7;
23358
23342
  var idCaptureGuideImages = useGuideImages(userSuppliedImages);
23359
23343
  var idCaptureGuideImagesByUrl = useGuideImagesByUrl(idCaptureGuideImages);
23360
- var _9 = React.useState(undefined),
23361
- aspectRatio = _9[0],
23362
- setAspectRatio = _9[1];
23344
+ var _8 = React.useState(undefined),
23345
+ aspectRatio = _8[0],
23346
+ setAspectRatio = _8[1];
23363
23347
  var onImageLoaded = React.useCallback(function (e) {
23364
23348
  var _a, _b, _c, _d;
23365
23349
  var img = e.currentTarget;
@@ -23401,7 +23385,7 @@
23401
23385
  borderColor: idCardGuideBorderColor,
23402
23386
  aspectRatio: aspectRatio,
23403
23387
  "$isVisible": requestedAction !== 'FLIP_ID',
23404
- progress: requestedAction === 'VERIFY_LIVENESS' ? 0 : idCardCaptureProgress
23388
+ progress: requestedAction === 'VERIFY_LIVENESS' ? undefined : idCardCaptureProgress
23405
23389
  }, /*#__PURE__*/React.createElement(IdCardGuideImage, {
23406
23390
  alt: "",
23407
23391
  className: classNames.idCardGuideImage,
@@ -23541,7 +23525,7 @@
23541
23525
  var defaultVideoIdCaptureThresholds = {
23542
23526
  detection: {
23543
23527
  idCardFront: 0.4,
23544
- idCardBack: 0.4,
23528
+ idCardBack: 0.5,
23545
23529
  passport: 1
23546
23530
  },
23547
23531
  focus: {
@@ -23561,7 +23545,8 @@
23561
23545
  goodFrames: {
23562
23546
  idCardFront: 1,
23563
23547
  idCardBack: 1
23564
- }
23548
+ },
23549
+ flipShortcutThreshold: 0.7
23565
23550
  };
23566
23551
  var IdVideoCapture = function IdVideoCapture(_a) {
23567
23552
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
@@ -23717,14 +23702,15 @@
23717
23702
  setCurrentFocusScore(prediction.focusScore);
23718
23703
  var detectionThresholdMet = requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
23719
23704
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
23720
- if (requestedAction === 'FLIP_ID' && isGoodFrame) {
23705
+ var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= videoIdCaptureThresholds.flipShortcutThreshold;
23706
+ if (shouldShortcutFlipAnimation) {
23721
23707
  return setRequestedAction('SHOW_ID_BACK');
23722
23708
  }
23723
23709
  setGoodFramesCount(isGoodFrame ? function (n) {
23724
23710
  return n + 1;
23725
23711
  } : 0);
23726
23712
  });
23727
- }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction]);
23713
+ }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, videoIdCaptureThresholds.flipShortcutThreshold]);
23728
23714
  var _29 = React.useState(null),
23729
23715
  idFrontCaptureStartedAt = _29[0],
23730
23716
  setFirstGoodFrameTime = _29[1];
@@ -23926,7 +23912,7 @@
23926
23912
  requestedAction: requestedAction,
23927
23913
  satisfied: satisfied,
23928
23914
  idCardGuideStatus: countdownStartedAt ? 'capturing' : 'ready',
23929
- idCardCaptureProgress: countdownStartedAt ? 1 : 0,
23915
+ idCardCaptureProgress: !!countdownStartedAt ? 1 : 0,
23930
23916
  idCardCaptureGuideImages: idCardCaptureGuideImages,
23931
23917
  faceGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor,
23932
23918
  idCardGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor