@wise/dynamic-flow-client 1.7.0 → 1.8.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.js CHANGED
@@ -850,8 +850,8 @@ function isReference(block) {
850
850
  }
851
851
 
852
852
  // src/dynamicFlow/DynamicFlow.tsx
853
- var import_react38 = require("react");
854
- var import_react_intl28 = require("react-intl");
853
+ var import_react40 = require("react");
854
+ var import_react_intl29 = require("react-intl");
855
855
 
856
856
  // src/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
857
857
  var import_react2 = require("react");
@@ -935,8 +935,8 @@ function isRelativePath(url = "") {
935
935
  // src/common/makeHttpClient/makeHttpClient.ts
936
936
  var makeHttpClient = (baseUrl, additionalHeaders) => (input, init) => {
937
937
  const resource = applyBaseUrl(input, baseUrl || "");
938
- const headers = mergeHeaders(init == null ? void 0 : init.headers, additionalHeaders);
939
- return fetch(resource, __spreadProps(__spreadValues({}, init || {}), { headers }));
938
+ const headers2 = mergeHeaders(init == null ? void 0 : init.headers, additionalHeaders);
939
+ return fetch(resource, __spreadProps(__spreadValues({}, init || {}), { headers: headers2 }));
940
940
  };
941
941
  var applyBaseUrl = (input, baseUrl) => {
942
942
  return typeof input === "string" && isRelativePath(input) ? baseUrl + input : input;
@@ -945,11 +945,11 @@ var mergeHeaders = (initHeaders, additionalHeaders) => {
945
945
  if (!initHeaders && !additionalHeaders) {
946
946
  return {};
947
947
  }
948
- const headers = new Headers(initHeaders);
948
+ const headers2 = new Headers(initHeaders);
949
949
  for (const [key, value] of Object.entries(additionalHeaders || {})) {
950
- headers.set(key, value);
950
+ headers2.set(key, value);
951
951
  }
952
- return headers;
952
+ return headers2;
953
953
  };
954
954
 
955
955
  // src/common/contexts/httpClientContext/HttpClientContext.tsx
@@ -1774,8 +1774,8 @@ function useExternalStepPolling(polling, onAction) {
1774
1774
  }
1775
1775
 
1776
1776
  // src/common/hooks/usePersistAsync/usePersistAsync.ts
1777
- var import_react26 = require("react");
1778
- var import_react_intl16 = require("react-intl");
1777
+ var import_react28 = require("react");
1778
+ var import_react_intl18 = require("react-intl");
1779
1779
 
1780
1780
  // src/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.js
1781
1781
  var import_react_intl = require("react-intl");
@@ -1788,8 +1788,8 @@ var PersistAsyncSchema_messages_default = (0, import_react_intl.defineMessages)(
1788
1788
  });
1789
1789
 
1790
1790
  // src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
1791
- var import_react25 = require("react");
1792
- var import_react_intl15 = require("react-intl");
1791
+ var import_react27 = require("react");
1792
+ var import_react_intl17 = require("react-intl");
1793
1793
 
1794
1794
  // src/common/constants/DateMode.ts
1795
1795
  var DateMode = {
@@ -1833,300 +1833,537 @@ var Size = {
1833
1833
 
1834
1834
  // src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
1835
1835
  var import_classnames6 = __toESM(require_classnames());
1836
- var import_react24 = require("react");
1836
+ var import_react26 = require("react");
1837
1837
 
1838
1838
  // src/layout/alert/DynamicAlert.tsx
1839
- var import_components = require("@transferwise/components");
1839
+ var import_components2 = require("@transferwise/components");
1840
1840
 
1841
- // src/layout/utils.ts
1842
- var getMarginBottom = (size) => {
1843
- switch (size) {
1844
- case "xs":
1845
- return "m-b-0";
1846
- case "sm":
1847
- return "m-b-1";
1848
- case "md":
1849
- return "m-b-2";
1850
- case "lg":
1851
- return "m-b-3";
1852
- case "xl":
1853
- return "m-b-5";
1854
- default:
1855
- return "";
1856
- }
1857
- };
1858
- var getTextAlignment = (align) => {
1859
- switch (align) {
1860
- case "right":
1861
- return "text-xs-right";
1862
- case "center":
1863
- return "text-xs-center";
1864
- case "left":
1865
- default:
1866
- return "";
1867
- }
1868
- };
1869
- var getTextAlignmentAndMargin = (component) => `${getTextAlignment(component.align)} ${getMarginBottom(component.margin)}`;
1841
+ // src/layout/utils/getNavigationOptionMedia.tsx
1842
+ var import_components = require("@transferwise/components");
1870
1843
 
1871
- // src/layout/alert/DynamicAlert.tsx
1844
+ // src/layout/icon/FlagIcon.tsx
1872
1845
  var import_jsx_runtime5 = require("react/jsx-runtime");
1873
- var DynamicAlert = (props) => {
1874
- const alert = props.component;
1875
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1876
- import_components.Alert,
1877
- {
1878
- type: mapContextToAlertType(legacy_mapContext(alert.context)),
1879
- className: getMarginBottom(alert.margin),
1880
- message: alert.markdown
1881
- }
1882
- );
1883
- };
1884
- var legacy_mapContext = (context) => {
1885
- switch (context) {
1886
- case "success":
1887
- return "positive";
1888
- case "failure":
1889
- return "negative";
1890
- case "warning":
1891
- return "warning";
1892
- case "info":
1893
- case "primary":
1894
- return "neutral";
1895
- default:
1896
- return context;
1897
- }
1898
- };
1899
- var mapContextToAlertType = (context) => {
1900
- if (!context || !["neutral", "warning", "negative", "positive"].includes(context)) {
1901
- return "neutral";
1902
- }
1903
- return context;
1904
- };
1905
- var DynamicAlert_default = DynamicAlert;
1906
-
1907
- // src/layout/box/DynamicBox.tsx
1908
- var import_jsx_runtime6 = require("react/jsx-runtime");
1909
- var DynamicBox = (props) => {
1910
- const box = props.component;
1911
- const margin = getMarginBottom(box.margin || box.border ? "lg" : "xs");
1912
- if (!box.width || box.width === "xl") {
1913
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: margin + getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1914
- DynamicLayout_default,
1915
- {
1916
- components: box.components,
1917
- model: props.model,
1918
- submitted: props.submitted,
1919
- errors: props.errors,
1920
- onModelChange: props.onModelChange,
1921
- onAction: props.onAction,
1922
- onPersistAsync: props.onPersistAsync
1923
- }
1924
- ) });
1925
- }
1926
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: margin + getBoxWidthClasses(box), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1927
- DynamicLayout_default,
1928
- {
1929
- components: box.components,
1930
- model: props.model,
1931
- submitted: props.submitted,
1932
- errors: props.errors,
1933
- onModelChange: props.onModelChange,
1934
- onAction: props.onAction,
1935
- onPersistAsync: props.onPersistAsync
1936
- }
1937
- ) }) }) });
1938
- };
1939
- var getBorderClass = (border) => {
1940
- return border ? " well p-b-0" : "";
1941
- };
1942
- var getBoxWidthClasses = (component) => {
1943
- switch (component.width) {
1944
- case "xs":
1945
- return " col-md-4 col-md-offset-4";
1946
- case "sm":
1947
- return " col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4";
1948
- case "md":
1949
- return " col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3";
1950
- case "lg":
1951
- return " col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2";
1952
- case "xl":
1953
- default:
1954
- return " col-xs-12";
1955
- }
1956
- };
1957
- var DynamicBox_default = DynamicBox;
1958
-
1959
- // src/layout/button/DynamicButton.tsx
1960
- var import_components2 = require("@transferwise/components");
1961
-
1962
- // src/layout/button/utils.ts
1963
- var priorities = {
1964
- primary: "primary",
1965
- secondary: "secondary",
1966
- link: "tertiary",
1967
- positive: "primary",
1968
- negative: "primary"
1969
- };
1970
- var getButtonPriority = (component) => {
1971
- var _a;
1972
- const actionType = component.action.type;
1973
- return (_a = component.control) != null ? _a : actionType ? priorities[actionType] : "secondary";
1974
- };
1975
- var types = {
1976
- primary: "neutral",
1977
- secondary: "neutral",
1978
- link: "neutral",
1979
- positive: "positive",
1980
- negative: "negative"
1981
- };
1982
- var getButtonType = (component) => {
1983
- var _a;
1984
- const actionType = component.action.type;
1985
- const type = (_a = component.context) != null ? _a : actionType ? types[actionType] : "neutral";
1986
- return type === "neutral" ? "accent" : type;
1987
- };
1988
- var getButtonSize = (size) => {
1989
- switch (size) {
1990
- case "xs":
1991
- case "sm":
1992
- return "sm";
1993
- case "lg":
1994
- case "xl":
1995
- return "lg";
1996
- case "md":
1997
- default:
1998
- return "md";
1846
+ var isFlagIcon = (name) => isCurrencyFlagIcon(name) || isCountryFlagIcon(name);
1847
+ var isCurrencyFlagIcon = (name) => currencyCodes.some((currencyCode) => name === `flag-${currencyCode}`);
1848
+ var isCountryFlagIcon = (name) => countryCodes.some((countryCode) => name === `flag-${countryCode}`);
1849
+ var FlagIcon = ({ name }) => {
1850
+ if (!isFlagIcon(name)) {
1851
+ return null;
1999
1852
  }
2000
- };
2001
-
2002
- // src/layout/button/DynamicButton.tsx
2003
- var import_jsx_runtime7 = require("react/jsx-runtime");
2004
- var DynamicButton = (props) => {
2005
- var _a;
2006
- const { component, onAction } = props;
2007
- const componentAction = component.action;
2008
- const type = getButtonType(component);
2009
- const priority = getButtonPriority(component);
2010
- const { loading } = useDynamicFlow();
2011
- const className = getMarginBottom(component.margin || "md");
2012
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
2013
- import_components2.Button,
1853
+ const code = name.substring(5);
1854
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1855
+ "img",
2014
1856
  {
2015
- size: getButtonSize(component.size),
2016
- type,
2017
- priority,
2018
- block: true,
2019
- className,
2020
- disabled: component.disabled || componentAction.disabled || loading,
2021
- onClick: () => onAction(componentAction),
2022
- children: (_a = component.title) != null ? _a : componentAction.title
1857
+ src: `https://wise.com/web-art/assets/flags/${code}.svg`,
1858
+ alt: "",
1859
+ "data-testid": `img-flag-${code}`
2023
1860
  }
2024
1861
  );
2025
1862
  };
2026
- var DynamicButton_default = DynamicButton;
2027
-
2028
- // src/layout/columns/DynamicColumns.tsx
2029
- var import_jsx_runtime8 = require("react/jsx-runtime");
2030
- var DynamicColumns = (props) => {
2031
- const columns = props.component;
2032
- const { leftWidth, rightWidth } = getWidth(columns.bias);
2033
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `${getMarginBottom(columns.margin || "xs")} row`, children: [
2034
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${leftWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2035
- DynamicLayout_default,
2036
- {
2037
- components: columns.left,
2038
- model: props.model,
2039
- submitted: props.submitted,
2040
- errors: props.errors,
2041
- onModelChange: props.onModelChange,
2042
- onAction: props.onAction,
2043
- onPersistAsync: props.onPersistAsync
2044
- }
2045
- ) }),
2046
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `${rightWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
2047
- DynamicLayout_default,
2048
- {
2049
- components: columns.right,
2050
- model: props.model,
2051
- submitted: props.submitted,
2052
- errors: props.errors,
2053
- onModelChange: props.onModelChange,
2054
- onAction: props.onAction,
2055
- onPersistAsync: props.onPersistAsync
2056
- }
2057
- ) })
2058
- ] });
2059
- };
2060
- var getWidth = (bias) => {
2061
- if (bias === "left") {
2062
- return {
2063
- leftWidth: "col-md-8",
2064
- rightWidth: "col-md-4"
2065
- };
2066
- }
2067
- if (bias === "right") {
2068
- return {
2069
- leftWidth: "col-md-4",
2070
- rightWidth: "col-md-8"
2071
- };
2072
- }
2073
- return {
2074
- leftWidth: "col-md-6",
2075
- rightWidth: "col-md-6"
2076
- };
2077
- };
2078
- var DynamicColumns_default = DynamicColumns;
2079
-
2080
- // src/layout/decision/DynamicDecision.tsx
2081
- var import_components3 = require("@transferwise/components");
2082
- var import_jsx_runtime9 = require("react/jsx-runtime");
2083
- var getMedia = (option) => {
2084
- var _a, _b, _c;
2085
- if ((_a = option.icon) == null ? void 0 : _a.name) {
2086
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components3.Avatar, { type: import_components3.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(DynamicIcon_default, { type: option.icon.name }) });
2087
- }
2088
- if ((_b = option.icon) == null ? void 0 : _b.text) {
2089
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components3.Avatar, { type: import_components3.AvatarType.INITIALS, children: option.icon.text });
1863
+ var currencyCodes = [
1864
+ "aed",
1865
+ "ars",
1866
+ "aud",
1867
+ "bdt",
1868
+ "bgn",
1869
+ "bhd",
1870
+ "bnd",
1871
+ "brl",
1872
+ "bwp",
1873
+ "cad",
1874
+ "chf",
1875
+ "clp",
1876
+ "cny",
1877
+ "cop",
1878
+ "crc",
1879
+ "czk",
1880
+ "dkk",
1881
+ "egp",
1882
+ "eur",
1883
+ "fjd",
1884
+ "gbp",
1885
+ "gel",
1886
+ "ghs",
1887
+ "gtq",
1888
+ "hkd",
1889
+ "hrk",
1890
+ "huf",
1891
+ "idr",
1892
+ "ils",
1893
+ "imp",
1894
+ "inr",
1895
+ "isk",
1896
+ "jmd",
1897
+ "jpy",
1898
+ "kes",
1899
+ "krw",
1900
+ "kwd",
1901
+ "lak",
1902
+ "lkr",
1903
+ "lsl",
1904
+ "mad",
1905
+ "mur",
1906
+ "mxn",
1907
+ "myr",
1908
+ "mzn",
1909
+ "nad",
1910
+ "ngn",
1911
+ "nok",
1912
+ "npr",
1913
+ "nzd",
1914
+ "omr",
1915
+ "pab",
1916
+ "pen",
1917
+ "php",
1918
+ "pkr",
1919
+ "pln",
1920
+ "qar",
1921
+ "ron",
1922
+ "rub",
1923
+ "sar",
1924
+ "sek",
1925
+ "sgd",
1926
+ "thb",
1927
+ "tmt",
1928
+ "try",
1929
+ "twd",
1930
+ "tzs",
1931
+ "uah",
1932
+ "ugx",
1933
+ "usd",
1934
+ "uyu",
1935
+ "vnd",
1936
+ "xof",
1937
+ "zar",
1938
+ "zmw"
1939
+ ];
1940
+ var countryCodes = [
1941
+ "ad",
1942
+ "ae",
1943
+ "ar",
1944
+ "at",
1945
+ "au",
1946
+ "bd",
1947
+ "be",
1948
+ "bg",
1949
+ "bh",
1950
+ "bn",
1951
+ "br",
1952
+ "bw",
1953
+ "ca",
1954
+ "ch",
1955
+ "cl",
1956
+ "cn",
1957
+ "co",
1958
+ "cr",
1959
+ "cy",
1960
+ "cz",
1961
+ "de",
1962
+ "dk",
1963
+ "ee",
1964
+ "eg",
1965
+ "es",
1966
+ "eu",
1967
+ "fi",
1968
+ "fj",
1969
+ "fr",
1970
+ "gb",
1971
+ "ge",
1972
+ "gg",
1973
+ "gh",
1974
+ "gp",
1975
+ "gr",
1976
+ "gt",
1977
+ "hk",
1978
+ "hr",
1979
+ "hu",
1980
+ "id",
1981
+ "ie",
1982
+ "il",
1983
+ "im",
1984
+ "in",
1985
+ "is",
1986
+ "it",
1987
+ "je",
1988
+ "jm",
1989
+ "jp",
1990
+ "ke",
1991
+ "kr",
1992
+ "kw",
1993
+ "la",
1994
+ "li",
1995
+ "lk",
1996
+ "ls",
1997
+ "lt",
1998
+ "lu",
1999
+ "lv",
2000
+ "ma",
2001
+ "mc",
2002
+ "mt",
2003
+ "mu",
2004
+ "mx",
2005
+ "my",
2006
+ "mz",
2007
+ "na",
2008
+ "ng",
2009
+ "nl",
2010
+ "no",
2011
+ "np",
2012
+ "nz",
2013
+ "om",
2014
+ "pa",
2015
+ "pe",
2016
+ "ph",
2017
+ "pk",
2018
+ "pl",
2019
+ "pt",
2020
+ "qa",
2021
+ "ro",
2022
+ "ru",
2023
+ "sa",
2024
+ "se",
2025
+ "sg",
2026
+ "si",
2027
+ "sk",
2028
+ "sm",
2029
+ "th",
2030
+ "tm",
2031
+ "tr",
2032
+ "tw",
2033
+ "tz",
2034
+ "ua",
2035
+ "ug",
2036
+ "us",
2037
+ "uy",
2038
+ "va",
2039
+ "vn",
2040
+ "wi",
2041
+ "xo",
2042
+ "za",
2043
+ "zm"
2044
+ ];
2045
+
2046
+ // src/layout/icon/NamedIcon.tsx
2047
+ var icons = __toESM(require("@transferwise/icons"));
2048
+ var import_jsx_runtime6 = require("react/jsx-runtime");
2049
+ var isNamedIcon = (name) => {
2050
+ const iconName = toCapitalisedCamelCase(name);
2051
+ return Object.keys(icons).includes(iconName);
2052
+ };
2053
+ var NamedIcon = ({ name }) => {
2054
+ if (!isNamedIcon(name)) {
2055
+ return null;
2090
2056
  }
2091
- if ((_c = option.image) == null ? void 0 : _c.url) {
2092
- const { url, text } = option.image;
2093
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("img", { src: url, alt: text });
2057
+ const iconName = toCapitalisedCamelCase(name);
2058
+ const Icon = icons[iconName];
2059
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon, { size: 24 });
2060
+ };
2061
+ var toCapitalisedCamelCase = (value) => value.split("-").map(capitaliseFirstChar).join("");
2062
+ var capitaliseFirstChar = (value) => {
2063
+ var _a;
2064
+ return `${(_a = value[0]) == null ? void 0 : _a.toUpperCase()}${value.slice(1)}`;
2065
+ };
2066
+
2067
+ // src/layout/icon/DynamicIcon.tsx
2068
+ var import_jsx_runtime7 = require("react/jsx-runtime");
2069
+ var DynamicIcon = ({ type }) => {
2070
+ if (isFlagIcon(type)) {
2071
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FlagIcon, { name: type });
2094
2072
  }
2095
- return void 0;
2073
+ if (isNamedIcon(type)) {
2074
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(NamedIcon, { name: type });
2075
+ }
2076
+ return null;
2096
2077
  };
2097
- var DynamicDecision = (props) => {
2098
- const decision = props.component;
2099
- const renderDecisionOption = (option, onAction) => {
2100
- const media = getMedia(option);
2101
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2102
- import_components3.NavigationOption,
2078
+ function isValidIconName(name) {
2079
+ return isNamedIcon(name) || isFlagIcon(name);
2080
+ }
2081
+ var DynamicIcon_default = DynamicIcon;
2082
+
2083
+ // src/layout/utils/getNavigationOptionMedia.tsx
2084
+ var import_jsx_runtime8 = require("react/jsx-runtime");
2085
+ var getNavigationOptionMedia = ({ icon, image }) => {
2086
+ if (icon == null ? void 0 : icon.name) {
2087
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components.Avatar, { type: import_components.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DynamicIcon_default, { type: icon.name }) });
2088
+ }
2089
+ if (icon == null ? void 0 : icon.text) {
2090
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_components.Avatar, { type: import_components.AvatarType.INITIALS, children: icon.text });
2091
+ }
2092
+ if (image == null ? void 0 : image.url) {
2093
+ const { url, text } = image;
2094
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("img", { src: url, alt: text });
2095
+ }
2096
+ return null;
2097
+ };
2098
+
2099
+ // src/layout/utils/index.ts
2100
+ var getMarginBottom = (size) => {
2101
+ switch (size) {
2102
+ case "xs":
2103
+ return "m-b-0";
2104
+ case "sm":
2105
+ return "m-b-1";
2106
+ case "md":
2107
+ return "m-b-2";
2108
+ case "lg":
2109
+ return "m-b-3";
2110
+ case "xl":
2111
+ return "m-b-5";
2112
+ default:
2113
+ return "";
2114
+ }
2115
+ };
2116
+ var getTextAlignment = (align) => {
2117
+ switch (align) {
2118
+ case "right":
2119
+ return "text-xs-right";
2120
+ case "center":
2121
+ return "text-xs-center";
2122
+ case "left":
2123
+ default:
2124
+ return "";
2125
+ }
2126
+ };
2127
+ var getTextAlignmentAndMargin = (component) => `${getTextAlignment(component.align)} ${getMarginBottom(component.margin)}`;
2128
+
2129
+ // src/layout/alert/DynamicAlert.tsx
2130
+ var import_jsx_runtime9 = require("react/jsx-runtime");
2131
+ var DynamicAlert = (props) => {
2132
+ const alert = props.component;
2133
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
2134
+ import_components2.Alert,
2135
+ {
2136
+ type: mapContextToAlertType(legacy_mapContext(alert.context)),
2137
+ className: getMarginBottom(alert.margin),
2138
+ message: alert.markdown
2139
+ }
2140
+ );
2141
+ };
2142
+ var legacy_mapContext = (context) => {
2143
+ switch (context) {
2144
+ case "success":
2145
+ return "positive";
2146
+ case "failure":
2147
+ return "negative";
2148
+ case "warning":
2149
+ return "warning";
2150
+ case "info":
2151
+ case "primary":
2152
+ return "neutral";
2153
+ default:
2154
+ return context;
2155
+ }
2156
+ };
2157
+ var mapContextToAlertType = (context) => {
2158
+ if (!context || !["neutral", "warning", "negative", "positive"].includes(context)) {
2159
+ return "neutral";
2160
+ }
2161
+ return context;
2162
+ };
2163
+ var DynamicAlert_default = DynamicAlert;
2164
+
2165
+ // src/layout/box/DynamicBox.tsx
2166
+ var import_jsx_runtime10 = require("react/jsx-runtime");
2167
+ var DynamicBox = (props) => {
2168
+ const box = props.component;
2169
+ const margin = getMarginBottom(box.margin || box.border ? "lg" : "xs");
2170
+ if (!box.width || box.width === "xl") {
2171
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: margin + getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2172
+ DynamicLayout_default,
2103
2173
  {
2104
- title: option.title,
2105
- content: option.description,
2106
- disabled: option.disabled,
2107
- media,
2108
- showMediaCircle: false,
2109
- showMediaAtAllSizes: true,
2110
- onClick: () => onAction(option.action)
2111
- },
2112
- JSON.stringify(option)
2113
- );
2174
+ components: box.components,
2175
+ model: props.model,
2176
+ submitted: props.submitted,
2177
+ errors: props.errors,
2178
+ onModelChange: props.onModelChange,
2179
+ onAction: props.onAction,
2180
+ onPersistAsync: props.onPersistAsync
2181
+ }
2182
+ ) });
2183
+ }
2184
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: margin + getBoxWidthClasses(box), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: getBorderClass(box.border), children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
2185
+ DynamicLayout_default,
2186
+ {
2187
+ components: box.components,
2188
+ model: props.model,
2189
+ submitted: props.submitted,
2190
+ errors: props.errors,
2191
+ onModelChange: props.onModelChange,
2192
+ onAction: props.onAction,
2193
+ onPersistAsync: props.onPersistAsync
2194
+ }
2195
+ ) }) }) });
2196
+ };
2197
+ var getBorderClass = (border) => {
2198
+ return border ? " well p-b-0" : "";
2199
+ };
2200
+ var getBoxWidthClasses = (component) => {
2201
+ switch (component.width) {
2202
+ case "xs":
2203
+ return " col-md-4 col-md-offset-4";
2204
+ case "sm":
2205
+ return " col-md-6 col-md-offset-3 col-lg-4 col-lg-offset-4";
2206
+ case "md":
2207
+ return " col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3";
2208
+ case "lg":
2209
+ return " col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2";
2210
+ case "xl":
2211
+ default:
2212
+ return " col-xs-12";
2213
+ }
2214
+ };
2215
+ var DynamicBox_default = DynamicBox;
2216
+
2217
+ // src/layout/button/DynamicButton.tsx
2218
+ var import_components3 = require("@transferwise/components");
2219
+
2220
+ // src/layout/button/utils.ts
2221
+ var priorities = {
2222
+ primary: "primary",
2223
+ secondary: "secondary",
2224
+ link: "tertiary",
2225
+ positive: "primary",
2226
+ negative: "primary"
2227
+ };
2228
+ var getButtonPriority = (component) => {
2229
+ var _a;
2230
+ const actionType = component.action.type;
2231
+ return (_a = component.control) != null ? _a : actionType ? priorities[actionType] : "secondary";
2232
+ };
2233
+ var types = {
2234
+ primary: "neutral",
2235
+ secondary: "neutral",
2236
+ link: "neutral",
2237
+ positive: "positive",
2238
+ negative: "negative"
2239
+ };
2240
+ var getButtonType = (component) => {
2241
+ var _a;
2242
+ const actionType = component.action.type;
2243
+ const type = (_a = component.context) != null ? _a : actionType ? types[actionType] : "neutral";
2244
+ return type === "neutral" ? "accent" : type;
2245
+ };
2246
+ var getButtonSize = (size) => {
2247
+ switch (size) {
2248
+ case "xs":
2249
+ case "sm":
2250
+ return "sm";
2251
+ case "lg":
2252
+ case "xl":
2253
+ return "lg";
2254
+ case "md":
2255
+ default:
2256
+ return "md";
2257
+ }
2258
+ };
2259
+
2260
+ // src/layout/button/DynamicButton.tsx
2261
+ var import_jsx_runtime11 = require("react/jsx-runtime");
2262
+ var DynamicButton = (props) => {
2263
+ var _a;
2264
+ const { component, onAction } = props;
2265
+ const componentAction = component.action;
2266
+ const type = getButtonType(component);
2267
+ const priority = getButtonPriority(component);
2268
+ const { loading } = useDynamicFlow();
2269
+ const className = getMarginBottom(component.margin || "md");
2270
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
2271
+ import_components3.Button,
2272
+ {
2273
+ size: getButtonSize(component.size),
2274
+ type,
2275
+ priority,
2276
+ block: true,
2277
+ className,
2278
+ disabled: component.disabled || componentAction.disabled || loading,
2279
+ onClick: () => onAction(componentAction),
2280
+ children: (_a = component.title) != null ? _a : componentAction.title
2281
+ }
2282
+ );
2283
+ };
2284
+ var DynamicButton_default = DynamicButton;
2285
+
2286
+ // src/layout/columns/DynamicColumns.tsx
2287
+ var import_jsx_runtime12 = require("react/jsx-runtime");
2288
+ var DynamicColumns = (props) => {
2289
+ const columns = props.component;
2290
+ const { leftWidth, rightWidth } = getWidth(columns.bias);
2291
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: `${getMarginBottom(columns.margin || "xs")} row`, children: [
2292
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${leftWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2293
+ DynamicLayout_default,
2294
+ {
2295
+ components: columns.left,
2296
+ model: props.model,
2297
+ submitted: props.submitted,
2298
+ errors: props.errors,
2299
+ onModelChange: props.onModelChange,
2300
+ onAction: props.onAction,
2301
+ onPersistAsync: props.onPersistAsync
2302
+ }
2303
+ ) }),
2304
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: `${rightWidth} m-b-0`, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2305
+ DynamicLayout_default,
2306
+ {
2307
+ components: columns.right,
2308
+ model: props.model,
2309
+ submitted: props.submitted,
2310
+ errors: props.errors,
2311
+ onModelChange: props.onModelChange,
2312
+ onAction: props.onAction,
2313
+ onPersistAsync: props.onPersistAsync
2314
+ }
2315
+ ) })
2316
+ ] });
2317
+ };
2318
+ var getWidth = (bias) => {
2319
+ if (bias === "left") {
2320
+ return {
2321
+ leftWidth: "col-md-8",
2322
+ rightWidth: "col-md-4"
2323
+ };
2324
+ }
2325
+ if (bias === "right") {
2326
+ return {
2327
+ leftWidth: "col-md-4",
2328
+ rightWidth: "col-md-8"
2329
+ };
2330
+ }
2331
+ return {
2332
+ leftWidth: "col-md-6",
2333
+ rightWidth: "col-md-6"
2114
2334
  };
2115
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: getMarginBottom(decision.margin), children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_components3.NavigationOptionsList, { children: decision.options.map((option) => renderDecisionOption(option, props.onAction)) }) });
2116
2335
  };
2336
+ var DynamicColumns_default = DynamicColumns;
2337
+
2338
+ // src/layout/decision/DynamicDecision.tsx
2339
+ var import_components4 = require("@transferwise/components");
2340
+ var import_jsx_runtime13 = require("react/jsx-runtime");
2341
+ var DynamicDecision = ({ component, onAction }) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: getMarginBottom(component.margin), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_components4.NavigationOptionsList, { children: component.options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
2342
+ import_components4.NavigationOption,
2343
+ {
2344
+ title: option.title,
2345
+ content: option.description,
2346
+ disabled: option.disabled,
2347
+ media: getNavigationOptionMedia(option),
2348
+ showMediaCircle: false,
2349
+ showMediaAtAllSizes: true,
2350
+ onClick: () => onAction(option.action)
2351
+ },
2352
+ JSON.stringify(option)
2353
+ )) }) });
2117
2354
  var DynamicDecision_default = DynamicDecision;
2118
2355
 
2119
2356
  // src/layout/divider/DynamicDivider.tsx
2120
- var import_jsx_runtime10 = require("react/jsx-runtime");
2357
+ var import_jsx_runtime14 = require("react/jsx-runtime");
2121
2358
  var DynamicDivider = ({ component }) => {
2122
2359
  const margin = getMarginBottom(component.margin);
2123
2360
  const className = `m-t-0 ${margin}`;
2124
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("hr", { className });
2361
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("hr", { className });
2125
2362
  };
2126
2363
  var DynamicDivider_default = DynamicDivider;
2127
2364
 
2128
2365
  // src/layout/external/DynamicExternal.tsx
2129
- var import_components4 = require("@transferwise/components");
2366
+ var import_components5 = require("@transferwise/components");
2130
2367
  var import_react9 = require("react");
2131
2368
  var import_react_intl3 = require("react-intl");
2132
2369
 
@@ -2141,7 +2378,7 @@ var DynamicExternal_messages_default = (0, import_react_intl2.defineMessages)({
2141
2378
  });
2142
2379
 
2143
2380
  // src/layout/external/DynamicExternal.tsx
2144
- var import_jsx_runtime11 = require("react/jsx-runtime");
2381
+ var import_jsx_runtime15 = require("react/jsx-runtime");
2145
2382
  var DynamicExternal = ({ component, onAction }) => {
2146
2383
  const { requestUrl, responseHandlers, polling, retryTitle } = component;
2147
2384
  const intl = (0, import_react_intl3.useIntl)();
@@ -2156,10 +2393,10 @@ var DynamicExternal = ({ component, onAction }) => {
2156
2393
  responseHandlers
2157
2394
  }) : void 0;
2158
2395
  useExternalStepPolling(pollingConfiguration, onAction);
2159
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(import_jsx_runtime11.Fragment, { children: [
2160
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_components4.Loader, { size: import_components4.Size.LARGE, classNames: { "tw-loader": "tw-loader m-x-auto" } }),
2161
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("br", {}),
2162
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_components4.Button, { priority: "tertiary", block: true, onClick: openExternalUrl, children: retryTitle || intl.formatMessage(DynamicExternal_messages_default.retryTitle) })
2396
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
2397
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_components5.Loader, { size: import_components5.Size.LARGE, classNames: { "tw-loader": "tw-loader m-x-auto" } }),
2398
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("br", {}),
2399
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_components5.Button, { priority: "tertiary", block: true, onClick: openExternalUrl, children: retryTitle || intl.formatMessage(DynamicExternal_messages_default.retryTitle) })
2163
2400
  ] });
2164
2401
  };
2165
2402
  var DynamicExternal_default = DynamicExternal;
@@ -2170,7 +2407,7 @@ var import_react20 = require("react");
2170
2407
  // src/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
2171
2408
  var import_classnames = __toESM(require_classnames());
2172
2409
  var import_react10 = require("react");
2173
- var import_jsx_runtime12 = require("react/jsx-runtime");
2410
+ var import_jsx_runtime16 = require("react/jsx-runtime");
2174
2411
  var splitModel = (model, schemas) => {
2175
2412
  return schemas.map((schema) => getValidObjectModelParts(model, schema) || {});
2176
2413
  };
@@ -2194,12 +2431,12 @@ var AllOfSchema = (props) => {
2194
2431
  props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model: combineModels(models) }));
2195
2432
  };
2196
2433
  const [models, setModels] = (0, import_react10.useState)(splitModel(props.model, props.schema.allOf));
2197
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(import_jsx_runtime12.Fragment, { children: [
2198
- props.schema.title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h3", { className: "page-header", children: props.schema.title }),
2199
- props.schema.description && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: props.schema.description }),
2200
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "row", children: props.schema.allOf.map((schema, index) => (
2434
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
2435
+ props.schema.title && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h3", { className: "page-header", children: props.schema.title }),
2436
+ props.schema.description && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: props.schema.description }),
2437
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "row", children: props.schema.allOf.map((schema, index) => (
2201
2438
  // eslint-disable-next-line react/no-array-index-key
2202
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: (0, import_classnames.default)(getSchemaColumnClasses(schema.width)), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
2439
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: (0, import_classnames.default)(getSchemaColumnClasses(schema.width)), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2203
2440
  GenericSchema_default,
2204
2441
  {
2205
2442
  schema,
@@ -2223,12 +2460,12 @@ AllOfSchema.defaultProps = {
2223
2460
  var AllOfSchema_default = AllOfSchema;
2224
2461
 
2225
2462
  // src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
2226
- var import_components6 = require("@transferwise/components");
2463
+ var import_components7 = require("@transferwise/components");
2227
2464
  var import_classnames2 = __toESM(require_classnames());
2228
2465
  var import_react11 = require("react");
2229
2466
 
2230
2467
  // src/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
2231
- var import_components5 = require("@transferwise/components");
2468
+ var import_components6 = require("@transferwise/components");
2232
2469
  var import_formatting = require("@transferwise/formatting");
2233
2470
  var import_react_intl5 = require("react-intl");
2234
2471
 
@@ -2288,7 +2525,7 @@ var ControlFeedback_messages_default = (0, import_react_intl4.defineMessages)({
2288
2525
  });
2289
2526
 
2290
2527
  // src/jsonSchemaForm/controlFeedback/ControlFeedback.tsx
2291
- var import_jsx_runtime13 = require("react/jsx-runtime");
2528
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2292
2529
  var ControlFeedback = (props) => {
2293
2530
  var _a;
2294
2531
  const defaultValidationMessages = useDefaultValidationMessages(props.schema);
@@ -2297,12 +2534,12 @@ var ControlFeedback = (props) => {
2297
2534
  const isValidationVisible = !isErrorVisible && (props.submitted || props.changed && props.blurred) && !!((_a = props.validations) == null ? void 0 : _a.length);
2298
2535
  const isDescriptionVisible = props.focused && props.schema.description && !isValidationVisible;
2299
2536
  const hasInfoMessage = !!props.infoMessage;
2300
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
2301
- isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_components5.InlineAlert, { type: "error", children: props.errors }) : null,
2302
- isValidationVisible ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_components5.InlineAlert, { type: "error", children: props.validations.map((validation) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: validationMessages[validation] }, validation)) }) : null,
2303
- (isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_components5.InlineAlert, { type: "info", children: [
2304
- isDescriptionVisible && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: props.schema.description }),
2305
- hasInfoMessage && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { children: props.infoMessage })
2537
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
2538
+ isErrorVisible ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components6.InlineAlert, { type: "error", children: props.errors }) : null,
2539
+ isValidationVisible ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components6.InlineAlert, { type: "error", children: props.validations.map((validation) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: validationMessages[validation] }, validation)) }) : null,
2540
+ (isDescriptionVisible || hasInfoMessage) && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_components6.InlineAlert, { type: "info", children: [
2541
+ isDescriptionVisible && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: props.schema.description }),
2542
+ hasInfoMessage && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { children: props.infoMessage })
2306
2543
  ] })
2307
2544
  ] });
2308
2545
  };
@@ -2444,7 +2681,7 @@ function useFormattedDefaultErrorMessages({
2444
2681
  }
2445
2682
 
2446
2683
  // src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.tsx
2447
- var import_jsx_runtime14 = require("react/jsx-runtime");
2684
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2448
2685
  var MultipleFileUploadSchema = (props) => {
2449
2686
  var _a, _b;
2450
2687
  const { onChange, schema } = props;
@@ -2505,10 +2742,10 @@ var MultipleFileUploadSchema = (props) => {
2505
2742
  onFilesChange,
2506
2743
  onDeleteFile: () => Promise.resolve()
2507
2744
  });
2508
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: (0, import_classnames2.default)("form-group", { "has-error": showError }), children: [
2509
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("label", { className: "d-block control-label", htmlFor: uid, children: props.schema.title }),
2510
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_components6.UploadInput, __spreadValues({}, uploadInputProps)),
2511
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
2745
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: (0, import_classnames2.default)("form-group", { "has-error": showError }), children: [
2746
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("label", { className: "d-block control-label", htmlFor: uid, children: props.schema.title }),
2747
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components7.UploadInput, __spreadValues({}, uploadInputProps)),
2748
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2512
2749
  ControlFeedback_default,
2513
2750
  {
2514
2751
  changed: inputChanged,
@@ -2537,7 +2774,7 @@ function getSuccessfullyProcessedFiles(allFiles) {
2537
2774
  return allFiles.filter((file) => !file.error && file.status === "succeeded");
2538
2775
  }
2539
2776
  function convertFileIdsToComponentFileObjects(fileIds) {
2540
- return fileIds.map((id) => isValidId(id) ? { id, status: import_components6.Status.SUCCEEDED } : null).filter((item) => item !== null);
2777
+ return fileIds.map((id) => isValidId(id) ? { id, status: import_components7.Status.SUCCEEDED } : null).filter((item) => item !== null);
2541
2778
  }
2542
2779
  function isValidId(id) {
2543
2780
  return isNumber(id) || isString(id);
@@ -2548,11 +2785,11 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
2548
2785
  }
2549
2786
 
2550
2787
  // src/jsonSchemaForm/arrayTypeSchema/arrayListSchema/ArrayListSchema.tsx
2551
- var import_jsx_runtime15 = require("react/jsx-runtime");
2788
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2552
2789
  var ArrayListSchema = (props) => {
2553
2790
  const { schema } = props;
2554
2791
  if (isMultipleFileUploadSchema(schema)) {
2555
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
2792
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MultipleFileUploadSchema_default, __spreadProps(__spreadValues({}, props), { schema }));
2556
2793
  }
2557
2794
  throw new Error("Not implemented");
2558
2795
  };
@@ -2563,11 +2800,11 @@ ArrayListSchema.defaultProps = {
2563
2800
  var ArrayListSchema_default = ArrayListSchema;
2564
2801
 
2565
2802
  // src/jsonSchemaForm/arrayTypeSchema/ArraySchema.tsx
2566
- var import_jsx_runtime16 = require("react/jsx-runtime");
2803
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2567
2804
  var ArraySchema = (props) => {
2568
2805
  const { schema } = props;
2569
2806
  if (isListArraySchema(schema)) {
2570
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ArrayListSchema_default, __spreadValues({}, props));
2807
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ArrayListSchema_default, __spreadValues({}, props));
2571
2808
  }
2572
2809
  throw new Error("Not implemented");
2573
2810
  };
@@ -2579,7 +2816,7 @@ var ArraySchema_default = ArraySchema;
2579
2816
  // src/jsonSchemaForm/objectSchema/ObjectSchema.tsx
2580
2817
  var import_classnames3 = __toESM(require_classnames());
2581
2818
  var import_react12 = require("react");
2582
- var import_jsx_runtime17 = require("react/jsx-runtime");
2819
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2583
2820
  var getSchemaColumnClasses2 = (width) => {
2584
2821
  return {
2585
2822
  "col-xs-12": true,
@@ -2617,25 +2854,25 @@ var ObjectSchema = (props) => {
2617
2854
  const isPropertyDefined = (propertyName) => typeof props.schema.properties[propertyName] !== "undefined";
2618
2855
  const orderedPropertyNames = Array.from(allorderedPropertiesSet).filter(isPropertyDefined);
2619
2856
  const propsErrors = props.errors;
2620
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("fieldset", { children: [
2621
- props.schema.title && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("legend", { children: [
2857
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("fieldset", { children: [
2858
+ props.schema.title && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("legend", { children: [
2622
2859
  " ",
2623
2860
  props.schema.title,
2624
2861
  " "
2625
2862
  ] }),
2626
- props.schema.description && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { children: [
2863
+ props.schema.description && !props.hideTitle && /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("p", { children: [
2627
2864
  " ",
2628
2865
  props.schema.description,
2629
2866
  " "
2630
2867
  ] }),
2631
- props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DynamicAlert_default, { component: props.schema.alert }),
2632
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "row", children: orderedPropertyNames.map((propertyName) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2868
+ props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(DynamicAlert_default, { component: props.schema.alert }),
2869
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "row", children: orderedPropertyNames.map((propertyName) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2633
2870
  "div",
2634
2871
  {
2635
2872
  className: (0, import_classnames3.default)(
2636
2873
  getSchemaColumnClasses2(props.schema.properties[propertyName].width)
2637
2874
  ),
2638
- children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2875
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2639
2876
  GenericSchema_default,
2640
2877
  {
2641
2878
  schema: props.schema.properties[propertyName],
@@ -2664,7 +2901,7 @@ var import_classnames4 = __toESM(require_classnames());
2664
2901
  var import_react15 = require("react");
2665
2902
 
2666
2903
  // src/jsonSchemaForm/help/Help.tsx
2667
- var import_components7 = require("@transferwise/components");
2904
+ var import_components8 = require("@transferwise/components");
2668
2905
  var import_react_intl10 = require("react-intl");
2669
2906
 
2670
2907
  // src/jsonSchemaForm/help/Help.messages.js
@@ -2678,14 +2915,14 @@ var Help_messages_default = (0, import_react_intl9.defineMessages)({
2678
2915
  });
2679
2916
 
2680
2917
  // src/jsonSchemaForm/help/Help.tsx
2681
- var import_jsx_runtime18 = require("react/jsx-runtime");
2918
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2682
2919
  var Help = (props) => {
2683
2920
  const intl = (0, import_react_intl10.useIntl)();
2684
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2685
- import_components7.Info,
2921
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2922
+ import_components8.Info,
2686
2923
  {
2687
2924
  className: "m-l-1",
2688
- content: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components7.Markdown, { children: props.help.markdown }),
2925
+ content: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_components8.Markdown, { children: props.help.markdown }),
2689
2926
  presentation: "POPOVER",
2690
2927
  size: "sm",
2691
2928
  "aria-label": intl.formatMessage(Help_messages_default.helpAria)
@@ -2698,7 +2935,7 @@ var Help_default = Help;
2698
2935
  var import_react14 = require("react");
2699
2936
 
2700
2937
  // src/formControl/FormControl.tsx
2701
- var import_components8 = require("@transferwise/components");
2938
+ var import_components9 = require("@transferwise/components");
2702
2939
  var import_react13 = require("react");
2703
2940
 
2704
2941
  // src/formControl/utils/value-utils.ts
@@ -2809,7 +3046,7 @@ var logInvalidTypeFallbackWarning = ({
2809
3046
  };
2810
3047
 
2811
3048
  // src/formControl/FormControl.tsx
2812
- var import_jsx_runtime19 = require("react/jsx-runtime");
3049
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2813
3050
  var _FormControl = class extends import_react13.PureComponent {
2814
3051
  constructor(props) {
2815
3052
  super(props);
@@ -2896,8 +3133,8 @@ var _FormControl = class extends import_react13.PureComponent {
2896
3133
  } = this.props;
2897
3134
  switch (type) {
2898
3135
  case FormControlType.RADIO:
2899
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2900
- import_components8.RadioGroup,
3136
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3137
+ import_components9.RadioGroup,
2901
3138
  {
2902
3139
  radios: options.map(this.mapOption),
2903
3140
  name,
@@ -2906,8 +3143,8 @@ var _FormControl = class extends import_react13.PureComponent {
2906
3143
  }
2907
3144
  );
2908
3145
  case FormControlType.CHECKBOX:
2909
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2910
- import_components8.Checkbox,
3146
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3147
+ import_components9.Checkbox,
2911
3148
  {
2912
3149
  checked: getSafeBooleanValue(value, { coerceValue: true }),
2913
3150
  disabled,
@@ -2921,8 +3158,8 @@ var _FormControl = class extends import_react13.PureComponent {
2921
3158
  );
2922
3159
  case FormControlType.SELECT: {
2923
3160
  const search = options.length >= 20;
2924
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2925
- import_components8.Select,
3161
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3162
+ import_components9.Select,
2926
3163
  {
2927
3164
  id,
2928
3165
  selected: this.getSelectedOption(options),
@@ -2945,13 +3182,13 @@ var _FormControl = class extends import_react13.PureComponent {
2945
3182
  );
2946
3183
  }
2947
3184
  case FormControlType.TAB:
2948
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2949
- import_components8.Tabs,
3185
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3186
+ import_components9.Tabs,
2950
3187
  {
2951
3188
  selected: ((_a = this.getSelectedOption(options)) == null ? void 0 : _a.value) || 0,
2952
3189
  tabs: options.map((option) => ({
2953
3190
  title: option.label,
2954
- content: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, {}),
3191
+ content: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_jsx_runtime23.Fragment, {}),
2955
3192
  disabled: option.disabled || false
2956
3193
  })),
2957
3194
  name: id,
@@ -2965,7 +3202,7 @@ var _FormControl = class extends import_react13.PureComponent {
2965
3202
  }
2966
3203
  );
2967
3204
  case FormControlType.NUMBER:
2968
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3205
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2969
3206
  "input",
2970
3207
  {
2971
3208
  autoComplete: this.getAutocompleteStatus(),
@@ -2993,7 +3230,7 @@ var _FormControl = class extends import_react13.PureComponent {
2993
3230
  }
2994
3231
  );
2995
3232
  case FormControlType.HIDDEN:
2996
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3233
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2997
3234
  "input",
2998
3235
  {
2999
3236
  type: "hidden",
@@ -3003,7 +3240,7 @@ var _FormControl = class extends import_react13.PureComponent {
3003
3240
  }
3004
3241
  );
3005
3242
  case FormControlType.PASSWORD:
3006
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3243
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3007
3244
  "input",
3008
3245
  {
3009
3246
  autoComplete: this.getAutocompleteStatus(),
@@ -3022,8 +3259,8 @@ var _FormControl = class extends import_react13.PureComponent {
3022
3259
  );
3023
3260
  case FormControlType.DATE:
3024
3261
  case FormControlType.DATETIME:
3025
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3026
- import_components8.DateInput,
3262
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3263
+ import_components9.DateInput,
3027
3264
  {
3028
3265
  disabled,
3029
3266
  size,
@@ -3036,8 +3273,8 @@ var _FormControl = class extends import_react13.PureComponent {
3036
3273
  }
3037
3274
  );
3038
3275
  case FormControlType.DATELOOKUP: {
3039
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3040
- import_components8.DateLookup,
3276
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3277
+ import_components9.DateLookup,
3041
3278
  {
3042
3279
  value: getSafeDateStringValue(value),
3043
3280
  min: minDate,
@@ -3054,8 +3291,8 @@ var _FormControl = class extends import_react13.PureComponent {
3054
3291
  );
3055
3292
  }
3056
3293
  case FormControlType.TEL:
3057
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3058
- import_components8.PhoneNumberInput,
3294
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3295
+ import_components9.PhoneNumberInput,
3059
3296
  {
3060
3297
  disabled,
3061
3298
  countryCode,
@@ -3086,8 +3323,8 @@ var _FormControl = class extends import_react13.PureComponent {
3086
3323
  autoComplete: this.getAutocompleteStatus()
3087
3324
  };
3088
3325
  if (this.props.displayPattern) {
3089
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3090
- import_components8.TextareaWithDisplayFormat,
3326
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3327
+ import_components9.TextareaWithDisplayFormat,
3091
3328
  __spreadProps(__spreadValues({
3092
3329
  displayPattern: this.props.displayPattern
3093
3330
  }, textareaProps), {
@@ -3095,15 +3332,15 @@ var _FormControl = class extends import_react13.PureComponent {
3095
3332
  })
3096
3333
  );
3097
3334
  }
3098
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("textarea", __spreadProps(__spreadValues({}, textareaProps), { onChange: this.handleInputOnChange }));
3335
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("textarea", __spreadProps(__spreadValues({}, textareaProps), { onChange: this.handleInputOnChange }));
3099
3336
  }
3100
3337
  case FormControlType.FILE:
3101
3338
  case FormControlType.UPLOAD: {
3102
3339
  return (
3103
3340
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
3104
3341
  // @ts-expect-error - TODO: Remove this once Upload is migrated to TypeScript
3105
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3106
- import_components8.Upload,
3342
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3343
+ import_components9.Upload,
3107
3344
  __spreadProps(__spreadValues({}, uploadProps), {
3108
3345
  usAccept: uploadProps.usAccept || "*",
3109
3346
  usDisabled: uploadProps.usDisabled || disabled,
@@ -3139,8 +3376,8 @@ var _FormControl = class extends import_react13.PureComponent {
3139
3376
  autoComplete: this.getAutocompleteStatus()
3140
3377
  };
3141
3378
  if (this.props.displayPattern) {
3142
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
3143
- import_components8.InputWithDisplayFormat,
3379
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3380
+ import_components9.InputWithDisplayFormat,
3144
3381
  __spreadProps(__spreadValues({
3145
3382
  displayPattern: this.props.displayPattern
3146
3383
  }, inputProps), {
@@ -3148,7 +3385,7 @@ var _FormControl = class extends import_react13.PureComponent {
3148
3385
  })
3149
3386
  );
3150
3387
  }
3151
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("input", __spreadProps(__spreadValues({}, inputProps), { onChange: this.handleInputOnChange }));
3388
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("input", __spreadProps(__spreadValues({}, inputProps), { onChange: this.handleInputOnChange }));
3152
3389
  }
3153
3390
  }
3154
3391
  }
@@ -3185,255 +3422,14 @@ FormControl.defaultProps = {
3185
3422
  selectedOption: null,
3186
3423
  size: _FormControl.Size.MEDIUM,
3187
3424
  step: 1,
3188
- type: _FormControl.Type.TEXT,
3189
- uploadProps: {},
3190
- value: null
3191
- };
3192
-
3193
- // src/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
3194
- var import_components9 = require("@transferwise/components");
3195
-
3196
- // src/layout/icon/FlagIcon.tsx
3197
- var import_jsx_runtime20 = require("react/jsx-runtime");
3198
- var isFlagIcon = (name) => isCurrencyFlagIcon(name) || isCountryFlagIcon(name);
3199
- var isCurrencyFlagIcon = (name) => currencyCodes.some((currencyCode) => name === `flag-${currencyCode}`);
3200
- var isCountryFlagIcon = (name) => countryCodes.some((countryCode) => name === `flag-${countryCode}`);
3201
- var FlagIcon = ({ name }) => {
3202
- if (!isFlagIcon(name)) {
3203
- return null;
3204
- }
3205
- const code = name.substring(5);
3206
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
3207
- "img",
3208
- {
3209
- src: `https://wise.com/web-art/assets/flags/${code}.svg`,
3210
- alt: "",
3211
- "data-testid": `img-flag-${code}`
3212
- }
3213
- );
3214
- };
3215
- var currencyCodes = [
3216
- "aed",
3217
- "ars",
3218
- "aud",
3219
- "bdt",
3220
- "bgn",
3221
- "bhd",
3222
- "bnd",
3223
- "brl",
3224
- "bwp",
3225
- "cad",
3226
- "chf",
3227
- "clp",
3228
- "cny",
3229
- "cop",
3230
- "crc",
3231
- "czk",
3232
- "dkk",
3233
- "egp",
3234
- "eur",
3235
- "fjd",
3236
- "gbp",
3237
- "gel",
3238
- "ghs",
3239
- "gtq",
3240
- "hkd",
3241
- "hrk",
3242
- "huf",
3243
- "idr",
3244
- "ils",
3245
- "imp",
3246
- "inr",
3247
- "isk",
3248
- "jmd",
3249
- "jpy",
3250
- "kes",
3251
- "krw",
3252
- "kwd",
3253
- "lak",
3254
- "lkr",
3255
- "lsl",
3256
- "mad",
3257
- "mur",
3258
- "mxn",
3259
- "myr",
3260
- "mzn",
3261
- "nad",
3262
- "ngn",
3263
- "nok",
3264
- "npr",
3265
- "nzd",
3266
- "omr",
3267
- "pab",
3268
- "pen",
3269
- "php",
3270
- "pkr",
3271
- "pln",
3272
- "qar",
3273
- "ron",
3274
- "rub",
3275
- "sar",
3276
- "sek",
3277
- "sgd",
3278
- "thb",
3279
- "tmt",
3280
- "try",
3281
- "twd",
3282
- "tzs",
3283
- "uah",
3284
- "ugx",
3285
- "usd",
3286
- "uyu",
3287
- "vnd",
3288
- "xof",
3289
- "zar",
3290
- "zmw"
3291
- ];
3292
- var countryCodes = [
3293
- "ad",
3294
- "ae",
3295
- "ar",
3296
- "at",
3297
- "au",
3298
- "bd",
3299
- "be",
3300
- "bg",
3301
- "bh",
3302
- "bn",
3303
- "br",
3304
- "bw",
3305
- "ca",
3306
- "ch",
3307
- "cl",
3308
- "cn",
3309
- "co",
3310
- "cr",
3311
- "cy",
3312
- "cz",
3313
- "de",
3314
- "dk",
3315
- "ee",
3316
- "eg",
3317
- "es",
3318
- "eu",
3319
- "fi",
3320
- "fj",
3321
- "fr",
3322
- "gb",
3323
- "ge",
3324
- "gg",
3325
- "gh",
3326
- "gp",
3327
- "gr",
3328
- "gt",
3329
- "hk",
3330
- "hr",
3331
- "hu",
3332
- "id",
3333
- "ie",
3334
- "il",
3335
- "im",
3336
- "in",
3337
- "is",
3338
- "it",
3339
- "je",
3340
- "jm",
3341
- "jp",
3342
- "ke",
3343
- "kr",
3344
- "kw",
3345
- "la",
3346
- "li",
3347
- "lk",
3348
- "ls",
3349
- "lt",
3350
- "lu",
3351
- "lv",
3352
- "ma",
3353
- "mc",
3354
- "mt",
3355
- "mu",
3356
- "mx",
3357
- "my",
3358
- "mz",
3359
- "na",
3360
- "ng",
3361
- "nl",
3362
- "no",
3363
- "np",
3364
- "nz",
3365
- "om",
3366
- "pa",
3367
- "pe",
3368
- "ph",
3369
- "pk",
3370
- "pl",
3371
- "pt",
3372
- "qa",
3373
- "ro",
3374
- "ru",
3375
- "sa",
3376
- "se",
3377
- "sg",
3378
- "si",
3379
- "sk",
3380
- "sm",
3381
- "th",
3382
- "tm",
3383
- "tr",
3384
- "tw",
3385
- "tz",
3386
- "ua",
3387
- "ug",
3388
- "us",
3389
- "uy",
3390
- "va",
3391
- "vn",
3392
- "wi",
3393
- "xo",
3394
- "za",
3395
- "zm"
3396
- ];
3397
-
3398
- // src/layout/icon/NamedIcon.tsx
3399
- var icons = __toESM(require("@transferwise/icons"));
3400
- var import_jsx_runtime21 = require("react/jsx-runtime");
3401
- var isNamedIcon = (name) => {
3402
- const iconName = toCapitalisedCamelCase(name);
3403
- return Object.keys(icons).includes(iconName);
3404
- };
3405
- var NamedIcon = ({ name }) => {
3406
- if (!isNamedIcon(name)) {
3407
- return null;
3408
- }
3409
- const iconName = toCapitalisedCamelCase(name);
3410
- const Icon = icons[iconName];
3411
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Icon, { size: 24 });
3412
- };
3413
- var toCapitalisedCamelCase = (value) => value.split("-").map(capitaliseFirstChar).join("");
3414
- var capitaliseFirstChar = (value) => {
3415
- var _a;
3416
- return `${(_a = value[0]) == null ? void 0 : _a.toUpperCase()}${value.slice(1)}`;
3417
- };
3418
-
3419
- // src/layout/icon/DynamicIcon.tsx
3420
- var import_jsx_runtime22 = require("react/jsx-runtime");
3421
- var DynamicIcon = ({ type }) => {
3422
- if (isFlagIcon(type)) {
3423
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(FlagIcon, { name: type });
3424
- }
3425
- if (isNamedIcon(type)) {
3426
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(NamedIcon, { name: type });
3427
- }
3428
- return null;
3425
+ type: _FormControl.Type.TEXT,
3426
+ uploadProps: {},
3427
+ value: null
3429
3428
  };
