@wise/dynamic-flow-client-internal 4.15.7 → 4.16.0-exp-modal-renderer-8e5c27a
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 +999 -1037
- package/build/main.mjs +999 -1037
- package/build/types/dynamicFlow/DynamicFlow.d.ts +1 -1
- package/package.json +5 -5
package/build/main.js
CHANGED
|
@@ -725,119 +725,16 @@ var mapCtaToAlertAction = (callToAction) => {
|
|
|
725
725
|
}
|
|
726
726
|
return void 0;
|
|
727
727
|
};
|
|
728
|
-
var AlertRenderer_default = AlertRenderer;
|
|
729
|
-
|
|
730
|
-
// ../renderers/src/components/FieldInput.tsx
|
|
731
|
-
var import_components3 = require("@transferwise/components");
|
|
732
|
-
|
|
733
|
-
// ../renderers/src/components/Help.tsx
|
|
734
|
-
var import_components2 = require("@transferwise/components");
|
|
735
|
-
var import_react_intl2 = require("react-intl");
|
|
736
|
-
|
|
737
|
-
// ../renderers/src/messages/help.messages.ts
|
|
738
|
-
var import_react_intl = require("react-intl");
|
|
739
|
-
var help_messages_default = (0, import_react_intl.defineMessages)({
|
|
740
|
-
helpAria: {
|
|
741
|
-
id: "df.wise.Help.ariaLabel",
|
|
742
|
-
defaultMessage: "Click here for more info.",
|
|
743
|
-
description: "Aria label for help."
|
|
744
|
-
}
|
|
745
|
-
});
|
|
746
|
-
|
|
747
|
-
// ../renderers/src/components/Help.tsx
|
|
748
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
749
|
-
function Help({ help, onClick }) {
|
|
750
|
-
const intl = (0, import_react_intl2.useIntl)();
|
|
751
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
752
|
-
import_components2.Info,
|
|
753
|
-
{
|
|
754
|
-
className: "m-l-1",
|
|
755
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_components2.Markdown, { config: { link: { target: "_blank" } }, children: help }),
|
|
756
|
-
presentation: "POPOVER",
|
|
757
|
-
size: "sm",
|
|
758
|
-
"aria-label": intl.formatMessage(help_messages_default.helpAria),
|
|
759
|
-
onClick
|
|
760
|
-
}
|
|
761
|
-
);
|
|
762
|
-
}
|
|
763
|
-
var Help_default = Help;
|
|
764
|
-
|
|
765
|
-
// ../renderers/src/components/LabelContentWithHelp.tsx
|
|
766
|
-
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
767
|
-
function LabelContentWithHelp({ text, help }) {
|
|
768
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
|
|
769
|
-
text,
|
|
770
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Help_default, { help })
|
|
771
|
-
] });
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
// ../renderers/src/components/FieldInput.tsx
|
|
775
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
776
|
-
function FieldInput({ id, children, label, validation, description, help }) {
|
|
777
|
-
const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LabelContentWithHelp, { text: label, help }) : label;
|
|
778
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
779
|
-
import_components3.Field,
|
|
780
|
-
{
|
|
781
|
-
id,
|
|
782
|
-
label: labelContent,
|
|
783
|
-
description,
|
|
784
|
-
message: validation == null ? void 0 : validation.message,
|
|
785
|
-
sentiment: mapStatusToSentiment(validation),
|
|
786
|
-
children
|
|
787
|
-
}
|
|
788
|
-
);
|
|
789
|
-
}
|
|
790
|
-
var mapStatusToSentiment = (validation) => {
|
|
791
|
-
if (validation) {
|
|
792
|
-
if (validation.status === "valid") {
|
|
793
|
-
return "positive";
|
|
794
|
-
}
|
|
795
|
-
return "negative";
|
|
796
|
-
}
|
|
797
|
-
return void 0;
|
|
798
|
-
};
|
|
799
|
-
var FieldInput_default = FieldInput;
|
|
800
|
-
|
|
801
|
-
// ../renderers/src/CheckboxInputRenderer.tsx
|
|
802
|
-
var import_components4 = require("@transferwise/components");
|
|
803
|
-
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
804
|
-
var CheckboxInputRenderer = {
|
|
805
|
-
canRenderType: "input-checkbox",
|
|
806
|
-
render: (props) => {
|
|
807
|
-
const _a = props, {
|
|
808
|
-
id,
|
|
809
|
-
control,
|
|
810
|
-
title = "",
|
|
811
|
-
description,
|
|
812
|
-
help,
|
|
813
|
-
type,
|
|
814
|
-
validationState,
|
|
815
|
-
value
|
|
816
|
-
} = _a, rest = __objRest(_a, [
|
|
817
|
-
"id",
|
|
818
|
-
"control",
|
|
819
|
-
"title",
|
|
820
|
-
"description",
|
|
821
|
-
"help",
|
|
822
|
-
"type",
|
|
823
|
-
"validationState",
|
|
824
|
-
"value"
|
|
825
|
-
]);
|
|
826
|
-
const checkboxProps = __spreadProps(__spreadValues({}, rest), { label: title, secondary: description, checked: value });
|
|
827
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(FieldInput_default, { id, label: "", description: "", validation: validationState, help, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_components4.Checkbox, __spreadValues({ id }, checkboxProps)) });
|
|
828
|
-
}
|
|
829
|
-
};
|
|
830
|
-
var CheckboxInputRenderer_default = CheckboxInputRenderer;
|
|
831
728
|
|
|
832
729
|
// ../renderers/src/BoxRenderer.tsx
|
|
833
730
|
var import_classnames = __toESM(require("classnames"));
|
|
834
|
-
var
|
|
731
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
835
732
|
var BoxRenderer = {
|
|
836
733
|
canRenderType: "box",
|
|
837
734
|
render: ({ children, control, margin, width }) => {
|
|
838
735
|
const hasFixedWidth = width !== "xl";
|
|
839
736
|
const hasBorder = control === "bordered" || control === "bordered-web";
|
|
840
|
-
const contents = /* @__PURE__ */ (0,
|
|
737
|
+
const contents = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
841
738
|
"div",
|
|
842
739
|
{
|
|
843
740
|
className: (0, import_classnames.default)({
|
|
@@ -848,15 +745,14 @@ var BoxRenderer = {
|
|
|
848
745
|
children
|
|
849
746
|
}
|
|
850
747
|
);
|
|
851
|
-
return hasFixedWidth ? /* @__PURE__ */ (0,
|
|
748
|
+
return hasFixedWidth ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: (0, import_classnames.default)("df-box-renderer-fixed-width", getMargin(margin)), children: contents }) : contents;
|
|
852
749
|
}
|
|
853
750
|
};
|
|
854
|
-
var BoxRenderer_default = BoxRenderer;
|
|
855
751
|
|
|
856
752
|
// ../renderers/src/ButtonRenderer.tsx
|
|
857
|
-
var
|
|
753
|
+
var import_components2 = require("@transferwise/components");
|
|
858
754
|
var import_react = require("react");
|
|
859
|
-
var
|
|
755
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
860
756
|
var ButtonRenderer = {
|
|
861
757
|
canRenderType: "button",
|
|
862
758
|
render: ButtonComponent
|
|
@@ -867,8 +763,8 @@ function ButtonComponent(props) {
|
|
|
867
763
|
const isLoading = isActive && stepLoadingState !== "idle";
|
|
868
764
|
const priority = mapControl(control);
|
|
869
765
|
const type = priority === "tertiary" ? void 0 : mapContext(context);
|
|
870
|
-
return /* @__PURE__ */ (0,
|
|
871
|
-
|
|
766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
767
|
+
import_components2.Button,
|
|
872
768
|
{
|
|
873
769
|
block: true,
|
|
874
770
|
className: getMargin(margin),
|
|
@@ -922,7 +818,109 @@ var mapSize = (size) => {
|
|
|
922
818
|
return "md";
|
|
923
819
|
}
|
|
924
820
|
};
|
|
925
|
-
|
|
821
|
+
|
|
822
|
+
// ../renderers/src/CheckboxInputRenderer.tsx
|
|
823
|
+
var import_components5 = require("@transferwise/components");
|
|
824
|
+
|
|
825
|
+
// ../renderers/src/components/FieldInput.tsx
|
|
826
|
+
var import_components4 = require("@transferwise/components");
|
|
827
|
+
|
|
828
|
+
// ../renderers/src/components/Help.tsx
|
|
829
|
+
var import_components3 = require("@transferwise/components");
|
|
830
|
+
var import_react_intl2 = require("react-intl");
|
|
831
|
+
|
|
832
|
+
// ../renderers/src/messages/help.messages.ts
|
|
833
|
+
var import_react_intl = require("react-intl");
|
|
834
|
+
var help_messages_default = (0, import_react_intl.defineMessages)({
|
|
835
|
+
helpAria: {
|
|
836
|
+
id: "df.wise.Help.ariaLabel",
|
|
837
|
+
defaultMessage: "Click here for more info.",
|
|
838
|
+
description: "Aria label for help."
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
|
|
842
|
+
// ../renderers/src/components/Help.tsx
|
|
843
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
844
|
+
function Help({ help, onClick }) {
|
|
845
|
+
const intl = (0, import_react_intl2.useIntl)();
|
|
846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
847
|
+
import_components3.Info,
|
|
848
|
+
{
|
|
849
|
+
className: "m-l-1",
|
|
850
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_components3.Markdown, { config: { link: { target: "_blank" } }, children: help }),
|
|
851
|
+
presentation: "POPOVER",
|
|
852
|
+
size: "sm",
|
|
853
|
+
"aria-label": intl.formatMessage(help_messages_default.helpAria),
|
|
854
|
+
onClick
|
|
855
|
+
}
|
|
856
|
+
);
|
|
857
|
+
}
|
|
858
|
+
var Help_default = Help;
|
|
859
|
+
|
|
860
|
+
// ../renderers/src/components/LabelContentWithHelp.tsx
|
|
861
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
862
|
+
function LabelContentWithHelp({ text, help }) {
|
|
863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
|
|
864
|
+
text,
|
|
865
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Help_default, { help })
|
|
866
|
+
] });
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
// ../renderers/src/components/FieldInput.tsx
|
|
870
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
871
|
+
function FieldInput({ id, children, label, validation, description, help }) {
|
|
872
|
+
const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LabelContentWithHelp, { text: label, help }) : label;
|
|
873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
874
|
+
import_components4.Field,
|
|
875
|
+
{
|
|
876
|
+
id,
|
|
877
|
+
label: labelContent,
|
|
878
|
+
description,
|
|
879
|
+
message: validation == null ? void 0 : validation.message,
|
|
880
|
+
sentiment: mapStatusToSentiment(validation),
|
|
881
|
+
children
|
|
882
|
+
}
|
|
883
|
+
);
|
|
884
|
+
}
|
|
885
|
+
var mapStatusToSentiment = (validation) => {
|
|
886
|
+
if (validation) {
|
|
887
|
+
if (validation.status === "valid") {
|
|
888
|
+
return "positive";
|
|
889
|
+
}
|
|
890
|
+
return "negative";
|
|
891
|
+
}
|
|
892
|
+
return void 0;
|
|
893
|
+
};
|
|
894
|
+
var FieldInput_default = FieldInput;
|
|
895
|
+
|
|
896
|
+
// ../renderers/src/CheckboxInputRenderer.tsx
|
|
897
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
898
|
+
var CheckboxInputRenderer = {
|
|
899
|
+
canRenderType: "input-checkbox",
|
|
900
|
+
render: (props) => {
|
|
901
|
+
const _a = props, {
|
|
902
|
+
id,
|
|
903
|
+
control,
|
|
904
|
+
title = "",
|
|
905
|
+
description,
|
|
906
|
+
help,
|
|
907
|
+
type,
|
|
908
|
+
validationState,
|
|
909
|
+
value
|
|
910
|
+
} = _a, rest = __objRest(_a, [
|
|
911
|
+
"id",
|
|
912
|
+
"control",
|
|
913
|
+
"title",
|
|
914
|
+
"description",
|
|
915
|
+
"help",
|
|
916
|
+
"type",
|
|
917
|
+
"validationState",
|
|
918
|
+
"value"
|
|
919
|
+
]);
|
|
920
|
+
const checkboxProps = __spreadProps(__spreadValues({}, rest), { label: title, secondary: description, checked: value });
|
|
921
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FieldInput_default, { id, label: "", description: "", validation: validationState, help, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_components5.Checkbox, __spreadValues({ id }, checkboxProps)) });
|
|
922
|
+
}
|
|
923
|
+
};
|
|
926
924
|
|
|
927
925
|
// ../renderers/src/ColumnsRenderer.tsx
|
|
928
926
|
var import_classnames2 = __toESM(require("classnames"));
|
|
@@ -943,7 +941,6 @@ var ColumnsRenderer = {
|
|
|
943
941
|
}
|
|
944
942
|
)
|
|
945
943
|
};
|
|
946
|
-
var ColumnsRenderer_default = ColumnsRenderer;
|
|
947
944
|
|
|
948
945
|
// ../renderers/src/components/VariableDateInput.tsx
|
|
949
946
|
var import_components6 = require("@transferwise/components");
|
|
@@ -1060,7 +1057,6 @@ var DateInputRenderer = {
|
|
|
1060
1057
|
);
|
|
1061
1058
|
}
|
|
1062
1059
|
};
|
|
1063
|
-
var DateInputRenderer_default = DateInputRenderer;
|
|
1064
1060
|
|
|
1065
1061
|
// ../renderers/src/DecisionRenderer.tsx
|
|
1066
1062
|
var import_components9 = require("@transferwise/components");
|
|
@@ -1214,7 +1210,6 @@ var DecisionRenderer = {
|
|
|
1214
1210
|
}) })
|
|
1215
1211
|
] })
|
|
1216
1212
|
};
|
|
1217
|
-
var DecisionRenderer_default = DecisionRenderer;
|
|
1218
1213
|
|
|
1219
1214
|
// ../renderers/src/DividerRenderer.tsx
|
|
1220
1215
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
@@ -1222,51 +1217,139 @@ var DividerRenderer = {
|
|
|
1222
1217
|
canRenderType: "divider",
|
|
1223
1218
|
render: ({ margin }) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("hr", { className: `m-t-0 ${getMargin(margin)}` })
|
|
1224
1219
|
};
|
|
1225
|
-
var DividerRenderer_default = DividerRenderer;
|
|
1226
|
-
|
|
1227
|
-
// ../renderers/src/FormRenderer.tsx
|
|
1228
|
-
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1229
|
-
var FormRenderer = {
|
|
1230
|
-
canRenderType: "form",
|
|
1231
|
-
render: ({ children, margin }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: getMargin(margin), children })
|
|
1232
|
-
};
|
|
1233
|
-
var FormRenderer_default = FormRenderer;
|
|
1234
1220
|
|
|
1235
|
-
// ../renderers/src/
|
|
1221
|
+
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1236
1222
|
var import_components10 = require("@transferwise/components");
|
|
1237
|
-
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1238
|
-
var FormSectionRenderer = {
|
|
1239
|
-
canRenderType: "form-section",
|
|
1240
|
-
render: ({ title, description, children }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("fieldset", { children: [
|
|
1241
|
-
title && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
1242
|
-
import_components10.Header,
|
|
1243
|
-
{
|
|
1244
|
-
as: "h2",
|
|
1245
|
-
title
|
|
1246
|
-
}
|
|
1247
|
-
),
|
|
1248
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { children: description }),
|
|
1249
|
-
children
|
|
1250
|
-
] })
|
|
1251
|
-
};
|
|
1252
|
-
var FormSectionRenderer_default = FormSectionRenderer;
|
|
1253
1223
|
|
|
1254
|
-
// ../renderers/src/
|
|
1255
|
-
var
|
|
1256
|
-
var
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1224
|
+
// ../renderers/src/messages/external-confirmation.messages.ts
|
|
1225
|
+
var import_react_intl3 = require("react-intl");
|
|
1226
|
+
var external_confirmation_messages_default = (0, import_react_intl3.defineMessages)({
|
|
1227
|
+
title: {
|
|
1228
|
+
id: "df.wise.ExternalConfirmation.title",
|
|
1229
|
+
defaultMessage: "Please confirm",
|
|
1230
|
+
description: "Heading for the confirmation screen."
|
|
1231
|
+
},
|
|
1232
|
+
description: {
|
|
1233
|
+
id: "df.wise.ExternalConfirmation.description",
|
|
1234
|
+
defaultMessage: "Please confirm you want to open **{origin}** in a new browser tab.",
|
|
1235
|
+
description: "Description for the confirmation screen."
|
|
1236
|
+
},
|
|
1237
|
+
open: {
|
|
1238
|
+
id: "df.wise.ExternalConfirmation.open",
|
|
1239
|
+
defaultMessage: "Open in new tab",
|
|
1240
|
+
description: "Button text confirming opening a new browser tab."
|
|
1241
|
+
},
|
|
1242
|
+
cancel: {
|
|
1243
|
+
id: "df.wise.ExternalConfirmation.cancel",
|
|
1244
|
+
defaultMessage: "Cancel",
|
|
1245
|
+
description: "Button text rejecting opening a new browser tab."
|
|
1246
|
+
}
|
|
1247
|
+
});
|
|
1248
|
+
|
|
1249
|
+
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
1250
|
+
var import_react_intl4 = require("react-intl");
|
|
1251
|
+
var import_react2 = require("react");
|
|
1252
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
1253
|
+
var ExternalConfirmationRenderer = {
|
|
1254
|
+
canRenderType: "external-confirmation",
|
|
1255
|
+
render: ExternalConfirmationRendererComponent
|
|
1260
1256
|
};
|
|
1261
|
-
function
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1257
|
+
function ExternalConfirmationRendererComponent({
|
|
1258
|
+
url,
|
|
1259
|
+
status,
|
|
1260
|
+
onSuccess,
|
|
1261
|
+
onFailure,
|
|
1262
|
+
onCancel
|
|
1263
|
+
}) {
|
|
1264
|
+
const { formatMessage } = (0, import_react_intl4.useIntl)();
|
|
1265
|
+
(0, import_react2.useEffect)(() => {
|
|
1266
|
+
if (url) {
|
|
1267
|
+
const w = window.open(url, "_blank");
|
|
1268
|
+
if (w) {
|
|
1269
|
+
onSuccess();
|
|
1270
|
+
} else {
|
|
1271
|
+
onFailure();
|
|
1272
|
+
}
|
|
1273
|
+
}
|
|
1274
|
+
}, []);
|
|
1275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1276
|
+
import_components10.Modal,
|
|
1277
|
+
{
|
|
1278
|
+
open: status === "failure",
|
|
1279
|
+
title: formatMessage(external_confirmation_messages_default.title),
|
|
1280
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
1281
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components10.Markdown, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(url) }) }),
|
|
1282
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "df-box-renderer-width-lg", children: [
|
|
1283
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
1284
|
+
import_components10.Button,
|
|
1285
|
+
{
|
|
1286
|
+
block: true,
|
|
1287
|
+
className: "m-b-2",
|
|
1288
|
+
priority: "primary",
|
|
1289
|
+
size: "md",
|
|
1290
|
+
onClick: () => {
|
|
1291
|
+
window.open(url);
|
|
1292
|
+
onCancel();
|
|
1293
|
+
},
|
|
1294
|
+
children: formatMessage(external_confirmation_messages_default.open)
|
|
1295
|
+
}
|
|
1296
|
+
),
|
|
1297
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components10.Button, { block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onCancel, children: formatMessage(external_confirmation_messages_default.cancel) })
|
|
1298
|
+
] }) })
|
|
1299
|
+
] }),
|
|
1300
|
+
onClose: onCancel
|
|
1301
|
+
}
|
|
1302
|
+
);
|
|
1303
|
+
}
|
|
1304
|
+
function getOrigin(url) {
|
|
1305
|
+
try {
|
|
1306
|
+
return new URL(url).origin;
|
|
1307
|
+
} catch (e) {
|
|
1308
|
+
return url;
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
// ../renderers/src/FormRenderer.tsx
|
|
1313
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
1314
|
+
var FormRenderer = {
|
|
1315
|
+
canRenderType: "form",
|
|
1316
|
+
render: ({ children, margin }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: getMargin(margin), children })
|
|
1317
|
+
};
|
|
1318
|
+
|
|
1319
|
+
// ../renderers/src/FormSectionRenderer.tsx
|
|
1320
|
+
var import_components11 = require("@transferwise/components");
|
|
1321
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
1322
|
+
var FormSectionRenderer = {
|
|
1323
|
+
canRenderType: "form-section",
|
|
1324
|
+
render: ({ title, description, children }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("fieldset", { children: [
|
|
1325
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
1326
|
+
import_components11.Header,
|
|
1327
|
+
{
|
|
1328
|
+
as: "h2",
|
|
1329
|
+
title
|
|
1330
|
+
}
|
|
1331
|
+
),
|
|
1332
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { children: description }),
|
|
1333
|
+
children
|
|
1334
|
+
] })
|
|
1335
|
+
};
|
|
1336
|
+
|
|
1337
|
+
// ../renderers/src/HeadingRenderer.tsx
|
|
1338
|
+
var import_components12 = require("@transferwise/components");
|
|
1339
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
1340
|
+
var HeadingRenderer = {
|
|
1341
|
+
canRenderType: "heading",
|
|
1342
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Heading, __spreadValues({}, props))
|
|
1343
|
+
};
|
|
1344
|
+
function Heading(props) {
|
|
1345
|
+
const { text, size, align, margin, control } = props;
|
|
1346
|
+
const className = getTextAlignmentAndMargin({ align, margin });
|
|
1347
|
+
return control === "display" ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(DisplayHeading, { size, text, className }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(StandardHeading, { size, text, className });
|
|
1348
|
+
}
|
|
1349
|
+
function DisplayHeading({ size, text, className }) {
|
|
1350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_components12.Display, { type: getDisplayType(size), className, children: text });
|
|
1351
|
+
}
|
|
1352
|
+
var getDisplayType = (size) => {
|
|
1270
1353
|
switch (size) {
|
|
1271
1354
|
case "xs":
|
|
1272
1355
|
case "sm":
|
|
@@ -1280,7 +1363,7 @@ var getDisplayType = (size) => {
|
|
|
1280
1363
|
}
|
|
1281
1364
|
};
|
|
1282
1365
|
function StandardHeading({ size, text, className }) {
|
|
1283
|
-
return /* @__PURE__ */ (0,
|
|
1366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_components12.Title, { type: getTitleTypeBySize(size), className, children: text });
|
|
1284
1367
|
}
|
|
1285
1368
|
var getTitleTypeBySize = (size) => {
|
|
1286
1369
|
var _a;
|
|
@@ -1293,11 +1376,10 @@ var getTitleTypeBySize = (size) => {
|
|
|
1293
1376
|
};
|
|
1294
1377
|
return (_a = titleTypes[size]) != null ? _a : "title-subsection";
|
|
1295
1378
|
};
|
|
1296
|
-
var HeadingRenderer_default = HeadingRenderer;
|
|
1297
1379
|
|
|
1298
1380
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1299
|
-
var
|
|
1300
|
-
var
|
|
1381
|
+
var import_components13 = require("@transferwise/components");
|
|
1382
|
+
var import_react3 = require("react");
|
|
1301
1383
|
|
|
1302
1384
|
// ../renderers/src/utils/api-utils.ts
|
|
1303
1385
|
function isRelativePath(url = "") {
|
|
@@ -1307,7 +1389,7 @@ function isRelativePath(url = "") {
|
|
|
1307
1389
|
}
|
|
1308
1390
|
|
|
1309
1391
|
// ../renderers/src/ImageRenderer/UrlImage.tsx
|
|
1310
|
-
var
|
|
1392
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
1311
1393
|
function UrlImage({
|
|
1312
1394
|
accessibilityDescription,
|
|
1313
1395
|
align,
|
|
@@ -1316,14 +1398,14 @@ function UrlImage({
|
|
|
1316
1398
|
uri,
|
|
1317
1399
|
httpClient
|
|
1318
1400
|
}) {
|
|
1319
|
-
const [imageSource, setImageSource] = (0,
|
|
1320
|
-
(0,
|
|
1401
|
+
const [imageSource, setImageSource] = (0, import_react3.useState)("");
|
|
1402
|
+
(0, import_react3.useEffect)(() => {
|
|
1321
1403
|
if (!uri.startsWith("urn:")) {
|
|
1322
1404
|
void getImageSource(httpClient, uri).then(setImageSource);
|
|
1323
1405
|
}
|
|
1324
1406
|
}, [uri, httpClient]);
|
|
1325
|
-
return /* @__PURE__ */ (0,
|
|
1326
|
-
|
|
1407
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: `df-image ${align} ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
1408
|
+
import_components13.Image,
|
|
1327
1409
|
{
|
|
1328
1410
|
className: `img-responsive ${getMargin(margin)}`,
|
|
1329
1411
|
alt: accessibilityDescription != null ? accessibilityDescription : "",
|
|
@@ -1366,7 +1448,7 @@ var getImageSource = async (httpClient, imageUrl) => {
|
|
|
1366
1448
|
};
|
|
1367
1449
|
|
|
1368
1450
|
// ../renderers/src/ImageRenderer/UrnFlagImage.tsx
|
|
1369
|
-
var
|
|
1451
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
1370
1452
|
var maxFlagSize = 600;
|
|
1371
1453
|
function UrnFlagImage({
|
|
1372
1454
|
accessibilityDescription,
|
|
@@ -1375,7 +1457,7 @@ function UrnFlagImage({
|
|
|
1375
1457
|
size,
|
|
1376
1458
|
uri
|
|
1377
1459
|
}) {
|
|
1378
|
-
return /* @__PURE__ */ (0,
|
|
1460
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `df-image ${align} ${size || "md"} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(UrnFlag, { size: maxFlagSize, urn: uri, accessibilityDescription }) });
|
|
1379
1461
|
}
|
|
1380
1462
|
|
|
1381
1463
|
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
@@ -1395,7 +1477,7 @@ var isAnimated = (uri) => {
|
|
|
1395
1477
|
};
|
|
1396
1478
|
|
|
1397
1479
|
// ../renderers/src/ImageRenderer/UrnIllustration.tsx
|
|
1398
|
-
var
|
|
1480
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
1399
1481
|
var urnPrefix = "urn:wise:illustrations:";
|
|
1400
1482
|
var isUrnIllustration = (uri) => uri.startsWith(urnPrefix);
|
|
1401
1483
|
function UrnIllustration({
|
|
@@ -1409,9 +1491,9 @@ function UrnIllustration({
|
|
|
1409
1491
|
const illustrationName = getIllustrationName(uri);
|
|
1410
1492
|
const illustration3DName = getIllustration3DName(uri);
|
|
1411
1493
|
if (illustration3DName && isAnimated(uri)) {
|
|
1412
|
-
return /* @__PURE__ */ (0,
|
|
1494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_art3.Illustration3D, { name: illustration3DName, size: illustrationSize }) });
|
|
1413
1495
|
}
|
|
1414
|
-
return /* @__PURE__ */ (0,
|
|
1496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
1415
1497
|
import_art3.Illustration,
|
|
1416
1498
|
{
|
|
1417
1499
|
className: "df-illustration",
|
|
@@ -1431,32 +1513,29 @@ var getIllustration3DName = (uri) => {
|
|
|
1431
1513
|
};
|
|
1432
1514
|
|
|
1433
1515
|
// ../renderers/src/ImageRenderer/UrnImage.tsx
|
|
1434
|
-
var
|
|
1516
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
1435
1517
|
var isUrnImage = (uri) => uri.startsWith("urn:");
|
|
1436
1518
|
function UrnImage(props) {
|
|
1437
1519
|
const { uri } = props;
|
|
1438
1520
|
if (isUrnIllustration(uri)) {
|
|
1439
|
-
return /* @__PURE__ */ (0,
|
|
1521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UrnIllustration, __spreadValues({}, props));
|
|
1440
1522
|
}
|
|
1441
1523
|
if (isUrnFlag(uri)) {
|
|
1442
|
-
return /* @__PURE__ */ (0,
|
|
1524
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(UrnFlagImage, __spreadValues({}, props));
|
|
1443
1525
|
}
|
|
1444
1526
|
return null;
|
|
1445
1527
|
}
|
|
1446
1528
|
|
|
1447
1529
|
// ../renderers/src/ImageRenderer/ImageRenderer.tsx
|
|
1448
|
-
var
|
|
1530
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
1449
1531
|
var ImageRenderer = {
|
|
1450
1532
|
canRenderType: "image",
|
|
1451
|
-
render: (props) => isUrnImage(props.uri) ? /* @__PURE__ */ (0,
|
|
1533
|
+
render: (props) => isUrnImage(props.uri) ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(UrnImage, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(UrlImage, __spreadValues({}, props))
|
|
1452
1534
|
};
|
|
1453
1535
|
|
|
1454
|
-
// ../renderers/src/ImageRenderer/index.tsx
|
|
1455
|
-
var ImageRenderer_default = ImageRenderer;
|
|
1456
|
-
|
|
1457
1536
|
// ../renderers/src/InstructionsRenderer.tsx
|
|
1458
|
-
var
|
|
1459
|
-
var
|
|
1537
|
+
var import_components14 = require("@transferwise/components");
|
|
1538
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
1460
1539
|
var doContext = ["positive", "neutral"];
|
|
1461
1540
|
var dontContext = ["warning", "negative"];
|
|
1462
1541
|
var InstructionsRenderer = {
|
|
@@ -1464,16 +1543,15 @@ var InstructionsRenderer = {
|
|
|
1464
1543
|
render: ({ items, margin, title }) => {
|
|
1465
1544
|
const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
|
|
1466
1545
|
const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
|
|
1467
|
-
return /* @__PURE__ */ (0,
|
|
1468
|
-
title ? /* @__PURE__ */ (0,
|
|
1469
|
-
/* @__PURE__ */ (0,
|
|
1546
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: getMargin(margin), children: [
|
|
1547
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components14.Header, { title }) : null,
|
|
1548
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_components14.InstructionsList, { dos, donts })
|
|
1470
1549
|
] });
|
|
1471
1550
|
}
|
|
1472
1551
|
};
|
|
1473
|
-
var InstructionsRenderer_default = InstructionsRenderer;
|
|
1474
1552
|
|
|
1475
1553
|
// ../renderers/src/IntegerInputRenderer.tsx
|
|
1476
|
-
var
|
|
1554
|
+
var import_components16 = require("@transferwise/components");
|
|
1477
1555
|
|
|
1478
1556
|
// ../renderers/src/utils/input-utils.ts
|
|
1479
1557
|
var onWheel = (event) => {
|
|
@@ -1483,8 +1561,8 @@ var onWheel = (event) => {
|
|
|
1483
1561
|
};
|
|
1484
1562
|
|
|
1485
1563
|
// ../renderers/src/utils/getInlineAvatar.tsx
|
|
1486
|
-
var
|
|
1487
|
-
var
|
|
1564
|
+
var import_components15 = require("@transferwise/components");
|
|
1565
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
1488
1566
|
var mediaSize2 = 24;
|
|
1489
1567
|
function getInlineAvatar({ icon, image }) {
|
|
1490
1568
|
const imageNode = getImageNode(image, mediaSize2);
|
|
@@ -1500,7 +1578,7 @@ function getInlineAvatar({ icon, image }) {
|
|
|
1500
1578
|
return iconNode;
|
|
1501
1579
|
}
|
|
1502
1580
|
if (iconNode) {
|
|
1503
|
-
return /* @__PURE__ */ (0,
|
|
1581
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components15.AvatarView, { size: mediaSize2, children: iconNode });
|
|
1504
1582
|
}
|
|
1505
1583
|
return null;
|
|
1506
1584
|
}
|
|
@@ -1523,7 +1601,7 @@ function pick(obj, ...keys) {
|
|
|
1523
1601
|
}
|
|
1524
1602
|
|
|
1525
1603
|
// ../renderers/src/IntegerInputRenderer.tsx
|
|
1526
|
-
var
|
|
1604
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
1527
1605
|
var IntegerInputRenderer = {
|
|
1528
1606
|
canRenderType: "input-integer",
|
|
1529
1607
|
render: (props) => {
|
|
@@ -1538,7 +1616,7 @@ var IntegerInputRenderer = {
|
|
|
1538
1616
|
"maximum",
|
|
1539
1617
|
"minimum"
|
|
1540
1618
|
);
|
|
1541
|
-
return /* @__PURE__ */ (0,
|
|
1619
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1542
1620
|
FieldInput_default,
|
|
1543
1621
|
{
|
|
1544
1622
|
id,
|
|
@@ -1546,8 +1624,8 @@ var IntegerInputRenderer = {
|
|
|
1546
1624
|
description,
|
|
1547
1625
|
validation: validationState,
|
|
1548
1626
|
help,
|
|
1549
|
-
children: /* @__PURE__ */ (0,
|
|
1550
|
-
|
|
1627
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components16.InputGroup, { addonStart: getInputGroupAddonStart({ icon, image }), children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
|
|
1628
|
+
import_components16.Input,
|
|
1551
1629
|
__spreadValues({
|
|
1552
1630
|
id,
|
|
1553
1631
|
name: id,
|
|
@@ -1566,15 +1644,86 @@ var IntegerInputRenderer = {
|
|
|
1566
1644
|
);
|
|
1567
1645
|
}
|
|
1568
1646
|
};
|
|
1569
|
-
|
|
1647
|
+
|
|
1648
|
+
// ../renderers/src/ListRenderer.tsx
|
|
1649
|
+
var import_components17 = require("@transferwise/components");
|
|
1650
|
+
var import_classnames3 = __toESM(require("classnames"));
|
|
1651
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
1652
|
+
var ListRenderer = {
|
|
1653
|
+
canRenderType: "list",
|
|
1654
|
+
render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: getMargin(margin), children: [
|
|
1655
|
+
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components17.Header, { as: "h2", title: title != null ? title : "", action: getListAction(callToAction) }),
|
|
1656
|
+
items.map((props) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(DesignSystemListItem, __spreadProps(__spreadValues({}, props), { control }), props.title))
|
|
1657
|
+
] })
|
|
1658
|
+
};
|
|
1659
|
+
var DesignSystemListItem = ({
|
|
1660
|
+
title,
|
|
1661
|
+
description,
|
|
1662
|
+
supportingValues,
|
|
1663
|
+
icon,
|
|
1664
|
+
image,
|
|
1665
|
+
control,
|
|
1666
|
+
tag
|
|
1667
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1668
|
+
"label",
|
|
1669
|
+
{
|
|
1670
|
+
className: (0, import_classnames3.default)("np-option p-a-2", {
|
|
1671
|
+
"np-option__sm-media": true,
|
|
1672
|
+
"np-option__container-aligned": true
|
|
1673
|
+
}),
|
|
1674
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "media", children: [
|
|
1675
|
+
icon || image ? /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "media-left", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
1676
|
+
ListItemMedia,
|
|
1677
|
+
{
|
|
1678
|
+
image,
|
|
1679
|
+
icon,
|
|
1680
|
+
preferAvatar: control === "with-avatar" || tag === "with-avatar"
|
|
1681
|
+
}
|
|
1682
|
+
) }) : null,
|
|
1683
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "media-body", children: [
|
|
1684
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "d-flex justify-content-between", children: [
|
|
1685
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: title }),
|
|
1686
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: supportingValues == null ? void 0 : supportingValues.value })
|
|
1687
|
+
] }),
|
|
1688
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "d-flex justify-content-between", children: [
|
|
1689
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components17.Body, { className: "d-block np-option__body", children: description }),
|
|
1690
|
+
/* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components17.Body, { className: "d-block np-option__body", children: supportingValues == null ? void 0 : supportingValues.subvalue })
|
|
1691
|
+
] })
|
|
1692
|
+
] })
|
|
1693
|
+
] })
|
|
1694
|
+
},
|
|
1695
|
+
title
|
|
1696
|
+
);
|
|
1697
|
+
var ListItemMedia = ({
|
|
1698
|
+
icon,
|
|
1699
|
+
image,
|
|
1700
|
+
preferAvatar
|
|
1701
|
+
}) => {
|
|
1702
|
+
if (icon) {
|
|
1703
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "circle circle-sm text-primary circle-inverse", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(OptionMedia, { icon, image, preferAvatar }) });
|
|
1704
|
+
}
|
|
1705
|
+
if (image) {
|
|
1706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(OptionMedia, { icon, image, preferAvatar }) });
|
|
1707
|
+
}
|
|
1708
|
+
};
|
|
1709
|
+
var getListAction = (callToAction) => {
|
|
1710
|
+
if (callToAction) {
|
|
1711
|
+
return __spreadValues({
|
|
1712
|
+
"aria-label": callToAction.accessibilityDescription,
|
|
1713
|
+
text: callToAction.title,
|
|
1714
|
+
onClick: callToAction.onClick
|
|
1715
|
+
}, callToAction.type === "link" ? { href: callToAction.href, target: "_blank" } : {});
|
|
1716
|
+
}
|
|
1717
|
+
return void 0;
|
|
1718
|
+
};
|
|
1570
1719
|
|
|
1571
1720
|
// ../renderers/src/LoadingIndicatorRenderer.tsx
|
|
1572
|
-
var
|
|
1573
|
-
var
|
|
1721
|
+
var import_components18 = require("@transferwise/components");
|
|
1722
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
1574
1723
|
var LoadingIndicatorRenderer = {
|
|
1575
1724
|
canRenderType: "loading-indicator",
|
|
1576
|
-
render: ({ margin, size }) => /* @__PURE__ */ (0,
|
|
1577
|
-
|
|
1725
|
+
render: ({ margin, size }) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
1726
|
+
import_components18.Loader,
|
|
1578
1727
|
{
|
|
1579
1728
|
size,
|
|
1580
1729
|
classNames: { "tw-loader": `tw-loader m-x-auto ${getMargin(margin)}` },
|
|
@@ -1582,33 +1731,40 @@ var LoadingIndicatorRenderer = {
|
|
|
1582
1731
|
}
|
|
1583
1732
|
)
|
|
1584
1733
|
};
|
|
1585
|
-
var LoadingIndicatorRenderer_default = LoadingIndicatorRenderer;
|
|
1586
1734
|
|
|
1587
1735
|
// ../renderers/src/MarkdownRenderer.tsx
|
|
1588
|
-
var
|
|
1589
|
-
var
|
|
1736
|
+
var import_components19 = require("@transferwise/components");
|
|
1737
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
1590
1738
|
var MarkdownRenderer = {
|
|
1591
1739
|
canRenderType: "markdown",
|
|
1592
|
-
render: ({ content, align, margin }) => /* @__PURE__ */ (0,
|
|
1740
|
+
render: ({ content, align, margin }) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_components19.Markdown, { className: "np-text-body-large", config: { link: { target: "_blank" } }, children: content }) })
|
|
1593
1741
|
};
|
|
1594
|
-
var MarkdownRenderer_default = MarkdownRenderer;
|
|
1595
1742
|
|
|
1596
|
-
// ../renderers/src/
|
|
1597
|
-
var
|
|
1598
|
-
var
|
|
1599
|
-
var
|
|
1600
|
-
var ModalRenderer = {
|
|
1743
|
+
// ../renderers/src/ModalContentRenderer.tsx
|
|
1744
|
+
var import_components20 = require("@transferwise/components");
|
|
1745
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
1746
|
+
var ModalContentRenderer = {
|
|
1601
1747
|
canRenderType: "modal",
|
|
1602
|
-
render: (
|
|
1748
|
+
render: ({ title, children, open, onClose }) => {
|
|
1749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_components20.Modal, { open, title, body: children, onClose });
|
|
1750
|
+
}
|
|
1751
|
+
};
|
|
1752
|
+
|
|
1753
|
+
// ../renderers/src/ModalLayoutRenderer.tsx
|
|
1754
|
+
var import_components21 = require("@transferwise/components");
|
|
1755
|
+
var import_react4 = require("react");
|
|
1756
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
1757
|
+
var ModalLayoutRenderer = {
|
|
1758
|
+
canRenderType: "modal-layout",
|
|
1759
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(DFModal, __spreadValues({}, props))
|
|
1603
1760
|
};
|
|
1604
|
-
var ModalRenderer_default = ModalRenderer;
|
|
1605
1761
|
function DFModal({ content, margin, trigger }) {
|
|
1606
|
-
const [visible, setVisible] = (0,
|
|
1762
|
+
const [visible, setVisible] = (0, import_react4.useState)(false);
|
|
1607
1763
|
const { children, title } = content;
|
|
1608
|
-
return /* @__PURE__ */ (0,
|
|
1609
|
-
/* @__PURE__ */ (0,
|
|
1610
|
-
/* @__PURE__ */ (0,
|
|
1611
|
-
|
|
1764
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: getMargin(margin), children: [
|
|
1765
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_components21.Button, { priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
|
|
1766
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
1767
|
+
import_components21.Modal,
|
|
1612
1768
|
{
|
|
1613
1769
|
scroll: "content",
|
|
1614
1770
|
open: visible,
|
|
@@ -1622,13 +1778,13 @@ function DFModal({ content, margin, trigger }) {
|
|
|
1622
1778
|
}
|
|
1623
1779
|
|
|
1624
1780
|
// ../renderers/src/MultiSelectInputRenderer.tsx
|
|
1625
|
-
var
|
|
1626
|
-
var
|
|
1627
|
-
var
|
|
1781
|
+
var import_components22 = require("@transferwise/components");
|
|
1782
|
+
var import_react5 = require("react");
|
|
1783
|
+
var import_react_intl6 = require("react-intl");
|
|
1628
1784
|
|
|
1629
1785
|
// ../renderers/src/messages/multi-select.messages.ts
|
|
1630
|
-
var
|
|
1631
|
-
var multi_select_messages_default = (0,
|
|
1786
|
+
var import_react_intl5 = require("react-intl");
|
|
1787
|
+
var multi_select_messages_default = (0, import_react_intl5.defineMessages)({
|
|
1632
1788
|
summary: {
|
|
1633
1789
|
id: "df.wise.MultiSelect.summary",
|
|
1634
1790
|
defaultMessage: "{first} and {count} more",
|
|
@@ -1637,14 +1793,14 @@ var multi_select_messages_default = (0, import_react_intl3.defineMessages)({
|
|
|
1637
1793
|
});
|
|
1638
1794
|
|
|
1639
1795
|
// ../renderers/src/MultiSelectInputRenderer.tsx
|
|
1640
|
-
var
|
|
1796
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
1641
1797
|
var MultiSelectInputRenderer = {
|
|
1642
1798
|
canRenderType: "input-multi-select",
|
|
1643
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
1799
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(MultiSelectInputRendererComponent, __spreadValues({}, props))
|
|
1644
1800
|
};
|
|
1645
1801
|
function MultiSelectInputRendererComponent(props) {
|
|
1646
|
-
const { formatMessage } = (0,
|
|
1647
|
-
const [stagedIndices, setStagedIndices] = (0,
|
|
1802
|
+
const { formatMessage } = (0, import_react_intl6.useIntl)();
|
|
1803
|
+
const [stagedIndices, setStagedIndices] = (0, import_react5.useState)();
|
|
1648
1804
|
const {
|
|
1649
1805
|
id,
|
|
1650
1806
|
autoComplete,
|
|
@@ -1682,12 +1838,12 @@ function MultiSelectInputRendererComponent(props) {
|
|
|
1682
1838
|
const contentProps = {
|
|
1683
1839
|
title: option.title,
|
|
1684
1840
|
description: option.description,
|
|
1685
|
-
icon: /* @__PURE__ */ (0,
|
|
1841
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(OptionMedia, { icon: option.icon, image: option.image, preferAvatar: false })
|
|
1686
1842
|
};
|
|
1687
|
-
return /* @__PURE__ */ (0,
|
|
1843
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_components22.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
1688
1844
|
};
|
|
1689
1845
|
const extraProps = { autoComplete };
|
|
1690
|
-
return /* @__PURE__ */ (0,
|
|
1846
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1691
1847
|
FieldInput_default,
|
|
1692
1848
|
{
|
|
1693
1849
|
id,
|
|
@@ -1695,8 +1851,8 @@ function MultiSelectInputRendererComponent(props) {
|
|
|
1695
1851
|
help,
|
|
1696
1852
|
description,
|
|
1697
1853
|
validation: validationState,
|
|
1698
|
-
children: /* @__PURE__ */ (0,
|
|
1699
|
-
|
|
1854
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
1855
|
+
import_components22.SelectInput,
|
|
1700
1856
|
__spreadValues({
|
|
1701
1857
|
id,
|
|
1702
1858
|
items: options.map((option, index) => {
|
|
@@ -1732,15 +1888,14 @@ function MultiSelectInputRendererComponent(props) {
|
|
|
1732
1888
|
}
|
|
1733
1889
|
);
|
|
1734
1890
|
}
|
|
1735
|
-
var MultiSelectInputRenderer_default = MultiSelectInputRenderer;
|
|
1736
1891
|
|
|
1737
1892
|
// ../renderers/src/MultiUploadInputRenderer.tsx
|
|
1738
|
-
var
|
|
1893
|
+
var import_components24 = require("@transferwise/components");
|
|
1739
1894
|
|
|
1740
1895
|
// ../renderers/src/components/UploadFieldInput.tsx
|
|
1741
|
-
var
|
|
1742
|
-
var
|
|
1743
|
-
var
|
|
1896
|
+
var import_components23 = require("@transferwise/components");
|
|
1897
|
+
var import_classnames4 = __toESM(require("classnames"));
|
|
1898
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
1744
1899
|
function UploadFieldInput({
|
|
1745
1900
|
id,
|
|
1746
1901
|
children,
|
|
@@ -1749,18 +1904,18 @@ function UploadFieldInput({
|
|
|
1749
1904
|
help,
|
|
1750
1905
|
validation
|
|
1751
1906
|
}) {
|
|
1752
|
-
const labelContent = label && help ? /* @__PURE__ */ (0,
|
|
1907
|
+
const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(LabelContentWithHelp, { text: label, help }) : label;
|
|
1753
1908
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
1754
|
-
return /* @__PURE__ */ (0,
|
|
1909
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
1755
1910
|
"div",
|
|
1756
1911
|
{
|
|
1757
|
-
className: (0,
|
|
1912
|
+
className: (0, import_classnames4.default)("form-group d-block", {
|
|
1758
1913
|
"has-error": (validation == null ? void 0 : validation.status) === "invalid"
|
|
1759
1914
|
}),
|
|
1760
1915
|
children: [
|
|
1761
|
-
/* @__PURE__ */ (0,
|
|
1916
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)("label", { htmlFor: id, className: "control-label", children: labelContent }),
|
|
1762
1917
|
children,
|
|
1763
|
-
(validation == null ? void 0 : validation.status) === "invalid" && /* @__PURE__ */ (0,
|
|
1918
|
+
(validation == null ? void 0 : validation.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_components23.InlineAlert, { type: "negative", id: descriptionId, children: validation.message })
|
|
1764
1919
|
]
|
|
1765
1920
|
}
|
|
1766
1921
|
);
|
|
@@ -1789,7 +1944,7 @@ var getFileType = (base64Url) => {
|
|
|
1789
1944
|
};
|
|
1790
1945
|
|
|
1791
1946
|
// ../renderers/src/MultiUploadInputRenderer.tsx
|
|
1792
|
-
var
|
|
1947
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
1793
1948
|
var MultiUploadInputRenderer = {
|
|
1794
1949
|
canRenderType: "input-upload-multi",
|
|
1795
1950
|
render: (props) => {
|
|
@@ -1814,7 +1969,7 @@ var MultiUploadInputRenderer = {
|
|
|
1814
1969
|
};
|
|
1815
1970
|
const onDeleteFile = async (fileId) => onRemoveFile(value.findIndex((file) => file.id === fileId));
|
|
1816
1971
|
const descriptionId = description ? `${id}-description` : void 0;
|
|
1817
|
-
return /* @__PURE__ */ (0,
|
|
1972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
1818
1973
|
UploadFieldInput_default,
|
|
1819
1974
|
{
|
|
1820
1975
|
id,
|
|
@@ -1822,8 +1977,8 @@ var MultiUploadInputRenderer = {
|
|
|
1822
1977
|
description,
|
|
1823
1978
|
validation: validationState,
|
|
1824
1979
|
help,
|
|
1825
|
-
children: /* @__PURE__ */ (0,
|
|
1826
|
-
|
|
1980
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
1981
|
+
import_components24.UploadInput,
|
|
1827
1982
|
{
|
|
1828
1983
|
id,
|
|
1829
1984
|
"aria-describedby": descriptionId,
|
|
@@ -1842,11 +1997,10 @@ var MultiUploadInputRenderer = {
|
|
|
1842
1997
|
);
|
|
1843
1998
|
}
|
|
1844
1999
|
};
|
|
1845
|
-
var MultiUploadInputRenderer_default = MultiUploadInputRenderer;
|
|
1846
2000
|
|
|
1847
2001
|
// ../renderers/src/NumberInputRenderer.tsx
|
|
1848
|
-
var
|
|
1849
|
-
var
|
|
2002
|
+
var import_components25 = require("@transferwise/components");
|
|
2003
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
1850
2004
|
var NumberInputRenderer = {
|
|
1851
2005
|
canRenderType: "input-number",
|
|
1852
2006
|
render: (props) => {
|
|
@@ -1860,7 +2014,7 @@ var NumberInputRenderer = {
|
|
|
1860
2014
|
"maximum",
|
|
1861
2015
|
"minimum"
|
|
1862
2016
|
);
|
|
1863
|
-
return /* @__PURE__ */ (0,
|
|
2017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
1864
2018
|
FieldInput_default,
|
|
1865
2019
|
{
|
|
1866
2020
|
id,
|
|
@@ -1868,8 +2022,8 @@ var NumberInputRenderer = {
|
|
|
1868
2022
|
description,
|
|
1869
2023
|
validation: validationState,
|
|
1870
2024
|
help,
|
|
1871
|
-
children: /* @__PURE__ */ (0,
|
|
1872
|
-
|
|
2025
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components25.InputGroup, { addonStart: getInputGroupAddonStart({ icon, image }), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
2026
|
+
import_components25.Input,
|
|
1873
2027
|
__spreadValues({
|
|
1874
2028
|
id,
|
|
1875
2029
|
name: id,
|
|
@@ -1886,27 +2040,26 @@ var NumberInputRenderer = {
|
|
|
1886
2040
|
);
|
|
1887
2041
|
}
|
|
1888
2042
|
};
|
|
1889
|
-
var NumberInputRenderer_default = NumberInputRenderer;
|
|
1890
2043
|
|
|
1891
2044
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
1892
|
-
var
|
|
2045
|
+
var import_react_intl8 = require("react-intl");
|
|
1893
2046
|
|
|
1894
2047
|
// ../renderers/src/hooks/useSnackBarIfAvailable.ts
|
|
1895
|
-
var
|
|
1896
|
-
var
|
|
2048
|
+
var import_components26 = require("@transferwise/components");
|
|
2049
|
+
var import_react6 = require("react");
|
|
1897
2050
|
function useSnackBarIfAvailable() {
|
|
1898
|
-
const context = (0,
|
|
2051
|
+
const context = (0, import_react6.useContext)(import_components26.SnackbarContext);
|
|
1899
2052
|
return context ? context.createSnackbar : () => {
|
|
1900
2053
|
};
|
|
1901
2054
|
}
|
|
1902
2055
|
|
|
1903
2056
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
1904
|
-
var
|
|
1905
|
-
var
|
|
2057
|
+
var import_components27 = require("@transferwise/components");
|
|
2058
|
+
var import_classnames5 = __toESM(require("classnames"));
|
|
1906
2059
|
|
|
1907
2060
|
// ../renderers/src/messages/paragraph.messages.ts
|
|
1908
|
-
var
|
|
1909
|
-
var paragraph_messages_default = (0,
|
|
2061
|
+
var import_react_intl7 = require("react-intl");
|
|
2062
|
+
var paragraph_messages_default = (0, import_react_intl7.defineMessages)({
|
|
1910
2063
|
copy: {
|
|
1911
2064
|
id: "df.wise.DynamicParagraph.copy",
|
|
1912
2065
|
defaultMessage: "Copy",
|
|
@@ -1920,55 +2073,54 @@ var paragraph_messages_default = (0, import_react_intl5.defineMessages)({
|
|
|
1920
2073
|
});
|
|
1921
2074
|
|
|
1922
2075
|
// ../renderers/src/ParagraphRenderer.tsx
|
|
1923
|
-
var
|
|
2076
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
1924
2077
|
var ParagraphRenderer = {
|
|
1925
2078
|
canRenderType: "paragraph",
|
|
1926
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
2079
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Paragraph, __spreadValues({}, props))
|
|
1927
2080
|
};
|
|
1928
2081
|
function Paragraph({ align, control, margin, text }) {
|
|
1929
2082
|
const className = getTextAlignmentAndMargin({ align, margin });
|
|
1930
|
-
return control === "copyable" ? /* @__PURE__ */ (0,
|
|
2083
|
+
return control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CopyableParagraph, { className, align, text }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(StandardParagraph, { className, text });
|
|
1931
2084
|
}
|
|
1932
2085
|
function StandardParagraph({ text, className }) {
|
|
1933
|
-
return /* @__PURE__ */ (0,
|
|
2086
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: `np-text-body-large ${className}`, children: text });
|
|
1934
2087
|
}
|
|
1935
2088
|
function CopyableParagraph({
|
|
1936
2089
|
text,
|
|
1937
2090
|
align,
|
|
1938
2091
|
className
|
|
1939
2092
|
}) {
|
|
1940
|
-
const { formatMessage } = (0,
|
|
2093
|
+
const { formatMessage } = (0, import_react_intl8.useIntl)();
|
|
1941
2094
|
const createSnackbar = useSnackBarIfAvailable();
|
|
1942
2095
|
const copy = () => {
|
|
1943
2096
|
navigator.clipboard.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(() => {
|
|
1944
2097
|
});
|
|
1945
2098
|
};
|
|
1946
2099
|
const inputAlignmentClasses = getTextAlignmentAndMargin({ align, margin: "sm" });
|
|
1947
|
-
return /* @__PURE__ */ (0,
|
|
1948
|
-
/* @__PURE__ */ (0,
|
|
1949
|
-
|
|
2100
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className, children: [
|
|
2101
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
2102
|
+
import_components27.Input,
|
|
1950
2103
|
{
|
|
1951
2104
|
type: "text",
|
|
1952
2105
|
value: text,
|
|
1953
2106
|
readOnly: true,
|
|
1954
|
-
className: (0,
|
|
2107
|
+
className: (0, import_classnames5.default)("text-ellipsis", inputAlignmentClasses)
|
|
1955
2108
|
}
|
|
1956
2109
|
),
|
|
1957
|
-
/* @__PURE__ */ (0,
|
|
2110
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components27.Button, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
|
|
1958
2111
|
] });
|
|
1959
2112
|
}
|
|
1960
|
-
var ParagraphRenderer_default = ParagraphRenderer;
|
|
1961
2113
|
|
|
1962
2114
|
// ../renderers/src/RepeatableRenderer.tsx
|
|
1963
|
-
var
|
|
2115
|
+
var import_components28 = require("@transferwise/components");
|
|
1964
2116
|
var import_icons = require("@transferwise/icons");
|
|
1965
|
-
var
|
|
1966
|
-
var
|
|
1967
|
-
var
|
|
2117
|
+
var import_classnames6 = __toESM(require("classnames"));
|
|
2118
|
+
var import_react7 = require("react");
|
|
2119
|
+
var import_react_intl10 = require("react-intl");
|
|
1968
2120
|
|
|
1969
2121
|
// ../renderers/src/messages/repeatable.messages.ts
|
|
1970
|
-
var
|
|
1971
|
-
var repeatable_messages_default = (0,
|
|
2122
|
+
var import_react_intl9 = require("react-intl");
|
|
2123
|
+
var repeatable_messages_default = (0, import_react_intl9.defineMessages)({
|
|
1972
2124
|
addItemTitle: {
|
|
1973
2125
|
id: "df.wise.ArraySchema.addItemTitle",
|
|
1974
2126
|
defaultMessage: "Add Item",
|
|
@@ -1992,10 +2144,10 @@ var repeatable_messages_default = (0, import_react_intl7.defineMessages)({
|
|
|
1992
2144
|
});
|
|
1993
2145
|
|
|
1994
2146
|
// ../renderers/src/RepeatableRenderer.tsx
|
|
1995
|
-
var
|
|
2147
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
1996
2148
|
var RepeatableRenderer = {
|
|
1997
2149
|
canRenderType: "repeatable",
|
|
1998
|
-
render: (props) => /* @__PURE__ */ (0,
|
|
2150
|
+
render: (props) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(Repeatable, __spreadValues({}, props))
|
|
1999
2151
|
};
|
|
2000
2152
|
function Repeatable(props) {
|
|
2001
2153
|
const {
|
|
@@ -2011,8 +2163,8 @@ function Repeatable(props) {
|
|
|
2011
2163
|
onSave,
|
|
2012
2164
|
onRemove
|
|
2013
2165
|
} = props;
|
|
2014
|
-
const { formatMessage } = (0,
|
|
2015
|
-
const [openModalType, setOpenModalType] = (0,
|
|
2166
|
+
const { formatMessage } = (0, import_react_intl10.useIntl)();
|
|
2167
|
+
const [openModalType, setOpenModalType] = (0, import_react7.useState)(null);
|
|
2016
2168
|
const onAddItem = () => {
|
|
2017
2169
|
onAdd();
|
|
2018
2170
|
setOpenModalType("add");
|
|
@@ -2034,40 +2186,40 @@ function Repeatable(props) {
|
|
|
2034
2186
|
const onCancelEdit = () => {
|
|
2035
2187
|
setOpenModalType(null);
|
|
2036
2188
|
};
|
|
2037
|
-
return /* @__PURE__ */ (0,
|
|
2038
|
-
title && /* @__PURE__ */ (0,
|
|
2039
|
-
description && /* @__PURE__ */ (0,
|
|
2040
|
-
/* @__PURE__ */ (0,
|
|
2189
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
2190
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components28.Header, { title }),
|
|
2191
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("p", { children: description }),
|
|
2192
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(
|
|
2041
2193
|
"div",
|
|
2042
2194
|
{
|
|
2043
|
-
className: (0,
|
|
2195
|
+
className: (0, import_classnames6.default)("form-group", {
|
|
2044
2196
|
"has-error": (validationState == null ? void 0 : validationState.status) === "invalid"
|
|
2045
2197
|
}),
|
|
2046
2198
|
children: [
|
|
2047
|
-
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0,
|
|
2048
|
-
/* @__PURE__ */ (0,
|
|
2049
|
-
|
|
2199
|
+
items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(ItemSummaryOption, { item, onClick: () => onEditItem(index) }, item.id)),
|
|
2200
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2201
|
+
import_components28.NavigationOption,
|
|
2050
2202
|
{
|
|
2051
|
-
media: /* @__PURE__ */ (0,
|
|
2203
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_icons.Plus, {}),
|
|
2052
2204
|
title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2053
2205
|
showMediaAtAllSizes: true,
|
|
2054
2206
|
onClick: () => onAddItem()
|
|
2055
2207
|
}
|
|
2056
2208
|
),
|
|
2057
|
-
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0,
|
|
2209
|
+
(validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components28.InlineAlert, { type: "negative", children: validationState.message })
|
|
2058
2210
|
]
|
|
2059
2211
|
}
|
|
2060
2212
|
),
|
|
2061
|
-
/* @__PURE__ */ (0,
|
|
2062
|
-
|
|
2213
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2214
|
+
import_components28.Modal,
|
|
2063
2215
|
{
|
|
2064
2216
|
open: openModalType !== null,
|
|
2065
2217
|
title: (openModalType === "add" ? addItemTitle : editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
|
|
2066
|
-
body: /* @__PURE__ */ (0,
|
|
2067
|
-
/* @__PURE__ */ (0,
|
|
2068
|
-
/* @__PURE__ */ (0,
|
|
2069
|
-
/* @__PURE__ */ (0,
|
|
2070
|
-
/* @__PURE__ */ (0,
|
|
2218
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_jsx_runtime41.Fragment, { children: [
|
|
2219
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "m-b-2", children: editableItem }),
|
|
2220
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { children: [
|
|
2221
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components28.Button, { priority: "primary", block: true, className: "m-b-2", onClick: () => onSaveItem(), children: formatMessage(repeatable_messages_default.addItem) }),
|
|
2222
|
+
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components28.Button, { priority: "secondary", type: "negative", block: true, onClick: () => onRemoveItem(), children: formatMessage(repeatable_messages_default.removeItem) })
|
|
2071
2223
|
] })
|
|
2072
2224
|
] }),
|
|
2073
2225
|
onClose: () => onCancelEdit()
|
|
@@ -2079,10 +2231,10 @@ function ItemSummaryOption({
|
|
|
2079
2231
|
item,
|
|
2080
2232
|
onClick
|
|
2081
2233
|
}) {
|
|
2082
|
-
return /* @__PURE__ */ (0,
|
|
2083
|
-
|
|
2234
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
2235
|
+
import_components28.NavigationOption,
|
|
2084
2236
|
{
|
|
2085
|
-
media: /* @__PURE__ */ (0,
|
|
2237
|
+
media: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(OptionMedia, __spreadProps(__spreadValues({}, item), { preferAvatar: false })),
|
|
2086
2238
|
title: item.title,
|
|
2087
2239
|
content: item.description,
|
|
2088
2240
|
showMediaAtAllSizes: true,
|
|
@@ -2090,29 +2242,111 @@ function ItemSummaryOption({
|
|
|
2090
2242
|
}
|
|
2091
2243
|
);
|
|
2092
2244
|
}
|
|
2093
|
-
var RepeatableRenderer_default = RepeatableRenderer;
|
|
2094
2245
|
|
|
2095
|
-
// ../renderers/src/
|
|
2096
|
-
var
|
|
2097
|
-
var import_react7 = require("react");
|
|
2098
|
-
var import_react_intl12 = require("react-intl");
|
|
2246
|
+
// ../renderers/src/ReviewRenderer.tsx
|
|
2247
|
+
var import_components29 = require("@transferwise/components");
|
|
2099
2248
|
|
|
2100
|
-
// ../renderers/src/
|
|
2101
|
-
var
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2249
|
+
// ../renderers/src/utils/getHeaderAction.tsx
|
|
2250
|
+
var getHeaderAction = (callToAction) => {
|
|
2251
|
+
if (!callToAction) {
|
|
2252
|
+
return void 0;
|
|
2253
|
+
}
|
|
2254
|
+
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
2255
|
+
return href ? {
|
|
2256
|
+
"aria-label": accessibilityDescription,
|
|
2257
|
+
text: title,
|
|
2258
|
+
href,
|
|
2259
|
+
target: "_blank"
|
|
2260
|
+
} : {
|
|
2261
|
+
"aria-label": accessibilityDescription,
|
|
2262
|
+
text: title,
|
|
2263
|
+
onClick: (event) => {
|
|
2264
|
+
event.preventDefault();
|
|
2265
|
+
onClick();
|
|
2266
|
+
}
|
|
2267
|
+
};
|
|
2268
|
+
};
|
|
2109
2269
|
|
|
2110
|
-
// ../renderers/src/
|
|
2270
|
+
// ../renderers/src/ReviewRenderer.tsx
|
|
2271
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
2272
|
+
var ReviewRenderer = {
|
|
2273
|
+
canRenderType: "review",
|
|
2274
|
+
render: ({ callToAction, control, fields, margin, title, trackEvent }) => {
|
|
2275
|
+
const orientation = mapControlToDefinitionListLayout(control);
|
|
2276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getMargin(margin), children: [
|
|
2277
|
+
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components29.Header, { title: title != null ? title : "", action: getHeaderAction(callToAction) }),
|
|
2278
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
2279
|
+
import_components29.DefinitionList,
|
|
2280
|
+
{
|
|
2281
|
+
layout: orientation,
|
|
2282
|
+
definitions: fields.map(
|
|
2283
|
+
({ label, value, help, analyticsId: fieldAnalyticsId }, index) => ({
|
|
2284
|
+
key: String(index),
|
|
2285
|
+
title: label,
|
|
2286
|
+
value: getFieldValue(
|
|
2287
|
+
value,
|
|
2288
|
+
help,
|
|
2289
|
+
orientation,
|
|
2290
|
+
() => trackEvent("Help Pressed", { layoutItemId: fieldAnalyticsId })
|
|
2291
|
+
)
|
|
2292
|
+
})
|
|
2293
|
+
)
|
|
2294
|
+
}
|
|
2295
|
+
) })
|
|
2296
|
+
] });
|
|
2297
|
+
}
|
|
2298
|
+
};
|
|
2299
|
+
var mapControlToDefinitionListLayout = (control) => {
|
|
2300
|
+
switch (control) {
|
|
2301
|
+
case "horizontal":
|
|
2302
|
+
case "horizontal-end-aligned":
|
|
2303
|
+
return "HORIZONTAL_RIGHT_ALIGNED";
|
|
2304
|
+
case "horizontal-start-aligned":
|
|
2305
|
+
return "HORIZONTAL_LEFT_ALIGNED";
|
|
2306
|
+
case "vertical-two-column":
|
|
2307
|
+
return "VERTICAL_TWO_COLUMN";
|
|
2308
|
+
case "vertical":
|
|
2309
|
+
case "vertical-one-column":
|
|
2310
|
+
default:
|
|
2311
|
+
return "VERTICAL_ONE_COLUMN";
|
|
2312
|
+
}
|
|
2313
|
+
};
|
|
2314
|
+
var getFieldValue = (value, help, orientation, onClick) => {
|
|
2315
|
+
if (help) {
|
|
2316
|
+
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
2317
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Help_default, { help, onClick }),
|
|
2318
|
+
" ",
|
|
2319
|
+
value
|
|
2320
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
2321
|
+
value,
|
|
2322
|
+
" ",
|
|
2323
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Help_default, { help, onClick })
|
|
2324
|
+
] });
|
|
2325
|
+
}
|
|
2326
|
+
return value;
|
|
2327
|
+
};
|
|
2328
|
+
|
|
2329
|
+
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
2330
|
+
var import_components31 = require("@transferwise/components");
|
|
2331
|
+
var import_react8 = require("react");
|
|
2332
|
+
var import_react_intl14 = require("react-intl");
|
|
2333
|
+
|
|
2334
|
+
// ../renderers/src/messages/search.messages.ts
|
|
2111
2335
|
var import_react_intl11 = require("react-intl");
|
|
2336
|
+
var search_messages_default = (0, import_react_intl11.defineMessages)({
|
|
2337
|
+
loading: {
|
|
2338
|
+
id: "df.wise.SearchLayout.loading",
|
|
2339
|
+
defaultMessage: "Loading...",
|
|
2340
|
+
description: "A message shown to the user while their search is being processed, before results appear."
|
|
2341
|
+
}
|
|
2342
|
+
});
|
|
2343
|
+
|
|
2344
|
+
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
2345
|
+
var import_react_intl13 = require("react-intl");
|
|
2112
2346
|
|
|
2113
2347
|
// ../renderers/src/messages/generic-error.messages.ts
|
|
2114
|
-
var
|
|
2115
|
-
var generic_error_messages_default = (0,
|
|
2348
|
+
var import_react_intl12 = require("react-intl");
|
|
2349
|
+
var generic_error_messages_default = (0, import_react_intl12.defineMessages)({
|
|
2116
2350
|
genericErrorRetryHint: {
|
|
2117
2351
|
id: "df.wise.PersistAsyncSchema.genericError",
|
|
2118
2352
|
defaultMessage: "Something went wrong, please try again.",
|
|
@@ -2131,20 +2365,20 @@ var generic_error_messages_default = (0, import_react_intl10.defineMessages)({
|
|
|
2131
2365
|
});
|
|
2132
2366
|
|
|
2133
2367
|
// ../renderers/src/SearchRenderer/ErrorResult.tsx
|
|
2134
|
-
var
|
|
2135
|
-
var
|
|
2368
|
+
var import_components30 = require("@transferwise/components");
|
|
2369
|
+
var import_jsx_runtime43 = require("react/jsx-runtime");
|
|
2136
2370
|
function ErrorResult({ state }) {
|
|
2137
|
-
const intl = (0,
|
|
2371
|
+
const intl = (0, import_react_intl13.useIntl)();
|
|
2138
2372
|
const buttonVisualProps = {
|
|
2139
2373
|
priority: "tertiary",
|
|
2140
2374
|
size: "sm",
|
|
2141
2375
|
style: { marginTop: "-2px", padding: "0", width: "auto", display: "inline" }
|
|
2142
2376
|
};
|
|
2143
|
-
return /* @__PURE__ */ (0,
|
|
2377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("p", { className: "m-t-2", children: [
|
|
2144
2378
|
intl.formatMessage(generic_error_messages_default.genericError),
|
|
2145
2379
|
"\xA0",
|
|
2146
|
-
/* @__PURE__ */ (0,
|
|
2147
|
-
|
|
2380
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
2381
|
+
import_components30.Button,
|
|
2148
2382
|
__spreadProps(__spreadValues({}, buttonVisualProps), {
|
|
2149
2383
|
onClick: () => {
|
|
2150
2384
|
state.onRetry();
|
|
@@ -2156,7 +2390,7 @@ function ErrorResult({ state }) {
|
|
|
2156
2390
|
}
|
|
2157
2391
|
|
|
2158
2392
|
// ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
|
|
2159
|
-
var
|
|
2393
|
+
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
2160
2394
|
function BlockSearchRendererComponent({
|
|
2161
2395
|
id,
|
|
2162
2396
|
isLoading,
|
|
@@ -2167,11 +2401,11 @@ function BlockSearchRendererComponent({
|
|
|
2167
2401
|
trackEvent,
|
|
2168
2402
|
onChange
|
|
2169
2403
|
}) {
|
|
2170
|
-
const [hasSearched, setHasSearched] = (0,
|
|
2171
|
-
const { formatMessage } = (0,
|
|
2172
|
-
return /* @__PURE__ */ (0,
|
|
2173
|
-
/* @__PURE__ */ (0,
|
|
2174
|
-
|
|
2404
|
+
const [hasSearched, setHasSearched] = (0, import_react8.useState)(false);
|
|
2405
|
+
const { formatMessage } = (0, import_react_intl14.useIntl)();
|
|
2406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: getMargin(margin), children: [
|
|
2407
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2408
|
+
import_components31.Input,
|
|
2175
2409
|
{
|
|
2176
2410
|
id,
|
|
2177
2411
|
name: id,
|
|
@@ -2187,7 +2421,7 @@ function BlockSearchRendererComponent({
|
|
|
2187
2421
|
}
|
|
2188
2422
|
}
|
|
2189
2423
|
) }),
|
|
2190
|
-
isLoading ? /* @__PURE__ */ (0,
|
|
2424
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children: formatMessage(search_messages_default.loading) }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SearchResultContent, { state, trackEvent })
|
|
2191
2425
|
] });
|
|
2192
2426
|
}
|
|
2193
2427
|
function SearchResultContent({
|
|
@@ -2196,27 +2430,27 @@ function SearchResultContent({
|
|
|
2196
2430
|
}) {
|
|
2197
2431
|
switch (state.type) {
|
|
2198
2432
|
case "error":
|
|
2199
|
-
return /* @__PURE__ */ (0,
|
|
2433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ErrorResult, { state });
|
|
2200
2434
|
case "results":
|
|
2201
|
-
return /* @__PURE__ */ (0,
|
|
2435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SearchResults, { state, trackEvent });
|
|
2202
2436
|
case "noResults":
|
|
2203
|
-
return /* @__PURE__ */ (0,
|
|
2437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(EmptySearchResult, { state });
|
|
2204
2438
|
case "pending":
|
|
2205
2439
|
default:
|
|
2206
2440
|
return null;
|
|
2207
2441
|
}
|
|
2208
2442
|
}
|
|
2209
2443
|
function EmptySearchResult({ state }) {
|
|
2210
|
-
return /* @__PURE__ */ (0,
|
|
2444
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components31.Markdown, { className: "m-t-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
2211
2445
|
}
|
|
2212
2446
|
function SearchResults({
|
|
2213
2447
|
state,
|
|
2214
2448
|
trackEvent
|
|
2215
2449
|
}) {
|
|
2216
|
-
return /* @__PURE__ */ (0,
|
|
2450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components31.NavigationOptionsList, { children: state.results.map((result) => {
|
|
2217
2451
|
const { icon, image } = result;
|
|
2218
|
-
return /* @__PURE__ */ (0,
|
|
2219
|
-
|
|
2452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
2453
|
+
import_components31.NavigationOption,
|
|
2220
2454
|
{
|
|
2221
2455
|
title: result.title,
|
|
2222
2456
|
content: result.description,
|
|
@@ -2237,11 +2471,11 @@ function SearchResults({
|
|
|
2237
2471
|
var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
|
|
2238
2472
|
|
|
2239
2473
|
// ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
|
|
2240
|
-
var
|
|
2474
|
+
var import_components32 = require("@transferwise/components");
|
|
2241
2475
|
var import_icons2 = require("@transferwise/icons");
|
|
2242
|
-
var
|
|
2243
|
-
var
|
|
2244
|
-
var
|
|
2476
|
+
var import_react9 = require("react");
|
|
2477
|
+
var import_react_intl15 = require("react-intl");
|
|
2478
|
+
var import_jsx_runtime45 = require("react/jsx-runtime");
|
|
2245
2479
|
function InlineSearchRenderer({
|
|
2246
2480
|
id,
|
|
2247
2481
|
isLoading,
|
|
@@ -2251,20 +2485,20 @@ function InlineSearchRenderer({
|
|
|
2251
2485
|
title,
|
|
2252
2486
|
trackEvent
|
|
2253
2487
|
}) {
|
|
2254
|
-
const [hasSearched, setHasSearched] = (0,
|
|
2255
|
-
const intl = (0,
|
|
2256
|
-
return /* @__PURE__ */ (0,
|
|
2257
|
-
|
|
2488
|
+
const [hasSearched, setHasSearched] = (0, import_react9.useState)(false);
|
|
2489
|
+
const intl = (0, import_react_intl15.useIntl)();
|
|
2490
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
2491
|
+
import_components32.Typeahead,
|
|
2258
2492
|
{
|
|
2259
2493
|
id: "typeahead-input-id",
|
|
2260
2494
|
intl,
|
|
2261
2495
|
name: "typeahead-input-name",
|
|
2262
2496
|
size: "md",
|
|
2263
2497
|
maxHeight: 100,
|
|
2264
|
-
footer: /* @__PURE__ */ (0,
|
|
2498
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(TypeaheadFooter, { state, isLoading }),
|
|
2265
2499
|
multiple: false,
|
|
2266
2500
|
clearable: false,
|
|
2267
|
-
addon: /* @__PURE__ */ (0,
|
|
2501
|
+
addon: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_icons2.Search, { size: 24 }),
|
|
2268
2502
|
options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
|
|
2269
2503
|
minQueryLength: 1,
|
|
2270
2504
|
onChange: (values) => {
|
|
@@ -2299,31 +2533,43 @@ function mapResultToTypeaheadOption(result) {
|
|
|
2299
2533
|
};
|
|
2300
2534
|
}
|
|
2301
2535
|
function TypeaheadFooter({ state, isLoading }) {
|
|
2302
|
-
const { formatMessage } = (0,
|
|
2536
|
+
const { formatMessage } = (0, import_react_intl15.useIntl)();
|
|
2303
2537
|
if (state.type === "noResults") {
|
|
2304
|
-
return /* @__PURE__ */ (0,
|
|
2538
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components32.Markdown, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: state.message });
|
|
2305
2539
|
}
|
|
2306
2540
|
if (state.type === "error") {
|
|
2307
|
-
return /* @__PURE__ */ (0,
|
|
2541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ErrorResult, { state }) });
|
|
2308
2542
|
}
|
|
2309
2543
|
if (state.type === "pending" || isLoading) {
|
|
2310
|
-
return /* @__PURE__ */ (0,
|
|
2544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "m-t-2 m-x-2", children: formatMessage(search_messages_default.loading) });
|
|
2311
2545
|
}
|
|
2312
2546
|
return null;
|
|
2313
2547
|
}
|
|
2314
2548
|
var InlineSearchRendererComponent_default = InlineSearchRenderer;
|
|
2315
2549
|
|
|
2316
2550
|
// ../renderers/src/SearchRenderer/SearchRenderer.tsx
|
|
2317
|
-
var
|
|
2551
|
+
var import_jsx_runtime46 = require("react/jsx-runtime");
|
|
2318
2552
|
var SearchRenderer = {
|
|
2319
2553
|
canRenderType: "search",
|
|
2320
|
-
render: (props) => props.control === "inline" ? /* @__PURE__ */ (0,
|
|
2554
|
+
render: (props) => props.control === "inline" ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(InlineSearchRendererComponent_default, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(BlockSearchRendererComponent_default, __spreadValues({}, props))
|
|
2555
|
+
};
|
|
2556
|
+
|
|
2557
|
+
// ../renderers/src/SectionRenderer.tsx
|
|
2558
|
+
var import_components33 = require("@transferwise/components");
|
|
2559
|
+
var import_jsx_runtime47 = require("react/jsx-runtime");
|
|
2560
|
+
var SectionRenderer = {
|
|
2561
|
+
canRenderType: "section",
|
|
2562
|
+
render: ({ children, callToAction, margin, title }) => {
|
|
2563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("section", { className: getMargin(margin), children: [
|
|
2564
|
+
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_components33.Header, { title: title != null ? title : "", action: getHeaderAction(callToAction) }),
|
|
2565
|
+
children
|
|
2566
|
+
] });
|
|
2567
|
+
}
|
|
2321
2568
|
};
|
|
2322
|
-
var SearchRenderer_default = SearchRenderer;
|
|
2323
2569
|
|
|
2324
2570
|
// ../renderers/src/SelectInputRenderer/RadioInputRendererComponent.tsx
|
|
2325
|
-
var
|
|
2326
|
-
var
|
|
2571
|
+
var import_components34 = require("@transferwise/components");
|
|
2572
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
2327
2573
|
function RadioInputRendererComponent(props) {
|
|
2328
2574
|
const {
|
|
2329
2575
|
id,
|
|
@@ -2337,8 +2583,8 @@ function RadioInputRendererComponent(props) {
|
|
|
2337
2583
|
validationState,
|
|
2338
2584
|
onSelect
|
|
2339
2585
|
} = props;
|
|
2340
|
-
return /* @__PURE__ */ (0,
|
|
2341
|
-
/* @__PURE__ */ (0,
|
|
2586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
|
|
2587
|
+
/* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
2342
2588
|
FieldInput_default,
|
|
2343
2589
|
{
|
|
2344
2590
|
id,
|
|
@@ -2346,8 +2592,8 @@ function RadioInputRendererComponent(props) {
|
|
|
2346
2592
|
help,
|
|
2347
2593
|
description,
|
|
2348
2594
|
validation: validationState,
|
|
2349
|
-
children: /* @__PURE__ */ (0,
|
|
2350
|
-
|
|
2595
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
|
|
2596
|
+
import_components34.RadioGroup,
|
|
2351
2597
|
{
|
|
2352
2598
|
name: id,
|
|
2353
2599
|
radios: options.map((option, index) => ({
|
|
@@ -2355,7 +2601,7 @@ function RadioInputRendererComponent(props) {
|
|
|
2355
2601
|
value: index,
|
|
2356
2602
|
secondary: option.description,
|
|
2357
2603
|
disabled: option.disabled || disabled,
|
|
2358
|
-
avatar: /* @__PURE__ */ (0,
|
|
2604
|
+
avatar: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(OptionMedia, { icon: option.icon, image: option.image, preferAvatar: false })
|
|
2359
2605
|
})),
|
|
2360
2606
|
selectedValue: selectedIndex != null ? selectedIndex : void 0,
|
|
2361
2607
|
onChange: onSelect
|
|
@@ -2368,16 +2614,15 @@ function RadioInputRendererComponent(props) {
|
|
|
2368
2614
|
] });
|
|
2369
2615
|
}
|
|
2370
2616
|
|
|
2371
|
-
// ../renderers/src/SelectInputRenderer/
|
|
2372
|
-
var
|
|
2373
|
-
var
|
|
2374
|
-
var
|
|
2375
|
-
function
|
|
2617
|
+
// ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
|
|
2618
|
+
var import_react10 = require("react");
|
|
2619
|
+
var import_components35 = require("@transferwise/components");
|
|
2620
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
2621
|
+
function SegmentedInputRendererComponent(props) {
|
|
2376
2622
|
const {
|
|
2377
2623
|
id,
|
|
2378
2624
|
children,
|
|
2379
2625
|
description,
|
|
2380
|
-
disabled,
|
|
2381
2626
|
help,
|
|
2382
2627
|
title,
|
|
2383
2628
|
options,
|
|
@@ -2385,13 +2630,13 @@ function TabInputRendererComponent(props) {
|
|
|
2385
2630
|
validationState,
|
|
2386
2631
|
onSelect
|
|
2387
2632
|
} = props;
|
|
2388
|
-
(0,
|
|
2633
|
+
(0, import_react10.useEffect)(() => {
|
|
2389
2634
|
if (!isValidIndex(selectedIndex, options.length)) {
|
|
2390
2635
|
onSelect(0);
|
|
2391
2636
|
}
|
|
2392
2637
|
}, [selectedIndex, onSelect, options.length]);
|
|
2393
|
-
return /* @__PURE__ */ (0,
|
|
2394
|
-
/* @__PURE__ */ (0,
|
|
2638
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
|
|
2639
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2395
2640
|
FieldInput_default,
|
|
2396
2641
|
{
|
|
2397
2642
|
id,
|
|
@@ -2399,31 +2644,31 @@ function TabInputRendererComponent(props) {
|
|
|
2399
2644
|
help,
|
|
2400
2645
|
description,
|
|
2401
2646
|
validation: validationState,
|
|
2402
|
-
children: /* @__PURE__ */ (0,
|
|
2403
|
-
|
|
2647
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2648
|
+
import_components35.SegmentedControl,
|
|
2404
2649
|
{
|
|
2405
|
-
name: id
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2650
|
+
name: `${id}-segmented-control`,
|
|
2651
|
+
value: String(selectedIndex),
|
|
2652
|
+
mode: "view",
|
|
2653
|
+
segments: options.map((option, index) => ({
|
|
2654
|
+
id: String(index),
|
|
2655
|
+
value: String(index),
|
|
2656
|
+
label: option.title,
|
|
2657
|
+
controls: `${id}-children`
|
|
2413
2658
|
})),
|
|
2414
|
-
|
|
2659
|
+
onChange: (value) => onSelect(Number(value))
|
|
2415
2660
|
}
|
|
2416
2661
|
)
|
|
2417
2662
|
}
|
|
2418
2663
|
),
|
|
2419
|
-
children
|
|
2664
|
+
/* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { id: `${id}-children`, children })
|
|
2420
2665
|
] });
|
|
2421
2666
|
}
|
|
2422
2667
|
var isValidIndex = (index, options) => index !== null && index >= 0 && index < options;
|
|
2423
2668
|
|
|
2424
2669
|
// ../renderers/src/SelectInputRenderer/SelectInputRendererComponent.tsx
|
|
2425
|
-
var
|
|
2426
|
-
var
|
|
2670
|
+
var import_components36 = require("@transferwise/components");
|
|
2671
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2427
2672
|
function SelectInputRendererComponent(props) {
|
|
2428
2673
|
const {
|
|
2429
2674
|
id,
|
|
@@ -2463,13 +2708,13 @@ function SelectInputRendererComponent(props) {
|
|
|
2463
2708
|
} : {
|
|
2464
2709
|
title: option.title,
|
|
2465
2710
|
description: option.description,
|
|
2466
|
-
icon: /* @__PURE__ */ (0,
|
|
2711
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(OptionMedia, { icon: option.icon, image: option.image, preferAvatar: false })
|
|
2467
2712
|
};
|
|
2468
|
-
return /* @__PURE__ */ (0,
|
|
2713
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components36.SelectInputOptionContent, __spreadValues({}, contentProps));
|
|
2469
2714
|
};
|
|
2470
2715
|
const extraProps = { autoComplete };
|
|
2471
|
-
return /* @__PURE__ */ (0,
|
|
2472
|
-
/* @__PURE__ */ (0,
|
|
2716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
|
|
2717
|
+
/* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2473
2718
|
FieldInput_default,
|
|
2474
2719
|
{
|
|
2475
2720
|
id,
|
|
@@ -2477,8 +2722,8 @@ function SelectInputRendererComponent(props) {
|
|
|
2477
2722
|
help,
|
|
2478
2723
|
description,
|
|
2479
2724
|
validation: validationState,
|
|
2480
|
-
children: /* @__PURE__ */ (0,
|
|
2481
|
-
|
|
2725
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2726
|
+
import_components36.SelectInput,
|
|
2482
2727
|
__spreadValues({
|
|
2483
2728
|
name: id,
|
|
2484
2729
|
placeholder,
|
|
@@ -2497,15 +2742,16 @@ function SelectInputRendererComponent(props) {
|
|
|
2497
2742
|
] });
|
|
2498
2743
|
}
|
|
2499
2744
|
|
|
2500
|
-
// ../renderers/src/SelectInputRenderer/
|
|
2501
|
-
var
|
|
2502
|
-
var
|
|
2503
|
-
var
|
|
2504
|
-
function
|
|
2745
|
+
// ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
|
|
2746
|
+
var import_components37 = require("@transferwise/components");
|
|
2747
|
+
var import_react11 = require("react");
|
|
2748
|
+
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2749
|
+
function TabInputRendererComponent(props) {
|
|
2505
2750
|
const {
|
|
2506
2751
|
id,
|
|
2507
2752
|
children,
|
|
2508
2753
|
description,
|
|
2754
|
+
disabled,
|
|
2509
2755
|
help,
|
|
2510
2756
|
title,
|
|
2511
2757
|
options,
|
|
@@ -2513,13 +2759,13 @@ function SegmentedInputRendererComponent(props) {
|
|
|
2513
2759
|
validationState,
|
|
2514
2760
|
onSelect
|
|
2515
2761
|
} = props;
|
|
2516
|
-
(0,
|
|
2762
|
+
(0, import_react11.useEffect)(() => {
|
|
2517
2763
|
if (!isValidIndex2(selectedIndex, options.length)) {
|
|
2518
2764
|
onSelect(0);
|
|
2519
2765
|
}
|
|
2520
2766
|
}, [selectedIndex, onSelect, options.length]);
|
|
2521
|
-
return /* @__PURE__ */ (0,
|
|
2522
|
-
/* @__PURE__ */ (0,
|
|
2767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
|
|
2768
|
+
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2523
2769
|
FieldInput_default,
|
|
2524
2770
|
{
|
|
2525
2771
|
id,
|
|
@@ -2527,61 +2773,60 @@ function SegmentedInputRendererComponent(props) {
|
|
|
2527
2773
|
help,
|
|
2528
2774
|
description,
|
|
2529
2775
|
validation: validationState,
|
|
2530
|
-
children: /* @__PURE__ */ (0,
|
|
2531
|
-
|
|
2776
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2777
|
+
import_components37.Tabs,
|
|
2532
2778
|
{
|
|
2533
|
-
name:
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2779
|
+
name: id,
|
|
2780
|
+
selected: selectedIndex != null ? selectedIndex : 0,
|
|
2781
|
+
tabs: options.map((option) => ({
|
|
2782
|
+
title: option.title,
|
|
2783
|
+
// if we pass null, we get some props-types console errors
|
|
2784
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
2785
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, {}),
|
|
2786
|
+
disabled: option.disabled || disabled
|
|
2541
2787
|
})),
|
|
2542
|
-
|
|
2788
|
+
onTabSelect: onSelect
|
|
2543
2789
|
}
|
|
2544
2790
|
)
|
|
2545
2791
|
}
|
|
2546
2792
|
),
|
|
2547
|
-
|
|
2793
|
+
children
|
|
2548
2794
|
] });
|
|
2549
2795
|
}
|
|
2550
2796
|
var isValidIndex2 = (index, options) => index !== null && index >= 0 && index < options;
|
|
2551
2797
|
|
|
2552
2798
|
// ../renderers/src/SelectInputRenderer/SelectInputRenderer.tsx
|
|
2553
|
-
var
|
|
2799
|
+
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
2554
2800
|
var SelectInputRenderer = {
|
|
2555
2801
|
canRenderType: "input-select",
|
|
2556
2802
|
render: (props) => {
|
|
2557
2803
|
switch (props.control) {
|
|
2558
2804
|
case "radio":
|
|
2559
|
-
return /* @__PURE__ */ (0,
|
|
2805
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(RadioInputRendererComponent, __spreadValues({}, props));
|
|
2560
2806
|
case "tab":
|
|
2561
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0,
|
|
2807
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(TabInputRendererComponent, __spreadValues({}, props));
|
|
2562
2808
|
case "segmented":
|
|
2563
|
-
return props.options.length > 3 ? /* @__PURE__ */ (0,
|
|
2809
|
+
return props.options.length > 3 ? /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SegmentedInputRendererComponent, __spreadValues({}, props));
|
|
2564
2810
|
case "select":
|
|
2565
2811
|
default:
|
|
2566
|
-
return /* @__PURE__ */ (0,
|
|
2812
|
+
return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(SelectInputRendererComponent, __spreadValues({}, props));
|
|
2567
2813
|
}
|
|
2568
2814
|
}
|
|
2569
2815
|
};
|
|
2570
|
-
var SelectInputRenderer_default = SelectInputRenderer;
|
|
2571
2816
|
|
|
2572
2817
|
// ../renderers/src/StatusListRenderer.tsx
|
|
2573
|
-
var
|
|
2574
|
-
var
|
|
2818
|
+
var import_components38 = require("@transferwise/components");
|
|
2819
|
+
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2575
2820
|
var StatusListRenderer = {
|
|
2576
2821
|
canRenderType: "status-list",
|
|
2577
|
-
render: ({ margin, items, title }) => /* @__PURE__ */ (0,
|
|
2578
|
-
title ? /* @__PURE__ */ (0,
|
|
2579
|
-
items.map(({ callToAction, description, icon, status, title: itemTitle }) => /* @__PURE__ */ (0,
|
|
2580
|
-
|
|
2822
|
+
render: ({ margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: getMargin(margin), children: [
|
|
2823
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_components38.Header, { title, className: "m-b-2" }) : null,
|
|
2824
|
+
items.map(({ callToAction, description, icon, status, title: itemTitle }) => /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
|
|
2825
|
+
import_components38.Summary,
|
|
2581
2826
|
{
|
|
2582
2827
|
title: itemTitle,
|
|
2583
2828
|
description,
|
|
2584
|
-
icon: icon && "name" in icon ? /* @__PURE__ */ (0,
|
|
2829
|
+
icon: icon && "name" in icon ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(DynamicIcon_default, { name: icon.name }) : null,
|
|
2585
2830
|
status: mapStatus(status),
|
|
2586
2831
|
action: getSummaryAction(callToAction)
|
|
2587
2832
|
},
|
|
@@ -2589,7 +2834,6 @@ var StatusListRenderer = {
|
|
|
2589
2834
|
))
|
|
2590
2835
|
] })
|
|
2591
2836
|
};
|
|
2592
|
-
var StatusListRenderer_default = StatusListRenderer;
|
|
2593
2837
|
var getSummaryAction = (callToAction) => {
|
|
2594
2838
|
if (!callToAction) {
|
|
2595
2839
|
return void 0;
|
|
@@ -2616,604 +2860,126 @@ var mapStatus = (status) => {
|
|
|
2616
2860
|
return status;
|
|
2617
2861
|
};
|
|
2618
2862
|
|
|
2619
|
-
// ../renderers/src/
|
|
2620
|
-
var
|
|
2863
|
+
// ../renderers/src/utils/useCustomTheme.ts
|
|
2864
|
+
var import_components_theming = require("@wise/components-theming");
|
|
2865
|
+
var import_react12 = require("react");
|
|
2866
|
+
var ThemeRequiredEventName = "Theme Required";
|
|
2867
|
+
var useCustomTheme = (theme, trackEvent) => {
|
|
2868
|
+
const previousThemeHookValue = (0, import_components_theming.useTheme)();
|
|
2869
|
+
const previousTheme = (0, import_react12.useMemo)(() => previousThemeHookValue.theme, []);
|
|
2870
|
+
(0, import_react12.useEffect)(() => {
|
|
2871
|
+
trackEvent(ThemeRequiredEventName, { theme });
|
|
2872
|
+
return theme !== previousTheme ? () => {
|
|
2873
|
+
trackEvent(ThemeRequiredEventName, { theme: previousTheme });
|
|
2874
|
+
} : () => {
|
|
2875
|
+
};
|
|
2876
|
+
}, []);
|
|
2877
|
+
};
|
|
2621
2878
|
|
|
2622
|
-
// ../renderers/src/
|
|
2623
|
-
var
|
|
2624
|
-
var
|
|
2625
|
-
var
|
|
2626
|
-
|
|
2627
|
-
"
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
const { id, value, control, onChange } = inputProps;
|
|
2640
|
-
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
2641
|
-
switch (control) {
|
|
2642
|
-
case "email":
|
|
2643
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
2644
|
-
case "password":
|
|
2645
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
|
|
2646
|
-
case "numeric": {
|
|
2647
|
-
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
2648
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
2649
|
-
TextInput,
|
|
2650
|
-
__spreadProps(__spreadValues({}, numericProps), {
|
|
2651
|
-
onChange: (newValue) => {
|
|
2652
|
-
const numericValueOrNull = !Number.isNaN(Number.parseFloat(newValue)) ? newValue : null;
|
|
2653
|
-
onChange(numericValueOrNull);
|
|
2654
|
-
}
|
|
2655
|
-
})
|
|
2656
|
-
);
|
|
2657
|
-
}
|
|
2658
|
-
case "phone-number":
|
|
2659
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components34.PhoneNumberInput, __spreadProps(__spreadValues({ initialValue: value }, commonProps), { onChange }));
|
|
2660
|
-
default: {
|
|
2661
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "text", onChange }));
|
|
2662
|
-
}
|
|
2663
|
-
}
|
|
2664
|
-
}
|
|
2665
|
-
function TextInput(props) {
|
|
2666
|
-
const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
|
|
2667
|
-
const InputWithPattern = control === "textarea" ? import_components34.TextareaWithDisplayFormat : import_components34.InputWithDisplayFormat;
|
|
2668
|
-
const InputWithoutPattern = control === "textarea" ? import_components34.TextArea : import_components34.Input;
|
|
2669
|
-
return displayFormat ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { onChange: (e) => onChange(e.target.value) }));
|
|
2670
|
-
}
|
|
2671
|
-
|
|
2672
|
-
// ../renderers/src/TextInputRenderer.tsx
|
|
2673
|
-
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
2674
|
-
var TextInputRenderer = {
|
|
2675
|
-
canRenderType: "input-text",
|
|
2676
|
-
render: (props) => {
|
|
2677
|
-
const _a = props, {
|
|
2678
|
-
id,
|
|
2679
|
-
title,
|
|
2680
|
-
description,
|
|
2681
|
-
help,
|
|
2682
|
-
icon,
|
|
2683
|
-
image,
|
|
2684
|
-
validationState,
|
|
2685
|
-
value: initialValue,
|
|
2686
|
-
onChange
|
|
2687
|
-
} = _a, rest = __objRest(_a, [
|
|
2688
|
-
"id",
|
|
2689
|
-
"title",
|
|
2690
|
-
"description",
|
|
2691
|
-
"help",
|
|
2692
|
-
"icon",
|
|
2693
|
-
"image",
|
|
2694
|
-
"validationState",
|
|
2695
|
-
"value",
|
|
2696
|
-
"onChange"
|
|
2697
|
-
]);
|
|
2698
|
-
const value = initialValue != null ? initialValue : "";
|
|
2699
|
-
const inputProps = __spreadProps(__spreadValues({}, rest), {
|
|
2700
|
-
value,
|
|
2701
|
-
id,
|
|
2702
|
-
onChange: (newValue) => {
|
|
2703
|
-
if ((value != null ? value : "") !== (newValue != null ? newValue : "")) {
|
|
2704
|
-
onChange(newValue);
|
|
2705
|
-
}
|
|
2706
|
-
}
|
|
2707
|
-
});
|
|
2708
|
-
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
|
|
2709
|
-
FieldInput_default,
|
|
2710
|
-
{
|
|
2711
|
-
id,
|
|
2712
|
-
label: title,
|
|
2713
|
-
description,
|
|
2714
|
-
validation: validationState,
|
|
2715
|
-
help,
|
|
2716
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components35.InputGroup, { addonStart: getInputGroupAddonStart({ icon, image }), children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(VariableTextInput, __spreadValues({}, inputProps)) })
|
|
2717
|
-
}
|
|
2718
|
-
);
|
|
2719
|
-
}
|
|
2720
|
-
};
|
|
2721
|
-
var TextInputRenderer_default = TextInputRenderer;
|
|
2722
|
-
|
|
2723
|
-
// ../renderers/src/UploadInputRenderer.tsx
|
|
2724
|
-
var import_components36 = require("@transferwise/components");
|
|
2725
|
-
|
|
2726
|
-
// ../renderers/src/utils/getRandomId.ts
|
|
2727
|
-
var getRandomId = () => Math.random().toString(36).substring(2);
|
|
2728
|
-
|
|
2729
|
-
// ../renderers/src/UploadInputRenderer.tsx
|
|
2730
|
-
var import_jsx_runtime51 = require("react/jsx-runtime");
|
|
2731
|
-
var UploadInputRenderer = {
|
|
2732
|
-
canRenderType: "input-upload",
|
|
2733
|
-
render: (props) => {
|
|
2734
|
-
const { id, accepts, title, description, disabled, maxSize, validationState, onUpload } = props;
|
|
2735
|
-
const onUploadFile = async (formData) => {
|
|
2736
|
-
const file = formData.get("file");
|
|
2737
|
-
return onUpload(file).then(() => ({
|
|
2738
|
-
id: getRandomId()
|
|
2739
|
-
}));
|
|
2740
|
-
};
|
|
2741
|
-
const onDeleteFile = async () => {
|
|
2742
|
-
await onUpload(null);
|
|
2743
|
-
};
|
|
2744
|
-
return (
|
|
2745
|
-
// We don't pass help here as there is no sensible place to display it
|
|
2746
|
-
/* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2747
|
-
UploadFieldInput_default,
|
|
2748
|
-
{
|
|
2749
|
-
id,
|
|
2750
|
-
label: void 0,
|
|
2751
|
-
description: void 0,
|
|
2752
|
-
validation: validationState,
|
|
2753
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2754
|
-
import_components36.UploadInput,
|
|
2755
|
-
{
|
|
2756
|
-
id,
|
|
2757
|
-
description,
|
|
2758
|
-
disabled,
|
|
2759
|
-
fileTypes: getAcceptsString(accepts),
|
|
2760
|
-
sizeLimit: maxSize ? toKilobytes(maxSize) : void 0,
|
|
2761
|
-
uploadButtonTitle: title,
|
|
2762
|
-
onDeleteFile,
|
|
2763
|
-
onUploadFile
|
|
2764
|
-
}
|
|
2765
|
-
)
|
|
2766
|
-
}
|
|
2767
|
-
)
|
|
2768
|
-
);
|
|
2769
|
-
}
|
|
2770
|
-
};
|
|
2771
|
-
var LargeUploadRenderer = {
|
|
2772
|
-
canRenderType: "input-upload",
|
|
2773
|
-
canRender: (props) => props.control === "upload-large",
|
|
2774
|
-
render: (props) => {
|
|
2775
|
-
const _a = props, {
|
|
2776
|
-
id,
|
|
2777
|
-
accepts,
|
|
2778
|
-
control,
|
|
2779
|
-
title,
|
|
2780
|
-
description,
|
|
2781
|
-
disabled,
|
|
2782
|
-
help,
|
|
2783
|
-
type,
|
|
2784
|
-
validationState,
|
|
2785
|
-
onUpload
|
|
2786
|
-
} = _a, rest = __objRest(_a, [
|
|
2787
|
-
"id",
|
|
2788
|
-
"accepts",
|
|
2789
|
-
"control",
|
|
2790
|
-
"title",
|
|
2791
|
-
"description",
|
|
2792
|
-
"disabled",
|
|
2793
|
-
"help",
|
|
2794
|
-
"type",
|
|
2795
|
-
"validationState",
|
|
2796
|
-
"onUpload"
|
|
2797
|
-
]);
|
|
2798
|
-
const uploadProps = __spreadProps(__spreadValues({}, rest), { id, name: id });
|
|
2799
|
-
const onUploadFile = async (file, fileName) => {
|
|
2800
|
-
try {
|
|
2801
|
-
const convertedFile = file ? await toFile(file, fileName) : null;
|
|
2802
|
-
await onUpload(convertedFile);
|
|
2803
|
-
} catch (e) {
|
|
2804
|
-
await onUpload(null);
|
|
2805
|
-
throw e;
|
|
2806
|
-
}
|
|
2807
|
-
};
|
|
2808
|
-
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2809
|
-
FieldInput_default,
|
|
2810
|
-
{
|
|
2811
|
-
id,
|
|
2812
|
-
label: title,
|
|
2813
|
-
description,
|
|
2814
|
-
validation: validationState,
|
|
2815
|
-
help,
|
|
2816
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
2817
|
-
import_components36.Upload,
|
|
2818
|
-
__spreadProps(__spreadValues({}, uploadProps), {
|
|
2819
|
-
usAccept: getAcceptsString(accepts),
|
|
2820
|
-
usDisabled: disabled,
|
|
2821
|
-
onSuccess: onUploadFile,
|
|
2822
|
-
onFailure: async () => onUpload(null),
|
|
2823
|
-
onCancel: async () => onUpload(null)
|
|
2824
|
-
})
|
|
2825
|
-
)
|
|
2826
|
-
}
|
|
2827
|
-
);
|
|
2828
|
-
}
|
|
2829
|
-
};
|
|
2830
|
-
|
|
2831
|
-
// ../renderers/src/ReviewRenderer.tsx
|
|
2832
|
-
var import_components37 = require("@transferwise/components");
|
|
2833
|
-
|
|
2834
|
-
// ../renderers/src/utils/getHeaderAction.tsx
|
|
2835
|
-
var getHeaderAction = (callToAction) => {
|
|
2836
|
-
if (!callToAction) {
|
|
2837
|
-
return void 0;
|
|
2838
|
-
}
|
|
2839
|
-
const { accessibilityDescription, href, title, onClick } = callToAction;
|
|
2840
|
-
return href ? {
|
|
2841
|
-
"aria-label": accessibilityDescription,
|
|
2842
|
-
text: title,
|
|
2843
|
-
href,
|
|
2844
|
-
target: "_blank"
|
|
2845
|
-
} : {
|
|
2846
|
-
"aria-label": accessibilityDescription,
|
|
2847
|
-
text: title,
|
|
2848
|
-
onClick: (event) => {
|
|
2849
|
-
event.preventDefault();
|
|
2850
|
-
onClick();
|
|
2851
|
-
}
|
|
2852
|
-
};
|
|
2853
|
-
};
|
|
2854
|
-
|
|
2855
|
-
// ../renderers/src/ReviewRenderer.tsx
|
|
2856
|
-
var import_jsx_runtime52 = require("react/jsx-runtime");
|
|
2857
|
-
var ReviewRenderer = {
|
|
2858
|
-
canRenderType: "review",
|
|
2859
|
-
render: ({ analyticsId, callToAction, control, fields, margin, title, trackEvent }) => {
|
|
2860
|
-
const orientation = mapControlToDefinitionListLayout(control);
|
|
2861
|
-
const onHelpClick = (fieldAnalyticsId) => {
|
|
2862
|
-
trackEvent("Help Pressed", {
|
|
2863
|
-
layoutId: analyticsId,
|
|
2864
|
-
layoutItemId: fieldAnalyticsId
|
|
2865
|
-
});
|
|
2866
|
-
};
|
|
2867
|
-
return /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: getMargin(margin), children: [
|
|
2868
|
-
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components37.Header, { title: title != null ? title : "", action: getHeaderAction(callToAction) }),
|
|
2869
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
|
|
2870
|
-
import_components37.DefinitionList,
|
|
2871
|
-
{
|
|
2872
|
-
layout: orientation,
|
|
2873
|
-
definitions: fields.map(
|
|
2874
|
-
({ label, value, help, analyticsId: fieldAnalyticsId }, index) => ({
|
|
2875
|
-
key: String(index),
|
|
2876
|
-
title: label,
|
|
2877
|
-
value: getFieldValue(value, help, orientation, () => onHelpClick(fieldAnalyticsId))
|
|
2878
|
-
})
|
|
2879
|
-
)
|
|
2880
|
-
}
|
|
2881
|
-
) })
|
|
2882
|
-
] });
|
|
2883
|
-
}
|
|
2884
|
-
};
|
|
2885
|
-
var ReviewRenderer_default = ReviewRenderer;
|
|
2886
|
-
var mapControlToDefinitionListLayout = (control) => {
|
|
2887
|
-
switch (control) {
|
|
2888
|
-
case "horizontal":
|
|
2889
|
-
case "horizontal-end-aligned":
|
|
2890
|
-
return "HORIZONTAL_RIGHT_ALIGNED";
|
|
2891
|
-
case "horizontal-start-aligned":
|
|
2892
|
-
return "HORIZONTAL_LEFT_ALIGNED";
|
|
2893
|
-
case "vertical-two-column":
|
|
2894
|
-
return "VERTICAL_TWO_COLUMN";
|
|
2895
|
-
case "vertical":
|
|
2896
|
-
case "vertical-one-column":
|
|
2897
|
-
default:
|
|
2898
|
-
return "VERTICAL_ONE_COLUMN";
|
|
2899
|
-
}
|
|
2900
|
-
};
|
|
2901
|
-
var getFieldValue = (value, help, orientation, onClick) => {
|
|
2902
|
-
if (help) {
|
|
2903
|
-
return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
2904
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Help_default, { help, onClick }),
|
|
2905
|
-
" ",
|
|
2906
|
-
value
|
|
2907
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)(import_jsx_runtime52.Fragment, { children: [
|
|
2908
|
-
value,
|
|
2909
|
-
" ",
|
|
2910
|
-
/* @__PURE__ */ (0, import_jsx_runtime52.jsx)(Help_default, { help, onClick })
|
|
2911
|
-
] });
|
|
2912
|
-
}
|
|
2913
|
-
return value;
|
|
2914
|
-
};
|
|
2915
|
-
|
|
2916
|
-
// ../renderers/src/step/StepRenderer.tsx
|
|
2917
|
-
var import_components39 = require("@transferwise/components");
|
|
2918
|
-
|
|
2919
|
-
// ../renderers/src/step/BackButton.tsx
|
|
2920
|
-
var import_components38 = require("@transferwise/components");
|
|
2921
|
-
var import_icons3 = require("@transferwise/icons");
|
|
2922
|
-
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
2923
|
-
function BackButton({ title, onClick }) {
|
|
2924
|
-
return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "m-b-2", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)(
|
|
2925
|
-
"button",
|
|
2926
|
-
{
|
|
2927
|
-
type: "button",
|
|
2928
|
-
className: "df-back-btn",
|
|
2929
|
-
title,
|
|
2930
|
-
"aria-label": title,
|
|
2931
|
-
onClick,
|
|
2932
|
-
children: [
|
|
2933
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)("span", { className: "sr-only", children: title }),
|
|
2934
|
-
/* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_components38.AvatarView, { interactive: true, children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(import_icons3.ArrowLeft, { size: "24" }) })
|
|
2935
|
-
]
|
|
2879
|
+
// ../renderers/src/step/BackButton.tsx
|
|
2880
|
+
var import_components39 = require("@transferwise/components");
|
|
2881
|
+
var import_icons3 = require("@transferwise/icons");
|
|
2882
|
+
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2883
|
+
function BackButton({ title, onClick }) {
|
|
2884
|
+
return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "m-b-2", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
|
|
2885
|
+
"button",
|
|
2886
|
+
{
|
|
2887
|
+
type: "button",
|
|
2888
|
+
className: "df-back-btn",
|
|
2889
|
+
title,
|
|
2890
|
+
"aria-label": title,
|
|
2891
|
+
onClick,
|
|
2892
|
+
children: [
|
|
2893
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "sr-only", children: title }),
|
|
2894
|
+
/* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components39.AvatarView, { interactive: true, children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_icons3.ArrowLeft, { size: "24" }) })
|
|
2895
|
+
]
|
|
2936
2896
|
}
|
|
2937
2897
|
) });
|
|
2938
2898
|
}
|
|
2939
2899
|
var BackButton_default = BackButton;
|
|
2940
2900
|
|
|
2941
|
-
// ../renderers/src/step/StepRenderer.tsx
|
|
2942
|
-
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
2943
|
-
var StepRenderer = {
|
|
2944
|
-
canRenderType: "step",
|
|
2945
|
-
render: StepRendererComponent
|
|
2946
|
-
};
|
|
2947
|
-
function StepRendererComponent(props) {
|
|
2948
|
-
const { back, description, error, title, children } = props;
|
|
2949
|
-
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
|
|
2950
|
-
back ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(BackButton_default, __spreadValues({}, back)) : null,
|
|
2951
|
-
title || description ? /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "m-b-4", children: [
|
|
2952
|
-
title ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components39.Title, { as: "h1", type: "title-section", className: "text-xs-center m-b-2", children: title }) : void 0,
|
|
2953
|
-
description ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-xs-center np-text-body-large", children: description }) : void 0
|
|
2954
|
-
] }) : void 0,
|
|
2955
|
-
error ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components39.Alert, { type: "negative", className: "m-b-2", message: error }) : void 0,
|
|
2956
|
-
children
|
|
2957
|
-
] });
|
|
2958
|
-
}
|
|
2959
|
-
|
|
2960
|
-
// ../renderers/src/ListRenderer.tsx
|
|
2961
|
-
var import_components40 = require("@transferwise/components");
|
|
2962
|
-
var import_classnames6 = __toESM(require("classnames"));
|
|
2963
|
-
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
2964
|
-
var ListRenderer = {
|
|
2965
|
-
canRenderType: "list",
|
|
2966
|
-
render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: getMargin(margin), children: [
|
|
2967
|
-
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components40.Header, { as: "h2", title: title != null ? title : "", action: getListAction(callToAction) }),
|
|
2968
|
-
items.map((props) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(DesignSystemListItem, __spreadProps(__spreadValues({}, props), { control }), props.title))
|
|
2969
|
-
] })
|
|
2970
|
-
};
|
|
2971
|
-
var DesignSystemListItem = ({
|
|
2972
|
-
title,
|
|
2973
|
-
description,
|
|
2974
|
-
supportingValues,
|
|
2975
|
-
icon,
|
|
2976
|
-
image,
|
|
2977
|
-
control,
|
|
2978
|
-
tag
|
|
2979
|
-
}) => /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2980
|
-
"label",
|
|
2981
|
-
{
|
|
2982
|
-
className: (0, import_classnames6.default)("np-option p-a-2", {
|
|
2983
|
-
"np-option__sm-media": true,
|
|
2984
|
-
"np-option__container-aligned": true
|
|
2985
|
-
}),
|
|
2986
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "media", children: [
|
|
2987
|
-
icon || image ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "media-left", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
|
|
2988
|
-
ListItemMedia,
|
|
2989
|
-
{
|
|
2990
|
-
image,
|
|
2991
|
-
icon,
|
|
2992
|
-
preferAvatar: control === "with-avatar" || tag === "with-avatar"
|
|
2993
|
-
}
|
|
2994
|
-
) }) : null,
|
|
2995
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "media-body", children: [
|
|
2996
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "d-flex justify-content-between", children: [
|
|
2997
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: title }),
|
|
2998
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: supportingValues == null ? void 0 : supportingValues.value })
|
|
2999
|
-
] }),
|
|
3000
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "d-flex justify-content-between", children: [
|
|
3001
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components40.Body, { className: "d-block np-option__body", children: description }),
|
|
3002
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_components40.Body, { className: "d-block np-option__body", children: supportingValues == null ? void 0 : supportingValues.subvalue })
|
|
3003
|
-
] })
|
|
3004
|
-
] })
|
|
3005
|
-
] })
|
|
3006
|
-
},
|
|
3007
|
-
title
|
|
3008
|
-
);
|
|
3009
|
-
var ListItemMedia = ({
|
|
3010
|
-
icon,
|
|
3011
|
-
image,
|
|
3012
|
-
preferAvatar
|
|
3013
|
-
}) => {
|
|
3014
|
-
if (icon) {
|
|
3015
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "circle circle-sm text-primary circle-inverse", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(OptionMedia, { icon, image, preferAvatar }) });
|
|
3016
|
-
}
|
|
3017
|
-
if (image) {
|
|
3018
|
-
return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(OptionMedia, { icon, image, preferAvatar }) });
|
|
3019
|
-
}
|
|
3020
|
-
};
|
|
3021
|
-
var getListAction = (callToAction) => {
|
|
3022
|
-
if (callToAction) {
|
|
3023
|
-
return __spreadValues({
|
|
3024
|
-
"aria-label": callToAction.accessibilityDescription,
|
|
3025
|
-
text: callToAction.title,
|
|
3026
|
-
onClick: callToAction.onClick
|
|
3027
|
-
}, callToAction.type === "link" ? { href: callToAction.href, target: "_blank" } : {});
|
|
3028
|
-
}
|
|
3029
|
-
return void 0;
|
|
3030
|
-
};
|
|
3031
|
-
var ListRenderer_default = ListRenderer;
|
|
3032
|
-
|
|
3033
|
-
// ../renderers/src/step/SplashStepRenderer.tsx
|
|
3034
|
-
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
3035
|
-
var SplashStepRenderer = {
|
|
3036
|
-
canRenderType: "step",
|
|
3037
|
-
canRender: ({ control }) => control === "splash",
|
|
3038
|
-
render: SplashStepRendererComponent
|
|
3039
|
-
};
|
|
3040
|
-
function SplashStepRendererComponent(props) {
|
|
3041
|
-
const { back, children } = props;
|
|
3042
|
-
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "splash-screen m-t-5", children: [
|
|
3043
|
-
back ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(BackButton_default, __spreadValues({}, back)) : null,
|
|
3044
|
-
children
|
|
3045
|
-
] });
|
|
3046
|
-
}
|
|
3047
|
-
|
|
3048
|
-
// ../renderers/src/utils/useCustomTheme.ts
|
|
3049
|
-
var import_components_theming = require("@wise/components-theming");
|
|
3050
|
-
var import_react11 = require("react");
|
|
3051
|
-
var ThemeRequiredEventName = "Theme Required";
|
|
3052
|
-
var useCustomTheme = (theme, trackEvent) => {
|
|
3053
|
-
const previousThemeHookValue = (0, import_components_theming.useTheme)();
|
|
3054
|
-
const previousTheme = (0, import_react11.useMemo)(() => previousThemeHookValue.theme, []);
|
|
3055
|
-
(0, import_react11.useEffect)(() => {
|
|
3056
|
-
trackEvent(ThemeRequiredEventName, { theme });
|
|
3057
|
-
return theme !== previousTheme ? () => {
|
|
3058
|
-
trackEvent(ThemeRequiredEventName, { theme: previousTheme });
|
|
3059
|
-
} : () => {
|
|
3060
|
-
};
|
|
3061
|
-
}, []);
|
|
3062
|
-
};
|
|
3063
|
-
|
|
3064
2901
|
// ../renderers/src/step/SplashCelebrationStepRenderer.tsx
|
|
3065
|
-
var
|
|
2902
|
+
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
3066
2903
|
var SplashCelebrationStepRenderer = {
|
|
3067
2904
|
canRenderType: "step",
|
|
3068
2905
|
canRender: ({ control }) => control === "splash-celebration",
|
|
3069
2906
|
render: SplashCelebrationStepRendererComponent
|
|
3070
2907
|
};
|
|
3071
|
-
function SplashCelebrationStepRendererComponent(props) {
|
|
3072
|
-
const { back, children, trackEvent } = props;
|
|
3073
|
-
useCustomTheme("forest-green", trackEvent);
|
|
3074
|
-
return /* @__PURE__ */ (0,
|
|
3075
|
-
back ? /* @__PURE__ */ (0,
|
|
3076
|
-
children
|
|
3077
|
-
] });
|
|
3078
|
-
}
|
|
3079
|
-
|
|
3080
|
-
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
3081
|
-
var import_components41 = require("@transferwise/components");
|
|
3082
|
-
|
|
3083
|
-
// ../renderers/src/messages/external-confirmation.messages.ts
|
|
3084
|
-
var import_react_intl14 = require("react-intl");
|
|
3085
|
-
var external_confirmation_messages_default = (0, import_react_intl14.defineMessages)({
|
|
3086
|
-
title: {
|
|
3087
|
-
id: "df.wise.ExternalConfirmation.title",
|
|
3088
|
-
defaultMessage: "Please confirm",
|
|
3089
|
-
description: "Heading for the confirmation screen."
|
|
3090
|
-
},
|
|
3091
|
-
description: {
|
|
3092
|
-
id: "df.wise.ExternalConfirmation.description",
|
|
3093
|
-
defaultMessage: "Please confirm you want to open **{origin}** in a new browser tab.",
|
|
3094
|
-
description: "Description for the confirmation screen."
|
|
3095
|
-
},
|
|
3096
|
-
open: {
|
|
3097
|
-
id: "df.wise.ExternalConfirmation.open",
|
|
3098
|
-
defaultMessage: "Open in new tab",
|
|
3099
|
-
description: "Button text confirming opening a new browser tab."
|
|
3100
|
-
},
|
|
3101
|
-
cancel: {
|
|
3102
|
-
id: "df.wise.ExternalConfirmation.cancel",
|
|
3103
|
-
defaultMessage: "Cancel",
|
|
3104
|
-
description: "Button text rejecting opening a new browser tab."
|
|
3105
|
-
}
|
|
3106
|
-
});
|
|
3107
|
-
|
|
3108
|
-
// ../renderers/src/ExternalConfirmationRenderer.tsx
|
|
3109
|
-
var import_react_intl15 = require("react-intl");
|
|
3110
|
-
var import_react12 = require("react");
|
|
3111
|
-
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3112
|
-
var ExternalConfirmationRenderer = {
|
|
3113
|
-
canRenderType: "external-confirmation",
|
|
3114
|
-
render: ExternalConfirmationRendererComponent
|
|
3115
|
-
};
|
|
3116
|
-
function ExternalConfirmationRendererComponent({
|
|
3117
|
-
url,
|
|
3118
|
-
status,
|
|
3119
|
-
onSuccess,
|
|
3120
|
-
onFailure,
|
|
3121
|
-
onCancel
|
|
3122
|
-
}) {
|
|
3123
|
-
const { formatMessage } = (0, import_react_intl15.useIntl)();
|
|
3124
|
-
(0, import_react12.useEffect)(() => {
|
|
3125
|
-
if (url) {
|
|
3126
|
-
const w = window.open(url, "_blank");
|
|
3127
|
-
if (w) {
|
|
3128
|
-
onSuccess();
|
|
3129
|
-
} else {
|
|
3130
|
-
onFailure();
|
|
3131
|
-
}
|
|
3132
|
-
}
|
|
3133
|
-
}, []);
|
|
3134
|
-
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3135
|
-
import_components41.Modal,
|
|
3136
|
-
{
|
|
3137
|
-
open: status === "failure",
|
|
3138
|
-
title: formatMessage(external_confirmation_messages_default.title),
|
|
3139
|
-
body: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
3140
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_components41.Markdown, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(url) }) }),
|
|
3141
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "df-box-renderer-width-lg", children: [
|
|
3142
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3143
|
-
import_components41.Button,
|
|
3144
|
-
{
|
|
3145
|
-
block: true,
|
|
3146
|
-
className: "m-b-2",
|
|
3147
|
-
priority: "primary",
|
|
3148
|
-
size: "md",
|
|
3149
|
-
onClick: () => {
|
|
3150
|
-
window.open(url);
|
|
3151
|
-
onCancel();
|
|
3152
|
-
},
|
|
3153
|
-
children: formatMessage(external_confirmation_messages_default.open)
|
|
3154
|
-
}
|
|
3155
|
-
),
|
|
3156
|
-
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_components41.Button, { block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onCancel, children: formatMessage(external_confirmation_messages_default.cancel) })
|
|
3157
|
-
] }) })
|
|
3158
|
-
] }),
|
|
3159
|
-
onClose: onCancel
|
|
3160
|
-
}
|
|
3161
|
-
);
|
|
2908
|
+
function SplashCelebrationStepRendererComponent(props) {
|
|
2909
|
+
const { back, children, trackEvent } = props;
|
|
2910
|
+
useCustomTheme("forest-green", trackEvent);
|
|
2911
|
+
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("div", { className: "splash-screen m-t-5", children: [
|
|
2912
|
+
back ? /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(BackButton_default, __spreadValues({}, back)) : null,
|
|
2913
|
+
children
|
|
2914
|
+
] });
|
|
3162
2915
|
}
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
}
|
|
2916
|
+
|
|
2917
|
+
// ../renderers/src/step/SplashStepRenderer.tsx
|
|
2918
|
+
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
2919
|
+
var SplashStepRenderer = {
|
|
2920
|
+
canRenderType: "step",
|
|
2921
|
+
canRender: ({ control }) => control === "splash",
|
|
2922
|
+
render: SplashStepRendererComponent
|
|
2923
|
+
};
|
|
2924
|
+
function SplashStepRendererComponent(props) {
|
|
2925
|
+
const { back, children } = props;
|
|
2926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "splash-screen m-t-5", children: [
|
|
2927
|
+
back ? /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(BackButton_default, __spreadValues({}, back)) : null,
|
|
2928
|
+
children
|
|
2929
|
+
] });
|
|
3169
2930
|
}
|
|
3170
|
-
var ExternalConfirmationRenderer_default = ExternalConfirmationRenderer;
|
|
3171
2931
|
|
|
3172
|
-
// ../renderers/src/
|
|
3173
|
-
var
|
|
3174
|
-
var
|
|
3175
|
-
var
|
|
3176
|
-
canRenderType: "
|
|
3177
|
-
render:
|
|
3178
|
-
return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)("section", { className: getMargin(margin), children: [
|
|
3179
|
-
(title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_components42.Header, { title: title != null ? title : "", action: getHeaderAction(callToAction) }),
|
|
3180
|
-
children
|
|
3181
|
-
] });
|
|
3182
|
-
}
|
|
2932
|
+
// ../renderers/src/step/StepRenderer.tsx
|
|
2933
|
+
var import_components40 = require("@transferwise/components");
|
|
2934
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
2935
|
+
var StepRenderer = {
|
|
2936
|
+
canRenderType: "step",
|
|
2937
|
+
render: StepRendererComponent
|
|
3183
2938
|
};
|
|
3184
|
-
|
|
2939
|
+
function StepRendererComponent(props) {
|
|
2940
|
+
const { back, description, error, title, children } = props;
|
|
2941
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
2942
|
+
back ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(BackButton_default, __spreadValues({}, back)) : null,
|
|
2943
|
+
title || description ? /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "m-b-4", children: [
|
|
2944
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_components40.Title, { as: "h1", type: "title-section", className: "text-xs-center m-b-2", children: title }) : void 0,
|
|
2945
|
+
description ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "text-xs-center np-text-body-large", children: description }) : void 0
|
|
2946
|
+
] }) : void 0,
|
|
2947
|
+
error ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_components40.Alert, { type: "negative", className: "m-b-2", message: error }) : void 0,
|
|
2948
|
+
children
|
|
2949
|
+
] });
|
|
2950
|
+
}
|
|
3185
2951
|
|
|
3186
2952
|
// ../renderers/src/TabsRenderer.tsx
|
|
3187
|
-
var
|
|
2953
|
+
var import_components41 = require("@transferwise/components");
|
|
3188
2954
|
var import_react13 = require("react");
|
|
3189
|
-
var
|
|
2955
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
3190
2956
|
var TabsRenderer = {
|
|
3191
2957
|
canRenderType: "tabs",
|
|
3192
2958
|
render: (props) => {
|
|
3193
2959
|
switch (props.control) {
|
|
3194
2960
|
case "segmented":
|
|
3195
2961
|
if (props.tabs.length > 3) {
|
|
3196
|
-
return /* @__PURE__ */ (0,
|
|
2962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TabsRendererComponent, __spreadValues({}, props));
|
|
3197
2963
|
}
|
|
3198
|
-
return /* @__PURE__ */ (0,
|
|
2964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(SegmentedTabsRendererComponent, __spreadValues({}, props));
|
|
3199
2965
|
case "chips":
|
|
3200
|
-
return /* @__PURE__ */ (0,
|
|
2966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ChipsTabsRendererComponent, __spreadValues({}, props));
|
|
3201
2967
|
default:
|
|
3202
|
-
return /* @__PURE__ */ (0,
|
|
2968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(TabsRendererComponent, __spreadValues({}, props));
|
|
3203
2969
|
}
|
|
3204
2970
|
}
|
|
3205
2971
|
};
|
|
3206
2972
|
function TabsRendererComponent({ uid, margin, tabs }) {
|
|
3207
2973
|
const [selectedIndex, setSelectedIndex] = (0, import_react13.useState)(0);
|
|
3208
|
-
return /* @__PURE__ */ (0,
|
|
3209
|
-
|
|
2974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
2975
|
+
import_components41.Tabs,
|
|
3210
2976
|
{
|
|
3211
2977
|
name: uid,
|
|
3212
2978
|
selected: selectedIndex != null ? selectedIndex : 0,
|
|
3213
2979
|
tabs: tabs.map((option) => ({
|
|
3214
2980
|
title: option.title,
|
|
3215
2981
|
disabled: false,
|
|
3216
|
-
content: /* @__PURE__ */ (0,
|
|
2982
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "m-t-2", children: [
|
|
3217
2983
|
" ",
|
|
3218
2984
|
option.children,
|
|
3219
2985
|
" "
|
|
@@ -3226,9 +2992,9 @@ function TabsRendererComponent({ uid, margin, tabs }) {
|
|
|
3226
2992
|
function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
3227
2993
|
var _a;
|
|
3228
2994
|
const [selectedIndex, setSelectedIndex] = (0, import_react13.useState)(0);
|
|
3229
|
-
return /* @__PURE__ */ (0,
|
|
3230
|
-
/* @__PURE__ */ (0,
|
|
3231
|
-
|
|
2995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: getMargin(margin), children: [
|
|
2996
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
2997
|
+
import_components41.SegmentedControl,
|
|
3232
2998
|
{
|
|
3233
2999
|
name: uid,
|
|
3234
3000
|
value: String(selectedIndex),
|
|
@@ -3242,75 +3008,277 @@ function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
|
|
|
3242
3008
|
onChange: (value) => setSelectedIndex(Number(value))
|
|
3243
3009
|
}
|
|
3244
3010
|
),
|
|
3245
|
-
/* @__PURE__ */ (0,
|
|
3011
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { id: `${uid}-children`, className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
3246
3012
|
] });
|
|
3247
3013
|
}
|
|
3248
3014
|
function ChipsTabsRendererComponent({ margin, tabs }) {
|
|
3249
3015
|
var _a;
|
|
3250
3016
|
const [selectedIndex, setSelectedIndex] = (0, import_react13.useState)(0);
|
|
3251
|
-
return /* @__PURE__ */ (0,
|
|
3252
|
-
/* @__PURE__ */ (0,
|
|
3253
|
-
|
|
3017
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: getMargin(margin), children: [
|
|
3018
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "chips-container", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
3019
|
+
import_components41.Chips,
|
|
3254
3020
|
{
|
|
3255
3021
|
chips: tabs.map((tab, index) => ({ label: tab.title, value: index })),
|
|
3256
3022
|
selected: selectedIndex,
|
|
3257
3023
|
onChange: ({ selectedValue }) => setSelectedIndex(Number(selectedValue))
|
|
3258
3024
|
}
|
|
3259
3025
|
) }),
|
|
3260
|
-
/* @__PURE__ */ (0,
|
|
3026
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
|
|
3261
3027
|
] });
|
|
3262
3028
|
}
|
|
3263
3029
|
|
|
3030
|
+
// ../renderers/src/TextInputRenderer.tsx
|
|
3031
|
+
var import_components43 = require("@transferwise/components");
|
|
3032
|
+
|
|
3033
|
+
// ../renderers/src/components/VariableTextInput.tsx
|
|
3034
|
+
var import_components42 = require("@transferwise/components");
|
|
3035
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
3036
|
+
var commonKeys = [
|
|
3037
|
+
"autoComplete",
|
|
3038
|
+
"autoCapitalize",
|
|
3039
|
+
"placeholder",
|
|
3040
|
+
"control",
|
|
3041
|
+
"disabled",
|
|
3042
|
+
"displayFormat",
|
|
3043
|
+
"id",
|
|
3044
|
+
"onBlur",
|
|
3045
|
+
"onFocus",
|
|
3046
|
+
"placeholder",
|
|
3047
|
+
"value"
|
|
3048
|
+
];
|
|
3049
|
+
function VariableTextInput(inputProps) {
|
|
3050
|
+
const { id, value, control, onChange } = inputProps;
|
|
3051
|
+
const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
|
|
3052
|
+
switch (control) {
|
|
3053
|
+
case "email":
|
|
3054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
|
|
3055
|
+
case "password":
|
|
3056
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
|
|
3057
|
+
case "numeric": {
|
|
3058
|
+
const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
|
|
3059
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
3060
|
+
TextInput,
|
|
3061
|
+
__spreadProps(__spreadValues({}, numericProps), {
|
|
3062
|
+
onChange: (newValue) => {
|
|
3063
|
+
const numericValueOrNull = !Number.isNaN(Number.parseFloat(newValue)) ? newValue : null;
|
|
3064
|
+
onChange(numericValueOrNull);
|
|
3065
|
+
}
|
|
3066
|
+
})
|
|
3067
|
+
);
|
|
3068
|
+
}
|
|
3069
|
+
case "phone-number":
|
|
3070
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_components42.PhoneNumberInput, __spreadProps(__spreadValues({ initialValue: value }, commonProps), { onChange }));
|
|
3071
|
+
default: {
|
|
3072
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "text", onChange }));
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
}
|
|
3076
|
+
function TextInput(props) {
|
|
3077
|
+
const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
|
|
3078
|
+
const InputWithPattern = control === "textarea" ? import_components42.TextareaWithDisplayFormat : import_components42.InputWithDisplayFormat;
|
|
3079
|
+
const InputWithoutPattern = control === "textarea" ? import_components42.TextArea : import_components42.Input;
|
|
3080
|
+
return displayFormat ? /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { onChange: (e) => onChange(e.target.value) }));
|
|
3081
|
+
}
|
|
3082
|
+
|
|
3083
|
+
// ../renderers/src/TextInputRenderer.tsx
|
|
3084
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
3085
|
+
var TextInputRenderer = {
|
|
3086
|
+
canRenderType: "input-text",
|
|
3087
|
+
render: (props) => {
|
|
3088
|
+
const _a = props, {
|
|
3089
|
+
id,
|
|
3090
|
+
title,
|
|
3091
|
+
description,
|
|
3092
|
+
help,
|
|
3093
|
+
icon,
|
|
3094
|
+
image,
|
|
3095
|
+
validationState,
|
|
3096
|
+
value: initialValue,
|
|
3097
|
+
onChange
|
|
3098
|
+
} = _a, rest = __objRest(_a, [
|
|
3099
|
+
"id",
|
|
3100
|
+
"title",
|
|
3101
|
+
"description",
|
|
3102
|
+
"help",
|
|
3103
|
+
"icon",
|
|
3104
|
+
"image",
|
|
3105
|
+
"validationState",
|
|
3106
|
+
"value",
|
|
3107
|
+
"onChange"
|
|
3108
|
+
]);
|
|
3109
|
+
const value = initialValue != null ? initialValue : "";
|
|
3110
|
+
const inputProps = __spreadProps(__spreadValues({}, rest), {
|
|
3111
|
+
value,
|
|
3112
|
+
id,
|
|
3113
|
+
onChange: (newValue) => {
|
|
3114
|
+
if ((value != null ? value : "") !== (newValue != null ? newValue : "")) {
|
|
3115
|
+
onChange(newValue);
|
|
3116
|
+
}
|
|
3117
|
+
}
|
|
3118
|
+
});
|
|
3119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
3120
|
+
FieldInput_default,
|
|
3121
|
+
{
|
|
3122
|
+
id,
|
|
3123
|
+
label: title,
|
|
3124
|
+
description,
|
|
3125
|
+
validation: validationState,
|
|
3126
|
+
help,
|
|
3127
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_components43.InputGroup, { addonStart: getInputGroupAddonStart({ icon, image }), children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(VariableTextInput, __spreadValues({}, inputProps)) })
|
|
3128
|
+
}
|
|
3129
|
+
);
|
|
3130
|
+
}
|
|
3131
|
+
};
|
|
3132
|
+
|
|
3133
|
+
// ../renderers/src/UploadInputRenderer.tsx
|
|
3134
|
+
var import_components44 = require("@transferwise/components");
|
|
3135
|
+
|
|
3136
|
+
// ../renderers/src/utils/getRandomId.ts
|
|
3137
|
+
var getRandomId = () => Math.random().toString(36).substring(2);
|
|
3138
|
+
|
|
3139
|
+
// ../renderers/src/UploadInputRenderer.tsx
|
|
3140
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
3141
|
+
var UploadInputRenderer = {
|
|
3142
|
+
canRenderType: "input-upload",
|
|
3143
|
+
render: (props) => {
|
|
3144
|
+
const { id, accepts, title, description, disabled, maxSize, validationState, onUpload } = props;
|
|
3145
|
+
const onUploadFile = async (formData) => {
|
|
3146
|
+
const file = formData.get("file");
|
|
3147
|
+
return onUpload(file).then(() => ({
|
|
3148
|
+
id: getRandomId()
|
|
3149
|
+
}));
|
|
3150
|
+
};
|
|
3151
|
+
const onDeleteFile = async () => {
|
|
3152
|
+
await onUpload(null);
|
|
3153
|
+
};
|
|
3154
|
+
return (
|
|
3155
|
+
// We don't pass help here as there is no sensible place to display it
|
|
3156
|
+
/* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3157
|
+
UploadFieldInput_default,
|
|
3158
|
+
{
|
|
3159
|
+
id,
|
|
3160
|
+
label: void 0,
|
|
3161
|
+
description: void 0,
|
|
3162
|
+
validation: validationState,
|
|
3163
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3164
|
+
import_components44.UploadInput,
|
|
3165
|
+
{
|
|
3166
|
+
id,
|
|
3167
|
+
description,
|
|
3168
|
+
disabled,
|
|
3169
|
+
fileTypes: getAcceptsString(accepts),
|
|
3170
|
+
sizeLimit: maxSize ? toKilobytes(maxSize) : void 0,
|
|
3171
|
+
uploadButtonTitle: title,
|
|
3172
|
+
onDeleteFile,
|
|
3173
|
+
onUploadFile
|
|
3174
|
+
}
|
|
3175
|
+
)
|
|
3176
|
+
}
|
|
3177
|
+
)
|
|
3178
|
+
);
|
|
3179
|
+
}
|
|
3180
|
+
};
|
|
3181
|
+
var LargeUploadRenderer = {
|
|
3182
|
+
canRenderType: "input-upload",
|
|
3183
|
+
canRender: (props) => props.control === "upload-large",
|
|
3184
|
+
render: (props) => {
|
|
3185
|
+
const _a = props, {
|
|
3186
|
+
id,
|
|
3187
|
+
accepts,
|
|
3188
|
+
control,
|
|
3189
|
+
title,
|
|
3190
|
+
description,
|
|
3191
|
+
disabled,
|
|
3192
|
+
help,
|
|
3193
|
+
type,
|
|
3194
|
+
validationState,
|
|
3195
|
+
onUpload
|
|
3196
|
+
} = _a, rest = __objRest(_a, [
|
|
3197
|
+
"id",
|
|
3198
|
+
"accepts",
|
|
3199
|
+
"control",
|
|
3200
|
+
"title",
|
|
3201
|
+
"description",
|
|
3202
|
+
"disabled",
|
|
3203
|
+
"help",
|
|
3204
|
+
"type",
|
|
3205
|
+
"validationState",
|
|
3206
|
+
"onUpload"
|
|
3207
|
+
]);
|
|
3208
|
+
const uploadProps = __spreadProps(__spreadValues({}, rest), { id, name: id });
|
|
3209
|
+
const onUploadFile = async (file, fileName) => {
|
|
3210
|
+
try {
|
|
3211
|
+
const convertedFile = file ? await toFile(file, fileName) : null;
|
|
3212
|
+
await onUpload(convertedFile);
|
|
3213
|
+
} catch (e) {
|
|
3214
|
+
await onUpload(null);
|
|
3215
|
+
throw e;
|
|
3216
|
+
}
|
|
3217
|
+
};
|
|
3218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3219
|
+
FieldInput_default,
|
|
3220
|
+
{
|
|
3221
|
+
id,
|
|
3222
|
+
label: title,
|
|
3223
|
+
description,
|
|
3224
|
+
validation: validationState,
|
|
3225
|
+
help,
|
|
3226
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
|
|
3227
|
+
import_components44.Upload,
|
|
3228
|
+
__spreadProps(__spreadValues({}, uploadProps), {
|
|
3229
|
+
usAccept: getAcceptsString(accepts),
|
|
3230
|
+
usDisabled: disabled,
|
|
3231
|
+
onSuccess: onUploadFile,
|
|
3232
|
+
onFailure: async () => onUpload(null),
|
|
3233
|
+
onCancel: async () => onUpload(null)
|
|
3234
|
+
})
|
|
3235
|
+
)
|
|
3236
|
+
}
|
|
3237
|
+
);
|
|
3238
|
+
}
|
|
3239
|
+
};
|
|
3240
|
+
|
|
3264
3241
|
// ../renderers/src/getWiseRenderers.ts
|
|
3265
3242
|
var getWiseRenderers = () => [
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3243
|
+
AlertRenderer,
|
|
3244
|
+
CheckboxInputRenderer,
|
|
3245
|
+
BoxRenderer,
|
|
3246
|
+
ButtonRenderer,
|
|
3247
|
+
ColumnsRenderer,
|
|
3248
|
+
DateInputRenderer,
|
|
3249
|
+
DecisionRenderer,
|
|
3250
|
+
DividerRenderer,
|
|
3251
|
+
ExternalConfirmationRenderer,
|
|
3252
|
+
FormRenderer,
|
|
3253
|
+
FormSectionRenderer,
|
|
3254
|
+
HeadingRenderer,
|
|
3255
|
+
ImageRenderer,
|
|
3256
|
+
InstructionsRenderer,
|
|
3257
|
+
IntegerInputRenderer,
|
|
3281
3258
|
LargeUploadRenderer,
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3259
|
+
ListRenderer,
|
|
3260
|
+
LoadingIndicatorRenderer,
|
|
3261
|
+
MarkdownRenderer,
|
|
3262
|
+
ModalContentRenderer,
|
|
3263
|
+
ModalLayoutRenderer,
|
|
3264
|
+
MultiSelectInputRenderer,
|
|
3265
|
+
MultiUploadInputRenderer,
|
|
3266
|
+
NumberInputRenderer,
|
|
3267
|
+
ParagraphRenderer,
|
|
3268
|
+
RepeatableRenderer,
|
|
3269
|
+
ReviewRenderer,
|
|
3270
|
+
SearchRenderer,
|
|
3271
|
+
SelectInputRenderer,
|
|
3272
|
+
SectionRenderer,
|
|
3273
|
+
StatusListRenderer,
|
|
3296
3274
|
TabsRenderer,
|
|
3297
|
-
|
|
3275
|
+
TextInputRenderer,
|
|
3298
3276
|
UploadInputRenderer,
|
|
3299
3277
|
SplashStepRenderer,
|
|
3300
3278
|
SplashCelebrationStepRenderer,
|
|
3301
3279
|
StepRenderer
|
|
3302
3280
|
];
|
|
3303
3281
|
|
|
3304
|
-
// ../renderers/src/ModalContentRenderer.tsx
|
|
3305
|
-
var import_components44 = require("@transferwise/components");
|
|
3306
|
-
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
3307
|
-
var ModalContentRenderer = {
|
|
3308
|
-
canRenderType: "modal-content",
|
|
3309
|
-
render: ({ title, children, open, onClose }) => {
|
|
3310
|
-
return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_components44.Modal, { open, title, body: children, onClose });
|
|
3311
|
-
}
|
|
3312
|
-
};
|
|
3313
|
-
|
|
3314
3282
|
// src/dynamicFlow/telemetry/app-version.ts
|
|
3315
3283
|
var appVersion = (
|
|
3316
3284
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
@@ -3373,10 +3341,7 @@ function DynamicFlowRevamp(props) {
|
|
|
3373
3341
|
onThemeChange
|
|
3374
3342
|
} = props;
|
|
3375
3343
|
const httpClient = useWiseHttpClient(customFetch);
|
|
3376
|
-
const mergedRenderers = (0, import_react14.useMemo)(
|
|
3377
|
-
() => [ModalContentRenderer, ...renderers != null ? renderers : [], ...wiseRenderers],
|
|
3378
|
-
[renderers]
|
|
3379
|
-
);
|
|
3344
|
+
const mergedRenderers = (0, import_react14.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
3380
3345
|
const logEvent = (0, import_react14.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
3381
3346
|
const trackEvent = (0, import_react14.useMemo)(
|
|
3382
3347
|
() => getTrackEvent(onEvent, onAnalytics, onThemeChange),
|
|
@@ -3403,10 +3368,7 @@ var DynamicForm = (0, import_react14.forwardRef)(function DynamicForm2(props, re
|
|
|
3403
3368
|
onThemeChange
|
|
3404
3369
|
} = props;
|
|
3405
3370
|
const httpClient = useWiseHttpClient(customFetch);
|
|
3406
|
-
const mergedRenderers = (0, import_react14.useMemo)(
|
|
3407
|
-
() => [ModalContentRenderer, ...renderers != null ? renderers : [], ...wiseRenderers],
|
|
3408
|
-
[renderers]
|
|
3409
|
-
);
|
|
3371
|
+
const mergedRenderers = (0, import_react14.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
|
|
3410
3372
|
const logEvent = (0, import_react14.useMemo)(() => getLogEvent(onLog), [onLog]);
|
|
3411
3373
|
const trackEvent = (0, import_react14.useMemo)(
|
|
3412
3374
|
() => getTrackEvent(onEvent, onAnalytics, onThemeChange),
|