@wise/dynamic-flow-client-internal 4.21.0-experimental-5de9758 → 4.21.0-experimental-d108035

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.
Files changed (3) hide show
  1. package/build/main.js +24 -200
  2. package/build/main.mjs +36 -212
  3. package/package.json +7 -7
package/build/main.js CHANGED
@@ -850,29 +850,27 @@ var AddressValidationButtonRenderer = {
850
850
  function AddressValidationButtonComponent(props) {
851
851
  const { disabled, margin, title, stepLoadingState, onClick } = props;
852
852
  const { formatMessage } = (0, import_react_intl2.useIntl)();
853
- const [isActive, setActive] = (0, import_react.useState)(false);
854
- const isLoading = isActive && stepLoadingState !== "idle";
853
+ const [spinny, setSpinny] = (0, import_react.useState)(false);
854
+ (0, import_react.useEffect)(() => {
855
+ if (stepLoadingState === "idle") {
856
+ setSpinny(false);
857
+ }
858
+ }, [stepLoadingState]);
855
859
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `d-flex flex-column ${getMargin(margin)}`, children: [
856
860
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
857
861
  import_components.Button,
858
862
  {
859
863
  v2: true,
860
864
  block: true,
861
- disabled: isLoading || disabled,
865
+ disabled: stepLoadingState !== "idle" || disabled,
862
866
  priority: "primary",
863
867
  size: "md",
864
- loading: isLoading,
865
- onBlur: () => {
866
- setActive(false);
867
- },
868
- onClick: () => {
869
- setActive(true);
870
- onClick();
871
- },
868
+ loading: spinny,
869
+ onClick,
872
870
  children: title
873
871
  }
874
872
  ),
875
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.InlineAlert, { type: "warning", className: "m-x-auto", children: formatMessage(loading_button_messages_default.buttonLoadingMessage) })
873
+ spinny && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.InlineAlert, { type: "warning", className: "m-x-auto", children: formatMessage(loading_button_messages_default.buttonLoadingMessage) })
876
874
  ] });
877
875
  }
878
876
  var AddressValidationButtonRenderer_default = AddressValidationButtonRenderer;
@@ -937,8 +935,12 @@ var ButtonRenderer = {
937
935
  };
