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.
package/dist/sdk2.esm.js CHANGED
@@ -204,7 +204,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
204
204
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
205
205
  };
206
206
 
207
- var webSdkVersion = '2.3.33';
207
+ var webSdkVersion = '2.3.35';
208
208
 
209
209
  function getPlatform() {
210
210
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -475,7 +475,7 @@ var OverlayInner$2 = styled.div(templateObject_2$D || (templateObject_2$D = __ma
475
475
  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"])));
476
476
  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"])));
477
477
  var GrayOverlayContainer = styled(OverlayContainer)(templateObject_5$e || (templateObject_5$e = __makeTemplateObject(["\n background: #f7f6fb;\n"], ["\n background: #f7f6fb;\n"])));
478
- 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"])));
478
+ 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"])));
479
479
  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"])));
480
480
  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) {
481
481
  var _a, _b;
@@ -514,7 +514,7 @@ var LoadingOverlayLoadingListItem = styled.li(templateObject_19 || (templateObje
514
514
  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"])));
515
515
  var LoadingOverlayCustomLoadingGraphic = styled.img(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n transform-style: preserve-3d;\n"], ["\n transform-style: preserve-3d;\n"])));
516
516
  var LoadingOverlayContinueButtonContainer = styled.div(templateObject_22 || (templateObject_22 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
517
- 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;
517
+ 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;
518
518
 
519
519
  var GeolocationAccessDeniedOverlay = function GeolocationAccessDeniedOverlay(_a) {
520
520
  var accessBlockedImageUrl = _a.accessBlockedImageUrl;
@@ -7582,7 +7582,7 @@ var ButtonsRow$1 = styled(LoadingOverlayButtonsRow)(templateObject_5$c || (templ
7582
7582
  var _a, _b, _c, _d, _e, _f;
7583
7583
  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, ";") : '';
7584
7584
  });
7585
- var ProgressBarBackground$1 = styled(LoadingOverlayProgressBarBackground)(templateObject_6$8 || (templateObject_6$8 = __makeTemplateObject(["\n background: ", ";\n opacity: ", ";\n"], ["\n background: ", ";\n opacity: ", ";\n"])), function (props) {
7585
+ var ProgressBarBackground$1 = styled(LoadingOverlayProgressBarBackground)(templateObject_6$9 || (templateObject_6$9 = __makeTemplateObject(["\n background: ", ";\n opacity: ", ";\n"], ["\n background: ", ";\n opacity: ", ";\n"])), function (props) {
7586
7586
  var _a, _b, _c, _d;
7587
7587
  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)';
7588
7588
  }, function (props) {
@@ -7612,7 +7612,7 @@ var ContinueButton$1 = styled(LoaderButton)(templateObject_8$3 || (templateObjec
7612
7612
  var _a, _b, _c, _d;
7613
7613
  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';
7614
7614
  });
7615
- 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;
7615
+ 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;
7616
7616
 
7617
7617
  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"])));
7618
7618
  var ContinuityCameraCheckbox = styled.input(templateObject_2$w || (templateObject_2$w = __makeTemplateObject(["\n margin-right: 8px;\n"], ["\n margin-right: 8px;\n"])));
@@ -7863,8 +7863,8 @@ var ImagesContainer = styled(OverlayImageContainer)(templateObject_2$u || (templ
7863
7863
  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"])));
7864
7864
  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"])));
7865
7865
  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"])));
7866
- 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"])));
7867
- var templateObject_1$B, templateObject_2$u, templateObject_3$l, templateObject_4$f, templateObject_5$b, templateObject_6$7;
7866
+ 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"])));
7867
+ var templateObject_1$B, templateObject_2$u, templateObject_3$l, templateObject_4$f, templateObject_5$b, templateObject_6$8;
7868
7868
 
7869
7869
  function useShowSuccessScreen(skipSuccessScreen, successScreenReady, onDoneCallback) {
7870
7870
  var _this = this;
@@ -7962,12 +7962,13 @@ function IdCardBorder(_a) {
7962
7962
  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;
7963
7963
  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';
7964
7964
  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;
7965
- return /*#__PURE__*/React__default.createElement(IdCardBorderContainer, _assign({}, props), /*#__PURE__*/React__default.createElement("div", {
7965
+ return /*#__PURE__*/React__default.createElement(IdCardBorderContainer, _assign({}, props, {
7966
+ style: _assign(_assign({}, props.style), {
7967
+ aspectRatio: aspectRatio
7968
+ })
7969
+ }), /*#__PURE__*/React__default.createElement(IdCardBorderInner, {
7966
7970
  ref: ref,
7967
7971
  style: {
7968
- maxHeight: '100%',
7969
- maxWidth: '100%',
7970
- display: 'flex',
7971
7972
  aspectRatio: aspectRatio
7972
7973
  }
7973
7974
  }, children), status === 'ready' && !wavesDisabled && ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(IdCardBorderSvg, {
@@ -8067,16 +8068,17 @@ function IdCardBorderSvg(_a) {
8067
8068
  className: isProgressBar ? "idmSdkProgressBorder ".concat(progressPaused ? 'idmSdkProgressPaused' : '') : ''
8068
8069
  }));
8069
8070
  }
8070
- 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);
8071
- 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"])));
8072
- 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) {
8071
+ 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);
8072
+ 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"])));
8073
+ 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"])));
8074
+ 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) {
8073
8075
  var _a;
8074
8076
  return (_a = props.$speed) !== null && _a !== void 0 ? _a : '3s';
8075
8077
  }, function (props) {
8076
8078
  var _a;
8077
8079
  return (_a = props.$fillMode) !== null && _a !== void 0 ? _a : 'forwards';
8078
8080
  });
8079
- var templateObject_1$A, templateObject_2$t, templateObject_3$k, templateObject_4$e, templateObject_5$a;
8081
+ var templateObject_1$A, templateObject_2$t, templateObject_3$k, templateObject_4$e, templateObject_5$a, templateObject_6$7;
8080
8082
 
8081
8083
  var defaultIdCaptureGuideImages = {
8082
8084
  portrait: {
@@ -8266,19 +8268,12 @@ var GuideOrientationContext = /*#__PURE__*/createContext({
8266
8268
  wrapperAspectRatio: 0,
8267
8269
  imageAspectRatio: 0,
8268
8270
  wrapperRef: null,
8269
- setDimensions: function setDimensions() {
8270
- return null;
8271
- },
8272
- onImageLoaded: function onImageLoaded() {
8271
+ setImageAspectRatio: function setImageAspectRatio() {
8273
8272
  return null;
8274
8273
  }
8275
8274
  });
8276
8275
  function GuideOrientationContextProvider(_a) {
8277
8276
  var children = _a.children;
8278
- var setDimensions = useState({
8279
- width: 1,
8280
- height: 1
8281
- })[1];
8282
8277
  var _b = useState(1),
8283
8278
  imageAspectRatio = _b[0],
8284
8279
  setImageAspectRatio = _b[1];
@@ -8291,10 +8286,6 @@ function GuideOrientationContextProvider(_a) {
8291
8286
  var wrapperAspectRatio = useMemo(function () {
8292
8287
  return wrapperWidth / wrapperHeight;
8293
8288
  }, [wrapperHeight, wrapperWidth]);
8294
- var onImageLoaded = useCallback(function (e) {
8295
- var img = e.target;
8296
- setImageAspectRatio(img.naturalWidth / img.naturalHeight);
8297
- }, []);
8298
8289
  var orientation = 'landscape'; //width > height ? 'landscape' : 'portrait'
8299
8290
  var value = useMemo(function () {
8300
8291
  return {
@@ -8303,11 +8294,10 @@ function GuideOrientationContextProvider(_a) {
8303
8294
  wrapperHeight: wrapperHeight,
8304
8295
  wrapperAspectRatio: wrapperAspectRatio,
8305
8296
  imageAspectRatio: imageAspectRatio,
8306
- setDimensions: setDimensions,
8307
- wrapperRef: wrapperRef,
8308
- onImageLoaded: onImageLoaded
8297
+ setImageAspectRatio: setImageAspectRatio,
8298
+ wrapperRef: wrapperRef
8309
8299
  };
8310
- }, [imageAspectRatio, onImageLoaded, setDimensions, wrapperAspectRatio, wrapperHeight, wrapperRef, wrapperWidth]);
8300
+ }, [imageAspectRatio, wrapperAspectRatio, wrapperHeight, wrapperRef, wrapperWidth]);
8311
8301
  return /*#__PURE__*/React__default.createElement(GuideOrientationContext.Provider, {
8312
8302
  value: value
8313
8303
  }, children);
@@ -8335,7 +8325,7 @@ var FlipIdPrompt = function FlipIdPrompt(_a) {
8335
8325
  portraitGuidesOnMobile = _g === void 0 ? true : _g,
8336
8326
  _h = _a.classNames,
8337
8327
  classNames = _h === void 0 ? {} : _h;
8338
- var onImageLoaded = useGuideOrientationContext().onImageLoaded;
8328
+ var imageAspectRatio = useGuideOrientationContext().imageAspectRatio;
8339
8329
  var orientation = getOrientation(portraitGuidesOnMobile);
8340
8330
  var _j = useState(1),
8341
8331
  transitionTime = _j[0],
@@ -8372,12 +8362,12 @@ var FlipIdPrompt = function FlipIdPrompt(_a) {
8372
8362
  borderRadius: borderRadius,
8373
8363
  "$transforms": frontTransforms.join(' '),
8374
8364
  "$transitionTime": transitionTime,
8365
+ aspectRatio: imageAspectRatio,
8375
8366
  "$isVisible": true
8376
8367
  }, /*#__PURE__*/React__default.createElement(IdCardGuideImage, {
8377
8368
  alt: "",
8378
8369
  src: images[orientation].SHOW_ID_FRONT.url,
8379
8370
  className: classNames.frontImage,
8380
- onLoad: onImageLoaded,
8381
8371
  width: width,
8382
8372
  height: height
8383
8373
  })), /*#__PURE__*/React__default.createElement(FlipImageContainer, {
@@ -8388,6 +8378,7 @@ var FlipIdPrompt = function FlipIdPrompt(_a) {
8388
8378
  borderRadius: borderRadius,
8389
8379
  "$transforms": backTransforms.join(' '),
8390
8380
  "$transitionTime": transitionTime,
8381
+ aspectRatio: imageAspectRatio,
8391
8382
  "$isVisible": true
8392
8383
  }, /*#__PURE__*/React__default.createElement(IdCardGuideImage, {
8393
8384
  alt: "",
@@ -8399,66 +8390,49 @@ var FlipIdPrompt = function FlipIdPrompt(_a) {
8399
8390
  };
8400
8391
 
8401
8392
  var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
8402
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
8403
- var _u = _a.classNames,
8404
- classNames = _u === void 0 ? {} : _u,
8405
- _v = _a.images,
8406
- userSuppliedImages = _v === void 0 ? defaultIdCaptureGuideImages : _v,
8393
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
8394
+ var _s = _a.classNames,
8395
+ classNames = _s === void 0 ? {} : _s,
8396
+ _t = _a.images,
8397
+ userSuppliedImages = _t === void 0 ? defaultIdCaptureGuideImages : _t,
8407
8398
  userSuppliedPadding = _a.padding,
8408
8399
  userSuppliedImagePadding = _a.imagePadding,
8409
- _w = _a.imageVisible,
8410
- imageVisible = _w === void 0 ? true : _w,
8400
+ _u = _a.imageVisible,
8401
+ imageVisible = _u === void 0 ? true : _u,
8411
8402
  borderWidth = _a.borderWidth,
8412
8403
  borderColor = _a.borderColor,
8413
- _x = _a.idCardBorderWidth,
8414
- idCardBorderWidth = _x === void 0 ? '2.5%' : _x,
8415
- _y = _a.idCardBorderColor,
8416
- idCardBorderColor = _y === void 0 ? 'white' : _y,
8404
+ _v = _a.idCardBorderWidth,
8405
+ idCardBorderWidth = _v === void 0 ? '2.5%' : _v,
8406
+ _w = _a.idCardBorderColor,
8407
+ idCardBorderColor = _w === void 0 ? 'white' : _w,
8417
8408
  maskColor = _a.maskColor,
8418
- _z = _a.isMirrored,
8419
- isMirrored = _z === void 0 ? false : _z,
8420
- _0 = _a.isBackToFront,
8421
- isBackToFront = _0 === void 0 ? false : _0,
8422
- _1 = _a.portraitGuidesOnMobile,
8423
- portraitGuidesOnMobile = _1 === void 0 ? true : _1,
8424
- _2 = _a.instruction,
8425
- instruction = _2 === void 0 ? '' : _2,
8426
- _3 = _a.requestedAction,
8427
- requestedAction = _3 === void 0 ? 'SHOW_ID_FRONT' : _3,
8428
- _4 = _a.progress,
8429
- progress = _4 === void 0 ? 0 : _4,
8430
- _5 = _a.status,
8431
- status = _5 === void 0 ? 'ready' : _5,
8409
+ _x = _a.isMirrored,
8410
+ isMirrored = _x === void 0 ? false : _x,
8411
+ _y = _a.isBackToFront,
8412
+ isBackToFront = _y === void 0 ? false : _y,
8413
+ _z = _a.portraitGuidesOnMobile,
8414
+ portraitGuidesOnMobile = _z === void 0 ? true : _z,
8415
+ _0 = _a.instruction,
8416
+ instruction = _0 === void 0 ? '' : _0,
8417
+ _1 = _a.requestedAction,
8418
+ requestedAction = _1 === void 0 ? 'SHOW_ID_FRONT' : _1,
8419
+ _2 = _a.progress,
8420
+ progress = _2 === void 0 ? 0 : _2,
8421
+ _3 = _a.status,
8422
+ status = _3 === void 0 ? 'ready' : _3,
8432
8423
  onClick = _a.onClick;
8433
- var _6 = useGuideOrientationContext(),
8434
- wrapperRef = _6.wrapperRef,
8435
- wrapperWidth = _6.wrapperWidth,
8436
- wrapperHeight = _6.wrapperHeight,
8437
- imageAspectRatio = _6.imageAspectRatio,
8438
- wrapperAspectRatio = _6.wrapperAspectRatio,
8439
- guideOrientationOnImageLoaded = _6.onImageLoaded,
8440
- setDimensions = _6.setDimensions;
8441
- var containerRef = useRef(null);
8442
- var _7 = useState({
8443
- width: 0,
8444
- height: 0
8445
- }),
8446
- imageDimensions = _7[0],
8447
- setImageDimensions = _7[1];
8448
- var _8 = useState({
8449
- width: 0,
8450
- height: 0
8451
- }),
8452
- containerDimensions = _8[0],
8453
- setContainerDimensions = _8[1];
8424
+ var _4 = useGuideOrientationContext(),
8425
+ wrapperRef = _4.wrapperRef,
8426
+ wrapperWidth = _4.wrapperWidth,
8427
+ imageAspectRatio = _4.imageAspectRatio,
8428
+ wrapperAspectRatio = _4.wrapperAspectRatio,
8429
+ setImageAspectRatio = _4.setImageAspectRatio;
8430
+ var _5 = useResizeObserver(),
8431
+ innerRef = _5.ref,
8432
+ innerWidth = _5.width,
8433
+ innerHeight = _5.height;
8454
8434
  var theme = useTheme();
8455
8435
  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;
8456
- useEffect(function () {
8457
- setDimensions({
8458
- width: wrapperWidth,
8459
- height: wrapperHeight
8460
- });
8461
- }, [setDimensions, wrapperHeight, wrapperWidth]);
8462
8436
  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;
8463
8437
  var paddingAndBorderPx = padding * 2 + (borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0) * 2;
8464
8438
  var images = useImagesWithBackToFront(userSuppliedImages, isBackToFront);
@@ -8466,28 +8440,18 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
8466
8440
  var currentImage = images[orientation][requestedAction === 'FLIP_ID' ? 'SHOW_ID_FRONT' : requestedAction];
8467
8441
  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;
8468
8442
  var centerRegionMinWidth = imageAspectRatio >= wrapperAspectRatio ? wrapperWidth - paddingAndBorderPx : undefined;
8469
- var onImageLoaded = useCallback(function (e) {
8470
- guideOrientationOnImageLoaded(e);
8471
- setImageDimensions({
8472
- width: (currentImage === null || currentImage === void 0 ? void 0 : currentImage.width) || imageDimensions.width,
8473
- height: (currentImage === null || currentImage === void 0 ? void 0 : currentImage.height) || imageDimensions.height
8474
- });
8475
- }, [guideOrientationOnImageLoaded, currentImage, imageDimensions.height, imageDimensions.width]);
8476
8443
  useEffect(function () {
8477
- if (containerRef.current && containerRef.current.clientWidth && containerRef.current.clientHeight) {
8478
- setContainerDimensions({
8479
- width: containerRef.current.clientWidth,
8480
- height: containerRef.current.clientHeight
8481
- });
8482
- dispatchIdCaptureAction({
8483
- type: 'guideImageLoaded',
8484
- payload: {
8485
- width: imageDimensions.width,
8486
- height: imageDimensions.height
8487
- }
8488
- });
8489
- }
8490
- }, [setDimensions, setContainerDimensions, imageDimensions.height, imageDimensions.width]);
8444
+ setImageAspectRatio(currentImage.width / currentImage.height);
8445
+ }, [currentImage.height, currentImage.width, setImageAspectRatio]);
8446
+ function onImageLoaded() {
8447
+ dispatchIdCaptureAction({
8448
+ type: 'guideImageLoaded',
8449
+ payload: {
8450
+ width: currentImage.width,
8451
+ height: currentImage.height
8452
+ }
8453
+ });
8454
+ }
8491
8455
  return /*#__PURE__*/React__default.createElement(StyledPageContainer, {
8492
8456
  ref: wrapperRef,
8493
8457
  onClick: onClick,
@@ -8517,10 +8481,10 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
8517
8481
  className: classNames.centerRegionBorder
8518
8482
  }, /*#__PURE__*/React__default.createElement(GuideCenterInner, {
8519
8483
  "$isLandscape": orientation === 'landscape',
8520
- ref: containerRef,
8484
+ ref: innerRef,
8521
8485
  className: classNames.centerRegionInner,
8522
8486
  style: {
8523
- aspectRatio: imageDimensions.width && imageDimensions.height ? imageDimensions.width / imageDimensions.height : 1
8487
+ aspectRatio: imageAspectRatio
8524
8488
  }
8525
8489
  }, /*#__PURE__*/React__default.createElement(IdCardGuideImageContainer, {
8526
8490
  status: status,
@@ -8528,7 +8492,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
8528
8492
  borderWidth: idCardBorderWidth,
8529
8493
  borderColor: idCardBorderColor,
8530
8494
  "$isVisible": requestedAction !== 'FLIP_ID',
8531
- aspectRatio: imageDimensions.width && imageDimensions.height ? imageDimensions.width / imageDimensions.height : 1
8495
+ aspectRatio: imageAspectRatio
8532
8496
  }, /*#__PURE__*/React__default.createElement(IdCardGuideImage, {
8533
8497
  alt: "",
8534
8498
  src: currentImage.url,
@@ -8536,8 +8500,8 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
8536
8500
  className: classNames.image,
8537
8501
  "$isInvisible": !imageVisible,
8538
8502
  "$isMirrored": isMirrored,
8539
- width: containerDimensions.width ? containerDimensions.width : imageDimensions.width,
8540
- height: containerDimensions.height ? containerDimensions.height : imageDimensions.height
8503
+ width: innerWidth || currentImage.width,
8504
+ height: innerHeight || currentImage.height
8541
8505
  })), requestedAction === 'FLIP_ID' && ( /*#__PURE__*/React__default.createElement(FlipIdPrompt, {
8542
8506
  images: images,
8543
8507
  borderWidth: idCardBorderWidth,
@@ -8545,8 +8509,8 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
8545
8509
  portraitGuidesOnMobile: portraitGuidesOnMobile,
8546
8510
  isMirrored: isMirrored,
8547
8511
  classNames: classNames.flipIdPrompt,
8548
- width: (_s = currentImage === null || currentImage === void 0 ? void 0 : currentImage.width) !== null && _s !== void 0 ? _s : imageDimensions.width,
8549
- height: (_t = currentImage === null || currentImage === void 0 ? void 0 : currentImage.width) !== null && _t !== void 0 ? _t : imageDimensions.height
8512
+ width: innerWidth,
8513
+ height: innerHeight
8550
8514
  }))))), /*#__PURE__*/React__default.createElement(Spacer, {
8551
8515
  "$maskColor": maskColor,
8552
8516
  "$minWidth": padding,
@@ -8586,14 +8550,14 @@ var GuideCenterRegion = styled.div(templateObject_6$6 || (templateObject_6$6 = _
8586
8550
  }, function (props) {
8587
8551
  return props.$isMirrored ? 'transform: scaleX(-1);' : '';
8588
8552
  });
8589
- 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) {
8553
+ 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) {
8590
8554
  var _a, _b;
8591
8555
  return "".concat((_a = props.$borderWidth) !== null && _a !== void 0 ? _a : 4, "px solid ").concat((_b = props.$borderColor) !== null && _b !== void 0 ? _b : 'white');
8592
8556
  }, function (props) {
8593
8557
  return props.$padding ? "padding: ".concat(props.$padding, "px;") : '';
8594
8558
  });
8595
8559
  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"])));
8596
- 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) {
8560
+ 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) {
8597
8561
  return props.$isLandscape ? 'height: 100%;' : 'width: 90%;';
8598
8562
  });
8599
8563
  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;