@wise/dynamic-flow-client-internal 5.22.1 → 5.23.0

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
@@ -127,7 +127,7 @@ import { useDynamicFlow } from "@wise/dynamic-flow-client";
127
127
  // src/dynamicFlow/telemetry/app-version.ts
128
128
  var appVersion = (
129
129
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
130
- typeof process !== "undefined" ? "5.22.1" : "0.0.0"
130
+ typeof process !== "undefined" ? "5.23.0" : "0.0.0"
131
131
  );
132
132
 
133
133
  // src/dynamicFlow/context-menu/useContextMenu.tsx
@@ -1103,10 +1103,47 @@ var CheckboxInputRenderer_default = CheckboxInputRenderer;
1103
1103
 
1104
1104
  // ../renderers/src/ColumnsRenderer.tsx
1105
1105
  var import_classnames3 = __toESM(require_classnames());
1106
+
1107
+ // ../renderers/src/utils/useIsCollapsed.ts
1108
+ import { useEffect as useEffect5, useState as useState4 } from "react";
1109
+ var COLLAPSE_QUERY = "(max-width: 767.98px)";
1110
+ var supportsMatchMedia = () => typeof window !== "undefined" && !!window.matchMedia;
1111
+ var useIsCollapsed = () => {
1112
+ const [collapsed, setCollapsed] = useState4(
1113
+ () => supportsMatchMedia() && window.matchMedia(COLLAPSE_QUERY).matches
1114
+ );
1115
+ useEffect5(() => {
1116
+ if (supportsMatchMedia()) {
1117
+ const mql = window.matchMedia(COLLAPSE_QUERY);
1118
+ const update = () => setCollapsed(mql.matches);
1119
+ mql.addEventListener("change", update);
1120
+ return () => mql.removeEventListener("change", update);
1121
+ }
1122
+ return void 0;
1123
+ }, []);
1124
+ return collapsed;
1125
+ };
1126
+
1127
+ // ../renderers/src/ColumnsRenderer.tsx
1106
1128
  import { jsx as jsx24, jsxs as jsxs4 } from "react/jsx-runtime";
1129
+ var RIGHT_FIRST_STACKING = "right-first-stacking";
1107
1130
  var ColumnsRenderer = {
1108
1131
  canRenderType: "columns",
1109
- render: ({ bias, margin, startChildren, endChildren }) => /* @__PURE__ */ jsxs4(
1132
+ render: ColumnsRendererComponent
1133
+ };
1134
+ function ColumnsRendererComponent({
1135
+ bias,
1136
+ margin,
1137
+ startChildren,
1138
+ endChildren,
1139
+ tags
1140
+ }) {
1141
+ var _a;
1142
+ const isCollapsed = useIsCollapsed();
1143
+ const reverse = isCollapsed && ((_a = tags == null ? void 0 : tags.includes(RIGHT_FIRST_STACKING)) != null ? _a : false);
1144
+ const startColumn = /* @__PURE__ */ jsx24("div", { className: "df-columns-renderer-column", children: startChildren });
1145
+ const endColumn = /* @__PURE__ */ jsx24("div", { className: "df-columns-renderer-column", children: endChildren });
1146
+ return /* @__PURE__ */ jsxs4(
1110
1147
  "div",
1111
1148
  {
1112
1149
  className: (0, import_classnames3.default)("df-columns-renderer-container", getMargin(margin), {
@@ -1114,12 +1151,12 @@ var ColumnsRenderer = {
1114
1151
  "df-columns-renderer-bias-end": bias === "end"
1115
1152
  }),
1116
1153
  children: [
1117
- /* @__PURE__ */ jsx24("div", { className: "df-columns-renderer-column", children: startChildren }),
1118
- /* @__PURE__ */ jsx24("div", { className: "df-columns-renderer-column", children: endChildren })
1154
+ reverse ? endColumn : startColumn,
1155
+ reverse ? startColumn : endColumn
1119
1156
  ]
1120
1157
  }
1121
- )
1122
- };
1158
+ );
1159
+ }
1123
1160
  var ColumnsRenderer_default = ColumnsRenderer;
1124
1161
 
1125
1162
  // ../renderers/src/components/VariableDateInput.tsx
