idmission-web-sdk 2.3.33 → 2.3.35

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.33';
214
+ var webSdkVersion = '2.3.35';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -482,7 +482,7 @@
482
482
  var OverlayImageContainer = styled.div(templateObject_3$r || (templateObject_3$r = __makeTemplateObject(["\n position: relative;\n display: flex;\n flex-grow: 1;\n padding-bottom: 25px;\n overflow: hidden;\n\n & > img,\n & > svg {\n margin: 0 auto;\n width: max-content;\n max-width: 100%;\n max-height: 100%;\n aspect-ratio: initial;\n object-fit: contain;\n display: block;\n }\n"], ["\n position: relative;\n display: flex;\n flex-grow: 1;\n padding-bottom: 25px;\n overflow: hidden;\n\n & > img,\n & > svg {\n margin: 0 auto;\n width: max-content;\n max-width: 100%;\n max-height: 100%;\n aspect-ratio: initial;\n object-fit: contain;\n display: block;\n }\n"])));
483
483
  var OverlayImageRow = styled.div(templateObject_4$l || (templateObject_4$l = __makeTemplateObject(["\n display: flex;\n margin: auto;\n\n & > div {\n max-height: calc(100% - 320px);\n\n & > img {\n width: 100%;\n max-height: 100%;\n height: auto;\n object-fit: contain;\n }\n }\n"], ["\n display: flex;\n margin: auto;\n\n & > div {\n max-height: calc(100% - 320px);\n\n & > img {\n width: 100%;\n max-height: 100%;\n height: auto;\n object-fit: contain;\n }\n }\n"])));
484
484
  var GrayOverlayContainer = styled(OverlayContainer)(templateObject_5$e || (templateObject_5$e = __makeTemplateObject(["\n background: #f7f6fb;\n"], ["\n background: #f7f6fb;\n"])));
