idmission-web-sdk 2.1.76 → 2.1.78

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.76';
218
+ var webSdkVersion = '2.1.78';
219
219
 
220
220
  function getPlatform() {
221
221
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -8835,6 +8835,12 @@
8835
8835
  modelError: modelError
8836
8836
  };
8837
8837
  }
8838
+ var lastFocusPredictionAt = 0;
8839
+ var lastFocusPredictionTime = 0;
8840
+ function setLastFocusPredictionAt(time) {
8841
+ lastFocusPredictionTime = time - lastFocusPredictionAt;
8842
+ lastFocusPredictionAt = time;
8843
+ }
8838
8844
  function makeFocusModelPrediction(model, imageData, cropCanvas, rotateCanvas, box) {
8839
8845
  var _a, _b, _c, _d, _e;
8840
8846
  var startedAt = new Date();
@@ -11945,22 +11951,19 @@
11945
11951
  var _e = React.useState({}),
11946
11952
  focusThresholds = _e[0],
11947
11953
  setFocusThresholds = _e[1];
11948
- var _f = React.useState(0),
11949
- focusPredictionTime = _f[0],
11950
- setFocusPredictionTime = _f[1];
11951
- var _g = useLoadFocusModel({
11954
+ var _f = useLoadFocusModel({
11952
11955
  modelPath: focusModelPath,
11953
11956
  modelLoadTimeoutMs: focusModelLoadTimeoutMs,
11954
11957
  onModelError: onFocusModelError
11955
11958
  }),
11956
- model = _g.model,
11957
- ready = _g.ready,
11958
- modelDownloadProgress = _g.modelDownloadProgress,
11959
- modelError = _g.modelError;
11959
+ model = _f.model,
11960
+ ready = _f.ready,
11961
+ modelDownloadProgress = _f.modelDownloadProgress,
11962
+ modelError = _f.modelError;
11960
11963
  var makeFocusPrediction = React.useCallback(function (imageData, box) {
11961
11964
  if (!model.current) return null;
11962
11965
  var prediction = makeFocusModelPrediction(model.current, imageData, cropCanvas.current, rotateCanvas.current, box);
11963
- setFocusPredictionTime(prediction.predictionTime);
11966
+ setLastFocusPredictionAt(prediction.predictionTime);
11964
11967
  return prediction;
11965
11968
  }, [model]);
11966
11969
  var value = React.useMemo(function () {
@@ -11969,11 +11972,11 @@
11969
11972
  focusModelDownloadProgress: modelDownloadProgress,
11970
11973
  focusModelError: modelError,
11971
11974
  makeFocusPrediction: makeFocusPrediction,
11972
- focusPredictionTime: focusPredictionTime,
11975
+ focusPredictionTime: lastFocusPredictionTime,
11973
11976
  focusThresholds: focusThresholds,
11974
11977
  setFocusThresholds: setFocusThresholds
11975
11978
  };
11976
- }, [focusPredictionTime, focusThresholds, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
11979
+ }, [focusThresholds, makeFocusPrediction, modelDownloadProgress, modelError, ready]);
11977
11980
  return /*#__PURE__*/React.createElement(FocusModelContext.Provider, {
11978
11981
  value: value
11979
11982
  }, /*#__PURE__*/React.createElement(InvisibleCanvas, {
@@ -17269,38 +17272,23 @@
17269
17272
  _b = _a.borderOpacity,
17270
17273
  borderOpacity = _b === void 0 ? 1 : _b,
17271
17274
  _c = _a.progress,
17272
- progress = _c === void 0 ? 1 : _c,
17275
+ progress = _c === void 0 ? 0 : _c,
17273
17276
  _d = _a.progressPaused,
17274
17277
  progressPaused = _d === void 0 ? false : _d,
17275
17278
  _e = _a.isProgressBar,
17276
17279
  isProgressBar = _e === void 0 ? false : _e,
17277
17280
  props = __rest(_a, ["borderRadius", "borderColor", "borderWidth", "borderOpacity", "progress", "progressPaused", "isProgressBar"]);
17278
- var rectRef = React.useRef(null);
17279
17281
  var _f = React.useState(0),
17280
17282
  totalLength = _f[0],
17281
17283
  setTotalLength = _f[1];
17282
17284
  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
- }
17285
+ var rectRef = function rectRef(r) {
17286
+ try {
17287
+ if (isProgressBar && r) setTotalLength(r.getTotalLength());
17288
+ } catch (e) {
17289
+ debug('failed to measure SVG length', e);
17297
17290
  }
17298
- measureTotalLength();
17299
- if (measuredLength === 0) interval = setInterval(measureTotalLength, 250);
17300
- return function () {
17301
- if (interval) clearInterval(interval);
17302
- };
17303
- }, [totalLength]);
17291
+ };
17304
17292
  return /*#__PURE__*/React.createElement(SvgOverlay, _assign({
17305
17293
  height: "100%",
17306
17294
  fill: "none",
@@ -17333,7 +17321,7 @@
17333
17321
  }
17334
17322
  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
17323
  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) {
17324
+ 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
17325
  var _a;
17338
17326
  return (_a = props.$speed) !== null && _a !== void 0 ? _a : '3s';
17339
17327
  }, function (props) {
@@ -23328,14 +23316,13 @@
23328
23316
  idCardGuideStatus = _1 === void 0 ? 'ready' : _1,
23329
23317
  idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
23330
23318
  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;
23319
+ idCardCaptureProgress = _a.idCardCaptureProgress,
23320
+ _2 = _a.idCardCaptureGuideImages,
23321
+ userSuppliedImages = _2 === void 0 ? defaultIdCaptureGuideImages : _2,
23322
+ _3 = _a.classNames,
23323
+ classNames = _3 === void 0 ? {} : _3,
23324
+ _4 = _a.verbiage,
23325
+ rawVerbiage = _4 === void 0 ? {} : _4;
23339
23326
  var cameraRef = React.useContext(CameraStateContext).cameraRef;
23340
23327
  var verbiage = useTranslations(rawVerbiage, {
23341
23328
  idFrontInstructionText: 'Display the front of your ID card...',
@@ -23349,17 +23336,17 @@
23349
23336
  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
23337
  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
23338
  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;
23339
+ var _5 = useResizeObserver(),
23340
+ idCardGuideRef = _5.ref,
23341
+ _6 = _5.width,
23342
+ idCardGuideWidth = _6 === void 0 ? 0 : _6,
23343
+ _7 = _5.height,
23344
+ idCardGuideHeight = _7 === void 0 ? 0 : _7;
23358
23345
  var idCaptureGuideImages = useGuideImages(userSuppliedImages);
23359
23346
  var idCaptureGuideImagesByUrl = useGuideImagesByUrl(idCaptureGuideImages);
23360
- var _9 = React.useState(undefined),
23361
- aspectRatio = _9[0],
23362
- setAspectRatio = _9[1];
23347
+ var _8 = React.useState(undefined),
23348
+ aspectRatio = _8[0],
23349
+ setAspectRatio = _8[1];
23363
23350
  var onImageLoaded = React.useCallback(function (e) {
23364
23351
  var _a, _b, _c, _d;
23365
23352
  var img = e.currentTarget;
@@ -23401,7 +23388,7 @@
23401
23388
  borderColor: idCardGuideBorderColor,
23402
23389
  aspectRatio: aspectRatio,
23403
23390
  "$isVisible": requestedAction !== 'FLIP_ID',
23404
- progress: requestedAction === 'VERIFY_LIVENESS' ? 0 : idCardCaptureProgress
23391
+ progress: requestedAction === 'VERIFY_LIVENESS' ? undefined : idCardCaptureProgress
23405
23392
  }, /*#__PURE__*/React.createElement(IdCardGuideImage, {
23406
23393
  alt: "",
23407
23394
  className: classNames.idCardGuideImage,
@@ -23928,7 +23915,7 @@
23928
23915
  requestedAction: requestedAction,
23929
23916
  satisfied: satisfied,
23930
23917
  idCardGuideStatus: countdownStartedAt ? 'capturing' : 'ready',
23931
- idCardCaptureProgress: countdownStartedAt ? 1 : 0,
23918
+ idCardCaptureProgress: !!countdownStartedAt ? 1 : 0,
23932
23919
  idCardCaptureGuideImages: idCardCaptureGuideImages,
23933
23920
  faceGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor,
23934
23921
  idCardGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor