@wise/dynamic-flow-client-internal 4.15.7 → 4.16.0-exp-modal-renderer-c6d2baa

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.mjs CHANGED
@@ -691,7 +691,102 @@ var mapCtaToAlertAction = (callToAction) => {
691
691
  }
692
692
  return void 0;
693
693
  };
694
- var AlertRenderer_default = AlertRenderer;
694
+
695
+ // ../renderers/src/BoxRenderer.tsx
696
+ import classNames from "classnames";
697
+ import { jsx as jsx2 } from "react/jsx-runtime";
698
+ var BoxRenderer = {
699
+ canRenderType: "box",
700
+ render: ({ children, control, margin, width }) => {
701
+ const hasFixedWidth = width !== "xl";
702
+ const hasBorder = control === "bordered" || control === "bordered-web";
703
+ const contents = /* @__PURE__ */ jsx2(
704
+ "div",
705
+ {
706
+ className: classNames({
707
+ "df-box-renderer-border": hasBorder,
708
+ [`df-box-renderer-width-${width}`]: hasFixedWidth,
709
+ [getMargin(margin)]: !hasFixedWidth
710
+ }),
711
+ children
712
+ }
713
+ );
714
+ return hasFixedWidth ? /* @__PURE__ */ jsx2("div", { className: classNames("df-box-renderer-fixed-width", getMargin(margin)), children: contents }) : contents;
715
+ }
716
+ };
717
+
718
+ // ../renderers/src/ButtonRenderer.tsx
719
+ import { Button } from "@transferwise/components";
720
+ import { useState } from "react";
721
+ import { jsx as jsx3 } from "react/jsx-runtime";
722
+ var ButtonRenderer = {
723
+ canRenderType: "button",
724
+ render: ButtonComponent
725
+ };
726
+ function ButtonComponent(props) {
727
+ const { control, context, disabled, margin, title, size, stepLoadingState, onClick } = props;
728
+ const [isActive, setActive] = useState(false);
729
+ const isLoading = isActive && stepLoadingState !== "idle";
730
+ const priority = mapControl(control);
731
+ const type = priority === "tertiary" ? void 0 : mapContext(context);
732
+ return /* @__PURE__ */ jsx3(
733
+ Button,
734
+ {
735
+ block: true,
736
+ className: getMargin(margin),
737
+ disabled: isLoading ? false : disabled,
738
+ priority,
739
+ size: mapSize(size),
740
+ loading: isLoading,
741
+ type,
742
+ onClick: () => {
743
+ setActive(true);
744
+ onClick();
745
+ },
746
+ onBlur: () => {
747
+ setActive(false);
748
+ },
749
+ children: title
750
+ }
751
+ );
752
+ }
753
+ var mapContext = (context) => {
754
+ switch (context) {
755
+ case "neutral":
756
+ case "warning":
757
+ return "accent";
758
+ default:
759
+ return context;
760
+ }
761
+ };
762
+ var mapControl = (control) => {
763
+ switch (control) {
764
+ case "primary":
765
+ case "tertiary":
766
+ return control;
767
+ default:
768
+ return "secondary";
769
+ }
770
+ };
771
+ var mapSize = (size) => {
772
+ if (!size) {
773
+ return void 0;
774
+ }
775
+ switch (size) {
776
+ case "xs":
777
+ case "sm":
778
+ return "sm";
779
+ case "lg":
780
+ case "xl":
781
+ return "lg";
782
+ case "md":
783
+ default:
784
+ return "md";
785
+ }
786
+ };
787
+
788
+ // ../renderers/src/CheckboxInputRenderer.tsx
789
+ import { Checkbox } from "@transferwise/components";
695
790
 
696
791
  // ../renderers/src/components/FieldInput.tsx
697
792
  import { Field } from "@transferwise/components";
@@ -711,14 +806,14 @@ var help_messages_default = defineMessages({
711
806
  });
712
807
 
713
808
  // ../renderers/src/components/Help.tsx
714
- import { jsx as jsx2 } from "react/jsx-runtime";
809
+ import { jsx as jsx4 } from "react/jsx-runtime";
715
810
  function Help({ help, onClick }) {
716
811
  const intl = useIntl();
717
- return /* @__PURE__ */ jsx2(
812
+ return /* @__PURE__ */ jsx4(
718
813
  Info,
719
814
  {
720
815
  className: "m-l-1",
721
- content: /* @__PURE__ */ jsx2(Markdown, { config: { link: { target: "_blank" } }, children: help }),
816
+ content: /* @__PURE__ */ jsx4(Markdown, { config: { link: { target: "_blank" } }, children: help }),
722
817
  presentation: "POPOVER",
723
818
  size: "sm",
724
819
  "aria-label": intl.formatMessage(help_messages_default.helpAria),
@@ -729,19 +824,19 @@ function Help({ help, onClick }) {
729
824
  var Help_default = Help;
730
825
 
731
826
  // ../renderers/src/components/LabelContentWithHelp.tsx
732
- import { jsx as jsx3, jsxs } from "react/jsx-runtime";
827
+ import { jsx as jsx5, jsxs } from "react/jsx-runtime";
733
828
  function LabelContentWithHelp({ text, help }) {
734
829
  return /* @__PURE__ */ jsxs("div", { children: [
735
830
  text,
736
- /* @__PURE__ */ jsx3(Help_default, { help })
831
+ /* @__PURE__ */ jsx5(Help_default, { help })
737
832
  ] });
738
833
  }
739
834
 
740
835
  // ../renderers/src/components/FieldInput.tsx
741
- import { jsx as jsx4 } from "react/jsx-runtime";
836
+ import { jsx as jsx6 } from "react/jsx-runtime";
742
837
  function FieldInput({ id, children, label, validation, description, help }) {
743
- const labelContent = label && help ? /* @__PURE__ */ jsx4(LabelContentWithHelp, { text: label, help }) : label;
744
- return /* @__PURE__ */ jsx4(
838
+ const labelContent = label && help ? /* @__PURE__ */ jsx6(LabelContentWithHelp, { text: label, help }) : label;
839
+ return /* @__PURE__ */ jsx6(
745
840
  Field,
746
841
  {
747
842
  id,
@@ -765,8 +860,7 @@ var mapStatusToSentiment = (validation) => {
765
860
  var FieldInput_default = FieldInput;
766
861
 
767
862
  // ../renderers/src/CheckboxInputRenderer.tsx
768
- import { Checkbox } from "@transferwise/components";
769
- import { jsx as jsx5 } from "react/jsx-runtime";
863
+ import { jsx as jsx7 } from "react/jsx-runtime";
770
864
  var CheckboxInputRenderer = {
771
865
  canRenderType: "input-checkbox",
772
866
  render: (props) => {
@@ -790,105 +884,9 @@ var CheckboxInputRenderer = {
790
884
  "value"
791
885
  ]);
792
886
  const checkboxProps = __spreadProps(__spreadValues({}, rest), { label: title, secondary: description, checked: value });
793
- return /* @__PURE__ */ jsx5(FieldInput_default, { id, label: "", description: "", validation: validationState, help, children: /* @__PURE__ */ jsx5(Checkbox, __spreadValues({ id }, checkboxProps)) });
794
- }
795
- };
796
- var CheckboxInputRenderer_default = CheckboxInputRenderer;
797
-
798
- // ../renderers/src/BoxRenderer.tsx
799
- import classNames from "classnames";
800
- import { jsx as jsx6 } from "react/jsx-runtime";
801
- var BoxRenderer = {
802
- canRenderType: "box",
803
- render: ({ children, control, margin, width }) => {
804
- const hasFixedWidth = width !== "xl";
805
- const hasBorder = control === "bordered" || control === "bordered-web";
806
- const contents = /* @__PURE__ */ jsx6(
807
- "div",
808
- {
809
- className: classNames({
810
- "df-box-renderer-border": hasBorder,
811
- [`df-box-renderer-width-${width}`]: hasFixedWidth,
812
- [getMargin(margin)]: !hasFixedWidth
813
- }),
814
- children
815
- }
816
- );
817
- return hasFixedWidth ? /* @__PURE__ */ jsx6("div", { className: classNames("df-box-renderer-fixed-width", getMargin(margin)), children: contents }) : contents;
818
- }
819
- };
820
- var BoxRenderer_default = BoxRenderer;
821
-
822
- // ../renderers/src/ButtonRenderer.tsx
823
- import { Button } from "@transferwise/components";
824
- import { useState } from "react";
825
- import { jsx as jsx7 } from "react/jsx-runtime";
826
- var ButtonRenderer = {
827
- canRenderType: "button",
828
- render: ButtonComponent
829
- };
830
- function ButtonComponent(props) {
831
- const { control, context, disabled, margin, title, size, stepLoadingState, onClick } = props;
832
- const [isActive, setActive] = useState(false);
833
- const isLoading = isActive && stepLoadingState !== "idle";
834
- const priority = mapControl(control);
835
- const type = priority === "tertiary" ? void 0 : mapContext(context);
836
- return /* @__PURE__ */ jsx7(
837
- Button,
838
- {
839
- block: true,
840
- className: getMargin(margin),
841
- disabled: isLoading ? false : disabled,
842
- priority,
843
- size: mapSize(size),
844
- loading: isLoading,
845
- type,
846
- onClick: () => {
847
- setActive(true);
848
- onClick();
849
- },
850
- onBlur: () => {
851
- setActive(false);
852
- },
853
- children: title
854
- }
855
- );
856
- }
857
- var mapContext = (context) => {
858
- switch (context) {
859
- case "neutral":
860
- case "warning":
861
- return "accent";
862
- default:
863
- return context;
864
- }
865
- };
866
- var mapControl = (control) => {
867
- switch (control) {
868
- case "primary":
869
- case "tertiary":
870
- return control;
871
- default:
872
- return "secondary";
873
- }
874
- };
875
- var mapSize = (size) => {
876
- if (!size) {
877
- return void 0;
878
- }
879
- switch (size) {
880
- case "xs":
881
- case "sm":
882
- return "sm";
883
- case "lg":
884
- case "xl":
885
- return "lg";
886
- case "md":
887
- default:
888
- return "md";
887
+ return /* @__PURE__ */ jsx7(FieldInput_default, { id, label: "", description: "", validation: validationState, help, children: /* @__PURE__ */ jsx7(Checkbox, __spreadValues({ id }, checkboxProps)) });
889
888
  }
890
889
  };
891
- var ButtonRenderer_default = ButtonRenderer;
892
890
 
893
891
  // ../renderers/src/ColumnsRenderer.tsx
894
892
  import classNames2 from "classnames";
@@ -909,7 +907,6 @@ var ColumnsRenderer = {
909
907
  }
910
908
  )
911
909
  };
912
- var ColumnsRenderer_default = ColumnsRenderer;
913
910
 
914
911
  // ../renderers/src/components/VariableDateInput.tsx
915
912
  import { DateInput, DateLookup } from "@transferwise/components";
@@ -1026,7 +1023,6 @@ var DateInputRenderer = {
1026
1023
  );
1027
1024
  }
1028
1025
  };
1029
- var DateInputRenderer_default = DateInputRenderer;
1030
1026
 
1031
1027
  // ../renderers/src/DecisionRenderer.tsx
1032
1028
  import { Header, NavigationOption, NavigationOptionsList } from "@transferwise/components";
@@ -1180,7 +1176,6 @@ var DecisionRenderer = {
1180
1176
  }) })
1181
1177
  ] })
1182
1178
  };
1183
- var DecisionRenderer_default = DecisionRenderer;
1184
1179
 
1185
1180
  // ../renderers/src/DividerRenderer.tsx
1186
1181
  import { jsx as jsx18 } from "react/jsx-runtime";
@@ -1188,65 +1183,153 @@ var DividerRenderer = {
1188
1183
  canRenderType: "divider",
1189
1184
  render: ({ margin }) => /* @__PURE__ */ jsx18("hr", { className: `m-t-0 ${getMargin(margin)}` })
1190
1185
  };
1191
- var DividerRenderer_default = DividerRenderer;
1192
1186
 
1193
- // ../renderers/src/FormRenderer.tsx
1194
- import { jsx as jsx19 } from "react/jsx-runtime";
1195
- var FormRenderer = {
1196
- canRenderType: "form",
1197
- render: ({ children, margin }) => /* @__PURE__ */ jsx19("div", { className: getMargin(margin), children })
1198
- };
1199
- var FormRenderer_default = FormRenderer;
1187
+ // ../renderers/src/ExternalConfirmationRenderer.tsx
1188
+ import { Button as Button2, Markdown as Markdown2, Modal } from "@transferwise/components";
1200
1189
 
1201
- // ../renderers/src/FormSectionRenderer.tsx
1202
- import { Header as Header2 } from "@transferwise/components";
1203
- import { jsx as jsx20, jsxs as jsxs4 } from "react/jsx-runtime";
1204
- var FormSectionRenderer = {
1205
- canRenderType: "form-section",
1206
- render: ({ title, description, children }) => /* @__PURE__ */ jsxs4("fieldset", { children: [
1207
- title && /* @__PURE__ */ jsx20(
1208
- Header2,
1209
- {
1210
- as: "h2",
1211
- title
1212
- }
1213
- ),
1214
- description && /* @__PURE__ */ jsx20("p", { children: description }),
1215
- children
1216
- ] })
1217
- };
1218
- var FormSectionRenderer_default = FormSectionRenderer;
1190
+ // ../renderers/src/messages/external-confirmation.messages.ts
1191
+ import { defineMessages as defineMessages2 } from "react-intl";
1192
+ var external_confirmation_messages_default = defineMessages2({
1193
+ title: {
1194
+ id: "df.wise.ExternalConfirmation.title",
1195
+ defaultMessage: "Please confirm",
1196
+ description: "Heading for the confirmation screen."
1197
+ },
1198
+ description: {
1199
+ id: "df.wise.ExternalConfirmation.description",
1200
+ defaultMessage: "Please confirm you want to open **{origin}** in a new browser tab.",
1201
+ description: "Description for the confirmation screen."
1202
+ },
1203
+ open: {
1204
+ id: "df.wise.ExternalConfirmation.open",
1205
+ defaultMessage: "Open in new tab",
1206
+ description: "Button text confirming opening a new browser tab."
1207
+ },
1208
+ cancel: {
1209
+ id: "df.wise.ExternalConfirmation.cancel",
1210
+ defaultMessage: "Cancel",
1211
+ description: "Button text rejecting opening a new browser tab."
1212
+ }
1213
+ });
1219
1214
 
1220
- // ../renderers/src/HeadingRenderer.tsx
1221
- import { Display, Title } from "@transferwise/components";
1222
- import { jsx as jsx21 } from "react/jsx-runtime";
1223
- var HeadingRenderer = {
1224
- canRenderType: "heading",
1225
- render: (props) => /* @__PURE__ */ jsx21(Heading, __spreadValues({}, props))
1215
+ // ../renderers/src/ExternalConfirmationRenderer.tsx
1216
+ import { useIntl as useIntl2 } from "react-intl";
1217
+ import { useEffect } from "react";
1218
+ import { Fragment, jsx as jsx19, jsxs as jsxs4 } from "react/jsx-runtime";
1219
+ var ExternalConfirmationRenderer = {
1220
+ canRenderType: "external-confirmation",
1221
+ render: ExternalConfirmationRendererComponent
1226
1222
  };
1227
- function Heading(props) {
1228
- const { text, size, align, margin, control } = props;
1229
- const className = getTextAlignmentAndMargin({ align, margin });
1230
- return control === "display" ? /* @__PURE__ */ jsx21(DisplayHeading, { size, text, className }) : /* @__PURE__ */ jsx21(StandardHeading, { size, text, className });
1231
- }
1232
- function DisplayHeading({ size, text, className }) {
1233
- return /* @__PURE__ */ jsx21(Display, { type: getDisplayType(size), className, children: text });
1234
- }
1235
- var getDisplayType = (size) => {
1236
- switch (size) {
1237
- case "xs":
1238
- case "sm":
1239
- return "display-small";
1240
- case "xl":
1241
- case "lg":
1242
- return "display-large";
1243
- case "md":
1244
- default:
1223
+ function ExternalConfirmationRendererComponent({
1224
+ url,
1225
+ status,
1226
+ onSuccess,
1227
+ onFailure,
1228
+ onCancel
1229
+ }) {
1230
+ const { formatMessage } = useIntl2();
1231
+ useEffect(() => {
1232
+ if (url) {
1233
+ const w = window.open(url, "_blank");
1234
+ if (w) {
1235
+ onSuccess();
1236
+ } else {
1237
+ onFailure();
1238
+ }
1239
+ }
1240
+ }, []);
1241
+ return /* @__PURE__ */ jsx19(
1242
+ Modal,
1243
+ {
1244
+ open: status === "failure",
1245
+ title: formatMessage(external_confirmation_messages_default.title),
1246
+ body: /* @__PURE__ */ jsxs4(Fragment, { children: [
1247
+ /* @__PURE__ */ jsx19(Markdown2, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(url) }) }),
1248
+ /* @__PURE__ */ jsx19("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ jsxs4("div", { className: "df-box-renderer-width-lg", children: [
1249
+ /* @__PURE__ */ jsx19(
1250
+ Button2,
1251
+ {
1252
+ block: true,
1253
+ className: "m-b-2",
1254
+ priority: "primary",
1255
+ size: "md",
1256
+ onClick: () => {
1257
+ window.open(url);
1258
+ onCancel();
1259
+ },
1260
+ children: formatMessage(external_confirmation_messages_default.open)
1261
+ }
1262
+ ),
1263
+ /* @__PURE__ */ jsx19(Button2, { block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onCancel, children: formatMessage(external_confirmation_messages_default.cancel) })
1264
+ ] }) })
1265
+ ] }),
1266
+ onClose: onCancel
1267
+ }
1268
+ );
1269
+ }
1270
+ function getOrigin(url) {
1271
+ try {
1272
+ return new URL(url).origin;
1273
+ } catch (e) {
1274
+ return url;
1275
+ }
1276
+ }
1277
+
1278
+ // ../renderers/src/FormRenderer.tsx
1279
+ import { jsx as jsx20 } from "react/jsx-runtime";
1280
+ var FormRenderer = {
1281
+ canRenderType: "form",
1282
+ render: ({ children, margin }) => /* @__PURE__ */ jsx20("div", { className: getMargin(margin), children })
1283
+ };
1284
+
1285
+ // ../renderers/src/FormSectionRenderer.tsx
1286
+ import { Header as Header2 } from "@transferwise/components";
1287
+ import { jsx as jsx21, jsxs as jsxs5 } from "react/jsx-runtime";
1288
+ var FormSectionRenderer = {
1289
+ canRenderType: "form-section",
1290
+ render: ({ title, description, children }) => /* @__PURE__ */ jsxs5("fieldset", { children: [
1291
+ title && /* @__PURE__ */ jsx21(
1292
+ Header2,
1293
+ {
1294
+ as: "h2",
1295
+ title
1296
+ }
1297
+ ),
1298
+ description && /* @__PURE__ */ jsx21("p", { children: description }),
1299
+ children
1300
+ ] })
1301
+ };
1302
+
1303
+ // ../renderers/src/HeadingRenderer.tsx
1304
+ import { Display, Title } from "@transferwise/components";
1305
+ import { jsx as jsx22 } from "react/jsx-runtime";
1306
+ var HeadingRenderer = {
1307
+ canRenderType: "heading",
1308
+ render: (props) => /* @__PURE__ */ jsx22(Heading, __spreadValues({}, props))
1309
+ };
1310
+ function Heading(props) {
1311
+ const { text, size, align, margin, control } = props;
1312
+ const className = getTextAlignmentAndMargin({ align, margin });
1313
+ return control === "display" ? /* @__PURE__ */ jsx22(DisplayHeading, { size, text, className }) : /* @__PURE__ */ jsx22(StandardHeading, { size, text, className });
1314
+ }
1315
+ function DisplayHeading({ size, text, className }) {
1316
+ return /* @__PURE__ */ jsx22(Display, { type: getDisplayType(size), className, children: text });
1317
+ }
1318
+ var getDisplayType = (size) => {
1319
+ switch (size) {
1320
+ case "xs":
1321
+ case "sm":
1322
+ return "display-small";
1323
+ case "xl":
1324
+ case "lg":
1325
+ return "display-large";
1326
+ case "md":
1327
+ default:
1245
1328
  return "display-medium";
1246
1329
  }
1247
1330
  };