485
- var ButtonsColumn = styled.div(templateObject_6$9 || (templateObject_6$9 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 15px 0;\n justify-content: center;\n margin-top: 24px;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 15px 0;\n justify-content: center;\n margin-top: 24px;\n"])));
485
+ var ButtonsColumn = styled.div(templateObject_6$a || (templateObject_6$a = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n gap: 15px 0;\n justify-content: center;\n margin-top: 24px;\n"], ["\n display: flex;\n flex-direction: column;\n gap: 15px 0;\n justify-content: center;\n margin-top: 24px;\n"])));
486
486
  var WideButton = styled(LoaderButton)(templateObject_7$6 || (templateObject_7$6 = __makeTemplateObject(["\n width: 100%;\n border-radius: 30px;\n"], ["\n width: 100%;\n border-radius: 30px;\n"])));
487
487
  var WideBorderButton = styled(WideButton)(templateObject_8$4 || (templateObject_8$4 = __makeTemplateObject(["\n color: ", ";\n background: ", ";\n border: 1px solid\n ", ";\n box-sizing: border-box;\n"], ["\n color: ", ";\n background: ", ";\n border: 1px solid\n ", ";\n box-sizing: border-box;\n"])), function (props) {
488
488
  var _a, _b;
@@ -521,7 +521,7 @@
521
521
  var LoadingOverlayProgressContainer = styled.div(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"], ["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n"])));
522
522
  var LoadingOverlayCustomLoadingGraphic = styled.img(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n transform-style: preserve-3d;\n"], ["\n transform-style: preserve-3d;\n"])));
523
523
  var LoadingOverlayContinueButtonContainer = styled.div(templateObject_22 || (templateObject_22 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
524
- var templateObject_1$M, templateObject_2$D, templateObject_3$r, templateObject_4$l, templateObject_5$e, templateObject_6$9, templateObject_7$6, templateObject_8$4, templateObject_9$3, templateObject_10$1, templateObject_11$1, templateObject_12$1, templateObject_13$1, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22;
524
+ var templateObject_1$M, templateObject_2$D, templateObject_3$r, templateObject_4$l, templateObject_5$e, templateObject_6$a, templateObject_7$6, templateObject_8$4, templateObject_9$3, templateObject_10$1, templateObject_11$1, templateObject_12$1, templateObject_13$1, templateObject_14, templateObject_15, templateObject_16, templateObject_17, templateObject_18, templateObject_19, templateObject_20, templateObject_21, templateObject_22;
525
525
 
526
526
  function _extends() {
527
527
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
@@ -16720,7 +16720,7 @@
16720
16720
  var _a, _b, _c, _d, _e, _f;
16721
16721
  return ((_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.progressBarFontSize) ? "font-size: ".concat((_f = (_e = (_d = props.theme) === null || _d === void 0 ? void 0 : _d.idCapture) === null || _e === void 0 ? void 0 : _e.loadingOverlay) === null || _f === void 0 ? void 0 : _f.progressBarFontSize, ";") : '';
16722
16722
  });
16723
- var ProgressBarBackground$1 = styled(LoadingOverlayProgressBarBackground)(templateObject_6$8 || (templateObject_6$8 = __makeTemplateObject(["\n background: ", ";\n opacity: ", ";\n"], ["\n background: ", ";\n opacity: ", ";\n"])), function (props) {
16723
+ var ProgressBarBackground$1 = styled(LoadingOverlayProgressBarBackground)(templateObject_6$9 || (templateObject_6$9 = __makeTemplateObject(["\n background: ", ";\n opacity: ", ";\n"], ["\n background: ", ";\n opacity: ", ";\n"])), function (props) {
16724
16724
  var _a, _b, _c, _d;
16725
16725
  return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.progressBarBackgroundColor) !== null && _d !== void 0 ? _d : 'var(--idm-color-positive-600)';
16726
16726
  }, function (props) {
@@ -16750,7 +16750,7 @@
16750
16750
  var _a, _b, _c, _d;
16751
16751
  return (_d = (_c = (_b = (_a = props.theme) === null || _a === void 0 ? void 0 : _a.idCapture) === null || _b === void 0 ? void 0 : _b.loadingOverlay) === null || _c === void 0 ? void 0 : _c.continueBtnDisabledBorder) !== null && _d !== void 0 ? _d : 'none';
16752
16752
  });
16753
- var templateObject_1$E, templateObject_2$x, templateObject_3$m, templateObject_4$g, templateObject_5$c, templateObject_6$8, templateObject_7$5, templateObject_8$3;
16753
+ var templateObject_1$E, templateObject_2$x, templateObject_3$m, templateObject_4$g, templateObject_5$c, templateObject_6$9, templateObject_7$5, templateObject_8$3;
16754
16754
 
16755
16755
  var ContinuityCameraCheckboxContainer = styled.div(templateObject_1$D || (templateObject_1$D = __makeTemplateObject(["\n margin-top: 15px;\n margin-bottom: 15px;\n"], ["\n margin-top: 15px;\n margin-bottom: 15px;\n"])));
16756
16756
  var ContinuityCameraCheckbox = styled.input(templateObject_2$w || (templateObject_2$w = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
@@ -17001,8 +17001,8 @@
17001
17001
  var ImageRow = styled(OverlayImageRow)(templateObject_3$l || (templateObject_3$l = __makeTemplateObject(["\n max-width: 100%;\n flex-direction: column;\n position: relative;\n width: 100%;\n"], ["\n max-width: 100%;\n flex-direction: column;\n position: relative;\n width: 100%;\n"])));
17002
17002
  var ImageCol$1 = styled.div(templateObject_4$f || (templateObject_4$f = __makeTemplateObject(["\n width: 450px;\n max-width: 100%;\n max-height: none !important;\n"], ["\n width: 450px;\n max-width: 100%;\n max-height: none !important;\n"])));
17003
17003
  var StyledImage = styled(CapturedDocumentImg)(templateObject_5$b || (templateObject_5$b = __makeTemplateObject(["\n width: 100%;\n border-radius: 12px;\n"], ["\n width: 100%;\n border-radius: 12px;\n"])));
17004
- var DebugPre = styled.pre(templateObject_6$7 || (templateObject_6$7 = __makeTemplateObject(["\n display: block;\n text-align: left;\n width: 100%;\n max-width: 100%;\n overflow-x: auto;\n"], ["\n display: block;\n text-align: left;\n width: 100%;\n max-width: 100%;\n overflow-x: auto;\n"])));
17005
- var templateObject_1$B, templateObject_2$u, templateObject_3$l, templateObject_4$f, templateObject_5$b, templateObject_6$7;
17004
+ var DebugPre = styled.pre(templateObject_6$8 || (templateObject_6$8 = __makeTemplateObject(["\n display: block;\n text-align: left;\n width: 100%;\n max-width: 100%;\n overflow-x: auto;\n"], ["\n display: block;\n text-align: left;\n width: 100%;\n max-width: 100%;\n overflow-x: auto;\n"])));
17005
+ var templateObject_1$B, templateObject_2$u, templateObject_3$l, templateObject_4$f, templateObject_5$b, templateObject_6$8;
17006
17006
 
17007
17007
  function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
17008
17008
  var _this = this;
@@ -17100,12 +17100,13 @@
17100
17100
  var progressBarColor = (_k = (_j = (_h = theme.idCapture) === null || _h === void 0 ? void 0 : _h.guideBox) === null || _j === void 0 ? void 0 : _j.progressBarColor) !== null && _k !== void 0 ? _k : borderColor;
17101
17101
  var progressBarIndicatorColor = (_o = (_m = (_l = theme.idCapture) === null || _l === void 0 ? void 0 : _l.guideBox) === null || _m === void 0 ? void 0 : _m.progressBarIndicatorColor) !== null && _o !== void 0 ? _o : '#287ec6';
17102
17102
  var progressBarWidth = (_r = (_q = (_p = theme.idCapture) === null || _p === void 0 ? void 0 : _p.guideBox) === null || _q === void 0 ? void 0 : _q.progressBarWidth) !== null && _r !== void 0 ? _r : borderWidth;
17103
- return /*#__PURE__*/React.createElement(IdCardBorderContainer, _assign({}, props), /*#__PURE__*/React.createElement("div", {
17103
+ return /*#__PURE__*/React.createElement(IdCardBorderContainer, _assign({}, props, {
17104
+ style: _assign(_assign({}, props.style), {
17105
+ aspectRatio: aspectRatio
17106
+ })
17107
+ }), /*#__PURE__*/React.createElement(IdCardBorderInner, {
17104
17108
  ref: ref,
17105
17109
  style: {
17106
- maxHeight: '100%',
17107
- maxWidth: '100%',
17108
- display: 'flex',
17109
17110
  aspectRatio: aspectRatio
17110
17111
  }
17111
17112
  }, children), status === 'ready' && !wavesDisabled && ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(IdCardBorderSvg, {
@@ -17205,16 +17206,17 @@
17205
17206
  className: isProgressBar ? "idmSdkProgressBorder ".concat(progressPaused ? 'idmSdkProgressPaused' : '') : ''
17206
17207
  }));
17207
17208
  }
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);
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"])));
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) {
17209
+ var IdCardBorderContainer = styled.div(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\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"], ["\n width: 100%;\n height: 100%;\n max-width: 100%;\n max-height: 100%;\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);
17210
+ var IdCardBorderInner = styled.div(templateObject_4$e || (templateObject_4$e = __makeTemplateObject(["\n max-height: 100%;\n max-width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n"], ["\n max-height: 100%;\n max-width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n"])));
17211
+ var SvgOverlay = styled.svg(templateObject_5$a || (templateObject_5$a = __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"])));
17212
+ var IdCardBorderRect = styled.rect(templateObject_6$7 || (templateObject_6$7 = __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) {
17211
17213
  var _a;
17212
17214
  return (_a = props.$speed) !== null && _a !== void 0 ? _a : '3s';
17213
17215
  }, function (props) {
17214
17216
  var _a;
17215
17217
  return (_a = props.$fillMode) !== null && _a !== void 0 ? _a : 'forwards';
17216
17218
  });
17217
- var templateObject_1$A, templateObject_2$t, templateObject_3$k, templateObject_4$e, templateObject_5$a;
17219
+ var templateObject_1$A, templateObject_2$t, templateObject_3$k, templateObject_4$e, templateObject_5$a, templateObject_6$7;
17218
17220
 
17219
17221
  var defaultIdCaptureGuideImages = {
17220
17222
  portrait: {
@@ -17404,19 +17406,12 @@
17404
17406
  wrapperAspectRatio: 0,
17405
17407
  imageAspectRatio: 0,
17406
17408
  wrapperRef: null,
17407
- setDimensions: function setDimensions() {
17408
- return null;
17409
- },
17410
- onImageLoaded: function onImageLoaded() {
17409
+ setImageAspectRatio: function setImageAspectRatio() {
17411
17410
  return null;
17412
17411
  }
17413
17412
  });
17414
17413
  function GuideOrientationContextProvider(_a) {
17415
17414
  var children = _a.children;
17416
- var setDimensions = React.useState({
17417
- width: 1,
17418
- height: 1
17419
- })[1];
17420
17415
  var _b = React.useState(1),
17421
17416
  imageAspectRatio = _b[0],
17422
17417
  setImageAspectRatio = _b[1];
@@ -17429,10 +17424,6 @@
17429
17424
  var wrapperAspectRatio = React.useMemo(function () {
17430
17425
  return wrapperWidth / wrapperHeight;
17431
17426
  }, [wrapperHeight, wrapperWidth]);
17432
- var onImageLoaded = React.useCallback(function (e) {
17433
- var img = e.target;
17434
- setImageAspectRatio(img.naturalWidth / img.naturalHeight);
17435
- }, []);
17436
17427
  var orientation = 'landscape'; //width > height ? 'landscape' : 'portrait'
17437
17428
  var value = React.useMemo(function () {
17438
17429
  return {
@@ -17441,11 +17432,10 @@
17441
17432
  wrapperHeight: wrapperHeight,
17442
17433
  wrapperAspectRatio: wrapperAspectRatio,
17443
17434
  imageAspectRatio: imageAspectRatio,
17444
- setDimensions: setDimensions,
17445
- wrapperRef: wrapperRef,
17446
- onImageLoaded: onImageLoaded
17435
+ setImageAspectRatio: setImageAspectRatio,
17436
+ wrapperRef: wrapperRef
17447
17437
  };
17448
- }, [imageAspectRatio, onImageLoaded, setDimensions, wrapperAspectRatio, wrapperHeight, wrapperRef, wrapperWidth]);
17438
+ }, [imageAspectRatio, wrapperAspectRatio, wrapperHeight, wrapperRef, wrapperWidth]);
17449
17439
  return /*#__PURE__*/React.createElement(GuideOrientationContext.Provider, {
17450
17440
  value: value
17451
17441
  }, children);
@@ -17473,7 +17463,7 @@
17473
17463
  portraitGuidesOnMobile = _g === void 0 ? true : _g,
17474
17464
  _h = _a.classNames,
17475
17465
  classNames = _h === void 0 ? {} : _h;
17476
- var onImageLoaded = useGuideOrientationContext().onImageLoaded;
17466
+ var imageAspectRatio = useGuideOrientationContext().imageAspectRatio;
17477
17467
  var orientation = getOrientation(portraitGuidesOnMobile);
17478
17468
  var _j = React.useState(1),
17479
17469
  transitionTime = _j[0],
@@ -17510,12 +17500,12 @@
17510
17500
  borderRadius: borderRadius,
17511
17501
  "$transforms": frontTransforms.join(' '),
17512
17502
  "$transitionTime": transitionTime,
17503
+ aspectRatio: imageAspectRatio,
17513
17504
  "$isVisible": true
17514
17505
  }, /*#__PURE__*/React.createElement(IdCardGuideImage, {
17515
17506
  alt: "",
17516
17507
  src: images[orientation].SHOW_ID_FRONT.url,
17517
17508
  className: classNames.frontImage,
17518
- onLoad: onImageLoaded,
17519
17509
  width: width,
17520
17510
  height: height
17521
17511
  })), /*#__PURE__*/React.createElement(FlipImageContainer, {
@@ -17526,6 +17516,7 @@
17526
17516
  borderRadius: borderRadius,
17527
17517
  "$transforms": backTransforms.join(' '),
17528
17518
  "$transitionTime": transitionTime,
17519
+ aspectRatio: imageAspectRatio,
17529
17520
  "$isVisible": true
17530
17521
  }, /*#__PURE__*/React.createElement(IdCardGuideImage, {
17531
17522
  alt: "",
@@ -17537,66 +17528,49 @@
17537
17528
  };
17538
17529
 
17539
17530
  var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
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,
17531
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
17532
+ var _s = _a.classNames,
17533
+ classNames = _s === void 0 ? {} : _s,
17534
+ _t = _a.images,
17535
+ userSuppliedImages = _t === void 0 ? defaultIdCaptureGuideImages : _t,
17545
17536
  userSuppliedPadding = _a.padding,
17546
17537
  userSuppliedImagePadding = _a.imagePadding,
17547
- _w = _a.imageVisible,
17548
- imageVisible = _w === void 0 ? true : _w,
17538
+ _u = _a.imageVisible,
17539
+ imageVisible = _u === void 0 ? true : _u,
17549
17540
  borderWidth = _a.borderWidth,
17550
17541
  borderColor = _a.borderColor,
17551
- _x = _a.idCardBorderWidth,
17552
- idCardBorderWidth = _x === void 0 ? '2.5%' : _x,
17553
- _y = _a.idCardBorderColor,
17554
- idCardBorderColor = _y === void 0 ? 'white' : _y,
17542
+ _v = _a.idCardBorderWidth,
17543
+ idCardBorderWidth = _v === void 0 ? '2.5%' : _v,
17544
+ _w = _a.idCardBorderColor,
17545
+ idCardBorderColor = _w === void 0 ? 'white' : _w,
17555
17546
  maskColor = _a.maskColor,
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,
17547
+ _x = _a.isMirrored,
17548
+ isMirrored = _x === void 0 ? false : _x,
17549
+ _y = _a.isBackToFront,
17550
+ isBackToFront = _y === void 0 ? false : _y,
17551
+ _z = _a.portraitGuidesOnMobile,
17552
+ portraitGuidesOnMobile = _z === void 0 ? true : _z,
17553
+ _0 = _a.instruction,
17554
+ instruction = _0 === void 0 ? '' : _0,
17555
+ _1 = _a.requestedAction,
17556
+ requestedAction = _1 === void 0 ? 'SHOW_ID_FRONT' : _1,
17557
+ _2 = _a.progress,
17558
+ progress = _2 === void 0 ? 0 : _2,
17559
+ _3 = _a.status,
17560
+ status = _3 === void 0 ? 'ready' : _3,
17570
17561
  onClick = _a.onClick;
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];
17562
+ var _4 = useGuideOrientationContext(),
17563
+ wrapperRef = _4.wrapperRef,
17564
+ wrapperWidth = _4.wrapperWidth,
17565
+ imageAspectRatio = _4.imageAspectRatio,
17566
+ wrapperAspectRatio = _4.wrapperAspectRatio,
17567
+ setImageAspectRatio = _4.setImageAspectRatio;
17568
+ var _5 = useResizeObserver(),
17569
+ innerRef = _5.ref,
17570
+ innerWidth = _5.width,
17571
+ innerHeight = _5.height;
17592
17572
  var theme = styled.useTheme();
17593
17573
  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;
17594
- React.useEffect(function () {
17595
- setDimensions({
17596
- width: wrapperWidth,
17597
- height: wrapperHeight
17598
- });
17599
- }, [setDimensions, wrapperHeight, wrapperWidth]);
17600
17574
  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;
17601
17575
  var paddingAndBorderPx = padding * 2 + (borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0) * 2;
17602
17576
  var images = useImagesWithBackToFront(userSuppliedImages, isBackToFront);
@@ -17604,28 +17578,18 @@
17604
17578
  var currentImage = images[orientation][requestedAction === 'FLIP_ID' ? 'SHOW_ID_FRONT' : requestedAction];
17605
17579
  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;
17606
17580
  var centerRegionMinWidth = imageAspectRatio >= wrapperAspectRatio ? wrapperWidth - paddingAndBorderPx : undefined;
17607
- var onImageLoaded = React.useCallback(function (e) {
17608
- guideOrientationOnImageLoaded(e);
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
17612
- });
17613
- }, [guideOrientationOnImageLoaded, currentImage, imageDimensions.height, imageDimensions.width]);
17614
17581
  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]);
17582
+ setImageAspectRatio(currentImage.width / currentImage.height);
17583
+ }, [currentImage.height, currentImage.width, setImageAspectRatio]);
17584
+ function onImageLoaded() {
17585
+ dispatchIdCaptureAction({
17586
+ type: 'guideImageLoaded',
17587
+ payload: {
17588
+ width: currentImage.width,
17589
+ height: currentImage.height
17590
+ }
17591
+ });
17592
+ }
17629
17593
  return /*#__PURE__*/React.createElement(StyledPageContainer, {
17630
17594
  ref: wrapperRef,
17631
17595
  onClick: onClick,
@@ -17655,10 +17619,10 @@
17655
17619
  className: classNames.centerRegionBorder
17656
17620
  }, /*#__PURE__*/React.createElement(GuideCenterInner, {
17657
17621
  "$isLandscape": orientation === 'landscape',
17658
- ref: containerRef,
17622
+ ref: innerRef,
17659
17623
  className: classNames.centerRegionInner,
17660
17624
  style: {
17661
- aspectRatio: imageDimensions.width && imageDimensions.height ? imageDimensions.width / imageDimensions.height : 1
17625
+ aspectRatio: imageAspectRatio
17662
17626
  }
17663
17627
  }, /*#__PURE__*/React.createElement(IdCardGuideImageContainer, {
17664
17628
  status: status,
@@ -17666,7 +17630,7 @@
17666
17630
  borderWidth: idCardBorderWidth,
17667
17631
  borderColor: idCardBorderColor,
17668
17632
  "$isVisible": requestedAction !== 'FLIP_ID',
17669
- aspectRatio: imageDimensions.width && imageDimensions.height ? imageDimensions.width / imageDimensions.height : 1
17633
+ aspectRatio: imageAspectRatio
17670
17634
  }, /*#__PURE__*/React.createElement(IdCardGuideImage, {
17671
17635
  alt: "",
17672
17636
  src: currentImage.url,
@@ -17674,8 +17638,8 @@
17674
17638
  className: classNames.image,
17675
17639
  "$isInvisible": !imageVisible,
17676
17640
  "$isMirrored": isMirrored,
17677
- width: containerDimensions.width ? containerDimensions.width : imageDimensions.width,
17678
- height: containerDimensions.height ? containerDimensions.height : imageDimensions.height
17641
+ width: innerWidth || currentImage.width,
17642
+ height: innerHeight || currentImage.height
17679
17643
  })), requestedAction === 'FLIP_ID' && ( /*#__PURE__*/React.createElement(FlipIdPrompt, {
17680
17644
  images: images,
17681
17645
  borderWidth: idCardBorderWidth,
@@ -17683,8 +17647,8 @@
17683
17647
  portraitGuidesOnMobile: portraitGuidesOnMobile,
17684
17648
  isMirrored: isMirrored,
17685
17649
  classNames: classNames.flipIdPrompt,
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
17650
+ width: innerWidth,
17651
+ height: innerHeight
17688
17652
  }))))), /*#__PURE__*/React.createElement(Spacer, {
17689
17653
  "$maskColor": maskColor,
17690
17654
  "$minWidth": padding,
@@ -17724,14 +17688,14 @@
17724
17688
  }, function (props) {
17725
17689
  return props.$isMirrored ? 'transform: scaleX(-1);' : '';
17726
17690
  });
17727
- var GuideCenterBorder = styled.div(templateObject_7$4 || (templateObject_7$4 = __makeTemplateObject(["\n box-sizing: border-box;\n border: ", ";\n display: flex;\n flex: 1;\n justify-content: center;\n max-height: 100%;\n min-height: 0;\n position: relative;\n ", "\n"], ["\n box-sizing: border-box;\n border: ", ";\n display: flex;\n flex: 1;\n justify-content: center;\n max-height: 100%;\n min-height: 0;\n position: relative;\n ", "\n"])), function (props) {
17691
+ var GuideCenterBorder = styled.div(templateObject_7$4 || (templateObject_7$4 = __makeTemplateObject(["\n box-sizing: border-box;\n border: ", ";\n display: flex;\n flex: 1;\n justify-content: center;\n max-height: 100%;\n min-height: 0;\n max-width: 100%;\n position: relative;\n ", "\n"], ["\n box-sizing: border-box;\n border: ", ";\n display: flex;\n flex: 1;\n justify-content: center;\n max-height: 100%;\n min-height: 0;\n max-width: 100%;\n position: relative;\n ", "\n"])), function (props) {
17728
17692
  var _a, _b;
17729
17693
  return "".concat((_a = props.$borderWidth) !== null && _a !== void 0 ? _a : 4, "px solid ").concat((_b = props.$borderColor) !== null && _b !== void 0 ? _b : 'white');
17730
17694
  }, function (props) {
17731
17695
  return props.$padding ? "padding: ".concat(props.$padding, "px;") : '';
17732
17696
  });
17733
17697
  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"])));
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) {
17698
+ 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 align-items: center;\n justify-content: center;\n"], ["\n position: relative;\n margin: auto;\n ", "\n max-height: 100%;\n max-width: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n"])), function (props) {
17735
17699
  return props.$isLandscape ? 'height: 100%;' : 'width: 90%;';
17736
17700
  });
17737
17701
  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;