@wise/dynamic-flow-client 3.11.6 → 3.11.8

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.
Files changed (25) hide show
  1. package/build/main.js +162 -161
  2. package/build/main.min.js +1 -1
  3. package/build/main.mjs +162 -161
  4. package/build/types/{legacy/step/cameraStep → common}/cameraCapture/CameraCapture.d.ts +3 -2
  5. package/build/types/{legacy/step/cameraStep → common}/cameraCapture/hooks/useFullScreenOrientationLock.d.ts +2 -2
  6. package/build/types/common/cameraCapture/tracking/index.d.ts +8 -0
  7. package/build/types/legacy/common/utils/index.d.ts +5 -5
  8. package/build/types/legacy/dynamic-flow-types.d.ts +2 -1
  9. package/build/types/legacy/dynamicFlow/utils/useErrorResponse.d.ts +1 -1
  10. package/package.json +23 -17
  11. package/build/types/legacy/step/cameraStep/cameraCapture/tracking/index.d.ts +0 -8
  12. /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/CameraCapture.messages.d.ts +0 -0
  13. /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/components/bottomBar/BottomBar.d.ts +0 -0
  14. /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/components/index.d.ts +0 -0
  15. /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.d.ts +0 -0
  16. /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.d.ts +0 -0
  17. /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/hooks/useVideoConstraints.d.ts +0 -0
  18. /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/index.d.ts +0 -0
  19. /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/overlay/Overlay.d.ts +0 -0
  20. /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.d.ts +0 -0
  21. /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/screens/index.d.ts +0 -0
  22. /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/types/index.d.ts +0 -0
  23. /package/build/types/{legacy/step/cameraStep → common}/cameraCapture/utils/index.d.ts +0 -0
  24. /package/build/types/{legacy/common → common/cameraCapture}/utils/mobile-utils.d.ts +0 -0
  25. /package/build/types/{legacy/common → common}/utils/debounce.d.ts +0 -0
package/build/main.js CHANGED
@@ -10624,7 +10624,7 @@ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
10624
10624
  return deterministicId || (id ? `radix-${id}` : "");
10625
10625
  }
10626
10626
 
10627
- // ../../node_modules/.pnpm/@wise+forms@0.3.4_@transferwise+components@46.36.0_@types+react@18.3.3_react@18.3.1/node_modules/@wise/forms/dist/index.mjs
10627
+ // ../../node_modules/.pnpm/@wise+forms@0.3.4_@transferwise+components@46.37.0_@types+react@18.3.3_react@18.3.1/node_modules/@wise/forms/dist/index.mjs
10628
10628
  var import_components3 = require("@transferwise/components");
10629
10629
  var import_classnames = __toESM(require_classnames(), 1);
10630
10630
  var import_react7 = require("react");
@@ -13208,6 +13208,61 @@ function FeatureContextProvider({ features, children }) {
13208
13208
  return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(FeatureContext.Provider, { value: features, children });
13209
13209
  }
13210
13210
 
13211
+ // src/common/cameraCapture/utils/mobile-utils.ts
13212
+ var isMobile = () => isMobileScreenSize() && (isTouchScreen() || isMobileUA());
13213
+ var isMobileUA = (userAgent = window.navigator.userAgent) => (
13214
+ // eslint-disable-next-line regexp/no-unused-capturing-group
13215
+ /mobi|\b(iphone|android|blackberry|webos|windows phone)\b/i.test(userAgent)
13216
+ );
13217
+ var isMobileScreenSize = (width = window.screen.width, height = window.screen.height) => width < 768 || height < 768;
13218
+ var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMedia) => {
13219
+ if ("maxTouchPoints" in navigator2) {
13220
+ return navigator2.maxTouchPoints > 0;
13221
+ }
13222
+ const mQ = matchMedia == null ? void 0 : matchMedia("(pointer:coarse)");
13223
+ if ((mQ == null ? void 0 : mQ.media) === "(pointer:coarse)") {
13224
+ return Boolean(mQ.matches);
13225
+ }
13226
+ return false;
13227
+ };
13228
+
13229
+ // src/common/utils/debounce.ts
13230
+ var debounce2 = (callback, waitMs) => {
13231
+ let timeoutId;
13232
+ let lastArgs;
13233
+ const clearTimer = () => {
13234
+ if (timeoutId) {
13235
+ clearTimeout(timeoutId);
13236
+ timeoutId = null;
13237
+ }
13238
+ lastArgs = null;
13239
+ };
13240
+ const debouncedFn = (...args) => {
13241
+ lastArgs = args;
13242
+ if (timeoutId !== null) {
13243
+ clearTimeout(timeoutId);
13244
+ }
13245
+ timeoutId = setTimeout(() => {
13246
+ callback(...lastArgs);
13247
+ timeoutId = null;
13248
+ lastArgs = null;
13249
+ }, waitMs);
13250
+ };
13251
+ debouncedFn.cancel = () => {
13252
+ if (timeoutId !== null) {
13253
+ clearTimer();
13254
+ }
13255
+ };
13256
+ debouncedFn.flush = () => {
13257
+ if (timeoutId !== null) {
13258
+ callback(...lastArgs);
13259
+ clearTimer();
13260
+ }
13261
+ };
13262
+ debouncedFn.isPending = () => timeoutId !== null;
13263
+ return debouncedFn;
13264
+ };
13265
+
13211
13266
  // src/legacy/common/utils/api-utils.ts