938
936
  function ButtonComponent(props) {
939
937
  const { control, context, disabled, margin, title, size, stepLoadingState, onClick } = props;
940
- const [isActive, setActive] = (0, import_react2.useState)(false);
941
- const isLoading = isActive && stepLoadingState !== "idle";
938
+ const [spinny, setSpinny] = (0, import_react2.useState)(false);
939
+ (0, import_react2.useEffect)(() => {
940
+ if (stepLoadingState === "idle") {
941
+ setSpinny(false);
942
+ }
943
+ }, [stepLoadingState]);
942
944
  const priority = mapControl(control);
943
945
  const type = priority === "tertiary" ? void 0 : mapContext(context);
944
946
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
@@ -946,16 +948,13 @@ function ButtonComponent(props) {
946
948
  {
947
949
  block: true,
948
950
  className: getMargin(margin),
949
- disabled: isLoading ? false : disabled,
951
+ disabled: stepLoadingState !== "idle" || disabled,
950
952
  priority,
951
953
  size: mapSize(size),
952
- loading: isLoading,
954
+ loading: spinny,
953
955
  type,
954
- onBlur: () => {
955
- setActive(false);
956
- },
957
956
  onClick: () => {
958
- setActive(true);
957
+ setSpinny(true);
959
958
  onClick();
960
959
  },
961
960
  children: title
@@ -3548,183 +3547,8 @@ var LargeUploadRenderer = {
3548
3547
  }
3549
3548
  };
3550
3549
 
3551
- // ../renderers/src/NewListItem/NewDecisionRenderer.tsx
3552
- var import_components48 = require("@transferwise/components");
3553
-
3554
- // ../renderers/src/NewListItem/getInlineAlert.tsx
3555
- var import_components47 = require("@transferwise/components");
3556
- var import_jsx_runtime67 = require("react/jsx-runtime");
3557
- var getInlineAlert = (inlineAlert) => inlineAlert ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_components47.ListItem.Prompt, { sentiment: inlineAlert == null ? void 0 : inlineAlert.context, children: inlineAlert.content }) : void 0;
3558
-
3559
- // ../renderers/src/NewListItem/NewDecisionRenderer.tsx
3560
- var import_jsx_runtime68 = require("react/jsx-runtime");
3561
- var DecisionRenderer2 = {
3562
- canRenderType: "decision",
3563
- render: ({ control, margin, options, title }) => /* @__PURE__ */ (0, import_jsx_runtime68.jsxs)("div", { className: getMargin(margin), children: [
3564
- title && /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components48.Header, { as: "h2", title }),
3565
- options.map((option) => {
3566
- const {
3567
- description,
3568
- disabled,
3569
- media,
3570
- title: itemTitle,
3571
- tag,
3572
- href,
3573
- additionalText,
3574
- inlineAlert,
3575
- supportingValues,
3576
- onClick
3577
- } = option;
3578
- return /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
3579
- import_components48.ListItem,
3580
- {
3581
- title: itemTitle,
3582
- subtitle: description,
3583
- spotlight: control === "spotlight" ? tag === "spotlight-active" ? "active" : "inactive" : void 0,
3584
- disabled,
3585
- valueTitle: supportingValues == null ? void 0 : supportingValues.value,
3586
- valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
3587
- media: media ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(
3588
- OptionMedia,
3589
- {
3590
- media,
3591
- preferAvatar: control === "with-avatar" || tag === "with-avatar"
3592
- }
3593
- ) : void 0,
3594
- prompt: getInlineAlert(inlineAlert),
3595
- additionalInfo: additionalText ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components48.ListItem.AdditionalInfo, { children: additionalText }) : void 0,
3596
- control: href ? /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components48.ListItem.Navigation, { href, target: "_blank" }) : /* @__PURE__ */ (0, import_jsx_runtime68.jsx)(import_components48.ListItem.Navigation, { onClick })
3597
- },
3598
- JSON.stringify(option)
3599
- );
3600
- })
3601
- ] })
3602
- };
3603
- var NewDecisionRenderer_default = DecisionRenderer2;
3604
-
3605
- // ../renderers/src/NewListItem/NewListRenderer.tsx
3606
- var import_components50 = require("@transferwise/components");
3607
-
3608
- // ../renderers/src/NewListItem/getAdditionalInfo.tsx
3609
- var import_components49 = require("@transferwise/components");
3610
- var import_jsx_runtime69 = require("react/jsx-runtime");
3611
- var getAdditionalInfo = (additionalInfo) => {
3612
- var _a;
3613
- return additionalInfo ? (
3614
- // TODO: this type should have an href so we can render anchors
3615
- additionalInfo.onClick ? /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
3616
- import_components49.ListItem.AdditionalInfo,
3617
- {
3618
- action: {
3619
- onClick: additionalInfo.onClick,
3620
- label: (_a = additionalInfo.text) != null ? _a : ""
3621
- }
3622
- }
3623
- ) : /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(import_components49.ListItem.AdditionalInfo, { children: additionalInfo == null ? void 0 : additionalInfo.text })
3624
- ) : void 0;
3625
- };
3626
-
3627
- // ../renderers/src/NewListItem/NewListRenderer.tsx
3628
- var import_jsx_runtime70 = require("react/jsx-runtime");
3629
- var ListRenderer2 = {
3630
- canRenderType: "list",
3631
- render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)("div", { className: getMargin(margin), children: [
3632
- (title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_components50.Header, { as: "h2", title: title != null ? title : "", action: getListAction2(callToAction) }),
3633
- items.map(
3634
- ({
3635
- title: itemTitle,
3636
- description,
3637
- supportingValues,
3638
- media,
3639
- tag,
3640
- additionalInfo,
3641
- inlineAlert
3642
- }) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
3643
- import_components50.ListItem,
3644
- {
3645
- title: itemTitle,
3646
- subtitle: description,
3647
- valueTitle: supportingValues == null ? void 0 : supportingValues.value,
3648
- valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
3649
- media: media ? /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
3650
- OptionMedia,
3651
- {
3652
- media,
3653
- preferAvatar: control === "with-avatar" || tag === "with-avatar"
3654
- }
3655
- ) : void 0,
3656
- prompt: getInlineAlert(inlineAlert),
3657
- additionalInfo: getAdditionalInfo(additionalInfo)
3658
- },
3659
- itemTitle
3660
- )
3661
- )
3662
- ] })
3663
- };
3664
- var getListAction2 = (callToAction) => {
3665
- if (callToAction) {
3666
- return __spreadValues({
3667
- "aria-label": callToAction.accessibilityDescription,
3668
- text: callToAction.title,
3669
- onClick: callToAction.onClick
3670
- }, callToAction.type === "link" ? { href: callToAction.href, target: "_blank" } : {});
3671
- }
3672
- return void 0;
3673
- };
3674
- var NewListRenderer_default = ListRenderer2;
3675
-
3676
- // ../renderers/src/NewListItem/NewReviewRenderer.tsx
3677
- var import_components51 = require("@transferwise/components");
3678
- var import_jsx_runtime71 = require("react/jsx-runtime");
3679
- var ReviewRenderer2 = {
3680
- canRenderType: "review",
3681
- render: ({ callToAction, control, margin, fields, title }) => /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)("div", { className: getMargin(margin), children: [
3682
- (title || callToAction) && /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_components51.Header, { as: "h2", title: title != null ? title : "", action: getHeaderAction(callToAction) }),
3683
- fields.map(({ label, value, media, tag, additionalInfo, inlineAlert, callToAction: callToAction2 }) => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
3684
- import_components51.ListItem,
3685
- {
3686
- title: value,
3687
- subtitle: label,
3688
- inverted: true,
3689
- media: media ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
3690
- OptionMedia,
3691
- {
3692
- media,
3693
- preferAvatar: control === "with-avatar" || tag === "with-avatar"
3694
- }
3695
- ) : void 0,
3696
- control: getControl(callToAction2),
3697
- prompt: getInlineAlert(inlineAlert),
3698
- additionalInfo: getAdditionalInfo(additionalInfo)
3699
- },
3700
- label
3701
- ))
3702
- ] })
3703
- };
3704
- var getControl = (callToAction) => {
3705
- if (!callToAction) {
3706
- return void 0;
3707
- }
3708
- const { accessibilityDescription, href, title, onClick } = callToAction;
3709
- if (href) {
3710
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_components51.ListItem.Button, { href, partiallyInteractive: true, "aria-description": accessibilityDescription, children: title });
3711
- }
3712
- return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
3713
- import_components51.ListItem.Button,
3714
- {
3715
- onClick,
3716
- partiallyInteractive: true,
3717
- "aria-description": accessibilityDescription,
3718
- children: title
3719
- }
3720
- );
3721
- };
3722
- var NewReviewRenderer_default = ReviewRenderer2;
3723
-
3724
3550
  // ../renderers/src/getWiseRenderers.ts
