@wise/dynamic-flow-client 2.1.5 → 2.2.0-beta-2448cc.12
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/build/i18n/en.json +2 -0
- package/build/i18n/es.json +1 -1
- package/build/main.css +19 -0
- package/build/main.js +169 -86
- package/build/main.min.js +1 -1
- package/build/types/common/utils/index.d.ts +1 -0
- package/build/types/common/utils/mobile-utils.d.ts +4 -0
- package/build/types/step/cameraStep/cameraCapture/components/index.d.ts +1 -0
- package/build/types/step/cameraStep/cameraCapture/components/orientationLock/OrientationLock.d.ts +2 -0
- package/build/types/step/cameraStep/cameraCapture/components/orientationLock/OrientationLock.messages.d.ts +13 -0
- package/package.json +26 -26
package/build/i18n/en.json
CHANGED
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
"dynamicFlows.CameraCapture.reviewInstructions": "Is your picture clear, readable and complete?",
|
|
14
14
|
"dynamicFlows.CameraCapture.reviewRetry": "No, try again",
|
|
15
15
|
"dynamicFlows.CameraCapture.reviewSubmit": "Yes, submit",
|
|
16
|
+
"dynamicFlows.CameraCapture.rotatePhone.imgAlt": "Rotate your phone icon",
|
|
17
|
+
"dynamicFlows.CameraCapture.rotatePhone.text": "Rotate your phone to portrait view to take a photo",
|
|
16
18
|
"dynamicFlows.ControlFeedback.maxLength": "Please enter {maxLength} or fewer characters.",
|
|
17
19
|
"dynamicFlows.ControlFeedback.maximum": "Please enter a number that's {maximum} or less.",
|
|
18
20
|
"dynamicFlows.ControlFeedback.maximumDate": "Please enter a date that's on or before {maximum}.",
|
package/build/i18n/es.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"dynamicFlows.ArraySchema.addItem": "Guardar",
|
|
3
|
-
"dynamicFlows.ArraySchema.addItemTitle": "
|
|
3
|
+
"dynamicFlows.ArraySchema.addItemTitle": "Añadir elemento",
|
|
4
4
|
"dynamicFlows.ArraySchema.editItem": "Guardar",
|
|
5
5
|
"dynamicFlows.ArraySchema.maxItemsError": "Añade {maxItems} o menos.",
|
|
6
6
|
"dynamicFlows.ArraySchema.minItemsError": "Añade al menos {minItems}.",
|
package/build/main.css
CHANGED
|
@@ -149,6 +149,25 @@
|
|
|
149
149
|
width: 100%;
|
|
150
150
|
z-index: 10000;
|
|
151
151
|
}
|
|
152
|
+
.orientation-lock-overlay {
|
|
153
|
+
display: none;
|
|
154
|
+
position: fixed;
|
|
155
|
+
inset: 0;
|
|
156
|
+
background-color: var(--color-dark);
|
|
157
|
+
color: var(--color-white);
|
|
158
|
+
text-align: center;
|
|
159
|
+
font-size: var(--font-size-16);
|
|
160
|
+
font-weight: var(--font-weight-semi-bold);
|
|
161
|
+
flex-direction: column;
|
|
162
|
+
justify-content: center;
|
|
163
|
+
align-items: center;
|
|
164
|
+
z-index: 1000;
|
|
165
|
+
}
|
|
166
|
+
@media screen and (orientation: landscape) and (max-height: 767px) {
|
|
167
|
+
.orientation-lock-overlay {
|
|
168
|
+
display: flex;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
152
171
|
.df-image {
|
|
153
172
|
display: flex;
|
|
154
173
|
justify-content: center;
|
package/build/main.js
CHANGED
|
@@ -851,7 +851,7 @@ function isReference(block) {
|
|
|
851
851
|
|
|
852
852
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
853
853
|
var import_react41 = require("react");
|
|
854
|
-
var
|
|
854
|
+
var import_react_intl34 = require("react-intl");
|
|
855
855
|
|
|
856
856
|
// src/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
857
857
|
var import_react2 = require("react");
|
|
@@ -1709,6 +1709,30 @@ var isNullableArrayModel = (model) => {
|
|
|
1709
1709
|
// src/common/utils/misc-utils.ts
|
|
1710
1710
|
var isBasicError = (error) => isString(error) || isNull(error);
|
|
1711
1711
|
|
|
1712
|
+
// src/common/utils/mobile-utils.ts
|
|
1713
|
+
var isMobile = () => {
|
|
1714
|
+
return isMobileScreenSize() && (isTouchScreen() || isMobileUA());
|
|
1715
|
+
};
|
|
1716
|
+
var isMobileUA = (userAgent = window.navigator.userAgent) => {
|
|
1717
|
+
return /Mobi|\b(iPhone|Android|BlackBerry|webOS|Windows Phone)\b/i.test(userAgent);
|
|
1718
|
+
};
|
|
1719
|
+
var isMobileScreenSize = (width = window.screen.width, height = window.screen.height) => {
|
|
1720
|
+
return width < 768 || height < 768;
|
|
1721
|
+
};
|
|
1722
|
+
var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMedia) => {
|
|
1723
|
+
if ("maxTouchPoints" in navigator2) {
|
|
1724
|
+
return navigator2.maxTouchPoints > 0;
|
|
1725
|
+
}
|
|
1726
|
+
if ("msMaxTouchPoints" in navigator2) {
|
|
1727
|
+
return navigator2["msMaxTouchPoints"] > 0;
|
|
1728
|
+
}
|
|
1729
|
+
const mQ = matchMedia == null ? void 0 : matchMedia("(pointer:coarse)");
|
|
1730
|
+
if ((mQ == null ? void 0 : mQ.media) === "(pointer:coarse)") {
|
|
1731
|
+
return !!mQ.matches;
|
|
1732
|
+
}
|
|
1733
|
+
return false;
|
|
1734
|
+
};
|
|
1735
|
+
|
|
1712
1736
|
// src/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
1713
1737
|
var import_react6 = require("react");
|
|
1714
1738
|
function useDebouncedFunction(callback, waitMs) {
|
|
@@ -5821,7 +5845,7 @@ var import_react36 = require("react");
|
|
|
5821
5845
|
|
|
5822
5846
|
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
5823
5847
|
var import_react35 = require("react");
|
|
5824
|
-
var
|
|
5848
|
+
var import_react_intl30 = require("react-intl");
|
|
5825
5849
|
var import_react_webcam = __toESM(require_react_webcam());
|
|
5826
5850
|
|
|
5827
5851
|
// src/step/cameraStep/cameraCapture/CameraCapture.messages.ts
|
|
@@ -5846,16 +5870,56 @@ var CameraCapture_messages_default = (0, import_react_intl22.defineMessages)({
|
|
|
5846
5870
|
|
|
5847
5871
|
// src/step/cameraStep/cameraCapture/components/index.tsx
|
|
5848
5872
|
var import_components27 = require("@transferwise/components");
|
|
5873
|
+
var import_react_intl25 = require("react-intl");
|
|
5874
|
+
|
|
5875
|
+
// src/step/cameraStep/cameraCapture/components/orientationLock/OrientationLock.tsx
|
|
5876
|
+
var import_react_intl24 = require("react-intl");
|
|
5877
|
+
|
|
5878
|
+
// src/step/cameraStep/cameraCapture/components/orientationLock/OrientationLock.messages.ts
|
|
5849
5879
|
var import_react_intl23 = require("react-intl");
|
|
5880
|
+
var OrientationLock_messages_default = (0, import_react_intl23.defineMessages)({
|
|
5881
|
+
text: {
|
|
5882
|
+
id: "dynamicFlows.CameraCapture.rotatePhone.text",
|
|
5883
|
+
defaultMessage: "Rotate your phone to portrait view to take a photo",
|
|
5884
|
+
description: "Prompt the user to rotate their phone from landscape to portrait mode when attempting to take a photo"
|
|
5885
|
+
},
|
|
5886
|
+
imgAlt: {
|
|
5887
|
+
id: "dynamicFlows.CameraCapture.rotatePhone.imgAlt",
|
|
5888
|
+
defaultMessage: "Rotate your phone icon",
|
|
5889
|
+
description: "Rotate phone icon alt text"
|
|
5890
|
+
}
|
|
5891
|
+
});
|
|
5892
|
+
|
|
5893
|
+
// src/step/cameraStep/cameraCapture/components/orientationLock/OrientationLock.tsx
|
|
5850
5894
|
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
5851
|
-
var
|
|
5895
|
+
var OrientationLock = () => {
|
|
5896
|
+
const intl = (0, import_react_intl24.useIntl)();
|
|
5897
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "orientation-lock-overlay p-x-3 p-y-3", "data-testid": "orientation-lock", children: [
|
|
5898
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
5899
|
+
"img",
|
|
5900
|
+
{
|
|
5901
|
+
className: "m-b-3",
|
|
5902
|
+
src: "https://wise.com/public-resources/assets/camera-guidelines/icon-rotate-phone.svg",
|
|
5903
|
+
width: "96",
|
|
5904
|
+
height: "96",
|
|
5905
|
+
alt: intl.formatMessage(OrientationLock_messages_default.imgAlt)
|
|
5906
|
+
}
|
|
5907
|
+
),
|
|
5908
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "text-center m-b-0", children: intl.formatMessage(OrientationLock_messages_default.text) })
|
|
5909
|
+
] });
|
|
5910
|
+
};
|
|
5911
|
+
var OrientationLock_default = OrientationLock;
|
|
5912
|
+
|
|
5913
|
+
// src/step/cameraStep/cameraCapture/components/index.tsx
|
|
5914
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5915
|
+
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CaptureButton, { onClick: onCapture }) });
|
|
5852
5916
|
var ReviewBottomBar = ({
|
|
5853
5917
|
onSubmit,
|
|
5854
5918
|
onRetry
|
|
5855
5919
|
}) => {
|
|
5856
|
-
const intl = (0,
|
|
5857
|
-
return /* @__PURE__ */ (0,
|
|
5858
|
-
/* @__PURE__ */ (0,
|
|
5920
|
+
const intl = (0, import_react_intl25.useIntl)();
|
|
5921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
|
|
5922
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5859
5923
|
import_components27.Button,
|
|
5860
5924
|
{
|
|
5861
5925
|
className: "m-b-1",
|
|
@@ -5866,7 +5930,7 @@ var ReviewBottomBar = ({
|
|
|
5866
5930
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
5867
5931
|
}
|
|
5868
5932
|
),
|
|
5869
|
-
/* @__PURE__ */ (0,
|
|
5933
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5870
5934
|
import_components27.Button,
|
|
5871
5935
|
{
|
|
5872
5936
|
className: "m-b-2",
|
|
@@ -5880,14 +5944,14 @@ var ReviewBottomBar = ({
|
|
|
5880
5944
|
)
|
|
5881
5945
|
] }) }) });
|
|
5882
5946
|
};
|
|
5883
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
5947
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5884
5948
|
"button",
|
|
5885
5949
|
{
|
|
5886
5950
|
type: "button",
|
|
5887
5951
|
className: "camera-capture-btn m-b-2",
|
|
5888
5952
|
"data-testid": "camera-capture-button",
|
|
5889
5953
|
onClick,
|
|
5890
|
-
children: /* @__PURE__ */ (0,
|
|
5954
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "camera-capture-btn-inner" })
|
|
5891
5955
|
}
|
|
5892
5956
|
);
|
|
5893
5957
|
|
|
@@ -5967,7 +6031,7 @@ var useVideoConstraints = (direction) => {
|
|
|
5967
6031
|
|
|
5968
6032
|
// src/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
5969
6033
|
var import_react34 = require("react");
|
|
5970
|
-
var
|
|
6034
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
5971
6035
|
var captureButtonHeight = 92;
|
|
5972
6036
|
var reviewButtonsHeight = 120;
|
|
5973
6037
|
var imageHeight = 40;
|
|
@@ -5996,18 +6060,18 @@ var Overlay = ({
|
|
|
5996
6060
|
return () => window.removeEventListener("resize", listener);
|
|
5997
6061
|
});
|
|
5998
6062
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
5999
|
-
let helperBox = /* @__PURE__ */ (0,
|
|
6000
|
-
imageUrl && /* @__PURE__ */ (0,
|
|
6001
|
-
title && /* @__PURE__ */ (0,
|
|
6002
|
-
instructions && /* @__PURE__ */ (0,
|
|
6063
|
+
let helperBox = /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(import_jsx_runtime59.Fragment, { children: [
|
|
6064
|
+
imageUrl && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
6065
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("h4", { className: "camera-capture-title", children: title }),
|
|
6066
|
+
instructions && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("small", { className: "camera-capture-instructions", children: instructions })
|
|
6003
6067
|
] });
|
|
6004
6068
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
6005
6069
|
if (reviewInstructions) {
|
|
6006
6070
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
6007
|
-
helperBox = /* @__PURE__ */ (0,
|
|
6071
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
6008
6072
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
6009
6073
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
6010
|
-
helperBox = /* @__PURE__ */ (0,
|
|
6074
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_jsx_runtime59.Fragment, {});
|
|
6011
6075
|
}
|
|
6012
6076
|
}
|
|
6013
6077
|
const framePosition = {
|
|
@@ -6025,25 +6089,25 @@ var Overlay = ({
|
|
|
6025
6089
|
width: "90%"
|
|
6026
6090
|
}
|
|
6027
6091
|
};
|
|
6028
|
-
return /* @__PURE__ */ (0,
|
|
6029
|
-
/* @__PURE__ */ (0,
|
|
6030
|
-
/* @__PURE__ */ (0,
|
|
6031
|
-
/* @__PURE__ */ (0,
|
|
6092
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
6093
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("mask", { id: "mask", children: [
|
|
6094
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
6095
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("image", __spreadValues({ href: overlay }, framePosition))
|
|
6032
6096
|
] }) }),
|
|
6033
|
-
overlay && /* @__PURE__ */ (0,
|
|
6034
|
-
outline && /* @__PURE__ */ (0,
|
|
6035
|
-
/* @__PURE__ */ (0,
|
|
6097
|
+
overlay && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
6098
|
+
outline && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("image", __spreadValues({ href: outline }, framePosition)),
|
|
6099
|
+
/* @__PURE__ */ (0, import_jsx_runtime59.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
|
|
6036
6100
|
] });
|
|
6037
6101
|
};
|
|
6038
6102
|
var Overlay_default = Overlay;
|
|
6039
6103
|
|
|
6040
6104
|
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
6041
6105
|
var import_components28 = require("@transferwise/components");
|
|
6042
|
-
var
|
|
6106
|
+
var import_react_intl27 = require("react-intl");
|
|
6043
6107
|
|
|
6044
6108
|
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.ts
|
|
6045
|
-
var
|
|
6046
|
-
var NoCameraAccess_messages_default = (0,
|
|
6109
|
+
var import_react_intl26 = require("react-intl");
|
|
6110
|
+
var NoCameraAccess_messages_default = (0, import_react_intl26.defineMessages)({
|
|
6047
6111
|
title: {
|
|
6048
6112
|
id: "dynamicFlows.CameraCapture.NoCameraAccess.title",
|
|
6049
6113
|
defaultMessage: "We can't access your camera",
|
|
@@ -6062,23 +6126,23 @@ var NoCameraAccess_messages_default = (0, import_react_intl24.defineMessages)({
|
|
|
6062
6126
|
});
|
|
6063
6127
|
|
|
6064
6128
|
// src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
|
|
6065
|
-
var
|
|
6129
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6066
6130
|
var NoCameraAccess = ({ onAction }) => {
|
|
6067
|
-
const intl = (0,
|
|
6068
|
-
return /* @__PURE__ */ (0,
|
|
6069
|
-
/* @__PURE__ */ (0,
|
|
6070
|
-
/* @__PURE__ */ (0,
|
|
6071
|
-
/* @__PURE__ */ (0,
|
|
6131
|
+
const intl = (0, import_react_intl27.useIntl)();
|
|
6132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { id: "no-camera-access", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
6133
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(NoCameraAccess_messages_default.title) }),
|
|
6134
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(NoCameraAccess_messages_default.paragraph) }),
|
|
6135
|
+
/* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_components28.Button, { block: true, onClick: onAction, children: intl.formatMessage(NoCameraAccess_messages_default.action) })
|
|
6072
6136
|
] }) }) }) });
|
|
6073
6137
|
};
|
|
6074
6138
|
var NoCameraAccess_default = NoCameraAccess;
|
|
6075
6139
|
|
|
6076
6140
|
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
6077
|
-
var
|
|
6141
|
+
var import_react_intl29 = require("react-intl");
|
|
6078
6142
|
|
|
6079
6143
|
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.ts
|
|
6080
|
-
var
|
|
6081
|
-
var CameraNotSupported_messages_default = (0,
|
|
6144
|
+
var import_react_intl28 = require("react-intl");
|
|
6145
|
+
var CameraNotSupported_messages_default = (0, import_react_intl28.defineMessages)({
|
|
6082
6146
|
title: {
|
|
6083
6147
|
id: "dynamicFlows.CameraCapture.CameraNotSupported.title",
|
|
6084
6148
|
defaultMessage: "Camera not supported",
|
|
@@ -6092,12 +6156,12 @@ var CameraNotSupported_messages_default = (0, import_react_intl26.defineMessages
|
|
|
6092
6156
|
});
|
|
6093
6157
|
|
|
6094
6158
|
// src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
|
|
6095
|
-
var
|
|
6159
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6096
6160
|
var CameraNotSupported = () => {
|
|
6097
|
-
const intl = (0,
|
|
6098
|
-
return /* @__PURE__ */ (0,
|
|
6099
|
-
/* @__PURE__ */ (0,
|
|
6100
|
-
/* @__PURE__ */ (0,
|
|
6161
|
+
const intl = (0, import_react_intl29.useIntl)();
|
|
6162
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { id: "camera-not-supported", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
6163
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(CameraNotSupported_messages_default.title) }),
|
|
6164
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(CameraNotSupported_messages_default.paragraph) })
|
|
6101
6165
|
] }) }) }) });
|
|
6102
6166
|
};
|
|
6103
6167
|
var CameraNotSupported_default = CameraNotSupported;
|
|
@@ -6122,7 +6186,7 @@ var getCameraStartedProperties = async (props, videoStream) => {
|
|
|
6122
6186
|
};
|
|
6123
6187
|
|
|
6124
6188
|
// src/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
6125
|
-
var
|
|
6189
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
6126
6190
|
var CameraCapture = ({
|
|
6127
6191
|
direction = "back",
|
|
6128
6192
|
overlay = "",
|
|
@@ -6138,9 +6202,10 @@ var CameraCapture = ({
|
|
|
6138
6202
|
const [isVideoMirrored, setIsVideoMirrored] = (0, import_react35.useState)(false);
|
|
6139
6203
|
const [ready, setReady] = (0, import_react35.useState)(false);
|
|
6140
6204
|
const [reviewImage, setReviewImage] = (0, import_react35.useState)();
|
|
6205
|
+
const isMobileDevice = (0, import_react35.useMemo)(() => isMobile(), []);
|
|
6141
6206
|
const webcamReference = (0, import_react35.useRef)(null);
|
|
6142
6207
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
6143
|
-
const intl = (0,
|
|
6208
|
+
const intl = (0, import_react_intl30.useIntl)();
|
|
6144
6209
|
const handleCapture = (0, import_react35.useCallback)(async () => {
|
|
6145
6210
|
var _a, _b, _c, _d, _e, _f;
|
|
6146
6211
|
if (((_a = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _a.video) && ((_c = (_b = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _b.video) == null ? void 0 : _c.readyState) >= 3) {
|
|
@@ -6191,8 +6256,23 @@ var CameraCapture = ({
|
|
|
6191
6256
|
setReviewImage(void 0);
|
|
6192
6257
|
};
|
|
6193
6258
|
const handleRetryCameraAccess = () => setMode("CAPTURE");
|
|
6194
|
-
|
|
6195
|
-
|
|
6259
|
+
(0, import_react35.useEffect)(() => {
|
|
6260
|
+
if (mode === "CAPTURE" && isMobileDevice && window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
6261
|
+
window.screen.orientation.lock("portrait").then(() => {
|
|
6262
|
+
console.log("orientation locked");
|
|
6263
|
+
}).catch((e) => {
|
|
6264
|
+
console.log(e);
|
|
6265
|
+
});
|
|
6266
|
+
}
|
|
6267
|
+
return () => {
|
|
6268
|
+
var _a, _b;
|
|
6269
|
+
if ((_b = (_a = window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.unlock) {
|
|
6270
|
+
window.screen.orientation.unlock();
|
|
6271
|
+
}
|
|
6272
|
+
};
|
|
6273
|
+
}, [mode, isMobileDevice]);
|
|
6274
|
+
const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
6275
|
+
videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6196
6276
|
import_react_webcam.default,
|
|
6197
6277
|
{
|
|
6198
6278
|
ref: webcamReference,
|
|
@@ -6203,7 +6283,7 @@ var CameraCapture = ({
|
|
|
6203
6283
|
onUserMedia: handleUserMedia
|
|
6204
6284
|
}
|
|
6205
6285
|
),
|
|
6206
|
-
/* @__PURE__ */ (0,
|
|
6286
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6207
6287
|
Overlay_default,
|
|
6208
6288
|
{
|
|
6209
6289
|
overlay,
|
|
@@ -6213,11 +6293,12 @@ var CameraCapture = ({
|
|
|
6213
6293
|
instructions
|
|
6214
6294
|
}
|
|
6215
6295
|
),
|
|
6216
|
-
|
|
6296
|
+
isMobileDevice && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(OrientationLock_default, {}),
|
|
6297
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CaptureBottomBar, { onCapture: () => void handleCapture() })
|
|
6217
6298
|
] });
|
|
6218
|
-
const reviewScreen = /* @__PURE__ */ (0,
|
|
6219
|
-
/* @__PURE__ */ (0,
|
|
6220
|
-
/* @__PURE__ */ (0,
|
|
6299
|
+
const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(import_jsx_runtime62.Fragment, { children: [
|
|
6300
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
|
|
6301
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
|
|
6221
6302
|
Overlay_default,
|
|
6222
6303
|
{
|
|
6223
6304
|
overlay,
|
|
@@ -6227,19 +6308,19 @@ var CameraCapture = ({
|
|
|
6227
6308
|
reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
|
|
6228
6309
|
}
|
|
6229
6310
|
),
|
|
6230
|
-
/* @__PURE__ */ (0,
|
|
6311
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
6231
6312
|
] });
|
|
6232
|
-
return /* @__PURE__ */ (0,
|
|
6313
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("section", { className: "camera-capture", children: [
|
|
6233
6314
|
mode === "CAPTURE" && captureScreen,
|
|
6234
6315
|
mode === "REVIEW" && reviewScreen,
|
|
6235
|
-
mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0,
|
|
6236
|
-
mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0,
|
|
6316
|
+
mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(NoCameraAccess_default, { onAction: handleRetryCameraAccess }),
|
|
6317
|
+
mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(CameraNotSupported_default, {})
|
|
6237
6318
|
] });
|
|
6238
6319
|
};
|
|
6239
6320
|
var CameraCapture_default = CameraCapture;
|
|
6240
6321
|
|
|
6241
6322
|
// src/step/cameraStep/CameraStep.tsx
|
|
6242
|
-
var
|
|
6323
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
6243
6324
|
function blobToBase64(blob) {
|
|
6244
6325
|
return new Promise((resolve, _) => {
|
|
6245
6326
|
const reader = new FileReader();
|
|
@@ -6277,7 +6358,7 @@ var CameraStep = (props) => {
|
|
|
6277
6358
|
});
|
|
6278
6359
|
}
|
|
6279
6360
|
};
|
|
6280
|
-
return /* @__PURE__ */ (0,
|
|
6361
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
6281
6362
|
CameraCapture_default,
|
|
6282
6363
|
{
|
|
6283
6364
|
overlay,
|
|
@@ -6326,11 +6407,11 @@ function getFirstAction(step) {
|
|
|
6326
6407
|
}
|
|
6327
6408
|
|
|
6328
6409
|
// src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6329
|
-
var
|
|
6410
|
+
var import_react_intl32 = require("react-intl");
|
|
6330
6411
|
|
|
6331
6412
|
// src/step/externalConfirmationStep/ExternalConfirmationStep.messages.ts
|
|
6332
|
-
var
|
|
6333
|
-
var ExternalConfirmationStep_messages_default = (0,
|
|
6413
|
+
var import_react_intl31 = require("react-intl");
|
|
6414
|
+
var ExternalConfirmationStep_messages_default = (0, import_react_intl31.defineMessages)({
|
|
6334
6415
|
title: {
|
|
6335
6416
|
id: "dynamicFlows.ExternalConfirmation.title",
|
|
6336
6417
|
defaultMessage: "Please confirm",
|
|
@@ -6354,12 +6435,12 @@ var ExternalConfirmationStep_messages_default = (0, import_react_intl29.defineMe
|
|
|
6354
6435
|
});
|
|
6355
6436
|
|
|
6356
6437
|
// src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
6357
|
-
var
|
|
6438
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6358
6439
|
var noop5 = () => {
|
|
6359
6440
|
};
|
|
6360
6441
|
var ExternalConfirmationStep = ({ url, onClose }) => {
|
|
6361
|
-
const { formatMessage } = (0,
|
|
6362
|
-
return /* @__PURE__ */ (0,
|
|
6442
|
+
const { formatMessage } = (0, import_react_intl32.useIntl)();
|
|
6443
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6363
6444
|
DynamicLayout_default,
|
|
6364
6445
|
{
|
|
6365
6446
|
components: [
|
|
@@ -6426,9 +6507,9 @@ function getOrigin(url) {
|
|
|
6426
6507
|
// src/dynamicFlow/BackButton.tsx
|
|
6427
6508
|
var import_components30 = require("@transferwise/components");
|
|
6428
6509
|
var import_icons2 = require("@transferwise/icons");
|
|
6429
|
-
var
|
|
6510
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
6430
6511
|
var BackButton = ({ title, action, onAction }) => {
|
|
6431
|
-
return /* @__PURE__ */ (0,
|
|
6512
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
6432
6513
|
"a",
|
|
6433
6514
|
{
|
|
6434
6515
|
onClick: (event) => {
|
|
@@ -6439,8 +6520,8 @@ var BackButton = ({ title, action, onAction }) => {
|
|
|
6439
6520
|
className: "df-back-btn",
|
|
6440
6521
|
"aria-label": title,
|
|
6441
6522
|
children: [
|
|
6442
|
-
/* @__PURE__ */ (0,
|
|
6443
|
-
/* @__PURE__ */ (0,
|
|
6523
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "sr-only", children: title }),
|
|
6524
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_components30.Avatar, { type: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_icons2.ArrowLeft, { size: "24" }) })
|
|
6444
6525
|
]
|
|
6445
6526
|
}
|
|
6446
6527
|
);
|
|
@@ -6448,7 +6529,7 @@ var BackButton = ({ title, action, onAction }) => {
|
|
|
6448
6529
|
var BackButton_default = BackButton;
|
|
6449
6530
|
|
|
6450
6531
|
// src/dynamicFlow/DynamicFlowStep.tsx
|
|
6451
|
-
var
|
|
6532
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6452
6533
|
var DynamicFlowStep = (props) => {
|
|
6453
6534
|
var _a, _b, _c;
|
|
6454
6535
|
const { step, globalError, onAction } = props;
|
|
@@ -6459,15 +6540,15 @@ var DynamicFlowStep = (props) => {
|
|
|
6459
6540
|
return null;
|
|
6460
6541
|
}
|
|
6461
6542
|
if (externalUrl && requiresManualTrigger) {
|
|
6462
|
-
return /* @__PURE__ */ (0,
|
|
6543
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
|
|
6463
6544
|
}
|
|
6464
6545
|
if (isCameraStep(step)) {
|
|
6465
|
-
return /* @__PURE__ */ (0,
|
|
6546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
|
|
6466
6547
|
}
|
|
6467
|
-
return /* @__PURE__ */ (0,
|
|
6468
|
-
backButton && /* @__PURE__ */ (0,
|
|
6469
|
-
globalError ? /* @__PURE__ */ (0,
|
|
6470
|
-
/* @__PURE__ */ (0,
|
|
6548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
6549
|
+
backButton && /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(BackButton_default, __spreadProps(__spreadValues({}, backButton), { onAction })),
|
|
6550
|
+
globalError ? /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
|
|
6551
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
|
|
6471
6552
|
] });
|
|
6472
6553
|
};
|
|
6473
6554
|
|
|
@@ -6613,7 +6694,7 @@ var isInlineSchema = (schema) => {
|
|
|
6613
6694
|
// src/dynamicFlow/utils/useLoader.tsx
|
|
6614
6695
|
var import_components31 = require("@transferwise/components");
|
|
6615
6696
|
var import_react39 = require("react");
|
|
6616
|
-
var
|
|
6697
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
6617
6698
|
function useLoader(loaderConfig, initialState) {
|
|
6618
6699
|
const config = __spreadValues({
|
|
6619
6700
|
size: import_components31.Size.EXTRA_LARGE,
|
|
@@ -6622,7 +6703,7 @@ function useLoader(loaderConfig, initialState) {
|
|
|
6622
6703
|
}, loaderConfig);
|
|
6623
6704
|
const [loadingState, setLoadingState] = (0, import_react39.useState)(initialState);
|
|
6624
6705
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
6625
|
-
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0,
|
|
6706
|
+
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
6626
6707
|
import_components31.Loader,
|
|
6627
6708
|
{
|
|
6628
6709
|
size: config.size,
|
|
@@ -6638,11 +6719,11 @@ var import_react40 = require("react");
|
|
|
6638
6719
|
|
|
6639
6720
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.tsx
|
|
6640
6721
|
var import_components32 = require("@transferwise/components");
|
|
6641
|
-
var
|
|
6642
|
-
var
|
|
6722
|
+
var import_react_intl33 = require("react-intl");
|
|
6723
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
6643
6724
|
var ErrorBoundaryAlert = ({ onDismiss }) => {
|
|
6644
|
-
const { formatMessage } = (0,
|
|
6645
|
-
return /* @__PURE__ */ (0,
|
|
6725
|
+
const { formatMessage } = (0, import_react_intl33.useIntl)();
|
|
6726
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
6646
6727
|
import_components32.Alert,
|
|
6647
6728
|
{
|
|
6648
6729
|
action: {
|
|
@@ -6658,7 +6739,7 @@ var ErrorBoundaryAlert = ({ onDismiss }) => {
|
|
|
6658
6739
|
};
|
|
6659
6740
|
|
|
6660
6741
|
// src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
|
|
6661
|
-
var
|
|
6742
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
6662
6743
|
var noop6 = () => {
|
|
6663
6744
|
};
|
|
6664
6745
|
var ErrorBoundary = class extends import_react40.Component {
|
|
@@ -6679,8 +6760,8 @@ var ErrorBoundary = class extends import_react40.Component {
|
|
|
6679
6760
|
render() {
|
|
6680
6761
|
const { children } = this.props;
|
|
6681
6762
|
const { hasError, isFatalError } = this.state;
|
|
6682
|
-
return /* @__PURE__ */ (0,
|
|
6683
|
-
hasError && /* @__PURE__ */ (0,
|
|
6763
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsxs)(import_jsx_runtime69.Fragment, { children: [
|
|
6764
|
+
hasError && /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(ErrorBoundaryAlert, { onDismiss: this.handleErrorReset }),
|
|
6684
6765
|
!isFatalError && children
|
|
6685
6766
|
] });
|
|
6686
6767
|
}
|
|
@@ -6785,7 +6866,7 @@ var assertResponseIsValid = (response) => {
|
|
|
6785
6866
|
var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
6786
6867
|
|
|
6787
6868
|
// src/dynamicFlow/DynamicFlow.tsx
|
|
6788
|
-
var
|
|
6869
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
6789
6870
|
var noop7 = () => {
|
|
6790
6871
|
};
|
|
6791
6872
|
var DynamicFlowComponent = ({
|
|
@@ -6800,7 +6881,7 @@ var DynamicFlowComponent = ({
|
|
|
6800
6881
|
onEvent = noop7,
|
|
6801
6882
|
onLog = noop7
|
|
6802
6883
|
}) => {
|
|
6803
|
-
const { locale } = (0,
|
|
6884
|
+
const { locale } = (0, import_react_intl34.useIntl)();
|
|
6804
6885
|
const {
|
|
6805
6886
|
formErrors,
|
|
6806
6887
|
globalError,
|
|
@@ -7005,7 +7086,7 @@ var DynamicFlowComponent = ({
|
|
|
7005
7086
|
await actionHandler(action);
|
|
7006
7087
|
}
|
|
7007
7088
|
};
|
|
7008
|
-
return /* @__PURE__ */ (0,
|
|
7089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(HttpClientProvider, { httpClient, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
7009
7090
|
DynamicFlowStep,
|
|
7010
7091
|
{
|
|
7011
7092
|
step,
|
|
@@ -7021,7 +7102,7 @@ var DynamicFlowComponent = ({
|
|
|
7021
7102
|
}
|
|
7022
7103
|
) }) }) }) });
|
|
7023
7104
|
};
|
|
7024
|
-
var DynamicFlow = (props) => /* @__PURE__ */ (0,
|
|
7105
|
+
var DynamicFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
|
|
7025
7106
|
var DynamicFlow_default = DynamicFlow;
|
|
7026
7107
|
var combineModels2 = (formModels) => {
|
|
7027
7108
|
return Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
@@ -7098,6 +7179,8 @@ var en_default = {
|
|
|
7098
7179
|
"dynamicFlows.CameraCapture.reviewInstructions": "Is your picture clear, readable and complete?",
|
|
7099
7180
|
"dynamicFlows.CameraCapture.reviewRetry": "No, try again",
|
|
7100
7181
|
"dynamicFlows.CameraCapture.reviewSubmit": "Yes, submit",
|
|
7182
|
+
"dynamicFlows.CameraCapture.rotatePhone.imgAlt": "Rotate your phone icon",
|
|
7183
|
+
"dynamicFlows.CameraCapture.rotatePhone.text": "Rotate your phone to portrait view to take a photo",
|
|
7101
7184
|
"dynamicFlows.ControlFeedback.maxLength": "Please enter {maxLength} or fewer characters.",
|
|
7102
7185
|
"dynamicFlows.ControlFeedback.maximum": "Please enter a number that's {maximum} or less.",
|
|
7103
7186
|
"dynamicFlows.ControlFeedback.maximumDate": "Please enter a date that's on or before {maximum}.",
|
|
@@ -7129,7 +7212,7 @@ var en_default = {
|
|
|
7129
7212
|
// src/i18n/es.json
|
|
7130
7213
|
var es_default = {
|
|
7131
7214
|
"dynamicFlows.ArraySchema.addItem": "Guardar",
|
|
7132
|
-
"dynamicFlows.ArraySchema.addItemTitle": "
|
|
7215
|
+
"dynamicFlows.ArraySchema.addItemTitle": "A\xF1adir elemento",
|
|
7133
7216
|
"dynamicFlows.ArraySchema.editItem": "Guardar",
|
|
7134
7217
|
"dynamicFlows.ArraySchema.maxItemsError": "A\xF1ade {maxItems} o menos.",
|
|
7135
7218
|
"dynamicFlows.ArraySchema.minItemsError": "A\xF1ade al menos {minItems}.",
|