13212
13267
  function isStatus2xx(status) {
13213
13268
  return status >= 200 && status < 300;
@@ -13670,63 +13725,6 @@ var dateStringToDate = (dateString) => {
13670
13725
  };
13671
13726
  var dateToDateString2 = (date) => formatDate2(date);
13672
13727
 
13673
- // src/legacy/common/utils/debounce.ts
13674
- var debounce2 = (callback, waitMs) => {
13675
- let timeoutId;
13676
- let lastArgs;
13677
- const clearTimer = () => {
13678
- if (timeoutId) {
13679
- clearTimeout(timeoutId);
13680
- timeoutId = null;
13681
- }
13682
- lastArgs = null;
13683
- };
13684
- const debouncedFn = (...args) => {
13685
- lastArgs = args;
13686
- if (timeoutId !== null) {
13687
- clearTimeout(timeoutId);
13688
- }
13689
- timeoutId = setTimeout(() => {
13690
- callback(...lastArgs);
13691
- timeoutId = null;
13692
- lastArgs = null;
13693
- }, waitMs);
13694
- };
13695
- debouncedFn.cancel = () => {
13696
- if (timeoutId !== null) {
13697
- clearTimer();
13698
- }
13699
- };
13700
- debouncedFn.flush = () => {
13701
- if (timeoutId !== null) {
13702
- callback(...lastArgs);
13703
- clearTimer();
13704
- }
13705
- };
13706
- debouncedFn.isPending = () => timeoutId !== null;
13707
- return debouncedFn;
13708
- };
13709
-
13710
- // src/legacy/common/utils/is-equal.ts
13711
- var isEqual = (a, b) => {
13712
- if (a === b) {
13713
- return true;
13714
- }
13715
- if (Array.isArray(a) && Array.isArray(b)) {
13716
- return a.length === b.length && a.every((item, index) => isEqual(item, b[index]));
13717
- }
13718
- if (isNonNullObject(a) && isNonNullObject(b) && isObjectEquals(a, b)) {
13719
- return true;
13720
- }
13721
- return false;
13722
- };
13723
- var isObjectEquals = (a, b) => {
13724
- const keysA = Object.keys(a);
13725
- const keysB = Object.keys(b);
13726
- return keysA.length === keysB.length && keysA.every((key) => Object.hasOwnProperty.call(b, key) && isEqual(a[key], b[key]));
13727
- };
13728
- var isNonNullObject = (a) => typeof a === "object" && a !== null;
13729
-
13730
13728
  // src/legacy/common/utils/file-utils.ts
13731
13729
  function toKilobytes2(sizeInBytes) {
13732
13730
  const ONE_KB_IN_BYTES = 1024;
@@ -13762,6 +13760,52 @@ var generateRandomId = (prefix = "") => {
13762
13760
  return `${prefixString}${Math.floor(1e8 * Math.random())}`;
13763
13761
  };
13764
13762
 
13763
+ // src/legacy/common/utils/is-equal.ts
13764
+ var isEqual = (a, b) => {
13765
+ if (a === b) {
13766
+ return true;
13767
+ }
13768
+ if (Array.isArray(a) && Array.isArray(b)) {
13769
+ return a.length === b.length && a.every((item, index) => isEqual(item, b[index]));
13770
+ }
13771
+ if (isNonNullObject(a) && isNonNullObject(b) && isObjectEquals(a, b)) {
13772
+ return true;
13773
+ }
13774
+ return false;
13775
+ };
13776
+ var isObjectEquals = (a, b) => {
13777
+ const keysA = Object.keys(a);
13778
+ const keysB = Object.keys(b);
13779
+ return keysA.length === keysB.length && keysA.every((key) => Object.hasOwnProperty.call(b, key) && isEqual(a[key], b[key]));
13780
+ };
13781
+ var isNonNullObject = (a) => typeof a === "object" && a !== null;
13782
+
13783
+ // src/legacy/common/utils/misc-utils.ts
13784
+ var isBasicError = (error) => isString2(error) || isNull3(error);
13785
+
13786
+ // src/legacy/common/utils/model-utils.ts
13787
+ var isObjectModel2 = (model) => typeof model === "object" && model !== null && model.constructor === Object;
13788
+ var isNullableObjectModel = (model) => isNull3(model) || isObjectModel2(model);
13789
+ var isNullableBasicModel = (model) => isBoolean2(model) || isNumber3(model) || isString2(model) || isNull3(model);
13790
+ var isNullableStringModel = (model) => isString2(model) || isNull3(model);
13791
+ var isArrayModel2 = (model) => {
13792
+ if (isArray2(model)) {
13793
+ if (model.length === 0) {
13794
+ return true;
13795
+ }
13796
+ return model.every(
13797
+ (item) => typeof item === "string" || typeof item === "number" || typeof item === "boolean" || typeof item === "object"
13798
+ );
13799
+ }
13800
+ return false;
13801
+ };
13802
+ var isNullableArrayModel = (model) => {
13803
+ if (isNull3(model)) {
13804
+ return true;
13805
+ }
13806
+ return isArrayModel2(model);
13807
+ };
13808
+
13765
13809
  // src/legacy/common/utils/schema-utils.ts
13766
13810
  function isConstSchema2(schema) {
13767
13811
  return !isUndefined3(schema == null ? void 0 : schema.const);
@@ -13890,50 +13934,6 @@ var filterHiddenSchemas = (schemas) => schemas.filter((schema) => {
13890
13934
  return (schema == null ? void 0 : schema.hidden) !== true;
13891
13935
  });
13892
13936
 
13893
- // src/legacy/common/utils/model-utils.ts
13894
- var isObjectModel2 = (model) => typeof model === "object" && model !== null && model.constructor === Object;
13895
- var isNullableObjectModel = (model) => isNull3(model) || isObjectModel2(model);
13896
- var isNullableBasicModel = (model) => isBoolean2(model) || isNumber3(model) || isString2(model) || isNull3(model);
13897
- var isNullableStringModel = (model) => isString2(model) || isNull3(model);
13898
- var isArrayModel2 = (model) => {
13899
- if (isArray2(model)) {
13900
- if (model.length === 0) {
13901
- return true;
13902
- }
13903
- return model.every(
13904
- (item) => typeof item === "string" || typeof item === "number" || typeof item === "boolean" || typeof item === "object"
13905
- );
13906
- }
13907
- return false;
13908
- };
13909
- var isNullableArrayModel = (model) => {
13910
- if (isNull3(model)) {
13911
- return true;
13912
- }
13913
- return isArrayModel2(model);
13914
- };
13915
-
13916
- // src/legacy/common/utils/misc-utils.ts
13917
- var isBasicError = (error) => isString2(error) || isNull3(error);
13918
-
13919
- // src/legacy/common/utils/mobile-utils.ts
13920
- var isMobile = () => isMobileScreenSize() && (isTouchScreen() || isMobileUA());
13921
- var isMobileUA = (userAgent = window.navigator.userAgent) => (
13922
- // eslint-disable-next-line regexp/no-unused-capturing-group
13923
- /mobi|\b(iphone|android|blackberry|webos|windows phone)\b/i.test(userAgent)
13924
- );
13925
- var isMobileScreenSize = (width = window.screen.width, height = window.screen.height) => width < 768 || height < 768;
13926
- var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMedia) => {
13927
- if ("maxTouchPoints" in navigator2) {
13928
- return navigator2.maxTouchPoints > 0;
13929
- }
13930
- const mQ = matchMedia == null ? void 0 : matchMedia("(pointer:coarse)");
13931
- if ((mQ == null ? void 0 : mQ.media) === "(pointer:coarse)") {
13932
- return Boolean(mQ.matches);
13933
- }
13934
- return false;
13935
- };
13936
-
13937
13937
  // src/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
13938
13938
  var import_react28 = require("react");
13939
13939
  function useDebouncedFunction(callback, waitMs) {
@@ -18147,12 +18147,12 @@ var LayoutStep_default = LayoutStep;
18147
18147
  // src/legacy/step/cameraStep/CameraStep.tsx
18148
18148
  var import_react62 = require("react");
18149
18149
 
18150
- // src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
18150
+ // src/common/cameraCapture/CameraCapture.tsx
18151
18151
  var import_react61 = require("react");
18152
18152
  var import_react_intl37 = require("react-intl");
18153
18153
  var import_react_webcam = __toESM(require("react-webcam"));
18154
18154
 
18155
- // src/legacy/step/cameraStep/cameraCapture/CameraCapture.messages.ts
18155
+ // src/common/cameraCapture/CameraCapture.messages.ts
18156
18156
  var import_react_intl33 = require("react-intl");
18157
18157
  var CameraCapture_messages_default = (0, import_react_intl33.defineMessages)({
18158
18158
  reviewSubmit: {
@@ -18212,7 +18212,7 @@ var CameraCapture_messages_default = (0, import_react_intl33.defineMessages)({
18212
18212
  }
18213
18213
  });
18214
18214
 
18215
- // src/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.tsx
18215
+ // src/common/cameraCapture/components/bottomBar/BottomBar.tsx
18216
18216
  var import_components73 = require("@transferwise/components");
18217
18217
  var import_react_intl34 = require("react-intl");
18218
18218
  var import_jsx_runtime118 = require("react/jsx-runtime");
@@ -18259,10 +18259,10 @@ var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime118.j
18259
18259
  }
18260
18260
  );
18261
18261
 
18262
- // src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
18262
+ // src/common/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
18263
18263
  var import_react_intl36 = require("react-intl");
18264
18264
 
18265
- // src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.ts
18265
+ // src/common/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.messages.ts
18266
18266
  var import_react_intl35 = require("react-intl");
18267
18267
  var OrientationLockOverlay_messages_default = (0, import_react_intl35.defineMessages)({
18268
18268
  text: {
@@ -18272,7 +18272,7 @@ var OrientationLockOverlay_messages_default = (0, import_react_intl35.defineMess
18272
18272
  }
18273
18273
  });
18274
18274
 
18275
- // src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
18275
+ // src/common/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
18276
18276
  var import_jsx_runtime119 = require("react/jsx-runtime");
18277
18277
  function OrientationLockOverlay() {
18278
18278
  const intl = (0, import_react_intl36.useIntl)();
@@ -18292,23 +18292,11 @@ function OrientationLockOverlay() {
18292
18292
  }
18293
18293
  var OrientationLockOverlay_default = OrientationLockOverlay;
18294
18294
 
18295
- // src/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.tsx
18296
- var import_components74 = require("@transferwise/components");
18297
- var import_jsx_runtime120 = require("react/jsx-runtime");
18298
- function CameraErrorScreen({ title, description, actionButton, onAction }) {
18299
- return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
18300
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("h2", { className: "text-xs-center m-b-3", children: title }),
18301
- /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("p", { className: "text-xs-center m-b-5", children: description }),
18302
- onAction && actionButton && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(import_components74.Button, { block: true, onClick: onAction, children: actionButton })
18303
- ] }) }) });
18304
- }
18305
- var CameraErrorScreen_default = CameraErrorScreen;
18306
-
18307
- // src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
18295
+ // src/common/cameraCapture/hooks/useFullScreenOrientationLock.ts
18308
18296
  var import_react58 = require("react");