3430
- function isValidIconName(name) {
3431
- return isNamedIcon(name) || isFlagIcon(name);
3432
- }
3433
- var DynamicIcon_default = DynamicIcon;
3434
3429
 
3435
3430
  // src/jsonSchemaForm/schemaFormControl/utils/mapping-utils.tsx
3436
- var import_jsx_runtime23 = require("react/jsx-runtime");
3431
+ var import_components10 = require("@transferwise/components");
3432
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3437
3433
  var mapConstSchemaToOption = (schema, controlType) => {
3438
3434
  switch (controlType) {
3439
3435
  case "select":
@@ -3461,7 +3457,7 @@ var mapKeywordsToSearchStrings = (searchStrings) => isArray(searchStrings) ? { s
3461
3457
  var mapImage = (image) => {
3462
3458
  if (image == null ? void 0 : image.url) {
3463
3459
  return {
3464
- icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "media", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { src: image.url, alt: image.name || "" }) }) })
3460
+ icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "media", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "np-option__no-media-circle", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: image.url, alt: image.name || "" }) }) })
3465
3461
  };
3466
3462
  }
3467
3463
  return null;
@@ -3471,27 +3467,27 @@ var getIconPropertyForSelectOption = (icon) => {
3471
3467
  return { currency: icon.name.substring(5) };
3472
3468
  }