3725
- var internalRenderers = [NewDecisionRenderer_default, NewListRenderer_default, NewReviewRenderer_default];
3726
- var getWiseRenderers = (internal = false) => [
3727
- ...internal ? internalRenderers : [],
3551
+ var getWiseRenderers = () => [
3728
3552
  AddressValidationButtonRenderer_default,
3729
3553
  AlertRenderer_default,
3730
3554
  CheckboxInputRenderer_default,
@@ -3823,12 +3647,12 @@ var messages_default = (0, import_react_intl18.defineMessages)({
3823
3647
  });
3824
3648
 
3825
3649
  // src/dynamicFlow/DynamicFlow.tsx
3826
- var import_jsx_runtime72 = require("react/jsx-runtime");
3650
+ var import_jsx_runtime67 = require("react/jsx-runtime");
3827
3651
  var wiseRenderers = getWiseRenderers();
3828
3652
  function DynamicFlowLegacy(props) {
3829
3653
  const { customFetch = globalThis.fetch } = props;
3830
3654
  const coreProps = __spreadProps(__spreadValues({}, props), { httpClient: customFetch });
3831
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_dynamic_flow_client2.DynamicFlow, __spreadValues({}, coreProps));
3655
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_dynamic_flow_client2.DynamicFlow, __spreadValues({}, coreProps));
3832
3656
  }
3833
3657
  function DynamicFlowRevamp(props) {
3834
3658
  const {
@@ -3865,7 +3689,7 @@ function DynamicFlowRevamp(props) {
3865
3689
  onLink,
3866
3690
  onCopy
3867
3691
  });
3868
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_dynamic_flow_client2.DynamicFlowCoreRevamp, __spreadValues({}, coreProps)) });
3692
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_dynamic_flow_client2.DynamicFlowCoreRevamp, __spreadValues({}, coreProps)) });
3869
3693
  }
3870
3694
  var DynamicForm = (0, import_react15.forwardRef)(function DynamicForm2(props, ref) {
3871
3695
  const {
@@ -3902,7 +3726,7 @@ var DynamicForm = (0, import_react15.forwardRef)(function DynamicForm2(props, re
3902
3726
  onLink,
3903
3727
  onCopy
3904
3728
  });
3905
- return /* @__PURE__ */ (0, import_jsx_runtime72.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime72.jsx)(import_dynamic_flow_client2.DynamicFormCore, __spreadProps(__spreadValues({}, coreProps), { ref })) });
3729
+ return /* @__PURE__ */ (0, import_jsx_runtime67.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(import_dynamic_flow_client2.DynamicFormCore, __spreadProps(__spreadValues({}, coreProps), { ref })) });
3906
3730
  });