1248
1331
  function StandardHeading({ size, text, className }) {
1249
- return /* @__PURE__ */ jsx21(Title, { type: getTitleTypeBySize(size), className, children: text });
1332
+ return /* @__PURE__ */ jsx22(Title, { type: getTitleTypeBySize(size), className, children: text });
1250
1333
  }
1251
1334
  var getTitleTypeBySize = (size) => {
1252
1335
  var _a;
@@ -1259,11 +1342,10 @@ var getTitleTypeBySize = (size) => {
1259
1342
  };
1260
1343
  return (_a = titleTypes[size]) != null ? _a : "title-subsection";
1261
1344
  };
1262
- var HeadingRenderer_default = HeadingRenderer;
1263
1345
 
1264
1346
  // ../renderers/src/ImageRenderer/UrlImage.tsx
1265
1347
  import { Image } from "@transferwise/components";
1266
- import { useEffect, useState as useState2 } from "react";
1348
+ import { useEffect as useEffect2, useState as useState2 } from "react";
1267
1349
 
1268
1350
  // ../renderers/src/utils/api-utils.ts
1269
1351
  function isRelativePath(url = "") {
@@ -1273,7 +1355,7 @@ function isRelativePath(url = "") {
1273
1355
  }
1274
1356
 
1275
1357
  // ../renderers/src/ImageRenderer/UrlImage.tsx
1276
- import { jsx as jsx22 } from "react/jsx-runtime";
1358
+ import { jsx as jsx23 } from "react/jsx-runtime";
1277
1359
  function UrlImage({
1278
1360
  accessibilityDescription,
1279
1361
  align,
@@ -1283,12 +1365,12 @@ function UrlImage({
1283
1365
  httpClient
1284
1366
  }) {
1285
1367
  const [imageSource, setImageSource] = useState2("");
1286
- useEffect(() => {
1368
+ useEffect2(() => {
1287
1369
  if (!uri.startsWith("urn:")) {
1288
1370
  void getImageSource(httpClient, uri).then(setImageSource);
1289
1371
  }
1290
1372
  }, [uri, httpClient]);
1291
- return /* @__PURE__ */ jsx22("div", { className: `df-image ${align} ${size || "md"}`, children: /* @__PURE__ */ jsx22(
1373
+ return /* @__PURE__ */ jsx23("div", { className: `df-image ${align} ${size || "md"}`, children: /* @__PURE__ */ jsx23(
1292
1374
  Image,
1293
1375
  {
1294
1376
  className: `img-responsive ${getMargin(margin)}`,
@@ -1332,7 +1414,7 @@ var getImageSource = async (httpClient, imageUrl) => {
1332
1414
  };
1333
1415
 
1334
1416
  // ../renderers/src/ImageRenderer/UrnFlagImage.tsx
1335
- import { jsx as jsx23 } from "react/jsx-runtime";
1417
+ import { jsx as jsx24 } from "react/jsx-runtime";
1336
1418
  var maxFlagSize = 600;
1337
1419
  function UrnFlagImage({
1338
1420
  accessibilityDescription,
@@ -1341,7 +1423,7 @@ function UrnFlagImage({
1341
1423
  size,
1342
1424
  uri
1343
1425
  }) {
1344
- return /* @__PURE__ */ jsx23("div", { className: `df-image ${align} ${size || "md"} ${getMargin(margin)}`, children: /* @__PURE__ */ jsx23(UrnFlag, { size: maxFlagSize, urn: uri, accessibilityDescription }) });
1426
+ return /* @__PURE__ */ jsx24("div", { className: `df-image ${align} ${size || "md"} ${getMargin(margin)}`, children: /* @__PURE__ */ jsx24(UrnFlag, { size: maxFlagSize, urn: uri, accessibilityDescription }) });
1345
1427
  }
1346
1428
 
1347
1429
  // ../renderers/src/ImageRenderer/UrnIllustration.tsx
@@ -1365,7 +1447,7 @@ var isAnimated = (uri) => {
1365
1447
  };
1366
1448
 
1367
1449
  // ../renderers/src/ImageRenderer/UrnIllustration.tsx
1368
- import { jsx as jsx24 } from "react/jsx-runtime";
1450
+ import { jsx as jsx25 } from "react/jsx-runtime";
1369
1451
  var urnPrefix = "urn:wise:illustrations:";
1370
1452
  var isUrnIllustration = (uri) => uri.startsWith(urnPrefix);
1371
1453
  function UrnIllustration({
@@ -1379,9 +1461,9 @@ function UrnIllustration({
1379
1461
  const illustrationName = getIllustrationName(uri);
1380
1462
  const illustration3DName = getIllustration3DName(uri);
1381
1463
  if (illustration3DName && isAnimated(uri)) {
1382
- return /* @__PURE__ */ jsx24("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ jsx24(Illustration3D, { name: illustration3DName, size: illustrationSize }) });
1464
+ return /* @__PURE__ */ jsx25("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ jsx25(Illustration3D, { name: illustration3DName, size: illustrationSize }) });
1383
1465
  }
1384
- return /* @__PURE__ */ jsx24("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ jsx24(
1466
+ return /* @__PURE__ */ jsx25("div", { className: `df-image ${align} ${getMargin(margin)}`, children: /* @__PURE__ */ jsx25(
1385
1467
  Illustration,
1386
1468
  {
1387
1469
  className: "df-illustration",
@@ -1401,32 +1483,29 @@ var getIllustration3DName = (uri) => {
1401
1483
  };
1402
1484
 
1403
1485
  // ../renderers/src/ImageRenderer/UrnImage.tsx
1404
- import { jsx as jsx25 } from "react/jsx-runtime";
1486
+ import { jsx as jsx26 } from "react/jsx-runtime";
1405
1487
  var isUrnImage = (uri) => uri.startsWith("urn:");
1406
1488
  function UrnImage(props) {
1407
1489
  const { uri } = props;
1408
1490
  if (isUrnIllustration(uri)) {
1409
- return /* @__PURE__ */ jsx25(UrnIllustration, __spreadValues({}, props));
1491
+ return /* @__PURE__ */ jsx26(UrnIllustration, __spreadValues({}, props));
1410
1492
  }
1411
1493
  if (isUrnFlag(uri)) {
1412
- return /* @__PURE__ */ jsx25(UrnFlagImage, __spreadValues({}, props));
1494
+ return /* @__PURE__ */ jsx26(UrnFlagImage, __spreadValues({}, props));
1413
1495
  }
1414
1496
  return null;
1415
1497
  }
1416
1498
 
1417
1499
  // ../renderers/src/ImageRenderer/ImageRenderer.tsx
1418
- import { jsx as jsx26 } from "react/jsx-runtime";
1500
+ import { jsx as jsx27 } from "react/jsx-runtime";
1419
1501
  var ImageRenderer = {
1420
1502
  canRenderType: "image",
1421
- render: (props) => isUrnImage(props.uri) ? /* @__PURE__ */ jsx26(UrnImage, __spreadValues({}, props)) : /* @__PURE__ */ jsx26(UrlImage, __spreadValues({}, props))
1503
+ render: (props) => isUrnImage(props.uri) ? /* @__PURE__ */ jsx27(UrnImage, __spreadValues({}, props)) : /* @__PURE__ */ jsx27(UrlImage, __spreadValues({}, props))
1422
1504
  };
1423
1505
 
1424
- // ../renderers/src/ImageRenderer/index.tsx
1425
- var ImageRenderer_default = ImageRenderer;
1426
-
1427
1506
  // ../renderers/src/InstructionsRenderer.tsx
1428
1507
  import { Header as Header3, InstructionsList } from "@transferwise/components";
1429
- import { jsx as jsx27, jsxs as jsxs5 } from "react/jsx-runtime";
1508
+ import { jsx as jsx28, jsxs as jsxs6 } from "react/jsx-runtime";
1430
1509
  var doContext = ["positive", "neutral"];
1431
1510
  var dontContext = ["warning", "negative"];
1432
1511
  var InstructionsRenderer = {
@@ -1434,13 +1513,12 @@ var InstructionsRenderer = {
1434
1513
  render: ({ items, margin, title }) => {
1435
1514
  const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
1436
1515
  const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
1437
- return /* @__PURE__ */ jsxs5("div", { className: getMargin(margin), children: [
1438
- title ? /* @__PURE__ */ jsx27(Header3, { title }) : null,
1439
- /* @__PURE__ */ jsx27(InstructionsList, { dos, donts })
1516
+ return /* @__PURE__ */ jsxs6("div", { className: getMargin(margin), children: [
1517
+ title ? /* @__PURE__ */ jsx28(Header3, { title }) : null,
1518
+ /* @__PURE__ */ jsx28(InstructionsList, { dos, donts })
1440
1519
  ] });
1441
1520
  }
1442
1521
  };
1443
- var InstructionsRenderer_default = InstructionsRenderer;
1444
1522
 
1445
1523
  // ../renderers/src/IntegerInputRenderer.tsx
1446
1524
  import { Input, InputGroup } from "@transferwise/components";
@@ -1454,7 +1532,7 @@ var onWheel = (event) => {
1454
1532
 
1455
1533
  // ../renderers/src/utils/getInlineAvatar.tsx
1456
1534
  import { AvatarView as AvatarView3 } from "@transferwise/components";
1457
- import { jsx as jsx28 } from "react/jsx-runtime";
1535
+ import { jsx as jsx29 } from "react/jsx-runtime";
1458
1536
  var mediaSize2 = 24;
1459
1537
  function getInlineAvatar({ icon, image }) {
1460
1538
  const imageNode = getImageNode(image, mediaSize2);
@@ -1470,7 +1548,7 @@ function getInlineAvatar({ icon, image }) {
1470
1548
  return iconNode;
1471
1549
  }
1472
1550
  if (iconNode) {
1473
- return /* @__PURE__ */ jsx28(AvatarView3, { size: mediaSize2, children: iconNode });
1551
+ return /* @__PURE__ */ jsx29(AvatarView3, { size: mediaSize2, children: iconNode });
1474
1552
  }
1475
1553
  return null;
1476
1554
  }
@@ -1493,7 +1571,7 @@ function pick(obj, ...keys) {
1493
1571
  }
1494
1572
 
1495
1573
  // ../renderers/src/IntegerInputRenderer.tsx
1496
- import { jsx as jsx29 } from "react/jsx-runtime";
1574
+ import { jsx as jsx30 } from "react/jsx-runtime";
1497
1575
  var IntegerInputRenderer = {
1498
1576
  canRenderType: "input-integer",
1499
1577
  render: (props) => {
@@ -1508,7 +1586,7 @@ var IntegerInputRenderer = {
1508
1586
  "maximum",
1509
1587
  "minimum"
1510
1588
  );
1511
- return /* @__PURE__ */ jsx29(
1589
+ return /* @__PURE__ */ jsx30(
1512
1590
  FieldInput_default,
1513
1591
  {
1514
1592
  id,
@@ -1516,7 +1594,7 @@ var IntegerInputRenderer = {
1516
1594
  description,
1517
1595
  validation: validationState,
1518
1596
  help,
1519
- children: /* @__PURE__ */ jsx29(InputGroup, { addonStart: getInputGroupAddonStart({ icon, image }), children: /* @__PURE__ */ jsx29(
1597
+ children: /* @__PURE__ */ jsx30(InputGroup, { addonStart: getInputGroupAddonStart({ icon, image }), children: /* @__PURE__ */ jsx30(
1520
1598
  Input,
1521
1599
  __spreadValues({
1522
1600
  id,
@@ -1536,14 +1614,85 @@ var IntegerInputRenderer = {
1536
1614
  );
1537
1615
  }
1538
1616
  };
1539
- var IntegerInputRenderer_default = IntegerInputRenderer;
1617
+
1618
+ // ../renderers/src/ListRenderer.tsx
1619
+ import { Body, Header as Header4 } from "@transferwise/components";
1620
+ import classNames3 from "classnames";
1621
+ import { jsx as jsx31, jsxs as jsxs7 } from "react/jsx-runtime";
1622
+ var ListRenderer = {
1623
+ canRenderType: "list",
1624
+ render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ jsxs7("div", { className: getMargin(margin), children: [
1625
+ (title || callToAction) && /* @__PURE__ */ jsx31(Header4, { as: "h2", title: title != null ? title : "", action: getListAction(callToAction) }),
1626
+ items.map((props) => /* @__PURE__ */ jsx31(DesignSystemListItem, __spreadProps(__spreadValues({}, props), { control }), props.title))
1627
+ ] })
1628
+ };
1629
+ var DesignSystemListItem = ({
1630
+ title,
1631
+ description,
1632
+ supportingValues,
1633
+ icon,
1634
+ image,
1635
+ control,
1636
+ tag
1637
+ }) => /* @__PURE__ */ jsx31(
1638
+ "label",
1639
+ {
1640
+ className: classNames3("np-option p-a-2", {
1641
+ "np-option__sm-media": true,
1642
+ "np-option__container-aligned": true
1643
+ }),
1644
+ children: /* @__PURE__ */ jsxs7("div", { className: "media", children: [
1645
+ icon || image ? /* @__PURE__ */ jsx31("div", { className: "media-left", children: /* @__PURE__ */ jsx31(
1646
+ ListItemMedia,
1647
+ {
1648
+ image,
1649
+ icon,
1650
+ preferAvatar: control === "with-avatar" || tag === "with-avatar"
1651
+ }
1652
+ ) }) : null,
1653
+ /* @__PURE__ */ jsxs7("div", { className: "media-body", children: [
1654
+ /* @__PURE__ */ jsxs7("div", { className: "d-flex justify-content-between", children: [
1655
+ /* @__PURE__ */ jsx31("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: title }),
1656
+ /* @__PURE__ */ jsx31("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: supportingValues == null ? void 0 : supportingValues.value })
1657
+ ] }),
1658
+ /* @__PURE__ */ jsxs7("div", { className: "d-flex justify-content-between", children: [
1659
+ /* @__PURE__ */ jsx31(Body, { className: "d-block np-option__body", children: description }),
1660
+ /* @__PURE__ */ jsx31(Body, { className: "d-block np-option__body", children: supportingValues == null ? void 0 : supportingValues.subvalue })
1661
+ ] })
1662
+ ] })
1663
+ ] })
1664
+ },
1665
+ title
1666
+ );
1667
+ var ListItemMedia = ({
1668
+ icon,
1669
+ image,
1670
+ preferAvatar
1671
+ }) => {
1672
+ if (icon) {
1673
+ return /* @__PURE__ */ jsx31("div", { className: "circle circle-sm text-primary circle-inverse", children: /* @__PURE__ */ jsx31(OptionMedia, { icon, image, preferAvatar }) });
1674
+ }
1675
+ if (image) {
1676
+ return /* @__PURE__ */ jsx31("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ jsx31(OptionMedia, { icon, image, preferAvatar }) });
1677
+ }
1678
+ };
1679
+ var getListAction = (callToAction) => {
1680
+ if (callToAction) {
1681
+ return __spreadValues({
1682
+ "aria-label": callToAction.accessibilityDescription,
1683
+ text: callToAction.title,
1684
+ onClick: callToAction.onClick
1685
+ }, callToAction.type === "link" ? { href: callToAction.href, target: "_blank" } : {});
1686
+ }
1687
+ return void 0;
1688
+ };
1540
1689
 
1541
1690
  // ../renderers/src/LoadingIndicatorRenderer.tsx
1542
1691
  import { Loader } from "@transferwise/components";
1543
- import { jsx as jsx30 } from "react/jsx-runtime";
1692
+ import { jsx as jsx32 } from "react/jsx-runtime";
1544
1693
  var LoadingIndicatorRenderer = {
1545
1694
  canRenderType: "loading-indicator",
1546
- render: ({ margin, size }) => /* @__PURE__ */ jsx30(
1695
+ render: ({ margin, size }) => /* @__PURE__ */ jsx32(
1547
1696
  Loader,
1548
1697
  {
1549
1698
  size,
@@ -1552,33 +1701,30 @@ var LoadingIndicatorRenderer = {
1552
1701
  }
1553
1702
  )
1554
1703
  };
1555
- var LoadingIndicatorRenderer_default = LoadingIndicatorRenderer;
1556
1704
 
1557
1705
  // ../renderers/src/MarkdownRenderer.tsx
1558
- import { Markdown as Markdown2 } from "@transferwise/components";
1559
- import { jsx as jsx31 } from "react/jsx-runtime";
1706
+ import { Markdown as Markdown3 } from "@transferwise/components";
1707
+ import { jsx as jsx33 } from "react/jsx-runtime";
1560
1708
  var MarkdownRenderer = {
1561
1709
  canRenderType: "markdown",
1562
- render: ({ content, align, margin }) => /* @__PURE__ */ jsx31("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ jsx31(Markdown2, { className: "np-text-body-large", config: { link: { target: "_blank" } }, children: content }) })
1710
+ render: ({ content, align, margin }) => /* @__PURE__ */ jsx33("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ jsx33(Markdown3, { className: "np-text-body-large", config: { link: { target: "_blank" } }, children: content }) })
1563
1711
  };
1564
- var MarkdownRenderer_default = MarkdownRenderer;
1565
1712
 
1566
- // ../renderers/src/ModalRenderer.tsx
1567
- import { Button as Button2, Modal } from "@transferwise/components";
1713
+ // ../renderers/src/ModalLayoutRenderer.tsx
1714
+ import { Button as Button3, Modal as Modal2 } from "@transferwise/components";
1568
1715
  import { useState as useState3 } from "react";
1569
- import { jsx as jsx32, jsxs as jsxs6 } from "react/jsx-runtime";
1570
- var ModalRenderer = {
1571
- canRenderType: "modal",
1572
- render: (props) => /* @__PURE__ */ jsx32(DFModal, __spreadValues({}, props))
1716
+ import { jsx as jsx34, jsxs as jsxs8 } from "react/jsx-runtime";
1717
+ var ModalLayoutRenderer = {
1718
+ canRenderType: "modal-layout",
1719
+ render: (props) => /* @__PURE__ */ jsx34(DFModal, __spreadValues({}, props))
1573
1720
  };
1574
- var ModalRenderer_default = ModalRenderer;
1575
1721
  function DFModal({ content, margin, trigger }) {
1576
1722
  const [visible, setVisible] = useState3(false);
1577
1723
  const { children, title } = content;
1578
- return /* @__PURE__ */ jsxs6("div", { className: getMargin(margin), children: [
1579
- /* @__PURE__ */ jsx32(Button2, { priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
1580
- /* @__PURE__ */ jsx32(
1581
- Modal,
1724
+ return /* @__PURE__ */ jsxs8("div", { className: getMargin(margin), children: [
1725
+ /* @__PURE__ */ jsx34(Button3, { priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
1726
+ /* @__PURE__ */ jsx34(
1727
+ Modal2,
1582
1728
  {
1583
1729
  scroll: "content",
1584
1730
  open: visible,
@@ -1591,14 +1737,24 @@ function DFModal({ content, margin, trigger }) {
1591
1737
  ] });
1592
1738
  }
1593
1739
 
1740
+ // ../renderers/src/ModalRenderer.tsx
1741
+ import { Modal as Modal3 } from "@transferwise/components";
1742
+ import { jsx as jsx35 } from "react/jsx-runtime";
1743
+ var ModalContentRenderer = {
1744
+ canRenderType: "modal",
1745
+ render: ({ title, children, open, onClose }) => {
1746
+ return /* @__PURE__ */ jsx35(Modal3, { open, title, body: children, onClose });
1747
+ }
1748
+ };
1749
+
1594
1750
  // ../renderers/src/MultiSelectInputRenderer.tsx
1595
1751
  import { SelectInput, SelectInputOptionContent } from "@transferwise/components";
1596
1752
  import { useState as useState4 } from "react";
1597
- import { useIntl as useIntl2 } from "react-intl";
1753
+ import { useIntl as useIntl3 } from "react-intl";
1598
1754
 
1599
1755
  // ../renderers/src/messages/multi-select.messages.ts
1600
- import { defineMessages as defineMessages2 } from "react-intl";
1601
- var multi_select_messages_default = defineMessages2({
1756
+ import { defineMessages as defineMessages3 } from "react-intl";
1757
+ var multi_select_messages_default = defineMessages3({
1602
1758
  summary: {
1603
1759
  id: "df.wise.MultiSelect.summary",
1604
1760
  defaultMessage: "{first} and {count} more",
@@ -1607,13 +1763,13 @@ var multi_select_messages_default = defineMessages2({
1607
1763
  });
1608
1764
 
1609
1765
  // ../renderers/src/MultiSelectInputRenderer.tsx
1610
- import { jsx as jsx33 } from "react/jsx-runtime";
1766
+ import { jsx as jsx36 } from "react/jsx-runtime";
1611
1767
  var MultiSelectInputRenderer = {
1612
1768
  canRenderType: "input-multi-select",
1613
- render: (props) => /* @__PURE__ */ jsx33(MultiSelectInputRendererComponent, __spreadValues({}, props))
1769
+ render: (props) => /* @__PURE__ */ jsx36(MultiSelectInputRendererComponent, __spreadValues({}, props))
1614
1770
  };
1615
1771
  function MultiSelectInputRendererComponent(props) {
1616
- const { formatMessage } = useIntl2();
1772
+ const { formatMessage } = useIntl3();
1617
1773
  const [stagedIndices, setStagedIndices] = useState4();
1618
1774
  const {
1619
1775
  id,
@@ -1652,12 +1808,12 @@ function MultiSelectInputRendererComponent(props) {
1652
1808
  const contentProps = {
1653
1809
  title: option.title,
1654
1810
  description: option.description,
1655
- icon: /* @__PURE__ */ jsx33(OptionMedia, { icon: option.icon, image: option.image, preferAvatar: false })
1811
+ icon: /* @__PURE__ */ jsx36(OptionMedia, { icon: option.icon, image: option.image, preferAvatar: false })
1656
1812
  };
1657
- return /* @__PURE__ */ jsx33(SelectInputOptionContent, __spreadValues({}, contentProps));
1813
+ return /* @__PURE__ */ jsx36(SelectInputOptionContent, __spreadValues({}, contentProps));
1658
1814
  };
1659
1815
  const extraProps = { autoComplete };
1660
- return /* @__PURE__ */ jsx33(
1816
+ return /* @__PURE__ */ jsx36(
1661
1817
  FieldInput_default,
1662
1818
  {
1663
1819
  id,
@@ -1665,7 +1821,7 @@ function MultiSelectInputRendererComponent(props) {
1665
1821
  help,
1666
1822
  description,
1667
1823
  validation: validationState,
1668
- children: /* @__PURE__ */ jsx33(
1824
+ children: /* @__PURE__ */ jsx36(
1669
1825
  SelectInput,
1670
1826
  __spreadValues({
1671
1827
  id,
@@ -1702,15 +1858,14 @@ function MultiSelectInputRendererComponent(props) {
1702
1858
  }
1703
1859
  );
1704
1860
  }
1705
- var MultiSelectInputRenderer_default = MultiSelectInputRenderer;
1706
1861
 
1707
1862
  // ../renderers/src/MultiUploadInputRenderer.tsx
1708
1863
  import { UploadInput } from "@transferwise/components";
1709
1864
 
1710
1865
  // ../renderers/src/components/UploadFieldInput.tsx
1711
1866
  import { InlineAlert } from "@transferwise/components";
1712
- import classNames3 from "classnames";
1713
- import { jsx as jsx34, jsxs as jsxs7 } from "react/jsx-runtime";
1867
+ import classNames4 from "classnames";
1868
+ import { jsx as jsx37, jsxs as jsxs9 } from "react/jsx-runtime";
1714
1869
  function UploadFieldInput({
1715
1870
  id,
1716
1871
  children,
@@ -1719,18 +1874,18 @@ function UploadFieldInput({
1719
1874
  help,
1720
1875
  validation
1721
1876
  }) {
1722
- const labelContent = label && help ? /* @__PURE__ */ jsx34(LabelContentWithHelp, { text: label, help }) : label;
1877
+ const labelContent = label && help ? /* @__PURE__ */ jsx37(LabelContentWithHelp, { text: label, help }) : label;
1723
1878
  const descriptionId = description ? `${id}-description` : void 0;
1724
- return /* @__PURE__ */ jsxs7(
1879
+ return /* @__PURE__ */ jsxs9(
1725
1880
  "div",
1726
1881
  {
1727
- className: classNames3("form-group d-block", {
1882
+ className: classNames4("form-group d-block", {
1728
1883
  "has-error": (validation == null ? void 0 : validation.status) === "invalid"
1729
1884
  }),
1730
1885
  children: [
1731
- /* @__PURE__ */ jsx34("label", { htmlFor: id, className: "control-label", children: labelContent }),
1886
+ /* @__PURE__ */ jsx37("label", { htmlFor: id, className: "control-label", children: labelContent }),
1732
1887
  children,
1733
- (validation == null ? void 0 : validation.status) === "invalid" && /* @__PURE__ */ jsx34(InlineAlert, { type: "negative", id: descriptionId, children: validation.message })
1888
+ (validation == null ? void 0 : validation.status) === "invalid" && /* @__PURE__ */ jsx37(InlineAlert, { type: "negative", id: descriptionId, children: validation.message })
1734
1889
  ]
1735
1890
  }
1736
1891
  );
@@ -1759,7 +1914,7 @@ var getFileType = (base64Url) => {
1759
1914
  };
1760
1915
 
1761
1916
  // ../renderers/src/MultiUploadInputRenderer.tsx
1762
- import { jsx as jsx35 } from "react/jsx-runtime";
1917
+ import { jsx as jsx38 } from "react/jsx-runtime";
1763
1918
  var MultiUploadInputRenderer = {
1764
1919
  canRenderType: "input-upload-multi",
1765
1920
  render: (props) => {
@@ -1784,7 +1939,7 @@ var MultiUploadInputRenderer = {
1784
1939
  };
1785
1940
  const onDeleteFile = async (fileId) => onRemoveFile(value.findIndex((file) => file.id === fileId));
1786
1941
  const descriptionId = description ? `${id}-description` : void 0;
1787
- return /* @__PURE__ */ jsx35(
1942
+ return /* @__PURE__ */ jsx38(
1788
1943
  UploadFieldInput_default,
1789
1944
  {
1790
1945
  id,
@@ -1792,7 +1947,7 @@ var MultiUploadInputRenderer = {
1792
1947
  description,
1793
1948
  validation: validationState,
1794
1949
  help,
1795
- children: /* @__PURE__ */ jsx35(
1950
+ children: /* @__PURE__ */ jsx38(
1796
1951
  UploadInput,
1797
1952
  {
1798
1953
  id,
@@ -1812,11 +1967,10 @@ var MultiUploadInputRenderer = {
1812
1967
  );
1813
1968
  }
1814
1969
  };
1815
- var MultiUploadInputRenderer_default = MultiUploadInputRenderer;
1816
1970
 
1817
1971
  // ../renderers/src/NumberInputRenderer.tsx
1818
1972
  import { Input as Input2, InputGroup as InputGroup2 } from "@transferwise/components";
1819
- import { jsx as jsx36 } from "react/jsx-runtime";
1973
+ import { jsx as jsx39 } from "react/jsx-runtime";
1820
1974
  var NumberInputRenderer = {
1821
1975
  canRenderType: "input-number",
1822
1976
  render: (props) => {
@@ -1830,7 +1984,7 @@ var NumberInputRenderer = {
1830
1984
  "maximum",
1831
1985
  "minimum"
1832
1986
  );
1833
- return /* @__PURE__ */ jsx36(
1987
+ return /* @__PURE__ */ jsx39(
1834
1988
  FieldInput_default,
1835
1989
  {
1836
1990
  id,
@@ -1838,7 +1992,7 @@ var NumberInputRenderer = {
1838
1992
  description,
1839
1993
  validation: validationState,
1840
1994
  help,
1841
- children: /* @__PURE__ */ jsx36(InputGroup2, { addonStart: getInputGroupAddonStart({ icon, image }), children: /* @__PURE__ */ jsx36(
1995
+ children: /* @__PURE__ */ jsx39(InputGroup2, { addonStart: getInputGroupAddonStart({ icon, image }), children: /* @__PURE__ */ jsx39(
1842
1996
  Input2,
1843
1997
  __spreadValues({
1844
1998
  id,
@@ -1856,10 +2010,9 @@ var NumberInputRenderer = {
1856
2010
  );
1857
2011
  }
1858
2012
  };
1859
- var NumberInputRenderer_default = NumberInputRenderer;
1860
2013
 
1861
2014
  // ../renderers/src/ParagraphRenderer.tsx
1862
- import { useIntl as useIntl3 } from "react-intl";
2015
+ import { useIntl as useIntl4 } from "react-intl";
1863
2016
 
1864
2017
  // ../renderers/src/hooks/useSnackBarIfAvailable.ts
1865
2018
  import { SnackbarContext } from "@transferwise/components";
@@ -1871,12 +2024,12 @@ function useSnackBarIfAvailable() {
1871
2024
  }
1872
2025
 
1873
2026
  // ../renderers/src/ParagraphRenderer.tsx
1874
- import { Button as Button3, Input as Input3 } from "@transferwise/components";
1875
- import classNames4 from "classnames";
2027
+ import { Button as Button4, Input as Input3 } from "@transferwise/components";
2028
+ import classNames5 from "classnames";
1876
2029
 
1877
2030
  // ../renderers/src/messages/paragraph.messages.ts
1878
- import { defineMessages as defineMessages3 } from "react-intl";
1879
- var paragraph_messages_default = defineMessages3({
2031
+ import { defineMessages as defineMessages4 } from "react-intl";
2032
+ var paragraph_messages_default = defineMessages4({
1880
2033
  copy: {
1881
2034
  id: "df.wise.DynamicParagraph.copy",
1882
2035
  defaultMessage: "Copy",
@@ -1890,55 +2043,54 @@ var paragraph_messages_default = defineMessages3({
1890
2043
  });
1891
2044
 
1892
2045
  // ../renderers/src/ParagraphRenderer.tsx
1893
- import { jsx as jsx37, jsxs as jsxs8 } from "react/jsx-runtime";
2046
+ import { jsx as jsx40, jsxs as jsxs10 } from "react/jsx-runtime";
1894
2047
  var ParagraphRenderer = {
1895
2048
  canRenderType: "paragraph",
1896
- render: (props) => /* @__PURE__ */ jsx37(Paragraph, __spreadValues({}, props))
2049
+ render: (props) => /* @__PURE__ */ jsx40(Paragraph, __spreadValues({}, props))
1897
2050
  };
1898
2051
  function Paragraph({ align, control, margin, text }) {
1899
2052
  const className = getTextAlignmentAndMargin({ align, margin });
1900
- return control === "copyable" ? /* @__PURE__ */ jsx37(CopyableParagraph, { className, align, text }) : /* @__PURE__ */ jsx37(StandardParagraph, { className, text });
2053
+ return control === "copyable" ? /* @__PURE__ */ jsx40(CopyableParagraph, { className, align, text }) : /* @__PURE__ */ jsx40(StandardParagraph, { className, text });
1901
2054
  }
1902
2055
  function StandardParagraph({ text, className }) {
1903
- return /* @__PURE__ */ jsx37("p", { className: `np-text-body-large ${className}`, children: text });
2056
+ return /* @__PURE__ */ jsx40("p", { className: `np-text-body-large ${className}`, children: text });
1904
2057
  }
1905
2058
  function CopyableParagraph({
1906
2059
  text,
1907
2060
  align,
1908
2061
  className
1909
2062
  }) {
1910
- const { formatMessage } = useIntl3();
2063
+ const { formatMessage } = useIntl4();
1911
2064
  const createSnackbar = useSnackBarIfAvailable();
1912
2065
  const copy = () => {
1913
2066
  navigator.clipboard.writeText(text).then(() => createSnackbar({ text: formatMessage(paragraph_messages_default.copied) })).catch(() => {
1914
2067
  });
1915
2068
  };
1916
2069
  const inputAlignmentClasses = getTextAlignmentAndMargin({ align, margin: "sm" });
1917
- return /* @__PURE__ */ jsxs8("div", { className, children: [
1918
- /* @__PURE__ */ jsx37(
2070
+ return /* @__PURE__ */ jsxs10("div", { className, children: [
2071
+ /* @__PURE__ */ jsx40(
1919
2072
  Input3,
1920
2073
  {
1921
2074
  type: "text",
1922
2075
  value: text,
1923
2076
  readOnly: true,
1924
- className: classNames4("text-ellipsis", inputAlignmentClasses)
2077
+ className: classNames5("text-ellipsis", inputAlignmentClasses)
1925
2078
  }
1926
2079
  ),
1927
- /* @__PURE__ */ jsx37(Button3, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
2080
+ /* @__PURE__ */ jsx40(Button4, { block: true, onClick: copy, children: formatMessage(paragraph_messages_default.copy) })
1928
2081
  ] });
1929
2082
  }
1930
- var ParagraphRenderer_default = ParagraphRenderer;
1931
2083
 
1932
2084
  // ../renderers/src/RepeatableRenderer.tsx
1933
- import { Button as Button4, Header as Header4, InlineAlert as InlineAlert2, Modal as Modal2, NavigationOption as NavigationOption2 } from "@transferwise/components";
2085
+ import { Button as Button5, Header as Header5, InlineAlert as InlineAlert2, Modal as Modal4, NavigationOption as NavigationOption2 } from "@transferwise/components";
1934
2086
  import { Plus } from "@transferwise/icons";
1935
- import classNames5 from "classnames";
2087
+ import classNames6 from "classnames";
1936
2088
  import { useState as useState5 } from "react";
1937
- import { useIntl as useIntl4 } from "react-intl";
2089
+ import { useIntl as useIntl5 } from "react-intl";
1938
2090
 
1939
2091
  // ../renderers/src/messages/repeatable.messages.ts
1940
- import { defineMessages as defineMessages4 } from "react-intl";
1941
- var repeatable_messages_default = defineMessages4({
2092
+ import { defineMessages as defineMessages5 } from "react-intl";
2093
+ var repeatable_messages_default = defineMessages5({
1942
2094
  addItemTitle: {
1943
2095
  id: "df.wise.ArraySchema.addItemTitle",
1944
2096
  defaultMessage: "Add Item",
@@ -1962,10 +2114,10 @@ var repeatable_messages_default = defineMessages4({
1962
2114
  });
1963
2115
 
1964
2116
  // ../renderers/src/RepeatableRenderer.tsx
1965
- import { Fragment, jsx as jsx38, jsxs as jsxs9 } from "react/jsx-runtime";
2117
+ import { Fragment as Fragment2, jsx as jsx41, jsxs as jsxs11 } from "react/jsx-runtime";
1966
2118
  var RepeatableRenderer = {
1967
2119
  canRenderType: "repeatable",
1968
- render: (props) => /* @__PURE__ */ jsx38(Repeatable, __spreadValues({}, props))
2120
+ render: (props) => /* @__PURE__ */ jsx41(Repeatable, __spreadValues({}, props))
1969
2121
  };
1970
2122
  function Repeatable(props) {
1971
2123
  const {
@@ -1981,7 +2133,7 @@ function Repeatable(props) {
1981
2133
  onSave,
1982
2134
  onRemove
1983
2135
  } = props;
1984
- const { formatMessage } = useIntl4();
2136
+ const { formatMessage } = useIntl5();
1985
2137
  const [openModalType, setOpenModalType] = useState5(null);
1986
2138
  const onAddItem = () => {
1987
2139
  onAdd();
@@ -2004,40 +2156,40 @@ function Repeatable(props) {
2004
2156
  const onCancelEdit = () => {
2005
2157
  setOpenModalType(null);
2006
2158
  };
2007
- return /* @__PURE__ */ jsxs9(Fragment, { children: [
2008
- title && /* @__PURE__ */ jsx38(Header4, { title }),
2009
- description && /* @__PURE__ */ jsx38("p", { children: description }),
2010
- /* @__PURE__ */ jsxs9(
2159
+ return /* @__PURE__ */ jsxs11(Fragment2, { children: [
2160
+ title && /* @__PURE__ */ jsx41(Header5, { title }),
2161
+ description && /* @__PURE__ */ jsx41("p", { children: description }),
2162
+ /* @__PURE__ */ jsxs11(
2011
2163
  "div",
2012
2164
  {
2013
- className: classNames5("form-group", {
2165
+ className: classNames6("form-group", {
2014
2166
  "has-error": (validationState == null ? void 0 : validationState.status) === "invalid"
2015
2167
  }),
2016
2168
  children: [
2017
- items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ jsx38(ItemSummaryOption, { item, onClick: () => onEditItem(index) }, item.id)),
2018
- /* @__PURE__ */ jsx38(
2169
+ items == null ? void 0 : items.map((item, index) => /* @__PURE__ */ jsx41(ItemSummaryOption, { item, onClick: () => onEditItem(index) }, item.id)),
2170
+ /* @__PURE__ */ jsx41(
2019
2171
  NavigationOption2,
2020
2172
  {
2021
- media: /* @__PURE__ */ jsx38(Plus, {}),
2173
+ media: /* @__PURE__ */ jsx41(Plus, {}),
2022
2174
  title: addItemTitle || formatMessage(repeatable_messages_default.addItemTitle),
2023
2175
  showMediaAtAllSizes: true,
2024
2176
  onClick: () => onAddItem()
2025
2177
  }
2026
2178
  ),
2027
- (validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ jsx38(InlineAlert2, { type: "negative", children: validationState.message })
2179
+ (validationState == null ? void 0 : validationState.status) === "invalid" && /* @__PURE__ */ jsx41(InlineAlert2, { type: "negative", children: validationState.message })
2028
2180
  ]
2029
2181
  }
2030
2182
  ),
2031
- /* @__PURE__ */ jsx38(
2032
- Modal2,
2183
+ /* @__PURE__ */ jsx41(
2184
+ Modal4,
2033
2185
  {
2034
2186
  open: openModalType !== null,
2035
2187
  title: (openModalType === "add" ? addItemTitle : editItemTitle) || formatMessage(repeatable_messages_default.addItemTitle),
2036
- body: /* @__PURE__ */ jsxs9(Fragment, { children: [
2037
- /* @__PURE__ */ jsx38("div", { className: "m-b-2", children: editableItem }),
2038
- /* @__PURE__ */ jsxs9("div", { children: [
2039
- /* @__PURE__ */ jsx38(Button4, { priority: "primary", block: true, className: "m-b-2", onClick: () => onSaveItem(), children: formatMessage(repeatable_messages_default.addItem) }),
2040
- /* @__PURE__ */ jsx38(Button4, { priority: "secondary", type: "negative", block: true, onClick: () => onRemoveItem(), children: formatMessage(repeatable_messages_default.removeItem) })
2188
+ body: /* @__PURE__ */ jsxs11(Fragment2, { children: [
2189
+ /* @__PURE__ */ jsx41("div", { className: "m-b-2", children: editableItem }),
2190
+ /* @__PURE__ */ jsxs11("div", { children: [
2191
+ /* @__PURE__ */ jsx41(Button5, { priority: "primary", block: true, className: "m-b-2", onClick: () => onSaveItem(), children: formatMessage(repeatable_messages_default.addItem) }),
2192
+ /* @__PURE__ */ jsx41(Button5, { priority: "secondary", type: "negative", block: true, onClick: () => onRemoveItem(), children: formatMessage(repeatable_messages_default.removeItem) })
2041
2193
  ] })
2042
2194
  ] }),
2043
2195
  onClose: () => onCancelEdit()
@@ -2049,10 +2201,10 @@ function ItemSummaryOption({
2049
2201
  item,
2050
2202
  onClick
2051
2203
  }) {
2052
- return /* @__PURE__ */ jsx38(
2204
+ return /* @__PURE__ */ jsx41(
2053
2205
  NavigationOption2,
2054
2206
  {
2055
- media: /* @__PURE__ */ jsx38(OptionMedia, __spreadProps(__spreadValues({}, item), { preferAvatar: false })),
2207
+ media: /* @__PURE__ */ jsx41(OptionMedia, __spreadProps(__spreadValues({}, item), { preferAvatar: false })),
2056
2208
  title: item.title,
2057
2209
  content: item.description,
2058
2210
  showMediaAtAllSizes: true,
@@ -2060,61 +2212,143 @@ function ItemSummaryOption({
2060
2212
  }
2061
2213
  );
2062
2214
  }
2063
- var RepeatableRenderer_default = RepeatableRenderer;
2064
-
2065
- // ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
2066
- import { Input as Input4, Markdown as Markdown3, NavigationOption as NavigationOption3, NavigationOptionsList as NavigationOptionsList2 } from "@transferwise/components";
2067
- import { useState as useState6 } from "react";
2068
- import { useIntl as useIntl6 } from "react-intl";
2069
-
2070
- // ../renderers/src/messages/search.messages.ts
2071
- import { defineMessages as defineMessages5 } from "react-intl";
2072
- var search_messages_default = defineMessages5({
2073
- loading: {
2074
- id: "df.wise.SearchLayout.loading",
2075
- defaultMessage: "Loading...",
2076
- description: "A message shown to the user while their search is being processed, before results appear."
2077
- }
2078
- });
2079
2215
 
2080
- // ../renderers/src/SearchRenderer/ErrorResult.tsx
2081
- import { useIntl as useIntl5 } from "react-intl";
2216
+ // ../renderers/src/ReviewRenderer.tsx
2217
+ import { DefinitionList, Header as Header6 } from "@transferwise/components";
2082
2218
 
2083
- // ../renderers/src/messages/generic-error.messages.ts
2084
- import { defineMessages as defineMessages6 } from "react-intl";
2085
- var generic_error_messages_default = defineMessages6({
2086
- genericErrorRetryHint: {
2087
- id: "df.wise.PersistAsyncSchema.genericError",
2088
- defaultMessage: "Something went wrong, please try again.",
2089
- description: "Generic error message for persist async schema"
2090
- },
2091
- genericError: {
2092
- id: "df.wise.ErrorBoundary.errorAlert",
2093
- defaultMessage: "Something went wrong.",
2094
- description: "Generic error message for when something has gone wrong."
2095
- },
2096
- retry: {
2097
- id: "df.wise.ErrorBoundary.retry",
2098
- defaultMessage: "Retry",
2099
- description: "Usually this follows the generic error and contains a link."
2219
+ // ../renderers/src/utils/getHeaderAction.tsx
2220
+ var getHeaderAction = (callToAction) => {
2221
+ if (!callToAction) {
2222
+ return void 0;
2100
2223
  }
2101
- });
2102
-
2103
- // ../renderers/src/SearchRenderer/ErrorResult.tsx
2104
- import { Button as Button5 } from "@transferwise/components";
2105
- import { jsx as jsx39, jsxs as jsxs10 } from "react/jsx-runtime";
2106
- function ErrorResult({ state }) {
2107
- const intl = useIntl5();
2108
- const buttonVisualProps = {
2109
- priority: "tertiary",
2110
- size: "sm",
2111
- style: { marginTop: "-2px", padding: "0", width: "auto", display: "inline" }
2224
+ const { accessibilityDescription, href, title, onClick } = callToAction;
2225
+ return href ? {
2226
+ "aria-label": accessibilityDescription,
2227
+ text: title,
2228
+ href,
2229
+ target: "_blank"
2230
+ } : {
2231
+ "aria-label": accessibilityDescription,
2232
+ text: title,
2233
+ onClick: (event) => {
2234
+ event.preventDefault();
2235
+ onClick();
2236
+ }
2112
2237
  };
2113
- return /* @__PURE__ */ jsxs10("p", { className: "m-t-2", children: [
2238
+ };
2239
+
2240
+ // ../renderers/src/ReviewRenderer.tsx
2241
+ import { Fragment as Fragment3, jsx as jsx42, jsxs as jsxs12 } from "react/jsx-runtime";
2242
+ var ReviewRenderer = {
2243
+ canRenderType: "review",
2244
+ render: ({ callToAction, control, fields, margin, title, trackEvent }) => {
2245
+ const orientation = mapControlToDefinitionListLayout(control);
2246
+ return /* @__PURE__ */ jsxs12("div", { className: getMargin(margin), children: [
2247
+ (title || callToAction) && /* @__PURE__ */ jsx42(Header6, { title: title != null ? title : "", action: getHeaderAction(callToAction) }),
2248
+ /* @__PURE__ */ jsx42("div", { className: margin, children: /* @__PURE__ */ jsx42(
2249
+ DefinitionList,
2250
+ {
2251
+ layout: orientation,
2252
+ definitions: fields.map(
2253
+ ({ label, value, help, analyticsId: fieldAnalyticsId }, index) => ({
2254
+ key: String(index),
2255
+ title: label,
2256
+ value: getFieldValue(
2257
+ value,
2258
+ help,
2259
+ orientation,
2260
+ () => trackEvent("Help Pressed", { layoutItemId: fieldAnalyticsId })
2261
+ )
2262
+ })
2263
+ )
2264
+ }
2265
+ ) })
2266
+ ] });
2267
+ }
2268
+ };
2269
+ var mapControlToDefinitionListLayout = (control) => {
2270
+ switch (control) {
2271
+ case "horizontal":
2272
+ case "horizontal-end-aligned":
2273
+ return "HORIZONTAL_RIGHT_ALIGNED";
2274
+ case "horizontal-start-aligned":
2275
+ return "HORIZONTAL_LEFT_ALIGNED";
2276
+ case "vertical-two-column":
2277
+ return "VERTICAL_TWO_COLUMN";
2278
+ case "vertical":
2279
+ case "vertical-one-column":
2280
+ default:
2281
+ return "VERTICAL_ONE_COLUMN";
2282
+ }
2283
+ };
2284
+ var getFieldValue = (value, help, orientation, onClick) => {
2285
+ if (help) {
2286
+ return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ jsxs12(Fragment3, { children: [
2287
+ /* @__PURE__ */ jsx42(Help_default, { help, onClick }),
2288
+ " ",
2289
+ value
2290
+ ] }) : /* @__PURE__ */ jsxs12(Fragment3, { children: [
2291
+ value,
2292
+ " ",
2293
+ /* @__PURE__ */ jsx42(Help_default, { help, onClick })
2294
+ ] });
2295
+ }
2296
+ return value;
2297
+ };
2298
+
2299
+ // ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
2300
+ import { Input as Input4, Markdown as Markdown4, NavigationOption as NavigationOption3, NavigationOptionsList as NavigationOptionsList2 } from "@transferwise/components";
2301
+ import { useState as useState6 } from "react";
2302
+ import { useIntl as useIntl7 } from "react-intl";
2303
+
2304
+ // ../renderers/src/messages/search.messages.ts
2305
+ import { defineMessages as defineMessages6 } from "react-intl";
2306
+ var search_messages_default = defineMessages6({
2307
+ loading: {
2308
+ id: "df.wise.SearchLayout.loading",
2309
+ defaultMessage: "Loading...",
2310
+ description: "A message shown to the user while their search is being processed, before results appear."
2311
+ }
2312
+ });
2313
+
2314
+ // ../renderers/src/SearchRenderer/ErrorResult.tsx
2315
+ import { useIntl as useIntl6 } from "react-intl";
2316
+
2317
+ // ../renderers/src/messages/generic-error.messages.ts
2318
+ import { defineMessages as defineMessages7 } from "react-intl";
2319
+ var generic_error_messages_default = defineMessages7({
2320
+ genericErrorRetryHint: {
2321
+ id: "df.wise.PersistAsyncSchema.genericError",
2322
+ defaultMessage: "Something went wrong, please try again.",
2323
+ description: "Generic error message for persist async schema"
2324
+ },
2325
+ genericError: {
2326
+ id: "df.wise.ErrorBoundary.errorAlert",
2327
+ defaultMessage: "Something went wrong.",
2328
+ description: "Generic error message for when something has gone wrong."
2329
+ },
2330
+ retry: {
2331
+ id: "df.wise.ErrorBoundary.retry",
2332
+ defaultMessage: "Retry",
2333
+ description: "Usually this follows the generic error and contains a link."
2334
+ }
2335
+ });
2336
+
2337
+ // ../renderers/src/SearchRenderer/ErrorResult.tsx
2338
+ import { Button as Button6 } from "@transferwise/components";
2339
+ import { jsx as jsx43, jsxs as jsxs13 } from "react/jsx-runtime";
2340
+ function ErrorResult({ state }) {
2341
+ const intl = useIntl6();
2342
+ const buttonVisualProps = {
2343
+ priority: "tertiary",
2344
+ size: "sm",
2345
+ style: { marginTop: "-2px", padding: "0", width: "auto", display: "inline" }
2346
+ };
2347
+ return /* @__PURE__ */ jsxs13("p", { className: "m-t-2", children: [
2114
2348
  intl.formatMessage(generic_error_messages_default.genericError),
2115
2349
  "\xA0",
2116
- /* @__PURE__ */ jsx39(
2117
- Button5,
2350
+ /* @__PURE__ */ jsx43(
2351
+ Button6,
2118
2352
  __spreadProps(__spreadValues({}, buttonVisualProps), {
2119
2353
  onClick: () => {
2120
2354
  state.onRetry();
@@ -2126,7 +2360,7 @@ function ErrorResult({ state }) {
2126
2360
  }
2127
2361
 
2128
2362
  // ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
2129
- import { Fragment as Fragment2, jsx as jsx40, jsxs as jsxs11 } from "react/jsx-runtime";
2363
+ import { Fragment as Fragment4, jsx as jsx44, jsxs as jsxs14 } from "react/jsx-runtime";
2130
2364
  function BlockSearchRendererComponent({
2131
2365
  id,
2132
2366
  isLoading,
@@ -2138,9 +2372,9 @@ function BlockSearchRendererComponent({
2138
2372
  onChange
2139
2373
  }) {
2140
2374
  const [hasSearched, setHasSearched] = useState6(false);
2141
- const { formatMessage } = useIntl6();
2142
- return /* @__PURE__ */ jsxs11("div", { className: getMargin(margin), children: [
2143
- /* @__PURE__ */ jsx40(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ jsx40(
2375
+ const { formatMessage } = useIntl7();
2376
+ return /* @__PURE__ */ jsxs14("div", { className: getMargin(margin), children: [
2377
+ /* @__PURE__ */ jsx44(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ jsx44(
2144
2378
  Input4,
2145
2379
  {
2146
2380
  id,
@@ -2157,7 +2391,7 @@ function BlockSearchRendererComponent({
2157
2391
  }
2158
2392
  }
2159
2393
  ) }),
2160
- isLoading ? /* @__PURE__ */ jsx40(Fragment2, { children: formatMessage(search_messages_default.loading) }) : /* @__PURE__ */ jsx40(SearchResultContent, { state, trackEvent })
2394
+ isLoading ? /* @__PURE__ */ jsx44(Fragment4, { children: formatMessage(search_messages_default.loading) }) : /* @__PURE__ */ jsx44(SearchResultContent, { state, trackEvent })
2161
2395
  ] });
2162
2396
  }
2163
2397
  function SearchResultContent({
@@ -2166,26 +2400,26 @@ function SearchResultContent({
2166
2400
  }) {
2167
2401
  switch (state.type) {
2168
2402
  case "error":
2169
- return /* @__PURE__ */ jsx40(ErrorResult, { state });
2403
+ return /* @__PURE__ */ jsx44(ErrorResult, { state });
2170
2404
  case "results":
2171
- return /* @__PURE__ */ jsx40(SearchResults, { state, trackEvent });
2405
+ return /* @__PURE__ */ jsx44(SearchResults, { state, trackEvent });
2172
2406
  case "noResults":
2173
- return /* @__PURE__ */ jsx40(EmptySearchResult, { state });
2407
+ return /* @__PURE__ */ jsx44(EmptySearchResult, { state });
2174
2408
  case "pending":
2175
2409
  default:
2176
2410
  return null;
2177
2411
  }
2178
2412
  }
2179
2413
  function EmptySearchResult({ state }) {
2180
- return /* @__PURE__ */ jsx40(Markdown3, { className: "m-t-2", config: { link: { target: "_blank" } }, children: state.message });
2414
+ return /* @__PURE__ */ jsx44(Markdown4, { className: "m-t-2", config: { link: { target: "_blank" } }, children: state.message });
2181
2415
  }
2182
2416
  function SearchResults({
2183
2417
  state,
2184
2418
  trackEvent
2185
2419
  }) {
2186
- return /* @__PURE__ */ jsx40(NavigationOptionsList2, { children: state.results.map((result) => {
2420
+ return /* @__PURE__ */ jsx44(NavigationOptionsList2, { children: state.results.map((result) => {
2187
2421
  const { icon, image } = result;
2188
- return /* @__PURE__ */ jsx40(
2422
+ return /* @__PURE__ */ jsx44(
2189
2423
  NavigationOption3,
2190
2424
  {
2191
2425
  title: result.title,
@@ -2207,11 +2441,11 @@ function SearchResults({
2207
2441
  var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
2208
2442
 
2209
2443
  // ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
2210
- import { Markdown as Markdown4, Typeahead } from "@transferwise/components";
2444
+ import { Markdown as Markdown5, Typeahead } from "@transferwise/components";
2211
2445
  import { Search } from "@transferwise/icons";
2212
2446
  import { useState as useState7 } from "react";
2213
- import { useIntl as useIntl7 } from "react-intl";
2214
- import { jsx as jsx41 } from "react/jsx-runtime";
2447
+ import { useIntl as useIntl8 } from "react-intl";
2448
+ import { jsx as jsx45 } from "react/jsx-runtime";
2215
2449
  function InlineSearchRenderer({
2216
2450
  id,
2217
2451
  isLoading,
@@ -2222,8 +2456,8 @@ function InlineSearchRenderer({
2222
2456
  trackEvent
2223
2457
  }) {
2224
2458
  const [hasSearched, setHasSearched] = useState7(false);
2225
- const intl = useIntl7();
2226
- return /* @__PURE__ */ jsx41("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx41(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ jsx41(
2459
+ const intl = useIntl8();
2460
+ return /* @__PURE__ */ jsx45("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx45(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ jsx45(
2227
2461
  Typeahead,
2228
2462
  {
2229
2463
  id: "typeahead-input-id",
@@ -2231,10 +2465,10 @@ function InlineSearchRenderer({
2231
2465
  name: "typeahead-input-name",
2232
2466
  size: "md",
2233
2467
  maxHeight: 100,
2234
- footer: /* @__PURE__ */ jsx41(TypeaheadFooter, { state, isLoading }),
2468
+ footer: /* @__PURE__ */ jsx45(TypeaheadFooter, { state, isLoading }),
2235
2469
  multiple: false,
2236
2470
  clearable: false,
2237
- addon: /* @__PURE__ */ jsx41(Search, { size: 24 }),
2471
+ addon: /* @__PURE__ */ jsx45(Search, { size: 24 }),
2238
2472
  options: state.type === "results" ? state.results.map(mapResultToTypeaheadOption) : [],
2239
2473
  minQueryLength: 1,
2240
2474
  onChange: (values) => {
@@ -2269,31 +2503,43 @@ function mapResultToTypeaheadOption(result) {
2269
2503
  };
2270
2504
  }
2271
2505
  function TypeaheadFooter({ state, isLoading }) {
2272
- const { formatMessage } = useIntl7();
2506
+ const { formatMessage } = useIntl8();
2273
2507
  if (state.type === "noResults") {
2274
- return /* @__PURE__ */ jsx41(Markdown4, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: state.message });
2508
+ return /* @__PURE__ */ jsx45(Markdown5, { className: "m-t-2 m-x-2", config: { link: { target: "_blank" } }, children: state.message });
2275
2509
  }
2276
2510
  if (state.type === "error") {
2277
- return /* @__PURE__ */ jsx41("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ jsx41(ErrorResult, { state }) });
2511
+ return /* @__PURE__ */ jsx45("div", { className: "m-t-2 m-x-2", children: /* @__PURE__ */ jsx45(ErrorResult, { state }) });
2278
2512
  }
2279
2513
  if (state.type === "pending" || isLoading) {
2280
- return /* @__PURE__ */ jsx41("p", { className: "m-t-2 m-x-2", children: formatMessage(search_messages_default.loading) });
2514
+ return /* @__PURE__ */ jsx45("p", { className: "m-t-2 m-x-2", children: formatMessage(search_messages_default.loading) });
2281
2515
  }
2282
2516
  return null;
2283
2517
  }
2284
2518
  var InlineSearchRendererComponent_default = InlineSearchRenderer;
2285
2519
 
2286
2520
  // ../renderers/src/SearchRenderer/SearchRenderer.tsx
2287
- import { jsx as jsx42 } from "react/jsx-runtime";
2521
+ import { jsx as jsx46 } from "react/jsx-runtime";
2288
2522
  var SearchRenderer = {
2289
2523
  canRenderType: "search",
2290
- render: (props) => props.control === "inline" ? /* @__PURE__ */ jsx42(InlineSearchRendererComponent_default, __spreadValues({}, props)) : /* @__PURE__ */ jsx42(BlockSearchRendererComponent_default, __spreadValues({}, props))
2524
+ render: (props) => props.control === "inline" ? /* @__PURE__ */ jsx46(InlineSearchRendererComponent_default, __spreadValues({}, props)) : /* @__PURE__ */ jsx46(BlockSearchRendererComponent_default, __spreadValues({}, props))
2525
+ };
2526
+
2527
+ // ../renderers/src/SectionRenderer.tsx
2528
+ import { Header as Header7 } from "@transferwise/components";
2529
+ import { jsx as jsx47, jsxs as jsxs15 } from "react/jsx-runtime";
2530
+ var SectionRenderer = {
2531
+ canRenderType: "section",
2532
+ render: ({ children, callToAction, margin, title }) => {
2533
+ return /* @__PURE__ */ jsxs15("section", { className: getMargin(margin), children: [
2534
+ (title || callToAction) && /* @__PURE__ */ jsx47(Header7, { title: title != null ? title : "", action: getHeaderAction(callToAction) }),
2535
+ children
2536
+ ] });
2537
+ }
2291
2538
  };
2292
- var SearchRenderer_default = SearchRenderer;
2293
2539
 
2294
2540
  // ../renderers/src/SelectInputRenderer/RadioInputRendererComponent.tsx
2295
2541
  import { RadioGroup } from "@transferwise/components";
2296
- import { Fragment as Fragment3, jsx as jsx43, jsxs as jsxs12 } from "react/jsx-runtime";
2542
+ import { Fragment as Fragment5, jsx as jsx48, jsxs as jsxs16 } from "react/jsx-runtime";
2297
2543
  function RadioInputRendererComponent(props) {
2298
2544
  const {
2299
2545
  id,
@@ -2307,8 +2553,8 @@ function RadioInputRendererComponent(props) {
2307
2553
  validationState,
2308
2554
  onSelect
2309
2555
  } = props;
2310
- return /* @__PURE__ */ jsxs12(Fragment3, { children: [
2311
- /* @__PURE__ */ jsx43(
2556
+ return /* @__PURE__ */ jsxs16(Fragment5, { children: [
2557
+ /* @__PURE__ */ jsx48(
2312
2558
  FieldInput_default,
2313
2559
  {
2314
2560
  id,
@@ -2316,7 +2562,7 @@ function RadioInputRendererComponent(props) {
2316
2562
  help,
2317
2563
  description,
2318
2564
  validation: validationState,
2319
- children: /* @__PURE__ */ jsx43("span", { children: /* @__PURE__ */ jsx43(
2565
+ children: /* @__PURE__ */ jsx48("span", { children: /* @__PURE__ */ jsx48(
2320
2566
  RadioGroup,
2321
2567
  {
2322
2568
  name: id,
@@ -2325,7 +2571,7 @@ function RadioInputRendererComponent(props) {
2325
2571
  value: index,
2326
2572
  secondary: option.description,
2327
2573
  disabled: option.disabled || disabled,
2328
- avatar: /* @__PURE__ */ jsx43(OptionMedia, { icon: option.icon, image: option.image, preferAvatar: false })
2574
+ avatar: /* @__PURE__ */ jsx48(OptionMedia, { icon: option.icon, image: option.image, preferAvatar: false })
2329
2575
  })),
2330
2576
  selectedValue: selectedIndex != null ? selectedIndex : void 0,
2331
2577
  onChange: onSelect
@@ -2338,16 +2584,15 @@ function RadioInputRendererComponent(props) {
2338
2584
  ] });
2339
2585
  }
2340
2586
 
2341
- // ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
2342
- import { Tabs } from "@transferwise/components";
2343
- import { useEffect as useEffect2 } from "react";
2344
- import { Fragment as Fragment4, jsx as jsx44, jsxs as jsxs13 } from "react/jsx-runtime";
2345
- function TabInputRendererComponent(props) {
2587
+ // ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
2588
+ import { useEffect as useEffect3 } from "react";
2589
+ import { SegmentedControl } from "@transferwise/components";
2590
+ import { Fragment as Fragment6, jsx as jsx49, jsxs as jsxs17 } from "react/jsx-runtime";
2591
+ function SegmentedInputRendererComponent(props) {
2346
2592
  const {
2347
2593
  id,
2348
2594
  children,
2349
2595
  description,
2350
- disabled,
2351
2596
  help,
2352
2597
  title,
2353
2598
  options,
@@ -2355,13 +2600,13 @@ function TabInputRendererComponent(props) {
2355
2600
  validationState,
2356
2601
  onSelect
2357
2602
  } = props;
2358
- useEffect2(() => {
2603
+ useEffect3(() => {
2359
2604
  if (!isValidIndex(selectedIndex, options.length)) {
2360
2605
  onSelect(0);
2361
2606
  }
2362
2607
  }, [selectedIndex, onSelect, options.length]);
2363
- return /* @__PURE__ */ jsxs13(Fragment4, { children: [
2364
- /* @__PURE__ */ jsx44(
2608
+ return /* @__PURE__ */ jsxs17(Fragment6, { children: [
2609
+ /* @__PURE__ */ jsx49(
2365
2610
  FieldInput_default,
2366
2611
  {
2367
2612
  id,
@@ -2369,31 +2614,31 @@ function TabInputRendererComponent(props) {
2369
2614
  help,
2370
2615
  description,
2371
2616
  validation: validationState,
2372
- children: /* @__PURE__ */ jsx44(
2373
- Tabs,
2617
+ children: /* @__PURE__ */ jsx49(
2618
+ SegmentedControl,
2374
2619
  {
2375
- name: id,
2376
- selected: selectedIndex != null ? selectedIndex : 0,
2377
- tabs: options.map((option) => ({
2378
- title: option.title,
2379
- // if we pass null, we get some props-types console errors
2380
- // eslint-disable-next-line react/jsx-no-useless-fragment
2381
- content: /* @__PURE__ */ jsx44(Fragment4, {}),
2382
- disabled: option.disabled || disabled
2620
+ name: `${id}-segmented-control`,
2621
+ value: String(selectedIndex),
2622
+ mode: "view",
2623
+ segments: options.map((option, index) => ({
2624
+ id: String(index),
2625
+ value: String(index),
2626
+ label: option.title,
2627
+ controls: `${id}-children`
2383
2628
  })),
2384
- onTabSelect: onSelect
2629
+ onChange: (value) => onSelect(Number(value))
2385
2630
  }
2386
2631
  )
2387
2632
  }
2388
2633
  ),
2389
- children
2634
+ /* @__PURE__ */ jsx49("div", { id: `${id}-children`, children })
2390
2635
  ] });
2391
2636
  }
2392
2637
  var isValidIndex = (index, options) => index !== null && index >= 0 && index < options;
2393
2638
 
2394
2639
  // ../renderers/src/SelectInputRenderer/SelectInputRendererComponent.tsx
2395
2640
  import { SelectInput as SelectInput2, SelectInputOptionContent as SelectInputOptionContent2 } from "@transferwise/components";
2396
- import { Fragment as Fragment5, jsx as jsx45, jsxs as jsxs14 } from "react/jsx-runtime";
2641
+ import { Fragment as Fragment7, jsx as jsx50, jsxs as jsxs18 } from "react/jsx-runtime";
2397
2642
  function SelectInputRendererComponent(props) {
2398
2643
  const {
2399
2644
  id,
@@ -2433,13 +2678,13 @@ function SelectInputRendererComponent(props) {
2433
2678
  } : {
2434
2679
  title: option.title,
2435
2680
  description: option.description,
2436
- icon: /* @__PURE__ */ jsx45(OptionMedia, { icon: option.icon, image: option.image, preferAvatar: false })
2681
+ icon: /* @__PURE__ */ jsx50(OptionMedia, { icon: option.icon, image: option.image, preferAvatar: false })
2437
2682
  };
2438
- return /* @__PURE__ */ jsx45(SelectInputOptionContent2, __spreadValues({}, contentProps));
2683
+ return /* @__PURE__ */ jsx50(SelectInputOptionContent2, __spreadValues({}, contentProps));
2439
2684
  };
2440
2685
  const extraProps = { autoComplete };
2441
- return /* @__PURE__ */ jsxs14(Fragment5, { children: [
2442
- /* @__PURE__ */ jsx45(
2686
+ return /* @__PURE__ */ jsxs18(Fragment7, { children: [
2687
+ /* @__PURE__ */ jsx50(
2443
2688
  FieldInput_default,
2444
2689
  {
2445
2690
  id,
@@ -2447,7 +2692,7 @@ function SelectInputRendererComponent(props) {
2447
2692
  help,
2448
2693
  description,
2449
2694
  validation: validationState,
2450
- children: /* @__PURE__ */ jsx45(
2695
+ children: /* @__PURE__ */ jsx50(
2451
2696
  SelectInput2,
2452
2697
  __spreadValues({
2453
2698
  name: id,
@@ -2467,15 +2712,16 @@ function SelectInputRendererComponent(props) {
2467
2712
  ] });
2468
2713
  }
2469
2714
 
2470
- // ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
2471
- import { useEffect as useEffect3 } from "react";
2472
- import { SegmentedControl } from "@transferwise/components";
2473
- import { Fragment as Fragment6, jsx as jsx46, jsxs as jsxs15 } from "react/jsx-runtime";
2474
- function SegmentedInputRendererComponent(props) {
2715
+ // ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
2716
+ import { Tabs } from "@transferwise/components";
2717
+ import { useEffect as useEffect4 } from "react";
2718
+ import { Fragment as Fragment8, jsx as jsx51, jsxs as jsxs19 } from "react/jsx-runtime";
2719
+ function TabInputRendererComponent(props) {
2475
2720
  const {
2476
2721
  id,
2477
2722
  children,
2478
2723
  description,
2724
+ disabled,
2479
2725
  help,
2480
2726
  title,
2481
2727
  options,
@@ -2483,13 +2729,13 @@ function SegmentedInputRendererComponent(props) {
2483
2729
  validationState,
2484
2730
  onSelect
2485
2731
  } = props;
2486
- useEffect3(() => {
2732
+ useEffect4(() => {
2487
2733
  if (!isValidIndex2(selectedIndex, options.length)) {
2488
2734
  onSelect(0);
2489
2735
  }
2490
2736
  }, [selectedIndex, onSelect, options.length]);
2491
- return /* @__PURE__ */ jsxs15(Fragment6, { children: [
2492
- /* @__PURE__ */ jsx46(
2737
+ return /* @__PURE__ */ jsxs19(Fragment8, { children: [
2738
+ /* @__PURE__ */ jsx51(
2493
2739
  FieldInput_default,
2494
2740
  {
2495
2741
  id,
@@ -2497,61 +2743,60 @@ function SegmentedInputRendererComponent(props) {
2497
2743
  help,
2498
2744
  description,
2499
2745
  validation: validationState,
2500
- children: /* @__PURE__ */ jsx46(
2501
- SegmentedControl,
2746
+ children: /* @__PURE__ */ jsx51(
2747
+ Tabs,
2502
2748
  {
2503
- name: `${id}-segmented-control`,
2504
- value: String(selectedIndex),
2505
- mode: "view",
2506
- segments: options.map((option, index) => ({
2507
- id: String(index),
2508
- value: String(index),
2509
- label: option.title,
2510
- controls: `${id}-children`
2749
+ name: id,
2750
+ selected: selectedIndex != null ? selectedIndex : 0,
2751
+ tabs: options.map((option) => ({
2752
+ title: option.title,
2753
+ // if we pass null, we get some props-types console errors
2754
+ // eslint-disable-next-line react/jsx-no-useless-fragment
2755
+ content: /* @__PURE__ */ jsx51(Fragment8, {}),
2756
+ disabled: option.disabled || disabled
2511
2757
  })),
2512
- onChange: (value) => onSelect(Number(value))
2758
+ onTabSelect: onSelect
2513
2759
  }
2514
2760
  )
2515
2761
  }
2516
2762
  ),
2517
- /* @__PURE__ */ jsx46("div", { id: `${id}-children`, children })
2763
+ children
2518
2764
  ] });
2519
2765
  }
2520
2766
  var isValidIndex2 = (index, options) => index !== null && index >= 0 && index < options;
2521
2767
 
2522
2768
  // ../renderers/src/SelectInputRenderer/SelectInputRenderer.tsx
2523
- import { jsx as jsx47 } from "react/jsx-runtime";
2769
+ import { jsx as jsx52 } from "react/jsx-runtime";
2524
2770
  var SelectInputRenderer = {
2525
2771
  canRenderType: "input-select",
2526
2772
  render: (props) => {
2527
2773
  switch (props.control) {
2528
2774
  case "radio":
2529
- return /* @__PURE__ */ jsx47(RadioInputRendererComponent, __spreadValues({}, props));
2775
+ return /* @__PURE__ */ jsx52(RadioInputRendererComponent, __spreadValues({}, props));
2530
2776
  case "tab":
2531
- return props.options.length > 3 ? /* @__PURE__ */ jsx47(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ jsx47(TabInputRendererComponent, __spreadValues({}, props));
2777
+ return props.options.length > 3 ? /* @__PURE__ */ jsx52(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ jsx52(TabInputRendererComponent, __spreadValues({}, props));
2532
2778
  case "segmented":
2533
- return props.options.length > 3 ? /* @__PURE__ */ jsx47(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ jsx47(SegmentedInputRendererComponent, __spreadValues({}, props));
2779
+ return props.options.length > 3 ? /* @__PURE__ */ jsx52(SelectInputRendererComponent, __spreadValues({}, props)) : /* @__PURE__ */ jsx52(SegmentedInputRendererComponent, __spreadValues({}, props));
2534
2780
  case "select":
2535
2781
  default:
2536
- return /* @__PURE__ */ jsx47(SelectInputRendererComponent, __spreadValues({}, props));
2782
+ return /* @__PURE__ */ jsx52(SelectInputRendererComponent, __spreadValues({}, props));
2537
2783
  }
2538
2784
  }
2539
2785
  };
2540
- var SelectInputRenderer_default = SelectInputRenderer;
2541
2786
 
2542
2787
  // ../renderers/src/StatusListRenderer.tsx
2543
- import { Header as Header5, Summary } from "@transferwise/components";
2544
- import { jsx as jsx48, jsxs as jsxs16 } from "react/jsx-runtime";
2788
+ import { Header as Header8, Summary } from "@transferwise/components";
2789
+ import { jsx as jsx53, jsxs as jsxs20 } from "react/jsx-runtime";
2545
2790
  var StatusListRenderer = {
2546
2791
  canRenderType: "status-list",
2547
- render: ({ margin, items, title }) => /* @__PURE__ */ jsxs16("div", { className: getMargin(margin), children: [
2548
- title ? /* @__PURE__ */ jsx48(Header5, { title, className: "m-b-2" }) : null,
2549
- items.map(({ callToAction, description, icon, status, title: itemTitle }) => /* @__PURE__ */ jsx48(
2792
+ render: ({ margin, items, title }) => /* @__PURE__ */ jsxs20("div", { className: getMargin(margin), children: [
2793
+ title ? /* @__PURE__ */ jsx53(Header8, { title, className: "m-b-2" }) : null,
2794
+ items.map(({ callToAction, description, icon, status, title: itemTitle }) => /* @__PURE__ */ jsx53(
2550
2795
  Summary,
2551
2796
  {
2552
2797
  title: itemTitle,
2553
2798
  description,
2554
- icon: icon && "name" in icon ? /* @__PURE__ */ jsx48(DynamicIcon_default, { name: icon.name }) : null,
2799
+ icon: icon && "name" in icon ? /* @__PURE__ */ jsx53(DynamicIcon_default, { name: icon.name }) : null,
2555
2800
  status: mapStatus(status),
2556
2801
  action: getSummaryAction(callToAction)
2557
2802
  },
@@ -2559,7 +2804,6 @@ var StatusListRenderer = {
2559
2804
  ))
2560
2805
  ] })
2561
2806
  };
2562
- var StatusListRenderer_default = StatusListRenderer;
2563
2807
  var getSummaryAction = (callToAction) => {
2564
2808
  if (!callToAction) {
2565
2809
  return void 0;
@@ -2586,602 +2830,118 @@ var mapStatus = (status) => {
2586
2830
  return status;
2587
2831
  };
2588
2832
 
2589
- // ../renderers/src/TextInputRenderer.tsx
2590
- import { InputGroup as InputGroup3 } from "@transferwise/components";
2833
+ // ../renderers/src/utils/useCustomTheme.ts
2834
+ import { useTheme } from "@wise/components-theming";
2835
+ import { useEffect as useEffect5, useMemo } from "react";
2836
+ var ThemeRequiredEventName = "Theme Required";
2837
+ var useCustomTheme = (theme, trackEvent) => {
2838
+ const previousThemeHookValue = useTheme();
2839
+ const previousTheme = useMemo(() => previousThemeHookValue.theme, []);
2840
+ useEffect5(() => {
2841
+ trackEvent(ThemeRequiredEventName, { theme });
2842
+ return theme !== previousTheme ? () => {
2843
+ trackEvent(ThemeRequiredEventName, { theme: previousTheme });
2844
+ } : () => {
2845
+ };
2846
+ }, []);
2847
+ };
2591
2848
 
2592
- // ../renderers/src/components/VariableTextInput.tsx
2593
- import {
2594
- Input as Input5,
2595
- InputWithDisplayFormat,
2596
- PhoneNumberInput,
2597
- TextArea,
2598
- TextareaWithDisplayFormat
2599
- } from "@transferwise/components";
2600
- import { jsx as jsx49 } from "react/jsx-runtime";
2601
- var commonKeys = [
2602
- "autoComplete",
2603
- "autoCapitalize",
2604
- "placeholder",
2605
- "control",
2606
- "disabled",
2607
- "displayFormat",
2608
- "id",
2609
- "onBlur",
2610
- "onFocus",
2611
- "placeholder",
2612
- "value"
2613
- ];
2614
- function VariableTextInput(inputProps) {
2615
- const { id, value, control, onChange } = inputProps;
2616
- const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
2617
- switch (control) {
2618
- case "email":
2619
- return /* @__PURE__ */ jsx49(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
2620
- case "password":
2621
- return /* @__PURE__ */ jsx49(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
2622
- case "numeric": {
2623
- const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
2624
- return /* @__PURE__ */ jsx49(
2625
- TextInput,
2626
- __spreadProps(__spreadValues({}, numericProps), {
2627
- onChange: (newValue) => {
2628
- const numericValueOrNull = !Number.isNaN(Number.parseFloat(newValue)) ? newValue : null;
2629
- onChange(numericValueOrNull);
2630
- }
2631
- })
2632
- );
2633
- }
2634
- case "phone-number":
2635
- return /* @__PURE__ */ jsx49(PhoneNumberInput, __spreadProps(__spreadValues({ initialValue: value }, commonProps), { onChange }));
2636
- default: {
2637
- return /* @__PURE__ */ jsx49(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "text", onChange }));
2849
+ // ../renderers/src/step/BackButton.tsx
2850
+ import { AvatarView as AvatarView4 } from "@transferwise/components";
2851
+ import { ArrowLeft } from "@transferwise/icons";
2852
+ import { jsx as jsx54, jsxs as jsxs21 } from "react/jsx-runtime";
2853
+ function BackButton({ title, onClick }) {
2854
+ return /* @__PURE__ */ jsx54("div", { className: "m-b-2", children: /* @__PURE__ */ jsxs21(
2855
+ "button",
2856
+ {
2857
+ type: "button",
2858
+ className: "df-back-btn",
2859
+ title,
2860
+ "aria-label": title,
2861
+ onClick,
2862
+ children: [
2863
+ /* @__PURE__ */ jsx54("span", { className: "sr-only", children: title }),
2864
+ /* @__PURE__ */ jsx54(AvatarView4, { interactive: true, children: /* @__PURE__ */ jsx54(ArrowLeft, { size: "24" }) })
2865
+ ]
2638
2866
  }
2639
- }
2867
+ ) });
2640
2868
  }
2641
- function TextInput(props) {
2642
- const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
2643
- const InputWithPattern = control === "textarea" ? TextareaWithDisplayFormat : InputWithDisplayFormat;
2644
- const InputWithoutPattern = control === "textarea" ? TextArea : Input5;
2645
- return displayFormat ? /* @__PURE__ */ jsx49(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ jsx49(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { onChange: (e) => onChange(e.target.value) }));
2869
+ var BackButton_default = BackButton;
2870
+
2871
+ // ../renderers/src/step/SplashCelebrationStepRenderer.tsx
2872
+ import { jsx as jsx55, jsxs as jsxs22 } from "react/jsx-runtime";
2873
+ var SplashCelebrationStepRenderer = {
2874
+ canRenderType: "step",
2875
+ canRender: ({ control }) => control === "splash-celebration",
2876
+ render: SplashCelebrationStepRendererComponent
2877
+ };
2878
+ function SplashCelebrationStepRendererComponent(props) {
2879
+ const { back, children, trackEvent } = props;
2880
+ useCustomTheme("forest-green", trackEvent);
2881
+ return /* @__PURE__ */ jsxs22("div", { className: "splash-screen m-t-5", children: [
2882
+ back ? /* @__PURE__ */ jsx55(BackButton_default, __spreadValues({}, back)) : null,
2883
+ children
2884
+ ] });
2646
2885
  }
2647
2886
 
2648
- // ../renderers/src/TextInputRenderer.tsx
2649
- import { jsx as jsx50 } from "react/jsx-runtime";
2650
- var TextInputRenderer = {
2651
- canRenderType: "input-text",
2652
- render: (props) => {
2653
- const _a = props, {
2654
- id,
2655
- title,
2656
- description,
2657
- help,
2658
- icon,
2659
- image,
2660
- validationState,
2661
- value: initialValue,
2662
- onChange
2663
- } = _a, rest = __objRest(_a, [
2664
- "id",
2665
- "title",
2666
- "description",
2667
- "help",
2668
- "icon",
2669
- "image",
2670
- "validationState",
2671
- "value",
2672
- "onChange"
2673
- ]);
2674
- const value = initialValue != null ? initialValue : "";
2675
- const inputProps = __spreadProps(__spreadValues({}, rest), {
2676
- value,
2677
- id,
2678
- onChange: (newValue) => {
2679
- if ((value != null ? value : "") !== (newValue != null ? newValue : "")) {
2680
- onChange(newValue);
2681
- }
2682
- }
2683
- });
2684
- return /* @__PURE__ */ jsx50(
2685
- FieldInput_default,
2686
- {
2687
- id,
2688
- label: title,
2689
- description,
2690
- validation: validationState,
2691
- help,
2692
- children: /* @__PURE__ */ jsx50(InputGroup3, { addonStart: getInputGroupAddonStart({ icon, image }), children: /* @__PURE__ */ jsx50(VariableTextInput, __spreadValues({}, inputProps)) })
2693
- }
2694
- );
2695
- }
2696
- };
2697
- var TextInputRenderer_default = TextInputRenderer;
2698
-
2699
- // ../renderers/src/UploadInputRenderer.tsx
2700
- import { Upload, UploadInput as UploadInput2 } from "@transferwise/components";
2701
-
2702
- // ../renderers/src/utils/getRandomId.ts
2703
- var getRandomId = () => Math.random().toString(36).substring(2);
2704
-
2705
- // ../renderers/src/UploadInputRenderer.tsx
2706
- import { jsx as jsx51 } from "react/jsx-runtime";
2707
- var UploadInputRenderer = {
2708
- canRenderType: "input-upload",
2709
- render: (props) => {
2710
- const { id, accepts, title, description, disabled, maxSize, validationState, onUpload } = props;
2711
- const onUploadFile = async (formData) => {
2712
- const file = formData.get("file");
2713
- return onUpload(file).then(() => ({
2714
- id: getRandomId()
2715
- }));
2716
- };
2717
- const onDeleteFile = async () => {
2718
- await onUpload(null);
2719
- };
2720
- return (
2721
- // We don't pass help here as there is no sensible place to display it
2722
- /* @__PURE__ */ jsx51(
2723
- UploadFieldInput_default,
2724
- {
2725
- id,
2726
- label: void 0,
2727
- description: void 0,
2728
- validation: validationState,
2729
- children: /* @__PURE__ */ jsx51(
2730
- UploadInput2,
2731
- {
2732
- id,
2733
- description,
2734
- disabled,
2735
- fileTypes: getAcceptsString(accepts),
2736
- sizeLimit: maxSize ? toKilobytes(maxSize) : void 0,
2737
- uploadButtonTitle: title,
2738
- onDeleteFile,
2739
- onUploadFile
2740
- }
2741
- )
2742
- }
2743
- )
2744
- );
2745
- }
2746
- };
2747
- var LargeUploadRenderer = {
2748
- canRenderType: "input-upload",
2749
- canRender: (props) => props.control === "upload-large",
2750
- render: (props) => {
2751
- const _a = props, {
2752
- id,
2753
- accepts,
2754
- control,
2755
- title,
2756
- description,
2757
- disabled,
2758
- help,
2759
- type,
2760
- validationState,
2761
- onUpload
2762
- } = _a, rest = __objRest(_a, [
2763
- "id",
2764
- "accepts",
2765
- "control",
2766
- "title",
2767
- "description",
2768
- "disabled",
2769
- "help",
2770
- "type",
2771
- "validationState",
2772
- "onUpload"
2773
- ]);
2774
- const uploadProps = __spreadProps(__spreadValues({}, rest), { id, name: id });
2775
- const onUploadFile = async (file, fileName) => {
2776
- try {
2777
- const convertedFile = file ? await toFile(file, fileName) : null;
2778
- await onUpload(convertedFile);
2779
- } catch (e) {
2780
- await onUpload(null);
2781
- throw e;
2782
- }
2783
- };
2784
- return /* @__PURE__ */ jsx51(
2785
- FieldInput_default,
2786
- {
2787
- id,
2788
- label: title,
2789
- description,
2790
- validation: validationState,
2791
- help,
2792
- children: /* @__PURE__ */ jsx51(
2793
- Upload,
2794
- __spreadProps(__spreadValues({}, uploadProps), {
2795
- usAccept: getAcceptsString(accepts),
2796
- usDisabled: disabled,
2797
- onSuccess: onUploadFile,
2798
- onFailure: async () => onUpload(null),
2799
- onCancel: async () => onUpload(null)
2800
- })
2801
- )
2802
- }
2803
- );
2804
- }
2805
- };
2806
-
2807
- // ../renderers/src/ReviewRenderer.tsx
2808
- import { DefinitionList, Header as Header6 } from "@transferwise/components";
2809
-
2810
- // ../renderers/src/utils/getHeaderAction.tsx
2811
- var getHeaderAction = (callToAction) => {
2812
- if (!callToAction) {
2813
- return void 0;
2814
- }
2815
- const { accessibilityDescription, href, title, onClick } = callToAction;
2816
- return href ? {
2817
- "aria-label": accessibilityDescription,
2818
- text: title,
2819
- href,
2820
- target: "_blank"
2821
- } : {
2822
- "aria-label": accessibilityDescription,
2823
- text: title,
2824
- onClick: (event) => {
2825
- event.preventDefault();
2826
- onClick();
2827
- }
2828
- };
2829
- };
2830
-
2831
- // ../renderers/src/ReviewRenderer.tsx
2832
- import { Fragment as Fragment7, jsx as jsx52, jsxs as jsxs17 } from "react/jsx-runtime";
2833
- var ReviewRenderer = {
2834
- canRenderType: "review",
2835
- render: ({ analyticsId, callToAction, control, fields, margin, title, trackEvent }) => {
2836
- const orientation = mapControlToDefinitionListLayout(control);
2837
- const onHelpClick = (fieldAnalyticsId) => {
2838
- trackEvent("Help Pressed", {
2839
- layoutId: analyticsId,
2840
- layoutItemId: fieldAnalyticsId
2841
- });
2842
- };
2843
- return /* @__PURE__ */ jsxs17("div", { className: getMargin(margin), children: [
2844
- (title || callToAction) && /* @__PURE__ */ jsx52(Header6, { title: title != null ? title : "", action: getHeaderAction(callToAction) }),
2845
- /* @__PURE__ */ jsx52("div", { className: margin, children: /* @__PURE__ */ jsx52(
2846
- DefinitionList,
2847
- {
2848
- layout: orientation,
2849
- definitions: fields.map(
2850
- ({ label, value, help, analyticsId: fieldAnalyticsId }, index) => ({
2851
- key: String(index),
2852
- title: label,
2853
- value: getFieldValue(value, help, orientation, () => onHelpClick(fieldAnalyticsId))
2854
- })
2855
- )
2856
- }
2857
- ) })
2858
- ] });
2859
- }
2860
- };
2861
- var ReviewRenderer_default = ReviewRenderer;
2862
- var mapControlToDefinitionListLayout = (control) => {
2863
- switch (control) {
2864
- case "horizontal":
2865
- case "horizontal-end-aligned":
2866
- return "HORIZONTAL_RIGHT_ALIGNED";
2867
- case "horizontal-start-aligned":
2868
- return "HORIZONTAL_LEFT_ALIGNED";
2869
- case "vertical-two-column":
2870
- return "VERTICAL_TWO_COLUMN";
2871
- case "vertical":
2872
- case "vertical-one-column":
2873
- default:
2874
- return "VERTICAL_ONE_COLUMN";
2875
- }
2876
- };
2877
- var getFieldValue = (value, help, orientation, onClick) => {
2878
- if (help) {
2879
- return orientation === "HORIZONTAL_RIGHT_ALIGNED" ? /* @__PURE__ */ jsxs17(Fragment7, { children: [
2880
- /* @__PURE__ */ jsx52(Help_default, { help, onClick }),
2881
- " ",
2882
- value
2883
- ] }) : /* @__PURE__ */ jsxs17(Fragment7, { children: [
2884
- value,
2885
- " ",
2886
- /* @__PURE__ */ jsx52(Help_default, { help, onClick })
2887
- ] });
2888
- }
2889
- return value;
2890
- };
2891
-
2892
- // ../renderers/src/step/StepRenderer.tsx
2893
- import { Alert as Alert2, Title as Title2 } from "@transferwise/components";
2894
-
2895
- // ../renderers/src/step/BackButton.tsx
2896
- import { AvatarView as AvatarView4 } from "@transferwise/components";
2897
- import { ArrowLeft } from "@transferwise/icons";
2898
- import { jsx as jsx53, jsxs as jsxs18 } from "react/jsx-runtime";
2899
- function BackButton({ title, onClick }) {
2900
- return /* @__PURE__ */ jsx53("div", { className: "m-b-2", children: /* @__PURE__ */ jsxs18(
2901
- "button",
2902
- {
2903
- type: "button",
2904
- className: "df-back-btn",
2905
- title,
2906
- "aria-label": title,
2907
- onClick,
2908
- children: [
2909
- /* @__PURE__ */ jsx53("span", { className: "sr-only", children: title }),
2910
- /* @__PURE__ */ jsx53(AvatarView4, { interactive: true, children: /* @__PURE__ */ jsx53(ArrowLeft, { size: "24" }) })
2911
- ]
2912
- }
2913
- ) });
2914
- }
2915
- var BackButton_default = BackButton;
2916
-
2917
- // ../renderers/src/step/StepRenderer.tsx
2918
- import { Fragment as Fragment8, jsx as jsx54, jsxs as jsxs19 } from "react/jsx-runtime";
2919
- var StepRenderer = {
2920
- canRenderType: "step",
2921
- render: StepRendererComponent
2922
- };
2923
- function StepRendererComponent(props) {
2924
- const { back, description, error, title, children } = props;
2925
- return /* @__PURE__ */ jsxs19(Fragment8, { children: [
2926
- back ? /* @__PURE__ */ jsx54(BackButton_default, __spreadValues({}, back)) : null,
2927
- title || description ? /* @__PURE__ */ jsxs19("div", { className: "m-b-4", children: [
2928
- title ? /* @__PURE__ */ jsx54(Title2, { as: "h1", type: "title-section", className: "text-xs-center m-b-2", children: title }) : void 0,
2929
- description ? /* @__PURE__ */ jsx54("p", { className: "text-xs-center np-text-body-large", children: description }) : void 0
2930
- ] }) : void 0,
2931
- error ? /* @__PURE__ */ jsx54(Alert2, { type: "negative", className: "m-b-2", message: error }) : void 0,
2932
- children
2933
- ] });
2934
- }
2935
-
2936
- // ../renderers/src/ListRenderer.tsx
2937
- import { Body, Header as Header7 } from "@transferwise/components";
2938
- import classNames6 from "classnames";
2939
- import { jsx as jsx55, jsxs as jsxs20 } from "react/jsx-runtime";
2940
- var ListRenderer = {
2941
- canRenderType: "list",
2942
- render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ jsxs20("div", { className: getMargin(margin), children: [
2943
- (title || callToAction) && /* @__PURE__ */ jsx55(Header7, { as: "h2", title: title != null ? title : "", action: getListAction(callToAction) }),
2944
- items.map((props) => /* @__PURE__ */ jsx55(DesignSystemListItem, __spreadProps(__spreadValues({}, props), { control }), props.title))
2945
- ] })
2946
- };
2947
- var DesignSystemListItem = ({
2948
- title,
2949
- description,
2950
- supportingValues,
2951
- icon,
2952
- image,
2953
- control,
2954
- tag
2955
- }) => /* @__PURE__ */ jsx55(
2956
- "label",
2957
- {
2958
- className: classNames6("np-option p-a-2", {
2959
- "np-option__sm-media": true,
2960
- "np-option__container-aligned": true
2961
- }),
2962
- children: /* @__PURE__ */ jsxs20("div", { className: "media", children: [
2963
- icon || image ? /* @__PURE__ */ jsx55("div", { className: "media-left", children: /* @__PURE__ */ jsx55(
2964
- ListItemMedia,
2965
- {
2966
- image,
2967
- icon,
2968
- preferAvatar: control === "with-avatar" || tag === "with-avatar"
2969
- }
2970
- ) }) : null,
2971
- /* @__PURE__ */ jsxs20("div", { className: "media-body", children: [
2972
- /* @__PURE__ */ jsxs20("div", { className: "d-flex justify-content-between", children: [
2973
- /* @__PURE__ */ jsx55("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: title }),
2974
- /* @__PURE__ */ jsx55("h4", { className: "np-text-body-large-bold text-primary np-option__title", children: supportingValues == null ? void 0 : supportingValues.value })
2975
- ] }),
2976
- /* @__PURE__ */ jsxs20("div", { className: "d-flex justify-content-between", children: [
2977
- /* @__PURE__ */ jsx55(Body, { className: "d-block np-option__body", children: description }),
2978
- /* @__PURE__ */ jsx55(Body, { className: "d-block np-option__body", children: supportingValues == null ? void 0 : supportingValues.subvalue })
2979
- ] })
2980
- ] })
2981
- ] })
2982
- },
2983
- title
2984
- );
2985
- var ListItemMedia = ({
2986
- icon,
2987
- image,
2988
- preferAvatar
2989
- }) => {
2990
- if (icon) {
2991
- return /* @__PURE__ */ jsx55("div", { className: "circle circle-sm text-primary circle-inverse", children: /* @__PURE__ */ jsx55(OptionMedia, { icon, image, preferAvatar }) });
2992
- }
2993
- if (image) {
2994
- return /* @__PURE__ */ jsx55("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ jsx55(OptionMedia, { icon, image, preferAvatar }) });
2995
- }
2996
- };
2997
- var getListAction = (callToAction) => {
2998
- if (callToAction) {
2999
- return __spreadValues({
3000
- "aria-label": callToAction.accessibilityDescription,
3001
- text: callToAction.title,
3002
- onClick: callToAction.onClick
3003
- }, callToAction.type === "link" ? { href: callToAction.href, target: "_blank" } : {});
3004
- }
3005
- return void 0;
3006
- };
3007
- var ListRenderer_default = ListRenderer;
3008
-
3009
- // ../renderers/src/step/SplashStepRenderer.tsx
3010
- import { jsx as jsx56, jsxs as jsxs21 } from "react/jsx-runtime";
3011
- var SplashStepRenderer = {
3012
- canRenderType: "step",
3013
- canRender: ({ control }) => control === "splash",
3014
- render: SplashStepRendererComponent
3015
- };
3016
- function SplashStepRendererComponent(props) {
3017
- const { back, children } = props;
3018
- return /* @__PURE__ */ jsxs21("div", { className: "splash-screen m-t-5", children: [
3019
- back ? /* @__PURE__ */ jsx56(BackButton_default, __spreadValues({}, back)) : null,
3020
- children
3021
- ] });
3022
- }
3023
-
3024
- // ../renderers/src/utils/useCustomTheme.ts
3025
- import { useTheme } from "@wise/components-theming";
3026
- import { useEffect as useEffect4, useMemo } from "react";
3027
- var ThemeRequiredEventName = "Theme Required";
3028
- var useCustomTheme = (theme, trackEvent) => {
3029
- const previousThemeHookValue = useTheme();
3030
- const previousTheme = useMemo(() => previousThemeHookValue.theme, []);
3031
- useEffect4(() => {
3032
- trackEvent(ThemeRequiredEventName, { theme });
3033
- return theme !== previousTheme ? () => {
3034
- trackEvent(ThemeRequiredEventName, { theme: previousTheme });
3035
- } : () => {
3036
- };
3037
- }, []);
3038
- };
3039
-
3040
- // ../renderers/src/step/SplashCelebrationStepRenderer.tsx
3041
- import { jsx as jsx57, jsxs as jsxs22 } from "react/jsx-runtime";
3042
- var SplashCelebrationStepRenderer = {
3043
- canRenderType: "step",
3044
- canRender: ({ control }) => control === "splash-celebration",
3045
- render: SplashCelebrationStepRendererComponent
3046
- };
3047
- function SplashCelebrationStepRendererComponent(props) {
3048
- const { back, children, trackEvent } = props;
3049
- useCustomTheme("forest-green", trackEvent);
3050
- return /* @__PURE__ */ jsxs22("div", { className: "splash-screen m-t-5", children: [
3051
- back ? /* @__PURE__ */ jsx57(BackButton_default, __spreadValues({}, back)) : null,
3052
- children
3053
- ] });
3054
- }
3055
-
3056
- // ../renderers/src/ExternalConfirmationRenderer.tsx
3057
- import { Button as Button6, Markdown as Markdown5, Modal as Modal3 } from "@transferwise/components";
3058
-
3059
- // ../renderers/src/messages/external-confirmation.messages.ts
3060
- import { defineMessages as defineMessages7 } from "react-intl";
3061
- var external_confirmation_messages_default = defineMessages7({
3062
- title: {
3063
- id: "df.wise.ExternalConfirmation.title",
3064
- defaultMessage: "Please confirm",
3065
- description: "Heading for the confirmation screen."
3066
- },
3067
- description: {
3068
- id: "df.wise.ExternalConfirmation.description",
3069
- defaultMessage: "Please confirm you want to open **{origin}** in a new browser tab.",
3070
- description: "Description for the confirmation screen."
3071
- },
3072
- open: {
3073
- id: "df.wise.ExternalConfirmation.open",
3074
- defaultMessage: "Open in new tab",
3075
- description: "Button text confirming opening a new browser tab."
3076
- },
3077
- cancel: {
3078
- id: "df.wise.ExternalConfirmation.cancel",
3079
- defaultMessage: "Cancel",
3080
- description: "Button text rejecting opening a new browser tab."
3081
- }
3082
- });
3083
-
3084
- // ../renderers/src/ExternalConfirmationRenderer.tsx
3085
- import { useIntl as useIntl8 } from "react-intl";
3086
- import { useEffect as useEffect5 } from "react";
3087
- import { Fragment as Fragment9, jsx as jsx58, jsxs as jsxs23 } from "react/jsx-runtime";
3088
- var ExternalConfirmationRenderer = {
3089
- canRenderType: "external-confirmation",
3090
- render: ExternalConfirmationRendererComponent
3091
- };
3092
- function ExternalConfirmationRendererComponent({
3093
- url,
3094
- status,
3095
- onSuccess,
3096
- onFailure,
3097
- onCancel
3098
- }) {
3099
- const { formatMessage } = useIntl8();
3100
- useEffect5(() => {
3101
- if (url) {
3102
- const w = window.open(url, "_blank");
3103
- if (w) {
3104
- onSuccess();
3105
- } else {
3106
- onFailure();
3107
- }
3108
- }
3109
- }, []);
3110
- return /* @__PURE__ */ jsx58(
3111
- Modal3,
3112
- {
3113
- open: status === "failure",
3114
- title: formatMessage(external_confirmation_messages_default.title),
3115
- body: /* @__PURE__ */ jsxs23(Fragment9, { children: [
3116
- /* @__PURE__ */ jsx58(Markdown5, { config: { link: { target: "_blank" } }, className: "text-xs-center m-b-5", children: formatMessage(external_confirmation_messages_default.description, { origin: getOrigin(url) }) }),
3117
- /* @__PURE__ */ jsx58("div", { className: "df-box-renderer-fixed-width", children: /* @__PURE__ */ jsxs23("div", { className: "df-box-renderer-width-lg", children: [
3118
- /* @__PURE__ */ jsx58(
3119
- Button6,
3120
- {
3121
- block: true,
3122
- className: "m-b-2",
3123
- priority: "primary",
3124
- size: "md",
3125
- onClick: () => {
3126
- window.open(url);
3127
- onCancel();
3128
- },
3129
- children: formatMessage(external_confirmation_messages_default.open)
3130
- }
3131
- ),
3132
- /* @__PURE__ */ jsx58(Button6, { block: true, className: "m-b-2", priority: "tertiary", size: "md", onClick: onCancel, children: formatMessage(external_confirmation_messages_default.cancel) })
3133
- ] }) })
3134
- ] }),
3135
- onClose: onCancel
3136
- }
3137
- );
3138
- }
3139
- function getOrigin(url) {
3140
- try {
3141
- return new URL(url).origin;
3142
- } catch (e) {
3143
- return url;
3144
- }
2887
+ // ../renderers/src/step/SplashStepRenderer.tsx
2888
+ import { jsx as jsx56, jsxs as jsxs23 } from "react/jsx-runtime";
2889
+ var SplashStepRenderer = {
2890
+ canRenderType: "step",
2891
+ canRender: ({ control }) => control === "splash",
2892
+ render: SplashStepRendererComponent
2893
+ };
2894
+ function SplashStepRendererComponent(props) {
2895
+ const { back, children } = props;
2896
+ return /* @__PURE__ */ jsxs23("div", { className: "splash-screen m-t-5", children: [
2897
+ back ? /* @__PURE__ */ jsx56(BackButton_default, __spreadValues({}, back)) : null,
2898
+ children
2899
+ ] });
3145
2900
  }
3146
- var ExternalConfirmationRenderer_default = ExternalConfirmationRenderer;
3147
2901
 
3148
- // ../renderers/src/SectionRenderer.tsx
3149
- import { Header as Header8 } from "@transferwise/components";
3150
- import { jsx as jsx59, jsxs as jsxs24 } from "react/jsx-runtime";
3151
- var SectionRenderer = {
3152
- canRenderType: "section",
3153
- render: ({ children, callToAction, margin, title }) => {
3154
- return /* @__PURE__ */ jsxs24("section", { className: getMargin(margin), children: [
3155
- (title || callToAction) && /* @__PURE__ */ jsx59(Header8, { title: title != null ? title : "", action: getHeaderAction(callToAction) }),
3156
- children
3157
- ] });
3158
- }
2902
+ // ../renderers/src/step/StepRenderer.tsx
2903
+ import { Alert as Alert2, Title as Title2 } from "@transferwise/components";
2904
+ import { Fragment as Fragment9, jsx as jsx57, jsxs as jsxs24 } from "react/jsx-runtime";
2905
+ var StepRenderer = {
2906
+ canRenderType: "step",
2907
+ render: StepRendererComponent
3159
2908
  };
3160
- var SectionRenderer_default = SectionRenderer;
2909
+ function StepRendererComponent(props) {
2910
+ const { back, description, error, title, children } = props;
2911
+ return /* @__PURE__ */ jsxs24(Fragment9, { children: [
2912
+ back ? /* @__PURE__ */ jsx57(BackButton_default, __spreadValues({}, back)) : null,
2913
+ title || description ? /* @__PURE__ */ jsxs24("div", { className: "m-b-4", children: [
2914
+ title ? /* @__PURE__ */ jsx57(Title2, { as: "h1", type: "title-section", className: "text-xs-center m-b-2", children: title }) : void 0,
2915
+ description ? /* @__PURE__ */ jsx57("p", { className: "text-xs-center np-text-body-large", children: description }) : void 0
2916
+ ] }) : void 0,
2917
+ error ? /* @__PURE__ */ jsx57(Alert2, { type: "negative", className: "m-b-2", message: error }) : void 0,
2918
+ children
2919
+ ] });
2920
+ }
3161
2921
 
3162
2922
  // ../renderers/src/TabsRenderer.tsx
3163
2923
  import { Chips, SegmentedControl as SegmentedControl2, Tabs as Tabs2 } from "@transferwise/components";
3164
2924
  import { useState as useState8 } from "react";
3165
- import { jsx as jsx60, jsxs as jsxs25 } from "react/jsx-runtime";
2925
+ import { jsx as jsx58, jsxs as jsxs25 } from "react/jsx-runtime";
3166
2926
  var TabsRenderer = {
3167
2927
  canRenderType: "tabs",
3168
2928
  render: (props) => {
3169
2929
  switch (props.control) {
3170
2930
  case "segmented":
3171
2931
  if (props.tabs.length > 3) {
3172
- return /* @__PURE__ */ jsx60(TabsRendererComponent, __spreadValues({}, props));
2932
+ return /* @__PURE__ */ jsx58(TabsRendererComponent, __spreadValues({}, props));
3173
2933
  }
3174
- return /* @__PURE__ */ jsx60(SegmentedTabsRendererComponent, __spreadValues({}, props));
2934
+ return /* @__PURE__ */ jsx58(SegmentedTabsRendererComponent, __spreadValues({}, props));
3175
2935
  case "chips":
3176
- return /* @__PURE__ */ jsx60(ChipsTabsRendererComponent, __spreadValues({}, props));
2936
+ return /* @__PURE__ */ jsx58(ChipsTabsRendererComponent, __spreadValues({}, props));
3177
2937
  default:
3178
- return /* @__PURE__ */ jsx60(TabsRendererComponent, __spreadValues({}, props));
2938
+ return /* @__PURE__ */ jsx58(TabsRendererComponent, __spreadValues({}, props));
3179
2939
  }
3180
2940
  }
3181
2941
  };
3182
2942
  function TabsRendererComponent({ uid, margin, tabs }) {
3183
2943
  const [selectedIndex, setSelectedIndex] = useState8(0);
3184
- return /* @__PURE__ */ jsx60("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx60(
2944
+ return /* @__PURE__ */ jsx58("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx58(
3185
2945
  Tabs2,
3186
2946
  {
3187
2947
  name: uid,
@@ -3203,7 +2963,7 @@ function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
3203
2963
  var _a;
3204
2964
  const [selectedIndex, setSelectedIndex] = useState8(0);
3205
2965
  return /* @__PURE__ */ jsxs25("div", { className: getMargin(margin), children: [
3206
- /* @__PURE__ */ jsx60(
2966
+ /* @__PURE__ */ jsx58(
3207
2967
  SegmentedControl2,
3208
2968
  {
3209
2969
  name: uid,
@@ -3218,14 +2978,14 @@ function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
3218
2978
  onChange: (value) => setSelectedIndex(Number(value))
3219
2979
  }
3220
2980
  ),
3221
- /* @__PURE__ */ jsx60("div", { id: `${uid}-children`, className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
2981
+ /* @__PURE__ */ jsx58("div", { id: `${uid}-children`, className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
3222
2982
  ] });
3223
2983
  }
3224
2984
  function ChipsTabsRendererComponent({ margin, tabs }) {
3225
2985
  var _a;
3226
2986
  const [selectedIndex, setSelectedIndex] = useState8(0);
3227
2987
  return /* @__PURE__ */ jsxs25("div", { className: getMargin(margin), children: [
3228
- /* @__PURE__ */ jsx60("div", { className: "chips-container", children: /* @__PURE__ */ jsx60(
2988
+ /* @__PURE__ */ jsx58("div", { className: "chips-container", children: /* @__PURE__ */ jsx58(
3229
2989
  Chips,
3230
2990
  {
3231
2991
  chips: tabs.map((tab, index) => ({ label: tab.title, value: index })),
@@ -3233,60 +2993,268 @@ function ChipsTabsRendererComponent({ margin, tabs }) {
3233
2993
  onChange: ({ selectedValue }) => setSelectedIndex(Number(selectedValue))
3234
2994
  }
3235
2995
  ) }),
3236
- /* @__PURE__ */ jsx60("div", { className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
2996
+ /* @__PURE__ */ jsx58("div", { className: "m-t-2", children: (_a = tabs[selectedIndex]) == null ? void 0 : _a.children })
3237
2997
  ] });
3238
2998
  }
3239
2999
 
3000
+ // ../renderers/src/TextInputRenderer.tsx
3001
+ import { InputGroup as InputGroup3 } from "@transferwise/components";
3002
+
3003
+ // ../renderers/src/components/VariableTextInput.tsx
3004
+ import {
3005
+ Input as Input5,
3006
+ InputWithDisplayFormat,
3007
+ PhoneNumberInput,
3008
+ TextArea,
3009
+ TextareaWithDisplayFormat
3010
+ } from "@transferwise/components";
3011
+ import { jsx as jsx59 } from "react/jsx-runtime";
3012
+ var commonKeys = [
3013
+ "autoComplete",
3014
+ "autoCapitalize",
3015
+ "placeholder",
3016
+ "control",
3017
+ "disabled",
3018
+ "displayFormat",
3019
+ "id",
3020
+ "onBlur",
3021
+ "onFocus",
3022
+ "placeholder",
3023
+ "value"
3024
+ ];
3025
+ function VariableTextInput(inputProps) {
3026
+ const { id, value, control, onChange } = inputProps;
3027
+ const commonProps = __spreadProps(__spreadValues({}, pick(inputProps, ...commonKeys)), { name: id });
3028
+ switch (control) {
3029
+ case "email":
3030
+ return /* @__PURE__ */ jsx59(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "email", onChange }));
3031
+ case "password":
3032
+ return /* @__PURE__ */ jsx59(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "password", onChange }));
3033
+ case "numeric": {
3034
+ const numericProps = __spreadProps(__spreadValues({}, commonProps), { type: "number", onWheel });
3035
+ return /* @__PURE__ */ jsx59(
3036
+ TextInput,
3037
+ __spreadProps(__spreadValues({}, numericProps), {
3038
+ onChange: (newValue) => {
3039
+ const numericValueOrNull = !Number.isNaN(Number.parseFloat(newValue)) ? newValue : null;
3040
+ onChange(numericValueOrNull);
3041
+ }
3042
+ })
3043
+ );
3044
+ }
3045
+ case "phone-number":
3046
+ return /* @__PURE__ */ jsx59(PhoneNumberInput, __spreadProps(__spreadValues({ initialValue: value }, commonProps), { onChange }));
3047
+ default: {
3048
+ return /* @__PURE__ */ jsx59(TextInput, __spreadProps(__spreadValues({}, commonProps), { type: "text", onChange }));
3049
+ }
3050
+ }
3051
+ }
3052
+ function TextInput(props) {
3053
+ const _a = props, { control, displayFormat, onChange } = _a, commonProps = __objRest(_a, ["control", "displayFormat", "onChange"]);
3054
+ const InputWithPattern = control === "textarea" ? TextareaWithDisplayFormat : InputWithDisplayFormat;
3055
+ const InputWithoutPattern = control === "textarea" ? TextArea : Input5;
3056
+ return displayFormat ? /* @__PURE__ */ jsx59(InputWithPattern, __spreadProps(__spreadValues({ displayPattern: displayFormat }, commonProps), { onChange })) : /* @__PURE__ */ jsx59(InputWithoutPattern, __spreadProps(__spreadValues({}, commonProps), { onChange: (e) => onChange(e.target.value) }));
3057
+ }
3058
+
3059
+ // ../renderers/src/TextInputRenderer.tsx
3060
+ import { jsx as jsx60 } from "react/jsx-runtime";
3061
+ var TextInputRenderer = {
3062
+ canRenderType: "input-text",
3063
+ render: (props) => {
3064
+ const _a = props, {
3065
+ id,
3066
+ title,
3067
+ description,
3068
+ help,
3069
+ icon,
3070
+ image,
3071
+ validationState,
3072
+ value: initialValue,
3073
+ onChange
3074
+ } = _a, rest = __objRest(_a, [
3075
+ "id",
3076
+ "title",
3077
+ "description",
3078
+ "help",
3079
+ "icon",
3080
+ "image",
3081
+ "validationState",
3082
+ "value",
3083
+ "onChange"
3084
+ ]);
3085
+ const value = initialValue != null ? initialValue : "";
3086
+ const inputProps = __spreadProps(__spreadValues({}, rest), {
3087
+ value,
3088
+ id,
3089
+ onChange: (newValue) => {
3090
+ if ((value != null ? value : "") !== (newValue != null ? newValue : "")) {
3091
+ onChange(newValue);
3092
+ }
3093
+ }
3094
+ });
3095
+ return /* @__PURE__ */ jsx60(
3096
+ FieldInput_default,
3097
+ {
3098
+ id,
3099
+ label: title,
3100
+ description,
3101
+ validation: validationState,
3102
+ help,
3103
+ children: /* @__PURE__ */ jsx60(InputGroup3, { addonStart: getInputGroupAddonStart({ icon, image }), children: /* @__PURE__ */ jsx60(VariableTextInput, __spreadValues({}, inputProps)) })
3104
+ }
3105
+ );
3106
+ }
3107
+ };
3108
+
3109
+ // ../renderers/src/UploadInputRenderer.tsx
3110
+ import { Upload, UploadInput as UploadInput2 } from "@transferwise/components";
3111
+
3112
+ // ../renderers/src/utils/getRandomId.ts
3113
+ var getRandomId = () => Math.random().toString(36).substring(2);
3114
+
3115
+ // ../renderers/src/UploadInputRenderer.tsx
3116
+ import { jsx as jsx61 } from "react/jsx-runtime";
3117
+ var UploadInputRenderer = {
3118
+ canRenderType: "input-upload",
3119
+ render: (props) => {
3120
+ const { id, accepts, title, description, disabled, maxSize, validationState, onUpload } = props;
3121
+ const onUploadFile = async (formData) => {
3122
+ const file = formData.get("file");
3123
+ return onUpload(file).then(() => ({
3124
+ id: getRandomId()
3125
+ }));
3126
+ };
3127
+ const onDeleteFile = async () => {
3128
+ await onUpload(null);
3129
+ };
3130
+ return (
3131
+ // We don't pass help here as there is no sensible place to display it
3132
+ /* @__PURE__ */ jsx61(
3133
+ UploadFieldInput_default,
3134
+ {
3135
+ id,
3136
+ label: void 0,
3137
+ description: void 0,
3138
+ validation: validationState,
3139
+ children: /* @__PURE__ */ jsx61(
3140
+ UploadInput2,
3141
+ {
3142
+ id,
3143
+ description,
3144
+ disabled,
3145
+ fileTypes: getAcceptsString(accepts),
3146
+ sizeLimit: maxSize ? toKilobytes(maxSize) : void 0,
3147
+ uploadButtonTitle: title,
3148
+ onDeleteFile,
3149
+ onUploadFile
3150
+ }
3151
+ )
3152
+ }
3153
+ )
3154
+ );
3155
+ }
3156
+ };
3157
+ var LargeUploadRenderer = {
3158
+ canRenderType: "input-upload",
3159
+ canRender: (props) => props.control === "upload-large",
3160
+ render: (props) => {
3161
+ const _a = props, {
3162
+ id,
3163
+ accepts,
3164
+ control,
3165
+ title,
3166
+ description,
3167
+ disabled,
3168
+ help,
3169
+ type,
3170
+ validationState,
3171
+ onUpload
3172
+ } = _a, rest = __objRest(_a, [
3173
+ "id",
3174
+ "accepts",
3175
+ "control",
3176
+ "title",
3177
+ "description",
3178
+ "disabled",
3179
+ "help",
3180
+ "type",
3181
+ "validationState",
3182
+ "onUpload"
3183
+ ]);
3184
+ const uploadProps = __spreadProps(__spreadValues({}, rest), { id, name: id });
3185
+ const onUploadFile = async (file, fileName) => {
3186
+ try {
3187
+ const convertedFile = file ? await toFile(file, fileName) : null;
3188
+ await onUpload(convertedFile);
3189
+ } catch (e) {
3190
+ await onUpload(null);
3191
+ throw e;
3192
+ }
3193
+ };
3194
+ return /* @__PURE__ */ jsx61(
3195
+ FieldInput_default,
3196
+ {
3197
+ id,
3198
+ label: title,
3199
+ description,
3200
+ validation: validationState,
3201
+ help,
3202
+ children: /* @__PURE__ */ jsx61(
3203
+ Upload,
3204
+ __spreadProps(__spreadValues({}, uploadProps), {
3205
+ usAccept: getAcceptsString(accepts),
3206
+ usDisabled: disabled,
3207
+ onSuccess: onUploadFile,
3208
+ onFailure: async () => onUpload(null),
3209
+ onCancel: async () => onUpload(null)
3210
+ })
3211
+ )
3212
+ }
3213
+ );
3214
+ }
3215
+ };
3216
+
3240
3217
  // ../renderers/src/getWiseRenderers.ts
3241
3218
  var getWiseRenderers = () => [
3242
- AlertRenderer_default,
3243
- CheckboxInputRenderer_default,
3244
- BoxRenderer_default,
3245
- ButtonRenderer_default,
3246
- ColumnsRenderer_default,
3247
- DateInputRenderer_default,
3248
- DecisionRenderer_default,
3249
- DividerRenderer_default,
3250
- ExternalConfirmationRenderer_default,
3251
- FormRenderer_default,
3252
- FormSectionRenderer_default,
3253
- HeadingRenderer_default,
3254
- ImageRenderer_default,
3255
- InstructionsRenderer_default,
3256
- IntegerInputRenderer_default,
3219
+ AlertRenderer,
3220
+ CheckboxInputRenderer,
3221
+ BoxRenderer,
3222
+ ButtonRenderer,
3223
+ ColumnsRenderer,
3224
+ DateInputRenderer,
3225
+ DecisionRenderer,
3226
+ DividerRenderer,
3227
+ ExternalConfirmationRenderer,
3228
+ FormRenderer,
3229
+ FormSectionRenderer,
3230
+ HeadingRenderer,
3231
+ ImageRenderer,
3232
+ InstructionsRenderer,
3233
+ IntegerInputRenderer,
3257
3234
  LargeUploadRenderer,
3258
- ListRenderer_default,
3259
- LoadingIndicatorRenderer_default,
3260
- MarkdownRenderer_default,
3261
- ModalRenderer_default,
3262
- MultiSelectInputRenderer_default,
3263
- MultiUploadInputRenderer_default,
3264
- NumberInputRenderer_default,
3265
- ParagraphRenderer_default,
3266
- RepeatableRenderer_default,
3267
- ReviewRenderer_default,
3268
- SearchRenderer_default,
3269
- SelectInputRenderer_default,
3270
- SectionRenderer_default,
3271
- StatusListRenderer_default,
3235
+ ListRenderer,
3236
+ LoadingIndicatorRenderer,
3237
+ MarkdownRenderer,
3238
+ ModalContentRenderer,
3239
+ ModalLayoutRenderer,
3240
+ MultiSelectInputRenderer,
3241
+ MultiUploadInputRenderer,
3242
+ NumberInputRenderer,
3243
+ ParagraphRenderer,
3244
+ RepeatableRenderer,
3245
+ ReviewRenderer,
3246
+ SearchRenderer,
3247
+ SelectInputRenderer,
3248
+ SectionRenderer,
3249
+ StatusListRenderer,
3272
3250
  TabsRenderer,
3273
- TextInputRenderer_default,
3251
+ TextInputRenderer,
3274
3252
  UploadInputRenderer,
3275
3253
  SplashStepRenderer,
3276
3254
  SplashCelebrationStepRenderer,
3277
3255
  StepRenderer
3278
3256
  ];
3279
3257
 
3280
- // ../renderers/src/ModalContentRenderer.tsx
3281
- import { Modal as Modal4 } from "@transferwise/components";
3282
- import { jsx as jsx61 } from "react/jsx-runtime";
3283
- var ModalContentRenderer = {
3284
- canRenderType: "modal-content",
3285
- render: ({ title, children, open, onClose }) => {
3286
- return /* @__PURE__ */ jsx61(Modal4, { open, title, body: children, onClose });
3287
- }
3288
- };
3289
-
3290
3258
  // src/dynamicFlow/telemetry/app-version.ts
3291
3259
  var appVersion = (
3292
3260
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
@@ -3349,10 +3317,7 @@ function DynamicFlowRevamp(props) {
3349
3317
  onThemeChange
3350
3318
  } = props;
3351
3319
  const httpClient = useWiseHttpClient(customFetch);
3352
- const mergedRenderers = useMemo2(
3353
- () => [ModalContentRenderer, ...renderers != null ? renderers : [], ...wiseRenderers],
3354
- [renderers]
3355
- );
3320
+ const mergedRenderers = useMemo2(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
3356
3321
  const logEvent = useMemo2(() => getLogEvent(onLog), [onLog]);
3357
3322
  const trackEvent = useMemo2(
3358
3323
  () => getTrackEvent(onEvent, onAnalytics, onThemeChange),
@@ -3379,10 +3344,7 @@ var DynamicForm = forwardRef(function DynamicForm2(props, ref) {
3379
3344
  onThemeChange
3380
3345
  } = props;
3381
3346
  const httpClient = useWiseHttpClient(customFetch);
3382
- const mergedRenderers = useMemo2(
3383
- () => [ModalContentRenderer, ...renderers != null ? renderers : [], ...wiseRenderers],
3384
- [renderers]
3385
- );
3347
+ const mergedRenderers = useMemo2(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
3386
3348
  const logEvent = useMemo2(() => getLogEvent(onLog), [onLog]);
3387
3349
  const trackEvent = useMemo2(
3388
3350
  () => getTrackEvent(onEvent, onAnalytics, onThemeChange),