@wise/dynamic-flow-client 3.9.1 → 3.9.2
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/main.js +745 -682
- package/build/main.min.js +1 -1
- package/build/main.mjs +513 -450
- package/build/types/legacy/dynamicFlow/utils/useErrorResponse.d.ts +2 -0
- package/build/types/revamp/wise/renderers/SelectInputRenderer/SegmentedInputRendererComponent.d.ts +2 -0
- package/package.json +2 -2
package/build/main.js
CHANGED
|
@@ -1153,7 +1153,7 @@ var translations = {
|
|
|
1153
1153
|
var i18n_default = translations;
|
|
1154
1154
|
|
|
1155
1155
|
// src/revamp/DynamicFlowWise.tsx
|
|
1156
|
-
var
|
|
1156
|
+
var import_react20 = require("react");
|
|
1157
1157
|
|
|
1158
1158
|
// src/common/httpClientContext/HttpClientContext.tsx
|
|
1159
1159
|
var import_react = require("react");
|
|
@@ -10224,7 +10224,7 @@ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
|
10224
10224
|
return deterministicId || (id ? `radix-${id}` : "");
|
|
10225
10225
|
}
|
|
10226
10226
|
|
|
10227
|
-
// ../../node_modules/.pnpm/@wise+forms@0.3.4_@transferwise+components@46.
|
|
10227
|
+
// ../../node_modules/.pnpm/@wise+forms@0.3.4_@transferwise+components@46.29.0_@types+react@18.0.29_react@18.2.0/node_modules/@wise/forms/dist/index.mjs
|
|
10228
10228
|
var import_components3 = require("@transferwise/components");
|
|
10229
10229
|
var import_classnames = __toESM(require_classnames(), 1);
|
|
10230
10230
|
var import_react7 = require("react");
|
|
@@ -11723,37 +11723,71 @@ function SelectInputRendererComponent(props) {
|
|
|
11723
11723
|
] });
|
|
11724
11724
|
}
|
|
11725
11725
|
|
|
11726
|
-
// src/revamp/wise/renderers/SelectInputRenderer/
|
|
11726
|
+
// src/revamp/wise/renderers/SelectInputRenderer/SegmentedInputRendererComponent.tsx
|
|
11727
|
+
var import_react17 = require("react");
|
|
11728
|
+
var import_components31 = require("@transferwise/components");
|
|
11727
11729
|
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
11730
|
+
function SegmentedInputRendererComponent(props) {
|
|
11731
|
+
const { id, children, description, error, help, label, options, selectedIndex, onSelect } = props;
|
|
11732
|
+
(0, import_react17.useEffect)(() => {
|
|
11733
|
+
if (!isValidIndex2(selectedIndex, options.length)) {
|
|
11734
|
+
onSelect(0);
|
|
11735
|
+
}
|
|
11736
|
+
}, [selectedIndex, onSelect, options.length]);
|
|
11737
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
11738
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(FieldInput_default, { id, label, help, description, error, children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
11739
|
+
import_components31.SegmentedControl,
|
|
11740
|
+
{
|
|
11741
|
+
name: `${id}-segmented-control`,
|
|
11742
|
+
value: String(selectedIndex),
|
|
11743
|
+
mode: "view",
|
|
11744
|
+
segments: options.map((option, index) => ({
|
|
11745
|
+
id: String(index),
|
|
11746
|
+
value: String(index),
|
|
11747
|
+
label: option.title,
|
|
11748
|
+
controls: `${id}-children`
|
|
11749
|
+
})),
|
|
11750
|
+
onChange: (value) => onSelect(Number(value))
|
|
11751
|
+
}
|
|
11752
|
+
) }),
|
|
11753
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)("div", { id: `${id}-children`, children })
|
|
11754
|
+
] });
|
|
11755
|
+
}
|
|
11756
|
+
var isValidIndex2 = (index, options) => index !== null && index >= 0 && index < options;
|
|
11757
|
+
|
|
11758
|
+
// src/revamp/wise/renderers/SelectInputRenderer/SelectInputRenderer.tsx
|
|
11759
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
11728
11760
|
var SelectInputRenderer = {
|
|
11729
11761
|
canRenderType: "input-select",
|
|
11730
11762
|
render: (props) => {
|
|
11731
11763
|
switch (props.control) {
|
|
11732
11764
|
case "radio":
|
|
11733
|
-
return /* @__PURE__ */ (0,
|
|
11765
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(RadioInputRendererComponent, __spreadValues({}, props));
|
|
11734
11766
|
case "tab":
|
|
11735
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0,
|
|
11767
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TabInputRendererComponent, __spreadValues({}, props));
|
|
11768
|
+
case "segmented":
|
|
11769
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SegmentedInputRendererComponent, __spreadValues({}, props));
|
|
11736
11770
|
case "select":
|
|
11737
11771
|
default:
|
|
11738
|
-
return /* @__PURE__ */ (0,
|
|
11772
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(SelectInputRendererComponent, __spreadValues({}, props));
|
|
11739
11773
|
}
|
|
11740
11774
|
}
|
|
11741
11775
|
};
|
|
11742
11776
|
var SelectInputRenderer_default = SelectInputRenderer;
|
|
11743
11777
|
|
|
11744
11778
|
// src/revamp/wise/renderers/StatusListRenderer.tsx
|
|
11745
|
-
var
|
|
11746
|
-
var
|
|
11779
|
+
var import_components32 = require("@transferwise/components");
|
|
11780
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
11747
11781
|
var StatusListRenderer = {
|
|
11748
11782
|
canRenderType: "status-list",
|
|
11749
|
-
render: ({ margin, items, title }) => /* @__PURE__ */ (0,
|
|
11750
|
-
title ? /* @__PURE__ */ (0,
|
|
11751
|
-
items.map(({ description, icon, status, title: itemTitle }) => /* @__PURE__ */ (0,
|
|
11752
|
-
|
|
11783
|
+
render: ({ margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: getMargin(margin), children: [
|
|
11784
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components32.Header, { title }) : null,
|
|
11785
|
+
items.map(({ description, icon, status, title: itemTitle }) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
11786
|
+
import_components32.Summary,
|
|
11753
11787
|
{
|
|
11754
11788
|
title: itemTitle,
|
|
11755
11789
|
description,
|
|
11756
|
-
icon: icon && "name" in icon ? /* @__PURE__ */ (0,
|
|
11790
|
+
icon: icon && "name" in icon ? /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(DynamicIcon_default, { name: icon.name }) : null,
|
|
11757
11791
|
status: mapStatus(status)
|
|
11758
11792
|
},
|
|
11759
11793
|
`${title}/${description || ""}`
|
|
@@ -11769,63 +11803,63 @@ var mapStatus = (status) => {
|
|
|
11769
11803
|
};
|
|
11770
11804
|
|
|
11771
11805
|
// src/revamp/wise/renderers/components/VariableTextInput.tsx
|
|
11772
|
-
var
|
|
11773
|
-
var
|
|
11806
|
+
var import_components33 = require("@transferwise/components");
|
|
11807
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
11774
11808
|
function VariableTextInput({
|
|
11775
11809
|
control,
|
|
11776
11810
|
inputProps
|
|
11777
11811
|
}) {
|
|
11778
11812
|
switch (control) {
|
|
11779
11813
|
case "password":
|
|
11780
|
-
return /* @__PURE__ */ (0,
|
|
11814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TextInput, __spreadValues({ type: "password" }, inputProps));
|
|
11781
11815
|
case "email":
|
|
11782
|
-
return /* @__PURE__ */ (0,
|
|
11816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TextInput, __spreadValues({ type: "email" }, inputProps));
|
|
11783
11817
|
case "textarea":
|
|
11784
|
-
return /* @__PURE__ */ (0,
|
|
11818
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TextAreaInput, __spreadValues({}, inputProps));
|
|
11785
11819
|
case "numeric":
|
|
11786
|
-
return /* @__PURE__ */ (0,
|
|
11820
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(NumericInput, __spreadValues({ type: "number" }, inputProps));
|
|
11787
11821
|
case "phone-number":
|
|
11788
|
-
return /* @__PURE__ */ (0,
|
|
11822
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(PhoneNumberInput, __spreadValues({}, inputProps));
|
|
11789
11823
|
default:
|
|
11790
|
-
return /* @__PURE__ */ (0,
|
|
11824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(TextInput, __spreadValues({ type: "text" }, inputProps));
|
|
11791
11825
|
}
|
|
11792
11826
|
}
|
|
11793
11827
|
function TextInput(_a) {
|
|
11794
11828
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11795
11829
|
if (typeof displayFormat === "string") {
|
|
11796
11830
|
const inputProps = __spreadValues({ id, name: id, className: "form-control" }, rest);
|
|
11797
|
-
return /* @__PURE__ */ (0,
|
|
11798
|
-
|
|
11831
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11832
|
+
import_components33.InputWithDisplayFormat,
|
|
11799
11833
|
__spreadValues({
|
|
11800
11834
|
displayPattern: displayFormat,
|
|
11801
11835
|
onChange: (newValue) => onChange(newValue)
|
|
11802
11836
|
}, inputProps)
|
|
11803
11837
|
);
|
|
11804
11838
|
}
|
|
11805
|
-
return /* @__PURE__ */ (0,
|
|
11839
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components33.Input, __spreadValues({ id, name: id, onChange: (e) => onChange(e.target.value) }, rest));
|
|
11806
11840
|
}
|
|
11807
11841
|
function TextAreaInput(_a) {
|
|
11808
11842
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11809
11843
|
const textAreaProps = __spreadValues({ id, name: id }, rest);
|
|
11810
|
-
return typeof displayFormat === "string" ? /* @__PURE__ */ (0,
|
|
11811
|
-
|
|
11844
|
+
return typeof displayFormat === "string" ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11845
|
+
import_components33.TextareaWithDisplayFormat,
|
|
11812
11846
|
__spreadValues({
|
|
11813
11847
|
displayPattern: displayFormat,
|
|
11814
11848
|
onChange: (newValue) => onChange(newValue)
|
|
11815
11849
|
}, textAreaProps)
|
|
11816
|
-
) : /* @__PURE__ */ (0,
|
|
11850
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components33.TextArea, __spreadValues({ onChange: (e) => onChange(e.target.value) }, textAreaProps));
|
|
11817
11851
|
}
|
|
11818
11852
|
function NumericInput(_a) {
|
|
11819
11853
|
var _b = _a, { id, displayFormat, onChange } = _b, rest = __objRest(_b, ["id", "displayFormat", "onChange"]);
|
|
11820
11854
|
const numericProps = __spreadValues({ id, name: id, onWheel }, rest);
|
|
11821
|
-
return typeof displayFormat === "string" ? /* @__PURE__ */ (0,
|
|
11822
|
-
|
|
11855
|
+
return typeof displayFormat === "string" ? /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11856
|
+
import_components33.InputWithDisplayFormat,
|
|
11823
11857
|
__spreadValues({
|
|
11824
11858
|
displayPattern: displayFormat,
|
|
11825
11859
|
onChange: (newValue) => onChange(numericValueOrNull(newValue))
|
|
11826
11860
|
}, numericProps)
|
|
11827
|
-
) : /* @__PURE__ */ (0,
|
|
11828
|
-
|
|
11861
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
11862
|
+
import_components33.Input,
|
|
11829
11863
|
__spreadValues({
|
|
11830
11864
|
onChange: ({ target: { value: newValue } }) => onChange(numericValueOrNull(newValue))
|
|
11831
11865
|
}, numericProps)
|
|
@@ -11833,12 +11867,12 @@ function NumericInput(_a) {
|
|
|
11833
11867
|
}
|
|
11834
11868
|
function PhoneNumberInput(_a) {
|
|
11835
11869
|
var _b = _a, { value } = _b, rest = __objRest(_b, ["value"]);
|
|
11836
|
-
return /* @__PURE__ */ (0,
|
|
11870
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_components33.PhoneNumberInput, __spreadValues({ initialValue: value }, rest));
|
|
11837
11871
|
}
|
|
11838
11872
|
var VariableTextInput_default = VariableTextInput;
|
|
11839
11873
|
|
|
11840
11874
|
// src/revamp/wise/renderers/TextInputRenderer.tsx
|
|
11841
|
-
var
|
|
11875
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
11842
11876
|
var TextInputRenderer = {
|
|
11843
11877
|
canRenderType: "input-text",
|
|
11844
11878
|
render: (props) => {
|
|
@@ -11863,14 +11897,14 @@ var TextInputRenderer = {
|
|
|
11863
11897
|
]);
|
|
11864
11898
|
const value = initialValue != null ? initialValue : "";
|
|
11865
11899
|
const inputProps = __spreadProps(__spreadValues({}, rest), { value, id });
|
|
11866
|
-
return /* @__PURE__ */ (0,
|
|
11900
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(VariableTextInput_default, { control, inputProps }) });
|
|
11867
11901
|
}
|
|
11868
11902
|
};
|
|
11869
11903
|
var TextInputRenderer_default = TextInputRenderer;
|
|
11870
11904
|
|
|
11871
11905
|
// src/revamp/wise/renderers/UploadInputRenderer.tsx
|
|
11872
|
-
var
|
|
11873
|
-
var
|
|
11906
|
+
var import_components34 = require("@transferwise/components");
|
|
11907
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
11874
11908
|
var UploadInputRenderer = {
|
|
11875
11909
|
canRenderType: "input-upload",
|
|
11876
11910
|
render: (props) => {
|
|
@@ -11886,8 +11920,8 @@ var UploadInputRenderer = {
|
|
|
11886
11920
|
};
|
|
11887
11921
|
return (
|
|
11888
11922
|
// We don't pass help here as there is no sensible place to display it
|
|
11889
|
-
/* @__PURE__ */ (0,
|
|
11890
|
-
|
|
11923
|
+
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(UploadFieldInput_default, { id, label: void 0, description: void 0, error, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11924
|
+
import_components34.UploadInput,
|
|
11891
11925
|
{
|
|
11892
11926
|
id,
|
|
11893
11927
|
description,
|
|
@@ -11941,8 +11975,8 @@ var LargeUploadRenderer = {
|
|
|
11941
11975
|
throw e;
|
|
11942
11976
|
}
|
|
11943
11977
|
};
|
|
11944
|
-
return /* @__PURE__ */ (0,
|
|
11945
|
-
|
|
11978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(FieldInput_default, { id, label, description, error, help, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
11979
|
+
import_components34.Upload,
|
|
11946
11980
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
11947
11981
|
usAccept: getAcceptsString(accepts),
|
|
11948
11982
|
usDisabled: disabled,
|
|
@@ -11955,8 +11989,8 @@ var LargeUploadRenderer = {
|
|
|
11955
11989
|
};
|
|
11956
11990
|
|
|
11957
11991
|
// src/revamp/wise/renderers/ReviewRenderer.tsx
|
|
11958
|
-
var
|
|
11959
|
-
var
|
|
11992
|
+
var import_components35 = require("@transferwise/components");
|
|
11993
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
11960
11994
|
var ReviewRenderer = {
|
|
11961
11995
|
canRenderType: "review",
|
|
11962
11996
|
render: ({ callToAction, control, fields, margin, title }) => {
|
|
@@ -11968,10 +12002,10 @@ var ReviewRenderer = {
|
|
|
11968
12002
|
callToAction.onClick();
|
|
11969
12003
|
}
|
|
11970
12004
|
} : void 0;
|
|
11971
|
-
return /* @__PURE__ */ (0,
|
|
11972
|
-
(title || callToAction) && /* @__PURE__ */ (0,
|
|
11973
|
-
/* @__PURE__ */ (0,
|
|
11974
|
-
|
|
12005
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: getMargin(margin), children: [
|
|
12006
|
+
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components35.Header, { title: title != null ? title : "", action }),
|
|
12007
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
|
|
12008
|
+
import_components35.DefinitionList,
|
|
11975
12009
|
{
|
|
11976
12010
|
layout: orientation,
|
|
11977
12011
|
definitions: fields.map(({ label, value, help }, index) => ({
|
|
@@ -11987,21 +12021,21 @@ var ReviewRenderer = {
|
|
|
11987
12021
|
var ReviewRenderer_default = ReviewRenderer;
|
|
11988
12022
|
var getFieldValue = (value, help, orientation) => {
|
|
11989
12023
|
if (help) {
|
|
11990
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0,
|
|
11991
|
-
/* @__PURE__ */ (0,
|
|
12024
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
12025
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Help_default, { help }),
|
|
11992
12026
|
" ",
|
|
11993
12027
|
value
|
|
11994
|
-
] }) : /* @__PURE__ */ (0,
|
|
12028
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
11995
12029
|
value,
|
|
11996
12030
|
" ",
|
|
11997
|
-
/* @__PURE__ */ (0,
|
|
12031
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Help_default, { help })
|
|
11998
12032
|
] });
|
|
11999
12033
|
}
|
|
12000
12034
|
return value;
|
|
12001
12035
|
};
|
|
12002
12036
|
|
|
12003
12037
|
// src/revamp/wise/renderers/step/StepRenderer.tsx
|
|
12004
|
-
var
|
|
12038
|
+
var import_react19 = require("react");
|
|
12005
12039
|
|
|
12006
12040
|
// src/revamp/wise/renderers/step/ExternalConfirmationDialog.tsx
|
|
12007
12041
|
var import_react_intl15 = require("react-intl");
|
|
@@ -12032,19 +12066,19 @@ var external_confirmation_messages_default = (0, import_react_intl14.defineMessa
|
|
|
12032
12066
|
});
|
|
12033
12067
|
|
|
12034
12068
|
// src/revamp/wise/renderers/step/ExternalConfirmationDialog.tsx
|
|
12035
|
-
var
|
|
12036
|
-
var
|
|
12069
|
+
var import_components36 = require("@transferwise/components");
|
|
12070
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
12037
12071
|
function ExternalConfirmationDialog({
|
|
12038
12072
|
external,
|
|
12039
12073
|
onClose
|
|
12040
12074
|
}) {
|
|
12041
12075
|
const { formatMessage } = (0, import_react_intl15.useIntl)();
|
|
12042
|
-
return /* @__PURE__ */ (0,
|
|
12043
|
-
/* @__PURE__ */ (0,
|
|
12044
|
-
/* @__PURE__ */ (0,
|
|
12045
|
-
/* @__PURE__ */ (0,
|
|
12046
|
-
/* @__PURE__ */ (0,
|
|
12047
|
-
|
|
12076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "df-box-renderer-width-lg", children: [
|
|
12077
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h2", { className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.title) }),
|
|
12078
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components36.Markdown, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(external.url) }) }),
|
|
12079
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "df-box-renderer-width-lg", children: [
|
|
12080
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
12081
|
+
import_components36.Button,
|
|
12048
12082
|
{
|
|
12049
12083
|
block: true,
|
|
12050
12084
|
className: "m-b-2",
|
|
@@ -12057,7 +12091,7 @@ function ExternalConfirmationDialog({
|
|
|
12057
12091
|
children: formatMessage(external_confirmation_messages_default.open)
|
|
12058
12092
|
}
|
|
12059
12093
|
),
|
|
12060
|
-
/* @__PURE__ */ (0,
|
|
12094
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components36.Button, { block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onClose, children: formatMessage(external_confirmation_messages_default.cancel) })
|
|
12061
12095
|
] }) })
|
|
12062
12096
|
] }) });
|
|
12063
12097
|
}
|
|
@@ -12070,12 +12104,12 @@ function getOrigin(url) {
|
|
|
12070
12104
|
}
|
|
12071
12105
|
|
|
12072
12106
|
// src/revamp/wise/renderers/step/useExternal.tsx
|
|
12073
|
-
var
|
|
12107
|
+
var import_react18 = require("react");
|
|
12074
12108
|
function useExternal(url) {
|
|
12075
|
-
const [externalWindow, setExternalWindow] = (0,
|
|
12076
|
-
const [hasDismissed, setHasDismissed] = (0,
|
|
12109
|
+
const [externalWindow, setExternalWindow] = (0, import_react18.useState)(null);
|
|
12110
|
+
const [hasDismissed, setHasDismissed] = (0, import_react18.useState)(false);
|
|
12077
12111
|
const dismissConfirmation = () => setHasDismissed(true);
|
|
12078
|
-
(0,
|
|
12112
|
+
(0, import_react18.useEffect)(() => {
|
|
12079
12113
|
if (url) {
|
|
12080
12114
|
setHasDismissed(false);
|
|
12081
12115
|
setExternalWindow(window.open(url, "_blank"));
|
|
@@ -12086,11 +12120,11 @@ function useExternal(url) {
|
|
|
12086
12120
|
}
|
|
12087
12121
|
|
|
12088
12122
|
// src/revamp/wise/renderers/step/BackButton.tsx
|
|
12089
|
-
var
|
|
12123
|
+
var import_components37 = require("@transferwise/components");
|
|
12090
12124
|
var import_icons3 = require("@transferwise/icons");
|
|
12091
|
-
var
|
|
12125
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
12092
12126
|
function BackButton({ title, onClick }) {
|
|
12093
|
-
return /* @__PURE__ */ (0,
|
|
12127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
12094
12128
|
"a",
|
|
12095
12129
|
{
|
|
12096
12130
|
href: "/",
|
|
@@ -12101,8 +12135,8 @@ function BackButton({ title, onClick }) {
|
|
|
12101
12135
|
onClick();
|
|
12102
12136
|
},
|
|
12103
12137
|
children: [
|
|
12104
|
-
/* @__PURE__ */ (0,
|
|
12105
|
-
/* @__PURE__ */ (0,
|
|
12138
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "sr-only", children: title }),
|
|
12139
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_components37.Avatar, { type: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_icons3.ArrowLeft, { size: "24" }) })
|
|
12106
12140
|
]
|
|
12107
12141
|
}
|
|
12108
12142
|
);
|
|
@@ -12110,20 +12144,20 @@ function BackButton({ title, onClick }) {
|
|
|
12110
12144
|
var BackButton_default = BackButton;
|
|
12111
12145
|
|
|
12112
12146
|
// src/revamp/wise/renderers/step/StepRenderer.tsx
|
|
12113
|
-
var
|
|
12147
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
12114
12148
|
var StepRenderer = {
|
|
12115
12149
|
canRenderType: "step",
|
|
12116
12150
|
render: StepRendererComponent
|
|
12117
12151
|
};
|
|
12118
12152
|
function StepRendererComponent(props) {
|
|
12119
12153
|
const { back, loadingState, external, trackEvent, children } = props;
|
|
12120
|
-
const value = (0,
|
|
12154
|
+
const value = (0, import_react19.useMemo)(() => ({ loadingState, trackEvent }), [loadingState, trackEvent]);
|
|
12121
12155
|
const { requiresUserConfirmation, dismissConfirmation } = useExternal(external == null ? void 0 : external.url);
|
|
12122
12156
|
if ((external == null ? void 0 : external.url) && requiresUserConfirmation) {
|
|
12123
|
-
return /* @__PURE__ */ (0,
|
|
12157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ExternalConfirmationDialog, { external, onClose: dismissConfirmation });
|
|
12124
12158
|
}
|
|
12125
|
-
return /* @__PURE__ */ (0,
|
|
12126
|
-
back ? /* @__PURE__ */ (0,
|
|
12159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(StepRendererContextProvider, { value, children: [
|
|
12160
|
+
back ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BackButton_default, __spreadValues({}, back)) : null,
|
|
12127
12161
|
children
|
|
12128
12162
|
] });
|
|
12129
12163
|
}
|
|
@@ -12162,24 +12196,24 @@ var getWiseRenderers = () => [
|
|
|
12162
12196
|
];
|
|
12163
12197
|
|
|
12164
12198
|
// src/revamp/DynamicFlowWise.tsx
|
|
12165
|
-
var
|
|
12199
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
12166
12200
|
var wiseRenderers = getWiseRenderers();
|
|
12167
12201
|
function DynamicFlowWise(props) {
|
|
12168
12202
|
const { httpClient, renderers } = props;
|
|
12169
|
-
const mergedRenderers = (0,
|
|
12170
|
-
return /* @__PURE__ */ (0,
|
|
12203
|
+
const mergedRenderers = (0, import_react20.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
12204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(HttpClientProvider, { httpClient, children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(DynamicFlowCore, __spreadProps(__spreadValues({}, props), { renderers: mergedRenderers })) });
|
|
12171
12205
|
}
|
|
12172
12206
|
var DynamicFlowWise_default = DynamicFlowWise;
|
|
12173
12207
|
|
|
12174
12208
|
// src/revamp/DynamicFragmentWise.tsx
|
|
12175
|
-
var
|
|
12176
|
-
var
|
|
12209
|
+
var import_react21 = require("react");
|
|
12210
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
12177
12211
|
var wiseRenderers2 = getWiseRenderers();
|
|
12178
|
-
var DynamicFragmentWise = (0,
|
|
12212
|
+
var DynamicFragmentWise = (0, import_react21.forwardRef)(function DynamicFragmentWise2(props, ref) {
|
|
12179
12213
|
const { httpClient, onEvent, onError, renderers } = props;
|
|
12180
|
-
const mergedRenderers = (0,
|
|
12214
|
+
const mergedRenderers = (0, import_react21.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers2], [renderers]);
|
|
12181
12215
|
const { stepComponentRef } = useDynamicFlowCore(props);
|
|
12182
|
-
(0,
|
|
12216
|
+
(0, import_react21.useImperativeHandle)(
|
|
12183
12217
|
ref,
|
|
12184
12218
|
() => ({
|
|
12185
12219
|
getValue: async () => {
|
|
@@ -12194,18 +12228,18 @@ var DynamicFragmentWise = (0, import_react20.forwardRef)(function DynamicFragmen
|
|
|
12194
12228
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
12195
12229
|
[]
|
|
12196
12230
|
);
|
|
12197
|
-
const render = (0,
|
|
12231
|
+
const render = (0, import_react21.useMemo)(
|
|
12198
12232
|
() => getRenderFunction([CoreContainerRenderer, ...mergedRenderers, StepRenderer]),
|
|
12199
12233
|
[mergedRenderers]
|
|
12200
12234
|
);
|
|
12201
|
-
return /* @__PURE__ */ (0,
|
|
12235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
12202
12236
|
ErrorBoundary_default,
|
|
12203
12237
|
{
|
|
12204
12238
|
onError: (error) => {
|
|
12205
12239
|
onEvent == null ? void 0 : onEvent("Dynamic Flow - Failed");
|
|
12206
12240
|
onError(error);
|
|
12207
12241
|
},
|
|
12208
|
-
children: /* @__PURE__ */ (0,
|
|
12242
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(HttpClientProvider, { httpClient, children: stepComponentRef.current ? render(stepComponentRef.current) : null })
|
|
12209
12243
|
}
|
|
12210
12244
|
);
|
|
12211
12245
|
});
|
|
@@ -12516,16 +12550,16 @@ function isReference(block) {
|
|
|
12516
12550
|
}
|
|
12517
12551
|
|
|
12518
12552
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
12519
|
-
var
|
|
12553
|
+
var import_react65 = require("react");
|
|
12520
12554
|
|
|
12521
12555
|
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
12522
|
-
var
|
|
12556
|
+
var import_react23 = require("react");
|
|
12523
12557
|
|
|
12524
12558
|
// src/legacy/common/contexts/dynamicFlowContexts/usePendingPromiseCounter.ts
|
|
12525
|
-
var
|
|
12559
|
+
var import_react22 = require("react");
|
|
12526
12560
|
function usePendingPromiseCounter() {
|
|
12527
|
-
const [count, setCount] = (0,
|
|
12528
|
-
const addPendingPromise = (0,
|
|
12561
|
+
const [count, setCount] = (0, import_react22.useState)(0);
|
|
12562
|
+
const addPendingPromise = (0, import_react22.useCallback)(
|
|
12529
12563
|
(promise) => {
|
|
12530
12564
|
setCount((c) => c + 1);
|
|
12531
12565
|
promise.catch(noop2).finally(() => delayUntilNextCycle(() => setCount((c) => Math.max(0, c - 1))));
|
|
@@ -12539,44 +12573,44 @@ var noop2 = () => {
|
|
|
12539
12573
|
};
|
|
12540
12574
|
|
|
12541
12575
|
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
12542
|
-
var
|
|
12576
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
12543
12577
|
var defaultContextValue = {
|
|
12544
12578
|
loading: false,
|
|
12545
12579
|
registerPersistAsyncPromise: (promise) => {
|
|
12546
12580
|
}
|
|
12547
12581
|
};
|
|
12548
|
-
var DFContext = (0,
|
|
12582
|
+
var DFContext = (0, import_react23.createContext)(defaultContextValue);
|
|
12549
12583
|
var DynamicFlowProvider = ({ loading, children }) => {
|
|
12550
12584
|
const { pendingPromises, addPendingPromise } = usePendingPromiseCounter();
|
|
12551
|
-
const providerValue = (0,
|
|
12585
|
+
const providerValue = (0, import_react23.useMemo)(() => {
|
|
12552
12586
|
return {
|
|
12553
12587
|
loading: loading || pendingPromises > 0,
|
|
12554
12588
|
registerPersistAsyncPromise: addPendingPromise
|
|
12555
12589
|
};
|
|
12556
12590
|
}, [loading, pendingPromises, addPendingPromise]);
|
|
12557
|
-
return /* @__PURE__ */ (0,
|
|
12591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DFContext.Provider, { value: providerValue, children });
|
|
12558
12592
|
};
|
|
12559
12593
|
var useDynamicFlow = () => {
|
|
12560
|
-
const context = (0,
|
|
12594
|
+
const context = (0, import_react23.useContext)(DFContext);
|
|
12561
12595
|
return context || defaultContextValue;
|
|
12562
12596
|
};
|
|
12563
12597
|
|
|
12564
12598
|
// src/legacy/common/contexts/eventsContext/EventsContext.tsx
|
|
12565
|
-
var
|
|
12566
|
-
var
|
|
12567
|
-
var EventsContext = (0,
|
|
12599
|
+
var import_react24 = require("react");
|
|
12600
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
12601
|
+
var EventsContext = (0, import_react24.createContext)({
|
|
12568
12602
|
triggerEvent: () => {
|
|
12569
12603
|
}
|
|
12570
12604
|
});
|
|
12571
12605
|
function EventsContextProvider({ metadata, children, onEvent }) {
|
|
12572
|
-
const value = (0,
|
|
12606
|
+
const value = (0, import_react24.useMemo)(
|
|
12573
12607
|
() => ({ triggerEvent: getEventDispatcher(onEvent, metadata) }),
|
|
12574
12608
|
[onEvent, metadata]
|
|
12575
12609
|
);
|
|
12576
|
-
return /* @__PURE__ */ (0,
|
|
12610
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(EventsContext.Provider, { value, children });
|
|
12577
12611
|
}
|
|
12578
12612
|
function useEventDispatcher() {
|
|
12579
|
-
const { triggerEvent } = (0,
|
|
12613
|
+
const { triggerEvent } = (0, import_react24.useContext)(EventsContext);
|
|
12580
12614
|
return triggerEvent;
|
|
12581
12615
|
}
|
|
12582
12616
|
var getEventDispatcher = (onEvent, metadata) => (eventName, properties = {}) => {
|
|
@@ -12587,8 +12621,8 @@ var getEventDispatcher = (onEvent, metadata) => (eventName, properties = {}) =>
|
|
|
12587
12621
|
};
|
|
12588
12622
|
|
|
12589
12623
|
// src/legacy/common/contexts/logContext/LogContext.tsx
|
|
12590
|
-
var
|
|
12591
|
-
var
|
|
12624
|
+
var import_react25 = require("react");
|
|
12625
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
12592
12626
|
var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLOW-ID") => (title, description, extra) => {
|
|
12593
12627
|
try {
|
|
12594
12628
|
onLog(level, `Dynamic Flow ${level} - ${title} - ${description}`, __spreadValues({
|
|
@@ -12598,9 +12632,9 @@ var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLO
|
|
|
12598
12632
|
} catch (e) {
|
|
12599
12633
|
}
|
|
12600
12634
|
};
|
|
12601
|
-
var LogContext = (0,
|
|
12635
|
+
var LogContext = (0, import_react25.createContext)(null);
|
|
12602
12636
|
function LogProvider({ flowId, stepId, children, onLog }) {
|
|
12603
|
-
const value = (0,
|
|
12637
|
+
const value = (0, import_react25.useMemo)(
|
|
12604
12638
|
() => ({
|
|
12605
12639
|
debug: getLogger("debug", onLog, flowId, stepId),
|
|
12606
12640
|
info: getLogger("info", onLog, flowId, stepId),
|
|
@@ -12610,10 +12644,10 @@ function LogProvider({ flowId, stepId, children, onLog }) {
|
|
|
12610
12644
|
}),
|
|
12611
12645
|
[onLog, flowId, stepId]
|
|
12612
12646
|
);
|
|
12613
|
-
return /* @__PURE__ */ (0,
|
|
12647
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(LogContext.Provider, { value, children });
|
|
12614
12648
|
}
|
|
12615
12649
|
var useLogger = () => {
|
|
12616
|
-
const logging = (0,
|
|
12650
|
+
const logging = (0, import_react25.useContext)(LogContext);
|
|
12617
12651
|
if (logging == null) {
|
|
12618
12652
|
throw new Error(
|
|
12619
12653
|
"Logging context not found. Did you forget to wrap your component in a <LogProvider />?"
|
|
@@ -12623,11 +12657,11 @@ var useLogger = () => {
|
|
|
12623
12657
|
};
|
|
12624
12658
|
|
|
12625
12659
|
// src/legacy/common/contexts/featureContext/FeatureContext.tsx
|
|
12626
|
-
var
|
|
12627
|
-
var
|
|
12628
|
-
var FeatureContext = (0,
|
|
12660
|
+
var import_react26 = require("react");
|
|
12661
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
12662
|
+
var FeatureContext = (0, import_react26.createContext)([]);
|
|
12629
12663
|
function FeatureContextProvider({ features, children }) {
|
|
12630
|
-
return /* @__PURE__ */ (0,
|
|
12664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(FeatureContext.Provider, { value: features, children });
|
|
12631
12665
|
}
|
|
12632
12666
|
|
|
12633
12667
|
// src/legacy/common/utils/api-utils.ts
|
|
@@ -13357,18 +13391,18 @@ var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMed
|
|
|
13357
13391
|
};
|
|
13358
13392
|
|
|
13359
13393
|
// src/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
13360
|
-
var
|
|
13394
|
+
var import_react27 = require("react");
|
|
13361
13395
|
function useDebouncedFunction(callback, waitMs) {
|
|
13362
|
-
return (0,
|
|
13396
|
+
return (0, import_react27.useCallback)(debounce2(callback, waitMs), [callback, waitMs]);
|
|
13363
13397
|
}
|
|
13364
13398
|
|
|
13365
13399
|
// src/legacy/common/hooks/useExternal/useExternal.tsx
|
|
13366
|
-
var
|
|
13400
|
+
var import_react28 = require("react");
|
|
13367
13401
|
function useExternal2(url) {
|
|
13368
|
-
const [externalWindow, setExternalWindow] = (0,
|
|
13369
|
-
const [hasManuallyTriggered, setHasManuallyTriggered] = (0,
|
|
13402
|
+
const [externalWindow, setExternalWindow] = (0, import_react28.useState)(null);
|
|
13403
|
+
const [hasManuallyTriggered, setHasManuallyTriggered] = (0, import_react28.useState)(false);
|
|
13370
13404
|
const dismissConfirmation = () => setHasManuallyTriggered(true);
|
|
13371
|
-
(0,
|
|
13405
|
+
(0, import_react28.useEffect)(() => {
|
|
13372
13406
|
if (url) {
|
|
13373
13407
|
setHasManuallyTriggered(false);
|
|
13374
13408
|
setExternalWindow(window.open(url, "_blank"));
|
|
@@ -13379,10 +13413,10 @@ function useExternal2(url) {
|
|
|
13379
13413
|
}
|
|
13380
13414
|
|
|
13381
13415
|
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
13382
|
-
var
|
|
13416
|
+
var import_react29 = require("react");
|
|
13383
13417
|
function useExternalStepPolling(polling, onAction) {
|
|
13384
13418
|
const httpClient = useHttpClient();
|
|
13385
|
-
const asyncFn = (0,
|
|
13419
|
+
const asyncFn = (0, import_react29.useMemo)(() => {
|
|
13386
13420
|
if (polling) {
|
|
13387
13421
|
return () => httpClient(polling.url).then((response) => {
|
|
13388
13422
|
if (response.ok) {
|
|
@@ -13400,7 +13434,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
13400
13434
|
}
|
|
13401
13435
|
return void 0;
|
|
13402
13436
|
}, [polling, httpClient]);
|
|
13403
|
-
const onPollingResponse = (0,
|
|
13437
|
+
const onPollingResponse = (0, import_react29.useCallback)(
|
|
13404
13438
|
(pollingResponse) => {
|
|
13405
13439
|
const responseHandlers = (polling == null ? void 0 : polling.responseHandlers) || [];
|
|
13406
13440
|
const responseHandler = responseHandlers.find(
|
|
@@ -13427,7 +13461,7 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
13427
13461
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
13428
13462
|
maxConsecutiveFails: (polling == null ? void 0 : polling.maxConsecutiveFails) || 0,
|
|
13429
13463
|
onPollingResponse,
|
|
13430
|
-
onFailure: (0,
|
|
13464
|
+
onFailure: (0, import_react29.useCallback)(() => {
|
|
13431
13465
|
if (polling) {
|
|
13432
13466
|
onAction(polling.onError.action);
|
|
13433
13467
|
}
|
|
@@ -13436,11 +13470,11 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
13436
13470
|
}
|
|
13437
13471
|
|
|
13438
13472
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
13439
|
-
var
|
|
13473
|
+
var import_react53 = require("react");
|
|
13440
13474
|
var import_react_intl31 = require("react-intl");
|
|
13441
13475
|
|
|
13442
13476
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
13443
|
-
var
|
|
13477
|
+
var import_react52 = require("react");
|
|
13444
13478
|
var import_react_intl30 = require("react-intl");
|
|
13445
13479
|
|
|
13446
13480
|
// src/legacy/common/constants/DateMode.ts
|
|
@@ -13489,28 +13523,28 @@ var Size = {
|
|
|
13489
13523
|
|
|
13490
13524
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
13491
13525
|
var import_classnames16 = __toESM(require_classnames());
|
|
13492
|
-
var
|
|
13526
|
+
var import_react51 = require("react");
|
|
13493
13527
|
|
|
13494
13528
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
13495
|
-
var
|
|
13529
|
+
var import_components39 = require("@transferwise/components");
|
|
13496
13530
|
|
|
13497
13531
|
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
13498
|
-
var
|
|
13532
|
+
var import_components38 = require("@transferwise/components");
|
|
13499
13533
|
|
|
13500
13534
|
// src/legacy/layout/icon/FlagIcon.tsx
|
|
13501
|
-
var
|
|
13535
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
13502
13536
|
var isFlagIcon2 = (name) => name.startsWith("flag-");
|
|
13503
13537
|
function FlagIcon2({ name }) {
|
|
13504
13538
|
if (!isFlagIcon2(name)) {
|
|
13505
13539
|
return null;
|
|
13506
13540
|
}
|
|
13507
13541
|
const code = name.substring(5);
|
|
13508
|
-
return /* @__PURE__ */ (0,
|
|
13542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Flag, { intrinsicSize: 24, code });
|
|
13509
13543
|
}
|
|
13510
13544
|
|
|
13511
13545
|
// src/legacy/layout/icon/NamedIcon.tsx
|
|
13512
13546
|
var icons2 = __toESM(require("@transferwise/icons"));
|
|
13513
|
-
var
|
|
13547
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
13514
13548
|
var isNamedIcon2 = (name) => {
|
|
13515
13549
|
const iconName = toCapitalisedCamelCase2(name);
|
|
13516
13550
|
return Object.keys(icons2).includes(iconName);
|
|
@@ -13521,19 +13555,19 @@ function NamedIcon2({ name }) {
|
|
|
13521
13555
|
}
|
|
13522
13556
|
const iconName = toCapitalisedCamelCase2(name);
|
|
13523
13557
|
const Icon = icons2[iconName];
|
|
13524
|
-
return /* @__PURE__ */ (0,
|
|
13558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Icon, { size: 24 });
|
|
13525
13559
|
}
|
|
13526
13560
|
var toCapitalisedCamelCase2 = (value) => value.split("-").map(capitaliseFirstChar2).join("");
|
|
13527
13561
|
var capitaliseFirstChar2 = (value) => `${value[0].toUpperCase()}${value.slice(1)}`;
|
|
13528
13562
|
|
|
13529
13563
|
// src/legacy/layout/icon/DynamicIcon.tsx
|
|
13530
|
-
var
|
|
13564
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
13531
13565
|
function DynamicIcon2({ type }) {
|
|
13532
13566
|
if (isFlagIcon2(type)) {
|
|
13533
|
-
return /* @__PURE__ */ (0,
|
|
13567
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FlagIcon2, { name: type });
|
|
13534
13568
|
}
|
|
13535
13569
|
if (isNamedIcon2(type)) {
|
|
13536
|
-
return /* @__PURE__ */ (0,
|
|
13570
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(NamedIcon2, { name: type });
|
|
13537
13571
|
}
|
|
13538
13572
|
return null;
|
|
13539
13573
|
}
|
|
@@ -13543,17 +13577,17 @@ function isValidIconName(name) {
|
|
|
13543
13577
|
var DynamicIcon_default2 = DynamicIcon2;
|
|
13544
13578
|
|
|
13545
13579
|
// src/legacy/layout/utils/getNavigationOptionMedia.tsx
|
|
13546
|
-
var
|
|
13580
|
+
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
13547
13581
|
var getNavigationOptionMedia = ({ icon, image }) => {
|
|
13548
13582
|
if (icon == null ? void 0 : icon.name) {
|
|
13549
|
-
return /* @__PURE__ */ (0,
|
|
13583
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components38.Avatar, { type: import_components38.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(DynamicIcon_default2, { type: icon.name }) });
|
|
13550
13584
|
}
|
|
13551
13585
|
if (icon == null ? void 0 : icon.text) {
|
|
13552
|
-
return /* @__PURE__ */ (0,
|
|
13586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components38.Avatar, { type: import_components38.AvatarType.INITIALS, children: icon.text });
|
|
13553
13587
|
}
|
|
13554
13588
|
if (image == null ? void 0 : image.url) {
|
|
13555
13589
|
const { url, text } = image;
|
|
13556
|
-
return /* @__PURE__ */ (0,
|
|
13590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("img", { src: url, alt: text });
|
|
13557
13591
|
}
|
|
13558
13592
|
return null;
|
|
13559
13593
|
};
|
|
@@ -13589,11 +13623,11 @@ var getTextAlignment2 = (align) => {
|
|
|
13589
13623
|
var getTextAlignmentAndMargin2 = (component) => `${getTextAlignment2(component.align)} ${getMargin2(component.margin)}`;
|
|
13590
13624
|
|
|
13591
13625
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
13592
|
-
var
|
|
13626
|
+
var import_jsx_runtime68 = require("react/jsx-runtime");
|
|
13593
13627
|
var DynamicAlert = (props) => {
|
|
13594
13628
|
const alert = props.component;
|
|
13595
|
-
return /* @__PURE__ */ (0,
|
|
13596
|
-
|
|
13629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
|
|
13630
|
+
import_components39.Alert,
|
|
13597
13631
|
{
|
|
13598
13632
|
type: mapContextToAlertType(legacy_mapContext(alert.context)),
|
|
13599
13633
|
className: getMargin2(alert.margin),
|
|
@@ -13625,12 +13659,12 @@ var mapContextToAlertType = (context) => {
|
|
|
13625
13659
|
var DynamicAlert_default = DynamicAlert;
|
|
13626
13660
|
|
|
13627
13661
|
// src/legacy/layout/box/DynamicBox.tsx
|
|
13628
|
-
var
|
|
13662
|
+
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
13629
13663
|
var DynamicBox = (props) => {
|
|
13630
13664
|
const box = props.component;
|
|
13631
13665
|
const margin = getMargin2(box.margin || box.border ? "lg" : "xs");
|
|
13632
13666
|
if (!box.width || box.width === "xl") {
|
|
13633
|
-
return /* @__PURE__ */ (0,
|
|
13667
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: margin + getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13634
13668
|
DynamicLayout_default,
|
|
13635
13669
|
{
|
|
13636
13670
|
components: box.components,
|
|
@@ -13643,7 +13677,7 @@ var DynamicBox = (props) => {
|
|
|
13643
13677
|
}
|
|
13644
13678
|
) });
|
|
13645
13679
|
}
|
|
13646
|
-
return /* @__PURE__ */ (0,
|
|
13680
|
+
return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: margin + getBoxWidthClasses(box), children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)("div", { className: getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
|
|
13647
13681
|
DynamicLayout_default,
|
|
13648
13682
|
{
|
|
13649
13683
|
components: box.components,
|
|
@@ -13677,7 +13711,7 @@ var getBoxWidthClasses = (component) => {
|
|
|
13677
13711
|
var DynamicBox_default = DynamicBox;
|
|
13678
13712
|
|
|
13679
13713
|
// src/legacy/layout/button/DynamicButton.tsx
|
|
13680
|
-
var
|
|
13714
|
+
var import_components40 = require("@transferwise/components");
|
|
13681
13715
|
|
|
13682
13716
|
// src/legacy/layout/button/utils.ts
|
|
13683
13717
|
var priorities = {
|
|
@@ -13727,7 +13761,7 @@ var getButtonSize = (size) => {
|
|
|
13727
13761
|
};
|
|
13728
13762
|
|
|
13729
13763
|
// src/legacy/layout/button/DynamicButton.tsx
|
|
13730
|
-
var
|
|
13764
|
+
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
13731
13765
|
function DynamicButton(props) {
|
|
13732
13766
|
var _a;
|
|
13733
13767
|
const { component, onAction } = props;
|
|
@@ -13736,8 +13770,8 @@ function DynamicButton(props) {
|
|
|
13736
13770
|
const priority = getButtonPriority(component);
|
|
13737
13771
|
const { loading } = useDynamicFlow();
|
|
13738
13772
|
const className = getMargin2(component.margin || "md");
|
|
13739
|
-
return /* @__PURE__ */ (0,
|
|
13740
|
-
|
|
13773
|
+
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
13774
|
+
import_components40.Button,
|
|
13741
13775
|
{
|
|
13742
13776
|
size: getButtonSize(component.size),
|
|
13743
13777
|
type: priority === "tertiary" ? void 0 : type,
|
|
@@ -13753,12 +13787,12 @@ function DynamicButton(props) {
|
|
|
13753
13787
|
var DynamicButton_default = DynamicButton;
|
|
13754
13788
|
|
|
13755
13789
|
// src/legacy/layout/columns/DynamicColumns.tsx
|
|
13756
|
-
var
|
|
13790
|
+
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
13757
13791
|
var DynamicColumns = (props) => {
|
|
13758
13792
|
const columns = props.component;
|
|
13759
13793
|
const { leftWidth, rightWidth } = getWidth(columns.bias);
|
|
13760
|
-
return /* @__PURE__ */ (0,
|
|
13761
|
-
/* @__PURE__ */ (0,
|
|
13794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: `${getMargin2(columns.margin || "xs")} row`, children: [
|
|
13795
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: `${leftWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13762
13796
|
DynamicLayout_default,
|
|
13763
13797
|
{
|
|
13764
13798
|
components: columns.left,
|
|
@@ -13770,7 +13804,7 @@ var DynamicColumns = (props) => {
|
|
|
13770
13804
|
onPersistAsync: props.onPersistAsync
|
|
13771
13805
|
}
|
|
13772
13806
|
) }),
|
|
13773
|
-
/* @__PURE__ */ (0,
|
|
13807
|
+
/* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: `${rightWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
13774
13808
|
DynamicLayout_default,
|
|
13775
13809
|
{
|
|
13776
13810
|
components: columns.right,
|
|
@@ -13805,12 +13839,12 @@ var getWidth = (bias) => {
|
|
|
13805
13839
|
var DynamicColumns_default = DynamicColumns;
|
|
13806
13840
|
|
|
13807
13841
|
// src/legacy/layout/decision/DynamicDecision.tsx
|
|
13808
|
-
var
|
|
13809
|
-
var
|
|
13842
|
+
var import_components41 = require("@transferwise/components");
|
|
13843
|
+
var import_jsx_runtime72 = require("react/jsx-runtime");
|
|
13810
13844
|
function DynamicDecision({ component, onAction }) {
|
|
13811
13845
|
const { loading } = useDynamicFlow();
|
|
13812
|
-
return /* @__PURE__ */ (0,
|
|
13813
|
-
|
|
13846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className: getMargin2(component.margin), children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_components41.NavigationOptionsList, { children: component.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(
|
|
13847
|
+
import_components41.NavigationOption,
|
|
13814
13848
|
{
|
|
13815
13849
|
title: option.title,
|
|
13816
13850
|
content: option.description,
|
|
@@ -13826,17 +13860,17 @@ function DynamicDecision({ component, onAction }) {
|
|
|
13826
13860
|
var DynamicDecision_default = DynamicDecision;
|
|
13827
13861
|
|
|
13828
13862
|
// src/legacy/layout/divider/DynamicDivider.tsx
|
|
13829
|
-
var
|
|
13863
|
+
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
13830
13864
|
var DynamicDivider = ({ component }) => {
|
|
13831
13865
|
const margin = getMargin2(component.margin);
|
|
13832
13866
|
const className = `m-t-0 ${margin}`;
|
|
13833
|
-
return /* @__PURE__ */ (0,
|
|
13867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("hr", { className });
|
|
13834
13868
|
};
|
|
13835
13869
|
var DynamicDivider_default = DynamicDivider;
|
|
13836
13870
|
|
|
13837
13871
|
// src/legacy/layout/external/DynamicExternal.tsx
|
|
13838
|
-
var
|
|
13839
|
-
var
|
|
13872
|
+
var import_components42 = require("@transferwise/components");
|
|
13873
|
+
var import_react30 = require("react");
|
|
13840
13874
|
var import_react_intl17 = require("react-intl");
|
|
13841
13875
|
|
|
13842
13876
|
// src/legacy/layout/external/DynamicExternal.messages.ts
|
|
@@ -13850,37 +13884,37 @@ var DynamicExternal_messages_default = (0, import_react_intl16.defineMessages)({
|
|
|
13850
13884
|
});
|
|
13851
13885
|
|
|
13852
13886
|
// src/legacy/layout/external/DynamicExternal.tsx
|
|
13853
|
-
var
|
|
13887
|
+
var import_jsx_runtime74 = require("react/jsx-runtime");
|
|
13854
13888
|
var DynamicExternal = ({ component, onAction }) => {
|
|
13855
13889
|
const { requestUrl, responseHandlers, polling, retryTitle } = component;
|
|
13856
13890
|
const intl = (0, import_react_intl17.useIntl)();
|
|
13857
|
-
const openExternalUrl = (0,
|
|
13891
|
+
const openExternalUrl = (0, import_react30.useCallback)(
|
|
13858
13892
|
() => window.open(requestUrl, "df-external-window"),
|
|
13859
13893
|
[requestUrl]
|
|
13860
13894
|
);
|
|
13861
|
-
(0,
|
|
13895
|
+
(0, import_react30.useEffect)(() => {
|
|
13862
13896
|
openExternalUrl();
|
|
13863
13897
|
}, [openExternalUrl]);
|
|
13864
13898
|
const pollingConfiguration = polling && responseHandlers ? __spreadProps(__spreadValues({}, polling), {
|
|
13865
13899
|
responseHandlers
|
|
13866
13900
|
}) : void 0;
|
|
13867
13901
|
useExternalStepPolling(pollingConfiguration, onAction);
|
|
13868
|
-
return /* @__PURE__ */ (0,
|
|
13869
|
-
/* @__PURE__ */ (0,
|
|
13870
|
-
/* @__PURE__ */ (0,
|
|
13871
|
-
/* @__PURE__ */ (0,
|
|
13902
|
+
return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
|
|
13903
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components42.Loader, { size: import_components42.Size.LARGE, classNames: { "tw-loader": "tw-loader m-x-auto" } }),
|
|
13904
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)("br", {}),
|
|
13905
|
+
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_components42.Button, { priority: "tertiary", block: true, onClick: openExternalUrl, children: retryTitle || intl.formatMessage(DynamicExternal_messages_default.retryTitle) })
|
|
13872
13906
|
] });
|
|
13873
13907
|
};
|
|
13874
13908
|
var DynamicExternal_default = DynamicExternal;
|
|
13875
13909
|
|
|
13876
13910
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
13877
|
-
var
|
|
13911
|
+
var import_react44 = require("react");
|
|
13878
13912
|
|
|
13879
13913
|
// src/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
13880
|
-
var
|
|
13914
|
+
var import_components43 = require("@transferwise/components");
|
|
13881
13915
|
var import_classnames7 = __toESM(require_classnames());
|
|
13882
|
-
var
|
|
13883
|
-
var
|
|
13916
|
+
var import_react31 = require("react");
|
|
13917
|
+
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
13884
13918
|
var splitModel = (model, schemas) => schemas.map((schema) => getValidObjectModelParts(model, schema) || {});
|
|
13885
13919
|
var combineModels = (models) => models.reduce((current, combined) => __spreadValues(__spreadValues({}, combined), current), {});
|
|
13886
13920
|
var getSchemaColumnClasses = (width) => ({
|
|
@@ -13895,13 +13929,13 @@ function AllOfSchema(props) {
|
|
|
13895
13929
|
setModels(models);
|
|
13896
13930
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model: combineModels(models) }));
|
|
13897
13931
|
};
|
|
13898
|
-
const [models, setModels] = (0,
|
|
13899
|
-
return /* @__PURE__ */ (0,
|
|
13900
|
-
props.schema.title && /* @__PURE__ */ (0,
|
|
13901
|
-
props.schema.description && /* @__PURE__ */ (0,
|
|
13902
|
-
/* @__PURE__ */ (0,
|
|
13932
|
+
const [models, setModels] = (0, import_react31.useState)(splitModel(props.model, props.schema.allOf));
|
|
13933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
13934
|
+
props.schema.title && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(import_components43.Header, { title: props.schema.title }),
|
|
13935
|
+
props.schema.description && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { children: props.schema.description }),
|
|
13936
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "row", children: props.schema.allOf.map((schema, index) => (
|
|
13903
13937
|
// eslint-disable-next-line react/no-array-index-key
|
|
13904
|
-
/* @__PURE__ */ (0,
|
|
13938
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: (0, import_classnames7.default)(getSchemaColumnClasses(schema.width)), children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
13905
13939
|
GenericSchema_default,
|
|
13906
13940
|
{
|
|
13907
13941
|
schema,
|
|
@@ -13925,15 +13959,15 @@ AllOfSchema.defaultProps = {
|
|
|
13925
13959
|
var AllOfSchema_default = AllOfSchema;
|
|
13926
13960
|
|
|
13927
13961
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
13928
|
-
var
|
|
13962
|
+
var import_components45 = require("@transferwise/components");
|
|
13929
13963
|
var import_classnames8 = __toESM(require_classnames());
|
|
13930
|
-
var
|
|
13964
|
+
var import_react32 = require("react");
|
|
13931
13965
|
|
|
13932
13966
|
// src/legacy/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
|
|
13933
|
-
var
|
|
13967
|
+
var import_components44 = require("@transferwise/components");
|
|
13934
13968
|
var import_formatting2 = require("@transferwise/formatting");
|
|
13935
13969
|
var import_react_intl18 = require("react-intl");
|
|
13936
|
-
var
|
|
13970
|
+
var import_jsx_runtime76 = require("react/jsx-runtime");
|
|
13937
13971
|
function ControlFeedback(props) {
|
|
13938
13972
|
var _a;
|
|
13939
13973
|
const defaultValidationMessages = useDefaultValidationMessages(props.schema);
|
|
@@ -13942,12 +13976,12 @@ function ControlFeedback(props) {
|
|
|
13942
13976
|
const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && Boolean((_a = props.validations) == null ? void 0 : _a.length);
|
|
13943
13977
|
const isDescriptionVisible = props.schema.type !== "boolean" && props.schema.description && !isErrorVisible && !isValidationVisible;
|
|
13944
13978
|
const hasInfoMessage = Boolean(props.infoMessage);
|
|
13945
|
-
return /* @__PURE__ */ (0,
|
|
13946
|
-
isErrorVisible ? /* @__PURE__ */ (0,
|
|
13947
|
-
isValidationVisible ? /* @__PURE__ */ (0,
|
|
13948
|
-
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0,
|
|
13949
|
-
isDescriptionVisible && /* @__PURE__ */ (0,
|
|
13950
|
-
hasInfoMessage && /* @__PURE__ */ (0,
|
|
13979
|
+
return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)("div", { id: props.id, children: [
|
|
13980
|
+
isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_components44.InlineAlert, { type: "error", children: props.errors }) : null,
|
|
13981
|
+
isValidationVisible ? /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(import_components44.InlineAlert, { type: "error", children: props.validations.map((validation) => /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { children: validationMessages[validation] }, validation)) }) : null,
|
|
13982
|
+
(isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_components44.InlineAlert, { type: "info", children: [
|
|
13983
|
+
isDescriptionVisible && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { children: props.schema.description }),
|
|
13984
|
+
hasInfoMessage && /* @__PURE__ */ (0, import_jsx_runtime76.jsx)("div", { children: props.infoMessage })
|
|
13951
13985
|
] })
|
|
13952
13986
|
] });
|
|
13953
13987
|
}
|
|
@@ -14073,15 +14107,15 @@ function useFormattedDefaultErrorMessages({
|
|
|
14073
14107
|
}
|
|
14074
14108
|
|
|
14075
14109
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
|
|
14076
|
-
var
|
|
14110
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
14077
14111
|
function MultipleFileUploadSchema(props) {
|
|
14078
14112
|
var _a, _b;
|
|
14079
14113
|
const { onChange, schema } = props;
|
|
14080
14114
|
const onEvent = useEventDispatcher();
|
|
14081
14115
|
const defaultErrorMessages = useFormattedDefaultErrorMessages(schema);
|
|
14082
|
-
const uid = (0,
|
|
14083
|
-
const [inputChanged, setInputChanged] = (0,
|
|
14084
|
-
const [files, setFiles] = (0,
|
|
14116
|
+
const uid = (0, import_react32.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
14117
|
+
const [inputChanged, setInputChanged] = (0, import_react32.useState)(false);
|
|
14118
|
+
const [files, setFiles] = (0, import_react32.useState)(() => convertFileIdsToComponentFileObjects(props.model || []));
|
|
14085
14119
|
const performPersistAsync = usePersistAsync(schema.items.persistAsync);
|
|
14086
14120
|
const fileSchemaDescriptor = schema.items.persistAsync.schema;
|
|
14087
14121
|
const isBlob = isBlobSchema2(fileSchemaDescriptor);
|
|
@@ -14135,10 +14169,10 @@ function MultipleFileUploadSchema(props) {
|
|
|
14135
14169
|
onDeleteFile: () => Promise.resolve()
|
|
14136
14170
|
});
|
|
14137
14171
|
const feedbackId = `${uid}-feedback`;
|
|
14138
|
-
return /* @__PURE__ */ (0,
|
|
14139
|
-
/* @__PURE__ */ (0,
|
|
14140
|
-
/* @__PURE__ */ (0,
|
|
14141
|
-
/* @__PURE__ */ (0,
|
|
14172
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: (0, import_classnames8.default)("form-group", { "has-error": showError }), children: [
|
|
14173
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("label", { className: "d-block control-label", htmlFor: uid, children: props.schema.title }),
|
|
14174
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(import_components45.UploadInput, __spreadValues({}, uploadInputProps)) }),
|
|
14175
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
14142
14176
|
ControlFeedback_default,
|
|
14143
14177
|
{
|
|
14144
14178
|
id: feedbackId,
|
|
@@ -14168,7 +14202,7 @@ function getSuccessfullyProcessedFiles(allFiles) {
|
|
|
14168
14202
|
return allFiles.filter((file) => !file.error && file.status === "succeeded");
|
|
14169
14203
|
}
|
|
14170
14204
|
function convertFileIdsToComponentFileObjects(fileIds) {
|
|
14171
|
-
return fileIds.map((id) => isValidId(id) ? { id, status:
|
|
14205
|
+
return fileIds.map((id) => isValidId(id) ? { id, status: import_components45.Status.SUCCEEDED } : null).filter((item) => item !== null);
|
|
14172
14206
|
}
|
|
14173
14207
|
function isValidId(id) {
|
|
14174
14208
|
return isNumber3(id) || isString2(id);
|
|
@@ -14179,14 +14213,14 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
|
|
|
14179
14213
|
}
|
|
14180
14214
|
|
|
14181
14215
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
14182
|
-
var
|
|
14216
|
+
var import_components47 = require("@transferwise/components");
|
|
14183
14217
|
var import_classnames9 = __toESM(require_classnames());
|
|
14184
|
-
var
|
|
14218
|
+
var import_react33 = require("react");
|
|
14185
14219
|
var import_react_intl22 = require("react-intl");
|
|
14186
14220
|
|
|
14187
14221
|
// src/legacy/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
|
|
14188
|
-
var
|
|
14189
|
-
var
|
|
14222
|
+
var import_components46 = require("@transferwise/components");
|
|
14223
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
14190
14224
|
var mapConstSchemaToOption = (schema, controlType) => {
|
|
14191
14225
|
switch (controlType) {
|
|
14192
14226
|
case "select":
|
|
@@ -14210,7 +14244,7 @@ var mapKeywordsToSearchStrings = (searchStrings) => isArray2(searchStrings) ? {
|
|
|
14210
14244
|
var mapImage = (image) => {
|
|
14211
14245
|
if (image == null ? void 0 : image.url) {
|
|
14212
14246
|
return {
|
|
14213
|
-
icon: /* @__PURE__ */ (0,
|
|
14247
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "media", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("img", { src: image.url, alt: image.name || "" }) }) }),
|
|
14214
14248
|
hideIconInTrigger: true
|
|
14215
14249
|
};
|
|
14216
14250
|
}
|
|
@@ -14219,17 +14253,17 @@ var mapImage = (image) => {
|
|
|
14219
14253
|
var getIconPropertyForSelectOption = (icon) => {
|
|
14220
14254
|
if ((icon == null ? void 0 : icon.name) && isFlagIcon2(icon.name)) {
|
|
14221
14255
|
return {
|
|
14222
|
-
icon: /* @__PURE__ */ (0,
|
|
14256
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Flag, { code: icon.name.substring(5), intrinsicSize: 24 })
|
|
14223
14257
|
};
|
|
14224
14258
|
}
|
|
14225
14259
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
14226
14260
|
return {
|
|
14227
|
-
icon: /* @__PURE__ */ (0,
|
|
14261
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DynamicIcon_default2, { type: icon.name })
|
|
14228
14262
|
};
|
|
14229
14263
|
}
|
|
14230
14264
|
if (icon == null ? void 0 : icon.text) {
|
|
14231
14265
|
return {
|
|
14232
|
-
icon: /* @__PURE__ */ (0,
|
|
14266
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { children: icon.text })
|
|
14233
14267
|
};
|
|
14234
14268
|
}
|
|
14235
14269
|
return null;
|
|
@@ -14237,17 +14271,17 @@ var getIconPropertyForSelectOption = (icon) => {
|
|
|
14237
14271
|
var getAvatarPropertyForRadioOption = ({ image, icon }) => {
|
|
14238
14272
|
if (image == null ? void 0 : image.url) {
|
|
14239
14273
|
return {
|
|
14240
|
-
avatar: /* @__PURE__ */ (0,
|
|
14274
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components46.Avatar, { type: import_components46.AvatarType.THUMBNAIL, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("img", { src: image.url, alt: "" }) })
|
|
14241
14275
|
};
|
|
14242
14276
|
}
|
|
14243
14277
|
if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
|
|
14244
14278
|
return {
|
|
14245
|
-
avatar: /* @__PURE__ */ (0,
|
|
14279
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components46.Avatar, { type: import_components46.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(DynamicIcon_default2, { type: icon.name }) })
|
|
14246
14280
|
};
|
|
14247
14281
|
}
|
|
14248
14282
|
if (icon == null ? void 0 : icon.text) {
|
|
14249
14283
|
return {
|
|
14250
|
-
avatar: /* @__PURE__ */ (0,
|
|
14284
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(import_components46.Avatar, { type: import_components46.AvatarType.INITIALS, children: icon.text })
|
|
14251
14285
|
};
|
|
14252
14286
|
}
|
|
14253
14287
|
return null;
|
|
@@ -14286,7 +14320,7 @@ var multi_select_messages_default = (0, import_react_intl21.defineMessages)({
|
|
|
14286
14320
|
});
|
|
14287
14321
|
|
|
14288
14322
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multiSelectSchema/MultiSelectSchema.tsx
|
|
14289
|
-
var
|
|
14323
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
14290
14324
|
function MultiSelectSchema({
|
|
14291
14325
|
schema,
|
|
14292
14326
|
model,
|
|
@@ -14298,10 +14332,10 @@ function MultiSelectSchema({
|
|
|
14298
14332
|
const { formatMessage, locale } = (0, import_react_intl22.useIntl)();
|
|
14299
14333
|
const { disabled, items, validationMessages, placeholder } = schema;
|
|
14300
14334
|
const options = items.oneOf.map((item) => mapConstSchemaToOption(item, "select"));
|
|
14301
|
-
const id = (0,
|
|
14302
|
-
const [changed, setChanged] = (0,
|
|
14303
|
-
const [selected, setSelected] = (0,
|
|
14304
|
-
(0,
|
|
14335
|
+
const id = (0, import_react33.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
14336
|
+
const [changed, setChanged] = (0, import_react33.useState)(false);
|
|
14337
|
+
const [selected, setSelected] = (0, import_react33.useState)(getInitialModelIndices(model, options));
|
|
14338
|
+
(0, import_react33.useEffect)(
|
|
14305
14339
|
() => {
|
|
14306
14340
|
if (selected) {
|
|
14307
14341
|
broadcastModelChange(selected);
|
|
@@ -14338,10 +14372,10 @@ function MultiSelectSchema({
|
|
|
14338
14372
|
const formGroupClasses = {
|
|
14339
14373
|
"has-error": shouldShowInitialError || shouldShowValidationError
|
|
14340
14374
|
};
|
|
14341
|
-
return /* @__PURE__ */ (0,
|
|
14342
|
-
schema.title ? /* @__PURE__ */ (0,
|
|
14343
|
-
/* @__PURE__ */ (0,
|
|
14344
|
-
|
|
14375
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: (0, import_classnames9.default)("d-flex flex-column", formGroupClasses), children: [
|
|
14376
|
+
schema.title ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)("label", { htmlFor: id, children: schema.title }) : void 0,
|
|
14377
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14378
|
+
import_components47.SelectInput,
|
|
14345
14379
|
{
|
|
14346
14380
|
id,
|
|
14347
14381
|
multiple: true,
|
|
@@ -14350,20 +14384,28 @@ function MultiSelectSchema({
|
|
|
14350
14384
|
items: options.map((value, index) => ({
|
|
14351
14385
|
type: "option",
|
|
14352
14386
|
value: index,
|
|
14353
|
-
disabled: value.disabled
|
|
14387
|
+
disabled: value.disabled,
|
|
14388
|
+
filterMatchers: [
|
|
14389
|
+
value.label,
|
|
14390
|
+
value.value,
|
|
14391
|
+
...value.note ? [value.note] : [],
|
|
14392
|
+
...value.secondary ? [value.secondary] : [],
|
|
14393
|
+
...value.searchStrings ? value.searchStrings : []
|
|
14394
|
+
]
|
|
14354
14395
|
})),
|
|
14396
|
+
filterable: options.length >= 8,
|
|
14355
14397
|
value: selected != null ? selected : [],
|
|
14356
14398
|
renderValue: (index, withinTrigger) => {
|
|
14357
14399
|
const { icon, label, note, secondary } = options[index];
|
|
14358
14400
|
if (withinTrigger) {
|
|
14359
14401
|
return selected && index === selected[0] ? getFormattedMessage() : void 0;
|
|
14360
14402
|
}
|
|
14361
|
-
return /* @__PURE__ */ (0,
|
|
14403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(import_components47.SelectInputOptionContent, { title: label, note: note != null ? note : secondary, icon });
|
|
14362
14404
|
},
|
|
14363
14405
|
onChange: broadcastModelChange
|
|
14364
14406
|
}
|
|
14365
14407
|
),
|
|
14366
|
-
/* @__PURE__ */ (0,
|
|
14408
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
14367
14409
|
ControlFeedback_default,
|
|
14368
14410
|
{
|
|
14369
14411
|
id: `${id}-feedback`,
|
|
@@ -14388,17 +14430,17 @@ var getInitialModelIndices = (model, options) => {
|
|
|
14388
14430
|
};
|
|
14389
14431
|
|
|
14390
14432
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
14391
|
-
var
|
|
14433
|
+
var import_components49 = require("@transferwise/components");
|
|
14392
14434
|
var import_icons4 = require("@transferwise/icons");
|
|
14393
|
-
var
|
|
14435
|
+
var import_react35 = require("react");
|
|
14394
14436
|
var import_react_intl24 = require("react-intl");
|
|
14395
14437
|
|
|
14396
14438
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
14397
|
-
var
|
|
14398
|
-
var
|
|
14439
|
+
var import_components48 = require("@transferwise/components");
|
|
14440
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
14399
14441
|
function ItemSummaryOption2({ item, onClick }) {
|
|
14400
|
-
return /* @__PURE__ */ (0,
|
|
14401
|
-
|
|
14442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsx)(
|
|
14443
|
+
import_components48.NavigationOption,
|
|
14402
14444
|
{
|
|
14403
14445
|
media: getNavigationOptionMedia(item),
|
|
14404
14446
|
title: item.title,
|
|
@@ -14410,9 +14452,9 @@ function ItemSummaryOption2({ item, onClick }) {
|
|
|
14410
14452
|
}
|
|
14411
14453
|
|
|
14412
14454
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
14413
|
-
var
|
|
14455
|
+
var import_react34 = require("react");
|
|
14414
14456
|
var import_react_intl23 = require("react-intl");
|
|
14415
|
-
var
|
|
14457
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
14416
14458
|
function RepeatableSchemaStep({
|
|
14417
14459
|
type,
|
|
14418
14460
|
schema,
|
|
@@ -14423,7 +14465,7 @@ function RepeatableSchemaStep({
|
|
|
14423
14465
|
onAction
|
|
14424
14466
|
}) {
|
|
14425
14467
|
const { formatMessage } = (0, import_react_intl23.useIntl)();
|
|
14426
|
-
const [filename, setFilename] = (0,
|
|
14468
|
+
const [filename, setFilename] = (0, import_react34.useState)(void 0);
|
|
14427
14469
|
const step = {
|
|
14428
14470
|
layout: [
|
|
14429
14471
|
{
|
|
@@ -14460,7 +14502,7 @@ function RepeatableSchemaStep({
|
|
|
14460
14502
|
}
|
|
14461
14503
|
onModelChange(__spreadProps(__spreadValues({}, modelChangeProps), { model: model2 }));
|
|
14462
14504
|
};
|
|
14463
|
-
return /* @__PURE__ */ (0,
|
|
14505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
14464
14506
|
DynamicFlowStep,
|
|
14465
14507
|
{
|
|
14466
14508
|
step,
|
|
@@ -14666,7 +14708,7 @@ var schemaSummaryProvides = (summary, providesProp) => (
|
|
|
14666
14708
|
|
|
14667
14709
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
14668
14710
|
var import_classnames10 = __toESM(require_classnames());
|
|
14669
|
-
var
|
|
14711
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
14670
14712
|
function RepeatableSchema({
|
|
14671
14713
|
schema,
|
|
14672
14714
|
model,
|
|
@@ -14676,9 +14718,9 @@ function RepeatableSchema({
|
|
|
14676
14718
|
onChange
|
|
14677
14719
|
}) {
|
|
14678
14720
|
var _a;
|
|
14679
|
-
const [openModalType, setOpenModalType] = (0,
|
|
14680
|
-
const [changed, setChanged] = (0,
|
|
14681
|
-
const [itemSummaries, setItemSummaries] = (0,
|
|
14721
|
+
const [openModalType, setOpenModalType] = (0, import_react35.useState)(null);
|
|
14722
|
+
const [changed, setChanged] = (0, import_react35.useState)(false);
|
|
14723
|
+
const [itemSummaries, setItemSummaries] = (0, import_react35.useState)(() => {
|
|
14682
14724
|
if (isObject2(model) && !isArray2(model)) {
|
|
14683
14725
|
throw new Error(
|
|
14684
14726
|
"RepeatableSchema does not support object models. Ensure your array schema is wrapped inside an object schema."
|
|
@@ -14686,8 +14728,8 @@ function RepeatableSchema({
|
|
|
14686
14728
|
}
|
|
14687
14729
|
return model ? model.map((item) => getItemSummaryFromSchema(schema.items, item, schema == null ? void 0 : schema.summary)) : null;
|
|
14688
14730
|
});
|
|
14689
|
-
const [editableItem, setEditableItem] = (0,
|
|
14690
|
-
const id = (0,
|
|
14731
|
+
const [editableItem, setEditableItem] = (0, import_react35.useState)({ item: null, model: null });
|
|
14732
|
+
const id = (0, import_react35.useMemo)(() => schema.$id || generateRandomId(), [schema.$id]);
|
|
14691
14733
|
const broadcastModelChange = (updatedItems) => {
|
|
14692
14734
|
const updatedModel = updatedItems ? updatedItems.map(({ value }) => value) : null;
|
|
14693
14735
|
onChange({
|
|
@@ -14743,9 +14785,9 @@ function RepeatableSchema({
|
|
|
14743
14785
|
const formGroupClasses = {
|
|
14744
14786
|
"has-error": (_a = errors && !isEmpty(errors)) != null ? _a : submitted && validations.length
|
|
14745
14787
|
};
|
|
14746
|
-
return /* @__PURE__ */ (0,
|
|
14747
|
-
schema.title && /* @__PURE__ */ (0,
|
|
14748
|
-
itemSummaries == null ? void 0 : itemSummaries.map((itemSummary) => /* @__PURE__ */ (0,
|
|
14788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { id, className: (0, import_classnames10.default)(formGroupClasses), children: [
|
|
14789
|
+
schema.title && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_components49.Header, { title: schema.title }),
|
|
14790
|
+
itemSummaries == null ? void 0 : itemSummaries.map((itemSummary) => /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14749
14791
|
ItemSummaryOption2,
|
|
14750
14792
|
{
|
|
14751
14793
|
item: itemSummary,
|
|
@@ -14753,21 +14795,21 @@ function RepeatableSchema({
|
|
|
14753
14795
|
},
|
|
14754
14796
|
JSON.stringify(itemSummary)
|
|
14755
14797
|
)),
|
|
14756
|
-
/* @__PURE__ */ (0,
|
|
14757
|
-
|
|
14798
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14799
|
+
import_components49.NavigationOption,
|
|
14758
14800
|
{
|
|
14759
|
-
media: /* @__PURE__ */ (0,
|
|
14801
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_icons4.Plus, {}),
|
|
14760
14802
|
title: schema.addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
14761
14803
|
showMediaAtAllSizes: true,
|
|
14762
14804
|
onClick: onAddItem
|
|
14763
14805
|
}
|
|
14764
14806
|
),
|
|
14765
|
-
/* @__PURE__ */ (0,
|
|
14766
|
-
|
|
14807
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14808
|
+
import_components49.Modal,
|
|
14767
14809
|
{
|
|
14768
14810
|
open: openModalType !== null,
|
|
14769
14811
|
title: (openModalType === "add" ? schema.addItemTitle : schema.editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
14770
|
-
body: /* @__PURE__ */ (0,
|
|
14812
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14771
14813
|
RepeatableSchemaStep_default,
|
|
14772
14814
|
{
|
|
14773
14815
|
type: openModalType != null ? openModalType : "add",
|
|
@@ -14782,7 +14824,7 @@ function RepeatableSchema({
|
|
|
14782
14824
|
onClose: onCancelEdit
|
|
14783
14825
|
}
|
|
14784
14826
|
),
|
|
14785
|
-
/* @__PURE__ */ (0,
|
|
14827
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
14786
14828
|
ControlFeedback_default,
|
|
14787
14829
|
{
|
|
14788
14830
|
id: `${id}-feedback`,
|
|
@@ -14824,17 +14866,17 @@ var getUpdatedItemSummaries = (action, {
|
|
|
14824
14866
|
var RepeatableSchema_default = RepeatableSchema;
|
|
14825
14867
|
|
|
14826
14868
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
|
|
14827
|
-
var
|
|
14869
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
14828
14870
|
function ArrayListSchema(props) {
|
|
14829
14871
|
const { schema } = props;
|
|
14830
14872
|
if (isMultipleFileUploadSchema(schema)) {
|
|
14831
|
-
return /* @__PURE__ */ (0,
|
|
14873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14832
14874
|
}
|
|
14833
14875
|
if (isMultiSelectConstSchema(schema)) {
|
|
14834
|
-
return /* @__PURE__ */ (0,
|
|
14876
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(MultiSelectSchema, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14835
14877
|
}
|
|
14836
14878
|
if (isListArraySchema(schema)) {
|
|
14837
|
-
return /* @__PURE__ */ (0,
|
|
14879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(RepeatableSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
|
|
14838
14880
|
}
|
|
14839
14881
|
throw new Error("Invalid array list schema");
|
|
14840
14882
|
}
|
|
@@ -14845,11 +14887,11 @@ ArrayListSchema.defaultProps = {
|
|
|
14845
14887
|
var ArrayListSchema_default = ArrayListSchema;
|
|
14846
14888
|
|
|
14847
14889
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
|
|
14848
|
-
var
|
|
14890
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
14849
14891
|
var ArraySchema = (props) => {
|
|
14850
14892
|
const { schema } = props;
|
|
14851
14893
|
if (isListArraySchema(schema)) {
|
|
14852
|
-
return /* @__PURE__ */ (0,
|
|
14894
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ArrayListSchema_default, __spreadValues({}, props));
|
|
14853
14895
|
}
|
|
14854
14896
|
throw new Error("Not implemented");
|
|
14855
14897
|
};
|
|
@@ -14859,17 +14901,17 @@ ArraySchema.defaultProps = {
|
|
|
14859
14901
|
var ArraySchema_default = ArraySchema;
|
|
14860
14902
|
|
|
14861
14903
|
// src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
14862
|
-
var
|
|
14904
|
+
var import_components50 = require("@transferwise/components");
|
|
14863
14905
|
var import_classnames11 = __toESM(require_classnames());
|
|
14864
|
-
var
|
|
14865
|
-
var
|
|
14906
|
+
var import_react36 = require("react");
|
|
14907
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
14866
14908
|
var getSchemaColumnClasses2 = (width) => ({
|
|
14867
14909
|
"col-xs-12": true,
|
|
14868
14910
|
"col-sm-6": width === "md",
|
|
14869
14911
|
"col-sm-4": width === "sm"
|
|
14870
14912
|
});
|
|
14871
14913
|
function ObjectSchema(props) {
|
|
14872
|
-
const [model, setModel] = (0,
|
|
14914
|
+
const [model, setModel] = (0, import_react36.useState)(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
|
|
14873
14915
|
const onChangeProperty = (propertyName, onChangeProps) => {
|
|
14874
14916
|
if (onChangeProps.model !== null) {
|
|
14875
14917
|
model[propertyName] = onChangeProps.model;
|
|
@@ -14880,7 +14922,7 @@ function ObjectSchema(props) {
|
|
|
14880
14922
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model }));
|
|
14881
14923
|
};
|
|
14882
14924
|
const isRequired = (propertyName) => props.schema.required && props.schema.required.includes(propertyName);
|
|
14883
|
-
(0,
|
|
14925
|
+
(0, import_react36.useEffect)(() => {
|
|
14884
14926
|
const newModel = getValidObjectModelParts(model, props.schema) || {};
|
|
14885
14927
|
setModel(newModel);
|
|
14886
14928
|
if (!isEqual(newModel, model)) {
|
|
@@ -14898,22 +14940,22 @@ function ObjectSchema(props) {
|
|
|
14898
14940
|
const isPropertyDefined = (propertyName) => typeof props.schema.properties[propertyName] !== "undefined";
|
|
14899
14941
|
const orderedPropertyNames = Array.from(allorderedPropertiesSet).filter(isPropertyDefined);
|
|
14900
14942
|
const propsErrors = props.errors;
|
|
14901
|
-
return /* @__PURE__ */ (0,
|
|
14902
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
14903
|
-
/* @__PURE__ */ (0,
|
|
14904
|
-
props.schema.title && !props.hideTitle && /* @__PURE__ */ (0,
|
|
14905
|
-
props.schema.description && !props.hideTitle && /* @__PURE__ */ (0,
|
|
14943
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(import_jsx_runtime85.Fragment, { children: [
|
|
14944
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
14945
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("fieldset", { children: [
|
|
14946
|
+
props.schema.title && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_components50.Header, { title: props.schema.title, as: "legend" }),
|
|
14947
|
+
props.schema.description && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("p", { children: [
|
|
14906
14948
|
" ",
|
|
14907
14949
|
props.schema.description,
|
|
14908
14950
|
" "
|
|
14909
14951
|
] }),
|
|
14910
|
-
/* @__PURE__ */ (0,
|
|
14952
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "row", children: orderedPropertyNames.map((propertyName) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
14911
14953
|
"div",
|
|
14912
14954
|
{
|
|
14913
14955
|
className: (0, import_classnames11.default)(
|
|
14914
14956
|
getSchemaColumnClasses2(props.schema.properties[propertyName].width)
|
|
14915
14957
|
),
|
|
14916
|
-
children: /* @__PURE__ */ (0,
|
|
14958
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
14917
14959
|
GenericSchema_default,
|
|
14918
14960
|
{
|
|
14919
14961
|
schema: props.schema.properties[propertyName],
|
|
@@ -14939,21 +14981,21 @@ ObjectSchema.defaultProps = {
|
|
|
14939
14981
|
var ObjectSchema_default = ObjectSchema;
|
|
14940
14982
|
|
|
14941
14983
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
14942
|
-
var
|
|
14984
|
+
var import_components53 = require("@transferwise/components");
|
|
14943
14985
|
var import_classnames12 = __toESM(require_classnames());
|
|
14944
|
-
var
|
|
14986
|
+
var import_react39 = require("react");
|
|
14945
14987
|
|
|
14946
14988
|
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
14947
|
-
var
|
|
14989
|
+
var import_components51 = require("@transferwise/components");
|
|
14948
14990
|
var import_react_intl25 = require("react-intl");
|
|
14949
|
-
var
|
|
14991
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
14950
14992
|
function Help2(props) {
|
|
14951
14993
|
const intl = (0, import_react_intl25.useIntl)();
|
|
14952
|
-
return /* @__PURE__ */ (0,
|
|
14953
|
-
|
|
14994
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
14995
|
+
import_components51.Info,
|
|
14954
14996
|
{
|
|
14955
14997
|
className: "m-l-1",
|
|
14956
|
-
content: /* @__PURE__ */ (0,
|
|
14998
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(import_components51.Markdown, { config: { link: { target: "_blank" } }, children: props.help.markdown }),
|
|
14957
14999
|
presentation: "POPOVER",
|
|
14958
15000
|
size: "sm",
|
|
14959
15001
|
"aria-label": intl.formatMessage(help_messages_default.helpAria)
|
|
@@ -14963,11 +15005,11 @@ function Help2(props) {
|
|
|
14963
15005
|
var Help_default2 = Help2;
|
|
14964
15006
|
|
|
14965
15007
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
14966
|
-
var
|
|
15008
|
+
var import_react38 = require("react");
|
|
14967
15009
|
|
|
14968
15010
|
// src/legacy/formControl/FormControl.tsx
|
|
14969
|
-
var
|
|
14970
|
-
var
|
|
15011
|
+
var import_components52 = require("@transferwise/components");
|
|
15012
|
+
var import_react37 = require("react");
|
|
14971
15013
|
|
|
14972
15014
|
// src/legacy/formControl/utils/value-utils.ts
|
|
14973
15015
|
var getSafeStringValue = (value, options = {}) => {
|
|
@@ -15153,8 +15195,8 @@ var autocompleteTokenMap2 = {
|
|
|
15153
15195
|
};
|
|
15154
15196
|
|
|
15155
15197
|
// src/legacy/formControl/FormControl.tsx
|
|
15156
|
-
var
|
|
15157
|
-
var _FormControl = class _FormControl extends
|
|
15198
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
15199
|
+
var _FormControl = class _FormControl extends import_react37.PureComponent {
|
|
15158
15200
|
constructor(props) {
|
|
15159
15201
|
super(props);
|
|
15160
15202
|
this.getAutocompleteValue = ({ prefix = "", suffix = "" } = {}) => {
|
|
@@ -15241,8 +15283,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15241
15283
|
} = this.props;
|
|
15242
15284
|
switch (type) {
|
|
15243
15285
|
case FormControlType.RADIO:
|
|
15244
|
-
return /* @__PURE__ */ (0,
|
|
15245
|
-
|
|
15286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15287
|
+
import_components52.RadioGroup,
|
|
15246
15288
|
{
|
|
15247
15289
|
radios: options.map(this.mapOption),
|
|
15248
15290
|
name,
|
|
@@ -15251,8 +15293,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15251
15293
|
}
|
|
15252
15294
|
);
|
|
15253
15295
|
case FormControlType.CHECKBOX:
|
|
15254
|
-
return /* @__PURE__ */ (0,
|
|
15255
|
-
|
|
15296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15297
|
+
import_components52.Checkbox,
|
|
15256
15298
|
{
|
|
15257
15299
|
checked: getSafeBooleanValue(value, { coerceValue: true }),
|
|
15258
15300
|
disabled,
|
|
@@ -15269,8 +15311,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15269
15311
|
const search = options.length >= 8;
|
|
15270
15312
|
const items = options;
|
|
15271
15313
|
const selected = this.getSelectedOption(options);
|
|
15272
|
-
return /* @__PURE__ */ (0,
|
|
15273
|
-
|
|
15314
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "d-flex flex-column", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15315
|
+
import_components52.SelectInput,
|
|
15274
15316
|
{
|
|
15275
15317
|
id,
|
|
15276
15318
|
items: items.map((value2) => ({
|
|
@@ -15279,8 +15321,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15279
15321
|
disabled: value2.disabled
|
|
15280
15322
|
})),
|
|
15281
15323
|
value: selected != null ? selected : null,
|
|
15282
|
-
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */ (0,
|
|
15283
|
-
|
|
15324
|
+
renderValue: ({ hideIconInTrigger, icon, label: label2, note, secondary }, withinTrigger) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15325
|
+
import_components52.SelectInputOptionContent,
|
|
15284
15326
|
{
|
|
15285
15327
|
title: label2,
|
|
15286
15328
|
note: withinTrigger ? note != null ? note : secondary : note,
|
|
@@ -15308,13 +15350,13 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15308
15350
|
) });
|
|
15309
15351
|
}
|
|
15310
15352
|
case FormControlType.TAB:
|
|
15311
|
-
return /* @__PURE__ */ (0,
|
|
15312
|
-
|
|
15353
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15354
|
+
import_components52.Tabs,
|
|
15313
15355
|
{
|
|
15314
15356
|
selected: ((_a = this.getSelectedOption(options)) == null ? void 0 : _a.value) || 0,
|
|
15315
15357
|
tabs: options.map((option) => ({
|
|
15316
15358
|
title: option.label,
|
|
15317
|
-
content: /* @__PURE__ */ (0,
|
|
15359
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_jsx_runtime87.Fragment, {}),
|
|
15318
15360
|
disabled: option.disabled || false
|
|
15319
15361
|
})),
|
|
15320
15362
|
name: id,
|
|
@@ -15329,7 +15371,7 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15329
15371
|
);
|
|
15330
15372
|
case FormControlType.NUMERIC:
|
|
15331
15373
|
case FormControlType.NUMBER: {
|
|
15332
|
-
return /* @__PURE__ */ (0,
|
|
15374
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15333
15375
|
"input",
|
|
15334
15376
|
{
|
|
15335
15377
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -15363,7 +15405,7 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15363
15405
|
);
|
|
15364
15406
|
}
|
|
15365
15407
|
case FormControlType.HIDDEN:
|
|
15366
|
-
return /* @__PURE__ */ (0,
|
|
15408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15367
15409
|
"input",
|
|
15368
15410
|
{
|
|
15369
15411
|
type: "hidden",
|
|
@@ -15373,7 +15415,7 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15373
15415
|
}
|
|
15374
15416
|
);
|
|
15375
15417
|
case FormControlType.PASSWORD:
|
|
15376
|
-
return /* @__PURE__ */ (0,
|
|
15418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15377
15419
|
"input",
|
|
15378
15420
|
{
|
|
15379
15421
|
autoComplete: this.getAutocompleteValue(),
|
|
@@ -15393,8 +15435,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15393
15435
|
);
|
|
15394
15436
|
case FormControlType.DATE:
|
|
15395
15437
|
case FormControlType.DATETIME:
|
|
15396
|
-
return /* @__PURE__ */ (0,
|
|
15397
|
-
|
|
15438
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15439
|
+
import_components52.DateInput,
|
|
15398
15440
|
{
|
|
15399
15441
|
dayAutoComplete: this.getAutocompleteValue({ suffix: "-day" }),
|
|
15400
15442
|
yearAutoComplete: this.getAutocompleteValue({ suffix: "-year" }),
|
|
@@ -15409,8 +15451,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15409
15451
|
}
|
|
15410
15452
|
);
|
|
15411
15453
|
case FormControlType.DATELOOKUP: {
|
|
15412
|
-
return /* @__PURE__ */ (0,
|
|
15413
|
-
|
|
15454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15455
|
+
import_components52.DateLookup,
|
|
15414
15456
|
{
|
|
15415
15457
|
value: getSafeDateStringValue(value),
|
|
15416
15458
|
min: minDate,
|
|
@@ -15427,8 +15469,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15427
15469
|
);
|
|
15428
15470
|
}
|
|
15429
15471
|
case FormControlType.TEL:
|
|
15430
|
-
return /* @__PURE__ */ (0,
|
|
15431
|
-
|
|
15472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15473
|
+
import_components52.PhoneNumberInput,
|
|
15432
15474
|
{
|
|
15433
15475
|
disabled,
|
|
15434
15476
|
countryCode,
|
|
@@ -15459,8 +15501,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15459
15501
|
autoComplete: this.getAutocompleteValue()
|
|
15460
15502
|
};
|
|
15461
15503
|
if (this.props.displayPattern) {
|
|
15462
|
-
return /* @__PURE__ */ (0,
|
|
15463
|
-
|
|
15504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15505
|
+
import_components52.TextareaWithDisplayFormat,
|
|
15464
15506
|
__spreadProps(__spreadValues({
|
|
15465
15507
|
displayPattern: this.props.displayPattern
|
|
15466
15508
|
}, textareaProps), {
|
|
@@ -15468,7 +15510,7 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15468
15510
|
})
|
|
15469
15511
|
);
|
|
15470
15512
|
}
|
|
15471
|
-
return /* @__PURE__ */ (0,
|
|
15513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15472
15514
|
"textarea",
|
|
15473
15515
|
__spreadProps(__spreadValues({}, textareaProps), {
|
|
15474
15516
|
"aria-describedby": describedBy,
|
|
@@ -15481,8 +15523,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15481
15523
|
return (
|
|
15482
15524
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
15483
15525
|
// @ts-expect-error - TODO: Remove this once Upload is migrated to TypeScript
|
|
15484
|
-
/* @__PURE__ */ (0,
|
|
15485
|
-
|
|
15526
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15527
|
+
import_components52.Upload,
|
|
15486
15528
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
15487
15529
|
usAccept: uploadProps.usAccept || "*",
|
|
15488
15530
|
usDisabled: uploadProps.usDisabled || disabled,
|
|
@@ -15519,8 +15561,8 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15519
15561
|
autoComplete: this.getAutocompleteValue()
|
|
15520
15562
|
};
|
|
15521
15563
|
if (this.props.displayPattern) {
|
|
15522
|
-
return /* @__PURE__ */ (0,
|
|
15523
|
-
|
|
15564
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15565
|
+
import_components52.InputWithDisplayFormat,
|
|
15524
15566
|
__spreadProps(__spreadValues({
|
|
15525
15567
|
displayPattern: this.props.displayPattern
|
|
15526
15568
|
}, inputProps), {
|
|
@@ -15528,7 +15570,7 @@ var _FormControl = class _FormControl extends import_react36.PureComponent {
|
|
|
15528
15570
|
})
|
|
15529
15571
|
);
|
|
15530
15572
|
}
|
|
15531
|
-
return /* @__PURE__ */ (0,
|
|
15573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
15532
15574
|
"input",
|
|
15533
15575
|
__spreadProps(__spreadValues({}, inputProps), {
|
|
15534
15576
|
"aria-describedby": describedBy,
|
|
@@ -15577,14 +15619,17 @@ _FormControl.defaultProps = {
|
|
|
15577
15619
|
var FormControl = _FormControl;
|
|
15578
15620
|
|
|
15579
15621
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
15580
|
-
var
|
|
15622
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
15581
15623
|
var isNativeInput = (propsSchemaType) => propsSchemaType === "string" || propsSchemaType === "number";
|
|
15582
15624
|
var getControlType = (schema) => {
|
|
15583
15625
|
if (isOneOfSchema2(schema)) {
|
|
15584
15626
|
if (schema.control === FormControlType.TAB && schema.oneOf.length > 3) {
|
|
15585
15627
|
return FormControlType.SELECT;
|
|
15586
15628
|
}
|
|
15587
|
-
|
|
15629
|
+
if (schema.control == null || !Object.values(FormControlType).includes(schema.control)) {
|
|
15630
|
+
return FormControlType.SELECT;
|
|
15631
|
+
}
|
|
15632
|
+
return schema.control;
|
|
15588
15633
|
}
|
|
15589
15634
|
if (isStringSchema2(schema)) {
|
|
15590
15635
|
return getStringSchemaControlType(schema);
|
|
@@ -15642,7 +15687,7 @@ function SchemaFormControl(props) {
|
|
|
15642
15687
|
onChange(getValidBasicModelOrNull(value2, schema), type, metadata);
|
|
15643
15688
|
};
|
|
15644
15689
|
const controlType = getControlType(schema);
|
|
15645
|
-
(0,
|
|
15690
|
+
(0, import_react38.useEffect)(() => {
|
|
15646
15691
|
warnIfInvalidSchema(schema, log, controlType);
|
|
15647
15692
|
}, [JSON.stringify(schema), log, controlType]);
|
|
15648
15693
|
const options = schema.values || getOptions(schema, controlType);
|
|
@@ -15668,7 +15713,7 @@ function SchemaFormControl(props) {
|
|
|
15668
15713
|
uploadProps: mapSchemaToUploadOptions(schema),
|
|
15669
15714
|
describedBy
|
|
15670
15715
|
};
|
|
15671
|
-
return /* @__PURE__ */ (0,
|
|
15716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("div", { "aria-describedby": describedBy, children: /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps)) });
|
|
15672
15717
|
}
|
|
15673
15718
|
SchemaFormControl.defaultProps = {
|
|
15674
15719
|
value: null,
|
|
@@ -15697,17 +15742,17 @@ var warnIfInvalidSchema = (schema, log, controlType) => {
|
|
|
15697
15742
|
var SchemaFormControl_default = SchemaFormControl;
|
|
15698
15743
|
|
|
15699
15744
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
15700
|
-
var
|
|
15745
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
15701
15746
|
function OneOfSchema(props) {
|
|
15702
15747
|
const onEvent = useEventDispatcher();
|
|
15703
|
-
const [changed, setChanged] = (0,
|
|
15704
|
-
const [focused, setFocused] = (0,
|
|
15705
|
-
const [blurred, setBlurred] = (0,
|
|
15706
|
-
const id = (0,
|
|
15707
|
-
const [schemaIndex, setSchemaIndex] = (0,
|
|
15748
|
+
const [changed, setChanged] = (0, import_react39.useState)(false);
|
|
15749
|
+
const [focused, setFocused] = (0, import_react39.useState)(false);
|
|
15750
|
+
const [blurred, setBlurred] = (0, import_react39.useState)(false);
|
|
15751
|
+
const id = (0, import_react39.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
15752
|
+
const [schemaIndex, setSchemaIndex] = (0, import_react39.useState)(
|
|
15708
15753
|
getActiveSchemaIndex(props.schema, props.model)
|
|
15709
15754
|
);
|
|
15710
|
-
const [models, setModels] = (0,
|
|
15755
|
+
const [models, setModels] = (0, import_react39.useState)(getModelPartsForSchemas(props.model, props.schema.oneOf));
|
|
15711
15756
|
const debouncedTrackEvent = useDebouncedFunction(onEvent, 200);
|
|
15712
15757
|
const onSearchChange = (searchValue) => {
|
|
15713
15758
|
debouncedTrackEvent("Dynamic Flow - OneOf Searched", {
|
|
@@ -15715,7 +15760,7 @@ function OneOfSchema(props) {
|
|
|
15715
15760
|
searchValueLength: searchValue.length
|
|
15716
15761
|
});
|
|
15717
15762
|
};
|
|
15718
|
-
(0,
|
|
15763
|
+
(0, import_react39.useEffect)(() => {
|
|
15719
15764
|
const modelIndex = getValidIndexFromValue(props.schema, props.model);
|
|
15720
15765
|
const defaultIndex = getValidIndexFromValue(props.schema, props.schema.default);
|
|
15721
15766
|
if (modelIndex === -1 && defaultIndex >= 0) {
|
|
@@ -15773,12 +15818,12 @@ function OneOfSchema(props) {
|
|
|
15773
15818
|
"has-error": !changed && props.errors && !isEmpty(props.errors) || (props.submitted || changed && blurred) && validations.length
|
|
15774
15819
|
};
|
|
15775
15820
|
const feedbackId = `${id}-feedback`;
|
|
15776
|
-
return /* @__PURE__ */ (0,
|
|
15777
|
-
(props.schema.oneOf.length > 1 || isConstSchema2(props.schema.oneOf[0])) && /* @__PURE__ */ (0,
|
|
15778
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
15779
|
-
/* @__PURE__ */ (0,
|
|
15821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
15822
|
+
(props.schema.oneOf.length > 1 || isConstSchema2(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(import_jsx_runtime89.Fragment, { children: [
|
|
15823
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
15824
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: (0, import_classnames12.default)(formGroupClasses), children: [
|
|
15780
15825
|
getTitleAndHelp(props.schema, id),
|
|
15781
|
-
/* @__PURE__ */ (0,
|
|
15826
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
15782
15827
|
SchemaFormControl_default,
|
|
15783
15828
|
{
|
|
15784
15829
|
id,
|
|
@@ -15792,7 +15837,7 @@ function OneOfSchema(props) {
|
|
|
15792
15837
|
onSearchChange
|
|
15793
15838
|
}
|
|
15794
15839
|
),
|
|
15795
|
-
/* @__PURE__ */ (0,
|
|
15840
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
15796
15841
|
ControlFeedback_default,
|
|
15797
15842
|
{
|
|
15798
15843
|
id: feedbackId,
|
|
@@ -15808,7 +15853,7 @@ function OneOfSchema(props) {
|
|
|
15808
15853
|
)
|
|
15809
15854
|
] })
|
|
15810
15855
|
] }),
|
|
15811
|
-
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0,
|
|
15856
|
+
isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
|
|
15812
15857
|
GenericSchema_default,
|
|
15813
15858
|
{
|
|
15814
15859
|
schema: props.schema.oneOf[schemaIndex],
|
|
@@ -15825,16 +15870,16 @@ function OneOfSchema(props) {
|
|
|
15825
15870
|
}
|
|
15826
15871
|
function getTitleAndHelp(schema, forId) {
|
|
15827
15872
|
var _a;
|
|
15828
|
-
const helpElement = schema.help ? /* @__PURE__ */ (0,
|
|
15829
|
-
const titleElement = isConstSchema2(schema.oneOf[0]) ? /* @__PURE__ */ (0,
|
|
15873
|
+
const helpElement = schema.help ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(Help_default2, { help: schema.help }) : null;
|
|
15874
|
+
const titleElement = isConstSchema2(schema.oneOf[0]) ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "m-b-1", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("label", { className: "control-label d-inline", htmlFor: forId, children: [
|
|
15830
15875
|
schema.title,
|
|
15831
15876
|
" ",
|
|
15832
15877
|
helpElement
|
|
15833
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
15878
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_jsx_runtime89.Fragment, { children: helpElement ? /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("h4", { className: "m-b-2", children: [
|
|
15834
15879
|
schema.title,
|
|
15835
15880
|
" ",
|
|
15836
15881
|
helpElement
|
|
15837
|
-
] }) : /* @__PURE__ */ (0,
|
|
15882
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_components53.Header, { title: (_a = schema.title) != null ? _a : "" }) });
|
|
15838
15883
|
return schema.title ? titleElement : helpElement;
|
|
15839
15884
|
}
|
|
15840
15885
|
function getValidations(props, schemaIndex) {
|
|
@@ -15871,12 +15916,12 @@ var OneOfSchema_default = OneOfSchema;
|
|
|
15871
15916
|
|
|
15872
15917
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
15873
15918
|
var import_classnames13 = __toESM(require_classnames());
|
|
15874
|
-
var
|
|
15919
|
+
var import_react41 = require("react");
|
|
15875
15920
|
|
|
15876
15921
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
15877
|
-
var
|
|
15878
|
-
var
|
|
15879
|
-
var
|
|
15922
|
+
var import_components54 = require("@transferwise/components");
|
|
15923
|
+
var import_react40 = require("react");
|
|
15924
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
15880
15925
|
function UploadInputAdapter(props) {
|
|
15881
15926
|
const {
|
|
15882
15927
|
id,
|
|
@@ -15892,7 +15937,7 @@ function UploadInputAdapter(props) {
|
|
|
15892
15937
|
onCancel
|
|
15893
15938
|
} = props;
|
|
15894
15939
|
const onEvent = useEventDispatcher();
|
|
15895
|
-
const files = (0,
|
|
15940
|
+
const files = (0, import_react40.useMemo)(() => fileId ? [{ id: fileId, status: import_components54.Status.SUCCEEDED }] : [], [fileId]);
|
|
15896
15941
|
const uploadFile = (formData) => {
|
|
15897
15942
|
onEvent("Dynamic Flow - PersistAsync", { status: "pending", schemaId: id });
|
|
15898
15943
|
return httpClient(String(httpOptions.url), {
|
|
@@ -15909,8 +15954,8 @@ function UploadInputAdapter(props) {
|
|
|
15909
15954
|
return Promise.reject();
|
|
15910
15955
|
});
|
|
15911
15956
|
};
|
|
15912
|
-
return /* @__PURE__ */ (0,
|
|
15913
|
-
|
|
15957
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
|
|
15958
|
+
import_components54.UploadInput,
|
|
15914
15959
|
{
|
|
15915
15960
|
id,
|
|
15916
15961
|
fileInputName: httpOptions.fileInputName,
|
|
@@ -15929,16 +15974,16 @@ function UploadInputAdapter(props) {
|
|
|
15929
15974
|
}
|
|
15930
15975
|
|
|
15931
15976
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
15932
|
-
var
|
|
15977
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
15933
15978
|
function PersistAsyncBlobSchema(props) {
|
|
15934
15979
|
const { model, schema, submitted, required, errors, onChange } = props;
|
|
15935
|
-
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0,
|
|
15936
|
-
const [persistAsyncValidations, setPersistAsyncValidations] = (0,
|
|
15937
|
-
const [validations, setValidations] = (0,
|
|
15938
|
-
const [changed, setChanged] = (0,
|
|
15980
|
+
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react41.useState)({});
|
|
15981
|
+
const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react41.useState)(null);
|
|
15982
|
+
const [validations, setValidations] = (0, import_react41.useState)([]);
|
|
15983
|
+
const [changed, setChanged] = (0, import_react41.useState)(false);
|
|
15939
15984
|
const httpClient = useHttpClient();
|
|
15940
15985
|
const onEvent = useEventDispatcher();
|
|
15941
|
-
(0,
|
|
15986
|
+
(0, import_react41.useEffect)(() => {
|
|
15942
15987
|
if (submitted) {
|
|
15943
15988
|
setValidations(getValidationFailures(model, schema, Boolean(required)));
|
|
15944
15989
|
} else {
|
|
@@ -15975,8 +16020,8 @@ function PersistAsyncBlobSchema(props) {
|
|
|
15975
16020
|
};
|
|
15976
16021
|
const id = schema.$id || schema.persistAsync.schema.$id || schema.persistAsync.idProperty;
|
|
15977
16022
|
const feedbackId = `${id}-feedback`;
|
|
15978
|
-
return /* @__PURE__ */ (0,
|
|
15979
|
-
/* @__PURE__ */ (0,
|
|
16023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)("div", { className: (0, import_classnames13.default)(formGroupClasses), children: [
|
|
16024
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
15980
16025
|
UploadInputAdapter,
|
|
15981
16026
|
__spreadValues({
|
|
15982
16027
|
id,
|
|
@@ -15993,7 +16038,7 @@ function PersistAsyncBlobSchema(props) {
|
|
|
15993
16038
|
onCancel
|
|
15994
16039
|
}, mapSchemaToUploadOptions(schema.persistAsync.schema))
|
|
15995
16040
|
) }),
|
|
15996
|
-
/* @__PURE__ */ (0,
|
|
16041
|
+
/* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
15997
16042
|
ControlFeedback_default,
|
|
15998
16043
|
{
|
|
15999
16044
|
id: feedbackId,
|
|
@@ -16018,17 +16063,17 @@ PersistAsyncBlobSchema.defaultProps = {
|
|
|
16018
16063
|
var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
|
|
16019
16064
|
|
|
16020
16065
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
|
|
16021
|
-
var
|
|
16066
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
16022
16067
|
function PersistAsyncSchema(props) {
|
|
16023
16068
|
const { schema } = props;
|
|
16024
16069
|
const persistAsyncSchemaType = schema.persistAsync.schema.type;
|
|
16025
16070
|
if (persistAsyncSchemaType === "blob") {
|
|
16026
|
-
return /* @__PURE__ */ (0,
|
|
16071
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
16027
16072
|
PersistAsyncBlobSchema_default,
|
|
16028
16073
|
__spreadValues({}, props)
|
|
16029
16074
|
);
|
|
16030
16075
|
}
|
|
16031
|
-
return /* @__PURE__ */ (0,
|
|
16076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
|
|
16032
16077
|
}
|
|
16033
16078
|
PersistAsyncSchema.defaultProps = {
|
|
16034
16079
|
required: false
|
|
@@ -16036,7 +16081,7 @@ PersistAsyncSchema.defaultProps = {
|
|
|
16036
16081
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
16037
16082
|
|
|
16038
16083
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
16039
|
-
var
|
|
16084
|
+
var import_react42 = require("react");
|
|
16040
16085
|
|
|
16041
16086
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
16042
16087
|
var getSelectionFromModel = (schema, model) => {
|
|
@@ -16048,8 +16093,8 @@ var getSelectionFromModel = (schema, model) => {
|
|
|
16048
16093
|
};
|
|
16049
16094
|
|
|
16050
16095
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
|
|
16051
|
-
var
|
|
16052
|
-
var
|
|
16096
|
+
var import_components55 = require("@transferwise/components");
|
|
16097
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
16053
16098
|
var PromotedOneOfCheckboxControl = (props) => {
|
|
16054
16099
|
const { id, selection, setSelection } = props;
|
|
16055
16100
|
const { promoted, other, checkedMeans } = props.promotion;
|
|
@@ -16060,14 +16105,14 @@ var PromotedOneOfCheckboxControl = (props) => {
|
|
|
16060
16105
|
const toggleSelection = () => {
|
|
16061
16106
|
setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
|
|
16062
16107
|
};
|
|
16063
|
-
return /* @__PURE__ */ (0,
|
|
16108
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(import_components55.Checkbox, { id, label: title, checked, onChange: toggleSelection }) });
|
|
16064
16109
|
};
|
|
16065
16110
|
PromotedOneOfCheckboxControl.defaultProps = {};
|
|
16066
16111
|
var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
|
|
16067
16112
|
|
|
16068
16113
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
|
|
16069
|
-
var
|
|
16070
|
-
var
|
|
16114
|
+
var import_components56 = require("@transferwise/components");
|
|
16115
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
16071
16116
|
function PromotedOneOfRadioControl(props) {
|
|
16072
16117
|
var _a, _b;
|
|
16073
16118
|
const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
|
|
@@ -16084,10 +16129,10 @@ function PromotedOneOfRadioControl(props) {
|
|
|
16084
16129
|
secondary: promotion.other.description
|
|
16085
16130
|
}, getAvatarPropertyForRadioOption(promotion.other))
|
|
16086
16131
|
];
|
|
16087
|
-
return /* @__PURE__ */ (0,
|
|
16088
|
-
title && /* @__PURE__ */ (0,
|
|
16089
|
-
/* @__PURE__ */ (0,
|
|
16090
|
-
|
|
16132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)("div", { className: "form-group", children: [
|
|
16133
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime94.jsx)("label", { className: "control-label", htmlFor: id, children: title }),
|
|
16134
|
+
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
16135
|
+
import_components56.RadioGroup,
|
|
16091
16136
|
{
|
|
16092
16137
|
name: "promoted-selection",
|
|
16093
16138
|
selectedValue: selection,
|
|
@@ -16104,16 +16149,16 @@ PromotedOneOfRadioControl.defaultProps = {
|
|
|
16104
16149
|
var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
|
|
16105
16150
|
|
|
16106
16151
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
|
|
16107
|
-
var
|
|
16152
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
16108
16153
|
function PromotedOneOfControl(props) {
|
|
16109
16154
|
const controlType = props.promotion.control || "radio";
|
|
16110
16155
|
switch (controlType) {
|
|
16111
16156
|
case "radio":
|
|
16112
|
-
return /* @__PURE__ */ (0,
|
|
16157
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(PromotedOneOfRadioControl_default, __spreadValues({}, props));
|
|
16113
16158
|
case "checkbox":
|
|
16114
|
-
return /* @__PURE__ */ (0,
|
|
16159
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
|
|
16115
16160
|
default:
|
|
16116
|
-
return /* @__PURE__ */ (0,
|
|
16161
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_jsx_runtime95.Fragment, {});
|
|
16117
16162
|
}
|
|
16118
16163
|
}
|
|
16119
16164
|
PromotedOneOfControl.defaultProps = {
|
|
@@ -16123,20 +16168,20 @@ PromotedOneOfControl.defaultProps = {
|
|
|
16123
16168
|
var PromotedOneOfControl_default = PromotedOneOfControl;
|
|
16124
16169
|
|
|
16125
16170
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
16126
|
-
var
|
|
16171
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
16127
16172
|
var isPromoted = (schema) => schema.promoted === true;
|
|
16128
16173
|
var PromotedOneOfSchema = (props) => {
|
|
16129
16174
|
var _a;
|
|
16130
|
-
const [selection, setSelection] = (0,
|
|
16175
|
+
const [selection, setSelection] = (0, import_react42.useState)(
|
|
16131
16176
|
getSelectionFromModel(props.schema, props.model) || ((_a = props.schema.promotion) == null ? void 0 : _a.default) || "promoted"
|
|
16132
16177
|
);
|
|
16133
16178
|
const promotedAlert = props.schema.alert;
|
|
16134
16179
|
const promotedOneOf = props.schema.oneOf.find(isPromoted);
|
|
16135
16180
|
const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
|
|
16136
16181
|
const otherOneOf = getOtherOneOf(props.schema);
|
|
16137
|
-
return /* @__PURE__ */ (0,
|
|
16138
|
-
promotedAlert && /* @__PURE__ */ (0,
|
|
16139
|
-
/* @__PURE__ */ (0,
|
|
16182
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
16183
|
+
promotedAlert && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(DynamicAlert_default, { component: promotedAlert }),
|
|
16184
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
16140
16185
|
PromotedOneOfControl_default,
|
|
16141
16186
|
{
|
|
16142
16187
|
id: props.schema.$id,
|
|
@@ -16147,8 +16192,8 @@ var PromotedOneOfSchema = (props) => {
|
|
|
16147
16192
|
setSelection
|
|
16148
16193
|
}
|
|
16149
16194
|
),
|
|
16150
|
-
selection === "promoted" && /* @__PURE__ */ (0,
|
|
16151
|
-
selection === "other" && /* @__PURE__ */ (0,
|
|
16195
|
+
selection === "promoted" && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(ObjectSchema_default, __spreadProps(__spreadValues({}, props), { schema: promotedObjectSchema })),
|
|
16196
|
+
selection === "other" && /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(GenericSchema_default, __spreadProps(__spreadValues({}, props), { schema: otherOneOf }))
|
|
16152
16197
|
] });
|
|
16153
16198
|
};
|
|
16154
16199
|
function getPromotedObjectSchema(promotedSchema) {
|
|
@@ -16178,7 +16223,7 @@ function getOtherOneOf(schema) {
|
|
|
16178
16223
|
var PromotedOneOfSchema_default = PromotedOneOfSchema;
|
|
16179
16224
|
|
|
16180
16225
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
16181
|
-
var
|
|
16226
|
+
var import_components57 = require("@transferwise/components");
|
|
16182
16227
|
var import_react_intl27 = require("react-intl");
|
|
16183
16228
|
|
|
16184
16229
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.ts
|
|
@@ -16197,12 +16242,12 @@ var ReadOnlySchema_messages_default = (0, import_react_intl26.defineMessages)({
|
|
|
16197
16242
|
});
|
|
16198
16243
|
|
|
16199
16244
|
// src/legacy/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
|
|
16200
|
-
var
|
|
16245
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
16201
16246
|
function ReadOnlySchema({ schema, model }) {
|
|
16202
16247
|
const { title = "" } = schema;
|
|
16203
16248
|
const { formatMessage } = (0, import_react_intl27.useIntl)();
|
|
16204
16249
|
const value = getValueForSchema({ schema, model, formatMessage });
|
|
16205
|
-
return /* @__PURE__ */ (0,
|
|
16250
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_components57.DefinitionList, { layout: import_components57.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
|
|
16206
16251
|
}
|
|
16207
16252
|
var ReadOnlySchema_default = ReadOnlySchema;
|
|
16208
16253
|
function getValueForSchema({
|
|
@@ -16235,7 +16280,7 @@ function getSelectedOneOf(schema, model) {
|
|
|
16235
16280
|
function getValueFromOption(option) {
|
|
16236
16281
|
const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
|
|
16237
16282
|
const icon = getAvatarPropertyForRadioOption({ icon: option.icon });
|
|
16238
|
-
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0,
|
|
16283
|
+
return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(import_jsx_runtime97.Fragment, { children: [
|
|
16239
16284
|
icon.avatar,
|
|
16240
16285
|
" ",
|
|
16241
16286
|
text
|
|
@@ -16243,22 +16288,22 @@ function getValueFromOption(option) {
|
|
|
16243
16288
|
}
|
|
16244
16289
|
|
|
16245
16290
|
// src/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
16246
|
-
var
|
|
16247
|
-
var
|
|
16291
|
+
var import_react43 = require("react");
|
|
16292
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
16248
16293
|
function ValidationAsyncSchema(props) {
|
|
16249
16294
|
const { schema, model, required, submitted, errors, onChange } = props;
|
|
16250
|
-
const [validationAsyncModel, setValidationAsyncModel] = (0,
|
|
16251
|
-
const previousRequestedModelReference = (0,
|
|
16252
|
-
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0,
|
|
16295
|
+
const [validationAsyncModel, setValidationAsyncModel] = (0, import_react43.useState)(model);
|
|
16296
|
+
const previousRequestedModelReference = (0, import_react43.useRef)(null);
|
|
16297
|
+
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0, import_react43.useState)(
|
|
16253
16298
|
null
|
|
16254
16299
|
);
|
|
16255
|
-
const [validationAsyncErrors, setValidationAsyncErrors] = (0,
|
|
16256
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
16257
|
-
const [abortController, setAbortController] = (0,
|
|
16300
|
+
const [validationAsyncErrors, setValidationAsyncErrors] = (0, import_react43.useState)(null);
|
|
16301
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react43.useState)(false);
|
|
16302
|
+
const [abortController, setAbortController] = (0, import_react43.useState)(null);
|
|
16258
16303
|
const httpClient = useHttpClient();
|
|
16259
16304
|
const onEvent = useEventDispatcher();
|
|
16260
16305
|
const log = useLogger();
|
|
16261
|
-
(0,
|
|
16306
|
+
(0, import_react43.useEffect)(() => {
|
|
16262
16307
|
if (!schema.validationAsync.method) {
|
|
16263
16308
|
log.warning(
|
|
16264
16309
|
"Invalid schema or model",
|
|
@@ -16328,20 +16373,20 @@ function ValidationAsyncSchema(props) {
|
|
|
16328
16373
|
required,
|
|
16329
16374
|
schema
|
|
16330
16375
|
};
|
|
16331
|
-
return /* @__PURE__ */ (0,
|
|
16376
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
|
|
16332
16377
|
}
|
|
16333
16378
|
ValidationAsyncSchema.defaultProps = { required: false };
|
|
16334
16379
|
var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
16335
16380
|
|
|
16336
16381
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
16337
|
-
var
|
|
16338
|
-
var
|
|
16382
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
16383
|
+
var import_react45 = require("react");
|
|
16339
16384
|
function GenericSchemaForm(props) {
|
|
16340
16385
|
const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
|
|
16341
16386
|
const schemaProps = __spreadProps(__spreadValues({}, props), { model, errors, hideTitle, disabled });
|
|
16342
16387
|
const type = getSchemaType(schema);
|
|
16343
16388
|
const log = useLogger();
|
|
16344
|
-
(0,
|
|
16389
|
+
(0, import_react44.useEffect)(() => {
|
|
16345
16390
|
if (!isValidGenericSchema(schema, model, errors)) {
|
|
16346
16391
|
log.error(
|
|
16347
16392
|
"Invalid schema or model",
|
|
@@ -16351,29 +16396,29 @@ function GenericSchemaForm(props) {
|
|
|
16351
16396
|
}, [JSON.stringify(schema), JSON.stringify(model), JSON.stringify(errors), type, log]);
|
|
16352
16397
|
switch (type) {
|
|
16353
16398
|
case "readOnly":
|
|
16354
|
-
return /* @__PURE__ */ (0,
|
|
16399
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ReadOnlySchema_default, __spreadValues({}, schemaProps));
|
|
16355
16400
|
case "persistAsync":
|
|
16356
|
-
return /* @__PURE__ */ (0,
|
|
16401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(PersistAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
16357
16402
|
case "validationAsync":
|
|
16358
|
-
return /* @__PURE__ */ (0,
|
|
16403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
|
|
16359
16404
|
case "basic": {
|
|
16360
16405
|
const basicTypeProps = __spreadValues({
|
|
16361
16406
|
infoMessage: null
|
|
16362
16407
|
}, schemaProps);
|
|
16363
|
-
return /* @__PURE__ */ (0,
|
|
16408
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
|
|
16364
16409
|
}
|
|
16365
16410
|
case "object":
|
|
16366
|
-
return /* @__PURE__ */ (0,
|
|
16411
|
+
return /* @__PURE__ */ (0, import_react45.createElement)(ObjectSchema_default, __spreadProps(__spreadValues({}, schemaProps), { key: JSON.stringify(schema) }));
|
|
16367
16412
|
case "array":
|
|
16368
|
-
return /* @__PURE__ */ (0,
|
|
16413
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(ArraySchema_default, __spreadValues({}, schemaProps));
|
|
16369
16414
|
case "promotedOneOf":
|
|
16370
|
-
return /* @__PURE__ */ (0,
|
|
16415
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(PromotedOneOfSchema_default, __spreadValues({}, schemaProps));
|
|
16371
16416
|
case "oneOf":
|
|
16372
|
-
return /* @__PURE__ */ (0,
|
|
16417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(OneOfSchema_default, __spreadValues({}, schemaProps));
|
|
16373
16418
|
case "allOf":
|
|
16374
|
-
return /* @__PURE__ */ (0,
|
|
16419
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(AllOfSchema_default, __spreadValues({}, schemaProps));
|
|
16375
16420
|
}
|
|
16376
|
-
return /* @__PURE__ */ (0,
|
|
16421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(import_jsx_runtime99.Fragment, {});
|
|
16377
16422
|
}
|
|
16378
16423
|
var GenericSchema_default = GenericSchemaForm;
|
|
16379
16424
|
var isValidGenericSchema = (schema, model, errors) => {
|
|
@@ -16400,7 +16445,7 @@ var isValidGenericSchema = (schema, model, errors) => {
|
|
|
16400
16445
|
};
|
|
16401
16446
|
|
|
16402
16447
|
// src/legacy/layout/form/DynamicForm.tsx
|
|
16403
|
-
var
|
|
16448
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
16404
16449
|
function DynamicForm({
|
|
16405
16450
|
component,
|
|
16406
16451
|
model = null,
|
|
@@ -16410,7 +16455,7 @@ function DynamicForm({
|
|
|
16410
16455
|
onPersistAsync
|
|
16411
16456
|
}) {
|
|
16412
16457
|
const formSchema = component.schema;
|
|
16413
|
-
return /* @__PURE__ */ (0,
|
|
16458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: getMargin2(component.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
16414
16459
|
GenericSchema_default,
|
|
16415
16460
|
{
|
|
16416
16461
|
schema: formSchema,
|
|
@@ -16427,64 +16472,64 @@ function DynamicForm({
|
|
|
16427
16472
|
var DynamicForm_default = DynamicForm;
|
|
16428
16473
|
|
|
16429
16474
|
// src/legacy/layout/heading/DynamicHeading.tsx
|
|
16430
|
-
var
|
|
16475
|
+
var import_components58 = require("@transferwise/components");
|
|
16431
16476
|
var import_classnames14 = __toESM(require_classnames());
|
|
16432
|
-
var
|
|
16477
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
16433
16478
|
var DynamicHeading = (props) => {
|
|
16434
16479
|
const { text, size = "md", align = "left", margin = "md", control } = props.component;
|
|
16435
16480
|
const classes = (0, import_classnames14.default)(getTextAlignmentAndMargin2({ align, margin }));
|
|
16436
|
-
return control === "display" ? /* @__PURE__ */ (0,
|
|
16481
|
+
return control === "display" ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(DisplayHeading2, { size, text, classes }) : /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(StandardHeading2, { size, text, classes });
|
|
16437
16482
|
};
|
|
16438
16483
|
var StandardHeading2 = ({ size, text, classes }) => {
|
|
16439
16484
|
switch (size) {
|
|
16440
16485
|
case "xs":
|
|
16441
|
-
return /* @__PURE__ */ (0,
|
|
16486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("h5", { className: classes, children: text });
|
|
16442
16487
|
case "sm":
|
|
16443
|
-
return /* @__PURE__ */ (0,
|
|
16488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("h4", { className: classes, children: text });
|
|
16444
16489
|
case "lg":
|
|
16445
|
-
return /* @__PURE__ */ (0,
|
|
16490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("h2", { className: classes, children: text });
|
|
16446
16491
|
case "xl":
|
|
16447
|
-
return /* @__PURE__ */ (0,
|
|
16492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("h1", { className: classes, children: text });
|
|
16448
16493
|
case "md":
|
|
16449
16494
|
default:
|
|
16450
|
-
return /* @__PURE__ */ (0,
|
|
16495
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("h3", { className: classes, children: text });
|
|
16451
16496
|
}
|
|
16452
16497
|
};
|
|
16453
16498
|
var DisplayHeading2 = ({ size, text, classes }) => {
|
|
16454
16499
|
switch (size) {
|
|
16455
16500
|
case "xs":
|
|
16456
16501
|
case "sm":
|
|
16457
|
-
return /* @__PURE__ */ (0,
|
|
16502
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_components58.Display, { type: "display-small", className: classes, children: text });
|
|
16458
16503
|
case "xl":
|
|
16459
16504
|
case "lg":
|
|
16460
|
-
return /* @__PURE__ */ (0,
|
|
16505
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_components58.Display, { type: "display-large", className: classes, children: text });
|
|
16461
16506
|
case "md":
|
|
16462
16507
|
default:
|
|
16463
|
-
return /* @__PURE__ */ (0,
|
|
16508
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(import_components58.Display, { type: "display-medium", className: classes, children: text });
|
|
16464
16509
|
}
|
|
16465
16510
|
};
|
|
16466
16511
|
var DynamicHeading_default = DynamicHeading;
|
|
16467
16512
|
|
|
16468
16513
|
// src/legacy/layout/markdown/DynamicMarkdown.tsx
|
|
16469
|
-
var
|
|
16470
|
-
var
|
|
16514
|
+
var import_components59 = require("@transferwise/components");
|
|
16515
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
16471
16516
|
var DynamicMarkdown = ({ component }) => {
|
|
16472
16517
|
const { content, align, margin } = component;
|
|
16473
|
-
return /* @__PURE__ */ (0,
|
|
16518
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: getTextAlignmentAndMargin2({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components59.Markdown, { config: { link: { target: "_blank" } }, children: content }) });
|
|
16474
16519
|
};
|
|
16475
16520
|
var DynamicInfo = ({ component }) => {
|
|
16476
|
-
return /* @__PURE__ */ (0,
|
|
16521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)("div", { className: getTextAlignmentAndMargin2(component), children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(import_components59.Markdown, { config: { link: { target: "_blank" } }, children: component.markdown }) });
|
|
16477
16522
|
};
|
|
16478
16523
|
|
|
16479
16524
|
// src/legacy/layout/image/DynamicImage.tsx
|
|
16480
|
-
var
|
|
16481
|
-
var
|
|
16482
|
-
var
|
|
16525
|
+
var import_components60 = require("@transferwise/components");
|
|
16526
|
+
var import_react46 = require("react");
|
|
16527
|
+
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
16483
16528
|
function DynamicImage({ component: image }) {
|
|
16484
16529
|
const { url, size, text, margin, accessibilityDescription } = image;
|
|
16485
16530
|
const httpClient = useHttpClient();
|
|
16486
|
-
const [imageSource, setImageSource] = (0,
|
|
16487
|
-
(0,
|
|
16531
|
+
const [imageSource, setImageSource] = (0, import_react46.useState)("");
|
|
16532
|
+
(0, import_react46.useEffect)(() => {
|
|
16488
16533
|
void getImageSource2(httpClient, url).then(setImageSource);
|
|
16489
16534
|
}, [url, httpClient]);
|
|
16490
16535
|
const imageProps = {
|
|
@@ -16496,7 +16541,7 @@ function DynamicImage({ component: image }) {
|
|
|
16496
16541
|
if (!imageSource) {
|
|
16497
16542
|
return null;
|
|
16498
16543
|
}
|
|
16499
|
-
return /* @__PURE__ */ (0,
|
|
16544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime103.jsx)(import_components60.Image, __spreadValues({ className: `img-responsive ${getMargin2(margin || "md")}` }, imageProps)) });
|
|
16500
16545
|
}
|
|
16501
16546
|
var readImageBlobAsDataURL2 = (imageBlob) => (
|
|
16502
16547
|
// we can safely assume the type of reader.result is string
|
|
@@ -16532,48 +16577,48 @@ var getImageSource2 = async (httpClient, imageUrl) => {
|
|
|
16532
16577
|
var DynamicImage_default = DynamicImage;
|
|
16533
16578
|
|
|
16534
16579
|
// src/legacy/layout/instructions/DynamicInstructions.tsx
|
|
16535
|
-
var
|
|
16536
|
-
var
|
|
16580
|
+
var import_components61 = require("@transferwise/components");
|
|
16581
|
+
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
16537
16582
|
var doContext2 = ["positive", "neutral"];
|
|
16538
16583
|
var dontContext2 = ["warning", "negative"];
|
|
16539
16584
|
var DynamicInstructions = ({ component }) => {
|
|
16540
16585
|
const { items } = component;
|
|
16541
16586
|
const dos = items.filter((item) => doContext2.includes(item.context)).map(({ text }) => text);
|
|
16542
16587
|
const donts = items.filter((item) => dontContext2.includes(item.context)).map(({ text }) => text);
|
|
16543
|
-
return /* @__PURE__ */ (0,
|
|
16544
|
-
component.title ? /* @__PURE__ */ (0,
|
|
16545
|
-
/* @__PURE__ */ (0,
|
|
16588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)("div", { className: getMargin2(component.margin || "md"), children: [
|
|
16589
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_components61.Header, { title: component.title }) : null,
|
|
16590
|
+
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)(import_components61.InstructionsList, { dos, donts })
|
|
16546
16591
|
] });
|
|
16547
16592
|
};
|
|
16548
16593
|
var DynamicInstructions_default = DynamicInstructions;
|
|
16549
16594
|
|
|
16550
16595
|
// src/legacy/layout/DynamicLayout.tsx
|
|
16551
|
-
var
|
|
16596
|
+
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
16552
16597
|
var getKey = (component) => JSON.stringify(component);
|
|
16553
16598
|
function DynamicLayout(props) {
|
|
16554
16599
|
const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
|
|
16555
16600
|
const renderComponent = (component) => {
|
|
16556
16601
|
switch (component.type) {
|
|
16557
16602
|
case "heading":
|
|
16558
|
-
return /* @__PURE__ */ (0,
|
|
16603
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicHeading_default, { component }, getKey(component));
|
|
16559
16604
|
case "paragraph":
|
|
16560
|
-
return /* @__PURE__ */ (0,
|
|
16605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicParagraph_default, { component }, getKey(component));
|
|
16561
16606
|
case "image":
|
|
16562
|
-
return /* @__PURE__ */ (0,
|
|
16607
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicImage_default, { component }, getKey(component));
|
|
16563
16608
|
case "alert":
|
|
16564
|
-
return /* @__PURE__ */ (0,
|
|
16609
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicAlert_default, { component }, getKey(component));
|
|
16565
16610
|
case "review":
|
|
16566
|
-
return /* @__PURE__ */ (0,
|
|
16611
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
|
|
16567
16612
|
case "divider":
|
|
16568
|
-
return /* @__PURE__ */ (0,
|
|
16613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicDivider_default, { component }, getKey(component));
|
|
16569
16614
|
case "info":
|
|
16570
|
-
return /* @__PURE__ */ (0,
|
|
16615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicInfo, { component }, getKey(component));
|
|
16571
16616
|
case "instructions":
|
|
16572
|
-
return /* @__PURE__ */ (0,
|
|
16617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicInstructions_default, { component }, getKey(component));
|
|
16573
16618
|
case "markdown":
|
|
16574
|
-
return /* @__PURE__ */ (0,
|
|
16619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicMarkdown, { component }, getKey(component));
|
|
16575
16620
|
case "columns":
|
|
16576
|
-
return /* @__PURE__ */ (0,
|
|
16621
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
16577
16622
|
DynamicColumns_default,
|
|
16578
16623
|
{
|
|
16579
16624
|
component,
|
|
@@ -16587,7 +16632,7 @@ function DynamicLayout(props) {
|
|
|
16587
16632
|
getKey(component)
|
|
16588
16633
|
);
|
|
16589
16634
|
case "form":
|
|
16590
|
-
return /* @__PURE__ */ (0,
|
|
16635
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
16591
16636
|
DynamicForm_default,
|
|
16592
16637
|
{
|
|
16593
16638
|
component,
|
|
@@ -16600,9 +16645,9 @@ function DynamicLayout(props) {
|
|
|
16600
16645
|
getKey(__spreadProps(__spreadValues({}, component), { errors: errors != null ? errors : null }))
|
|
16601
16646
|
);
|
|
16602
16647
|
case "button":
|
|
16603
|
-
return /* @__PURE__ */ (0,
|
|
16648
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
|
|
16604
16649
|
case "box":
|
|
16605
|
-
return /* @__PURE__ */ (0,
|
|
16650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
16606
16651
|
DynamicBox_default,
|
|
16607
16652
|
{
|
|
16608
16653
|
component,
|
|
@@ -16616,18 +16661,18 @@ function DynamicLayout(props) {
|
|
|
16616
16661
|
getKey(component)
|
|
16617
16662
|
);
|
|
16618
16663
|
case "decision":
|
|
16619
|
-
return /* @__PURE__ */ (0,
|
|
16664
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
|
|
16620
16665
|
case "external":
|
|
16621
|
-
return /* @__PURE__ */ (0,
|
|
16666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
|
|
16622
16667
|
case "list":
|
|
16623
16668
|
case "status-list":
|
|
16624
|
-
return /* @__PURE__ */ (0,
|
|
16669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicStatusList_default, { component, onAction }, getKey(component));
|
|
16625
16670
|
case "loading-indicator":
|
|
16626
|
-
return /* @__PURE__ */ (0,
|
|
16671
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
|
|
16627
16672
|
case "search":
|
|
16628
|
-
return /* @__PURE__ */ (0,
|
|
16673
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(DynamicSearch_default, { component, onAction }, getKey(component));
|
|
16629
16674
|
case "modal":
|
|
16630
|
-
return /* @__PURE__ */ (0,
|
|
16675
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(
|
|
16631
16676
|
DynamicModal_default,
|
|
16632
16677
|
{
|
|
16633
16678
|
component,
|
|
@@ -16641,22 +16686,22 @@ function DynamicLayout(props) {
|
|
|
16641
16686
|
getKey(component)
|
|
16642
16687
|
);
|
|
16643
16688
|
default:
|
|
16644
|
-
return /* @__PURE__ */ (0,
|
|
16689
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)("div", {}, getKey(component));
|
|
16645
16690
|
}
|
|
16646
16691
|
};
|
|
16647
16692
|
if (useHasHttpClientProvider() || baseUrl == null) {
|
|
16648
|
-
return /* @__PURE__ */ (0,
|
|
16693
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(import_jsx_runtime105.Fragment, { children: components.map(renderComponent) });
|
|
16649
16694
|
}
|
|
16650
|
-
return /* @__PURE__ */ (0,
|
|
16695
|
+
return /* @__PURE__ */ (0, import_jsx_runtime105.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
|
|
16651
16696
|
}
|
|
16652
16697
|
var DynamicLayout_default = DynamicLayout;
|
|
16653
16698
|
|
|
16654
16699
|
// src/legacy/layout/list/DynamicStatusList.tsx
|
|
16655
|
-
var
|
|
16656
|
-
var
|
|
16700
|
+
var import_components62 = require("@transferwise/components");
|
|
16701
|
+
var import_jsx_runtime106 = require("react/jsx-runtime");
|
|
16657
16702
|
var DynamicStatusList = ({ component }) => {
|
|
16658
|
-
return /* @__PURE__ */ (0,
|
|
16659
|
-
component.title ? /* @__PURE__ */ (0,
|
|
16703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsxs)("div", { className: getMargin2(component.margin || "md"), children: [
|
|
16704
|
+
component.title ? /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_components62.Header, { title: component.title }) : null,
|
|
16660
16705
|
component.items.map(mapListItemToSummary)
|
|
16661
16706
|
] });
|
|
16662
16707
|
};
|
|
@@ -16665,8 +16710,8 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
|
|
|
16665
16710
|
key: `${title}/${description || ""}`,
|
|
16666
16711
|
title,
|
|
16667
16712
|
description
|
|
16668
|
-
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0,
|
|
16669
|
-
return /* @__PURE__ */ (0,
|
|
16713
|
+
}, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(DynamicIcon_default2, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
|
|
16714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime106.jsx)(import_components62.Summary, __spreadValues({}, props));
|
|
16670
16715
|
};
|
|
16671
16716
|
var statusListMap = {
|
|
16672
16717
|
done: "done",
|
|
@@ -16682,12 +16727,12 @@ var statusMap = __spreadValues(__spreadValues({}, statusListMap), legacyStatusMa
|
|
|
16682
16727
|
var DynamicStatusList_default = DynamicStatusList;
|
|
16683
16728
|
|
|
16684
16729
|
// src/legacy/layout/loadingIndicator/DynamicLoadingIndicator.tsx
|
|
16685
|
-
var
|
|
16686
|
-
var
|
|
16730
|
+
var import_components63 = require("@transferwise/components");
|
|
16731
|
+
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
16687
16732
|
var DynamicLoadingIndicator = ({ component }) => {
|
|
16688
16733
|
const { margin = "md", size = "md" } = component;
|
|
16689
|
-
return /* @__PURE__ */ (0,
|
|
16690
|
-
|
|
16734
|
+
return /* @__PURE__ */ (0, import_jsx_runtime107.jsx)(
|
|
16735
|
+
import_components63.Loader,
|
|
16691
16736
|
{
|
|
16692
16737
|
size,
|
|
16693
16738
|
classNames: {
|
|
@@ -16700,26 +16745,26 @@ var DynamicLoadingIndicator = ({ component }) => {
|
|
|
16700
16745
|
var DynamicLoadingIndicator_default = DynamicLoadingIndicator;
|
|
16701
16746
|
|
|
16702
16747
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
16703
|
-
var
|
|
16748
|
+
var import_components65 = require("@transferwise/components");
|
|
16704
16749
|
var import_react_intl28 = require("react-intl");
|
|
16705
16750
|
|
|
16706
16751
|
// src/legacy/layout/paragraph/useSnackBarIfAvailable.ts
|
|
16707
|
-
var
|
|
16708
|
-
var
|
|
16752
|
+
var import_components64 = require("@transferwise/components");
|
|
16753
|
+
var import_react47 = require("react");
|
|
16709
16754
|
function useSnackBarIfAvailable2() {
|
|
16710
|
-
const context = (0,
|
|
16755
|
+
const context = (0, import_react47.useContext)(import_components64.SnackbarContext);
|
|
16711
16756
|
return context ? context.createSnackbar : noop3;
|
|
16712
16757
|
}
|
|
16713
16758
|
function noop3() {
|
|
16714
16759
|
}
|
|
16715
16760
|
|
|
16716
16761
|
// src/legacy/layout/paragraph/DynamicParagraph.tsx
|
|
16717
|
-
var
|
|
16762
|
+
var import_jsx_runtime108 = require("react/jsx-runtime");
|
|
16718
16763
|
function DynamicParagraph({ component }) {
|
|
16719
|
-
return component.control === "copyable" ? /* @__PURE__ */ (0,
|
|
16764
|
+
return component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime108.jsx)(BasicDynamicParagraph, { component });
|
|
16720
16765
|
}
|
|
16721
16766
|
function BasicDynamicParagraph({ component }) {
|
|
16722
|
-
return /* @__PURE__ */ (0,
|
|
16767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("p", { className: getTextAlignmentAndMargin2(component), children: [
|
|
16723
16768
|
" ",
|
|
16724
16769
|
component.text,
|
|
16725
16770
|
" "
|
|
@@ -16737,8 +16782,8 @@ function CopyableDynamicParagraph({ component }) {
|
|
|
16737
16782
|
align: component.align,
|
|
16738
16783
|
margin: "sm"
|
|
16739
16784
|
})} form-control`;
|
|
16740
|
-
return /* @__PURE__ */ (0,
|
|
16741
|
-
/* @__PURE__ */ (0,
|
|
16785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime108.jsxs)("div", { className: getTextAlignmentAndMargin2(component), children: [
|
|
16786
|
+
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(
|
|
16742
16787
|
"input",
|
|
16743
16788
|
{
|
|
16744
16789
|
type: "text",
|
|
@@ -16748,7 +16793,7 @@ function CopyableDynamicParagraph({ component }) {
|
|
|
16748
16793
|
style: { textOverflow: "ellipsis" }
|
|
16749
16794
|
}
|
|
16750
16795
|
),
|
|
16751
|
-
/* @__PURE__ */ (0,
|
|
16796
|
+
/* @__PURE__ */ (0, import_jsx_runtime108.jsx)(import_components65.Button, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
16752
16797
|
] });
|
|
16753
16798
|
}
|
|
16754
16799
|
function noop4() {
|
|
@@ -16756,8 +16801,8 @@ function noop4() {
|
|
|
16756
16801
|
var DynamicParagraph_default = DynamicParagraph;
|
|
16757
16802
|
|
|
16758
16803
|
// src/legacy/layout/review/DynamicReview.tsx
|
|
16759
|
-
var
|
|
16760
|
-
var
|
|
16804
|
+
var import_components66 = require("@transferwise/components");
|
|
16805
|
+
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
16761
16806
|
var getDefinitions = (orientation, review) => review.fields.map(({ label, value, help }, index) => ({
|
|
16762
16807
|
key: String(index),
|
|
16763
16808
|
title: label,
|
|
@@ -16765,14 +16810,14 @@ var getDefinitions = (orientation, review) => review.fields.map(({ label, value,
|
|
|
16765
16810
|
}));
|
|
16766
16811
|
var getFieldValue2 = (value, help, orientation) => {
|
|
16767
16812
|
if (help) {
|
|
16768
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0,
|
|
16769
|
-
/* @__PURE__ */ (0,
|
|
16813
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
|
|
16814
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Help_default2, { help }),
|
|
16770
16815
|
" ",
|
|
16771
16816
|
value
|
|
16772
|
-
] }) : /* @__PURE__ */ (0,
|
|
16817
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)(import_jsx_runtime109.Fragment, { children: [
|
|
16773
16818
|
value,
|
|
16774
16819
|
" ",
|
|
16775
|
-
/* @__PURE__ */ (0,
|
|
16820
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)(Help_default2, { help })
|
|
16776
16821
|
] });
|
|
16777
16822
|
}
|
|
16778
16823
|
return value;
|
|
@@ -16797,25 +16842,25 @@ function DynamicReview(props) {
|
|
|
16797
16842
|
const orientation = getReviewLayout(review);
|
|
16798
16843
|
const callToAction = review.callToAction ? getReviewAction2(review.callToAction.title, review.callToAction.action) : null;
|
|
16799
16844
|
const legacyCallToAction = !callToAction && review.action ? getReviewAction2(review.action.title || "", review.action) : null;
|
|
16800
|
-
return /* @__PURE__ */ (0,
|
|
16801
|
-
review.title && /* @__PURE__ */ (0,
|
|
16802
|
-
/* @__PURE__ */ (0,
|
|
16845
|
+
return /* @__PURE__ */ (0, import_jsx_runtime109.jsxs)("div", { className: margin, children: [
|
|
16846
|
+
review.title && /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_components66.Header, { title: review.title, action: callToAction || legacyCallToAction || void 0 }),
|
|
16847
|
+
/* @__PURE__ */ (0, import_jsx_runtime109.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime109.jsx)(import_components66.DefinitionList, { layout: orientation, definitions: getDefinitions(orientation, review) }) })
|
|
16803
16848
|
] });
|
|
16804
16849
|
}
|
|
16805
16850
|
var DynamicReview_default = DynamicReview;
|
|
16806
16851
|
|
|
16807
16852
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
16808
|
-
var
|
|
16853
|
+
var import_react49 = require("react");
|
|
16809
16854
|
var import_icons5 = require("@transferwise/icons");
|
|
16810
16855
|
|
|
16811
16856
|
// src/legacy/layout/search/SearchInput.tsx
|
|
16812
|
-
var
|
|
16813
|
-
var
|
|
16857
|
+
var import_components67 = require("@transferwise/components");
|
|
16858
|
+
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
16814
16859
|
var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
16815
|
-
return /* @__PURE__ */ (0,
|
|
16860
|
+
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)("label", { className: "control-label d-inline", children: [
|
|
16816
16861
|
title,
|
|
16817
|
-
/* @__PURE__ */ (0,
|
|
16818
|
-
|
|
16862
|
+
/* @__PURE__ */ (0, import_jsx_runtime110.jsx)(
|
|
16863
|
+
import_components67.Input,
|
|
16819
16864
|
{
|
|
16820
16865
|
type: "text",
|
|
16821
16866
|
value,
|
|
@@ -16828,15 +16873,15 @@ var SearchInput = ({ title, value, onFocus, onChange }) => {
|
|
|
16828
16873
|
};
|
|
16829
16874
|
|
|
16830
16875
|
// src/legacy/layout/search/SearchResults.tsx
|
|
16831
|
-
var
|
|
16876
|
+
var import_components68 = require("@transferwise/components");
|
|
16832
16877
|
var import_react_intl29 = require("react-intl");
|
|
16833
|
-
var
|
|
16878
|
+
var import_jsx_runtime111 = require("react/jsx-runtime");
|
|
16834
16879
|
function SearchResults2({ results, emptyMessage, onSelect }) {
|
|
16835
16880
|
if (results.length === 0) {
|
|
16836
|
-
return /* @__PURE__ */ (0,
|
|
16881
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)("p", { className: "m-t-2", children: emptyMessage });
|
|
16837
16882
|
}
|
|
16838
|
-
return /* @__PURE__ */ (0,
|
|
16839
|
-
|
|
16883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(import_components68.NavigationOptionsList, { children: results.map((result) => /* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16884
|
+
import_components68.NavigationOption,
|
|
16840
16885
|
{
|
|
16841
16886
|
title: result.title,
|
|
16842
16887
|
content: result.description,
|
|
@@ -16850,10 +16895,10 @@ function SearchResults2({ results, emptyMessage, onSelect }) {
|
|
|
16850
16895
|
}
|
|
16851
16896
|
function ErrorResult2({ onRetrySearch }) {
|
|
16852
16897
|
const intl = (0, import_react_intl29.useIntl)();
|
|
16853
|
-
return /* @__PURE__ */ (0,
|
|
16898
|
+
return /* @__PURE__ */ (0, import_jsx_runtime111.jsxs)("p", { className: "m-t-2", children: [
|
|
16854
16899
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
16855
16900
|
"\xA0",
|
|
16856
|
-
/* @__PURE__ */ (0,
|
|
16901
|
+
/* @__PURE__ */ (0, import_jsx_runtime111.jsx)(
|
|
16857
16902
|
"a",
|
|
16858
16903
|
{
|
|
16859
16904
|
href: "/",
|
|
@@ -16868,15 +16913,15 @@ function ErrorResult2({ onRetrySearch }) {
|
|
|
16868
16913
|
}
|
|
16869
16914
|
|
|
16870
16915
|
// src/legacy/layout/search/useSearch.tsx
|
|
16871
|
-
var
|
|
16916
|
+
var import_react48 = require("react");
|
|
16872
16917
|
var headers = { "Content-Type": "application/json" };
|
|
16873
16918
|
var useSearch = (defaultSearchConfig) => {
|
|
16874
|
-
const [state, setState] = (0,
|
|
16919
|
+
const [state, setState] = (0, import_react48.useState)({
|
|
16875
16920
|
status: "idle"
|
|
16876
16921
|
});
|
|
16877
|
-
const abortControllerRef = (0,
|
|
16922
|
+
const abortControllerRef = (0, import_react48.useRef)(null);
|
|
16878
16923
|
const httpClient = useHttpClient();
|
|
16879
|
-
const search = (0,
|
|
16924
|
+
const search = (0, import_react48.useCallback)(
|
|
16880
16925
|
async (query, { url, method, param } = defaultSearchConfig) => {
|
|
16881
16926
|
var _a;
|
|
16882
16927
|
(_a = abortControllerRef.current) == null ? void 0 : _a.abort();
|
|
@@ -16937,16 +16982,16 @@ var addQueryParameter2 = (url, key, value) => {
|
|
|
16937
16982
|
};
|
|
16938
16983
|
|
|
16939
16984
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
16940
|
-
var
|
|
16985
|
+
var import_components69 = require("@transferwise/components");
|
|
16941
16986
|
var import_classnames15 = __toESM(require_classnames());
|
|
16942
|
-
var
|
|
16987
|
+
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
16943
16988
|
var DEBOUNCE_TIME2 = 400;
|
|
16944
16989
|
function DynamicSearch({ component, onAction }) {
|
|
16945
|
-
const [query, setQuery] = (0,
|
|
16990
|
+
const [query, setQuery] = (0, import_react49.useState)("");
|
|
16946
16991
|
const { control, title, margin, url, method, param, emptyMessage } = component;
|
|
16947
16992
|
const { status, results, search } = useSearch({ url, method, param });
|
|
16948
16993
|
const onEvent = useEventDispatcher();
|
|
16949
|
-
const debouncedSearch = (0,
|
|
16994
|
+
const debouncedSearch = (0, import_react49.useMemo)(() => debounce2(search, DEBOUNCE_TIME2), [search]);
|
|
16950
16995
|
const onSearchStart = () => {
|
|
16951
16996
|
onEvent("Dynamic Flow - Search Started", {});
|
|
16952
16997
|
};
|
|
@@ -16975,16 +17020,16 @@ function DynamicSearch({ component, onAction }) {
|
|
|
16975
17020
|
void search(query);
|
|
16976
17021
|
};
|
|
16977
17022
|
if (control === "inline") {
|
|
16978
|
-
return /* @__PURE__ */ (0,
|
|
17023
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: (0, import_classnames15.default)(getMargin2(margin != null ? margin : "md"), "df-search-typeahead"), children: /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("label", { className: "control-label d-inline", children: [
|
|
16979
17024
|
title,
|
|
16980
|
-
/* @__PURE__ */ (0,
|
|
16981
|
-
|
|
17025
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "m-t-1", children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
17026
|
+
import_components69.Typeahead,
|
|
16982
17027
|
{
|
|
16983
17028
|
id: "typeahead-input-id",
|
|
16984
17029
|
name: "typeahead-input-name",
|
|
16985
17030
|
size: "md",
|
|
16986
17031
|
maxHeight: 100,
|
|
16987
|
-
footer: /* @__PURE__ */ (0,
|
|
17032
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(
|
|
16988
17033
|
TypeaheadFooter2,
|
|
16989
17034
|
{
|
|
16990
17035
|
state: status,
|
|
@@ -16995,7 +17040,7 @@ function DynamicSearch({ component, onAction }) {
|
|
|
16995
17040
|
),
|
|
16996
17041
|
multiple: false,
|
|
16997
17042
|
clearable: false,
|
|
16998
|
-
addon: /* @__PURE__ */ (0,
|
|
17043
|
+
addon: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_icons5.Search, { size: 24 }),
|
|
16999
17044
|
options: results.map(mapResultToTypeaheadOption2),
|
|
17000
17045
|
onChange: (values) => {
|
|
17001
17046
|
if (values.length > 0) {
|
|
@@ -17010,11 +17055,11 @@ function DynamicSearch({ component, onAction }) {
|
|
|
17010
17055
|
) })
|
|
17011
17056
|
] }) });
|
|
17012
17057
|
}
|
|
17013
|
-
return /* @__PURE__ */ (0,
|
|
17014
|
-
/* @__PURE__ */ (0,
|
|
17015
|
-
status === "loading" && /* @__PURE__ */ (0,
|
|
17016
|
-
status === "error" && /* @__PURE__ */ (0,
|
|
17017
|
-
status === "success" && /* @__PURE__ */ (0,
|
|
17058
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsxs)("div", { className: getMargin2(margin != null ? margin : "md"), children: [
|
|
17059
|
+
/* @__PURE__ */ (0, import_jsx_runtime112.jsx)(SearchInput, { title, value: query, onChange, onFocus: onSearchStart }),
|
|
17060
|
+
status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
|
|
17061
|
+
status === "error" && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ErrorResult2, { onRetrySearch }),
|
|
17062
|
+
status === "success" && /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(SearchResults2, { results, emptyMessage, onSelect: onResultSelected })
|
|
17018
17063
|
] });
|
|
17019
17064
|
}
|
|
17020
17065
|
function mapResultToTypeaheadOption2(result) {
|
|
@@ -17033,35 +17078,35 @@ function TypeaheadFooter2({
|
|
|
17033
17078
|
emptyMessage
|
|
17034
17079
|
}) {
|
|
17035
17080
|
if (state === "success" && results.length === 0) {
|
|
17036
|
-
return /* @__PURE__ */ (0,
|
|
17081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(import_components69.Markdown, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: emptyMessage });
|
|
17037
17082
|
}
|
|
17038
17083
|
if (state === "error" && results.length === 0) {
|
|
17039
|
-
return /* @__PURE__ */ (0,
|
|
17084
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime112.jsx)(ErrorResult2, { onRetrySearch }) });
|
|
17040
17085
|
}
|
|
17041
17086
|
if (state === "loading" || results.length === 0) {
|
|
17042
|
-
return /* @__PURE__ */ (0,
|
|
17087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime112.jsx)("p", { className: "m-t-2 m-x-2", children: "Loading..." });
|
|
17043
17088
|
}
|
|
17044
17089
|
return null;
|
|
17045
17090
|
}
|
|
17046
17091
|
var DynamicSearch_default = DynamicSearch;
|
|
17047
17092
|
|
|
17048
17093
|
// src/legacy/layout/modal/DynamicModal.tsx
|
|
17049
|
-
var
|
|
17050
|
-
var
|
|
17051
|
-
var
|
|
17094
|
+
var import_components70 = require("@transferwise/components");
|
|
17095
|
+
var import_react50 = require("react");
|
|
17096
|
+
var import_jsx_runtime113 = require("react/jsx-runtime");
|
|
17052
17097
|
function DynamicModal(props) {
|
|
17053
|
-
const [visible, isVisible] = (0,
|
|
17098
|
+
const [visible, isVisible] = (0, import_react50.useState)(false);
|
|
17054
17099
|
const { component, onAction } = props;
|
|
17055
17100
|
const { margin = "md" } = component;
|
|
17056
|
-
return /* @__PURE__ */ (0,
|
|
17057
|
-
/* @__PURE__ */ (0,
|
|
17058
|
-
/* @__PURE__ */ (0,
|
|
17059
|
-
|
|
17101
|
+
return /* @__PURE__ */ (0, import_jsx_runtime113.jsxs)("div", { className: getTextAlignmentAndMargin2({ margin }), children: [
|
|
17102
|
+
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(import_components70.Button, { priority: "tertiary", block: true, onClick: () => isVisible(true), children: component.trigger.title }),
|
|
17103
|
+
/* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
17104
|
+
import_components70.Modal,
|
|
17060
17105
|
{
|
|
17061
17106
|
scroll: "content",
|
|
17062
17107
|
open: visible,
|
|
17063
17108
|
size: "lg",
|
|
17064
|
-
body: /* @__PURE__ */ (0,
|
|
17109
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime113.jsx)(
|
|
17065
17110
|
DynamicLayout_default,
|
|
17066
17111
|
__spreadProps(__spreadValues({}, props), {
|
|
17067
17112
|
components: component.content.components,
|
|
@@ -17079,7 +17124,7 @@ function DynamicModal(props) {
|
|
|
17079
17124
|
var DynamicModal_default = DynamicModal;
|
|
17080
17125
|
|
|
17081
17126
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
17082
|
-
var
|
|
17127
|
+
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
17083
17128
|
var isNullish3 = (value) => isNull3(value) || isUndefined3(value);
|
|
17084
17129
|
var getDefaultValue = (schema) => {
|
|
17085
17130
|
return schema.type === "boolean" && isNullish3(schema.default) ? false : schema.default;
|
|
@@ -17117,13 +17162,13 @@ var BasicTypeSchema = (props) => {
|
|
|
17117
17162
|
props.onBlur();
|
|
17118
17163
|
}
|
|
17119
17164
|
};
|
|
17120
|
-
const [model, setModel] = (0,
|
|
17121
|
-
const [lastModel, setLastModel] = (0,
|
|
17122
|
-
const [changed, setChanged] = (0,
|
|
17123
|
-
const [focused, setFocused] = (0,
|
|
17124
|
-
const [blurred, setBlurred] = (0,
|
|
17125
|
-
const [validations, setValidations] = (0,
|
|
17126
|
-
const id = (0,
|
|
17165
|
+
const [model, setModel] = (0, import_react51.useState)((_a = props.model) != null ? _a : null);
|
|
17166
|
+
const [lastModel, setLastModel] = (0, import_react51.useState)((_b = props.model) != null ? _b : null);
|
|
17167
|
+
const [changed, setChanged] = (0, import_react51.useState)(false);
|
|
17168
|
+
const [focused, setFocused] = (0, import_react51.useState)(false);
|
|
17169
|
+
const [blurred, setBlurred] = (0, import_react51.useState)(false);
|
|
17170
|
+
const [validations, setValidations] = (0, import_react51.useState)([]);
|
|
17171
|
+
const id = (0, import_react51.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
17127
17172
|
const onSchemaChange = () => {
|
|
17128
17173
|
const defaultValue = getDefaultValue(props.schema);
|
|
17129
17174
|
if (isNullish3(model) && !isNullish3(defaultValue)) {
|
|
@@ -17138,9 +17183,9 @@ var BasicTypeSchema = (props) => {
|
|
|
17138
17183
|
};
|
|
17139
17184
|
const isConst = props.schema.const;
|
|
17140
17185
|
const isHidden = props.schema.hidden || isConst;
|
|
17141
|
-
(0,
|
|
17142
|
-
(0,
|
|
17143
|
-
(0,
|
|
17186
|
+
(0, import_react51.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
17187
|
+
(0, import_react51.useEffect)(onSchemaChange, [props.schema]);
|
|
17188
|
+
(0, import_react51.useEffect)(() => {
|
|
17144
17189
|
var _a2;
|
|
17145
17190
|
const newModel = (_a2 = props.model) != null ? _a2 : null;
|
|
17146
17191
|
if (newModel !== model) {
|
|
@@ -17155,15 +17200,15 @@ var BasicTypeSchema = (props) => {
|
|
|
17155
17200
|
const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
|
|
17156
17201
|
const schemaHelp = props.schema.help;
|
|
17157
17202
|
const feedbackId = `${id}-feedback`;
|
|
17158
|
-
return !isHidden ? /* @__PURE__ */ (0,
|
|
17159
|
-
props.schema.alert && /* @__PURE__ */ (0,
|
|
17160
|
-
/* @__PURE__ */ (0,
|
|
17161
|
-
showLabel && /* @__PURE__ */ (0,
|
|
17162
|
-
/* @__PURE__ */ (0,
|
|
17163
|
-
!!schemaHelp && /* @__PURE__ */ (0,
|
|
17203
|
+
return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)(import_jsx_runtime114.Fragment, { children: [
|
|
17204
|
+
props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(DynamicAlert_default, { component: props.schema.alert }),
|
|
17205
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: (0, import_classnames16.default)(formGroupClasses), children: [
|
|
17206
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime114.jsxs)("div", { className: "d-inline-block m-b-1", children: [
|
|
17207
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
|
|
17208
|
+
!!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(Help_default2, { help: schemaHelp })
|
|
17164
17209
|
] }),
|
|
17165
|
-
!showLabel && !!schemaHelp && /* @__PURE__ */ (0,
|
|
17166
|
-
/* @__PURE__ */ (0,
|
|
17210
|
+
!showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime114.jsx)(Help_default2, { help: schemaHelp }),
|
|
17211
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
17167
17212
|
SchemaFormControl_default,
|
|
17168
17213
|
{
|
|
17169
17214
|
id,
|
|
@@ -17176,7 +17221,7 @@ var BasicTypeSchema = (props) => {
|
|
|
17176
17221
|
describedBy: feedbackId
|
|
17177
17222
|
}
|
|
17178
17223
|
),
|
|
17179
|
-
/* @__PURE__ */ (0,
|
|
17224
|
+
/* @__PURE__ */ (0, import_jsx_runtime114.jsx)(
|
|
17180
17225
|
ControlFeedback_default,
|
|
17181
17226
|
{
|
|
17182
17227
|
id: feedbackId,
|
|
@@ -17201,7 +17246,7 @@ BasicTypeSchema.defaultProps = {
|
|
|
17201
17246
|
var BasicTypeSchema_default = BasicTypeSchema;
|
|
17202
17247
|
|
|
17203
17248
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
17204
|
-
var
|
|
17249
|
+
var import_jsx_runtime115 = require("react/jsx-runtime");
|
|
17205
17250
|
var getIdFromResponse = (idProperty, response) => response[idProperty];
|
|
17206
17251
|
var getErrorFromResponse = (errorProperty, response) => {
|
|
17207
17252
|
var _a;
|
|
@@ -17219,12 +17264,12 @@ function PersistAsyncBasicSchema(props) {
|
|
|
17219
17264
|
const intl = (0, import_react_intl30.useIntl)();
|
|
17220
17265
|
const httpClient = useHttpClient();
|
|
17221
17266
|
const onEvent = useEventDispatcher();
|
|
17222
|
-
const [persistAsyncModel, setPersistAsyncModel] = (0,
|
|
17267
|
+
const [persistAsyncModel, setPersistAsyncModel] = (0, import_react52.useState)(null);
|
|
17223
17268
|
const previousPersistAsyncModel = usePrevious(persistAsyncModel);
|
|
17224
|
-
const [persistAsyncError, setPersistAsyncError] = (0,
|
|
17225
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
17226
|
-
const [abortController, setAbortController] = (0,
|
|
17227
|
-
(0,
|
|
17269
|
+
const [persistAsyncError, setPersistAsyncError] = (0, import_react52.useState)(null);
|
|
17270
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react52.useState)(false);
|
|
17271
|
+
const [abortController, setAbortController] = (0, import_react52.useState)(null);
|
|
17272
|
+
(0, import_react52.useEffect)(() => {
|
|
17228
17273
|
if (controlTypesWithPersistOnChange.has(
|
|
17229
17274
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
17230
17275
|
getControlType(schema.persistAsync.schema)
|
|
@@ -17291,7 +17336,7 @@ function PersistAsyncBasicSchema(props) {
|
|
|
17291
17336
|
setPersistAsyncModel(newPersistAsyncModel);
|
|
17292
17337
|
}
|
|
17293
17338
|
};
|
|
17294
|
-
return /* @__PURE__ */ (0,
|
|
17339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime115.jsx)(
|
|
17295
17340
|
BasicTypeSchema_default,
|
|
17296
17341
|
{
|
|
17297
17342
|
required,
|
|
@@ -17312,7 +17357,7 @@ var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
|
17312
17357
|
|
|
17313
17358
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
17314
17359
|
var usePersistAsync = (persistAsync) => {
|
|
17315
|
-
const [abortController, setAbortController] = (0,
|
|
17360
|
+
const [abortController, setAbortController] = (0, import_react53.useState)(null);
|
|
17316
17361
|
const httpClient = useHttpClient();
|
|
17317
17362
|
const intl = (0, import_react_intl31.useIntl)();
|
|
17318
17363
|
const { schema } = persistAsync;
|
|
@@ -17391,7 +17436,7 @@ function hasStringMessage(value) {
|
|
|
17391
17436
|
}
|
|
17392
17437
|
|
|
17393
17438
|
// src/legacy/common/hooks/usePolling/usePolling.tsx
|
|
17394
|
-
var
|
|
17439
|
+
var import_react54 = require("react");
|
|
17395
17440
|
function usePolling({
|
|
17396
17441
|
asyncFn,
|
|
17397
17442
|
interval,
|
|
@@ -17400,9 +17445,9 @@ function usePolling({
|
|
|
17400
17445
|
onPollingResponse,
|
|
17401
17446
|
onFailure
|
|
17402
17447
|
}) {
|
|
17403
|
-
const onPollingResponseReference = (0,
|
|
17404
|
-
const onFailureReference = (0,
|
|
17405
|
-
const poll = (0,
|
|
17448
|
+
const onPollingResponseReference = (0, import_react54.useRef)(onPollingResponse);
|
|
17449
|
+
const onFailureReference = (0, import_react54.useRef)(onFailure);
|
|
17450
|
+
const poll = (0, import_react54.useMemo)(
|
|
17406
17451
|
() => createPollingClosure(
|
|
17407
17452
|
asyncFn,
|
|
17408
17453
|
maxAttempts,
|
|
@@ -17412,7 +17457,7 @@ function usePolling({
|
|
|
17412
17457
|
),
|
|
17413
17458
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
17414
17459
|
);
|
|
17415
|
-
(0,
|
|
17460
|
+
(0, import_react54.useEffect)(() => {
|
|
17416
17461
|
if (interval > 0) {
|
|
17417
17462
|
const intervalReference = setInterval(() => {
|
|
17418
17463
|
poll();
|
|
@@ -17420,7 +17465,7 @@ function usePolling({
|
|
|
17420
17465
|
return () => clearInterval(intervalReference);
|
|
17421
17466
|
}
|
|
17422
17467
|
}, [poll, interval]);
|
|
17423
|
-
(0,
|
|
17468
|
+
(0, import_react54.useEffect)(() => {
|
|
17424
17469
|
onPollingResponseReference.current = onPollingResponse;
|
|
17425
17470
|
onFailureReference.current = onFailure;
|
|
17426
17471
|
}, [onPollingResponse, onFailure]);
|
|
@@ -17451,20 +17496,20 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
|
|
|
17451
17496
|
}
|
|
17452
17497
|
|
|
17453
17498
|
// src/legacy/common/hooks/usePrevious/usePrevious.js
|
|
17454
|
-
var
|
|
17499
|
+
var import_react55 = require("react");
|
|
17455
17500
|
var usePrevious = (value) => {
|
|
17456
|
-
const reference = (0,
|
|
17457
|
-
(0,
|
|
17501
|
+
const reference = (0, import_react55.useRef)();
|
|
17502
|
+
(0, import_react55.useEffect)(() => {
|
|
17458
17503
|
reference.current = value;
|
|
17459
17504
|
}, [value]);
|
|
17460
17505
|
return reference.current;
|
|
17461
17506
|
};
|
|
17462
17507
|
|
|
17463
17508
|
// src/legacy/common/hooks/useStepPolling/useStepPolling.tsx
|
|
17464
|
-
var
|
|
17509
|
+
var import_react56 = require("react");
|
|
17465
17510
|
function useStepPolling(polling, onAction) {
|
|
17466
17511
|
const httpClient = useHttpClient();
|
|
17467
|
-
const asyncFn = (0,
|
|
17512
|
+
const asyncFn = (0, import_react56.useMemo)(() => {
|
|
17468
17513
|
if (polling) {
|
|
17469
17514
|
return () => httpClient(polling.url).then((response) => {
|
|
17470
17515
|
if (response.ok) {
|
|
@@ -17477,7 +17522,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17477
17522
|
}
|
|
17478
17523
|
return void 0;
|
|
17479
17524
|
}, [polling, httpClient]);
|
|
17480
|
-
const onPollingResponse = (0,
|
|
17525
|
+
const onPollingResponse = (0, import_react56.useCallback)(
|
|
17481
17526
|
(pollingResponse) => {
|
|
17482
17527
|
if (pollingResponse == null ? void 0 : pollingResponse.action) {
|
|
17483
17528
|
onAction(pollingResponse.action);
|
|
@@ -17493,7 +17538,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17493
17538
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
17494
17539
|
maxConsecutiveFails: 1,
|
|
17495
17540
|
onPollingResponse,
|
|
17496
|
-
onFailure: (0,
|
|
17541
|
+
onFailure: (0, import_react56.useCallback)(() => {
|
|
17497
17542
|
if (polling) {
|
|
17498
17543
|
onAction(polling.onError.action);
|
|
17499
17544
|
}
|
|
@@ -17502,7 +17547,7 @@ function useStepPolling(polling, onAction) {
|
|
|
17502
17547
|
}
|
|
17503
17548
|
|
|
17504
17549
|
// src/legacy/step/layoutStep/LayoutStep.tsx
|
|
17505
|
-
var
|
|
17550
|
+
var import_jsx_runtime116 = require("react/jsx-runtime");
|
|
17506
17551
|
var getComponents = (step, options) => {
|
|
17507
17552
|
var _a;
|
|
17508
17553
|
if (isEmpty(step)) {
|
|
@@ -17525,7 +17570,7 @@ var LayoutStep = (props) => {
|
|
|
17525
17570
|
onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
|
|
17526
17571
|
};
|
|
17527
17572
|
useStepPolling(stepSpecification.polling, onAction);
|
|
17528
|
-
return /* @__PURE__ */ (0,
|
|
17573
|
+
return /* @__PURE__ */ (0, import_jsx_runtime116.jsx)(
|
|
17529
17574
|
DynamicLayout_default,
|
|
17530
17575
|
{
|
|
17531
17576
|
components,
|
|
@@ -17541,10 +17586,10 @@ var LayoutStep = (props) => {
|
|
|
17541
17586
|
var LayoutStep_default = LayoutStep;
|
|
17542
17587
|
|
|
17543
17588
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
17544
|
-
var
|
|
17589
|
+
var import_react61 = require("react");
|
|
17545
17590
|
|
|
17546
17591
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
17547
|
-
var
|
|
17592
|
+
var import_react60 = require("react");
|
|
17548
17593
|
var import_react_intl36 = require("react-intl");
|
|
17549
17594
|
var import_react_webcam = __toESM(require("react-webcam"));
|
|
17550
17595
|
|
|
@@ -17609,49 +17654,49 @@ var CameraCapture_messages_default = (0, import_react_intl32.defineMessages)({
|
|
|
17609
17654
|
});
|
|
17610
17655
|
|
|
17611
17656
|
// src/legacy/step/cameraStep/cameraCapture/components/bottomBar/BottomBar.tsx
|
|
17612
|
-
var
|
|
17657
|
+
var import_components71 = require("@transferwise/components");
|
|
17613
17658
|
var import_react_intl33 = require("react-intl");
|
|
17614
|
-
var
|
|
17615
|
-
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0,
|
|
17659
|
+
var import_jsx_runtime117 = require("react/jsx-runtime");
|
|
17660
|
+
var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(CaptureButton, { onClick: onCapture }) });
|
|
17616
17661
|
var ReviewBottomBar = ({
|
|
17617
17662
|
onSubmit,
|
|
17618
17663
|
onRetry
|
|
17619
17664
|
}) => {
|
|
17620
17665
|
const intl = (0, import_react_intl33.useIntl)();
|
|
17621
|
-
return /* @__PURE__ */ (0,
|
|
17622
|
-
/* @__PURE__ */ (0,
|
|
17623
|
-
|
|
17666
|
+
return /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime117.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
|
|
17667
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
17668
|
+
import_components71.Button,
|
|
17624
17669
|
{
|
|
17625
17670
|
className: "m-b-1",
|
|
17626
17671
|
block: true,
|
|
17627
|
-
size:
|
|
17628
|
-
type:
|
|
17672
|
+
size: import_components71.Size.MEDIUM,
|
|
17673
|
+
type: import_components71.ControlType.ACCENT,
|
|
17629
17674
|
onClick: onSubmit,
|
|
17630
17675
|
children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
|
|
17631
17676
|
}
|
|
17632
17677
|
),
|
|
17633
|
-
/* @__PURE__ */ (0,
|
|
17634
|
-
|
|
17678
|
+
/* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
17679
|
+
import_components71.Button,
|
|
17635
17680
|
{
|
|
17636
17681
|
className: "m-b-2",
|
|
17637
17682
|
block: true,
|
|
17638
|
-
size:
|
|
17639
|
-
type:
|
|
17640
|
-
priority:
|
|
17683
|
+
size: import_components71.Size.MEDIUM,
|
|
17684
|
+
type: import_components71.ControlType.ACCENT,
|
|
17685
|
+
priority: import_components71.Priority.SECONDARY,
|
|
17641
17686
|
onClick: onRetry,
|
|
17642
17687
|
children: intl.formatMessage(CameraCapture_messages_default.reviewRetry)
|
|
17643
17688
|
}
|
|
17644
17689
|
)
|
|
17645
17690
|
] }) }) });
|
|
17646
17691
|
};
|
|
17647
|
-
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0,
|
|
17692
|
+
var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime117.jsx)(
|
|
17648
17693
|
"button",
|
|
17649
17694
|
{
|
|
17650
17695
|
type: "button",
|
|
17651
17696
|
className: "camera-capture-btn m-b-2",
|
|
17652
17697
|
"data-testid": "camera-capture-button",
|
|
17653
17698
|
onClick,
|
|
17654
|
-
children: /* @__PURE__ */ (0,
|
|
17699
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime117.jsx)("span", { className: "camera-capture-btn-inner" })
|
|
17655
17700
|
}
|
|
17656
17701
|
);
|
|
17657
17702
|
|
|
@@ -17669,11 +17714,11 @@ var OrientationLockOverlay_messages_default = (0, import_react_intl34.defineMess
|
|
|
17669
17714
|
});
|
|
17670
17715
|
|
|
17671
17716
|
// src/legacy/step/cameraStep/cameraCapture/components/orientationLockOverlay/OrientationLockOverlay.tsx
|
|
17672
|
-
var
|
|
17717
|
+
var import_jsx_runtime118 = require("react/jsx-runtime");
|
|
17673
17718
|
function OrientationLockOverlay() {
|
|
17674
17719
|
const intl = (0, import_react_intl35.useIntl)();
|
|
17675
|
-
return /* @__PURE__ */ (0,
|
|
17676
|
-
/* @__PURE__ */ (0,
|
|
17720
|
+
return /* @__PURE__ */ (0, import_jsx_runtime118.jsxs)("div", { className: "orientation-lock-overlay", children: [
|
|
17721
|
+
/* @__PURE__ */ (0, import_jsx_runtime118.jsx)(
|
|
17677
17722
|
"img",
|
|
17678
17723
|
{
|
|
17679
17724
|
className: "m-b-3",
|
|
@@ -17683,25 +17728,25 @@ function OrientationLockOverlay() {
|
|
|
17683
17728
|
alt: ""
|
|
17684
17729
|
}
|
|
17685
17730
|
),
|
|
17686
|
-
/* @__PURE__ */ (0,
|
|
17731
|
+
/* @__PURE__ */ (0, import_jsx_runtime118.jsx)("p", { className: "text-center m-b-0", children: intl.formatMessage(OrientationLockOverlay_messages_default.text) })
|
|
17687
17732
|
] });
|
|
17688
17733
|
}
|
|
17689
17734
|
var OrientationLockOverlay_default = OrientationLockOverlay;
|
|
17690
17735
|
|
|
17691
17736
|
// src/legacy/step/cameraStep/cameraCapture/screens/cameraErrorScreen/CameraErrorScreen.tsx
|
|
17692
|
-
var
|
|
17693
|
-
var
|
|
17737
|
+
var import_components72 = require("@transferwise/components");
|
|
17738
|
+
var import_jsx_runtime119 = require("react/jsx-runtime");
|
|
17694
17739
|
function CameraErrorScreen({ title, description, actionButton, onAction }) {
|
|
17695
|
-
return /* @__PURE__ */ (0,
|
|
17696
|
-
/* @__PURE__ */ (0,
|
|
17697
|
-
/* @__PURE__ */ (0,
|
|
17698
|
-
onAction && actionButton && /* @__PURE__ */ (0,
|
|
17740
|
+
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
|
|
17741
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)("h2", { className: "text-xs-center m-b-3", children: title }),
|
|
17742
|
+
/* @__PURE__ */ (0, import_jsx_runtime119.jsx)("p", { className: "text-xs-center m-b-5", children: description }),
|
|
17743
|
+
onAction && actionButton && /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(import_components72.Button, { block: true, onClick: onAction, children: actionButton })
|
|
17699
17744
|
] }) }) });
|
|
17700
17745
|
}
|
|
17701
17746
|
var CameraErrorScreen_default = CameraErrorScreen;
|
|
17702
17747
|
|
|
17703
17748
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
17704
|
-
var
|
|
17749
|
+
var import_react57 = require("react");
|
|
17705
17750
|
var import_screenfull = __toESM(require_screenfull());
|
|
17706
17751
|
|
|
17707
17752
|
// src/legacy/step/cameraStep/cameraCapture/utils/index.ts
|
|
@@ -17780,16 +17825,16 @@ var trackCameraOrientationLocked = (onEvent) => {
|
|
|
17780
17825
|
|
|
17781
17826
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
17782
17827
|
var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
17783
|
-
const lockOrientation = (0,
|
|
17828
|
+
const lockOrientation = (0, import_react57.useCallback)(() => {
|
|
17784
17829
|
if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
17785
17830
|
window.screen.orientation.lock("portrait").then(() => trackCameraOrientationLocked(onEvent)).catch(noop5);
|
|
17786
17831
|
}
|
|
17787
17832
|
}, [onEvent]);
|
|
17788
|
-
const unlockOrientation = (0,
|
|
17833
|
+
const unlockOrientation = (0, import_react57.useCallback)(() => {
|
|
17789
17834
|
var _a, _b, _c;
|
|
17790
17835
|
return (_c = (_b = (_a = window == null ? void 0 : window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.unlock) == null ? void 0 : _c.call(_b);
|
|
17791
17836
|
}, []);
|
|
17792
|
-
const enterFullScreen = (0,
|
|
17837
|
+
const enterFullScreen = (0, import_react57.useCallback)(() => {
|
|
17793
17838
|
setTimeout(() => {
|
|
17794
17839
|
if (shouldLockOrientation && !import_screenfull.default.isFullscreen && import_screenfull.default.isEnabled) {
|
|
17795
17840
|
import_screenfull.default.request(document.documentElement, { navigationUI: "show" }).then(() => {
|
|
@@ -17798,13 +17843,13 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
17798
17843
|
}
|
|
17799
17844
|
}, 100);
|
|
17800
17845
|
}, [shouldLockOrientation, lockOrientation]);
|
|
17801
|
-
const exitFullScreen = (0,
|
|
17846
|
+
const exitFullScreen = (0, import_react57.useCallback)(() => {
|
|
17802
17847
|
if (import_screenfull.default.isFullscreen) {
|
|
17803
17848
|
import_screenfull.default.exit().catch(noop5);
|
|
17804
17849
|
}
|
|
17805
17850
|
unlockOrientation();
|
|
17806
17851
|
}, [unlockOrientation]);
|
|
17807
|
-
const handleOrientationChange = (0,
|
|
17852
|
+
const handleOrientationChange = (0, import_react57.useCallback)(
|
|
17808
17853
|
(event) => {
|
|
17809
17854
|
var _a, _b;
|
|
17810
17855
|
if ((_a = event == null ? void 0 : event.target) == null ? void 0 : _a.type.includes("landscape")) {
|
|
@@ -17815,7 +17860,7 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
17815
17860
|
},
|
|
17816
17861
|
[onEvent]
|
|
17817
17862
|
);
|
|
17818
|
-
(0,
|
|
17863
|
+
(0, import_react57.useEffect)(() => {
|
|
17819
17864
|
var _a, _b;
|
|
17820
17865
|
if (shouldLockOrientation) {
|
|
17821
17866
|
(_b = (_a = window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.addEventListener(
|
|
@@ -17838,9 +17883,9 @@ var noop5 = () => {
|
|
|
17838
17883
|
};
|
|
17839
17884
|
|
|
17840
17885
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
17841
|
-
var
|
|
17886
|
+
var import_react58 = require("react");
|
|
17842
17887
|
var useVideoConstraints = (direction) => {
|
|
17843
|
-
const [videoConstraints, setVideoConstraints] = (0,
|
|
17888
|
+
const [videoConstraints, setVideoConstraints] = (0, import_react58.useState)();
|
|
17844
17889
|
const defaultVideoConstraints = {
|
|
17845
17890
|
facingMode: direction === "front" ? "user" : "environment",
|
|
17846
17891
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
@@ -17848,7 +17893,7 @@ var useVideoConstraints = (direction) => {
|
|
|
17848
17893
|
frameRate: 30,
|
|
17849
17894
|
aspectRatio: 16 / 9
|
|
17850
17895
|
};
|
|
17851
|
-
(0,
|
|
17896
|
+
(0, import_react58.useEffect)(() => {
|
|
17852
17897
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
17853
17898
|
}, [direction]);
|
|
17854
17899
|
const getVideoConstraints = async (direction2) => {
|
|
@@ -17866,8 +17911,8 @@ var useVideoConstraints = (direction) => {
|
|
|
17866
17911
|
};
|
|
17867
17912
|
|
|
17868
17913
|
// src/legacy/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
17869
|
-
var
|
|
17870
|
-
var
|
|
17914
|
+
var import_react59 = require("react");
|
|
17915
|
+
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
17871
17916
|
var captureButtonHeight = 92;
|
|
17872
17917
|
var reviewButtonsHeight = 120;
|
|
17873
17918
|
var imageHeight = 40;
|
|
@@ -17876,8 +17921,8 @@ var instructionsHeight = 48;
|
|
|
17876
17921
|
var reviewInstructionsHeight = 40;
|
|
17877
17922
|
var overlayMaxWidth = 800;
|
|
17878
17923
|
function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstructions }) {
|
|
17879
|
-
const svgReference = (0,
|
|
17880
|
-
(0,
|
|
17924
|
+
const svgReference = (0, import_react59.useRef)(null);
|
|
17925
|
+
(0, import_react59.useEffect)(() => {
|
|
17881
17926
|
const listener = debounce2(() => {
|
|
17882
17927
|
var _a;
|
|
17883
17928
|
if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
|
|
@@ -17889,18 +17934,18 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
17889
17934
|
return () => window.removeEventListener("resize", listener);
|
|
17890
17935
|
});
|
|
17891
17936
|
let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
|
|
17892
|
-
let helperBox = /* @__PURE__ */ (0,
|
|
17893
|
-
imageUrl && /* @__PURE__ */ (0,
|
|
17894
|
-
title && /* @__PURE__ */ (0,
|
|
17895
|
-
instructions && /* @__PURE__ */ (0,
|
|
17937
|
+
let helperBox = /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)(import_jsx_runtime120.Fragment, { children: [
|
|
17938
|
+
imageUrl && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
|
|
17939
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("h4", { className: "camera-capture-title", children: title }),
|
|
17940
|
+
instructions && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("small", { className: "camera-capture-instructions", children: instructions })
|
|
17896
17941
|
] });
|
|
17897
17942
|
const frameBottomMargin = captureButtonHeight + helperBoxHeight;
|
|
17898
17943
|
if (reviewInstructions) {
|
|
17899
17944
|
helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
|
|
17900
|
-
helperBox = /* @__PURE__ */ (0,
|
|
17945
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
|
|
17901
17946
|
const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
|
|
17902
17947
|
if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
|
|
17903
|
-
helperBox = /* @__PURE__ */ (0,
|
|
17948
|
+
helperBox = /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(import_jsx_runtime120.Fragment, {});
|
|
17904
17949
|
}
|
|
17905
17950
|
}
|
|
17906
17951
|
const framePosition = {
|
|
@@ -17918,20 +17963,20 @@ function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstru
|
|
|
17918
17963
|
width: "90%"
|
|
17919
17964
|
}
|
|
17920
17965
|
};
|
|
17921
|
-
return /* @__PURE__ */ (0,
|
|
17922
|
-
/* @__PURE__ */ (0,
|
|
17923
|
-
/* @__PURE__ */ (0,
|
|
17924
|
-
/* @__PURE__ */ (0,
|
|
17966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
|
|
17967
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime120.jsxs)("mask", { id: "mask", children: [
|
|
17968
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
|
|
17969
|
+
/* @__PURE__ */ (0, import_jsx_runtime120.jsx)("image", __spreadValues({ href: overlay }, framePosition))
|
|
17925
17970
|
] }) }),
|
|
17926
|
-
overlay && /* @__PURE__ */ (0,
|
|
17927
|
-
outline && /* @__PURE__ */ (0,
|
|
17928
|
-
/* @__PURE__ */ (0,
|
|
17971
|
+
overlay && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
|
|
17972
|
+
outline && /* @__PURE__ */ (0, import_jsx_runtime120.jsx)("image", __spreadValues({ href: outline }, framePosition)),
|
|
17973
|
+
/* @__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 })) })
|
|
17929
17974
|
] });
|
|
17930
17975
|
}
|
|
17931
17976
|
var Overlay_default = Overlay;
|
|
17932
17977
|
|
|
17933
17978
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
17934
|
-
var
|
|
17979
|
+
var import_jsx_runtime121 = require("react/jsx-runtime");
|
|
17935
17980
|
function CameraCapture({
|
|
17936
17981
|
direction = "back",
|
|
17937
17982
|
overlay = "",
|
|
@@ -17943,14 +17988,14 @@ function CameraCapture({
|
|
|
17943
17988
|
onCapture,
|
|
17944
17989
|
onEvent
|
|
17945
17990
|
}) {
|
|
17946
|
-
const [mode, setMode] = (0,
|
|
17947
|
-
const [cameraError, setCameraError] = (0,
|
|
17948
|
-
const [isVideoMirrored, setIsVideoMirrored] = (0,
|
|
17949
|
-
const [ready, setReady] = (0,
|
|
17950
|
-
const [reviewImage, setReviewImage] = (0,
|
|
17951
|
-
const webcamReference = (0,
|
|
17991
|
+
const [mode, setMode] = (0, import_react60.useState)("CAPTURE" /* CAPTURE */);
|
|
17992
|
+
const [cameraError, setCameraError] = (0, import_react60.useState)();
|
|
17993
|
+
const [isVideoMirrored, setIsVideoMirrored] = (0, import_react60.useState)(false);
|
|
17994
|
+
const [ready, setReady] = (0, import_react60.useState)(false);
|
|
17995
|
+
const [reviewImage, setReviewImage] = (0, import_react60.useState)();
|
|
17996
|
+
const webcamReference = (0, import_react60.useRef)(null);
|
|
17952
17997
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
17953
|
-
const shouldLockOrientation = (0,
|
|
17998
|
+
const shouldLockOrientation = (0, import_react60.useMemo)(
|
|
17954
17999
|
() => !!(isMobile() && mode === "CAPTURE" /* CAPTURE */),
|
|
17955
18000
|
[mode]
|
|
17956
18001
|
);
|
|
@@ -17959,7 +18004,7 @@ function CameraCapture({
|
|
|
17959
18004
|
onEvent
|
|
17960
18005
|
);
|
|
17961
18006
|
const intl = (0, import_react_intl36.useIntl)();
|
|
17962
|
-
const handleCapture = (0,
|
|
18007
|
+
const handleCapture = (0, import_react60.useCallback)(async () => {
|
|
17963
18008
|
var _a, _b, _c, _d, _e, _f;
|
|
17964
18009
|
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) {
|
|
17965
18010
|
(_e = (_d = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _d.video) == null ? void 0 : _e.pause();
|
|
@@ -17981,7 +18026,7 @@ function CameraCapture({
|
|
|
17981
18026
|
);
|
|
17982
18027
|
}
|
|
17983
18028
|
}, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
17984
|
-
const handleUserMediaError = (0,
|
|
18029
|
+
const handleUserMediaError = (0, import_react60.useCallback)(
|
|
17985
18030
|
(error) => {
|
|
17986
18031
|
setMode("ERROR" /* ERROR */);
|
|
17987
18032
|
if (error instanceof DOMException) {
|
|
@@ -18017,7 +18062,7 @@ function CameraCapture({
|
|
|
18017
18062
|
},
|
|
18018
18063
|
[intl, onEvent]
|
|
18019
18064
|
);
|
|
18020
|
-
const handleUserMedia = (0,
|
|
18065
|
+
const handleUserMedia = (0, import_react60.useCallback)(
|
|
18021
18066
|
(stream) => {
|
|
18022
18067
|
enterFullScreen();
|
|
18023
18068
|
setReady(true);
|
|
@@ -18034,13 +18079,13 @@ function CameraCapture({
|
|
|
18034
18079
|
setReviewImage(void 0);
|
|
18035
18080
|
};
|
|
18036
18081
|
const handleRetryCameraAccess = () => setMode("CAPTURE" /* CAPTURE */);
|
|
18037
|
-
(0,
|
|
18082
|
+
(0, import_react60.useEffect)(() => {
|
|
18038
18083
|
if (mode !== "CAPTURE" /* CAPTURE */) {
|
|
18039
18084
|
exitFullScreen();
|
|
18040
18085
|
}
|
|
18041
18086
|
}, [mode, exitFullScreen]);
|
|
18042
|
-
const captureScreen = /* @__PURE__ */ (0,
|
|
18043
|
-
videoConstraints && /* @__PURE__ */ (0,
|
|
18087
|
+
const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "camera-capture", children: [
|
|
18088
|
+
videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
18044
18089
|
import_react_webcam.default,
|
|
18045
18090
|
{
|
|
18046
18091
|
ref: webcamReference,
|
|
@@ -18051,7 +18096,7 @@ function CameraCapture({
|
|
|
18051
18096
|
onUserMedia: handleUserMedia
|
|
18052
18097
|
}
|
|
18053
18098
|
),
|
|
18054
|
-
/* @__PURE__ */ (0,
|
|
18099
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
18055
18100
|
Overlay_default,
|
|
18056
18101
|
{
|
|
18057
18102
|
overlay,
|
|
@@ -18061,8 +18106,8 @@ function CameraCapture({
|
|
|
18061
18106
|
instructions
|
|
18062
18107
|
}
|
|
18063
18108
|
),
|
|
18064
|
-
shouldLockOrientation && /* @__PURE__ */ (0,
|
|
18065
|
-
ready && /* @__PURE__ */ (0,
|
|
18109
|
+
shouldLockOrientation && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(OrientationLockOverlay_default, {}),
|
|
18110
|
+
ready && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
18066
18111
|
CaptureBottomBar,
|
|
18067
18112
|
{
|
|
18068
18113
|
onCapture: () => {
|
|
@@ -18071,9 +18116,9 @@ function CameraCapture({
|
|
|
18071
18116
|
}
|
|
18072
18117
|
)
|
|
18073
18118
|
] });
|
|
18074
|
-
const reviewScreen = /* @__PURE__ */ (0,
|
|
18075
|
-
/* @__PURE__ */ (0,
|
|
18076
|
-
/* @__PURE__ */ (0,
|
|
18119
|
+
const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("div", { className: "camera-capture", children: [
|
|
18120
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
|
|
18121
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(
|
|
18077
18122
|
Overlay_default,
|
|
18078
18123
|
{
|
|
18079
18124
|
overlay,
|
|
@@ -18083,18 +18128,18 @@ function CameraCapture({
|
|
|
18083
18128
|
reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
|
|
18084
18129
|
}
|
|
18085
18130
|
),
|
|
18086
|
-
/* @__PURE__ */ (0,
|
|
18131
|
+
/* @__PURE__ */ (0, import_jsx_runtime121.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
|
|
18087
18132
|
] });
|
|
18088
|
-
return /* @__PURE__ */ (0,
|
|
18133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime121.jsxs)("section", { children: [
|
|
18089
18134
|
mode === "CAPTURE" /* CAPTURE */ && captureScreen,
|
|
18090
18135
|
mode === "REVIEW" /* REVIEW */ && reviewScreen,
|
|
18091
|
-
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */ (0,
|
|
18136
|
+
mode === "ERROR" /* ERROR */ && cameraError && /* @__PURE__ */ (0, import_jsx_runtime121.jsx)(CameraErrorScreen_default, __spreadValues({}, cameraError))
|
|
18092
18137
|
] });
|
|
18093
18138
|
}
|
|
18094
18139
|
var CameraCapture_default = CameraCapture;
|
|
18095
18140
|
|
|
18096
18141
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
18097
|
-
var
|
|
18142
|
+
var import_jsx_runtime122 = require("react/jsx-runtime");
|
|
18098
18143
|
function blobToBase64(blob) {
|
|
18099
18144
|
return new Promise((resolve, _) => {
|
|
18100
18145
|
const reader = new FileReader();
|
|
@@ -18112,8 +18157,8 @@ function CameraStep(props) {
|
|
|
18112
18157
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
18113
18158
|
const { overlay, outline } = assets || {};
|
|
18114
18159
|
const { url: imageUrl } = image || {};
|
|
18115
|
-
const [captureClicked, setCaptureClicked] = (0,
|
|
18116
|
-
(0,
|
|
18160
|
+
const [captureClicked, setCaptureClicked] = (0, import_react61.useState)(false);
|
|
18161
|
+
(0, import_react61.useEffect)(() => {
|
|
18117
18162
|
if (captureClicked) {
|
|
18118
18163
|
onAction(action);
|
|
18119
18164
|
}
|
|
@@ -18132,7 +18177,7 @@ function CameraStep(props) {
|
|
|
18132
18177
|
});
|
|
18133
18178
|
}
|
|
18134
18179
|
};
|
|
18135
|
-
return /* @__PURE__ */ (0,
|
|
18180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime122.jsx)(
|
|
18136
18181
|
CameraCapture_default,
|
|
18137
18182
|
{
|
|
18138
18183
|
overlay,
|
|
@@ -18182,12 +18227,12 @@ function getFirstAction(step) {
|
|
|
18182
18227
|
|
|
18183
18228
|
// src/legacy/step/externalConfirmationStep/ExternalConfirmationStep.tsx
|
|
18184
18229
|
var import_react_intl37 = require("react-intl");
|
|
18185
|
-
var
|
|
18230
|
+
var import_jsx_runtime123 = require("react/jsx-runtime");
|
|
18186
18231
|
var noop6 = () => {
|
|
18187
18232
|
};
|
|
18188
18233
|
function ExternalConfirmationStep({ url, onClose }) {
|
|
18189
18234
|
const { formatMessage } = (0, import_react_intl37.useIntl)();
|
|
18190
|
-
return /* @__PURE__ */ (0,
|
|
18235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime123.jsx)(
|
|
18191
18236
|
DynamicLayout_default,
|
|
18192
18237
|
{
|
|
18193
18238
|
components: [
|
|
@@ -18252,11 +18297,11 @@ function getOrigin2(url) {
|
|
|
18252
18297
|
}
|
|
18253
18298
|
|
|
18254
18299
|
// src/legacy/dynamicFlow/BackButton.tsx
|
|
18255
|
-
var
|
|
18300
|
+
var import_components74 = require("@transferwise/components");
|
|
18256
18301
|
var import_icons6 = require("@transferwise/icons");
|
|
18257
|
-
var
|
|
18302
|
+
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
18258
18303
|
function BackButton2({ title, action, onAction }) {
|
|
18259
|
-
return /* @__PURE__ */ (0,
|
|
18304
|
+
return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)(
|
|
18260
18305
|
"a",
|
|
18261
18306
|
{
|
|
18262
18307
|
href: "/",
|
|
@@ -18267,8 +18312,8 @@ function BackButton2({ title, action, onAction }) {
|
|
|
18267
18312
|
onAction(__spreadProps(__spreadValues({}, action), { skipValidation: true }));
|
|
18268
18313
|
},
|
|
18269
18314
|
children: [
|
|
18270
|
-
/* @__PURE__ */ (0,
|
|
18271
|
-
/* @__PURE__ */ (0,
|
|
18315
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)("span", { className: "sr-only", children: title }),
|
|
18316
|
+
/* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_components74.Avatar, { type: "icon", children: /* @__PURE__ */ (0, import_jsx_runtime124.jsx)(import_icons6.ArrowLeft, { size: "24" }) })
|
|
18272
18317
|
]
|
|
18273
18318
|
}
|
|
18274
18319
|
);
|
|
@@ -18276,7 +18321,7 @@ function BackButton2({ title, action, onAction }) {
|
|
|
18276
18321
|
var BackButton_default2 = BackButton2;
|
|
18277
18322
|
|
|
18278
18323
|
// src/legacy/dynamicFlow/DynamicFlowStep.tsx
|
|
18279
|
-
var
|
|
18324
|
+
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
18280
18325
|
function DynamicFlowStep(props) {
|
|
18281
18326
|
var _a, _b, _c;
|
|
18282
18327
|
const { step, globalError, onAction } = props;
|
|
@@ -18285,28 +18330,28 @@ function DynamicFlowStep(props) {
|
|
|
18285
18330
|
const { requiresManualTrigger, dismissConfirmation } = useExternal2(externalUrl);
|
|
18286
18331
|
if (step === void 0) {
|
|
18287
18332
|
if (globalError) {
|
|
18288
|
-
return /* @__PURE__ */ (0,
|
|
18333
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } });
|
|
18289
18334
|
}
|
|
18290
18335
|
return null;
|
|
18291
18336
|
}
|
|
18292
18337
|
if (externalUrl && requiresManualTrigger) {
|
|
18293
|
-
return /* @__PURE__ */ (0,
|
|
18338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
|
|
18294
18339
|
}
|
|
18295
18340
|
if (isCameraStep(step)) {
|
|
18296
|
-
return /* @__PURE__ */ (0,
|
|
18341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
|
|
18297
18342
|
}
|
|
18298
|
-
return /* @__PURE__ */ (0,
|
|
18299
|
-
backButton && /* @__PURE__ */ (0,
|
|
18300
|
-
globalError ? /* @__PURE__ */ (0,
|
|
18301
|
-
/* @__PURE__ */ (0,
|
|
18343
|
+
return /* @__PURE__ */ (0, import_jsx_runtime125.jsxs)(import_jsx_runtime125.Fragment, { children: [
|
|
18344
|
+
backButton && /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(BackButton_default2, __spreadProps(__spreadValues({}, backButton), { onAction })),
|
|
18345
|
+
globalError ? /* @__PURE__ */ (0, import_jsx_runtime125.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
|
|
18346
|
+
/* @__PURE__ */ (0, import_jsx_runtime125.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
|
|
18302
18347
|
] });
|
|
18303
18348
|
}
|
|
18304
18349
|
|
|
18305
18350
|
// src/legacy/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
18306
|
-
var
|
|
18351
|
+
var import_react62 = require("react");
|
|
18307
18352
|
var DEBOUNCE_DELAY = 1e3;
|
|
18308
18353
|
function useDebouncedRefresh(fetchRefresh) {
|
|
18309
|
-
const map = (0,
|
|
18354
|
+
const map = (0, import_react62.useRef)(/* @__PURE__ */ new Map());
|
|
18310
18355
|
const retrieveOrCreate = (key) => {
|
|
18311
18356
|
if (map.current.has(key)) {
|
|
18312
18357
|
return map.current.get(key);
|
|
@@ -18338,12 +18383,12 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
18338
18383
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
18339
18384
|
|
|
18340
18385
|
// src/legacy/dynamicFlow/utils/useDynamicFlowState.ts
|
|
18341
|
-
var
|
|
18386
|
+
var import_react63 = require("react");
|
|
18342
18387
|
var useDynamicFlowState = (initialStep) => {
|
|
18343
18388
|
var _a, _b;
|
|
18344
|
-
const [formErrors, setFormErrors] = (0,
|
|
18345
|
-
const [globalError, setGlobalError] = (0,
|
|
18346
|
-
const [stepAndModels, setStepAndModels] = (0,
|
|
18389
|
+
const [formErrors, setFormErrors] = (0, import_react63.useState)((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
|
|
18390
|
+
const [globalError, setGlobalError] = (0, import_react63.useState)((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
|
|
18391
|
+
const [stepAndModels, setStepAndModels] = (0, import_react63.useState)({
|
|
18347
18392
|
step: initialStep || void 0,
|
|
18348
18393
|
models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
18349
18394
|
etag: void 0
|
|
@@ -18373,7 +18418,7 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
18373
18418
|
return updatedState;
|
|
18374
18419
|
});
|
|
18375
18420
|
};
|
|
18376
|
-
const modelIsValid = (0,
|
|
18421
|
+
const modelIsValid = (0, import_react63.useMemo)(
|
|
18377
18422
|
() => areModelsValid(models, getAllValidatableSchemas(step)),
|
|
18378
18423
|
[models, step]
|
|
18379
18424
|
);
|
|
@@ -18445,19 +18490,19 @@ var getSchemaReference = (component) => {
|
|
|
18445
18490
|
var isInlineSchema = (schema) => schema !== void 0 && typeof schema === "object" && !Object.hasOwnProperty.call(schema, "$ref");
|
|
18446
18491
|
|
|
18447
18492
|
// src/legacy/dynamicFlow/utils/useLoader.tsx
|
|
18448
|
-
var
|
|
18449
|
-
var
|
|
18450
|
-
var
|
|
18493
|
+
var import_components75 = require("@transferwise/components");
|
|
18494
|
+
var import_react64 = require("react");
|
|
18495
|
+
var import_jsx_runtime126 = require("react/jsx-runtime");
|
|
18451
18496
|
function useLoader(loaderConfig, initialState) {
|
|
18452
18497
|
const config = __spreadValues({
|
|
18453
|
-
size:
|
|
18498
|
+
size: import_components75.Size.EXTRA_LARGE,
|
|
18454
18499
|
initial: true,
|
|
18455
18500
|
submission: false
|
|
18456
18501
|
}, loaderConfig);
|
|
18457
|
-
const [loadingState, setLoadingState] = (0,
|
|
18502
|
+
const [loadingState, setLoadingState] = (0, import_react64.useState)(initialState);
|
|
18458
18503
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
18459
|
-
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0,
|
|
18460
|
-
|
|
18504
|
+
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime126.jsx)(
|
|
18505
|
+
import_components75.Loader,
|
|
18461
18506
|
{
|
|
18462
18507
|
size: config.size,
|
|
18463
18508
|
classNames: { "tw-loader": "tw-loader m-x-auto" },
|
|
@@ -18558,8 +18603,25 @@ var assertResponseIsValid2 = (response) => {
|
|
|
18558
18603
|
};
|
|
18559
18604
|
var isResponse2 = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
18560
18605
|
|
|
18606
|
+
// src/legacy/dynamicFlow/utils/useErrorResponse.tsx
|
|
18607
|
+
var import_react_intl38 = require("react-intl");
|
|
18608
|
+
var useErrorResponse = () => {
|
|
18609
|
+
const { formatMessage } = (0, import_react_intl38.useIntl)();
|
|
18610
|
+
return async (response, fetchType) => {
|
|
18611
|
+
try {
|
|
18612
|
+
const errorResponse = await parseErrorResponse(response);
|
|
18613
|
+
return errorResponse;
|
|
18614
|
+
} catch (error) {
|
|
18615
|
+
if (fetchType === "submission") {
|
|
18616
|
+
return { error: formatMessage(generic_error_messages_default.genericErrorRetryHint) };
|
|
18617
|
+
}
|
|
18618
|
+
throw error;
|
|
18619
|
+
}
|
|
18620
|
+
};
|
|
18621
|
+
};
|
|
18622
|
+
|
|
18561
18623
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
18562
|
-
var
|
|
18624
|
+
var import_jsx_runtime127 = require("react/jsx-runtime");
|
|
18563
18625
|
var noop7 = () => {
|
|
18564
18626
|
};
|
|
18565
18627
|
var DynamicFlowComponent = ({
|
|
@@ -18587,7 +18649,7 @@ var DynamicFlowComponent = ({
|
|
|
18587
18649
|
setStepAndEtag,
|
|
18588
18650
|
setSchemaModel
|
|
18589
18651
|
} = useDynamicFlowState(initialStep);
|
|
18590
|
-
const [submitted, setSubmitted] = (0,
|
|
18652
|
+
const [submitted, setSubmitted] = (0, import_react65.useState)(false);
|
|
18591
18653
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
18592
18654
|
loaderConfig,
|
|
18593
18655
|
initialStep ? "idle" : "initial"
|
|
@@ -18605,18 +18667,18 @@ var DynamicFlowComponent = ({
|
|
|
18605
18667
|
);
|
|
18606
18668
|
}
|
|
18607
18669
|
};
|
|
18608
|
-
const analyticsMetadata = (0,
|
|
18670
|
+
const analyticsMetadata = (0, import_react65.useMemo)(
|
|
18609
18671
|
() => {
|
|
18610
18672
|
var _a;
|
|
18611
18673
|
return __spreadValues({ flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key) }, (_a = step == null ? void 0 : step.analytics) != null ? _a : {});
|
|
18612
18674
|
},
|
|
18613
18675
|
[flowId, step]
|
|
18614
18676
|
);
|
|
18615
|
-
const dispatchEvent = (0,
|
|
18677
|
+
const dispatchEvent = (0, import_react65.useMemo)(
|
|
18616
18678
|
() => getEventDispatcher(onEvent, analyticsMetadata),
|
|
18617
18679
|
[onEvent, analyticsMetadata]
|
|
18618
18680
|
);
|
|
18619
|
-
const dfHttpClient = (0,
|
|
18681
|
+
const dfHttpClient = (0, import_react65.useCallback)(
|
|
18620
18682
|
({
|
|
18621
18683
|
action,
|
|
18622
18684
|
data,
|
|
@@ -18667,17 +18729,17 @@ var DynamicFlowComponent = ({
|
|
|
18667
18729
|
dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
|
|
18668
18730
|
};
|
|
18669
18731
|
const { debouncedRefresh, isDebouncing, cancelPendingRefreshes } = useDebouncedRefresh(performRefresh);
|
|
18670
|
-
const dispatchEventAndComplete = (0,
|
|
18732
|
+
const dispatchEventAndComplete = (0, import_react65.useCallback)(
|
|
18671
18733
|
(result) => {
|
|
18672
18734
|
dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
|
|
18673
18735
|
onCompletion(result);
|
|
18674
18736
|
},
|
|
18675
18737
|
[onCompletion, dispatchEvent]
|
|
18676
18738
|
);
|
|
18677
|
-
(0,
|
|
18739
|
+
(0, import_react65.useEffect)(() => {
|
|
18678
18740
|
dispatchEvent("Dynamic Flow - Flow Started", {});
|
|
18679
18741
|
}, []);
|
|
18680
|
-
(0,
|
|
18742
|
+
(0, import_react65.useEffect)(() => {
|
|
18681
18743
|
if (!initialStep) {
|
|
18682
18744
|
const action = __spreadValues({
|
|
18683
18745
|
id: "#initial-step-request",
|
|
@@ -18689,6 +18751,7 @@ var DynamicFlowComponent = ({
|
|
|
18689
18751
|
warnIfNoStepLayout(initialStep);
|
|
18690
18752
|
}
|
|
18691
18753
|
}, [httpClient, JSON.stringify(initialStep), JSON.stringify(initialAction)]);
|
|
18754
|
+
const getErrorResponse = useErrorResponse();
|
|
18692
18755
|
const handleResponse = async (response, fetchType, actionResult) => {
|
|
18693
18756
|
try {
|
|
18694
18757
|
if (response.status === 304) {
|
|
@@ -18696,7 +18759,7 @@ var DynamicFlowComponent = ({
|
|
|
18696
18759
|
return;
|
|
18697
18760
|
}
|
|
18698
18761
|
if (!response.ok) {
|
|
18699
|
-
const errorResponse = await
|
|
18762
|
+
const errorResponse = await getErrorResponse(response, fetchType);
|
|
18700
18763
|
void updateAfterError(errorResponse);
|
|
18701
18764
|
return;
|
|
18702
18765
|
}
|
|
@@ -18797,7 +18860,7 @@ var DynamicFlowComponent = ({
|
|
|
18797
18860
|
await performAction(action);
|
|
18798
18861
|
}
|
|
18799
18862
|
};
|
|
18800
|
-
return /* @__PURE__ */ (0,
|
|
18863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(DynamicFlowProvider, { loading: isLoading || isDebouncing, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(HttpClientProvider, { httpClient, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(FeatureContextProvider, { features, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(
|
|
18801
18864
|
DynamicFlowStep,
|
|
18802
18865
|
{
|
|
18803
18866
|
step,
|
|
@@ -18814,7 +18877,7 @@ var DynamicFlowComponent = ({
|
|
|
18814
18877
|
) }) }) }) }) });
|
|
18815
18878
|
};
|
|
18816
18879
|
function DynamicFlow(props) {
|
|
18817
|
-
return /* @__PURE__ */ (0,
|
|
18880
|
+
return /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime127.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
|
|
18818
18881
|
}
|
|
18819
18882
|
var DynamicFlow_default = DynamicFlow;
|
|
18820
18883
|
var combineModels2 = (formModels) => Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
@@ -18831,19 +18894,19 @@ var shouldTriggerRefresh = (props) => {
|
|
|
18831
18894
|
};
|
|
18832
18895
|
|
|
18833
18896
|
// src/legacy/jsonSchemaForm/JsonSchemaForm.tsx
|
|
18834
|
-
var
|
|
18897
|
+
var import_jsx_runtime128 = require("react/jsx-runtime");
|
|
18835
18898
|
function JsonSchemaForm(props) {
|
|
18836
18899
|
const schemaProps = __spreadValues({
|
|
18837
18900
|
model: null,
|
|
18838
18901
|
errors: null
|
|
18839
18902
|
}, props);
|
|
18840
18903
|
const { baseUrl = "", onEvent = noop8, onLog = noop8 } = props;
|
|
18841
|
-
return /* @__PURE__ */ (0,
|
|
18904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(
|
|
18842
18905
|
EventsContextProvider,
|
|
18843
18906
|
{
|
|
18844
18907
|
metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
|
|
18845
18908
|
onEvent,
|
|
18846
|
-
children: /* @__PURE__ */ (0,
|
|
18909
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: /* @__PURE__ */ (0, import_jsx_runtime128.jsx)(GenericSchema_default, __spreadValues({}, schemaProps)) })
|
|
18847
18910
|
}
|
|
18848
18911
|
) });
|
|
18849
18912
|
}
|