@@ -1275,7 +1312,7 @@ var shouldUseAvatar = (control, tags) => {
1275
1312
 
1276
1313
  // ../renderers/src/DecisionRenderer/DecisionWrapper.tsx
1277
1314
  import { Header as Header2, SearchInput } from "@transferwise/components";
1278
- import { useState as useState4 } from "react";
1315
+ import { useState as useState5 } from "react";
1279
1316
  import { useIntl as useIntl4 } from "react-intl";
1280
1317
 
1281
1318
  // ../renderers/src/messages/filter.messages.ts
@@ -1421,7 +1458,7 @@ var UnfilteredDecisionList = (_a) => {
1421
1458
  };
1422
1459
  var FilteredDecisionList = (props) => {
1423
1460
  const { formatMessage } = useIntl4();
1424
- const [query, setQuery] = useState4("");
1461
+ const [query, setQuery] = useState5("");
1425
1462
  const { control, options, renderDecisionList: renderDecisionList2 } = props;
1426
1463
  const filteredOptions = (query == null ? void 0 : query.length) > 0 ? filterAndSortDecisionOptions(options, query) : options;
1427
1464
  const isGrouped = isGroupedDecision(options);
@@ -1538,7 +1575,7 @@ var external_confirmation_messages_default = defineMessages5({
1538
1575
 
1539
1576
  // ../renderers/src/ExternalConfirmationRenderer.tsx
1540
1577
  import { useIntl as useIntl5 } from "react-intl";
1541
- import { useEffect as useEffect5 } from "react";
1578
+ import { useEffect as useEffect6 } from "react";
1542
1579
  import { Fragment as Fragment4, jsx as jsx32, jsxs as jsxs7 } from "react/jsx-runtime";
1543
1580
  var ExternalConfirmationRenderer = {
1544
1581
  canRenderType: "external-confirmation",
@@ -1551,7 +1588,7 @@ function ExternalConfirmationRendererComponent({
1551
1588
  onCancel
1552
1589
  }) {
1553
1590
  const { formatMessage } = useIntl5();
1554
- useEffect5(() => {
1591
+ useEffect6(() => {
1555
1592
  open();
1556
1593
  }, []);
1557
1594
  return /* @__PURE__ */ jsx32(
@@ -1665,7 +1702,7 @@ var HeadingRenderer_default = HeadingRenderer;
1665
1702
 
1666
1703
  // ../renderers/src/ImageRenderer/UrlImage.tsx
1667
1704
  import { Image } from "@transferwise/components";
1668
- import { useEffect as useEffect6, useState as useState5 } from "react";
1705
+ import { useEffect as useEffect7, useState as useState6 } from "react";
1669
1706
 
1670
1707
  // ../renderers/src/utils/api-utils.ts
1671
1708
  function isRelativePath(url = "") {
@@ -1684,8 +1721,8 @@ function UrlImage({
1684
1721
  uri,
1685
1722
  httpClient
1686
1723
  }) {
1687
- const [imageSource, setImageSource] = useState5("");
1688
- useEffect6(() => {
1724
+ const [imageSource, setImageSource] = useState6("");
1725
+ useEffect7(() => {
1689
1726
  if (!uri.startsWith("urn:")) {
1690
1727
  void getImageSource(httpClient, uri).then(setImageSource);
1691
1728
  }
@@ -1751,7 +1788,7 @@ import {
1751
1788
  Illustration,
1752
1789
  isIllustrationSupport3D
1753
1790
  } from "@wise/art";
1754
- import { useState as useState6 } from "react";
1791
+ import { useState as useState7 } from "react";
1755
1792
 
1756
1793
  // ../renderers/src/ImageRenderer/isAnimated.ts
1757
1794
  var isAnimated = (uri) => {
@@ -1801,7 +1838,7 @@ function UrnIllustration({
1801
1838
  size,
1802
1839
  uri
1803
1840
  }) {
1804
- const [has3DFailed, setHas3DFailed] = useState6(false);
1841
+ const [has3DFailed, setHas3DFailed] = useState7(false);
1805
1842
  const illustrationSize = getIllustrationSize(size);
1806
1843
  const illustrationName = getIllustrationName(uri);
1807
1844
  const illustration3DName = getIllustration3DName(uri);
@@ -2120,7 +2157,7 @@ var mapAvatarMediaSize = (size) => {
2120
2157
 
2121
2158
  // ../renderers/src/ModalLayoutRenderer.tsx
2122
2159
  import { Button as Button4, Modal as Modal2 } from "@transferwise/components";
2123
- import { useState as useState7 } from "react";
2160
+ import { useState as useState8 } from "react";
2124
2161
  import { jsx as jsx50, jsxs as jsxs11 } from "react/jsx-runtime";
2125
2162
  var ModalLayoutRenderer = {
2126
2163
  canRenderType: "modal-layout",
@@ -2128,7 +2165,7 @@ var ModalLayoutRenderer = {
2128
2165
  };
2129
2166
  var ModalLayoutRenderer_default = ModalLayoutRenderer;
2130
2167
  function DFModal({ content, margin, trigger }) {
2131
- const [visible, setVisible] = useState7(false);
2168
+ const [visible, setVisible] = useState8(false);
2132
2169
  const { children, title } = content;
2133
2170
  return /* @__PURE__ */ jsxs11("div", { className: getMargin(margin), children: [
2134
2171
  /* @__PURE__ */ jsx50(Button4, { v2: true, priority: "tertiary", block: true, onClick: () => setVisible(true), children: trigger.title }),
@@ -2158,7 +2195,7 @@ var ModalRenderer = {
2158
2195
 
2159
2196
  // ../renderers/src/MoneyInputRenderer.tsx
2160
2197
  import { MoneyInput } from "@transferwise/components";
2161
- import { useEffect as useEffect7 } from "react";
2198
+ import { useEffect as useEffect8 } from "react";
2162
2199
  import { useIntl as useIntl6 } from "react-intl";
2163
2200
  import { jsx as jsx52 } from "react/jsx-runtime";
2164
2201
  var groupingTags2 = Object.keys(group_messages_default).filter((key) => key !== "all");
@@ -2181,7 +2218,7 @@ function MoneyInputRendererComponent(props) {
2181
2218
  onAmountChange,
2182
2219
  onCurrencyChange
2183
2220
  } = props;
2184
- useEffect7(() => {
2221
+ useEffect8(() => {
2185
2222
  if (!isValidIndex(selectedCurrencyIndex, currencies.length)) {
2186
2223
  onCurrencyChange(0);
2187
2224
  }
@@ -2326,7 +2363,7 @@ function InlineComponent(props) {
2326
2363
 
2327
2364
  // ../renderers/src/MultiSelectInputRenderer/DefaultComponent.tsx
2328
2365
  import { SelectInput, SelectInputOptionContent } from "@transferwise/components";
2329
- import { useState as useState8 } from "react";
2366
+ import { useState as useState9 } from "react";
2330
2367
  import { useIntl as useIntl7 } from "react-intl";
2331
2368
 
2332
2369
  // ../renderers/src/messages/multi-select.messages.ts
@@ -2343,7 +2380,7 @@ var multi_select_messages_default = defineMessages6({
2343
2380
  import { jsx as jsx54 } from "react/jsx-runtime";
2344
2381
  function DefaultComponent(props) {
2345
2382
  const { formatMessage } = useIntl7();
2346
- const [stagedIndices, setStagedIndices] = useState8();
2383
+ const [stagedIndices, setStagedIndices] = useState9();
2347
2384
  const {
2348
2385
  id,
2349
2386
  autoComplete,
@@ -2775,7 +2812,7 @@ var ProgressRenderer = {
2775
2812
  var import_classnames7 = __toESM(require_classnames());
2776
2813
  import { Button as Button6, Header as Header6, InlineAlert as InlineAlert3, Modal as Modal4, NavigationOption } from "@transferwise/components";
2777
2814
  import { Plus } from "@transferwise/icons";
2778
- import { useState as useState9 } from "react";
2815
+ import { useState as useState10 } from "react";
2779
2816
  import { useIntl as useIntl9 } from "react-intl";
2780
2817
 
2781
2818
  // ../renderers/src/messages/repeatable.messages.ts
@@ -2825,7 +2862,7 @@ function Repeatable(props) {
2825
2862
  onRemove
2826
2863
  } = props;
2827
2864
  const { formatMessage } = useIntl9();
2828
- const [openModalType, setOpenModalType] = useState9(null);
2865
+ const [openModalType, setOpenModalType] = useState10(null);
2829
2866
  const { ref } = useScrollToError(validationState, features);
2830
2867
  const onAddItem = () => {
2831
2868
  onAdd();
@@ -3047,7 +3084,7 @@ var ReviewRenderer_default = ReviewRenderer2;
3047
3084
 
3048
3085
  // ../renderers/src/SearchRenderer/BlockSearchRendererComponent.tsx
3049
3086
  import { Input as Input4, InputGroup as InputGroup3, List, ListItem as ListItem10, Markdown as Markdown5 } from "@transferwise/components";
3050
- import { useState as useState10 } from "react";
3087
+ import { useState as useState11 } from "react";
3051
3088
  import { useIntl as useIntl12 } from "react-intl";
3052
3089
 
3053
3090
  // ../renderers/src/messages/search.messages.ts
@@ -3110,7 +3147,7 @@ function BlockSearchRendererComponent({
3110
3147
  trackEvent,
3111
3148
  onChange
3112
3149
  }) {
3113
- const [hasSearched, setHasSearched] = useState10(false);
3150
+ const [hasSearched, setHasSearched] = useState11(false);
3114
3151
  const { formatMessage } = useIntl12();
3115
3152
  return /* @__PURE__ */ jsxs18("div", { className: getMargin(margin), children: [
3116
3153
  /* @__PURE__ */ jsx66(
@@ -3202,7 +3239,7 @@ var BlockSearchRendererComponent_default = BlockSearchRendererComponent;
3202
3239
  // ../renderers/src/SearchRenderer/InlineSearchRendererComponent.tsx
3203
3240
  import { Markdown as Markdown6, Typeahead } from "@transferwise/components";
3204
3241
  import { Search as Search2 } from "@transferwise/icons";
3205
- import { useState as useState11 } from "react";
3242
+ import { useState as useState12 } from "react";
3206
3243
  import { useIntl as useIntl13 } from "react-intl";
3207
3244
  import { jsx as jsx67 } from "react/jsx-runtime";
3208
3245
  function InlineSearchRenderer({
@@ -3216,7 +3253,7 @@ function InlineSearchRenderer({
3216
3253
  onChange,
3217
3254
  trackEvent
3218
3255
  }) {
3219
- const [hasSearched, setHasSearched] = useState11(false);
3256
+ const [hasSearched, setHasSearched] = useState12(false);
3220
3257
  const intl = useIntl13();
3221
3258
  return /* @__PURE__ */ jsx67("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx67(
3222
3259
  FieldInput_default,
@@ -3389,7 +3426,7 @@ function RadioInputRendererComponent(props) {
3389
3426
 
3390
3427
  // ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
3391
3428
  import { Tabs } from "@transferwise/components";
3392
- import { useEffect as useEffect8 } from "react";
3429
+ import { useEffect as useEffect9 } from "react";
3393
3430
  import { Fragment as Fragment9, jsx as jsx71, jsxs as jsxs21 } from "react/jsx-runtime";
3394
3431
  function TabInputRendererComponent(props) {
3395
3432
  const {
@@ -3405,7 +3442,7 @@ function TabInputRendererComponent(props) {
3405
3442
  validationState,
3406
3443
  onSelect
3407
3444
  } = props;
3408
- useEffect8(() => {
3445
+ useEffect9(() => {
3409
3446
  if (!isValidIndex2(selectedIndex, options.length)) {
3410
3447
  onSelect(0);
3411
3448
  }
@@ -3521,7 +3558,7 @@ function SelectInputRendererComponent(props) {
3521
3558
  }
3522
3559
 
3523
3560
  // ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
3524
- import { useEffect as useEffect9 } from "react";
3561
+ import { useEffect as useEffect10 } from "react";
3525
3562
  import { SegmentedControl } from "@transferwise/components";
3526
3563
  import { Fragment as Fragment11, jsx as jsx73, jsxs as jsxs23 } from "react/jsx-runtime";
3527
3564
  function SegmentedInputRendererComponent(props) {
@@ -3537,7 +3574,7 @@ function SegmentedInputRendererComponent(props) {
3537
3574
  validationState,
3538
3575
  onSelect
3539
3576
  } = props;
3540
- useEffect9(() => {
3577
+ useEffect10(() => {
3541
3578
  if (!isValidIndex3(selectedIndex, options.length)) {
3542
3579
  onSelect(0);
3543
3580
  }
@@ -3705,12 +3742,12 @@ var StatusListRenderer_default = StatusListRenderer;
3705
3742
 
3706
3743
  // ../renderers/src/utils/useCustomTheme.ts
3707
3744
  import { useTheme } from "@wise/components-theming";
3708
- import { useEffect as useEffect10, useMemo } from "react";
3745
+ import { useEffect as useEffect11, useMemo } from "react";
3709
3746
  var ThemeRequiredEventName = "Theme Required";
3710
3747
  var useCustomTheme = (theme, trackEvent) => {
3711
3748
  const theming = useTheme();
3712
3749
  const previousTheme = useMemo(() => theming.theme, []);
3713
- useEffect10(() => {
3750
+ useEffect11(() => {
3714
3751
  theming.setTheme(theme);
3715
3752
  trackEvent(ThemeRequiredEventName, { theme });
3716
3753
  return theme !== previousTheme ? () => {
@@ -3723,7 +3760,7 @@ var useCustomTheme = (theme, trackEvent) => {
3723
3760
 
3724
3761
  // ../renderers/src/step/StepFooter.tsx
3725
3762
  import { Button as Button7 } from "@transferwise/components";
3726
- import { useEffect as useEffect11, useRef as useRef2, useState as useState12 } from "react";
3763
+ import { useEffect as useEffect12, useRef as useRef2, useState as useState13 } from "react";
3727
3764
  import { useIntl as useIntl14 } from "react-intl";
3728
3765
 
3729
3766
  // ../renderers/src/messages/step.messages.ts
@@ -3780,8 +3817,8 @@ var FooterWithScrollButton = ({ footer }) => {
3780
3817
  ] });
3781
3818
  };
3782
3819
  var useIsElementVisible = (elementRef) => {
3783
- const [isVisible, setIsVisible] = useState12(false);
3784
- useEffect11(() => {
3820
+ const [isVisible, setIsVisible] = useState13(false);
3821
+ useEffect12(() => {
3785
3822
  const element = elementRef.current;
3786
3823
  if (!element) return;
3787
3824
  const observer = new IntersectionObserver(([entry]) => {
@@ -3965,7 +4002,7 @@ function StepRendererComponent(props) {
3965
4002
 
3966
4003
  // ../renderers/src/TabsRenderer.tsx
3967
4004
  import { Chips, SegmentedControl as SegmentedControl2, Tabs as Tabs2 } from "@transferwise/components";
3968
- import { useState as useState13 } from "react";
4005
+ import { useState as useState14 } from "react";
3969
4006
  import { jsx as jsx85, jsxs as jsxs34 } from "react/jsx-runtime";
3970
4007
  var TabsRenderer = {
3971
4008
  canRenderType: "tabs",
@@ -3984,7 +4021,7 @@ var TabsRenderer = {
3984
4021
  }
3985
4022
  };
3986
4023
  function TabsRendererComponent({ uid, margin, tabs }) {
3987
- const [selectedIndex, setSelectedIndex] = useState13(0);
4024
+ const [selectedIndex, setSelectedIndex] = useState14(0);
3988
4025
  return /* @__PURE__ */ jsx85("div", { className: getMargin(margin), children: /* @__PURE__ */ jsx85(
3989
4026
  Tabs2,
3990
4027
  {
@@ -4005,7 +4042,7 @@ function TabsRendererComponent({ uid, margin, tabs }) {
4005
4042
  }
4006
4043
  function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
4007
4044
  var _a;
4008
- const [selectedIndex, setSelectedIndex] = useState13(0);
4045
+ const [selectedIndex, setSelectedIndex] = useState14(0);
4009
4046
  return /* @__PURE__ */ jsxs34("div", { className: getMargin(margin), children: [
4010
4047
  /* @__PURE__ */ jsx85(
4011
4048
  SegmentedControl2,
@@ -4027,7 +4064,7 @@ function SegmentedTabsRendererComponent({ uid, margin, tabs }) {
4027
4064
  }
4028
4065
  function ChipsTabsRendererComponent({ margin, tabs }) {
4029
4066
  var _a;
4030
- const [selectedIndex, setSelectedIndex] = useState13(0);
4067
+ const [selectedIndex, setSelectedIndex] = useState14(0);
4031
4068
  return /* @__PURE__ */ jsxs34("div", { className: getMargin(margin), children: [
4032
4069
  /* @__PURE__ */ jsx85("div", { className: "chips-container", children: /* @__PURE__ */ jsx85(
4033
4070
  Chips,
@@ -4288,7 +4325,7 @@ var LargeUploadRenderer = {
4288
4325
 
4289
4326
  // ../renderers/src/UpsellRenderer.tsx
4290
4327
  import { Nudge } from "@transferwise/components";
4291
- import { useState as useState14 } from "react";
4328
+ import { useState as useState15 } from "react";
4292
4329
  import { jsx as jsx89 } from "react/jsx-runtime";
4293
4330
  var UpsellRenderer = {
4294
4331
  canRenderType: "upsell",
@@ -4296,7 +4333,7 @@ var UpsellRenderer = {
4296
4333
  };
4297
4334
  function UpsellRendererComponent(props) {
4298
4335
  const { text, callToAction, media, margin, onDismiss } = props;
4299
- const [isVisible, setIsVisible] = useState14(true);
4336
+ const [isVisible, setIsVisible] = useState15(true);
4300
4337
  return isVisible ? /* @__PURE__ */ jsx89(
4301
4338
  Nudge,
4302
4339
  {