@wise/dynamic-flow-client-internal 3.34.1 → 4.0.0-exp-zod-301f0be

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
@@ -1039,16 +1039,16 @@ var mapStatusToSentiment = (validation) => {
1039
1039
  };
1040
1040
  var FieldInput_default = FieldInput;
1041
1041
 
1042
- // ../renderers/src/BooleanInputRenderer.tsx
1042
+ // ../renderers/src/CheckboxInputRenderer.tsx
1043
1043
  var import_components4 = require("@transferwise/components");
1044
1044
  var import_jsx_runtime6 = require("react/jsx-runtime");
1045
- var BooleanInputRenderer = {
1046
- canRenderType: "input-boolean",
1045
+ var CheckboxInputRenderer = {
1046
+ canRenderType: "input-checkbox",
1047
1047
  render: (props) => {
1048
1048
  const _a = props, {
1049
1049
  id,
1050
1050
  control,
1051
- label = "",
1051
+ title = "",
1052
1052
  description,
1053
1053
  help,
1054
1054
  type,
@@ -1057,18 +1057,18 @@ var BooleanInputRenderer = {
1057
1057
  } = _a, rest = __objRest(_a, [
1058
1058
  "id",
1059
1059
  "control",
1060
- "label",
1060
+ "title",
1061
1061
  "description",
1062
1062
  "help",
1063
1063
  "type",
1064
1064
  "validationState",
1065
1065
  "value"
1066
1066
  ]);
1067
- const checkboxProps = __spreadProps(__spreadValues({}, rest), { label, secondary: description, checked: value });
1067
+ const checkboxProps = __spreadProps(__spreadValues({}, rest), { label: title, secondary: description, checked: value });
1068
1068
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(FieldInput_default, { id, label: "", description: "", validation: validationState, help, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_components4.Checkbox, __spreadValues({ id }, checkboxProps)) });
1069
1069
  }
1070
1070
  };
1071
- var BooleanInputRenderer_default = BooleanInputRenderer;
1071
+ var CheckboxInputRenderer_default = CheckboxInputRenderer;
1072
1072
 
1073
1073
  // ../renderers/src/BoxRenderer.tsx
1074
1074
  var import_classnames = __toESM(require_classnames());
@@ -1289,19 +1289,19 @@ var DateInputRenderer = {
1289
1289
  const _a = props, {
1290
1290
  id,
1291
1291
  control,
1292
- label,
1293
1292
  description,
1294
1293
  type,
1295
1294
  help,
1295
+ title,
1296
1296
  validationState,
1297
1297
  value: initialValue
1298
1298
  } = _a, rest = __objRest(_a, [
1299
1299
  "id",
1300
1300
  "control",
1301
- "label",
1302
1301
  "description",
1303
1302
  "type",
1304
1303
  "help",
1304
+ "title",
1305
1305
  "validationState",
1306
1306
  "value"
1307
1307
  ]);
@@ -1311,7 +1311,7 @@ var DateInputRenderer = {
1311
1311
  FieldInput_default,
1312
1312
  {
1313
1313
  id,
1314
- label,
1314
+ label: title,
1315
1315
  description,
1316
1316
  validation: validationState,
1317
1317
  help,
@@ -1444,10 +1444,9 @@ var FormRenderer_default = FormRenderer;
1444
1444
  var import_components9 = require("@transferwise/components");
1445
1445
  var import_jsx_runtime21 = require("react/jsx-runtime");
1446
1446
  var FormSectionRenderer = {
1447
- canRenderType: "form-section",
1447
+ canRenderType: "section",
1448
1448
  render: ({ title, description, children }) => /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("fieldset", { children: [
1449
- title && // TODO - once section headers support help, we could show help in here
1450
- /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1449
+ title && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
1451
1450
  import_components9.Header,
1452
1451
  {
1453
1452
  as: "h2",
@@ -1656,7 +1655,7 @@ var IntegerInputRenderer = {
1656
1655
  render: (props) => {
1657
1656
  const _a = props, {
1658
1657
  id,
1659
- label,
1658
+ title,
1660
1659
  description,
1661
1660
  help,
1662
1661
  icon,
@@ -1667,7 +1666,7 @@ var IntegerInputRenderer = {
1667
1666
  onChange
1668
1667
  } = _a, rest = __objRest(_a, [
1669
1668
  "id",
1670
- "label",
1669
+ "title",
1671
1670
  "description",
1672
1671
  "help",
1673
1672
  "icon",
@@ -1681,7 +1680,7 @@ var IntegerInputRenderer = {
1681
1680
  FieldInput_default,
1682
1681
  {
1683
1682
  id,
1684
- label,
1683
+ label: title,
1685
1684
  description,
1686
1685
  validation: validationState,
1687
1686
  help,
@@ -1807,11 +1806,11 @@ function MultiSelectInputRendererComponent(props) {
1807
1806
  autoComplete,
1808
1807
  description,
1809
1808
  disabled,
1810
- label,
1811
1809
  help,
1812
1810
  options,
1813
1811
  placeholder,
1814
1812
  selectedIndices,
1813
+ title,
1815
1814
  validationState,
1816
1815
  onSelect
1817
1816
  } = props;
@@ -1848,7 +1847,7 @@ function MultiSelectInputRendererComponent(props) {
1848
1847
  FieldInput_default,
1849
1848
  {
1850
1849
  id,
1851
- label,
1850
+ label: title,
1852
1851
  help,
1853
1852
  description,
1854
1853
  validation: validationState,
@@ -1944,9 +1943,6 @@ var getFileType = (base64Url) => {
1944
1943
  return void 0;
1945
1944
  };
1946
1945
 
1947
- // ../renderers/src/utils/getRandomId.ts
1948
- var getRandomId = () => Math.random().toString(36).substring(2);
1949
-
1950
1946
  // ../renderers/src/MultiUploadInputRenderer.tsx
1951
1947
  var import_jsx_runtime33 = require("react/jsx-runtime");
1952
1948
  var MultiUploadInputRenderer = {
@@ -1956,30 +1952,28 @@ var MultiUploadInputRenderer = {
1956
1952
  id,
1957
1953
  accepts,
1958
1954
  help,
1959
- label,
1955
+ title,
1960
1956
  description,
1961
1957
  disabled,
1962
1958
  maxSize,
1963
1959
  maxItems,
1964
1960
  uploadLabel,
1965
1961
  validationState,
1966
- onUpload,
1967
- onDelete
1962
+ value,
1963
+ onInsertFile,
1964
+ onRemoveFile
1968
1965
  } = props;
1969
1966
  const onUploadFile = async (formData) => {
1970
1967
  const file = formData.get("file");
1971
- const fileId = getRandomId();
1972
- return onUpload(file, fileId).then(() => ({
1973
- id: fileId
1974
- }));
1968
+ return onInsertFile(value.length, file).then((newId) => ({ id: newId }));
1975
1969
  };
1976
- const onDeleteFile = async (fileId) => onDelete(String(fileId));
1970
+ const onDeleteFile = async (fileId) => onRemoveFile(value.findIndex((file) => file.id === fileId));
1977
1971
  const descriptionId = description ? `${id}-description` : void 0;
1978
1972
  return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1979
1973
  UploadFieldInput_default,
1980
1974
  {
1981
1975
  id,
1982
- label,
1976
+ label: title,
1983
1977
  description,
1984
1978
  validation: validationState,
1985
1979
  help,
@@ -2013,7 +2007,7 @@ var NumberInputRenderer = {
2013
2007
  render: (props) => {
2014
2008
  const _a = props, {
2015
2009
  id,
2016
- label,
2010
+ title,
2017
2011
  description,
2018
2012
  help,
2019
2013
  icon,
@@ -2024,7 +2018,7 @@ var NumberInputRenderer = {
2024
2018
  onChange
2025
2019
  } = _a, rest = __objRest(_a, [
2026
2020
  "id",
2027
- "label",
2021
+ "title",
2028
2022
  "description",
2029
2023
  "help",
2030
2024
  "icon",
@@ -2038,7 +2032,7 @@ var NumberInputRenderer = {
2038
2032
  FieldInput_default,
2039
2033
  {
2040
2034
  id,
2041
- label,
2035
+ label: title,
2042
2036
  description,
2043
2037
  validation: validationState,
2044
2038
  help,
@@ -2507,7 +2501,7 @@ function RadioInputRendererComponent(props) {
2507
2501
  description,
2508
2502
  disabled,
2509
2503
  help,
2510
- label,
2504
+ title,
2511
2505
  options,
2512
2506
  selectedIndex,
2513
2507
  validationState,
@@ -2518,7 +2512,7 @@ function RadioInputRendererComponent(props) {
2518
2512
  FieldInput_default,
2519
2513
  {
2520
2514
  id,
2521
- label,
2515
+ label: title,
2522
2516
  help,
2523
2517
  description,
2524
2518
  validation: validationState,
@@ -2555,7 +2549,7 @@ function TabInputRendererComponent(props) {
2555
2549
  description,
2556
2550
  disabled,
2557
2551
  help,
2558
- label,
2552
+ title,
2559
2553
  options,
2560
2554
  selectedIndex,
2561
2555
  validationState,
@@ -2571,7 +2565,7 @@ function TabInputRendererComponent(props) {
2571
2565
  FieldInput_default,
2572
2566
  {
2573
2567
  id,
2574
- label,
2568
+ label: title,
2575
2569
  help,
2576
2570
  description,
2577
2571
  validation: validationState,
@@ -2608,7 +2602,7 @@ function SelectInputRendererComponent(props) {
2608
2602
  description,
2609
2603
  disabled,
2610
2604
  help,
2611
- label,
2605
+ title,
2612
2606
  options,
2613
2607
  placeholder,
2614
2608
  required,
@@ -2649,7 +2643,7 @@ function SelectInputRendererComponent(props) {
2649
2643
  FieldInput_default,
2650
2644
  {
2651
2645
  id,
2652
- label,
2646
+ label: title,
2653
2647
  help,
2654
2648
  description,
2655
2649
  validation: validationState,
@@ -2683,7 +2677,7 @@ function SegmentedInputRendererComponent(props) {
2683
2677
  children,
2684
2678
  description,
2685
2679
  help,
2686
- label,
2680
+ title,
2687
2681
  options,
2688
2682
  selectedIndex,
2689
2683
  validationState,
@@ -2699,7 +2693,7 @@ function SegmentedInputRendererComponent(props) {
2699
2693
  FieldInput_default,
2700
2694
  {
2701
2695
  id,
2702
- label,
2696
+ label: title,
2703
2697
  help,
2704
2698
  description,
2705
2699
  validation: validationState,
@@ -2872,7 +2866,7 @@ var TextInputRenderer = {
2872
2866
  const _a = props, {
2873
2867
  id,
2874
2868
  control,
2875
- label,
2869
+ title,
2876
2870
  description,
2877
2871
  help,
2878
2872
  error,
@@ -2887,7 +2881,7 @@ var TextInputRenderer = {
2887
2881
  } = _a, rest = __objRest(_a, [
2888
2882
  "id",
2889
2883
  "control",
2890
- "label",
2884
+ "title",
2891
2885
  "description",
2892
2886
  "help",
2893
2887
  "error",
@@ -2914,7 +2908,7 @@ var TextInputRenderer = {
2914
2908
  FieldInput_default,
2915
2909
  {
2916
2910
  id,
2917
- label,
2911
+ label: title,
2918
2912
  description,
2919
2913
  validation: validationState,
2920
2914
  help,
@@ -2927,11 +2921,16 @@ var TextInputRenderer_default = TextInputRenderer;
2927
2921
 
2928
2922
  // ../renderers/src/UploadInputRenderer.tsx
2929
2923
  var import_components36 = require("@transferwise/components");
2924
+
2925
+ // ../renderers/src/utils/getRandomId.ts
2926
+ var getRandomId = () => Math.random().toString(36).substring(2);
2927
+
2928
+ // ../renderers/src/UploadInputRenderer.tsx
2930
2929
  var import_jsx_runtime49 = require("react/jsx-runtime");
2931
2930
  var UploadInputRenderer = {
2932
2931
  canRenderType: "input-upload",
2933
2932
  render: (props) => {
2934
- const { id, accepts, label, description, disabled, maxSize, validationState, onUpload } = props;
2933
+ const { id, accepts, title, description, disabled, maxSize, validationState, onUpload } = props;
2935
2934
  const onUploadFile = async (formData) => {
2936
2935
  const file = formData.get("file");
2937
2936
  return onUpload(file).then(() => ({
@@ -2958,7 +2957,7 @@ var UploadInputRenderer = {
2958
2957
  disabled,
2959
2958
  fileTypes: getAcceptsString(accepts),
2960
2959
  sizeLimit: maxSize ? toKilobytes(maxSize) : void 0,
2961
- uploadButtonTitle: label,
2960
+ uploadButtonTitle: title,
2962
2961
  onDeleteFile,
2963
2962
  onUploadFile
2964
2963
  }
@@ -2976,7 +2975,7 @@ var LargeUploadRenderer = {
2976
2975
  id,
2977
2976
  accepts,
2978
2977
  control,
2979
- label,
2978
+ title,
2980
2979
  description,
2981
2980
  disabled,
2982
2981
  help,
@@ -2988,7 +2987,7 @@ var LargeUploadRenderer = {
2988
2987
  "id",
2989
2988
  "accepts",
2990
2989
  "control",
2991
- "label",
2990
+ "title",
2992
2991
  "description",
2993
2992
  "disabled",
2994
2993
  "help",
@@ -3011,7 +3010,7 @@ var LargeUploadRenderer = {
3011
3010
  FieldInput_default,
3012
3011
  {
3013
3012
  id,
3014
- label,
3013
+ label: title,
3015
3014
  description,
3016
3015
  validation: validationState,
3017
3016
  help,
@@ -3245,7 +3244,7 @@ var import_jsx_runtime54 = require("react/jsx-runtime");
3245
3244
  var ListRenderer = {
3246
3245
  canRenderType: "list",
3247
3246
  render: ({ callToAction, margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: getMargin(margin), children: [
3248
- (title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components41.Header, { as: "h2", title: title != null ? title : "", action: getListAction(callToAction) }),
3247
+ title && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(import_components41.Header, { as: "h2", title, action: getListAction(callToAction) }),
3249
3248
  items.map((props) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(DesignSystemListItem, __spreadValues({}, props), props.title))
3250
3249
  ] })
3251
3250
  };
@@ -3307,7 +3306,7 @@ var ListRenderer_default = ListRenderer;
3307
3306
  // ../renderers/src/getWiseRenderers.ts
3308
3307
  var getWiseRenderers = () => [
3309
3308
  AlertRenderer_default,
3310
- BooleanInputRenderer_default,
3309
+ CheckboxInputRenderer_default,
3311
3310
  BoxRenderer_default,
3312
3311
  ButtonRenderer_default,
3313
3312
  ColumnsRenderer_default,