18309
18297
  var import_screenfull = __toESM(require_screenfull());
18310
18298
 
18311
- // src/legacy/step/cameraStep/cameraCapture/utils/index.ts
18299
+ // src/common/cameraCapture/utils/index.ts
18312
18300
  var isSelfieCamera = (stream) => {
18313
18301
  var _a;
18314
18302
  const { facingMode } = ((_a = getVideoTrack(stream)) == null ? void 0 : _a.getSettings()) || {};
@@ -18354,7 +18342,7 @@ var getVideoCapabilities = (videoStream) => {
18354
18342
  return (_b = (_a = getVideoTrack(videoStream)) == null ? void 0 : _a.getCapabilities) == null ? void 0 : _b.call(_a);
18355
18343
  };
18356
18344
 
18357
- // src/legacy/step/cameraStep/cameraCapture/tracking/index.ts
18345
+ // src/common/cameraCapture/tracking/index.ts
18358
18346
  var trackCameraError = (message, onEvent, error) => onEvent == null ? void 0 : onEvent(message, { Error: getSerializedError(error) });
18359
18347
  var getSerializedError = (error) => error instanceof DOMException ? JSON.stringify({
18360
18348
  name: error == null ? void 0 : error.name,
@@ -18376,13 +18364,13 @@ var getCameraStartedProperties = async (props, videoStream) => {
18376
18364
  });
18377
18365
  };
18378
18366
  var trackCameraOrientationLandscape = (onEvent) => {
18379
- onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Orientation Lock Overlay Shown", {});
18367
+ void (onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Orientation Lock Overlay Shown", {}));
18380
18368
  };
18381
18369
  var trackCameraOrientationLocked = (onEvent) => {
18382
- onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Orientation Locked", {});
18370
+ void (onEvent == null ? void 0 : onEvent("Dynamic Flow - Camera Orientation Locked", {}));
18383
18371
  };
18384
18372
 
18385
- // src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
18373
+ // src/common/cameraCapture/hooks/useFullScreenOrientationLock.ts
18386
18374
  var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
18387
18375
  const lockOrientation = (0, import_react58.useCallback)(() => {
18388
18376
  if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
@@ -18444,37 +18432,37 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
18444
18432
  var noop5 = () => {
18445
18433
  };
18446
18434
 
18447
- // src/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
18435
+ // src/common/cameraCapture/hooks/useVideoConstraints.ts
18448
18436
  var import_react59 = require("react");
18449
18437
  var useVideoConstraints = (direction) => {
18450
18438
  const [videoConstraints, setVideoConstraints] = (0, import_react59.useState)();
18439
+ (0, import_react59.useEffect)(() => {
18440
+ void getVideoConstraints(direction).then(setVideoConstraints);
18441
+ }, [direction]);
18442
+ return { videoConstraints };
18443
+ };
18444
+ var getVideoConstraints = async (dir) => {
18451
18445
  const defaultVideoConstraints = {
18452
- facingMode: direction === "front" ? "user" : "environment",
18446
+ facingMode: dir === "front" ? "user" : "environment",
18453
18447
  height: { min: 480, max: 1080, ideal: 720 },
18454
18448
  width: { min: 640, max: 1920, ideal: 1280 },
18455
18449
  frameRate: 30,
18456
18450
  aspectRatio: 16 / 9
18457
18451
  };
18458
- (0, import_react59.useEffect)(() => {
18459
- void getVideoConstraints(direction).then(setVideoConstraints);
18460
- }, [direction]);
18461
- const getVideoConstraints = async (direction2) => {
18462
- if (direction2 === "back") {
18463
- const mainCamera = (await getAvailableVideoDevices()).find(isMainBackCamera);
18464
- if (mainCamera == null ? void 0 : mainCamera.deviceId) {
18465
- return __spreadProps(__spreadValues({}, defaultVideoConstraints), {
18466
- deviceId: { exact: mainCamera.deviceId }
18467
- });
18468
- }
18452
+ if (dir === "back") {
18453
+ const mainCamera = (await getAvailableVideoDevices()).find(isMainBackCamera);
18454
+ if (mainCamera == null ? void 0 : mainCamera.deviceId) {
18455
+ return __spreadProps(__spreadValues({}, defaultVideoConstraints), {
18456
+ deviceId: { exact: mainCamera.deviceId }
18457
+ });
18469
18458
  }
18470
- return defaultVideoConstraints;
18471
- };
18472
- return { videoConstraints };
18459
+ }
18460
+ return defaultVideoConstraints;
18473
18461
  };
18474
18462
 
18475
- // src/legacy/step/cameraStep/cameraCapture/overlay/Overlay.tsx
18463
+ // src/common/cameraCapture/overlay/Overlay.tsx
18476
18464
  var import_react60 = require("react");
18477
- var import_jsx_runtime121 = require("react/jsx-runtime");
18465
+ var import_jsx_runtime120 = require("react/jsx-runtime");
18478
18466
  var captureButtonHeight = 92;
18479
18467
  var reviewButtonsHeight = 120;
18480
18468
  var imageHeight = 40;
@@ -18496,18 +18484,18 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
18496
18484
  return () => window.removeEventListener("resize", listener);
18497
18485
  });
18498
18486
  let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
18499
- let helperBox = /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)(import_jsx_runtime121.Fragment, { children: [
18500
- imageUrl && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
18501
- title && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("h4", { className: "camera-capture-title", children: title }),
18502
- instructions && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("small", { className: "camera-capture-instructions", children: instructions })
18487
+ let helperBox = /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
18488
+ imageUrl && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
18489
+ title && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("h4", { className: "camera-capture-title", children: title }),
18490
+ instructions && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("small", { className: "camera-capture-instructions", children: instructions })
18503
18491
  ] });
18504
18492
  const frameBottomMargin = captureButtonHeight + helperBoxHeight;
18505
18493
  if (reviewInstructions) {
18506
18494
  helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
18507
- helperBox = /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
18495
+ helperBox = /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
18508
18496
  const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
18509
18497
  if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
18510
- helperBox = /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_jsx_runtime121.Fragment, {});
18498
+ helperBox = /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(import_jsx_runtime120.Fragment, {});
18511
18499
  }
18512
18500
  }