3473
3469
  if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
3474
- return { icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DynamicIcon_default, { type: icon.name }) };
3470
+ return { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DynamicIcon_default, { type: icon.name }) };
3475
3471
  }
3476
3472
  if (icon == null ? void 0 : icon.text) {
3477
- return { icon: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: icon.text }) };
3473
+ return { icon: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { children: icon.text }) };
3478
3474
  }
3479
3475
  return null;
3480
3476
  };
3481
3477
  var getAvatarPropertyForRadioOption = ({ image, icon }) => {
3482
3478
  if (image == null ? void 0 : image.url) {
3483
3479
  return {
3484
- avatar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components9.Avatar, { type: import_components9.AvatarType.THUMBNAIL, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("img", { src: image.url, alt: "" }) })
3480
+ avatar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components10.Avatar, { type: import_components10.AvatarType.THUMBNAIL, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("img", { src: image.url, alt: "" }) })
3485
3481
  };
3486
3482
  }
3487
3483
  if ((icon == null ? void 0 : icon.name) && isValidIconName(icon.name)) {
3488
3484
  return {
3489
- avatar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components9.Avatar, { type: import_components9.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(DynamicIcon_default, { type: icon.name }) })
3485
+ avatar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components10.Avatar, { type: import_components10.AvatarType.ICON, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(DynamicIcon_default, { type: icon.name }) })
3490
3486
  };
