@wise/dynamic-flow-client-internal 5.17.0 → 5.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/build/main.js CHANGED
@@ -141,7 +141,7 @@ var import_dynamic_flow_client4 = require("@wise/dynamic-flow-client");
141
141
  // src/dynamicFlow/telemetry/app-version.ts
142
142
  var appVersion = (
143
143
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
144
- typeof process !== "undefined" ? "5.17.0" : "0.0.0"
144
+ typeof process !== "undefined" ? "5.18.1" : "0.0.0"
145
145
  );
146
146
 
147
147
  // src/dynamicFlow/context-menu/useContextMenu.tsx
@@ -226,27 +226,29 @@ var useDFContextMenu = (controller) => {
226
226
  }
227
227
  },
228
228
  {
229
- label: "Open in Sandbox",
229
+ label: "Copy step JSON",
230
230
  onClick: () => {
231
- openInSandbox(getEncodedCurrentStep());
231
+ copyToClipboard(getCurrentStep());
232
232
  }
233
233
  },
234
234
  {
235
- label: "Open in Sandbox (with model)",
235
+ label: "Open in Studio (experimental)",
236
236
  onClick: () => {
237
- void getEncodedCurrentStepWithModel().then(openInSandbox);
237
+ openIn("studio", getEncodedCurrentStep());
238
238
  }
239
239
  },
240
240
  {
241
- label: "Copy step JSON",
241
+ label: "Open in Sandbox",
242
242
  onClick: () => {
243
- copyToClipboard(getCurrentStep());
243
+ openIn("sandbox", getEncodedCurrentStep());
244
244
  }
245
245
  },
246
246
  {
247
- label: "Copy step JSON (with model)",
247
+ label: "Open in Sandbox (with model)",
248
248
  onClick: () => {
249
- void getCurrentStepWithModel().then(copyToClipboard);
249
+ void getEncodedCurrentStepWithModel().then(
250
+ (base64Step) => openIn("sandbox", base64Step)
251
+ );
250
252
  }
251
253
  }
252
254
  ] : []
@@ -257,9 +259,9 @@ var toBase64 = (str) => {
257
259
  const binString = Array.from(bytes, (b) => String.fromCharCode(b)).join("");
258
260
  return btoa(binString);
259
261
  };