18513
18501
  const framePosition = {
@@ -18525,19 +18513,31 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
18525
18513
  width: "90%"
18526
18514
  }
18527
18515
  };
18528
- return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
18529
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("mask", { id: "mask", children: [
18530
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
18531
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("image", __spreadValues({ href: overlay }, framePosition))
18516
+ return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
18517
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("mask", { id: "mask", children: [
18518
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
18519
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("image", __spreadValues({ href: overlay }, framePosition))
18532
18520
  ] }) }),
18533
- overlay && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
18534
- outline && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("image", __spreadValues({ href: outline }, framePosition)),
18535
- /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
18521
+ overlay && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
18522
+ outline && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("image", __spreadValues({ href: outline }, framePosition)),
18523
+ /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
18536
18524
  ] });
18537
18525
  }
18538
18526
  var Overlay_default = Overlay;
18539
18527
 
18540
- // src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
18528
+ // src/common/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.tsx
18529
+ var import_components74 = require("@transferwise/components");
18530
+ var import_jsx_runtime121 = require("react/jsx-runtime");
18531
+ function CameraErrorScreen({ title, description, actionButton, onAction }) {
18532
+ return /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
18533
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("h2", { className: "text-xs-center m-b-3", children: title }),
18534
+ /* @__PURE__ */ (0, import_jsx_runtime121.jsx)("p", { className: "text-xs-center m-b-5", children: description }),
18535
+ onAction && actionButton && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(import_components74.Button, { block: true, onClick: onAction, children: actionButton })
18536
+ ] }) }) });
18537
+ }
18538
+ var CameraErrorScreen_default = CameraErrorScreen;
18539
+
18540
+ // src/common/cameraCapture/CameraCapture.tsx
18541
18541
  var import_jsx_runtime122 = require("react/jsx-runtime");