3491
3487
  }
3492
3488
  if (icon == null ? void 0 : icon.text) {
3493
3489
  return {
3494
- avatar: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components9.Avatar, { type: import_components9.AvatarType.INITIALS, children: icon.text })
3490
+ avatar: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components10.Avatar, { type: import_components10.AvatarType.INITIALS, children: icon.text })
3495
3491
  };
3496
3492
  }
3497
3493
  return null;
@@ -3512,7 +3508,7 @@ var getDisabled = (disabled) => {
3512
3508
  };
3513
3509
 
3514
3510
  // src/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
3515
- var import_jsx_runtime24 = require("react/jsx-runtime");
3511
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3516
3512
  var isNativeInput = (propsSchemaType) => {
3517
3513
  return propsSchemaType === "string" || propsSchemaType === "number";
3518
3514
  };
@@ -3588,7 +3584,7 @@ var SchemaFormControl = (props) => {
3588
3584
  // TODO: LOW avoid type assertion below
3589
3585
  uploadProps: mapSchemaToUploadOptions(schema)
3590
3586
  };
3591
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps));
3587
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(FormControl, __spreadValues(__spreadValues({ type: controlType, value: safeValue }, events), controlProps));
3592
3588
  };
3593
3589
  SchemaFormControl.defaultProps = {
3594
3590
  value: null,
@@ -3668,7 +3664,7 @@ function getSchemaProperties(childSchema) {
3668
3664
  }
3669
3665
 
3670
3666
  // src/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
3671
- var import_jsx_runtime25 = require("react/jsx-runtime");
3667
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3672
3668
  var OneOfSchema = (props) => {
3673
3669
  const onEvent = useEventDispatcher();
3674
3670
  const [changed, setChanged] = (0, import_react15.useState)(false);
@@ -3741,11 +3737,11 @@ var OneOfSchema = (props) => {
3741
3737
  "form-group": true,
3742
3738
  "has-error": !changed && props.errors && !isEmpty(props.errors) || (props.submitted || changed && blurred) && validations.length
3743
3739
  };
3744
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3745
- (props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3746
- /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: (0, import_classnames4.default)(formGroupClasses), children: [
3740
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
3741
+ (props.schema.oneOf.length > 1 || isConstSchema(props.schema.oneOf[0])) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
3742
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: (0, import_classnames4.default)(formGroupClasses), children: [
3747
3743
  getTitleAndHelp(props.schema, id),
3748
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3744
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3749
3745
  SchemaFormControl_default,
3750
3746
  {
3751
3747
  id,
@@ -3758,7 +3754,7 @@ var OneOfSchema = (props) => {
3758
3754
  onSearchChange
3759
3755
  }
3760
3756
  ),
3761
- /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3757
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3762
3758
  ControlFeedback_default,
3763
3759
  {
3764
3760
  changed,
@@ -3772,9 +3768,9 @@ var OneOfSchema = (props) => {
3772
3768
  }
3773
3769
  )
3774
3770
  ] }),
3775
- props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DynamicAlert_default, { component: props.schema.alert })
3771
+ props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DynamicAlert_default, { component: props.schema.alert })
3776
3772
  ] }),
3777
- isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3773
+ isNoNConstSchema(props.schema.oneOf[schemaIndex]) && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3778
3774
  GenericSchema_default,
3779
3775
  {
3780
3776
  schema: props.schema.oneOf[schemaIndex],
@@ -3790,12 +3786,12 @@ var OneOfSchema = (props) => {
3790
3786
  ] });
3791
3787
  };
3792
3788
  function getTitleAndHelp(schema, id) {
3793
- const helpElement = schema.help ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Help_default, { help: schema.help }) : null;
3794
- const titleElement = isConstSchema(schema.oneOf[0]) ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("label", { className: "control-label d-inline", htmlFor: id, children: [
3789
+ const helpElement = schema.help ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Help_default, { help: schema.help }) : null;
3790
+ const titleElement = isConstSchema(schema.oneOf[0]) ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("label", { className: "control-label d-inline", htmlFor: id, children: [
3795
3791
  schema.title,
3796
3792
  " ",
3797
3793
  helpElement
3798
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("h4", { className: "m-b-2", children: [
3794
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("h4", { className: "m-b-2", children: [
3799
3795
  schema.title,
3800
3796
  " ",
3801
3797
  helpElement
@@ -3839,9 +3835,9 @@ var import_classnames5 = __toESM(require_classnames());
3839
3835
  var import_react17 = require("react");
3840
3836
 
3841
3837
  // src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
3842
- var import_components10 = require("@transferwise/components");
3838
+ var import_components11 = require("@transferwise/components");
3843
3839
  var import_react16 = require("react");
3844
- var import_jsx_runtime26 = require("react/jsx-runtime");
3840
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3845
3841
  var UploadInputAdapter = (props) => {
3846
3842
  const {
3847
3843
  id,
@@ -3857,7 +3853,7 @@ var UploadInputAdapter = (props) => {
3857
3853
  onCancel
3858
3854
  } = props;
3859
3855
  const onEvent = useEventDispatcher();
3860
- const files = (0, import_react16.useMemo)(() => fileId ? [{ id: fileId, status: import_components10.Status.SUCCEEDED }] : [], [fileId]);
3856
+ const files = (0, import_react16.useMemo)(() => fileId ? [{ id: fileId, status: import_components11.Status.SUCCEEDED }] : [], [fileId]);
3861
3857
  const uploadFile = (formData) => {
3862
3858
  onEvent("Dynamic Flow - PersistAsync", { status: "pending", schemaId: id });
3863
3859
  return httpClient(`${httpOptions.url}`, {
@@ -3875,8 +3871,8 @@ var UploadInputAdapter = (props) => {
3875
3871
  }
3876
3872
  });
3877
3873
  };
3878
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3879
- import_components10.UploadInput,
3874
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3875
+ import_components11.UploadInput,
3880
3876
  {
3881
3877
  id,
3882
3878
  fileInputName: httpOptions.fileInputName,
@@ -3895,7 +3891,7 @@ var UploadInputAdapter = (props) => {
3895
3891
  };
3896
3892
 
3897
3893
  // src/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
3898
- var import_jsx_runtime27 = require("react/jsx-runtime");
3894
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3899
3895
  var PersistAsyncBlobSchema = (props) => {
3900
3896
  const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react17.useState)({});
3901
3897
  const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react17.useState)(null);
@@ -3937,8 +3933,8 @@ var PersistAsyncBlobSchema = (props) => {
3937
3933
  "form-group": true,
3938
3934
  "has-error": (props.submitted || changed) && !!combinedValidations.length
3939
3935
  };
3940
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
3941
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3936
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
3937
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3942
3938
  UploadInputAdapter,
3943
3939
  __spreadValues({
3944
3940
  id: props.schema.$id || props.schema.persistAsync.schema.$id || props.schema.persistAsync.idProperty,
@@ -3955,7 +3951,7 @@ var PersistAsyncBlobSchema = (props) => {
3955
3951
  onCancel
3956
3952
  }, mapSchemaToUploadOptions(props.schema.persistAsync.schema))
3957
3953
  ),
3958
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3954
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3959
3955
  ControlFeedback_default,
3960
3956
  {
3961
3957
  blurred: true,
@@ -3979,17 +3975,17 @@ PersistAsyncBlobSchema.defaultProps = {
3979
3975
  var PersistAsyncBlobSchema_default = PersistAsyncBlobSchema;
3980
3976
 
3981
3977
  // src/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.tsx
3982
- var import_jsx_runtime28 = require("react/jsx-runtime");
3978
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3983
3979
  var PersistAsyncSchema = (props) => {
3984
3980
  const { schema } = props;
3985
3981
  const persistAsyncSchemaType = schema.persistAsync.schema.type;
3986
3982
  if (persistAsyncSchemaType === "blob") {
3987
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3983
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3988
3984
  PersistAsyncBlobSchema_default,
3989
3985
  __spreadValues({}, props)
3990
3986
  );
3991
3987
  }
3992
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
3988
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PersistAsyncBasicSchema_default, __spreadValues({}, props));
3993
3989
  };
3994
3990
  PersistAsyncSchema.defaultProps = {
3995
3991
  required: false
@@ -4009,8 +4005,8 @@ var getSelectionFromModel = (schema, model) => {
4009
4005
  };
4010
4006
 
4011
4007
  // src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfCheckboxControl.tsx
4012
- var import_components11 = require("@transferwise/components");
4013
- var import_jsx_runtime29 = require("react/jsx-runtime");
4008
+ var import_components12 = require("@transferwise/components");
4009
+ var import_jsx_runtime30 = require("react/jsx-runtime");
4014
4010
  var PromotedOneOfCheckboxControl = (props) => {
4015
4011
  const { id, selection, setSelection } = props;
4016
4012
  const { promoted, other, checkedMeans } = props.promotion;
@@ -4021,14 +4017,14 @@ var PromotedOneOfCheckboxControl = (props) => {
4021
4017
  const toggleSelection = () => {
4022
4018
  setSelection(checked ? selectionWhenUnchecked : selectionWhenChecked);
4023
4019
  };
4024
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components11.Checkbox, { id, label: title, checked, onChange: toggleSelection }) });
4020
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("div", { className: "form-group", children: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(import_components12.Checkbox, { id, label: title, checked, onChange: toggleSelection }) });
4025
4021
  };
4026
4022
  PromotedOneOfCheckboxControl.defaultProps = {};
4027
4023
  var PromotedOneOfCheckboxControl_default = PromotedOneOfCheckboxControl;
4028
4024
 
4029
4025
  // src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfRadioControl.tsx
4030
- var import_components12 = require("@transferwise/components");
4031
- var import_jsx_runtime30 = require("react/jsx-runtime");
4026
+ var import_components13 = require("@transferwise/components");
4027
+ var import_jsx_runtime31 = require("react/jsx-runtime");
4032
4028
  var PromotedOneOfRadioControl = (props) => {
4033
4029
  var _a, _b;
4034
4030
  const { id, selection, setSelection, promotion, promotedOneOf, title } = props;
@@ -4045,10 +4041,10 @@ var PromotedOneOfRadioControl = (props) => {
4045
4041
  secondary: promotion.other.description
4046
4042
  }, getAvatarPropertyForRadioOption(promotion.other))
4047
4043
  ];
4048
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("div", { className: "form-group", children: [
4049
- title && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("label", { className: "control-label", htmlFor: id, children: title }),
4050
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
4051
- import_components12.RadioGroup,
4044
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("div", { className: "form-group", children: [
4045
+ title && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("label", { className: "control-label", htmlFor: id, children: title }),
4046
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
4047
+ import_components13.RadioGroup,
4052
4048
  {
4053
4049
  name: "promoted-selection",
4054
4050
  selectedValue: selection,
@@ -4065,16 +4061,16 @@ PromotedOneOfRadioControl.defaultProps = {
4065
4061
  var PromotedOneOfRadioControl_default = PromotedOneOfRadioControl;
4066
4062
 
4067
4063
  // src/jsonSchemaForm/promotedOneOfSchema/promotedOneOfControl/PromotedOneOfControl.tsx
4068
- var import_jsx_runtime31 = require("react/jsx-runtime");
4064
+ var import_jsx_runtime32 = require("react/jsx-runtime");
4069
4065
  var PromotedOneOfControl = (props) => {
4070
4066
  const controlType = props.promotion.control || "radio";
4071
4067
  switch (controlType) {
4072
4068
  case "radio":
4073
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PromotedOneOfRadioControl_default, __spreadValues({}, props));
4069
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PromotedOneOfRadioControl_default, __spreadValues({}, props));
4074
4070
  case "checkbox":
4075
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
4071
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(PromotedOneOfCheckboxControl_default, __spreadValues({}, props));
4076
4072
  default:
4077
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, {});
4073
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, {});
4078
4074
  }
4079
4075
  };
4080
4076
  PromotedOneOfControl.defaultProps = {
@@ -4084,7 +4080,7 @@ PromotedOneOfControl.defaultProps = {
4084
4080
  var PromotedOneOfControl_default = PromotedOneOfControl;
4085
4081
 
4086
4082
  // src/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
4087
- var import_jsx_runtime32 = require("react/jsx-runtime");
4083
+ var import_jsx_runtime33 = require("react/jsx-runtime");
4088
4084
  var isPromoted = (schema) => schema.promoted === true;
4089
4085
  var PromotedOneOfSchema = (props) => {
4090
4086
  var _a;
@@ -4095,9 +4091,9 @@ var PromotedOneOfSchema = (props) => {
4095
4091
  const promotedOneOf = props.schema.oneOf.find(isPromoted);
4096
4092
  const promotedObjectSchema = getPromotedObjectSchema(promotedOneOf);
4097
4093
  const otherOneOf = getOtherOneOf(props.schema);
4098
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(import_jsx_runtime32.Fragment, { children: [
4099
- promotedAlert && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(DynamicAlert_default, { component: promotedAlert }),
4100
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
4094
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4095
+ promotedAlert && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(DynamicAlert_default, { component: promotedAlert }),
4096
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
4101
4097
  PromotedOneOfControl_default,
4102
4098
  {
4103
4099
  id: props.schema.$id,
@@ -4108,8 +4104,8 @@ var PromotedOneOfSchema = (props) => {
4108
4104
  setSelection
4109
4105
  }
4110
4106
  ),
4111
- selection === "promoted" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(ObjectSchema_default, __spreadProps(__spreadValues({}, props), { schema: promotedObjectSchema })),
4112
- selection === "other" && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(GenericSchema_default, __spreadProps(__spreadValues({}, props), { schema: otherOneOf }))
4107
+ selection === "promoted" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(ObjectSchema_default, __spreadProps(__spreadValues({}, props), { schema: promotedObjectSchema })),
4108
+ selection === "other" && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(GenericSchema_default, __spreadProps(__spreadValues({}, props), { schema: otherOneOf }))
4113
4109
  ] });
4114
4110
  };
4115
4111
  function getPromotedObjectSchema(promotedSchema) {
@@ -4139,7 +4135,7 @@ function getOtherOneOf(schema) {
4139
4135
  var PromotedOneOfSchema_default = PromotedOneOfSchema;
4140
4136
 
4141
4137
  // src/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
4142
- var import_components13 = require("@transferwise/components");
4138
+ var import_components14 = require("@transferwise/components");
4143
4139
  var import_react_intl12 = require("react-intl");
4144
4140
 
4145
4141
  // src/jsonSchemaForm/readOnlySchema/ReadOnlySchema.messages.js
@@ -4158,12 +4154,12 @@ var ReadOnlySchema_messages_default = (0, import_react_intl11.defineMessages)({
4158
4154
  });
4159
4155
 
4160
4156
  // src/jsonSchemaForm/readOnlySchema/ReadOnlySchema.tsx
4161
- var import_jsx_runtime33 = require("react/jsx-runtime");
4157
+ var import_jsx_runtime34 = require("react/jsx-runtime");
4162
4158
  var ReadOnlySchema = ({ schema, model }) => {
4163
4159
  const { title = "" } = schema;
4164
4160
  const { formatMessage } = (0, import_react_intl12.useIntl)();
4165
4161
  const value = getValueForSchema({ schema, model, formatMessage });
4166
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_components13.DefinitionList, { layout: import_components13.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
4162
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_components14.DefinitionList, { layout: import_components14.Layout.VERTICAL_ONE_COLUMN, definitions: [{ title, value, key: "" }] });
4167
4163
  };
4168
4164
  var ReadOnlySchema_default = ReadOnlySchema;
4169
4165
  function getValueForSchema({
@@ -4196,7 +4192,7 @@ function getSelectedOneOf(schema, model) {
4196
4192
  function getValueFromOption(option) {
4197
4193
  const text = option.title && option.description ? `${option.title} - ${option.description}` : option.title || "";
4198
4194
  const icon = getAvatarPropertyForRadioOption({ icon: option.icon });
4199
- return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
4195
+ return (icon == null ? void 0 : icon.avatar) ? /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(import_jsx_runtime34.Fragment, { children: [
4200
4196
  icon.avatar,
4201
4197
  " ",
4202
4198
  text
@@ -4205,7 +4201,7 @@ function getValueFromOption(option) {
4205
4201
 
4206
4202
  // src/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
4207
4203
  var import_react19 = require("react");
4208
- var import_jsx_runtime34 = require("react/jsx-runtime");
4204
+ var import_jsx_runtime35 = require("react/jsx-runtime");
4209
4205
  var ValidationAsyncSchema = (props) => {
4210
4206
  const { schema, model, required, submitted, errors, onChange } = props;
4211
4207
  const [validationAsyncModel, setValidationAsyncModel] = (0, import_react19.useState)(model);
@@ -4291,13 +4287,13 @@ var ValidationAsyncSchema = (props) => {
4291
4287
  required,
4292
4288
  schema
4293
4289
  };
4294
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
4290
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeSchemaProps));
4295
4291
  };
4296
4292
  ValidationAsyncSchema.defaultProps = { required: false };
4297
4293
  var ValidationAsyncSchema_default = ValidationAsyncSchema;
4298
4294
 
4299
4295
  // src/jsonSchemaForm/genericSchema/GenericSchema.tsx
4300
- var import_jsx_runtime35 = require("react/jsx-runtime");
4296
+ var import_jsx_runtime36 = require("react/jsx-runtime");
4301
4297
  var import_react21 = require("react");
4302
4298
  var GenericSchemaForm = (props) => {
4303
4299
  const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
@@ -4314,27 +4310,27 @@ var GenericSchemaForm = (props) => {
4314
4310
  }, [JSON.stringify(schema), JSON.stringify(model), JSON.stringify(errors), type, log]);
4315
4311
  switch (type) {
4316
4312
  case "readOnly":
4317
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ReadOnlySchema_default, __spreadValues({}, schemaProps));
4313
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ReadOnlySchema_default, __spreadValues({}, schemaProps));
4318
4314
  case "persistAsync":
4319
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PersistAsyncSchema_default, __spreadValues({}, schemaProps));
4315
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PersistAsyncSchema_default, __spreadValues({}, schemaProps));
4320
4316
  case "validationAsync":
4321
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
4317
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ValidationAsyncSchema_default, __spreadValues({}, schemaProps));
4322
4318
  case "basic": {
4323
4319
  const basicTypeProps = __spreadValues({ infoMessage: null }, schemaProps);
4324
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
4320
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
4325
4321
  }
4326
4322
  case "object":
4327
4323
  return /* @__PURE__ */ (0, import_react21.createElement)(ObjectSchema_default, __spreadProps(__spreadValues({}, schemaProps), { key: JSON.stringify(schema) }));
4328
4324
  case "array":
4329
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ArraySchema_default, __spreadValues({}, schemaProps));
4325
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(ArraySchema_default, __spreadValues({}, schemaProps));
4330
4326
  case "promotedOneOf":
4331
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(PromotedOneOfSchema_default, __spreadValues({}, schemaProps));
4327
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(PromotedOneOfSchema_default, __spreadValues({}, schemaProps));
4332
4328
  case "oneOf":
4333
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(OneOfSchema_default, __spreadValues({}, schemaProps));
4329
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(OneOfSchema_default, __spreadValues({}, schemaProps));
4334
4330
  case "allOf":
4335
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(AllOfSchema_default, __spreadValues({}, schemaProps));
4331
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AllOfSchema_default, __spreadValues({}, schemaProps));
4336
4332
  }
4337
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, {});
4333
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(import_jsx_runtime36.Fragment, {});
4338
4334
  };
4339
4335
  var GenericSchema_default = GenericSchemaForm;
4340
4336
  var isValidGenericSchema = (schema, model, errors) => {
@@ -4361,7 +4357,7 @@ var isValidGenericSchema = (schema, model, errors) => {
4361
4357
  };
4362
4358
 
4363
4359
  // src/jsonSchemaForm/JsonSchemaForm.tsx
4364
- var import_jsx_runtime36 = require("react/jsx-runtime");
4360
+ var import_jsx_runtime37 = require("react/jsx-runtime");
4365
4361
  var JsonSchemaForm = (props) => {
4366
4362
  const schemaProps = __spreadValues({
4367
4363
  model: null,
@@ -4370,26 +4366,26 @@ var JsonSchemaForm = (props) => {
4370
4366
  baseUrl: ""
4371
4367
  }, props);
4372
4368
  if (useHasHttpClientProvider() || schemaProps.baseUrl == null) {
4373
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(GenericSchema_default, __spreadValues({}, schemaProps));
4369
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(GenericSchema_default, __spreadValues({}, schemaProps));
4374
4370
  }
4375
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4371
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4376
4372
  Providers,
4377
4373
  {
4378
4374
  baseUrl: schemaProps.baseUrl,
4379
4375
  onEvent: schemaProps.onEvent,
4380
4376
  onLog: schemaProps.onLog,
4381
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(GenericSchema_default, __spreadValues({}, schemaProps))
4377
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(GenericSchema_default, __spreadValues({}, schemaProps))
4382
4378
  }
4383
4379
  );
4384
4380
  };
4385
4381
  var JsonSchemaForm_default = JsonSchemaForm;
4386
4382
  var Providers = ({ baseUrl, onEvent, onLog, children }) => {
4387
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog: onLog != null ? onLog : noop2, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
4383
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(LogProvider, { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm", onLog: onLog != null ? onLog : noop2, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4388
4384
  EventsContextProvider,
4389
4385
  {
4390
4386
  metadata: { flowId: "JsonSchemaForm", stepId: "JsonSchemaForm" },
4391
4387
  onEvent: onEvent != null ? onEvent : noop2,
4392
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children })
4388
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children })
4393
4389
  }
4394
4390
  ) });
4395
4391
  };
@@ -4397,11 +4393,11 @@ var noop2 = () => {
4397
4393
  };
4398
4394
 
4399
4395
  // src/layout/form/DynamicForm.tsx
4400
- var import_jsx_runtime37 = require("react/jsx-runtime");
4396
+ var import_jsx_runtime38 = require("react/jsx-runtime");
4401
4397
  var DynamicForm = (props) => {
4402
4398
  const form = props.component;
4403
4399
  const formSchema = form.schema;
4404
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: getMarginBottom(form.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4400
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: getMarginBottom(form.margin || "md"), children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
4405
4401
  JsonSchemaForm_default,
4406
4402
  {
4407
4403
  schema: formSchema,
@@ -4418,41 +4414,41 @@ var DynamicForm = (props) => {
4418
4414
  var DynamicForm_default = DynamicForm;
4419
4415
 
4420
4416
  // src/layout/heading/DynamicHeading.tsx
4421
- var import_jsx_runtime38 = require("react/jsx-runtime");
4417
+ var import_jsx_runtime39 = require("react/jsx-runtime");
4422
4418
  var DynamicHeading = (props) => {
4423
4419
  const { text, size = "md", align = "left", margin = "md" } = props.component;
4424
4420
  const classes = getTextAlignmentAndMargin({ align, margin });
4425
4421
  switch (size) {
4426
4422
  case "xs":
4427
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h5", { className: classes, children: text });
4423
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h5", { className: classes, children: text });
4428
4424
  case "sm":
4429
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h4", { className: classes, children: text });
4425
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h4", { className: classes, children: text });
4430
4426
  case "lg":
4431
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h2", { className: classes, children: text });
4427
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h2", { className: classes, children: text });
4432
4428
  case "xl":
4433
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h1", { className: classes, children: text });
4429
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h1", { className: classes, children: text });
4434
4430
  case "md":
4435
4431
  default:
4436
- return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h3", { className: classes, children: text });
4432
+ return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("h3", { className: classes, children: text });
4437
4433
  }
4438
4434
  };
4439
4435
  var DynamicHeading_default = DynamicHeading;
4440
4436
 
4441
4437
  // src/layout/markdown/DynamicMarkdown.tsx
4442
- var import_components14 = require("@transferwise/components");
4443
- var import_jsx_runtime39 = require("react/jsx-runtime");
4438
+ var import_components15 = require("@transferwise/components");
4439
+ var import_jsx_runtime40 = require("react/jsx-runtime");
4444
4440
  var DynamicMarkdown = ({ component }) => {
4445
4441
  const { content, align, margin } = component;
4446
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components14.Markdown, { config: { link: { target: "_blank" } }, children: content }) });
4442
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: getTextAlignmentAndMargin({ align, margin }), children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components15.Markdown, { config: { link: { target: "_blank" } }, children: content }) });
4447
4443
  };
4448
4444
  var DynamicInfo = ({ component }) => {
4449
- return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: getTextAlignmentAndMargin(component), children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_components14.Markdown, { config: { link: { target: "_blank" } }, children: component.markdown }) });
4445
+ return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: getTextAlignmentAndMargin(component), children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components15.Markdown, { config: { link: { target: "_blank" } }, children: component.markdown }) });
4450
4446
  };
4451
4447
 
4452
4448
  // src/layout/image/DynamicImage.tsx
4453
- var import_components15 = require("@transferwise/components");
4449
+ var import_components16 = require("@transferwise/components");
4454
4450
  var import_react22 = require("react");
4455
- var import_jsx_runtime40 = require("react/jsx-runtime");
4451
+ var import_jsx_runtime41 = require("react/jsx-runtime");
4456
4452
  var DynamicImage = ({ component: image }) => {
4457
4453
  const { url, size, text, margin } = image;
4458
4454
  const httpClient = useHttpClient();
@@ -4469,7 +4465,7 @@ var DynamicImage = ({ component: image }) => {
4469
4465
  if (!imageSource) {
4470
4466
  return null;
4471
4467
  }
4472
- return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_components15.Image, __spreadValues({ className: `img-responsive ${getMarginBottom(margin || "md")}` }, imageProps)) });
4468
+ return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: `df-image ${size || "md"}`, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components16.Image, __spreadValues({ className: `img-responsive ${getMarginBottom(margin || "md")}` }, imageProps)) });
4473
4469
  };