260
- var openInSandbox = (base64Step) => {
262
+ var openIn = (editor, base64Step) => {
261
263
  if (base64Step) {
262
- window.open(`https://df.wise.com/sandbox#${base64Step}`, "_blank", "noopener,noreferrer");
264
+ window.open(`https://df.wise.com/${editor}#${base64Step}`, "_blank", "noopener,noreferrer");
263
265
  }
264
266
  };
265
267
  var openVersionPage = (version) => {
@@ -323,56 +325,10 @@ var recursivelyRemoveNullish = (element) => {
323
325
  };
324
326
 
325
327
  // src/dynamicFlow/useWiseToCoreProps.tsx
326
- var import_react24 = require("react");
327
-
328
- // src/dynamicFlow/telemetry/getLogEvent.ts
329
- var getLogEvent = (onLog) => (level, message, extra) => {
330
- const extraWithVersion = __spreadProps(__spreadValues({}, extra), {
331
- dfWiseVersion: appVersion
332
- });
333
- if (level !== "info" && onLog) {
334
- if (onLog) {
335
- onLog(level, message, extraWithVersion);
336
- } else {
337
- logToRollbar(level, message, extraWithVersion);
338
- }
339
- }
340
- };
341
- var logToRollbar = (level, message, extra) => {
342
- try {
343
- const rollbar = typeof window.Rollbar !== "undefined" ? window.Rollbar : void 0;
344
- rollbar == null ? void 0 : rollbar[level](message, extra);
345
- } catch (error) {
346
- console.error("Failed to log to Rollbar", error);
347
- }
348
- };
328
+ var import_react26 = require("react");
349
329
 
350
- // src/dynamicFlow/telemetry/getTrackEvent.ts
351
- var import_dynamic_flow_client = require("@wise/dynamic-flow-client");
352
- var prefix = "Dynamic Flow - ";
353
- var getTrackEvent = (onEvent, onAnalytics) => (name, properties) => {
354
- onEvent == null ? void 0 : onEvent(name, properties);
355
- if (includeInAnalytics(name)) {
356
- onAnalytics == null ? void 0 : onAnalytics(name, properties);
357
- }
358
- };
359
- var includeInAnalytics = (name) => {
360
- const eventName = name.startsWith(prefix) ? name.slice(prefix.length) : name;
361
- if (isCoreEventName(eventName)) {
362
- return true;
363
- }
364
- if (eventName in customEventsToAnalytics) {
365
- return customEventsToAnalytics[eventName];
366
- }
367
- return true;
368
- };
369
- var isCoreEventName = (eventName) => {
370
- return import_dynamic_flow_client.eventNames.includes(eventName);
371
- };
372
- var customEventsToAnalytics = {
373
- "Theme Required": false
374
- // Excluded from analytics
375
- };
330
+ // src/dynamicFlow/getMergedRenderers.tsx
331
+ var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
376
332
 
377
333
  // ../renderers/src/AlertRenderer.tsx
378
334
  var import_components = require("@transferwise/components");
@@ -911,6 +867,18 @@ var getPriority = (control, tags) => {
911
867
 
912
868
  // ../renderers/src/components/FieldInput.tsx
913
869
  var import_components8 = require("@transferwise/components");
870
+ var import_react4 = require("react");
871
+
872
+ // ../renderers/src/utils/scroll-to-if-not-visible.ts
873
+ var scrollToIfNotVisible = (ref) => {
874
+ const rect = ref == null ? void 0 : ref.getBoundingClientRect();
875
+ if (!ref || !rect) {
876
+ return;
877
+ }
878
+ if (rect.bottom > window.innerHeight || rect.top < 0) {
879
+ ref.scrollIntoView({ behavior: "smooth" });
880
+ }
881
+ };
914
882
 
915
883
  // ../renderers/src/components/Help.tsx
916
884
  var import_components7 = require("@transferwise/components");
@@ -954,28 +922,47 @@ function LabelContentWithHelp({ text, help }) {
954
922
 
955
923
  // ../renderers/src/components/FieldInput.tsx
956
924
  var import_jsx_runtime19 = require("react/jsx-runtime");
957
- function FieldInput({ id, children, label, validation, description, help }) {
925
+ function FieldInput({
926
+ id,
927
+ children,
928
+ label,
929
+ validation,
930
+ description,
931
+ help,
932
+ loadingState = "idle",
933
+ inlineAlert
934
+ }) {
958
935
  const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(LabelContentWithHelp, { text: label, help }) : label;
959
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
936
+ const message = validation == null ? void 0 : validation.message;
937
+ const ref = (0, import_react4.useRef)(null);
938
+ (0, import_react4.useEffect)(() => {
939
+ if (message) {
940
+ scrollToIfNotVisible(ref.current);
941
+ }
942
+ }, [message]);
943
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
960
944
  import_components8.Field,
961
945
  {
962
946
  id,
963
947
  label: labelContent,
964
948
  description,
965
- message: validation == null ? void 0 : validation.message,
966
- sentiment: mapStatusToSentiment(validation),
949
+ message: message != null ? message : inlineAlert == null ? void 0 : inlineAlert.content,
950
+ messageLoading: loadingState !== "idle",
951
+ sentiment: mapStatusToSentiment(validation, inlineAlert == null ? void 0 : inlineAlert.context),
967
952
  children
968
953
  }
969
- );
954
+ ) });
970
955
  }
971
- var mapStatusToSentiment = (validation) => {
972
- if (validation) {
973
- if (validation.status === "valid") {
974
- return "positive";
956
+ var mapStatusToSentiment = (validation, defaultContext) => {
957
+ if (validation == null ? void 0 : validation.message) {
958
+ switch (validation.status) {
959
+ case "valid":
960
+ return "positive";
961
+ case "invalid":
962
+ return "negative";
975
963
  }
976
- return "negative";
977
964
  }
978
- return void 0;
965
+ return defaultContext;
979
966
  };
980
967
  var FieldInput_default = FieldInput;
981
968
 
@@ -1043,7 +1030,19 @@ var CheckboxComponent = (props) => {
1043
1030
  "value"
1044
1031
  ]);
1045
1032
  const checkboxProps = __spreadProps(__spreadValues({}, rest), { label: title, secondary: description, checked: value });
1046
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(FieldInput_default, { id, label: "", description: "", validation: validationState, help, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.Checkbox, __spreadValues({ id }, checkboxProps)) });
1033
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
1034
+ FieldInput_default,
1035
+ {
1036
+ id,
1037
+ label: "",
1038
+ description: "",
1039
+ validation: validationState,
1040
+ help,
1041
+ inlineAlert: rest.inlineAlert,
1042
+ loadingState: rest.fieldLoadingState,
1043
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.Checkbox, __spreadValues({ id }, checkboxProps))
1044
+ }
1045
+ );
1047
1046
  };
