idmission-web-sdk 2.3.32 → 2.3.33

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.
@@ -211,7 +211,7 @@
211
211
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
212
  };
213
213
 
214
- var webSdkVersion = '2.3.32';
214
+ var webSdkVersion = '2.3.33';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -17054,12 +17054,10 @@
17054
17054
  canvas.style.height = '0';
17055
17055
  }
17056
17056
 
17057
- var IdCardGuideImageContainer = styled(IdCardBorder)(templateObject_1$A || (templateObject_1$A = __makeTemplateObject(["\n position: relative;\n ", "\n box-sizing: border-box;\n aspect-ratio: ", ";\n display: flex;\n"], ["\n position: relative;\n ", "\n box-sizing: border-box;\n aspect-ratio: ", ";\n display: flex;\n"])), function (props) {
17057
+ var IdCardGuideImageContainer = styled(IdCardBorder)(templateObject_1$A || (templateObject_1$A = __makeTemplateObject(["\n position: relative;\n ", "\n box-sizing: border-box;\n"], ["\n position: relative;\n ", "\n box-sizing: border-box;\n"])), function (props) {
17058
17058
  return props.$isVisible ? '' : 'opacity: 0;';
17059
- }, function (props) {
17060
- return props.$aspectRatio;
17061
17059
  });
17062
- var IdCardGuideImage = styled.img(templateObject_2$t || (templateObject_2$t = __makeTemplateObject(["\n transform-style: preserve-3d;\n ", "\n ", "\n max-width: 100%;\n max-height: 100%;\n"], ["\n transform-style: preserve-3d;\n ", "\n ", "\n max-width: 100%;\n max-height: 100%;\n"])), function (props) {
17060
+ var IdCardGuideImage = styled.img(templateObject_2$t || (templateObject_2$t = __makeTemplateObject(["\n max-height: 100%;\n transform-style: preserve-3d;\n ", "\n ", "\n"], ["\n max-height: 100%;\n transform-style: preserve-3d;\n ", "\n ", "\n"])), function (props) {
17063
17061
  return props.$isMirrored ? 'transform: scaleX(-1);' : '';
17064
17062
  }, function (props) {
17065
17063
  return props.$isInvisible ? 'opacity: 0;' : '';
@@ -17075,19 +17073,20 @@
17075
17073
  borderRadius = _u === void 0 ? 25 : _u,
17076
17074
  _v = _a.borderColor,
17077
17075
  borderColor = _v === void 0 ? 'white' : _v,
17078
- aspectRatio = _a.aspectRatio,
17079
- _w = _a.progress,
17080
- progress = _w === void 0 ? 0 : _w,
17076
+ _w = _a.aspectRatio,
17077
+ aspectRatio = _w === void 0 ? 1 : _w,
17078
+ _x = _a.progress,
17079
+ progress = _x === void 0 ? 0 : _x,
17081
17080
  props = __rest(_a, ["children", "status", "borderWidth", "borderRadius", "borderColor", "aspectRatio", "progress"]);
17082
- var _x = useResizeObserver(),
17083
- ref = _x.ref,
17084
- _y = _x.width,
17085
- width = _y === void 0 ? 0 : _y,
17086
- _z = _x.height,
17087
- height = _z === void 0 ? 0 : _z;
17088
- var _0 = React.useState(0),
17089
- progressResets = _0[0],
17090
- setProgressResets = _0[1];
17081
+ var _y = useResizeObserver(),
17082
+ ref = _y.ref,
17083
+ _z = _y.width,
17084
+ width = _z === void 0 ? 0 : _z,
17085
+ _0 = _y.height,
17086
+ height = _0 === void 0 ? 0 : _0;
17087
+ var _1 = React.useState(0),
17088
+ progressResets = _1[0],
17089
+ setProgressResets = _1[1];
17091
17090
  React.useEffect(function () {
17092
17091
  if (progress === 0 && status === 'capturing') {
17093
17092
  setProgressResets(function (n) {
@@ -17104,8 +17103,10 @@
17104
17103
  return /*#__PURE__*/React.createElement(IdCardBorderContainer, _assign({}, props), /*#__PURE__*/React.createElement("div", {
17105
17104
  ref: ref,
17106
17105
  style: {
17107
- aspectRatio: aspectRatio,
17108
- flex: 1
17106
+ maxHeight: '100%',
17107
+ maxWidth: '100%',
17108
+ display: 'flex',
17109
+ aspectRatio: aspectRatio
17109
17110
  }
17110
17111
  }, children), status === 'ready' && !wavesDisabled && ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IdCardBorderSvg, {
17111
17112
  width: width,
@@ -17204,7 +17205,7 @@
17204
17205
  className: isProgressBar ? "idmSdkProgressBorder ".concat(progressPaused ? 'idmSdkProgressPaused' : '') : ''
17205
17206
  }));
17206
17207
  }
17207
- var IdCardBorderContainer = styled.div(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n & > .idmSdkWaves {\n position: absolute;\n animation: ", " 2s ease-out infinite;\n transform-style: preserve-3d;\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 & > .idmSdkWaves {\n position: absolute;\n animation: ", " 2s ease-out infinite;\n transform-style: preserve-3d;\n\n &:nth-child(2) {\n animation-delay: 0.66s;\n }\n\n &:nth-child(3) {\n animation-delay: 1.33s;\n }\n }\n"])), wavesAnimation);
17208
+ var IdCardBorderContainer = styled.div(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n max-width: 100%;\n & > .idmSdkWaves {\n position: absolute;\n animation: ", " 2s ease-out infinite;\n transform-style: preserve-3d;\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 max-width: 100%;\n & > .idmSdkWaves {\n position: absolute;\n animation: ", " 2s ease-out infinite;\n transform-style: preserve-3d;\n\n &:nth-child(2) {\n animation-delay: 0.66s;\n }\n\n &:nth-child(3) {\n animation-delay: 1.33s;\n }\n }\n"])), wavesAnimation);
17208
17209
  var SvgOverlay = styled.svg(templateObject_4$e || (templateObject_4$e = __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"])));
17209
17210
  var IdCardBorderRect = styled.rect(templateObject_5$a || (templateObject_5$a = __makeTemplateObject(["\n &.idmSdkProgressBorder {\n animation: ", " ", "\n ", ";\n }\n\n &.idmSdkProgressPaused {\n animation-play-state: paused;\n }\n"], ["\n &.idmSdkProgressBorder {\n animation: ", " ", "\n ", ";\n }\n\n &.idmSdkProgressPaused {\n animation-play-state: paused;\n }\n"])), progressBorderAnimation, function (props) {
17210
17211
  var _a;
@@ -17536,46 +17537,58 @@
17536
17537
  };
17537
17538
 
17538
17539
  var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
17539
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
17540
- var _p = _a.classNames,
17541
- classNames = _p === void 0 ? {} : _p,
17542
- _q = _a.images,
17543
- userSuppliedImages = _q === void 0 ? defaultIdCaptureGuideImages : _q,
17540
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
17541
+ var _u = _a.classNames,
17542
+ classNames = _u === void 0 ? {} : _u,
17543
+ _v = _a.images,
17544
+ userSuppliedImages = _v === void 0 ? defaultIdCaptureGuideImages : _v,
17544
17545
  userSuppliedPadding = _a.padding,
17545
17546
  userSuppliedImagePadding = _a.imagePadding,
17546
- _r = _a.imageVisible,
17547
- imageVisible = _r === void 0 ? true : _r,
17547
+ _w = _a.imageVisible,
17548
+ imageVisible = _w === void 0 ? true : _w,
17548
17549
  borderWidth = _a.borderWidth,
17549
17550
  borderColor = _a.borderColor,
17550
- _s = _a.idCardBorderWidth,
17551
- idCardBorderWidth = _s === void 0 ? '2.5%' : _s,
17552
- _t = _a.idCardBorderColor,
17553
- idCardBorderColor = _t === void 0 ? 'white' : _t,
17551
+ _x = _a.idCardBorderWidth,
17552
+ idCardBorderWidth = _x === void 0 ? '2.5%' : _x,
17553
+ _y = _a.idCardBorderColor,
17554
+ idCardBorderColor = _y === void 0 ? 'white' : _y,
17554
17555
  maskColor = _a.maskColor,
17555
- _u = _a.isMirrored,
17556
- isMirrored = _u === void 0 ? false : _u,
17557
- _v = _a.isBackToFront,
17558
- isBackToFront = _v === void 0 ? false : _v,
17559
- _w = _a.portraitGuidesOnMobile,
17560
- portraitGuidesOnMobile = _w === void 0 ? true : _w,
17561
- _x = _a.instruction,
17562
- instruction = _x === void 0 ? '' : _x,
17563
- _y = _a.requestedAction,
17564
- requestedAction = _y === void 0 ? 'SHOW_ID_FRONT' : _y,
17565
- _z = _a.progress,
17566
- progress = _z === void 0 ? 0 : _z,
17567
- _0 = _a.status,
17568
- status = _0 === void 0 ? 'ready' : _0,
17556
+ _z = _a.isMirrored,
17557
+ isMirrored = _z === void 0 ? false : _z,
17558
+ _0 = _a.isBackToFront,
17559
+ isBackToFront = _0 === void 0 ? false : _0,
17560
+ _1 = _a.portraitGuidesOnMobile,
17561
+ portraitGuidesOnMobile = _1 === void 0 ? true : _1,
17562
+ _2 = _a.instruction,
17563
+ instruction = _2 === void 0 ? '' : _2,
17564
+ _3 = _a.requestedAction,
17565
+ requestedAction = _3 === void 0 ? 'SHOW_ID_FRONT' : _3,
17566
+ _4 = _a.progress,
17567
+ progress = _4 === void 0 ? 0 : _4,
17568
+ _5 = _a.status,
17569
+ status = _5 === void 0 ? 'ready' : _5,
17569
17570
  onClick = _a.onClick;
17570
- var _1 = useGuideOrientationContext(),
17571
- wrapperRef = _1.wrapperRef,
17572
- wrapperWidth = _1.wrapperWidth,
17573
- wrapperHeight = _1.wrapperHeight,
17574
- imageAspectRatio = _1.imageAspectRatio,
17575
- wrapperAspectRatio = _1.wrapperAspectRatio,
17576
- guideOrientationOnImageLoaded = _1.onImageLoaded,
17577
- setDimensions = _1.setDimensions;
17578
- var state = useIdCaptureStore();
17571
+ var _6 = useGuideOrientationContext(),
17572
+ wrapperRef = _6.wrapperRef,
17573
+ wrapperWidth = _6.wrapperWidth,
17574
+ wrapperHeight = _6.wrapperHeight,
17575
+ imageAspectRatio = _6.imageAspectRatio,
17576
+ wrapperAspectRatio = _6.wrapperAspectRatio,
17577
+ guideOrientationOnImageLoaded = _6.onImageLoaded,
17578
+ setDimensions = _6.setDimensions;
17579
+ var containerRef = React.useRef(null);
17580
+ var _7 = React.useState({
17581
+ width: 0,
17582
+ height: 0
17583
+ }),
17584
+ imageDimensions = _7[0],
17585
+ setImageDimensions = _7[1];
17586
+ var _8 = React.useState({
17587
+ width: 0,
17588
+ height: 0
17589
+ }),
17590
+ containerDimensions = _8[0],
17591
+ setContainerDimensions = _8[1];
17579
17592
  var theme = styled.useTheme();
17580
17593
  if (borderWidth === undefined) borderWidth = (_d = (_c = (_b = theme.idCapture) === null || _b === void 0 ? void 0 : _b.guideBox) === null || _c === void 0 ? void 0 : _c.borderWidth) !== null && _d !== void 0 ? _d : 4;
17581
17594
  React.useEffect(function () {
@@ -17587,34 +17600,32 @@
17587
17600
  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;
17588
17601
  var paddingAndBorderPx = padding * 2 + (borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0) * 2;
17589
17602
  var images = useImagesWithBackToFront(userSuppliedImages, isBackToFront);
17590
- var imagesByUrl = useGuideImagesByUrl(images);
17591
17603
  var orientation = getOrientation(portraitGuidesOnMobile);
17592
17604
  var currentImage = images[orientation][requestedAction === 'FLIP_ID' ? 'SHOW_ID_FRONT' : requestedAction];
17593
- var imagePadding = (_o = userSuppliedImagePadding !== null && userSuppliedImagePadding !== void 0 ? userSuppliedImagePadding : (_m = (_l = theme.idCapture) === null || _l === void 0 ? void 0 : _l.guideBox) === null || _m === void 0 ? void 0 : _m.imagePadding) !== null && _o !== void 0 ? _o : '0 50px';
17594
- if (typeof imagePadding === 'number') {
17595
- imagePadding = "".concat(imagePadding, "px");
17596
- }
17597
- var paddingForMath = imagePadding.replace(/[^0-9\s]/g, '').split(' ').map(Number);
17598
- var paddingForMathMax = Math.max.apply(Math, paddingForMath);
17599
- var imageWidth = state.guideRectWidth - paddingForMathMax * 2;
17600
- var imageHeight = state.guideRectHeight - paddingForMathMax * 2;
17605
+ var imagePadding = userSuppliedImagePadding !== null && userSuppliedImagePadding !== void 0 ? userSuppliedImagePadding : isMobile() ? (_o = (_m = (_l = theme.idCapture) === null || _l === void 0 ? void 0 : _l.guideBox) === null || _m === void 0 ? void 0 : _m.mobileImagePadding) !== null && _o !== void 0 ? _o : 0 : (_r = (_q = (_p = theme.idCapture) === null || _p === void 0 ? void 0 : _p.guideBox) === null || _q === void 0 ? void 0 : _q.imagePadding) !== null && _r !== void 0 ? _r : 50;
17601
17606
  var centerRegionMinWidth = imageAspectRatio >= wrapperAspectRatio ? wrapperWidth - paddingAndBorderPx : undefined;
17602
- var cardAspectRatio = imageAspectRatio > 1 ? '1.6' : '0.625';
17603
17607
  var onImageLoaded = React.useCallback(function (e) {
17604
- var _a, _b;
17605
17608
  guideOrientationOnImageLoaded(e);
17606
- var img = e.currentTarget;
17607
- var imageByUrl = imagesByUrl[img.src];
17608
- var width = (_a = imageByUrl === null || imageByUrl === void 0 ? void 0 : imageByUrl.width) !== null && _a !== void 0 ? _a : img.naturalWidth;
17609
- var height = (_b = imageByUrl === null || imageByUrl === void 0 ? void 0 : imageByUrl.height) !== null && _b !== void 0 ? _b : img.naturalHeight;
17610
- dispatchIdCaptureAction({
17611
- type: 'guideImageLoaded',
17612
- payload: {
17613
- width: width,
17614
- height: height
17615
- }
17609
+ setImageDimensions({
17610
+ width: (currentImage === null || currentImage === void 0 ? void 0 : currentImage.width) || imageDimensions.width,
17611
+ height: (currentImage === null || currentImage === void 0 ? void 0 : currentImage.height) || imageDimensions.height
17616
17612
  });
17617
- }, [guideOrientationOnImageLoaded, imagesByUrl]);
17613
+ }, [guideOrientationOnImageLoaded, currentImage, imageDimensions.height, imageDimensions.width]);
17614
+ React.useEffect(function () {
17615
+ if (containerRef.current && containerRef.current.clientWidth && containerRef.current.clientHeight) {
17616
+ setContainerDimensions({
17617
+ width: containerRef.current.clientWidth,
17618
+ height: containerRef.current.clientHeight
17619
+ });
17620
+ dispatchIdCaptureAction({
17621
+ type: 'guideImageLoaded',
17622
+ payload: {
17623
+ width: imageDimensions.width,
17624
+ height: imageDimensions.height
17625
+ }
17626
+ });
17627
+ }
17628
+ }, [setDimensions, setContainerDimensions, imageDimensions.height, imageDimensions.width]);
17618
17629
  return /*#__PURE__*/React.createElement(StyledPageContainer, {
17619
17630
  ref: wrapperRef,
17620
17631
  onClick: onClick,
@@ -17643,14 +17654,19 @@
17643
17654
  "$padding": imagePadding,
17644
17655
  className: classNames.centerRegionBorder
17645
17656
  }, /*#__PURE__*/React.createElement(GuideCenterInner, {
17646
- className: classNames.centerRegionInner
17657
+ "$isLandscape": orientation === 'landscape',
17658
+ ref: containerRef,
17659
+ className: classNames.centerRegionInner,
17660
+ style: {
17661
+ aspectRatio: imageDimensions.width && imageDimensions.height ? imageDimensions.width / imageDimensions.height : 1
17662
+ }
17647
17663
  }, /*#__PURE__*/React.createElement(IdCardGuideImageContainer, {
17648
17664
  status: status,
17649
17665
  progress: progress,
17650
17666
  borderWidth: idCardBorderWidth,
17651
17667
  borderColor: idCardBorderColor,
17652
17668
  "$isVisible": requestedAction !== 'FLIP_ID',
17653
- "$aspectRatio": cardAspectRatio
17669
+ aspectRatio: imageDimensions.width && imageDimensions.height ? imageDimensions.width / imageDimensions.height : 1
17654
17670
  }, /*#__PURE__*/React.createElement(IdCardGuideImage, {
17655
17671
  alt: "",
17656
17672
  src: currentImage.url,
@@ -17658,8 +17674,8 @@
17658
17674
  className: classNames.image,
17659
17675
  "$isInvisible": !imageVisible,
17660
17676
  "$isMirrored": isMirrored,
17661
- width: imageWidth,
17662
- height: imageHeight
17677
+ width: containerDimensions.width ? containerDimensions.width : imageDimensions.width,
17678
+ height: containerDimensions.height ? containerDimensions.height : imageDimensions.height
17663
17679
  })), requestedAction === 'FLIP_ID' && ( /*#__PURE__*/React.createElement(FlipIdPrompt, {
17664
17680
  images: images,
17665
17681
  borderWidth: idCardBorderWidth,
@@ -17667,8 +17683,8 @@
17667
17683
  portraitGuidesOnMobile: portraitGuidesOnMobile,
17668
17684
  isMirrored: isMirrored,
17669
17685
  classNames: classNames.flipIdPrompt,
17670
- width: imageWidth,
17671
- height: imageHeight
17686
+ width: (_s = currentImage === null || currentImage === void 0 ? void 0 : currentImage.width) !== null && _s !== void 0 ? _s : imageDimensions.width,
17687
+ height: (_t = currentImage === null || currentImage === void 0 ? void 0 : currentImage.width) !== null && _t !== void 0 ? _t : imageDimensions.height
17672
17688
  }))))), /*#__PURE__*/React.createElement(Spacer, {
17673
17689
  "$maskColor": maskColor,
17674
17690
  "$minWidth": padding,
@@ -17712,10 +17728,12 @@
17712
17728
  var _a, _b;
17713
17729
  return "".concat((_a = props.$borderWidth) !== null && _a !== void 0 ? _a : 4, "px solid ").concat((_b = props.$borderColor) !== null && _b !== void 0 ? _b : 'white');
17714
17730
  }, function (props) {
17715
- return props.$padding ? "padding: ".concat(props.$padding, ";") : '';
17731
+ return props.$padding ? "padding: ".concat(props.$padding, "px;") : '';
17716
17732
  });
17717
17733
  var GuideText = styled.span(templateObject_8$2 || (templateObject_8$2 = __makeTemplateObject(["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"], ["\n align-content: center;\n margin-top: 12px;\n margin-bottom: 12px;\n"])));
17718
- var GuideCenterInner = styled.div(templateObject_9$2 || (templateObject_9$2 = __makeTemplateObject(["\n position: relative;\n margin: auto;\n"], ["\n position: relative;\n margin: auto;\n"])));
17734
+ var GuideCenterInner = styled.div(templateObject_9$2 || (templateObject_9$2 = __makeTemplateObject(["\n position: relative;\n margin: auto;\n ", "\n max-height: 100%;\n max-width: 100%;\n display: flex;\n"], ["\n position: relative;\n margin: auto;\n ", "\n max-height: 100%;\n max-width: 100%;\n display: flex;\n"])), function (props) {
17735
+ return props.$isLandscape ? 'height: 100%;' : 'width: 90%;';
17736
+ });
17719
17737
  var templateObject_1$y, templateObject_2$s, templateObject_3$j, templateObject_4$d, templateObject_5$9, templateObject_6$6, templateObject_7$4, templateObject_8$2, templateObject_9$2;
17720
17738
 
17721
17739
  var IdCaptureFitGuide = function IdCaptureFitGuide(_a) {
@@ -25616,7 +25634,8 @@
25616
25634
  borderWidth: 4,
25617
25635
  desktopPadding: 50,
25618
25636
  mobilePadding: 0,
25619
- imagePadding: '0 50px',
25637
+ imagePadding: 50,
25638
+ mobileImagePadding: 0,
25620
25639
  wavesDisabled: false,
25621
25640
  wavesColor: '#287ec6',
25622
25641
  progressBarColor: 'white',