4474
4470
  var readImageBlobAsDataURL = (imageBlob) => {
4475
4471
  return new Promise((resolve, reject) => {
@@ -4502,48 +4498,48 @@ var getImageSource = async (httpClient, imageUrl) => {
4502
4498
  var DynamicImage_default = DynamicImage;
4503
4499
 
4504
4500
  // src/layout/instructions/DynamicInstructions.tsx
4505
- var import_components16 = require("@transferwise/components");
4506
- var import_jsx_runtime41 = require("react/jsx-runtime");
4501
+ var import_components17 = require("@transferwise/components");
4502
+ var import_jsx_runtime42 = require("react/jsx-runtime");
4507
4503
  var doContext = ["positive", "neutral"];
4508
4504
  var dontContext = ["warning", "negative"];
4509
4505
  var DynamicInstructions = ({ component }) => {
4510
4506
  const { items } = component;
4511
4507
  const dos = items.filter((item) => doContext.includes(item.context)).map(({ text }) => text);
4512
4508
  const donts = items.filter((item) => dontContext.includes(item.context)).map(({ text }) => text);
4513
- return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)("div", { className: getMarginBottom(component.margin || "md"), children: [
4514
- component.title ? /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components16.Header, { title: component.title }) : null,
4515
- /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(import_components16.InstructionsList, { dos, donts })
4509
+ return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: getMarginBottom(component.margin || "md"), children: [
4510
+ component.title ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components17.Header, { title: component.title }) : null,
4511
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_components17.InstructionsList, { dos, donts })
4516
4512
  ] });
4517
4513
  };
4518
4514
  var DynamicInstructions_default = DynamicInstructions;
4519
4515
 
4520
4516
  // src/layout/DynamicLayout.tsx
4521
- var import_jsx_runtime42 = require("react/jsx-runtime");
4517
+ var import_jsx_runtime43 = require("react/jsx-runtime");
4522
4518
  var getKey = (component) => JSON.stringify(component);
4523
4519
  var DynamicLayout = (props) => {
4524
4520
  const { components, model, submitted, errors, onModelChange, onAction, onPersistAsync, baseUrl } = props;
4525
4521
  const renderComponent = (component) => {
4526
4522
  switch (component.type) {
4527
4523
  case "heading":
4528
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicHeading_default, { component }, getKey(component));
4524
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicHeading_default, { component }, getKey(component));
4529
4525
  case "paragraph":
4530
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicParagraph_default, { component }, getKey(component));
4526
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicParagraph_default, { component }, getKey(component));
4531
4527
  case "image":
4532
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicImage_default, { component }, getKey(component));
4528
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicImage_default, { component }, getKey(component));
4533
4529
  case "alert":
4534
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicAlert_default, { component }, getKey(component));
4530
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicAlert_default, { component }, getKey(component));
4535
4531
  case "review":
4536
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
4532
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicReview_default, { component, onAction }, getKey(component));
4537
4533
  case "divider":
4538
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicDivider_default, { component }, getKey(component));
4534
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicDivider_default, { component }, getKey(component));
4539
4535
  case "info":
4540
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicInfo, { component }, getKey(component));
4536
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicInfo, { component }, getKey(component));
4541
4537
  case "instructions":
4542
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicInstructions_default, { component }, getKey(component));
4538
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicInstructions_default, { component }, getKey(component));
4543
4539
  case "markdown":
4544
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicMarkdown, { component }, getKey(component));
4540
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicMarkdown, { component }, getKey(component));
4545
4541
  case "columns":
4546
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4542
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4547
4543
  DynamicColumns_default,
4548
4544
  {
4549
4545
  component,
@@ -4557,7 +4553,7 @@ var DynamicLayout = (props) => {
4557
4553
  getKey(component)
4558
4554
  );
4559
4555
  case "form":
4560
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4556
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4561
4557
  DynamicForm_default,
4562
4558
  {
4563
4559
  component,
@@ -4570,9 +4566,9 @@ var DynamicLayout = (props) => {
4570
4566
  getKey(__spreadProps(__spreadValues({}, component), { errors: errors != null ? errors : null }))
4571
4567
  );
4572
4568
  case "button":
4573
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
4569
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicButton_default, { component, onAction }, getKey(component));
4574
4570
  case "box":
4575
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
4571
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
4576
4572
  DynamicBox_default,
4577
4573
  {
4578
4574
  component,
@@ -4586,32 +4582,34 @@ var DynamicLayout = (props) => {
4586
4582
  getKey(component)
4587
4583
  );
4588
4584
  case "decision":
4589
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
4585
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicDecision_default, { component, onAction }, getKey(component));
4590
4586
  case "external":
4591
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
4587
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicExternal_default, { component, onAction }, getKey(component));
4592
4588
  case "list":
4593
4589
  case "status-list":
4594
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicStatusList_default, { component, onAction }, getKey(component));
4590
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicStatusList_default, { component, onAction }, getKey(component));
4595
4591
  case "loading-indicator":
4596
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
4592
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicLoadingIndicator_default, { component }, getKey(component));
4593
+ case "search":
4594
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicSearch_default, { component, onAction }, getKey(component));
4597
4595
  default:
4598
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", {}, getKey(component));
4596
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", {}, getKey(component));
4599
4597
  }
4600
4598
  };
4601
4599
  if (useHasHttpClientProvider() || baseUrl == null) {
4602
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_jsx_runtime42.Fragment, { children: components.map(renderComponent) });
4600
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_jsx_runtime43.Fragment, { children: components.map(renderComponent) });
4603
4601
  } else {
4604
- return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
4602
+ return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(HttpClientProviderFromBaseUrl, { baseUrl, children: components.map(renderComponent) });
4605
4603
  }
4606
4604
  };
4607
4605
  var DynamicLayout_default = DynamicLayout;
4608
4606
 
4609
4607
  // src/layout/list/DynamicStatusList.tsx