1048
1047
  var CheckboxItemComponent = (props) => {
1049
1048
  const {
@@ -1098,7 +1097,7 @@ var SwitchItemComponent = (props) => {
1098
1097
  );
1099
1098
  };
1100
1099
  var getInlineAlertOrValidation = (validationState, inlineAlert) => {
1101
- if (validationState && validationState.status === "invalid") {
1100
+ if ((validationState == null ? void 0 : validationState.status) === "invalid") {
1102
1101
  return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components11.ListItem.Prompt, { sentiment: "negative", children: validationState.message });
1103
1102
  }
1104
1103
  return getInlineAlert(inlineAlert);
@@ -1235,6 +1234,8 @@ var DateInputRenderer = {
1235
1234
  label: title,
1236
1235
  description,
1237
1236
  validation: validationState,
1237
+ inlineAlert: props.inlineAlert,
1238
+ loadingState: props.fieldLoadingState,
1238
1239
  help,
1239
1240
  children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(VariableDateInput_default, { control, inputProps })
1240
1241
  }
@@ -1278,7 +1279,7 @@ var shouldUseAvatar = (control, tags) => {
1278
1279
 
1279
1280
  // ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
1280
1281
  var import_components15 = require("@transferwise/components");
1281
- var import_react4 = require("react");
1282
+ var import_react5 = require("react");
1282
1283
  var import_react_intl8 = require("react-intl");
1283
1284
 
1284
1285
  // ../renderers/src/messages/filter.messages.ts
@@ -1424,7 +1425,7 @@ var UnfilteredDecisionList = (_a) => {
1424
1425
  };
1425
1426
  var FilteredDecisionList = (props) => {
1426
1427
  const { formatMessage } = (0, import_react_intl8.useIntl)();
1427
- const [query, setQuery] = (0, import_react4.useState)("");
1428
+ const [query, setQuery] = (0, import_react5.useState)("");
1428
1429
  const { control, options, renderDecisionList: renderDecisionList2 } = props;
1429
1430
  const filteredOptions = (query == null ? void 0 : query.length) > 0 ? filterAndSortDecisionOptions(options, query) : options;
1430
1431
  const isGrouped = isGroupedDecision(options);
@@ -1541,7 +1542,7 @@ var external_confirmation_messages_default = (0, import_react_intl9.defineMessag
1541
1542
 
1542
1543
  // ../renderers/src/ExternalConfirmationRenderer.tsx
1543
1544
  var import_react_intl10 = require("react-intl");
1544
- var import_react5 = require("react");
1545
+ var import_react6 = require("react");
1545
1546
  var import_jsx_runtime32 = require("react/jsx-runtime");
1546
1547
  var ExternalConfirmationRenderer = {
1547
1548
  canRenderType: "external-confirmation",
@@ -1554,7 +1555,7 @@ function ExternalConfirmationRendererComponent({
1554
1555
  onCancel
1555
1556
  }) {
1556
1557
  const { formatMessage } = (0, import_react_intl10.useIntl)();
1557
- (0, import_react5.useEffect)(() => {
1558
+ (0, import_react6.useEffect)(() => {
1558
1559
  open();
1559
1560
  }, []);
1560
1561
  return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
@@ -1668,7 +1669,7 @@ var HeadingRenderer_default = HeadingRenderer;
1668
1669
 
1669
1670
  // ../renderers/src/ImageRenderer/UrlImage.tsx
1670
1671
  var import_components21 = require("@transferwise/components");
1671
- var import_react6 = require("react");
1672
+ var import_react7 = require("react");
1672
1673
 
1673
1674
  // ../renderers/src/utils/api-utils.ts
1674
1675
  function isRelativePath(url = "") {
@@ -1687,8 +1688,8 @@ function UrlImage({
1687
1688
  uri,
1688
1689
  httpClient
1689
1690
  }) {
1690
- const [imageSource, setImageSource] = (0, import_react6.useState)("");
1691
- (0, import_react6.useEffect)(() => {
1691
+ const [imageSource, setImageSource] = (0, import_react7.useState)("");
1692
+ (0, import_react7.useEffect)(() => {
1692
1693
  if (!uri.startsWith("urn:")) {
1693
1694
  void getImageSource(httpClient, uri).then(setImageSource);
1694
1695
  }
@@ -1751,7 +1752,7 @@ function UrnFlagImage({
1751
1752
 
1752
1753
  // ../renderers/src/ImageRenderer/UrnIllustration.tsx
1753
1754
  var import_art4 = require("@wise/art");
1754
- var import_react8 = require("react");
1755
+ var import_react9 = require("react");
1755
1756
 
1756
1757
  // ../renderers/src/ImageRenderer/isAnimated.ts
1757
1758
  var isAnimated = (uri) => {
@@ -1761,9 +1762,9 @@ var isAnimated = (uri) => {
1761
1762
 
1762
1763
  // ../renderers/src/ImageRenderer/SafeIllustration3D.tsx
1763
1764
  var import_art3 = require("@wise/art");
1764
- var import_react7 = require("react");
1765
+ var import_react8 = require("react");
1765
1766
  var import_jsx_runtime38 = require("react/jsx-runtime");
1766
- var Illustration3DErrorBoundary = class extends import_react7.Component {
1767
+ var Illustration3DErrorBoundary = class extends import_react8.Component {
1767
1768
  constructor(props) {
1768
1769
  super(props);
1769
1770
  this.state = { hasError: false };
@@ -1801,7 +1802,7 @@ function UrnIllustration({
1801
1802
  size,
1802
1803
  uri
1803
1804
  }) {
1804
- const [has3DFailed, setHas3DFailed] = (0, import_react8.useState)(false);
1805
+ const [has3DFailed, setHas3DFailed] = (0, import_react9.useState)(false);
1805
1806
  const illustrationSize = getIllustrationSize(size);
1806
1807
  const illustrationName = getIllustrationName(uri);
1807
1808
  const illustration3DName = getIllustration3DName(uri);
@@ -1924,6 +1925,8 @@ var IntegerInputRenderer = {
1924
1925
  label: title,
1925
1926
  description,
1926
1927
  validation: validationState,
1928
+ inlineAlert: props.inlineAlert,
1929
+ loadingState: props.fieldLoadingState,
1927
1930
  help,
1928
1931
  children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components23.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
1929
1932
  import_components23.Input,
@@ -2139,7 +2142,7 @@ var mapAvatarMediaSize = (size) => {
2139
2142
 
2140
2143
  // ../renderers/src/ModalLayoutRenderer.tsx
2141
2144
  var import_components29 = require("@transferwise/components");
2142
- var import_react9 = require("react");
2145
+ var import_react10 = require("react");
2143
2146
  var import_jsx_runtime50 = require("react/jsx-runtime");
2144
2147
  var ModalLayoutRenderer = {
2145
2148
  canRenderType: "modal-layout",
@@ -2147,7 +2150,7 @@ var ModalLayoutRenderer = {
2147
2150
  };
2148
2151
  var ModalLayoutRenderer_default = ModalLayoutRenderer;
2149
2152
  function DFModal({ content, margin, trigger }) {
2150
- const [visible, setVisible] = (0, import_react9.useState)(false);
2153
+ const [visible, setVisible] = (0, import_react10.useState)(false);
2151
2154
  const { children, title } = content;
2152
2155
  return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: getMargin(margin), children: [
2153
2156
  /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_components29.Button, { v2: true, priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
@@ -2177,7 +2180,7 @@ var ModalRenderer = {
2177
2180
 
2178
2181
  // ../renderers/src/MoneyInputRenderer.tsx
2179
2182
  var import_components31 = require("@transferwise/components");
2180
- var import_react10 = require("react");
2183
+ var import_react11 = require("react");
2181
2184
  var import_react_intl11 = require("react-intl");
2182
2185
  var import_jsx_runtime52 = require("react/jsx-runtime");
2183
2186
  var groupingTags2 = Object.keys(group_messages_default).filter((key) => key !== "all");
@@ -2200,7 +2203,7 @@ function MoneyInputRendererComponent(props) {
2200
2203
  onAmountChange,
2201
2204
  onCurrencyChange
2202
2205
  } = props;
2203
- (0, import_react10.useEffect)(() => {
2206
+ (0, import_react11.useEffect)(() => {
2204
2207
  if (!isValidIndex(selectedCurrencyIndex, currencies.length)) {
2205
2208
  onCurrencyChange(0);
2206
2209
  }
@@ -2342,7 +2345,7 @@ function InlineComponent(props) {
2342
2345
 
2343
2346
  // ../renderers/src/MultiSelectInputRenderer/DefaultComponent.tsx
2344
2347
  var import_components33 = require("@transferwise/components");
2345
- var import_react11 = require("react");
2348
+ var import_react12 = require("react");
2346
2349
  var import_react_intl13 = require("react-intl");
2347
2350
 
2348
2351
  // ../renderers/src/messages/multi-select.messages.ts
@@ -2359,7 +2362,7 @@ var multi_select_messages_default = (0, import_react_intl12.defineMessages)({
2359
2362
  var import_jsx_runtime54 = require("react/jsx-runtime");
2360
2363
  function DefaultComponent(props) {
2361
2364
  const { formatMessage } = (0, import_react_intl13.useIntl)();
2362
- const [stagedIndices, setStagedIndices] = (0, import_react11.useState)();
2365
+ const [stagedIndices, setStagedIndices] = (0, import_react12.useState)();
2363
2366
  const {
2364
2367
  id,
2365
2368
  autoComplete,
@@ -2517,6 +2520,7 @@ var MultiSelectInputRenderer = {
2517
2520
  var import_components36 = require("@transferwise/components");
2518
2521
 
2519
2522
  // ../renderers/src/components/UploadFieldInput.tsx
2523
+ var import_react13 = require("react");
2520
2524
  var import_components35 = require("@transferwise/components");
2521
2525
  var import_classnames4 = __toESM(require_classnames());
2522
2526
  var import_jsx_runtime57 = require("react/jsx-runtime");
@@ -2530,9 +2534,17 @@ function UploadFieldInput({
2530
2534
  }) {
2531
2535
  const labelContent = label && help ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(LabelContentWithHelp, { text: label, help }) : label;
2532
2536
  const descriptionId = description ? `${id}-description` : void 0;
2537
+ const message = validation == null ? void 0 : validation.message;
2538
+ const ref = (0, import_react13.useRef)(null);
2539
+ (0, import_react13.useEffect)(() => {
2540
+ if (message) {
2541
+ scrollToIfNotVisible(ref.current);
2542
+ }
2543
+ }, [message]);
2533
2544
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
2534
2545
  "div",
2535
2546
  {
2547
+ ref,
2536
2548
  className: (0, import_classnames4.default)("form-group d-block", {
2537
2549
  "has-error": (validation == null ? void 0 : validation.status) === "invalid"
2538
2550
  }),
@@ -2657,6 +2669,8 @@ var NumberInputRenderer = {
2657
2669
  label: title,
2658
2670
  description,
2659
2671
  validation: validationState,
2672
+ inlineAlert: props.inlineAlert,
2673
+ loadingState: props.fieldLoadingState,
2660
2674
  help,
2661
2675
  children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_components37.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
2662
2676
  import_components37.Input,
@@ -2683,9 +2697,9 @@ var import_react_intl15 = require("react-intl");
2683
2697
 
2684
2698
  // ../renderers/src/hooks/useSnackBarIfAvailable.ts
2685
2699
  var import_components38 = require("@transferwise/components");
2686
- var import_react12 = require("react");
2700
+ var import_react14 = require("react");
2687
2701
  function useSnackBarIfAvailable() {
2688
- const context = (0, import_react12.useContext)(import_components38.SnackbarContext);
2702
+ const context = (0, import_react14.useContext)(import_components38.SnackbarContext);
2689
2703
  return context ? context.createSnackbar : () => {
2690
2704
  };
2691
2705
  }
@@ -2779,7 +2793,7 @@ var ProgressRenderer = {
2779
2793
  var import_components41 = require("@transferwise/components");
2780
2794
  var import_icons = require("@transferwise/icons");
2781
2795
  var import_classnames6 = __toESM(require_classnames());
2782
- var import_react13 = require("react");
2796
+ var import_react15 = require("react");
2783
2797
  var import_react_intl17 = require("react-intl");
2784
2798
 
2785
2799
  // ../renderers/src/messages/repeatable.messages.ts
@@ -2828,7 +2842,7 @@ function Repeatable(props) {
2828
2842
  onRemove
2829
2843
  } = props;
2830
2844
  const { formatMessage } = (0, import_react_intl17.useIntl)();
2831
- const [openModalType, setOpenModalType] = (0, import_react13.useState)(null);
2845
+ const [openModalType, setOpenModalType] = (0, import_react15.useState)(null);
2832
2846
  const onAddItem = () => {
2833
2847
  onAdd();
2834
2848
  setOpenModalType("add");
@@ -3047,7 +3061,7 @@ var ReviewRenderer_default = ReviewRenderer2;
3047
3061
 
3048
3062
  // ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
3049
3063
  var import_components45 = require("@transferwise/components");
3050
- var import_react14 = require("react");
3064
+ var import_react16 = require("react");
3051
3065
  var import_react_intl22 = require("react-intl");
3052
3066
 
3053
3067
  // ../renderers/src/messages/search.messages.ts
@@ -3109,7 +3123,7 @@ function BlockSearchRendererComponent({
3109
3123
  trackEvent,
3110
3124
  onChange
3111
3125
  }) {
3112
- const [hasSearched, setHasSearched] = (0, import_react14.useState)(false);
3126
+ const [hasSearched, setHasSearched] = (0, import_react16.useState)(false);
3113
3127
  const { formatMessage } = (0, import_react_intl22.useIntl)();
3114
3128
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)("div", { className: getMargin(margin), children: [
3115
3129
  /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_components45.InputGroup, { addonStart: { content: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_icons3.Search, { size: 24 }) }, children: /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(
@@ -3190,7 +3204,7 @@ var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
3190
3204
  // ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
3191
3205
  var import_components46 = require("@transferwise/components");
3192
3206
  var import_icons4 = require("@transferwise/icons");
3193
- var import_react15 = require("react");
3207
+ var import_react17 = require("react");
3194
3208
  var import_react_intl23 = require("react-intl");
3195
3209
  var import_jsx_runtime67 = require("react/jsx-runtime");
3196
3210
  function InlineSearchRenderer({
@@ -3203,7 +3217,7 @@ function InlineSearchRenderer({
3203
3217
  title,
3204
3218
  trackEvent
3205
3219
  }) {
3206
- const [hasSearched, setHasSearched] = (0, import_react15.useState)(false);
3220
+ const [hasSearched, setHasSearched] = (0, import_react17.useState)(false);
3207
3221
  const intl = (0, import_react_intl23.useIntl)();
3208
3222
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(FieldInput_default, { id, description: "", validation: void 0, help: "", label: title, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
3209
3223
  import_components46.Typeahead,
@@ -3363,7 +3377,7 @@ function RadioInputRendererComponent(props) {
3363
3377
 
3364
3378
  // ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
3365
3379
  var import_components49 = require("@transferwise/components");
3366
- var import_react16 = require("react");
3380
+ var import_react18 = require("react");
3367
3381
  var import_jsx_runtime71 = require("react/jsx-runtime");
3368
3382
  function TabInputRendererComponent(props) {
3369
3383
  const {
@@ -3378,7 +3392,7 @@ function TabInputRendererComponent(props) {
3378
3392
  validationState,
3379
3393
  onSelect
3380
3394
  } = props;
3381
- (0, import_react16.useEffect)(() => {
3395
+ (0, import_react18.useEffect)(() => {
3382
3396
  if (!isValidIndex2(selectedIndex, options.length)) {
3383
3397
  onSelect(0);
3384
3398
  }
@@ -3491,7 +3505,7 @@ function SelectInputRendererComponent(props) {
3491
3505
  }
3492
3506
 
3493
3507
  // ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
3494
- var import_react17 = require("react");
3508
+ var import_react19 = require("react");
3495
3509
  var import_components51 = require("@transferwise/components");
3496
3510
  var import_jsx_runtime73 = require("react/jsx-runtime");
3497
3511
  function SegmentedInputRendererComponent(props) {
@@ -3506,7 +3520,7 @@ function SegmentedInputRendererComponent(props) {
3506
3520
  validationState,
3507
3521
  onSelect
3508
3522
  } = props;
3509
- (0, import_react17.useEffect)(() => {
3523
+ (0, import_react19.useEffect)(() => {
3510
3524
  if (!isValidIndex3(selectedIndex, options.length)) {
3511
3525
  onSelect(0);
3512
3526
  }
@@ -3674,12 +3688,12 @@ var StatusListRenderer_default = StatusListRenderer;
3674
3688
 
3675
3689
  // ../renderers/src/utils/useCustomTheme.ts
3676
3690
  var import_components_theming = require("@wise/components-theming");
3677
- var import_react18 = require("react");
3691
+ var import_react20 = require("react");
3678
3692
  var ThemeRequiredEventName = "Theme Required";
3679
3693
  var useCustomTheme = (theme, trackEvent) => {
3680
3694
  const theming = (0, import_components_theming.useTheme)();
3681
- const previousTheme = (0, import_react18.useMemo)(() => theming.theme, []);
3682
- (0, import_react18.useEffect)(() => {
3695
+ const previousTheme = (0, import_react20.useMemo)(() => theming.theme, []);
3696
+ (0, import_react20.useEffect)(() => {
3683
3697
  theming.setTheme(theme);
3684
3698
  trackEvent(ThemeRequiredEventName, { theme });
3685
3699
  return theme !== previousTheme ? () => {
@@ -3692,7 +3706,7 @@ var useCustomTheme = (theme, trackEvent) => {
3692
3706
 
3693
3707
  // ../renderers/src/step/StepFooter.tsx
3694
3708
  var import_components54 = require("@transferwise/components");
3695
- var import_react19 = require("react");
3709
+ var import_react21 = require("react");
3696
3710
  var import_react_intl25 = require("react-intl");
3697
3711
 
3698
3712
  // ../renderers/src/messages/step.messages.ts
@@ -3720,7 +3734,7 @@ var DefaultFooter = ({ footer }) => {
3720
3734
  };
3721
3735
  var FooterWithScrollButton = ({ footer }) => {
3722
3736
  const { formatMessage } = (0, import_react_intl25.useIntl)();
3723
- const endOfLayoutRef = (0, import_react19.useRef)(null);
3737
+ const endOfLayoutRef = (0, import_react21.useRef)(null);
3724
3738
  const isElementVisible = useIsElementVisible(endOfLayoutRef);
3725
3739
  const scrollButton = /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
3726
3740
  import_components54.Button,
@@ -3749,8 +3763,8 @@ var FooterWithScrollButton = ({ footer }) => {
3749
3763
  ] });
3750
3764
  };
3751
3765
  var useIsElementVisible = (elementRef) => {
3752
- const [isVisible, setIsVisible] = (0, import_react19.useState)(false);
3753
- (0, import_react19.useEffect)(() => {
3766
+ const [isVisible, setIsVisible] = (0, import_react21.useState)(false);
3767
+ (0, import_react21.useEffect)(() => {
3754
3768
  const element = elementRef.current;
3755
3769
  if (!element) return;
3756
3770
  const observer = new IntersectionObserver(([entry]) => {
@@ -3934,7 +3948,7 @@ function StepRendererComponent(props) {
3934
3948
 
3935
3949
  // ../renderers/src/TabsRenderer.tsx
3936
3950
  var import_components59 = require("@transferwise/components");
3937
- var import_react20 = require("react");
3951
+ var import_react22 = require("react");
3938
3952
  var import_jsx_runtime85 = require("react/jsx-runtime");
3939
3953
  var TabsRenderer = {
3940
3954
  canRenderType: "tabs",
@@ -3953,7 +3967,7 @@ var TabsRenderer = {
3953
3967
  }
3954
3968
  };
3955
3969
  function TabsRendererComponent({ uid, margin, tabs }) {
3956
- const [selectedIndex, setSelectedIndex] = (0, import_react20.useState)(0);
3970
+ const [selectedIndex, setSelectedIndex] = (0, import_react22.useState)(0);
3957
3971
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: getMargin(margin), children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
3958
3972
  import_components59.Tabs,
3959
3973
  {
@@ -3974,7 +3988,7 @@ function TabsRendererComponent({ uid, margin, tabs }) {
3974
3988
  }
3975
3989
  function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
3976
3990
  var _a;
3977
- const [selectedIndex, setSelectedIndex] = (0, import_react20.useState)(0);
3991
+ const [selectedIndex, setSelectedIndex] = (0, import_react22.useState)(0);
3978
3992
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: getMargin(margin), children: [
3979
3993
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
3980
3994
  import_components59.SegmentedControl,
@@ -3996,7 +4010,7 @@ function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
3996
4010
  }
3997
4011
  function ChipsTabsRendererComponent({ margin, tabs }) {
3998
4012
  var _a;
3999
- const [selectedIndex, setSelectedIndex] = (0, import_react20.useState)(0);
4013
+ const [selectedIndex, setSelectedIndex] = (0, import_react22.useState)(0);
4000
4014
  return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: getMargin(margin), children: [
4001
4015
  /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("div", { className: "chips-container", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
4002
4016
  import_components59.Chips,
@@ -4104,6 +4118,8 @@ var TextInputRenderer = {
4104
4118
  label: title,
4105
4119
  description,
4106
4120
  validation: validationState,
4121
+ inlineAlert: props.inlineAlert,
4122
+ loadingState: props.fieldLoadingState,
4107
4123
  help,
4108
4124
  children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_components61.InputGroup, { addonStart: getInputGroupAddonStart(media), children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(VariableTextInput, __spreadValues({}, inputProps)) })
4109
4125
  }
@@ -4233,7 +4249,7 @@ var LargeUploadRenderer = {
4233
4249
 
4234
4250
  // ../renderers/src/UpsellRenderer.tsx
4235
4251
  var import_components63 = require("@transferwise/components");
4236
- var import_react21 = require("react");
4252
+ var import_react23 = require("react");
4237
4253
  var import_jsx_runtime89 = require("react/jsx-runtime");
4238
4254
  var UpsellRenderer = {
4239
4255
  canRenderType: "upsell",
@@ -4241,7 +4257,7 @@ var UpsellRenderer = {
4241
4257
  };
4242
4258
  function UpsellRendererComponent(props) {
4243
4259
  const { text, callToAction, media, margin, onDismiss } = props;
4244
- const [isVisible, setIsVisible] = (0, import_react21.useState)(true);
4260
+ const [isVisible, setIsVisible] = (0, import_react23.useState)(true);
4245
4261
  return isVisible ? /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
4246
4262
  import_components63.Nudge,
4247
4263
  {
@@ -4382,8 +4398,104 @@ var InitialLoadingStateRenderer = {
4382
4398
  )
4383
4399
  };
4384
4400
 
4401
+ // src/dynamicFlow/DynamicFlowModal.tsx
4402
+ var import_dynamic_flow_client = require("@wise/dynamic-flow-client");
4403
+ var import_components66 = require("@transferwise/components");
4404
+ var import_jsx_runtime92 = require("react/jsx-runtime");
4405
+ function DynamicFlowModal(props) {
4406
+ const _a = props, { className = "" } = _a, rest = __objRest(_a, ["className"]);
4407
+ const dfProps = useWiseToCoreProps(rest);
4408
+ const df = (0, import_dynamic_flow_client.useDynamicFlowModal)(dfProps);
4409
+ return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
4410
+ import_components66.Modal,
4411
+ __spreadProps(__spreadValues({
4412
+ className: `dynamic-flow-modal ${className}`,
4413
+ disableDimmerClickToClose: true
4414
+ }, df.modal), {
4415
+ body: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "dynamic-flow-modal", children: df.modal.body })
4416
+ })
4417
+ );
4418
+ }
4419
+
4420
+ // src/dynamicFlow/getMergedRenderers.tsx
4421
+ var import_jsx_runtime93 = require("react/jsx-runtime");
4422
+ var wiseRenderers = getWiseRenderers();
4423
+ var getMergedRenderers = (props) => {
4424
+ var _d, _e;
4425
+ const _a = props, { initialAction, initialStep } = _a, restProps = __objRest(_a, ["initialAction", "initialStep"]);
4426
+ const subflowFeatures = __spreadProps(__spreadValues({}, props.features), { nativeBack: true });
4427
+ const subflowRenderer = (0, import_dynamic_flow_client2.getDynamicSubflowRenderer)({
4428
+ Component: (_b) => {
4429
+ var _c = _b, { presentation, initialRequest } = _c, rest = __objRest(_c, ["presentation", "initialRequest"]);
4430
+ const action = {
4431
+ url: initialRequest.url,
4432
+ method: initialRequest.method,
4433
+ data: initialRequest.body
4434
+ };
4435
+ return presentation.type === "push" ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DynamicFlow, __spreadProps(__spreadValues(__spreadValues({}, restProps), rest), { features: subflowFeatures, initialAction: action })) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
4436
+ DynamicFlowModal,
4437
+ __spreadProps(__spreadValues(__spreadValues({}, restProps), rest), {
4438
+ features: subflowFeatures,
4439
+ initialAction: action
4440
+ })
4441
+ );
4442
+ }
4443
+ });
4444
+ const loadingStateRenderer = ((_d = props.features) == null ? void 0 : _d.initialLoader) ? [InitialLoadingStateRenderer] : [];
4445
+ return [...(_e = props.renderers) != null ? _e : [], subflowRenderer, ...loadingStateRenderer, ...wiseRenderers];
4446
+ };
4447
+
4448
+ // src/dynamicFlow/telemetry/getLogEvent.ts
4449
+ var getLogEvent = (onLog) => (level, message, extra) => {
4450
+ const extraWithVersion = __spreadProps(__spreadValues({}, extra), {
4451
+ dfWiseVersion: appVersion
4452
+ });
4453
+ if (level !== "info" && onLog) {
4454
+ if (onLog) {
4455
+ onLog(level, message, extraWithVersion);
4456
+ } else {
4457
+ logToRollbar(level, message, extraWithVersion);
4458
+ }
4459
+ }
4460
+ };
4461
+ var logToRollbar = (level, message, extra) => {
4462
+ try {
4463
+ const rollbar = typeof window.Rollbar !== "undefined" ? window.Rollbar : void 0;
4464
+ rollbar == null ? void 0 : rollbar[level](message, extra);
4465
+ } catch (error) {
4466
+ console.error("Failed to log to Rollbar", error);
4467
+ }
4468
+ };
4469
+
4470
+ // src/dynamicFlow/telemetry/getTrackEvent.ts
4471
+ var import_dynamic_flow_client3 = require("@wise/dynamic-flow-client");
4472
+ var prefix = "Dynamic Flow - ";
4473
+ var getTrackEvent = (onEvent, onAnalytics) => (name, properties) => {
4474
+ onEvent == null ? void 0 : onEvent(name, properties);
4475
+ if (includeInAnalytics(name)) {
4476
+ onAnalytics == null ? void 0 : onAnalytics(name, properties);
4477
+ }
4478
+ };
4479
+ var includeInAnalytics = (name) => {
4480
+ const eventName = name.startsWith(prefix) ? name.slice(prefix.length) : name;
4481
+ if (isCoreEventName(eventName)) {
4482
+ return true;
4483
+ }
4484
+ if (eventName in customEventsToAnalytics) {
4485
+ return customEventsToAnalytics[eventName];
4486
+ }
4487
+ return true;
4488
+ };
4489
+ var isCoreEventName = (eventName) => {
4490
+ return import_dynamic_flow_client3.eventNames.includes(eventName);
4491
+ };
4492
+ var customEventsToAnalytics = {
4493
+ "Theme Required": false
4494
+ // Excluded from analytics
4495
+ };
4496
+
4385
4497
  // src/dynamicFlow/useOnCopy.tsx
4386
- var import_react22 = require("react");
4498
+ var import_react24 = require("react");
4387
4499
  var import_react_intl29 = require("react-intl");
4388
4500
 
4389
4501
  // src/dynamicFlow/messages.ts
@@ -4405,7 +4517,7 @@ var messages_default = (0, import_react_intl28.defineMessages)({
4405
4517
  var useOnCopy = () => {
4406
4518
  const { formatMessage } = (0, import_react_intl29.useIntl)();
4407
4519
  const createSnackBar = useSnackBarIfAvailable();
4408
- return (0, import_react22.useCallback)(
4520
+ return (0, import_react24.useCallback)(
4409
4521
  (copiedContent) => {
4410
4522
  if (copiedContent) {
4411
4523
  createSnackBar({ text: formatMessage(messages_default.copied) });
@@ -4418,11 +4530,11 @@ var useOnCopy = () => {
4418
4530
  };
4419
4531
 
4420
4532
  // src/dynamicFlow/useWiseHttpClient.tsx
4421
- var import_react23 = require("react");
4533
+ var import_react25 = require("react");
4422
4534
  var import_react_intl30 = require("react-intl");
4423
4535
  var useWiseHttpClient = (httpClient) => {
4424
4536
  const { locale } = (0, import_react_intl30.useIntl)();
4425
- return (0, import_react23.useCallback)(
4537
+ return (0, import_react25.useCallback)(
4426
4538
  async (input, init = {}) => {
4427
4539
  const headers = new Headers(init.headers);
4428
4540
  headers.set("accept-language", locale);
@@ -4443,54 +4555,10 @@ var handleRejection = (error) => {
4443
4555
  throw error;
4444
4556
  };
4445
4557
 
4446
- // src/dynamicFlow/getMergedRenderers.tsx
4447
- var import_dynamic_flow_client3 = require("@wise/dynamic-flow-client");
4448
-
4449
- // src/dynamicFlow/DynamicFlowModal.tsx
4450
- var import_dynamic_flow_client2 = require("@wise/dynamic-flow-client");
4451
- var import_components66 = require("@transferwise/components");
4452
- var import_jsx_runtime92 = require("react/jsx-runtime");
4453
- function DynamicFlowModal(props) {
4454
- const _a = props, { className = "" } = _a, rest = __objRest(_a, ["className"]);
4455
- const dfProps = useWiseToCoreProps(rest);
4456
- const df = (0, import_dynamic_flow_client2.useDynamicFlowModal)(dfProps);
4457
- return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
4458
- import_components66.Modal,
4459
- __spreadProps(__spreadValues({
4460
- className: `dynamic-flow-modal ${className}`,
4461
- disableDimmerClickToClose: true
4462
- }, df.modal), {
4463
- body: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("div", { className: "dynamic-flow-modal", children: df.modal.body })
4464
- })
4465
- );
4466
- }
4467
-
4468
- // src/dynamicFlow/getMergedRenderers.tsx
4469
- var import_jsx_runtime93 = require("react/jsx-runtime");
4470
- var wiseRenderers = getWiseRenderers();
4471
- var getMergedRenderers = (props) => {
4472
- var _d, _e;
4473
- const _a = props, { initialAction, initialStep } = _a, restProps = __objRest(_a, ["initialAction", "initialStep"]);
4474
- const subflowFeatures = __spreadProps(__spreadValues({}, props.features), { nativeBack: true });
4475
- const subflowRenderer = (0, import_dynamic_flow_client3.getDynamicSubflowRenderer)({
4476
- Component: (_b) => {
4477
- var _c = _b, { presentation, initialRequest } = _c, rest = __objRest(_c, ["presentation", "initialRequest"]);
4478
- const action = {
4479
- url: initialRequest.url,
4480
- method: initialRequest.method,
4481
- data: initialRequest.body
4482
- };
4483
- return presentation.type === "push" ? /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(DynamicFlow, __spreadProps(__spreadValues(__spreadValues({}, restProps), rest), { features: subflowFeatures, initialAction: action })) : /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
4484
- DynamicFlowModal,
4485
- __spreadProps(__spreadValues(__spreadValues({}, restProps), rest), {
4486
- features: subflowFeatures,
4487
- initialAction: action
4488
- })
4489
- );
4490
- }
4491
- });
4492
- const loadingStateRenderer = ((_d = props.features) == null ? void 0 : _d.initialLoader) ? [InitialLoadingStateRenderer] : [];
4493
- return [...(_e = props.renderers) != null ? _e : [], subflowRenderer, ...loadingStateRenderer, ...wiseRenderers];
4558
+ // src/dynamicFlow/useCreateSnackBar.tsx
4559
+ var useCreateSnackBar = () => {
4560
+ const createSnackBar = useSnackBarIfAvailable();
4561
+ return createSnackBar;
4494
4562
  };
4495
4563
 
4496
4564
  // src/dynamicFlow/useWiseToCoreProps.tsx
@@ -4503,12 +4571,14 @@ var useWiseToCoreProps = (props) => {
4503
4571
  onAnalytics,
4504
4572
  onEvent,
4505
4573
  onLink = openLinkInNewTab,
4574
+ onNotification,
4506
4575
  onLog
4507
4576
  } = props;
4508
4577
  const httpClient = useWiseHttpClient(customFetch);
4509
- const mergedRenderers = (0, import_react24.useMemo)(() => getMergedRenderers(props), [renderers]);
4510
- const logEvent = (0, import_react24.useMemo)(() => getLogEvent(onLog), [onLog]);
4511
- const trackEvent = (0, import_react24.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
4578
+ const mergedRenderers = (0, import_react26.useMemo)(() => getMergedRenderers(props), [renderers]);
4579
+ const createSnackBar = useCreateSnackBar();
4580
+ const logEvent = (0, import_react26.useMemo)(() => getLogEvent(onLog), [onLog]);
4581
+ const trackEvent = (0, import_react26.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
4512
4582
  const onCopy = useOnCopy();
4513
4583
  return __spreadProps(__spreadValues({}, props), {
4514
4584
  httpClient,
@@ -4517,6 +4587,7 @@ var useWiseToCoreProps = (props) => {
4517
4587
  onEvent: trackEvent,
4518
4588
  onLog: logEvent,
4519
4589
  onCopy,
4590
+ onNotification: onNotification != null ? onNotification : createSnackBar,
4520
4591
  onLink
4521
4592
  });
4522
4593
  };
@@ -4552,14 +4623,14 @@ function DynamicFlow(props) {
4552
4623
  }
4553
4624
 
4554
4625
  // src/dynamicFlow/DynamicFlowWithRef.tsx
4555
- var import_react25 = require("react");
4626
+ var import_react27 = require("react");
4556
4627
  var import_dynamic_flow_client5 = require("@wise/dynamic-flow-client");
4557
4628
  var import_jsx_runtime95 = require("react/jsx-runtime");
4558
- var DynamicFlowWithRef = (0, import_react25.forwardRef)(function DynamicFlowWithRef2(props, ref) {
4629
+ var DynamicFlowWithRef = (0, import_react27.forwardRef)(function DynamicFlowWithRef2(props, ref) {
4559
4630
  const { className = "" } = props;
4560
4631
  const dfProps = useWiseToCoreProps(props);
4561
4632
  const df = (0, import_dynamic_flow_client5.useDynamicFlow)(dfProps);
4562
- (0, import_react25.useImperativeHandle)(
4633
+ (0, import_react27.useImperativeHandle)(
4563
4634
  ref,
4564
4635
  () => ({
4565
4636
  getValue: async () => {