3907
3731
  var useWiseHttpClient = (httpClient) => {
3908
3732
  const { locale } = (0, import_react_intl19.useIntl)();
package/build/main.mjs CHANGED
@@ -806,7 +806,7 @@ var loading_button_messages_default = defineMessages({
806
806
  });
807
807
 
808
808
  // ../renderers/src/ButtonRenderer/AddressValidationButtonRenderer.tsx
809
- import { useState } from "react";
809
+ import { useEffect, useState } from "react";
810
810
  import { jsx, jsxs } from "react/jsx-runtime";
811
811
  var AddressValidationButtonRenderer = {
812
812
  canRenderType: "button",
@@ -816,29 +816,27 @@ var AddressValidationButtonRenderer = {
816
816
  function AddressValidationButtonComponent(props) {
817
817
  const { disabled, margin, title, stepLoadingState, onClick } = props;
818
818
  const { formatMessage } = useIntl();
819
- const [isActive, setActive] = useState(false);
820
- const isLoading = isActive && stepLoadingState !== "idle";
819
+ const [spinny, setSpinny] = useState(false);
820
+ useEffect(() => {
821
+ if (stepLoadingState === "idle") {
822
+ setSpinny(false);
823
+ }
824
+ }, [stepLoadingState]);
821
825
  return /* @__PURE__ */ jsxs("div", { className: `d-flex flex-column ${getMargin(margin)}`, children: [
822
826
  /* @__PURE__ */ jsx(
823
827
  Button,
824
828
  {
825
829
  v2: true,
826
830
  block: true,
827
- disabled: isLoading || disabled,
831
+ disabled: stepLoadingState !== "idle" || disabled,
828
832
  priority: "primary",
829
833
  size: "md",
830
- loading: isLoading,
831
- onBlur: () => {
832
- setActive(false);
833
- },
834
- onClick: () => {
835
- setActive(true);
836
- onClick();
837
- },
834
+ loading: spinny,
835
+ onClick,
838
836
  children: title
839
837
  }
840
838
  ),
841
- isLoading && /* @__PURE__ */ jsx(InlineAlert, { type: "warning", className: "m-x-auto", children: formatMessage(loading_button_messages_default.buttonLoadingMessage) })
839
+ spinny && /* @__PURE__ */ jsx(InlineAlert, { type: "warning", className: "m-x-auto", children: formatMessage(loading_button_messages_default.buttonLoadingMessage) })
842
840
  ] });
843
841
  }
844
842
  var AddressValidationButtonRenderer_default = AddressValidationButtonRenderer;
@@ -895,7 +893,7 @@ var BoxRenderer_default = BoxRenderer;
895
893
 
896
894
  // ../renderers/src/ButtonRenderer/ButtonRenderer.tsx
897
895
  import { Button as Button2 } from "@transferwise/components";
898
- import { useState as useState2 } from "react";
896
+ import { useEffect as useEffect2, useState as useState2 } from "react";
899
897
  import { jsx as jsx4 } from "react/jsx-runtime";
900
898
  var ButtonRenderer = {
901
899
  canRenderType: "button",
@@ -903,8 +901,12 @@ var ButtonRenderer = {
903
901
  };
904
902
  function ButtonComponent(props) {
905
903
  const { control, context, disabled, margin, title, size, stepLoadingState, onClick } = props;
906
- const [isActive, setActive] = useState2(false);
907
- const isLoading = isActive && stepLoadingState !== "idle";
904
+ const [spinny, setSpinny] = useState2(false);
905
+ useEffect2(() => {
906
+ if (stepLoadingState === "idle") {
907
+ setSpinny(false);
908
+ }
909
+ }, [stepLoadingState]);
908
910
  const priority = mapControl(control);
909
911
  const type = priority === "tertiary" ? void 0 : mapContext(context);
910
912
  return /* @__PURE__ */ jsx4(
@@ -912,16 +914,13 @@ function ButtonComponent(props) {
912
914
  {
913
915
  block: true,
914
916
  className: getMargin(margin),
915
- disabled: isLoading ? false : disabled,
917
+ disabled: stepLoadingState !== "idle" || disabled,
916
918
  priority,
917
919
  size: mapSize(size),
918
- loading: isLoading,
920
+ loading: spinny,
919
921
  type,
920
- onBlur: () => {
921
- setActive(false);
922
- },
923
922
  onClick: () => {
924
- setActive(true);
923
+ setSpinny(true);
925
924
  onClick();
926
925
  },
927
926
  children: title
@@ -1524,7 +1523,7 @@ var external_confirmation_messages_default = defineMessages3({
1524
1523
 
1525
1524
  // ../renderers/src/ExternalConfirmationRenderer.tsx
1526
1525
  import { useIntl as useIntl3 } from "react-intl";
1527
- import { useEffect } from "react";
1526
+ import { useEffect as useEffect3 } from "react";
1528
1527
  import { Fragment, jsx as jsx25, jsxs as jsxs5 } from "react/jsx-runtime";
1529
1528
  var ExternalConfirmationRenderer = {
1530
1529
  canRenderType: "external-confirmation",
@@ -1538,7 +1537,7 @@ function ExternalConfirmationRendererComponent({
1538
1537
  onCancel
1539
1538
  }) {
1540
1539
  const { formatMessage } = useIntl3();
1541
- useEffect(() => {
1540
+ useEffect3(() => {
1542
1541
  if (url) {
1543
1542
  const w = window.open(url, "_blank");
1544
1543
  if (w) {
@@ -1659,7 +1658,7 @@ var HeadingRenderer_default = HeadingRenderer;
1659
1658
 
1660
1659
  // ../renderers/src/ImageRenderer/UrlImage.tsx
1661
1660
  import { Image } from "@transferwise/components";
1662
- import { useEffect as useEffect2, useState as useState3 } from "react";
1661
+ import { useEffect as useEffect4, useState as useState3 } from "react";
1663
1662
 
1664
1663
  // ../renderers/src/utils/api-utils.ts
1665
1664
  function isRelativePath(url = "") {
@@ -1679,7 +1678,7 @@ function UrlImage({
1679
1678
  httpClient
1680
1679
  }) {
1681
1680
  const [imageSource, setImageSource] = useState3("");
1682
- useEffect2(() => {
1681
+ useEffect4(() => {
1683
1682
  if (!uri.startsWith("urn:")) {
1684
1683
  void getImageSource(httpClient, uri).then(setImageSource);
1685
1684
  }
@@ -2891,7 +2890,7 @@ function RadioInputRendererComponent(props) {
2891
2890
 
2892
2891
  // ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
2893
2892
  import { Tabs } from "@transferwise/components";
2894
- import { useEffect as useEffect3 } from "react";
2893
+ import { useEffect as useEffect5 } from "react";
2895
2894
  import { Fragment as Fragment6, jsx as jsx54, jsxs as jsxs18 } from "react/jsx-runtime";
2896
2895
  function TabInputRendererComponent(props) {
2897
2896
  const {
@@ -2906,7 +2905,7 @@ function TabInputRendererComponent(props) {
2906
2905
  validationState,
2907
2906
  onSelect
2908
2907
  } = props;
2909
- useEffect3(() => {
2908
+ useEffect5(() => {
2910
2909
  if (!isValidIndex(selectedIndex, options.length)) {
2911
2910
  onSelect(0);
2912
2911
  }
@@ -3019,7 +3018,7 @@ function SelectInputRendererComponent(props) {
3019
3018
  }
3020
3019
 
3021
3020
  // ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
3022
- import { useEffect as useEffect4 } from "react";
3021
+ import { useEffect as useEffect6 } from "react";
3023
3022
  import { SegmentedControl } from "@transferwise/components";
3024
3023
  import { Fragment as Fragment8, jsx as jsx56, jsxs as jsxs20 } from "react/jsx-runtime";
3025
3024
  function SegmentedInputRendererComponent(props) {
@@ -3034,7 +3033,7 @@ function SegmentedInputRendererComponent(props) {
3034
3033
  validationState,
3035
3034
  onSelect
3036
3035
  } = props;
3037
- useEffect4(() => {
3036
+ useEffect6(() => {
3038
3037
  if (!isValidIndex2(selectedIndex, options.length)) {
3039
3038
  onSelect(0);
3040
3039
  }
@@ -3139,12 +3138,12 @@ var mapStatus = (status) => {
3139
3138
 
3140
3139
  // ../renderers/src/utils/useCustomTheme.ts
3141
3140
  import { useTheme } from "@wise/components-theming";
3142
- import { useEffect as useEffect5, useMemo } from "react";
3141
+ import { useEffect as useEffect7, useMemo } from "react";
3143
3142
  var ThemeRequiredEventName = "Theme Required";
3144
3143
  var useCustomTheme = (theme, trackEvent) => {
3145
3144
  const previousThemeHookValue = useTheme();
3146
3145
  const previousTheme = useMemo(() => previousThemeHookValue.theme, []);
3147
- useEffect5(() => {
3146
+ useEffect7(() => {
3148
3147
  trackEvent(ThemeRequiredEventName, { theme });
3149
3148
  return theme !== previousTheme ? () => {
3150
3149
  trackEvent(ThemeRequiredEventName, { theme: previousTheme });
@@ -3524,183 +3523,8 @@ var LargeUploadRenderer = {
3524
3523
  }
3525
3524
  };
3526
3525
 
3527
- // ../renderers/src/NewListItem/NewDecisionRenderer.tsx
3528
- import { Header as Header9, ListItem as ListItem2 } from "@transferwise/components";
3529
-
3530
- // ../renderers/src/NewListItem/getInlineAlert.tsx
3531
- import { ListItem } from "@transferwise/components";
3532
- import { jsx as jsx67 } from "react/jsx-runtime";
3533
- var getInlineAlert = (inlineAlert) => inlineAlert ? /* @__PURE__ */ jsx67(ListItem.Prompt, { sentiment: inlineAlert == null ? void 0 : inlineAlert.context, children: inlineAlert.content }) : void 0;
3534
-
3535
- // ../renderers/src/NewListItem/NewDecisionRenderer.tsx
3536
- import { jsx as jsx68, jsxs as jsxs27 } from "react/jsx-runtime";
3537
- var DecisionRenderer2 = {
3538
- canRenderType: "decision",
3539
- render: ({ control, margin, options, title }) => /* @__PURE__ */ jsxs27("div", { className: getMargin(margin), children: [
3540
- title && /* @__PURE__ */ jsx68(Header9, { as: "h2", title }),
3541
- options.map((option) => {
3542
- const {
3543
- description,
3544
- disabled,
3545
- media,
3546
- title: itemTitle,
3547
- tag,
3548
- href,
3549
- additionalText,
3550
- inlineAlert,
3551
- supportingValues,
3552
- onClick
3553
- } = option;
3554
- return /* @__PURE__ */ jsx68(
3555
- ListItem2,
3556
- {
3557
- title: itemTitle,
3558
- subtitle: description,
3559
- spotlight: control === "spotlight" ? tag === "spotlight-active" ? "active" : "inactive" : void 0,
3560
- disabled,
3561
- valueTitle: supportingValues == null ? void 0 : supportingValues.value,
3562
- valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
3563
- media: media ? /* @__PURE__ */ jsx68(
3564
- OptionMedia,
3565
- {
3566
- media,
3567
- preferAvatar: control === "with-avatar" || tag === "with-avatar"
3568
- }
3569
- ) : void 0,
3570
- prompt: getInlineAlert(inlineAlert),
3571
- additionalInfo: additionalText ? /* @__PURE__ */ jsx68(ListItem2.AdditionalInfo, { children: additionalText }) : void 0,
3572
- control: href ? /* @__PURE__ */ jsx68(ListItem2.Navigation, { href, target: "_blank" }) : /* @__PURE__ */ jsx68(ListItem2.Navigation, { onClick })
3573
- },
3574
- JSON.stringify(option)
3575
- );
3576
- })
3577
- ] })
3578
- };
3579
- var NewDecisionRenderer_default = DecisionRenderer2;
3580
-
3581
- // ../renderers/src/NewListItem/NewListRenderer.tsx
3582
- import { Header as Header10, ListItem as ListItem4 } from "@transferwise/components";
3583
-
3584
- // ../renderers/src/NewListItem/getAdditionalInfo.tsx
3585
- import { ListItem as ListItem3 } from "@transferwise/components";
3586
- import { jsx as jsx69 } from "react/jsx-runtime";
3587
- var getAdditionalInfo = (additionalInfo) => {
3588
- var _a;
3589
- return additionalInfo ? (
3590
- // TODO: this type should have an href so we can render anchors
3591
- additionalInfo.onClick ? /* @__PURE__ */ jsx69(
3592
- ListItem3.AdditionalInfo,
3593
- {
3594
- action: {
3595
- onClick: additionalInfo.onClick,
3596
- label: (_a = additionalInfo.text) != null ? _a : ""
3597
- }
3598
- }
3599
- ) : /* @__PURE__ */ jsx69(ListItem3.AdditionalInfo, { children: additionalInfo == null ? void 0 : additionalInfo.text })
3600
- ) : void 0;
3601
- };
3602
-
3603
- // ../renderers/src/NewListItem/NewListRenderer.tsx
3604
- import { jsx as jsx70, jsxs as jsxs28 } from "react/jsx-runtime";
3605
- var ListRenderer2 = {
3606
- canRenderType: "list",
3607
- render: ({ callToAction, control, margin, items, title }) => /* @__PURE__ */ jsxs28("div", { className: getMargin(margin), children: [
3608
- (title || callToAction) && /* @__PURE__ */ jsx70(Header10, { as: "h2", title: title != null ? title : "", action: getListAction2(callToAction) }),
3609
- items.map(
3610
- ({
3611
- title: itemTitle,
3612
- description,
3613
- supportingValues,
3614
- media,
3615
- tag,
3616
- additionalInfo,
3617
- inlineAlert
3618
- }) => /* @__PURE__ */ jsx70(
3619
- ListItem4,
3620
- {
3621
- title: itemTitle,
3622
- subtitle: description,
3623
- valueTitle: supportingValues == null ? void 0 : supportingValues.value,
3624
- valueSubtitle: supportingValues == null ? void 0 : supportingValues.subvalue,
3625
- media: media ? /* @__PURE__ */ jsx70(
3626
- OptionMedia,
3627
- {
3628
- media,
3629
- preferAvatar: control === "with-avatar" || tag === "with-avatar"
3630
- }
3631
- ) : void 0,
3632
- prompt: getInlineAlert(inlineAlert),
3633
- additionalInfo: getAdditionalInfo(additionalInfo)
3634
- },
3635
- itemTitle
3636
- )
3637
- )
3638
- ] })
3639
- };
3640
- var getListAction2 = (callToAction) => {
3641
- if (callToAction) {
3642
- return __spreadValues({
3643
- "aria-label": callToAction.accessibilityDescription,
3644
- text: callToAction.title,
3645
- onClick: callToAction.onClick
3646
- }, callToAction.type === "link" ? { href: callToAction.href, target: "_blank" } : {});
3647
- }
3648
- return void 0;
3649
- };
3650
- var NewListRenderer_default = ListRenderer2;
3651
-
3652
- // ../renderers/src/NewListItem/NewReviewRenderer.tsx
3653
- import { Header as Header11, ListItem as ListItem5 } from "@transferwise/components";
3654
- import { jsx as jsx71, jsxs as jsxs29 } from "react/jsx-runtime";
3655
- var ReviewRenderer2 = {
3656
- canRenderType: "review",
3657
- render: ({ callToAction, control, margin, fields, title }) => /* @__PURE__ */ jsxs29("div", { className: getMargin(margin), children: [
3658
- (title || callToAction) && /* @__PURE__ */ jsx71(Header11, { as: "h2", title: title != null ? title : "", action: getHeaderAction(callToAction) }),
3659
- fields.map(({ label, value, media, tag, additionalInfo, inlineAlert, callToAction: callToAction2 }) => /* @__PURE__ */ jsx71(
3660
- ListItem5,
3661
- {
3662
- title: value,
3663
- subtitle: label,
3664
- inverted: true,
3665
- media: media ? /* @__PURE__ */ jsx71(
3666
- OptionMedia,
3667
- {
3668
- media,
3669
- preferAvatar: control === "with-avatar" || tag === "with-avatar"
3670
- }
3671
- ) : void 0,
3672
- control: getControl(callToAction2),
3673
- prompt: getInlineAlert(inlineAlert),
3674
- additionalInfo: getAdditionalInfo(additionalInfo)
3675
- },
3676
- label
3677
- ))
3678
- ] })
3679
- };
3680
- var getControl = (callToAction) => {
3681
- if (!callToAction) {
3682
- return void 0;
3683
- }
3684
- const { accessibilityDescription, href, title, onClick } = callToAction;
3685
- if (href) {
3686
- return /* @__PURE__ */ jsx71(ListItem5.Button, { href, partiallyInteractive: true, "aria-description": accessibilityDescription, children: title });
3687
- }
3688
- return /* @__PURE__ */ jsx71(
3689
- ListItem5.Button,
3690
- {
3691
- onClick,
3692
- partiallyInteractive: true,
3693
- "aria-description": accessibilityDescription,
3694
- children: title
3695
- }
3696
- );
3697
- };
3698
- var NewReviewRenderer_default = ReviewRenderer2;
3699
-
3700
3526
  // ../renderers/src/getWiseRenderers.ts
3701
- var internalRenderers = [NewDecisionRenderer_default, NewListRenderer_default, NewReviewRenderer_default];
3702
- var getWiseRenderers = (internal = false) => [
3703
- ...internal ? internalRenderers : [],
3527
+ var getWiseRenderers = () => [
3704
3528
  AddressValidationButtonRenderer_default,
3705
3529
  AlertRenderer_default,
3706
3530
  CheckboxInputRenderer_default,
@@ -3799,12 +3623,12 @@ var messages_default = defineMessages9({
3799
3623
  });
3800
3624
 
3801
3625
  // src/dynamicFlow/DynamicFlow.tsx
3802
- import { jsx as jsx72 } from "react/jsx-runtime";
3626
+ import { jsx as jsx67 } from "react/jsx-runtime";
3803
3627
  var wiseRenderers = getWiseRenderers();
3804
3628
  function DynamicFlowLegacy(props) {
3805
3629
  const { customFetch = globalThis.fetch } = props;
3806
3630
  const coreProps = __spreadProps(__spreadValues({}, props), { httpClient: customFetch });
3807
- return /* @__PURE__ */ jsx72(DynamicFlowCoreLegacy, __spreadValues({}, coreProps));
3631
+ return /* @__PURE__ */ jsx67(DynamicFlowCoreLegacy, __spreadValues({}, coreProps));
3808
3632
  }
3809
3633
  function DynamicFlowRevamp(props) {
3810
3634
  const {
@@ -3841,7 +3665,7 @@ function DynamicFlowRevamp(props) {
3841
3665
  onLink,
3842
3666
  onCopy
3843
3667
  });
3844
- return /* @__PURE__ */ jsx72("div", { className, children: /* @__PURE__ */ jsx72(DynamicFlowCoreRevamp, __spreadValues({}, coreProps)) });
3668
+ return /* @__PURE__ */ jsx67("div", { className, children: /* @__PURE__ */ jsx67(DynamicFlowCoreRevamp, __spreadValues({}, coreProps)) });
3845
3669
  }
3846
3670
  var DynamicForm = forwardRef(function DynamicForm2(props, ref) {
3847
3671
  const {
@@ -3878,7 +3702,7 @@ var DynamicForm = forwardRef(function DynamicForm2(props, ref) {
3878
3702
  onLink,
3879
3703
  onCopy
3880
3704
  });
3881
- return /* @__PURE__ */ jsx72("div", { className, children: /* @__PURE__ */ jsx72(DynamicFormCore, __spreadProps(__spreadValues({}, coreProps), { ref })) });
3705
+ return /* @__PURE__ */ jsx67("div", { className, children: /* @__PURE__ */ jsx67(DynamicFormCore, __spreadProps(__spreadValues({}, coreProps), { ref })) });
3882
3706
  });
3883
3707
  var useWiseHttpClient = (httpClient) => {
3884
3708
  const { locale } = useIntl10();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client-internal",
3
- "version": "4.21.0-experimental-5de9758",
3
+ "version": "4.21.0-experimental-d108035",
4
4
  "description": "Dynamic Flow web client for Wise",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -43,7 +43,7 @@
43
43
  "@testing-library/jest-dom": "6.6.4",
44
44
  "@testing-library/react": "16.3.0",
45
45
  "@testing-library/user-event": "14.6.1",
46
- "@transferwise/components": "0.0.0-experimental-4ee52fa",
46
+ "@transferwise/components": "46.101.0",
47
47
  "@transferwise/formatting": "^2.13.4",
48
48
  "@transferwise/icons": "3.22.3",
49
49
  "@transferwise/neptune-css": "14.24.5",
@@ -74,9 +74,9 @@
74
74
  "stylelint-value-no-unknown-custom-properties": "6.0.1",
75
75
  "tsx": "4.20.3",
76
76
  "typescript": "5.9.2",
77
- "@wise/dynamic-flow-types": "3.10.0-experimental-5de9758",
78
- "@wise/dynamic-flow-fixtures": "0.0.1",
79
- "@wise/dynamic-flow-renderers": "0.0.0"
77
+ "@wise/dynamic-flow-types": "3.10.0-experimental-d108035",
78
+ "@wise/dynamic-flow-renderers": "0.0.0",
79
+ "@wise/dynamic-flow-fixtures": "0.0.1"
80
80
  },
81
81
  "peerDependencies": {
82
82
  "@transferwise/components": "^46.92.0",
@@ -91,8 +91,8 @@
91
91
  },
92
92
  "dependencies": {
93
93
  "classnames": "2.5.1",
94
- "@wise/dynamic-flow-client": "4.12.0-experimental-5de9758",
95
- "@wise/dynamic-flow-types": "3.10.0-experimental-5de9758"
94
+ "@wise/dynamic-flow-client": "4.12.0-experimental-d108035",
95
+ "@wise/dynamic-flow-types": "3.10.0-experimental-d108035"
96
96
  },
97
97
  "scripts": {
98
98
  "dev": "pnpm build:visual-tests && storybook dev -p 3005",