18542
18542
  function CameraCapture({
18543
18543
  direction = "back",
@@ -19169,12 +19169,12 @@ var isResponse2 = (response) => typeof response === "object" && response !== nul
19169
19169
  var import_react_intl39 = require("react-intl");
19170
19170
  var useErrorResponse = () => {
19171
19171
  const { formatMessage } = (0, import_react_intl39.useIntl)();
19172
- return async (response, fetchType) => {
19172
+ return async (response, fetchType, isInitialRequest) => {
19173
19173
  try {
19174
19174
  const errorResponse = await parseErrorResponse(response);
19175
19175
  return errorResponse;
19176
19176
  } catch (error) {
19177
- if (fetchType === "submission") {
19177
+ if (fetchType === "submission" && !isInitialRequest) {
19178
19178
  return { error: formatMessage(generic_error_messages_default.genericErrorRetryHint) };
19179
19179
  }
19180
19180
  throw error;
@@ -19324,7 +19324,8 @@ var DynamicFlowComponent = ({
19324
19324
  return;
19325
19325
  }
19326
19326
  if (!response.ok) {
19327
- const errorResponse = await getErrorResponse(response, fetchType);
19327
+ const isInitialRequest = step === void 0;
19328
+ const errorResponse = await getErrorResponse(response, fetchType, isInitialRequest);
19328
19329
  void updateAfterError(errorResponse);
19329
19330
  return;
19330
19331
  }