4610
- var import_components17 = require("@transferwise/components");
4611
- var import_jsx_runtime43 = require("react/jsx-runtime");
4608
+ var import_components18 = require("@transferwise/components");
4609
+ var import_jsx_runtime44 = require("react/jsx-runtime");
4612
4610
  var DynamicStatusList = ({ component }) => {
4613
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: getMarginBottom(component.margin || "md"), children: [
4614
- component.title ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("h4", { className: "m-b-2", children: [
4611
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: getMarginBottom(component.margin || "md"), children: [
4612
+ component.title ? /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("h4", { className: "m-b-2", children: [
4615
4613
  " ",
4616
4614
  component.title,
4617
4615
  " "
@@ -4624,8 +4622,8 @@ var mapListItemToSummary = ({ title, description, icon, status }) => {
4624
4622
  key: `${title}/${description || ""}`,
4625
4623
  title,
4626
4624
  description
4627
- }, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(DynamicIcon_default, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
4628
- return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_components17.Summary, __spreadValues({}, props));
4625
+ }, (icon == null ? void 0 : icon.name) ? { icon: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(DynamicIcon_default, { type: icon.name }) } : {}), status ? { status: statusMap[status] } : {});
4626
+ return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_components18.Summary, __spreadValues({}, props));
4629
4627
  };
4630
4628
  var statusListMap = {
4631
4629
  done: "done",
@@ -4641,12 +4639,12 @@ var statusMap = __spreadValues(__spreadValues({}, statusListMap), legacyStatusMa
4641
4639
  var DynamicStatusList_default = DynamicStatusList;
4642
4640
 
4643
4641
  // src/layout/loadingIndicator/DynamicLoadingIndicator.tsx
4644
- var import_components18 = require("@transferwise/components");
4645
- var import_jsx_runtime44 = require("react/jsx-runtime");
4642
+ var import_components19 = require("@transferwise/components");
4643
+ var import_jsx_runtime45 = require("react/jsx-runtime");
4646
4644
  var DynamicLoadingIndicator = ({ component }) => {
4647
4645
  const { margin, size = "md" } = component;
4648
- return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
4649
- import_components18.Loader,
4646
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4647
+ import_components19.Loader,
4650
4648
  {
4651
4649
  size,
4652
4650
  classNames: {
@@ -4659,7 +4657,7 @@ var DynamicLoadingIndicator = ({ component }) => {
4659
4657
  var DynamicLoadingIndicator_default = DynamicLoadingIndicator;
4660
4658
 
4661
4659
  // src/layout/paragraph/DynamicParagraph.tsx
4662
- var import_components20 = require("@transferwise/components");
4660
+ var import_components21 = require("@transferwise/components");
4663
4661
  var import_react_intl14 = require("react-intl");
4664
4662
 
4665
4663
  // src/layout/paragraph/DynamicParagraph.messages.ts
@@ -4678,19 +4676,19 @@ var DynamicParagraph_messages_default = (0, import_react_intl13.defineMessages)(
4678
4676
  });
4679
4677
 
4680
4678
  // src/layout/paragraph/useSnackBarIfAvailable.ts
4681
- var import_components19 = require("@transferwise/components");
4679
+ var import_components20 = require("@transferwise/components");
4682
4680
  var import_react23 = require("react");
4683
4681
  function useSnackBarIfAvailable() {
4684
- const context = (0, import_react23.useContext)(import_components19.SnackbarContext);
4682
+ const context = (0, import_react23.useContext)(import_components20.SnackbarContext);
4685
4683
  return context ? context.createSnackbar : noop3;
4686
4684
  }
4687
4685
  function noop3() {
4688
4686
  }
4689
4687
 
4690
4688
  // src/layout/paragraph/DynamicParagraph.tsx
4691
- var import_jsx_runtime45 = require("react/jsx-runtime");
4692
- var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(BasicDynamicParagraph, { component });
4693
- var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("p", { className: getTextAlignmentAndMargin(component), children: [
4689
+ var import_jsx_runtime46 = require("react/jsx-runtime");
4690
+ var DynamicParagraph = ({ component }) => component.control === "copyable" ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(CopyableDynamicParagraph, { component }) : /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(BasicDynamicParagraph, { component });
4691
+ var BasicDynamicParagraph = ({ component }) => /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("p", { className: getTextAlignmentAndMargin(component), children: [
4694
4692
  " ",
4695
4693
  component.text,
4696
4694
  " "
@@ -4704,8 +4702,8 @@ var CopyableDynamicParagraph = ({ component }) => {
4704
4702
  (_a = navigator.clipboard) == null ? void 0 : _a.writeText(text).then(() => createSnackbar({ text: formatMessage(DynamicParagraph_messages_default.copied) })).catch(noop4);
4705
4703
  };
4706
4704
  const classNames7 = getTextAlignmentAndMargin({ align: component.align, margin: "sm" }) + " form-control";
4707
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
4708
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
4705
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("div", { className: getTextAlignmentAndMargin(component), children: [
4706
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
4709
4707
  "input",
4710
4708
  {
4711
4709
  type: "text",
@@ -4715,7 +4713,7 @@ var CopyableDynamicParagraph = ({ component }) => {
4715
4713
  style: { textOverflow: "ellipsis" }
4716
4714
  }
4717
4715
  ),
4718
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_components20.Button, { block: true, onClick: copy, children: formatMessage(DynamicParagraph_messages_default.copy) })
4716
+ /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_components21.Button, { block: true, onClick: copy, children: formatMessage(DynamicParagraph_messages_default.copy) })
4719
4717
  ] });
4720
4718
  };
4721
4719
  function noop4() {
@@ -4723,8 +4721,8 @@ function noop4() {
4723
4721
  var DynamicParagraph_default = DynamicParagraph;
4724
4722
 
4725
4723
  // src/layout/review/DynamicReview.tsx
4726
- var import_components21 = require("@transferwise/components");
4727
- var import_jsx_runtime46 = require("react/jsx-runtime");
4724
+ var import_components22 = require("@transferwise/components");
4725
+ var import_jsx_runtime47 = require("react/jsx-runtime");
4728
4726
  var mapFieldsToDefinitions = ({ label, value }, index) => {
4729
4727
  return { key: String(index), title: label, value };
4730
4728
  };
@@ -4736,7 +4734,7 @@ var DynamicReview = (props) => {
4736
4734
  const review = props.component;
4737
4735
  const margin = getMarginBottom(review.margin || "xs");
4738
4736
  const getReviewAction = (action) => {
4739
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
4737
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
4740
4738
  "a",
4741
4739
  {
4742
4740
  href: action.url,
@@ -4750,13 +4748,13 @@ var DynamicReview = (props) => {
4750
4748
  }
4751
4749
  );
4752
4750
  };
4753
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
4754
- review.title && /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)("h6", { className: "m-b-2", children: [
4751
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
4752
+ review.title && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("h6", { className: "m-b-2", children: [
4755
4753
  review.title,
4756
4754
  review.action && getReviewAction(review.action)
4757
4755
  ] }),
4758
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(
4759
- import_components21.DefinitionList,
4756
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("div", { className: margin, children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
4757
+ import_components22.DefinitionList,
4760
4758
  {
4761
4759
  layout: getReviewLayout(review),
4762
4760
  definitions: review.fields.map(mapFieldsToDefinitions)
@@ -4766,8 +4764,176 @@ var DynamicReview = (props) => {
4766
4764
  };
4767
4765
  var DynamicReview_default = DynamicReview;
4768
4766
 
4767
+ // src/layout/search/DynamicSearch.tsx
4768
+ var import_react25 = require("react");
4769
+
4770
+ // src/layout/search/SearchInput.tsx
4771
+ var import_components23 = require("@transferwise/components");
4772
+ var import_jsx_runtime48 = require("react/jsx-runtime");
4773
+ var SearchInput = ({ title, value, onChange }) => {
4774
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)("label", { className: "control-label d-inline", children: [
4775
+ title,
4776
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_components23.Input, { type: "text", value, onChange: (event) => onChange(event.currentTarget.value) })
4777
+ ] });
4778
+ };
4779
+
4780
+ // src/layout/search/SearchResults.tsx
4781
+ var import_components24 = require("@transferwise/components");
4782
+ var import_react_intl16 = require("react-intl");
4783
+
4784
+ // src/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.ts
4785
+ var import_react_intl15 = require("react-intl");
4786
+ var ErrorBoundary_messages_default = (0, import_react_intl15.defineMessages)({
4787
+ errorAlert: {
4788
+ id: "dynamicFlows.ErrorBoundary.errorAlert",
4789
+ defaultMessage: "Oops. Something went wrong...",
4790
+ description: "Generic error message for when something has gone wrong."
4791
+ },
4792
+ retry: {
4793
+ id: "dynamicFlows.ErrorBoundary.retry",
4794
+ defaultMessage: "Retry",
4795
+ description: "Usually this follows the generic error and contains a link."
4796
+ }
4797
+ });
4798
+
4799
+ // src/layout/search/SearchResults.tsx
4800
+ var import_jsx_runtime49 = require("react/jsx-runtime");
4801
+ var SearchResults = ({ results, emptyMessage, onSelect }) => {
4802
+ if (results.length === 0) {
4803
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { className: "m-t-2", children: emptyMessage });
4804
+ }
4805
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_components24.NavigationOptionsList, { children: results.map((result) => {
4806
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
4807
+ import_components24.NavigationOption,
4808
+ {
4809
+ title: result.title,
4810
+ content: result.description,
4811
+ media: getNavigationOptionMedia(result),
4812
+ showMediaCircle: false,
4813
+ showMediaAtAllSizes: true,
4814
+ onClick: () => onSelect(result)
4815
+ },
4816
+ JSON.stringify(result)
4817
+ );
4818
+ }) });
4819
+ };
4820
+ var ErrorResult = ({ onRetrySearch }) => {
4821
+ const intl = (0, import_react_intl16.useIntl)();
4822
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("p", { className: "m-t-2", children: [
4823
+ intl.formatMessage(ErrorBoundary_messages_default.errorAlert),
4824
+ "\xA0",
4825
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
4826
+ "a",
4827
+ {
4828
+ href: "/",
4829
+ onClick: (e) => {
4830
+ e.preventDefault();
4831
+ onRetrySearch();
4832
+ },
4833
+ children: intl.formatMessage(ErrorBoundary_messages_default.retry)
4834
+ }
4835
+ )
4836
+ ] });
4837
+ };
4838
+
4839
+ // src/layout/search/useSearch.tsx
4840
+ var import_react24 = require("react");
4841
+ var headers = { "Content-Type": "application/json" };
4842
+ var useSearch = (defaultSearchConfig) => {
4843
+ const [state, setState] = (0, import_react24.useState)({
4844
+ status: "idle"
4845
+ });
4846
+ const abortControllerRef = (0, import_react24.useRef)(null);
4847
+ const httpClient = useHttpClient();
4848
+ const search = (0, import_react24.useCallback)(
4849
+ async (query, { url, method, param } = defaultSearchConfig) => {
4850
+ var _a;
4851
+ (_a = abortControllerRef.current) == null ? void 0 : _a.abort();
4852
+ if (!query) {
4853
+ setState({ status: "idle" });
4854
+ return;
4855
+ }
4856
+ abortControllerRef.current = new AbortController();
4857
+ const signal = abortControllerRef.current.signal;
4858
+ setState({ status: "loading" });
4859
+ try {
4860
+ const resolvedUrl = method === "GET" ? `${url}?${param}=${encodeURIComponent(query)}` : url;
4861
+ const extraParams = method === "GET" ? {} : { body: JSON.stringify({ [param]: query }) };
4862
+ const response = await httpClient(resolvedUrl, __spreadValues({
4863
+ method,
4864
+ signal,
4865
+ headers
4866
+ }, extraParams));
4867
+ void handleResponse(response, query);
4868
+ } catch (error) {
4869
+ void handleError(error, query);
4870
+ }
4871
+ },
4872
+ // eslint-disable-next-line react-hooks/exhaustive-deps
4873
+ [httpClient, JSON.stringify(defaultSearchConfig)]
4874
+ );
4875
+ const handleResponse = async (response, query) => {
4876
+ if (response.ok) {
4877
+ const body = await response.json().catch(() => null);
4878
+ if (isValidResponseBody(body)) {
4879
+ setState({ status: "success", results: body.results });
4880
+ return;
4881
+ }
4882
+ }
4883
+ setState({ status: "error" });
4884
+ };
4885
+ const handleError = (error, query) => {
4886
+ if (isAbortError(error) === false) {
4887
+ setState({ status: "error" });
4888
+ }
4889
+ };
4890
+ const results = state.status === "success" ? state.results : [];
4891
+ return { status: state.status, results, search };
4892
+ };
4893
+ var isValidResponseBody = (body) => {
4894
+ return isObject(body) && "results" in body && isArray(body.results) && body.results.every(
4895
+ (result) => isObject(result) && "title" in result && "type" in result && "value" in result
4896
+ );
4897
+ };
4898
+ var isAbortError = (error) => error instanceof DOMException && error.name === "AbortError";
4899
+
4900
+ // src/layout/search/DynamicSearch.tsx
4901
+ var import_jsx_runtime50 = require("react/jsx-runtime");
4902
+ var DEBOUNCE_TIME = 400;
4903
+ var DynamicSearch = ({ component, onAction }) => {
4904
+ const [query, setQuery] = (0, import_react25.useState)("");
4905
+ const { title, margin, url, method, param, emptyMessage } = component;
4906
+ const { status, results, search } = useSearch({ url, method, param });
4907
+ const debouncedSearch = (0, import_react25.useMemo)(() => debounce(search, DEBOUNCE_TIME), [search]);
4908
+ const onChange = (value) => {
4909
+ setQuery(value);
4910
+ debouncedSearch(value);
4911
+ };
4912
+ const onResultSelected = ({ type, value }) => {
4913
+ if (type === "action") {
4914
+ onAction(value);
4915
+ }
4916
+ if (type === "search") {
4917
+ setQuery(value.query);
4918
+ const { url: url2, method: method2, param: param2, query: query2 } = value;
4919
+ void search(query2, { url: url2, method: method2, param: param2 });
4920
+ }
4921
+ };
4922
+ const onRetrySearch = () => {
4923
+ setQuery(query);
4924
+ void search(query);
4925
+ };
4926
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: getMarginBottom(margin), children: [
4927
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SearchInput, { title, value: query, onChange }),
4928
+ status === "loading" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(DynamicLoadingIndicator_default, { component: { type: "loading-indicator", size: "sm" } }),
4929
+ status === "error" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(ErrorResult, { onRetrySearch }),
4930
+ status === "success" && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(SearchResults, { results, emptyMessage, onSelect: onResultSelected })
4931
+ ] });
4932
+ };
4933
+ var DynamicSearch_default = DynamicSearch;
4934
+
4769
4935
  // src/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
4770
- var import_jsx_runtime47 = require("react/jsx-runtime");
4936
+ var import_jsx_runtime51 = require("react/jsx-runtime");
4771
4937
  var isNullish = (value) => isNull(value) || isUndefined(value);
4772
4938
  var getDefaultValue = (schema) => {
4773
4939
  return schema.type === "boolean" && isNullish(schema.default) ? false : schema.default;
@@ -4804,13 +4970,13 @@ var BasicTypeSchema = (props) => {
4804
4970
  props.onBlur();
4805
4971
  }
4806
4972
  };
4807
- const [model, setModel] = (0, import_react24.useState)((_a = props.model) != null ? _a : null);
4808
- const [lastModel, setLastModel] = (0, import_react24.useState)((_b = props.model) != null ? _b : null);
4809
- const [changed, setChanged] = (0, import_react24.useState)(false);
4810
- const [focused, setFocused] = (0, import_react24.useState)(false);
4811
- const [blurred, setBlurred] = (0, import_react24.useState)(false);
4812
- const [validations, setValidations] = (0, import_react24.useState)([]);
4813
- const id = (0, import_react24.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
4973
+ const [model, setModel] = (0, import_react26.useState)((_a = props.model) != null ? _a : null);
4974
+ const [lastModel, setLastModel] = (0, import_react26.useState)((_b = props.model) != null ? _b : null);
4975
+ const [changed, setChanged] = (0, import_react26.useState)(false);
4976
+ const [focused, setFocused] = (0, import_react26.useState)(false);
4977
+ const [blurred, setBlurred] = (0, import_react26.useState)(false);
4978
+ const [validations, setValidations] = (0, import_react26.useState)([]);
4979
+ const id = (0, import_react26.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
4814
4980
  const onSchemaChange = () => {
4815
4981
  const defaultValue = getDefaultValue(props.schema);
4816
4982
  if (isNullish(model) && !isNullish(defaultValue)) {
@@ -4825,9 +4991,9 @@ var BasicTypeSchema = (props) => {
4825
4991
  };
4826
4992
  const isConst = props.schema.const;
4827
4993
  const isHidden = props.schema.hidden || isConst;
4828
- (0, import_react24.useEffect)(refreshValidations, [props.model, props.submitted]);
4829
- (0, import_react24.useEffect)(onSchemaChange, [props.schema]);
4830
- (0, import_react24.useEffect)(() => {
4994
+ (0, import_react26.useEffect)(refreshValidations, [props.model, props.submitted]);
4995
+ (0, import_react26.useEffect)(onSchemaChange, [props.schema]);
4996
+ (0, import_react26.useEffect)(() => {
4831
4997
  var _a2;
4832
4998
  const newModel = (_a2 = props.model) != null ? _a2 : null;
4833
4999
  if (newModel !== model) {
@@ -4841,15 +5007,15 @@ var BasicTypeSchema = (props) => {
4841
5007
  };
4842
5008
  const showLabel = props.schema.format !== "file" && props.schema.type !== "boolean";
4843
5009
  const schemaHelp = props.schema.help;
4844
- return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_jsx_runtime47.Fragment, { children: [
4845
- props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(DynamicAlert_default, { component: props.schema.alert }),
4846
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: (0, import_classnames6.default)(formGroupClasses), children: [
4847
- showLabel && /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)("div", { className: "d-inline-block", children: [
4848
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
4849
- !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Help_default, { help: schemaHelp })
5010
+ return !isHidden ? /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
5011
+ props.schema.alert && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(DynamicAlert_default, { component: props.schema.alert }),
5012
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: (0, import_classnames6.default)(formGroupClasses), children: [
5013
+ showLabel && /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("div", { className: "d-inline-block", children: [
5014
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("label", { className: "control-label d-inline", htmlFor: id, children: props.schema.title }),
5015
+ !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Help_default, { help: schemaHelp })
4850
5016
  ] }),
4851
- !showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Help_default, { help: schemaHelp }),
4852
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5017
+ !showLabel && !!schemaHelp && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(Help_default, { help: schemaHelp }),
5018
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
4853
5019
  SchemaFormControl_default,
4854
5020
  {
4855
5021
  id,
@@ -4861,7 +5027,7 @@ var BasicTypeSchema = (props) => {
4861
5027
  onBlur
4862
5028
  }
4863
5029
  ),
4864
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
5030
+ /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
4865
5031
  ControlFeedback_default,
4866
5032
  {
4867
5033
  changed,
@@ -4885,7 +5051,7 @@ BasicTypeSchema.defaultProps = {
4885
5051
  var BasicTypeSchema_default = BasicTypeSchema;
4886
5052
 
4887
5053
  // src/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
4888
- var import_jsx_runtime48 = require("react/jsx-runtime");
5054
+ var import_jsx_runtime52 = require("react/jsx-runtime");
4889
5055
  var getIdFromResponse = (idProperty, response) => {
4890
5056
  return response[idProperty];
4891
5057
  };
@@ -4902,15 +5068,15 @@ var controlTypesWithPersistOnChange = /* @__PURE__ */ new Set([
4902
5068
  ]);
4903
5069
  var PersistAsyncBasicSchema = (props) => {
4904
5070
  const { schema, required, submitted, errors, onChange, onPersistAsync } = props;
4905
- const intl = (0, import_react_intl15.useIntl)();
5071
+ const intl = (0, import_react_intl17.useIntl)();
4906
5072
  const httpClient = useHttpClient();
4907
5073
  const onEvent = useEventDispatcher();
4908
- const [persistAsyncModel, setPersistAsyncModel] = (0, import_react25.useState)(null);
5074
+ const [persistAsyncModel, setPersistAsyncModel] = (0, import_react27.useState)(null);
4909
5075
  const previousPersistAsyncModel = usePrevious(persistAsyncModel);
4910
- const [persistAsyncError, setPersistAsyncError] = (0, import_react25.useState)(null);
4911
- const [fieldSubmitted, setFieldSubmitted] = (0, import_react25.useState)(false);
4912
- const [abortController, setAbortController] = (0, import_react25.useState)(null);
4913
- (0, import_react25.useEffect)(() => {
5076
+ const [persistAsyncError, setPersistAsyncError] = (0, import_react27.useState)(null);
5077
+ const [fieldSubmitted, setFieldSubmitted] = (0, import_react27.useState)(false);
5078
+ const [abortController, setAbortController] = (0, import_react27.useState)(null);
5079
+ (0, import_react27.useEffect)(() => {
4914
5080
  if (controlTypesWithPersistOnChange.has(
4915
5081
  // TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
4916
5082
  getControlType(schema.persistAsync.schema)
@@ -4977,7 +5143,7 @@ var PersistAsyncBasicSchema = (props) => {
4977
5143
  setPersistAsyncModel(newPersistAsyncModel);
4978
5144
  }
4979
5145
  };
4980
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
5146
+ return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
4981
5147
  BasicTypeSchema_default,
4982
5148
  {
4983
5149
  required,
@@ -4998,9 +5164,9 @@ var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
4998
5164
 
4999
5165
  // src/common/hooks/usePersistAsync/usePersistAsync.ts
5000
5166
  var usePersistAsync = (persistAsync) => {
5001
- const [abortController, setAbortController] = (0, import_react26.useState)(null);
5167
+ const [abortController, setAbortController] = (0, import_react28.useState)(null);
5002
5168
  const httpClient = useHttpClient();
5003
- const intl = (0, import_react_intl16.useIntl)();
5169
+ const intl = (0, import_react_intl18.useIntl)();
5004
5170
  const { schema } = persistAsync;
5005
5171
  async function handlePersistAsync(model) {
5006
5172
  const isInvalidSchema = model instanceof Blob ? !isBlobSchema(schema) : !isValidSchema(model, schema);
@@ -5077,7 +5243,7 @@ function hasStringMessage(value) {
5077
5243
  }
5078
5244
 
5079
5245
  // src/common/hooks/usePolling/usePolling.tsx
5080
- var import_react27 = require("react");
5246
+ var import_react29 = require("react");
5081
5247
  function usePolling({
5082
5248
  asyncFn,
5083
5249
  interval,
@@ -5086,9 +5252,9 @@ function usePolling({
5086
5252
  onPollingResponse,
5087
5253
  onFailure
5088
5254
  }) {
5089
- const onPollingResponseReference = (0, import_react27.useRef)(onPollingResponse);
5090
- const onFailureReference = (0, import_react27.useRef)(onFailure);
5091
- const poll = (0, import_react27.useMemo)(
5255
+ const onPollingResponseReference = (0, import_react29.useRef)(onPollingResponse);
5256
+ const onFailureReference = (0, import_react29.useRef)(onFailure);
5257
+ const poll = (0, import_react29.useMemo)(
5092
5258
  () => createPollingClosure(
5093
5259
  asyncFn,
5094
5260
  maxAttempts,
@@ -5098,7 +5264,7 @@ function usePolling({
5098
5264
  ),
5099
5265
  [asyncFn, maxAttempts, maxConsecutiveFails]
5100
5266
  );
5101
- (0, import_react27.useEffect)(() => {
5267
+ (0, import_react29.useEffect)(() => {
5102
5268
  if (interval > 0) {
5103
5269
  const intervalReference = setInterval(() => {
5104
5270
  poll();
@@ -5106,7 +5272,7 @@ function usePolling({
5106
5272
  return () => clearInterval(intervalReference);
5107
5273
  }
5108
5274
  }, [poll, interval]);
5109
- (0, import_react27.useEffect)(() => {
5275
+ (0, import_react29.useEffect)(() => {
5110
5276
  onPollingResponseReference.current = onPollingResponse;
5111
5277
  onFailureReference.current = onFailure;
5112
5278
  }, [onPollingResponse, onFailure]);
@@ -5135,20 +5301,20 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
5135
5301
  }
5136
5302
 
5137
5303
  // src/common/hooks/usePrevious/usePrevious.js
5138
- var import_react28 = require("react");
5304
+ var import_react30 = require("react");
5139
5305
  var usePrevious = (value) => {
5140
- const reference = (0, import_react28.useRef)();
5141
- (0, import_react28.useEffect)(() => {
5306
+ const reference = (0, import_react30.useRef)();
5307
+ (0, import_react30.useEffect)(() => {
5142
5308
  reference.current = value;
5143
5309
  }, [value]);
5144
5310
  return reference.current;
5145
5311
  };
5146
5312
 
5147
5313
  // src/common/hooks/useStepPolling/useStepPolling.tsx
5148
- var import_react29 = require("react");
5314
+ var import_react31 = require("react");
5149
5315
  function useStepPolling(polling, onAction) {
5150
5316
  const httpClient = useHttpClient();
5151
- const asyncFn = (0, import_react29.useMemo)(() => {
5317
+ const asyncFn = (0, import_react31.useMemo)(() => {
5152
5318
  if (polling) {
5153
5319
  return () => {
5154
5320
  return httpClient(polling.url).then((response) => {
@@ -5163,7 +5329,7 @@ function useStepPolling(polling, onAction) {
5163
5329
  return void 0;
5164
5330
  }
5165
5331
  }, [polling, httpClient]);
5166
- const onPollingResponse = (0, import_react29.useCallback)(
5332
+ const onPollingResponse = (0, import_react31.useCallback)(
5167
5333
  (pollingResponse) => {
5168
5334
  if (pollingResponse == null ? void 0 : pollingResponse.action) {
5169
5335
  onAction(pollingResponse.action);
@@ -5179,7 +5345,7 @@ function useStepPolling(polling, onAction) {
5179
5345
  maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
5180
5346
  maxConsecutiveFails: 1,
5181
5347
  onPollingResponse,
5182
- onFailure: (0, import_react29.useCallback)(() => {
5348
+ onFailure: (0, import_react31.useCallback)(() => {
5183
5349
  if (polling) {
5184
5350
  onAction(polling.onError.action);
5185
5351
  }
@@ -5188,7 +5354,7 @@ function useStepPolling(polling, onAction) {
5188
5354
  }
5189
5355
 
5190
5356
  // src/step/layoutStep/LayoutStep.tsx
5191
- var import_jsx_runtime49 = require("react/jsx-runtime");
5357
+ var import_jsx_runtime53 = require("react/jsx-runtime");
5192
5358
  var getComponents = (step, options) => {
5193
5359
  var _a;
5194
5360
  if (isEmpty(step)) {
@@ -5211,7 +5377,7 @@ var LayoutStep = (props) => {
5211
5377
  onEvent("Dynamic Flow - onAction supressed", { reason: "LayoutStep - loading state" });
5212
5378
  };
5213
5379
  useStepPolling(stepSpecification.polling, onAction);
5214
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5380
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
5215
5381
  DynamicLayout_default,
5216
5382
  {
5217
5383
  components,
@@ -5227,16 +5393,16 @@ var LayoutStep = (props) => {
5227
5393
  var LayoutStep_default = LayoutStep;
5228
5394
 
5229
5395
  // src/step/cameraStep/CameraStep.tsx
5230
- var import_react33 = require("react");
5396
+ var import_react35 = require("react");
5231
5397
 
5232
5398
  // src/step/cameraStep/cameraCapture/CameraCapture.tsx
5233
- var import_react32 = require("react");
5234
- var import_react_intl23 = require("react-intl");
5399
+ var import_react34 = require("react");
5400
+ var import_react_intl25 = require("react-intl");
5235
5401
  var import_react_webcam = __toESM(require_react_webcam());
5236
5402
 
5237
5403
  // src/step/cameraStep/cameraCapture/CameraCapture.messages.ts
5238
- var import_react_intl17 = require("react-intl");
5239
- var CameraCapture_messages_default = (0, import_react_intl17.defineMessages)({
5404
+ var import_react_intl19 = require("react-intl");
5405
+ var CameraCapture_messages_default = (0, import_react_intl19.defineMessages)({
5240
5406
  reviewSubmit: {
5241
5407
  id: "dynamicFlows.CameraCapture.reviewSubmit",
5242
5408
  defaultMessage: "Yes, submit",
@@ -5255,54 +5421,54 @@ var CameraCapture_messages_default = (0, import_react_intl17.defineMessages)({
5255
5421
  });
5256
5422
 
5257
5423
  // src/step/cameraStep/cameraCapture/components/index.tsx
5258
- var import_components22 = require("@transferwise/components");
5259
- var import_react_intl18 = require("react-intl");
5260
- var import_jsx_runtime50 = require("react/jsx-runtime");
5261
- var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(CaptureButton, { onClick: onCapture }) });
5424
+ var import_components25 = require("@transferwise/components");
5425
+ var import_react_intl20 = require("react-intl");
5426
+ var import_jsx_runtime54 = require("react/jsx-runtime");
5427
+ var CaptureBottomBar = ({ onCapture }) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "bottom-bar", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(CaptureButton, { onClick: onCapture }) });
5262
5428
  var ReviewBottomBar = ({
5263
5429
  onSubmit,
5264
5430
  onRetry
5265
5431
  }) => {
5266
- const intl = (0, import_react_intl18.useIntl)();
5267
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
5268
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5269
- import_components22.Button,
5432
+ const intl = (0, import_react_intl20.useIntl)();
5433
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "bottom-bar p-x-2", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "col-xs-12 col-md-6 col-md-offset-3", children: [
5434
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5435
+ import_components25.Button,
5270
5436
  {
5271
5437
  className: "m-b-1",
5272
5438
  block: true,
5273
- size: import_components22.Size.MEDIUM,
5274
- type: import_components22.ControlType.ACCENT,
5439
+ size: import_components25.Size.MEDIUM,
5440
+ type: import_components25.ControlType.ACCENT,
5275
5441
  onClick: onSubmit,
5276
5442
  children: intl.formatMessage(CameraCapture_messages_default.reviewSubmit)
5277
5443
  }
5278
5444
  ),
5279
- /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5280
- import_components22.Button,
5445
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5446
+ import_components25.Button,
5281
5447
  {
5282
5448
  className: "m-b-2",
5283
5449
  block: true,
5284
- size: import_components22.Size.MEDIUM,
5285
- type: import_components22.ControlType.ACCENT,
5286
- priority: import_components22.Priority.SECONDARY,
5450
+ size: import_components25.Size.MEDIUM,
5451
+ type: import_components25.ControlType.ACCENT,
5452
+ priority: import_components25.Priority.SECONDARY,
5287
5453
  onClick: onRetry,
5288
5454
  children: intl.formatMessage(CameraCapture_messages_default.reviewRetry)
5289
5455
  }
5290
5456
  )
5291
5457
  ] }) }) });
5292
5458
  };
5293
- var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5459
+ var CaptureButton = ({ onClick }) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5294
5460
  "button",
5295
5461
  {
5296
5462
  type: "button",
5297
5463
  className: "camera-capture-btn m-b-2",
5298
5464
  "data-testid": "camera-capture-button",
5299
5465
  onClick,
5300
- children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("span", { className: "camera-capture-btn-inner" })
5466
+ children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "camera-capture-btn-inner" })
5301
5467
  }
5302
5468
  );
5303
5469
 
5304
5470
  // src/step/cameraStep/cameraCapture/hooks/index.ts
5305
- var import_react30 = require("react");
5471
+ var import_react32 = require("react");
5306
5472
 
5307
5473
  // src/step/cameraStep/cameraCapture/utils/index.ts
5308
5474
  var isSelfieCamera = (stream) => {
@@ -5350,7 +5516,7 @@ var getVideoCapabilities = (videoStream) => {
5350
5516
 
5351
5517
  // src/step/cameraStep/cameraCapture/hooks/index.ts
5352
5518
  var useVideoConstraints = (direction) => {
5353
- const [videoConstraints, setVideoConstraints] = (0, import_react30.useState)();
5519
+ const [videoConstraints, setVideoConstraints] = (0, import_react32.useState)();
5354
5520
  const defaultVideoConstraints = {
5355
5521
  facingMode: direction === "front" ? "user" : "environment",
5356
5522
  height: { min: 480, max: 1080, ideal: 720 },
@@ -5358,7 +5524,7 @@ var useVideoConstraints = (direction) => {
5358
5524
  frameRate: 30,
5359
5525
  aspectRatio: 16 / 9
5360
5526
  };
5361
- (0, import_react30.useEffect)(() => {
5527
+ (0, import_react32.useEffect)(() => {
5362
5528
  void getVideoConstraints(direction).then(setVideoConstraints);
5363
5529
  }, [direction]);
5364
5530
  const getVideoConstraints = async (direction2) => {
@@ -5376,8 +5542,8 @@ var useVideoConstraints = (direction) => {
5376
5542
  };
5377
5543
 
5378
5544
  // src/step/cameraStep/cameraCapture/overlay/Overlay.tsx
5379
- var import_react31 = require("react");
5380
- var import_jsx_runtime51 = require("react/jsx-runtime");
5545
+ var import_react33 = require("react");
5546
+ var import_jsx_runtime55 = require("react/jsx-runtime");
5381
5547
  var captureButtonHeight = 92;
5382
5548
  var reviewButtonsHeight = 120;
5383
5549
  var imageHeight = 40;
@@ -5393,8 +5559,8 @@ var Overlay = ({
5393
5559
  instructions,
5394
5560
  reviewInstructions
5395
5561
  }) => {
5396
- const svgReference = (0, import_react31.useRef)(null);
5397
- (0, import_react31.useEffect)(() => {
5562
+ const svgReference = (0, import_react33.useRef)(null);
5563
+ (0, import_react33.useEffect)(() => {
5398
5564
  const listener = debounce(() => {
5399
5565
  var _a;
5400
5566
  if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
@@ -5406,18 +5572,18 @@ var Overlay = ({
5406
5572
  return () => window.removeEventListener("resize", listener);
5407
5573
  });
5408
5574
  let helperBoxHeight = (imageUrl ? imageHeight : 0) + (title ? titleHeight : 0) + (instructions ? instructionsHeight : 0);
5409
- let helperBox = /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)(import_jsx_runtime51.Fragment, { children: [
5410
- imageUrl && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
5411
- title && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("h4", { className: "camera-capture-title", children: title }),
5412
- instructions && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("small", { className: "camera-capture-instructions", children: instructions })
5575
+ let helperBox = /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
5576
+ imageUrl && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("img", { className: "camera-capture-img", src: imageUrl, alt: "" }),
5577
+ title && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("h4", { className: "camera-capture-title", children: title }),
5578
+ instructions && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("small", { className: "camera-capture-instructions", children: instructions })
5413
5579
  ] });
5414
5580
  const frameBottomMargin = captureButtonHeight + helperBoxHeight;
5415
5581
  if (reviewInstructions) {
5416
5582
  helperBoxHeight = frameBottomMargin - reviewButtonsHeight;
5417
- helperBox = /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
5583
+ helperBox = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("small", { className: "camera-capture-instructions", children: reviewInstructions });
5418
5584
  const frameWithReviewInstructionsMinBottomMargin = reviewButtonsHeight + reviewInstructionsHeight;
5419
5585
  if (frameBottomMargin < frameWithReviewInstructionsMinBottomMargin) {
5420
- helperBox = /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(import_jsx_runtime51.Fragment, {});
5586
+ helperBox = /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(import_jsx_runtime55.Fragment, {});
5421
5587
  }
5422
5588
  }
5423
5589
  const framePosition = {
@@ -5435,25 +5601,25 @@ var Overlay = ({
5435
5601
  width: "90%"
5436
5602
  }
5437
5603
  };
5438
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
5439
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime51.jsxs)("mask", { id: "mask", children: [
5440
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
5441
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("image", __spreadValues({ href: overlay }, framePosition))
5604
+ return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("svg", { ref: svgReference, xmlns: "http://www.w3.org/2000/svg", children: [
5605
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("mask", { id: "mask", children: [
5606
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("rect", { width: "100%", height: "100%", fill: "#fff" }),
5607
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("image", __spreadValues({ href: overlay }, framePosition))
5442
5608
  ] }) }),
5443
- overlay && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
5444
- outline && /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("image", __spreadValues({ href: outline }, framePosition)),
5445
- /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime51.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
5609
+ overlay && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("rect", { width: "100%", height: "100%", mask: "url(#mask)", fillOpacity: "0.72" }),
5610
+ outline && /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("image", __spreadValues({ href: outline }, framePosition)),
5611
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("foreignObject", { width: "100%", height: "100%", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", __spreadProps(__spreadValues({ className: "camera-capture-text-and-image-container" }, helperBoxPosition), { children: helperBox })) })
5446
5612
  ] });
5447
5613
  };
5448
5614
  var Overlay_default = Overlay;
5449
5615
 
5450
5616
  // src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
5451
- var import_components23 = require("@transferwise/components");
5452
- var import_react_intl20 = require("react-intl");
5617
+ var import_components26 = require("@transferwise/components");
5618
+ var import_react_intl22 = require("react-intl");
5453
5619
 
5454
5620
  // src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.messages.ts
5455
- var import_react_intl19 = require("react-intl");
5456
- var NoCameraAccess_messages_default = (0, import_react_intl19.defineMessages)({
5621
+ var import_react_intl21 = require("react-intl");
5622
+ var NoCameraAccess_messages_default = (0, import_react_intl21.defineMessages)({
5457
5623
  title: {
5458
5624
  id: "dynamicFlows.CameraCapture.NoCameraAccess.title",
5459
5625
  defaultMessage: "We can't access your camera",
@@ -5472,23 +5638,23 @@ var NoCameraAccess_messages_default = (0, import_react_intl19.defineMessages)({
5472
5638
  });
5473
5639
 
5474
5640
  // src/step/cameraStep/cameraCapture/screens/NoCameraAccess/NoCameraAccess.tsx
5475
- var import_jsx_runtime52 = require("react/jsx-runtime");
5641
+ var import_jsx_runtime56 = require("react/jsx-runtime");
5476
5642
  var NoCameraAccess = ({ onAction }) => {
5477
- const intl = (0, import_react_intl20.useIntl)();
5478
- return /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { id: "no-camera-access", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
5479
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(NoCameraAccess_messages_default.title) }),
5480
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(NoCameraAccess_messages_default.paragraph) }),
5481
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_components23.Button, { block: true, onClick: onAction, children: intl.formatMessage(NoCameraAccess_messages_default.action) })
5643
+ const intl = (0, import_react_intl22.useIntl)();
5644
+ return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { id: "no-camera-access", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
5645
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(NoCameraAccess_messages_default.title) }),
5646
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(NoCameraAccess_messages_default.paragraph) }),
5647
+ /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_components26.Button, { block: true, onClick: onAction, children: intl.formatMessage(NoCameraAccess_messages_default.action) })
5482
5648
  ] }) }) }) });
5483
5649
  };
5484
5650
  var NoCameraAccess_default = NoCameraAccess;
5485
5651
 
5486
5652
  // src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
5487
- var import_react_intl22 = require("react-intl");
5653
+ var import_react_intl24 = require("react-intl");
5488
5654
 
5489
5655
  // src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.messages.ts
5490
- var import_react_intl21 = require("react-intl");
5491
- var CameraNotSupported_messages_default = (0, import_react_intl21.defineMessages)({
5656
+ var import_react_intl23 = require("react-intl");
5657
+ var CameraNotSupported_messages_default = (0, import_react_intl23.defineMessages)({
5492
5658
  title: {
5493
5659
  id: "dynamicFlows.CameraCapture.CameraNotSupported.title",
5494
5660
  defaultMessage: "Camera not supported",
@@ -5502,12 +5668,12 @@ var CameraNotSupported_messages_default = (0, import_react_intl21.defineMessages
5502
5668
  });
5503
5669
 
5504
5670
  // src/step/cameraStep/cameraCapture/screens/CameraNotSupported/CameraNotSupported.tsx
5505
- var import_jsx_runtime53 = require("react/jsx-runtime");
5671
+ var import_jsx_runtime57 = require("react/jsx-runtime");
5506
5672
  var CameraNotSupported = () => {
5507
- const intl = (0, import_react_intl22.useIntl)();
5508
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { id: "camera-not-supported", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
5509
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(CameraNotSupported_messages_default.title) }),
5510
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(CameraNotSupported_messages_default.paragraph) })
5673
+ const intl = (0, import_react_intl24.useIntl)();
5674
+ return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { id: "camera-not-supported", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "container p-t-5", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { className: "row", children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "col-md-6 col-md-offset-3", children: [
5675
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("h2", { className: "text-xs-center m-b-3", children: intl.formatMessage(CameraNotSupported_messages_default.title) }),
5676
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)("p", { className: "text-xs-center m-b-5", children: intl.formatMessage(CameraNotSupported_messages_default.paragraph) })
5511
5677
  ] }) }) }) });
5512
5678
  };
5513
5679
  var CameraNotSupported_default = CameraNotSupported;
@@ -5532,7 +5698,7 @@ var getCameraStartedProperties = async (props, videoStream) => {
5532
5698
  };
5533
5699
 
5534
5700
  // src/step/cameraStep/cameraCapture/CameraCapture.tsx
5535
- var import_jsx_runtime54 = require("react/jsx-runtime");
5701
+ var import_jsx_runtime58 = require("react/jsx-runtime");
5536
5702
  var CameraCapture = ({
5537
5703
  direction = "back",
5538
5704
  overlay = "",
@@ -5544,14 +5710,14 @@ var CameraCapture = ({
5544
5710
  onCapture,
5545
5711
  onEvent
5546
5712
  }) => {
5547
- const [mode, setMode] = (0, import_react32.useState)("CAPTURE");
5548
- const [isVideoMirrored, setIsVideoMirrored] = (0, import_react32.useState)(false);
5549
- const [ready, setReady] = (0, import_react32.useState)(false);
5550
- const [reviewImage, setReviewImage] = (0, import_react32.useState)();
5551
- const webcamReference = (0, import_react32.useRef)(null);
5713
+ const [mode, setMode] = (0, import_react34.useState)("CAPTURE");
5714
+ const [isVideoMirrored, setIsVideoMirrored] = (0, import_react34.useState)(false);
5715
+ const [ready, setReady] = (0, import_react34.useState)(false);
5716
+ const [reviewImage, setReviewImage] = (0, import_react34.useState)();
5717
+ const webcamReference = (0, import_react34.useRef)(null);
5552
5718
  const { videoConstraints } = useVideoConstraints(direction);
5553
- const intl = (0, import_react_intl23.useIntl)();
5554
- const handleCapture = (0, import_react32.useCallback)(async () => {
5719
+ const intl = (0, import_react_intl25.useIntl)();
5720
+ const handleCapture = (0, import_react34.useCallback)(async () => {
5555
5721
  var _a, _b, _c, _d, _e, _f;
5556
5722
  if (((_a = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _a.video) && ((_c = (_b = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _b.video) == null ? void 0 : _c.readyState) >= 3) {
5557
5723
  (_e = (_d = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _d.video) == null ? void 0 : _e.pause();
@@ -5573,7 +5739,7 @@ var CameraCapture = ({
5573
5739
  );
5574
5740
  }
5575
5741
  }, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
5576
- const handleUserMediaError = (0, import_react32.useCallback)(
5742
+ const handleUserMediaError = (0, import_react34.useCallback)(
5577
5743
  (error) => {
5578
5744
  if (error instanceof DOMException && (error == null ? void 0 : error.name) === "NotAllowedError") {
5579
5745
  setMode("NO_CAMERA_ACCESS");
@@ -5585,7 +5751,7 @@ var CameraCapture = ({
5585
5751
  },
5586
5752
  [setMode, onEvent]
5587
5753
  );
5588
- const handleUserMedia = (0, import_react32.useCallback)(
5754
+ const handleUserMedia = (0, import_react34.useCallback)(
5589
5755
  (stream) => {
5590
5756
  setReady(true);
5591
5757
  setIsVideoMirrored(isSelfieCamera(stream));
@@ -5601,8 +5767,8 @@ var CameraCapture = ({
5601
5767
  setReviewImage(void 0);
5602
5768
  };
5603
5769
  const handleRetryCameraAccess = () => setMode("CAPTURE");
5604
- const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
5605
- videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5770
+ const captureScreen = /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
5771
+ videoConstraints && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
5606
5772
  import_react_webcam.default,
5607
5773
  {
5608
5774
  ref: webcamReference,
@@ -5613,7 +5779,7 @@ var CameraCapture = ({
5613
5779
  onUserMedia: handleUserMedia
5614
5780
  }
5615
5781
  ),
5616
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5782
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
5617
5783
  Overlay_default,
5618
5784
  {
5619
5785
  overlay,
@@ -5623,11 +5789,11 @@ var CameraCapture = ({
5623
5789
  instructions
5624
5790
  }
5625
5791
  ),
5626
- ready && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(CaptureBottomBar, { onCapture: () => void handleCapture() })
5792
+ ready && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CaptureBottomBar, { onCapture: () => void handleCapture() })
5627
5793
  ] });
5628
- const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_jsx_runtime54.Fragment, { children: [
5629
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
5630
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5794
+ const reviewScreen = /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
5795
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("img", { className: "review-image", src: reviewImage == null ? void 0 : reviewImage.source, alt: "" }),
5796
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
5631
5797
  Overlay_default,
5632
5798
  {
5633
5799
  overlay,
@@ -5637,19 +5803,19 @@ var CameraCapture = ({
5637
5803
  reviewInstructions: intl.formatMessage(CameraCapture_messages_default.reviewInstructions)
5638
5804
  }
5639
5805
  ),
5640
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
5806
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(ReviewBottomBar, { onSubmit: handleReviewSubmit, onRetry: handleReviewRetry })
5641
5807
  ] });
5642
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("section", { className: "camera-capture", children: [
5808
+ return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("section", { className: "camera-capture", children: [
5643
5809
  mode === "CAPTURE" && captureScreen,
5644
5810
  mode === "REVIEW" && reviewScreen,
5645
- mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(NoCameraAccess_default, { onAction: handleRetryCameraAccess }),
5646
- mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(CameraNotSupported_default, {})
5811
+ mode === "NO_CAMERA_ACCESS" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(NoCameraAccess_default, { onAction: handleRetryCameraAccess }),
5812
+ mode === "CAMERA_NOT_SUPPORTED" && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CameraNotSupported_default, {})
5647
5813
  ] });
5648
5814
  };
5649
5815
  var CameraCapture_default = CameraCapture;
5650
5816
 
5651
5817
  // src/step/cameraStep/CameraStep.tsx
5652
- var import_jsx_runtime55 = require("react/jsx-runtime");
5818
+ var import_jsx_runtime59 = require("react/jsx-runtime");
5653
5819
  function blobToBase64(blob) {
5654
5820
  return new Promise((resolve, _) => {
5655
5821
  const reader = new FileReader();
@@ -5667,8 +5833,8 @@ var CameraStep = (props) => {
5667
5833
  const { assets, direction, instructions } = cameraConfig || {};
5668
5834
  const { overlay, outline } = assets || {};
5669
5835
  const { url: imageUrl } = image || {};
5670
- const [captureClicked, setCaptureClicked] = (0, import_react33.useState)(false);
5671
- (0, import_react33.useEffect)(() => {
5836
+ const [captureClicked, setCaptureClicked] = (0, import_react35.useState)(false);
5837
+ (0, import_react35.useEffect)(() => {
5672
5838
  if (captureClicked) {
5673
5839
  onAction(action);
5674
5840
  }
@@ -5687,7 +5853,7 @@ var CameraStep = (props) => {
5687
5853
  });
5688
5854
  }
5689
5855
  };
5690
- return /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(
5856
+ return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
5691
5857
  CameraCapture_default,
5692
5858
  {
5693
5859
  overlay,
@@ -5736,11 +5902,11 @@ function getFirstAction(step) {
5736
5902
  }
5737
5903
 
5738
5904
  // src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
5739
- var import_react_intl25 = require("react-intl");
5905
+ var import_react_intl27 = require("react-intl");
5740
5906
 
5741
5907
  // src/step/externalConfirmationStep/ExternalConfirmationStep.messages.ts
5742
- var import_react_intl24 = require("react-intl");
5743
- var ExternalConfirmationStep_messages_default = (0, import_react_intl24.defineMessages)({
5908
+ var import_react_intl26 = require("react-intl");
5909
+ var ExternalConfirmationStep_messages_default = (0, import_react_intl26.defineMessages)({
5744
5910
  title: {
5745
5911
  id: "dynamicFlows.ExternalConfirmation.title",
5746
5912
  defaultMessage: "Please confirm",
@@ -5764,12 +5930,12 @@ var ExternalConfirmationStep_messages_default = (0, import_react_intl24.defineMe
5764
5930
  });
5765
5931
 
5766
5932
  // src/step/externalConfirmationStep/ExternalConfirmationStep.tsx
5767
- var import_jsx_runtime56 = require("react/jsx-runtime");
5933
+ var import_jsx_runtime60 = require("react/jsx-runtime");
5768
5934
  var noop5 = () => {
5769
5935
  };
5770
5936
  var ExternalConfirmationStep = ({ url, onClose }) => {
5771
- const { formatMessage } = (0, import_react_intl25.useIntl)();
5772
- return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
5937
+ const { formatMessage } = (0, import_react_intl27.useIntl)();
5938
+ return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
5773
5939
  DynamicLayout_default,
5774
5940
  {
5775
5941
  components: [
@@ -5834,7 +6000,7 @@ function getOrigin(url) {
5834
6000
  }
5835
6001
 
5836
6002
  // src/dynamicFlow/DynamicFlowStep.tsx
5837
- var import_jsx_runtime57 = require("react/jsx-runtime");
6003
+ var import_jsx_runtime61 = require("react/jsx-runtime");
5838
6004
  var DynamicFlowStep = (props) => {
5839
6005
  var _a;
5840
6006
  const { step, globalError } = props;
@@ -5844,22 +6010,22 @@ var DynamicFlowStep = (props) => {
5844
6010
  return null;
5845
6011
  }
5846
6012
  if (externalUrl && requiresManualTrigger) {
5847
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
6013
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ExternalConfirmationStep_default, { url: externalUrl, onClose: dismissConfirmation });
5848
6014
  }
5849
6015
  if (isCameraStep(step)) {
5850
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
6016
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(CameraStep_default, __spreadProps(__spreadValues({}, props), { step }));
5851
6017
  }
5852
- return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
5853
- globalError ? /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
5854
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
6018
+ return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(import_jsx_runtime61.Fragment, { children: [
6019
+ globalError ? /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DynamicAlert_default, { component: { context: "negative", markdown: globalError, margin: "lg" } }) : null,
6020
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(LayoutStep_default, __spreadProps(__spreadValues({}, props), { stepSpecification: step }))
5855
6021
  ] });
5856
6022
  };
5857
6023
 
5858
6024
  // src/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
5859
- var import_react34 = require("react");
6025
+ var import_react36 = require("react");
5860
6026
  var DEBOUNCE_DELAY = 1e3;
5861
6027
  function useDebouncedRefresh(fetchRefresh) {
5862
- const map = (0, import_react34.useRef)(/* @__PURE__ */ new Map());
6028
+ const map = (0, import_react36.useRef)(/* @__PURE__ */ new Map());
5863
6029
  const retrieveOrCreate = (key) => {
5864
6030
  if (map.current.has(key)) {
5865
6031
  return map.current.get(key);
@@ -5882,12 +6048,12 @@ function useDebouncedRefresh(fetchRefresh) {
5882
6048
  var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
5883
6049
 
5884
6050
  // src/dynamicFlow/utils/useDynamicFlowState.ts
5885
- var import_react35 = require("react");
6051
+ var import_react37 = require("react");
5886
6052
  var useDynamicFlowState = (initialStep) => {
5887
6053
  var _a, _b;
5888
- const [formErrors, setFormErrors] = (0, import_react35.useState)((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
5889
- const [globalError, setGlobalError] = (0, import_react35.useState)((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
5890
- const [stepAndModels, setStepAndModels] = (0, import_react35.useState)({
6054
+ const [formErrors, setFormErrors] = (0, import_react37.useState)((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
6055
+ const [globalError, setGlobalError] = (0, import_react37.useState)((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
6056
+ const [stepAndModels, setStepAndModels] = (0, import_react37.useState)({
5891
6057
  step: initialStep || void 0,
5892
6058
  models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
5893
6059
  etag: void 0
@@ -5917,7 +6083,7 @@ var useDynamicFlowState = (initialStep) => {
5917
6083
  return updatedState;
5918
6084
  });
5919
6085
  };
5920
- const modelIsValid = (0, import_react35.useMemo)(() => areModelsValid(models, getAllSchemas(step)), [models, step]);
6086
+ const modelIsValid = (0, import_react37.useMemo)(() => areModelsValid(models, getAllSchemas(step)), [models, step]);
5921
6087
  return {
5922
6088
  formErrors,
5923
6089
  globalError,
@@ -5970,19 +6136,19 @@ var isInlineSchema = (schema) => {
5970
6136
  };
5971
6137
 
5972
6138
  // src/dynamicFlow/utils/useLoader.tsx
5973
- var import_components25 = require("@transferwise/components");
5974
- var import_react36 = require("react");
5975
- var import_jsx_runtime58 = require("react/jsx-runtime");
6139
+ var import_components28 = require("@transferwise/components");
6140
+ var import_react38 = require("react");
6141
+ var import_jsx_runtime62 = require("react/jsx-runtime");
5976
6142
  function useLoader(loaderConfig, initialState) {
5977
6143
  const config = __spreadValues({
5978
- size: import_components25.Size.EXTRA_LARGE,
6144
+ size: import_components28.Size.EXTRA_LARGE,
5979
6145
  initial: true,
5980
6146
  submission: false
5981
6147
  }, loaderConfig);
5982
- const [loadingState, setLoadingState] = (0, import_react36.useState)(initialState);
6148
+ const [loadingState, setLoadingState] = (0, import_react38.useState)(initialState);
5983
6149
  const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
5984
- const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
5985
- import_components25.Loader,
6150
+ const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
6151
+ import_components28.Loader,
5986
6152
  {
5987
6153
  size: config.size,
5988
6154
  classNames: { "tw-loader": "tw-loader m-x-auto" },
@@ -5993,40 +6159,23 @@ function useLoader(loaderConfig, initialState) {
5993
6159
  }
5994
6160
 
5995
6161
  // src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
5996
- var import_react37 = require("react");
5997
-
5998
- // src/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.tsx
5999
- var import_components26 = require("@transferwise/components");
6000
- var import_react_intl27 = require("react-intl");
6001
-
6002
- // src/dynamicFlow/utils/errorBoundary/ErrorBoundary.messages.ts
6003
- var import_react_intl26 = require("react-intl");
6004
- var ErrorBoundary_messages_default = (0, import_react_intl26.defineMessages)({
6005
- errorAlert: {
6006
- id: "dynamicFlows.ErrorBoundary.errorAlert",
6007
- defaultMessage: "Oops. Something went wrong...",
6008
- description: "Generic error message for when something has gone wrong"
6009
- },
6010
- retry: {
6011
- id: "dynamicFlows.ErrorBoundary.retry",
6012
- defaultMessage: "Retry",
6013
- description: "Retry"
6014
- }
6015
- });
6162
+ var import_react39 = require("react");
6016
6163
 
6017
6164
  // src/dynamicFlow/utils/errorBoundary/ErrorBoundaryAlert.tsx
6018
- var import_jsx_runtime59 = require("react/jsx-runtime");
6165
+ var import_components29 = require("@transferwise/components");
6166
+ var import_react_intl28 = require("react-intl");
6167
+ var import_jsx_runtime63 = require("react/jsx-runtime");
6019
6168
  var ErrorBoundaryAlert = ({ onDismiss }) => {
6020
- const { formatMessage } = (0, import_react_intl27.useIntl)();
6021
- return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
6022
- import_components26.Alert,
6169
+ const { formatMessage } = (0, import_react_intl28.useIntl)();
6170
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
6171
+ import_components29.Alert,
6023
6172
  {
6024
6173
  action: {
6025
6174
  text: formatMessage(ErrorBoundary_messages_default.retry),
6026
6175
  href: window.location.href
6027
6176
  },
6028
6177
  message: formatMessage(ErrorBoundary_messages_default.errorAlert),
6029
- type: import_components26.Sentiment.NEGATIVE,
6178
+ type: import_components29.Sentiment.NEGATIVE,
6030
6179
  className: "m-b-3",
6031
6180
  onDismiss
6032
6181
  }
@@ -6034,10 +6183,10 @@ var ErrorBoundaryAlert = ({ onDismiss }) => {
6034
6183
  };
6035
6184
 
6036
6185
  // src/dynamicFlow/utils/errorBoundary/ErrorBoundary.tsx
6037
- var import_jsx_runtime60 = require("react/jsx-runtime");
6186
+ var import_jsx_runtime64 = require("react/jsx-runtime");
6038
6187
  var noop6 = () => {
6039
6188
  };
6040
- var ErrorBoundary = class extends import_react37.Component {
6189
+ var ErrorBoundary = class extends import_react39.Component {
6041
6190
  constructor(props) {
6042
6191
  super(props);
6043
6192
  this.handleErrorReset = () => {
@@ -6055,8 +6204,8 @@ var ErrorBoundary = class extends import_react37.Component {
6055
6204
  render() {
6056
6205
  const { children } = this.props;
6057
6206
  const { hasError, isFatalError } = this.state;
6058
- return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)(import_jsx_runtime60.Fragment, { children: [
6059
- hasError && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(ErrorBoundaryAlert, { onDismiss: this.handleErrorReset }),
6207
+ return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
6208
+ hasError && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(ErrorBoundaryAlert, { onDismiss: this.handleErrorReset }),
6060
6209
  !isFatalError && children
6061
6210
  ] });
6062
6211
  }
@@ -6157,7 +6306,7 @@ var assertResponseIsValid = (response) => {
6157
6306
  var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
6158
6307
 
6159
6308
  // src/dynamicFlow/DynamicFlow.tsx
6160
- var import_jsx_runtime61 = require("react/jsx-runtime");
6309
+ var import_jsx_runtime65 = require("react/jsx-runtime");
6161
6310
  var noop7 = () => {
6162
6311
  };
6163
6312
  var DynamicFlowComponent = ({
@@ -6172,7 +6321,7 @@ var DynamicFlowComponent = ({
6172
6321
  onEvent = noop7,
6173
6322
  onLog = noop7
6174
6323
  }) => {
6175
- const { locale } = (0, import_react_intl28.useIntl)();
6324
+ const { locale } = (0, import_react_intl29.useIntl)();
6176
6325
  const {
6177
6326
  formErrors,
6178
6327
  globalError,
@@ -6185,24 +6334,24 @@ var DynamicFlowComponent = ({
6185
6334
  setStepAndEtag,
6186
6335
  setSchemaModel
6187
6336
  } = useDynamicFlowState(initialStep);
6188
- const [submitted, setSubmitted] = (0, import_react38.useState)(false);
6337
+ const [submitted, setSubmitted] = (0, import_react40.useState)(false);
6189
6338
  const { isLoading, loader, setLoadingState } = useLoader(
6190
6339
  loaderConfig,
6191
6340
  initialStep ? "idle" : "initial"
6192
6341
  );
6193
6342
  const logCritical = getLogger("critical", onLog, flowId, (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key));
6194
- const analyticsMetadata = (0, import_react38.useMemo)(
6343
+ const analyticsMetadata = (0, import_react40.useMemo)(
6195
6344
  () => {
6196
6345
  var _a;
6197
6346
  return __spreadValues({ flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key) }, (_a = step == null ? void 0 : step.analytics) != null ? _a : {});
6198
6347
  },
6199
6348
  [flowId, step]
6200
6349
  );
6201
- const dispatchEvent = (0, import_react38.useMemo)(
6350
+ const dispatchEvent = (0, import_react40.useMemo)(
6202
6351
  () => getEventDispatcher(onEvent, analyticsMetadata),
6203
6352
  [onEvent, analyticsMetadata]
6204
6353
  );
6205
- const dfHttpClient = (0, import_react38.useCallback)(
6354
+ const dfHttpClient = (0, import_react40.useCallback)(
6206
6355
  ({ action, data, etag: etag2 }) => {
6207
6356
  const { url, method = "POST" } = action;
6208
6357
  return httpClient(url != null ? url : "", {
@@ -6252,17 +6401,17 @@ var DynamicFlowComponent = ({
6252
6401
  dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
6253
6402
  };
6254
6403
  const debouncedRefresh = useDebouncedRefresh(performRefresh);
6255
- const dispatchEventAndComplete = (0, import_react38.useCallback)(
6404
+ const dispatchEventAndComplete = (0, import_react40.useCallback)(
6256
6405
  (result) => {
6257
6406
  dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
6258
6407
  onCompletion(result);
6259
6408
  },
6260
6409
  [onCompletion, dispatchEvent]
6261
6410
  );
6262
- (0, import_react38.useEffect)(() => {
6411
+ (0, import_react40.useEffect)(() => {
6263
6412
  dispatchEvent("Dynamic Flow - Flow Started", {});
6264
6413
  }, []);
6265
- (0, import_react38.useEffect)(() => {
6414
+ (0, import_react40.useEffect)(() => {
6266
6415
  if (!initialStep) {
6267
6416
  const action = __spreadValues({
6268
6417
  id: "#initial-step-request",
@@ -6375,7 +6524,7 @@ var DynamicFlowComponent = ({
6375
6524
  await actionHandler(action);
6376
6525
  }
6377
6526
  };
6378
- return /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(HttpClientProvider, { httpClient, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(
6527
+ return /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(HttpClientProvider, { httpClient, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(
6379
6528
  DynamicFlowStep,
6380
6529
  {
6381
6530
  step,
@@ -6391,7 +6540,7 @@ var DynamicFlowComponent = ({
6391
6540
  }
6392
6541
  ) }) }) }) });
6393
6542
  };
6394
- var DynamicFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
6543
+ var DynamicFlow = (props) => /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
6395
6544
  var DynamicFlow_default = DynamicFlow;
6396
6545
  var combineModels2 = (formModels) => {
6397
6546
  return Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});