idmission-web-sdk 2.3.33 → 2.3.34

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.
@@ -1,16 +1,12 @@
1
- import React, { ReactElement, ReactNode, RefCallback, SyntheticEvent } from 'react';
1
+ import React, { ReactElement, ReactNode, RefCallback } from 'react';
2
2
  export type GuideOrientationState = {
3
3
  orientation: 'portrait' | 'landscape';
4
4
  wrapperWidth: number;
5
5
  wrapperHeight: number;
6
6
  wrapperAspectRatio: number;
7
7
  imageAspectRatio: number;
8
+ setImageAspectRatio: (n: number) => void;
8
9
  wrapperRef: RefCallback<HTMLDivElement>;
9
- setDimensions: (dimensions: {
10
- width: number;
11
- height: number;
12
- }) => void;
13
- onImageLoaded: (e: SyntheticEvent) => void;
14
10
  };
15
11
  export declare const GuideOrientationContext: React.Context<GuideOrientationState>;
16
12
  export default function GuideOrientationContextProvider({ children, }: {
@@ -1 +1 @@
1
- {"version":3,"file":"GuideOrientationContextProvider.d.ts","sourceRoot":"","sources":["../../src/components/GuideOrientationContextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEZ,YAAY,EACZ,SAAS,EACT,WAAW,EACX,cAAc,EAKf,MAAM,OAAO,CAAA;AAGd,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,UAAU,GAAG,WAAW,CAAA;IACrC,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,WAAW,CAAC,cAAc,CAAC,CAAA;IACvC,aAAa,EAAE,CAAC,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IACtE,aAAa,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,CAAA;CAC3C,CAAA;AAED,eAAO,MAAM,uBAAuB,sCASlC,CAAA;AAEF,MAAM,CAAC,OAAO,UAAU,+BAA+B,CAAC,EACtD,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;CACpB,GAAG,YAAY,CA+Cf;AAED,wBAAgB,0BAA0B,IAAI,qBAAqB,CAOlE"}
1
+ {"version":3,"file":"GuideOrientationContextProvider.d.ts","sourceRoot":"","sources":["../../src/components/GuideOrientationContextProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAEZ,YAAY,EACZ,SAAS,EACT,WAAW,EAIZ,MAAM,OAAO,CAAA;AAGd,MAAM,MAAM,qBAAqB,GAAG;IAClC,WAAW,EAAE,UAAU,GAAG,WAAW,CAAA;IACrC,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,gBAAgB,EAAE,MAAM,CAAA;IACxB,mBAAmB,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,UAAU,EAAE,WAAW,CAAC,cAAc,CAAC,CAAA;CACxC,CAAA;AAED,eAAO,MAAM,uBAAuB,sCAQlC,CAAA;AAEF,MAAM,CAAC,OAAO,UAAU,+BAA+B,CAAC,EACtD,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,SAAS,CAAA;CACpB,GAAG,YAAY,CAsCf;AAED,wBAAgB,0BAA0B,IAAI,qBAAqB,CAOlE"}
@@ -1 +1 @@
1
- {"version":3,"file":"FlipIdPrompt.d.ts","sourceRoot":"","sources":["../../../src/components/id_capture/FlipIdPrompt.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,YAAY,EAAuB,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAI5D,OAAO,EAGL,oBAAoB,EACrB,MAAM,iBAAiB,CAAA;AAExB,MAAM,MAAM,sBAAsB,GAAG;IACnC,mBAAmB,C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ACnB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,eAAe,CAAC,EAAE,wBAAwB,CAAA;CAC3C,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,CAAC,EAAE,oBAAoB,CAAA;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,UAAU,CAAC,EAAE,sBAAsB,CAAA;IACnC,QAAQ,CAAC,EAAE,oBAAoB,CAAA;CAChC,CAAA;AAED,eAAO,MAAM,YAAY,uHAUtB,iBAAiB,KAAG,YAyEtB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"IdCaptureGuideOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/id_capture/IdCaptureGuideOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,YAAY,EAMb,MAAM,OAAO,CAAA;AAId,OAAO,EAGL,iBAAiB,EAClB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAgB,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAErE,OAAO,EAGL,oBAAoB,EAErB,MAAM,iBAAiB,CAAA;AAExB,MAAM,MAAM,+BAA+B,GAAG;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kBAAkB,CAA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AAO,MAAM,eAAe,yMAK3B,CAAA;AAED,eAAO,MAAM,cAAc,yMAW1B,CAAA;AAED,eAAO,MAAM,WAAW;gBACV,MAAM;iBACL,MAAM;iBACN,MAAM;YAiBpB,CAAA;AAED,eAAO,MAAM,MAAM;gBArBL,MAAM;iBACL,MAAM;iBACN,MAAM;;;mBAsBpB,CAAA;AAED,eAAO,MAAM,iBAAiB;gBAChB,MAAM;kBACJ,OAAO;YAUtB,CAAA;AAED,eAAO,MAAM,iBAAiB;kBACd,MAAM;mBACL,MAAM;eACV,MAAM;YAYlB,CAAA;AAED,eAAO,MAAM,SAAS,2MAIrB,CAAA;AAED,eAAO,MAAM,gBAAgB;mBAA+B,OAAO;YAOlE,CAAA"}
1
+ {"version":3,"file":"IdCaptureGuideOverlay.d.ts","sourceRoot":"","sources":["../../../src/components/id_capture/IdCaptureGuideOverlay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAI3C,OAAO,EAGL,iBAAiB,EAClB,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAgB,sBAAsB,EAAE,MAAM,gBAAgB,CAAA;AAErE,OAAO,EAGL,oBAAoB,EAErB,MAAM,iBAAiB,CAAA;AAGxB,MAAM,MAAM,+BAA+B,GAAG;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAA;IAC3B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC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CAAA;AAED,eAAO,MAAM,iBAAiB;gBAChB,MAAM;kBACJ,OAAO;YAUtB,CAAA;AAED,eAAO,MAAM,iBAAiB;kBACd,MAAM;mBACL,MAAM;eACV,MAAM;YAalB,CAAA;AAED,eAAO,MAAM,SAAS,2MAIrB,CAAA;AAED,eAAO,MAAM,gBAAgB;mBAA+B,OAAO;YASlE,CAAA"}
@@ -235,7 +235,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
235
235
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
236
236
  };
237
237
 
238
- var webSdkVersion = '2.3.33';
238
+ var webSdkVersion = '2.3.34';
239
239
 
240
240
  function getPlatform() {
241
241
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -7993,7 +7993,11 @@ function IdCardBorder(_a) {
7993
7993
  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;
7994
7994
  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';
7995
7995
  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;
7996
- return /*#__PURE__*/React__namespace.default.createElement(IdCardBorderContainer, _assign({}, props), /*#__PURE__*/React__namespace.default.createElement("div", {
7996
+ return /*#__PURE__*/React__namespace.default.createElement(IdCardBorderContainer, _assign({}, props, {
7997
+ style: {
7998
+ aspectRatio: aspectRatio
7999
+ }
8000
+ }), /*#__PURE__*/React__namespace.default.createElement("div", {
7997
8001
  ref: ref,
7998
8002
  style: {
7999
8003
  maxHeight: '100%',
@@ -8098,7 +8102,7 @@ function IdCardBorderSvg(_a) {
8098
8102
  className: isProgressBar ? "idmSdkProgressBorder ".concat(progressPaused ? 'idmSdkProgressPaused' : '') : ''
8099
8103
  }));
8100
8104
  }
8101
- var IdCardBorderContainer = styled__default.default.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);
8105
+ var IdCardBorderContainer = styled__default.default.div(templateObject_3$k || (templateObject_3$k = __makeTemplateObject(["\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 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);
8102
8106
  var SvgOverlay = styled__default.default.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"])));
8103
8107
  var IdCardBorderRect = styled__default.default.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) {
8104
8108
  var _a;
@@ -8290,65 +8294,6 @@ var FlipImageContainer = styled__default.default(IdCardGuideImageContainer)(temp
8290
8294
  });
8291
8295
  var templateObject_1$z;
8292
8296
 
8293
- var GuideOrientationContext = /*#__PURE__*/React.createContext({
8294
- orientation: 'landscape',
8295
- wrapperWidth: 1,
8296
- wrapperHeight: 1,
8297
- wrapperAspectRatio: 0,
8298
- imageAspectRatio: 0,
8299
- wrapperRef: null,
8300
- setDimensions: function setDimensions() {
8301
- return null;
8302
- },
8303
- onImageLoaded: function onImageLoaded() {
8304
- return null;
8305
- }
8306
- });
8307
- function GuideOrientationContextProvider(_a) {
8308
- var children = _a.children;
8309
- var setDimensions = React.useState({
8310
- width: 1,
8311
- height: 1
8312
- })[1];
8313
- var _b = React.useState(1),
8314
- imageAspectRatio = _b[0],
8315
- setImageAspectRatio = _b[1];
8316
- var _c = useResizeObserver(),
8317
- wrapperRef = _c.ref,
8318
- _d = _c.width,
8319
- wrapperWidth = _d === void 0 ? 1 : _d,
8320
- _e = _c.height,
8321
- wrapperHeight = _e === void 0 ? 1 : _e;
8322
- var wrapperAspectRatio = React.useMemo(function () {
8323
- return wrapperWidth / wrapperHeight;
8324
- }, [wrapperHeight, wrapperWidth]);
8325
- var onImageLoaded = React.useCallback(function (e) {
8326
- var img = e.target;
8327
- setImageAspectRatio(img.naturalWidth / img.naturalHeight);
8328
- }, []);
8329
- var orientation = 'landscape'; //width > height ? 'landscape' : 'portrait'
8330
- var value = React.useMemo(function () {
8331
- return {
8332
- orientation: orientation,
8333
- wrapperWidth: wrapperWidth,
8334
- wrapperHeight: wrapperHeight,
8335
- wrapperAspectRatio: wrapperAspectRatio,
8336
- imageAspectRatio: imageAspectRatio,
8337
- setDimensions: setDimensions,
8338
- wrapperRef: wrapperRef,
8339
- onImageLoaded: onImageLoaded
8340
- };
8341
- }, [imageAspectRatio, onImageLoaded, setDimensions, wrapperAspectRatio, wrapperHeight, wrapperRef, wrapperWidth]);
8342
- return /*#__PURE__*/React__namespace.default.createElement(GuideOrientationContext.Provider, {
8343
- value: value
8344
- }, children);
8345
- }
8346
- function useGuideOrientationContext() {
8347
- var ctx = React.useContext(GuideOrientationContext);
8348
- if (!ctx) throw new Error('useGuideOrientationContext cannot be used without GuideOrientationContextProvider');
8349
- return ctx;
8350
- }
8351
-
8352
8297
  var FlipIdPrompt = function FlipIdPrompt(_a) {
8353
8298
  var _b = _a.images,
8354
8299
  images = _b === void 0 ? defaultIdCaptureGuideImages : _b,
@@ -8366,7 +8311,6 @@ var FlipIdPrompt = function FlipIdPrompt(_a) {
8366
8311
  portraitGuidesOnMobile = _g === void 0 ? true : _g,
8367
8312
  _h = _a.classNames,
8368
8313
  classNames = _h === void 0 ? {} : _h;
8369
- var onImageLoaded = useGuideOrientationContext().onImageLoaded;
8370
8314
  var orientation = getOrientation(portraitGuidesOnMobile);
8371
8315
  var _j = React.useState(1),
8372
8316
  transitionTime = _j[0],
@@ -8408,7 +8352,6 @@ var FlipIdPrompt = function FlipIdPrompt(_a) {
8408
8352
  alt: "",
8409
8353
  src: images[orientation].SHOW_ID_FRONT.url,
8410
8354
  className: classNames.frontImage,
8411
- onLoad: onImageLoaded,
8412
8355
  width: width,
8413
8356
  height: height
8414
8357
  })), /*#__PURE__*/React__namespace.default.createElement(FlipImageContainer, {
@@ -8429,67 +8372,97 @@ var FlipIdPrompt = function FlipIdPrompt(_a) {
8429
8372
  })));
8430
8373
  };
8431
8374
 
8375
+ var GuideOrientationContext = /*#__PURE__*/React.createContext({
8376
+ orientation: 'landscape',
8377
+ wrapperWidth: 1,
8378
+ wrapperHeight: 1,
8379
+ wrapperAspectRatio: 0,
8380
+ imageAspectRatio: 0,
8381
+ wrapperRef: null,
8382
+ setImageAspectRatio: function setImageAspectRatio() {
8383
+ return null;
8384
+ }
8385
+ });
8386
+ function GuideOrientationContextProvider(_a) {
8387
+ var children = _a.children;
8388
+ var _b = React.useState(1),
8389
+ imageAspectRatio = _b[0],
8390
+ setImageAspectRatio = _b[1];
8391
+ var _c = useResizeObserver(),
8392
+ wrapperRef = _c.ref,
8393
+ _d = _c.width,
8394
+ wrapperWidth = _d === void 0 ? 1 : _d,
8395
+ _e = _c.height,
8396
+ wrapperHeight = _e === void 0 ? 1 : _e;
8397
+ var wrapperAspectRatio = React.useMemo(function () {
8398
+ return wrapperWidth / wrapperHeight;
8399
+ }, [wrapperHeight, wrapperWidth]);
8400
+ var orientation = 'landscape'; //width > height ? 'landscape' : 'portrait'
8401
+ var value = React.useMemo(function () {
8402
+ return {
8403
+ orientation: orientation,
8404
+ wrapperWidth: wrapperWidth,
8405
+ wrapperHeight: wrapperHeight,
8406
+ wrapperAspectRatio: wrapperAspectRatio,
8407
+ imageAspectRatio: imageAspectRatio,
8408
+ setImageAspectRatio: setImageAspectRatio,
8409
+ wrapperRef: wrapperRef
8410
+ };
8411
+ }, [imageAspectRatio, wrapperAspectRatio, wrapperHeight, wrapperRef, wrapperWidth]);
8412
+ return /*#__PURE__*/React__namespace.default.createElement(GuideOrientationContext.Provider, {
8413
+ value: value
8414
+ }, children);
8415
+ }
8416
+ function useGuideOrientationContext() {
8417
+ var ctx = React.useContext(GuideOrientationContext);
8418
+ if (!ctx) throw new Error('useGuideOrientationContext cannot be used without GuideOrientationContextProvider');
8419
+ return ctx;
8420
+ }
8421
+
8432
8422
  var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
8433
- var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
8434
- var _u = _a.classNames,
8435
- classNames = _u === void 0 ? {} : _u,
8436
- _v = _a.images,
8437
- userSuppliedImages = _v === void 0 ? defaultIdCaptureGuideImages : _v,
8423
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
8424
+ var _s = _a.classNames,
8425
+ classNames = _s === void 0 ? {} : _s,
8426
+ _t = _a.images,
8427
+ userSuppliedImages = _t === void 0 ? defaultIdCaptureGuideImages : _t,
8438
8428
  userSuppliedPadding = _a.padding,
8439
8429
  userSuppliedImagePadding = _a.imagePadding,
8440
- _w = _a.imageVisible,
8441
- imageVisible = _w === void 0 ? true : _w,
8430
+ _u = _a.imageVisible,
8431
+ imageVisible = _u === void 0 ? true : _u,
8442
8432
  borderWidth = _a.borderWidth,
8443
8433
  borderColor = _a.borderColor,
8444
- _x = _a.idCardBorderWidth,
8445
- idCardBorderWidth = _x === void 0 ? '2.5%' : _x,
8446
- _y = _a.idCardBorderColor,
8447
- idCardBorderColor = _y === void 0 ? 'white' : _y,
8434
+ _v = _a.idCardBorderWidth,
8435
+ idCardBorderWidth = _v === void 0 ? '2.5%' : _v,
8436
+ _w = _a.idCardBorderColor,
8437
+ idCardBorderColor = _w === void 0 ? 'white' : _w,
8448
8438
  maskColor = _a.maskColor,
8449
- _z = _a.isMirrored,
8450
- isMirrored = _z === void 0 ? false : _z,
8451
- _0 = _a.isBackToFront,
8452
- isBackToFront = _0 === void 0 ? false : _0,
8453
- _1 = _a.portraitGuidesOnMobile,
8454
- portraitGuidesOnMobile = _1 === void 0 ? true : _1,
8455
- _2 = _a.instruction,
8456
- instruction = _2 === void 0 ? '' : _2,
8457
- _3 = _a.requestedAction,
8458
- requestedAction = _3 === void 0 ? 'SHOW_ID_FRONT' : _3,
8459
- _4 = _a.progress,
8460
- progress = _4 === void 0 ? 0 : _4,
8461
- _5 = _a.status,
8462
- status = _5 === void 0 ? 'ready' : _5,
8439
+ _x = _a.isMirrored,
8440
+ isMirrored = _x === void 0 ? false : _x,
8441
+ _y = _a.isBackToFront,
8442
+ isBackToFront = _y === void 0 ? false : _y,
8443
+ _z = _a.portraitGuidesOnMobile,
8444
+ portraitGuidesOnMobile = _z === void 0 ? true : _z,
8445
+ _0 = _a.instruction,
8446
+ instruction = _0 === void 0 ? '' : _0,
8447
+ _1 = _a.requestedAction,
8448
+ requestedAction = _1 === void 0 ? 'SHOW_ID_FRONT' : _1,
8449
+ _2 = _a.progress,
8450
+ progress = _2 === void 0 ? 0 : _2,
8451
+ _3 = _a.status,
8452
+ status = _3 === void 0 ? 'ready' : _3,
8463
8453
  onClick = _a.onClick;
8464
- var _6 = useGuideOrientationContext(),
8465
- wrapperRef = _6.wrapperRef,
8466
- wrapperWidth = _6.wrapperWidth,
8467
- wrapperHeight = _6.wrapperHeight,
8468
- imageAspectRatio = _6.imageAspectRatio,
8469
- wrapperAspectRatio = _6.wrapperAspectRatio,
8470
- guideOrientationOnImageLoaded = _6.onImageLoaded,
8471
- setDimensions = _6.setDimensions;
8472
- var containerRef = React.useRef(null);
8473
- var _7 = React.useState({
8474
- width: 0,
8475
- height: 0
8476
- }),
8477
- imageDimensions = _7[0],
8478
- setImageDimensions = _7[1];
8479
- var _8 = React.useState({
8480
- width: 0,
8481
- height: 0
8482
- }),
8483
- containerDimensions = _8[0],
8484
- setContainerDimensions = _8[1];
8454
+ var _4 = useGuideOrientationContext(),
8455
+ wrapperRef = _4.wrapperRef,
8456
+ wrapperWidth = _4.wrapperWidth,
8457
+ imageAspectRatio = _4.imageAspectRatio,
8458
+ wrapperAspectRatio = _4.wrapperAspectRatio,
8459
+ setImageAspectRatio = _4.setImageAspectRatio;
8460
+ var _5 = useResizeObserver(),
8461
+ innerRef = _5.ref,
8462
+ innerWidth = _5.width,
8463
+ innerHeight = _5.height;
8485
8464
  var theme = styled.useTheme();
8486
8465
  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;
8487
- React.useEffect(function () {
8488
- setDimensions({
8489
- width: wrapperWidth,
8490
- height: wrapperHeight
8491
- });
8492
- }, [setDimensions, wrapperHeight, wrapperWidth]);
8493
8466
  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;
8494
8467
  var paddingAndBorderPx = padding * 2 + (borderWidth !== null && borderWidth !== void 0 ? borderWidth : 0) * 2;
8495
8468
  var images = useImagesWithBackToFront(userSuppliedImages, isBackToFront);
@@ -8497,28 +8470,16 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
8497
8470
  var currentImage = images[orientation][requestedAction === 'FLIP_ID' ? 'SHOW_ID_FRONT' : requestedAction];
8498
8471
  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;
8499
8472
  var centerRegionMinWidth = imageAspectRatio >= wrapperAspectRatio ? wrapperWidth - paddingAndBorderPx : undefined;
8500
- var onImageLoaded = React.useCallback(function (e) {
8501
- guideOrientationOnImageLoaded(e);
8502
- setImageDimensions({
8503
- width: (currentImage === null || currentImage === void 0 ? void 0 : currentImage.width) || imageDimensions.width,
8504
- height: (currentImage === null || currentImage === void 0 ? void 0 : currentImage.height) || imageDimensions.height
8473
+ function onImageLoaded() {
8474
+ setImageAspectRatio(currentImage.width / currentImage.height);
8475
+ dispatchIdCaptureAction({
8476
+ type: 'guideImageLoaded',
8477
+ payload: {
8478
+ width: currentImage.width,
8479
+ height: currentImage.height
8480
+ }
8505
8481
  });
8506
- }, [guideOrientationOnImageLoaded, currentImage, imageDimensions.height, imageDimensions.width]);
8507
- React.useEffect(function () {
8508
- if (containerRef.current && containerRef.current.clientWidth && containerRef.current.clientHeight) {
8509
- setContainerDimensions({
8510
- width: containerRef.current.clientWidth,
8511
- height: containerRef.current.clientHeight
8512
- });
8513
- dispatchIdCaptureAction({
8514
- type: 'guideImageLoaded',
8515
- payload: {
8516
- width: imageDimensions.width,
8517
- height: imageDimensions.height
8518
- }
8519
- });
8520
- }
8521
- }, [setDimensions, setContainerDimensions, imageDimensions.height, imageDimensions.width]);
8482
+ }
8522
8483
  return /*#__PURE__*/React__namespace.default.createElement(StyledPageContainer, {
8523
8484
  ref: wrapperRef,
8524
8485
  onClick: onClick,
@@ -8548,10 +8509,10 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
8548
8509
  className: classNames.centerRegionBorder
8549
8510
  }, /*#__PURE__*/React__namespace.default.createElement(GuideCenterInner, {
8550
8511
  "$isLandscape": orientation === 'landscape',
8551
- ref: containerRef,
8512
+ ref: innerRef,
8552
8513
  className: classNames.centerRegionInner,
8553
8514
  style: {
8554
- aspectRatio: imageDimensions.width && imageDimensions.height ? imageDimensions.width / imageDimensions.height : 1
8515
+ aspectRatio: imageAspectRatio
8555
8516
  }
8556
8517
  }, /*#__PURE__*/React__namespace.default.createElement(IdCardGuideImageContainer, {
8557
8518
  status: status,
@@ -8559,7 +8520,7 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
8559
8520
  borderWidth: idCardBorderWidth,
8560
8521
  borderColor: idCardBorderColor,
8561
8522
  "$isVisible": requestedAction !== 'FLIP_ID',
8562
- aspectRatio: imageDimensions.width && imageDimensions.height ? imageDimensions.width / imageDimensions.height : 1
8523
+ aspectRatio: imageAspectRatio
8563
8524
  }, /*#__PURE__*/React__namespace.default.createElement(IdCardGuideImage, {
8564
8525
  alt: "",
8565
8526
  src: currentImage.url,
@@ -8567,8 +8528,8 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
8567
8528
  className: classNames.image,
8568
8529
  "$isInvisible": !imageVisible,
8569
8530
  "$isMirrored": isMirrored,
8570
- width: containerDimensions.width ? containerDimensions.width : imageDimensions.width,
8571
- height: containerDimensions.height ? containerDimensions.height : imageDimensions.height
8531
+ width: innerWidth || currentImage.width,
8532
+ height: innerHeight || currentImage.height
8572
8533
  })), requestedAction === 'FLIP_ID' && ( /*#__PURE__*/React__namespace.default.createElement(FlipIdPrompt, {
8573
8534
  images: images,
8574
8535
  borderWidth: idCardBorderWidth,
@@ -8576,8 +8537,8 @@ var IdCaptureGuideOverlay = function IdCaptureGuideOverlay(_a) {
8576
8537
  portraitGuidesOnMobile: portraitGuidesOnMobile,
8577
8538
  isMirrored: isMirrored,
8578
8539
  classNames: classNames.flipIdPrompt,
8579
- width: (_s = currentImage === null || currentImage === void 0 ? void 0 : currentImage.width) !== null && _s !== void 0 ? _s : imageDimensions.width,
8580
- height: (_t = currentImage === null || currentImage === void 0 ? void 0 : currentImage.width) !== null && _t !== void 0 ? _t : imageDimensions.height
8540
+ width: currentImage.width,
8541
+ height: currentImage.height
8581
8542
  }))))), /*#__PURE__*/React__namespace.default.createElement(Spacer, {
8582
8543
  "$maskColor": maskColor,
8583
8544
  "$minWidth": padding,
@@ -8617,14 +8578,14 @@ var GuideCenterRegion = styled__default.default.div(templateObject_6$6 || (templ
8617
8578
  }, function (props) {
8618
8579
  return props.$isMirrored ? 'transform: scaleX(-1);' : '';
8619
8580
  });
8620
- var GuideCenterBorder = styled__default.default.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) {
8581
+ var GuideCenterBorder = styled__default.default.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) {
8621
8582
  var _a, _b;
8622
8583
  return "".concat((_a = props.$borderWidth) !== null && _a !== void 0 ? _a : 4, "px solid ").concat((_b = props.$borderColor) !== null && _b !== void 0 ? _b : 'white');
8623
8584
  }, function (props) {
8624
8585
  return props.$padding ? "padding: ".concat(props.$padding, "px;") : '';
8625
8586
  });
8626
8587
  var GuideText = styled__default.default.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"])));
8627
- var GuideCenterInner = styled__default.default.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) {
8588
+ var GuideCenterInner = styled__default.default.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) {
8628
8589
  return props.$isLandscape ? 'height: 100%;' : 'width: 90%;';
8629
8590
  });
8630
8591
  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;