@wise/dynamic-flow-client-internal 4.20.0-experimental-1c8f72d → 4.20.0-experimental-189acbd

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
@@ -772,27 +772,29 @@ var AddressValidationButtonRenderer = {
772
772
  function AddressValidationButtonComponent(props) {
773
773
  const { disabled, margin, title, stepLoadingState, onClick } = props;
774
774
  const { formatMessage } = (0, import_react_intl2.useIntl)();
775
- const [spinny, setSpinny] = (0, import_react.useState)(false);
776
- (0, import_react.useEffect)(() => {
777
- if (stepLoadingState === "idle") {
778
- setSpinny(false);
779
- }
780
- }, [stepLoadingState]);
775
+ const [isActive, setActive] = (0, import_react.useState)(false);
776
+ const isLoading = isActive && stepLoadingState !== "idle";
781
777
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `d-flex flex-column ${getMargin(margin)}`, children: [
782
778
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
783
779
  import_components.Button,
784
780
  {
785
781
  v2: true,
786
782
  block: true,
787
- disabled: stepLoadingState !== "idle" || disabled,
783
+ disabled: isLoading || disabled,
788
784
  priority: "primary",
789
785
  size: "md",
790
- loading: spinny,
791
- onClick,
786
+ loading: isLoading,
787
+ onBlur: () => {
788
+ setActive(false);
789
+ },
790
+ onClick: () => {
791
+ setActive(true);
792
+ onClick();
793
+ },
792
794
  children: title
793
795
  }
794
796
  ),
795
- spinny && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.InlineAlert, { type: "warning", className: "m-x-auto", children: formatMessage(loading_button_messages_default.buttonLoadingMessage) })
797
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.InlineAlert, { type: "warning", className: "m-x-auto", children: formatMessage(loading_button_messages_default.buttonLoadingMessage) })
796
798
  ] });
797
799
  }
798
800
  var AddressValidationButtonRenderer_default = AddressValidationButtonRenderer;
@@ -857,12 +859,8 @@ var ButtonRenderer = {
857
859
  };
858
860
  function ButtonComponent(props) {
859
861
  const { control, context, disabled, margin, title, size, stepLoadingState, onClick } = props;
860
- const [spinny, setSpinny] = (0, import_react2.useState)(false);
861
- (0, import_react2.useEffect)(() => {
862
- if (stepLoadingState === "idle") {
863
- setSpinny(false);
864
- }
865
- }, [stepLoadingState]);
862
+ const [isActive, setActive] = (0, import_react2.useState)(false);
863
+ const isLoading = isActive && stepLoadingState !== "idle";
866
864
  const priority = mapControl(control);
867
865
  const type = priority === "tertiary" ? void 0 : mapContext(context);
868
866
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
@@ -870,13 +868,16 @@ function ButtonComponent(props) {
870
868
  {
871
869
  block: true,
872
870
  className: getMargin(margin),
873
- disabled: stepLoadingState !== "idle" || disabled,
871
+ disabled: isLoading ? false : disabled,
874
872
  priority,
875
873
  size: mapSize(size),
876
- loading: spinny,
874
+ loading: isLoading,
877
875
  type,
876
+ onBlur: () => {
877
+ setActive(false);
878
+ },
878
879
  onClick: () => {
879
- setSpinny(true);
880
+ setActive(true);
880
881
  onClick();
881
882
  },
882
883
  children: title
package/build/main.mjs CHANGED
@@ -728,7 +728,7 @@ var loading_button_messages_default = defineMessages({
728
728
  });
729
729
 
730
730
  // ../renderers/src/ButtonRenderer/AddressValidationButtonRenderer.tsx
731
- import { useEffect, useState } from "react";
731
+ import { useState } from "react";
732
732
  import { jsx, jsxs } from "react/jsx-runtime";
733
733
  var AddressValidationButtonRenderer = {
734
734
  canRenderType: "button",
@@ -738,27 +738,29 @@ var AddressValidationButtonRenderer = {
738
738
  function AddressValidationButtonComponent(props) {
739
739
  const { disabled, margin, title, stepLoadingState, onClick } = props;
740
740
  const { formatMessage } = useIntl();
741
- const [spinny, setSpinny] = useState(false);
742
- useEffect(() => {
743
- if (stepLoadingState === "idle") {
744
- setSpinny(false);
745
- }
746
- }, [stepLoadingState]);
741
+ const [isActive, setActive] = useState(false);
742
+ const isLoading = isActive && stepLoadingState !== "idle";
747
743
  return /* @__PURE__ */ jsxs("div", { className: `d-flex flex-column ${getMargin(margin)}`, children: [
748
744
  /* @__PURE__ */ jsx(
749
745
  Button,
750
746
  {
751
747
  v2: true,
752
748
  block: true,
753
- disabled: stepLoadingState !== "idle" || disabled,
749
+ disabled: isLoading || disabled,
754
750
  priority: "primary",
755
751
  size: "md",
756
- loading: spinny,
757
- onClick,
752
+ loading: isLoading,
753
+ onBlur: () => {
754
+ setActive(false);
755
+ },
756
+ onClick: () => {
757
+ setActive(true);
758
+ onClick();
759
+ },
758
760
  children: title
759
761
  }
760
762
  ),
761
- spinny && /* @__PURE__ */ jsx(InlineAlert, { type: "warning", className: "m-x-auto", children: formatMessage(loading_button_messages_default.buttonLoadingMessage) })
763
+ isLoading && /* @__PURE__ */ jsx(InlineAlert, { type: "warning", className: "m-x-auto", children: formatMessage(loading_button_messages_default.buttonLoadingMessage) })
762
764
  ] });
763
765
  }
764
766
  var AddressValidationButtonRenderer_default = AddressValidationButtonRenderer;
@@ -815,7 +817,7 @@ var BoxRenderer_default = BoxRenderer;
815
817
 
816
818
  // ../renderers/src/ButtonRenderer/ButtonRenderer.tsx
817
819
  import { Button as Button2 } from "@transferwise/components";
818
- import { useEffect as useEffect2, useState as useState2 } from "react";
820
+ import { useState as useState2 } from "react";
819
821
  import { jsx as jsx4 } from "react/jsx-runtime";
820
822
  var ButtonRenderer = {
821
823
  canRenderType: "button",
@@ -823,12 +825,8 @@ var ButtonRenderer = {
823
825
  };
824
826
  function ButtonComponent(props) {
825
827
  const { control, context, disabled, margin, title, size, stepLoadingState, onClick } = props;
826
- const [spinny, setSpinny] = useState2(false);
827
- useEffect2(() => {
828
- if (stepLoadingState === "idle") {
829
- setSpinny(false);
830
- }
831
- }, [stepLoadingState]);
828
+ const [isActive, setActive] = useState2(false);
829
+ const isLoading = isActive && stepLoadingState !== "idle";
832
830
  const priority = mapControl(control);
833
831
  const type = priority === "tertiary" ? void 0 : mapContext(context);
834
832
  return /* @__PURE__ */ jsx4(
@@ -836,13 +834,16 @@ function ButtonComponent(props) {
836
834
  {
837
835
  block: true,
838
836
  className: getMargin(margin),
839
- disabled: stepLoadingState !== "idle" || disabled,
837
+ disabled: isLoading ? false : disabled,
840
838
  priority,
841
839
  size: mapSize(size),
842
- loading: spinny,
840
+ loading: isLoading,
843
841
  type,
842
+ onBlur: () => {
843
+ setActive(false);
844
+ },
844
845
  onClick: () => {
845
- setSpinny(true);
846
+ setActive(true);
846
847
  onClick();
847
848
  },
848
849
  children: title
@@ -1317,7 +1318,7 @@ var external_confirmation_messages_default = defineMessages3({
1317
1318
 
1318
1319
  // ../renderers/src/ExternalConfirmationRenderer.tsx
1319
1320
  import { useIntl as useIntl3 } from "react-intl";
1320
- import { useEffect as useEffect3 } from "react";
1321
+ import { useEffect } from "react";
1321
1322
  import { Fragment, jsx as jsx20, jsxs as jsxs5 } from "react/jsx-runtime";
1322
1323
  var ExternalConfirmationRenderer = {
1323
1324
  canRenderType: "external-confirmation",
@@ -1331,7 +1332,7 @@ function ExternalConfirmationRendererComponent({
1331
1332
  onCancel
1332
1333
  }) {
1333
1334
  const { formatMessage } = useIntl3();
1334
- useEffect3(() => {
1335
+ useEffect(() => {
1335
1336
  if (url) {
1336
1337
  const w = window.open(url, "_blank");
1337
1338
  if (w) {
@@ -1452,7 +1453,7 @@ var HeadingRenderer_default = HeadingRenderer;
1452
1453
 
1453
1454
  // ../renderers/src/ImageRenderer/UrlImage.tsx
1454
1455
  import { Image } from "@transferwise/components";
1455
- import { useEffect as useEffect4, useState as useState3 } from "react";
1456
+ import { useEffect as useEffect2, useState as useState3 } from "react";
1456
1457
 
1457
1458
  // ../renderers/src/utils/api-utils.ts
1458
1459
  function isRelativePath(url = "") {
@@ -1472,7 +1473,7 @@ function UrlImage({
1472
1473
  httpClient
1473
1474
  }) {
1474
1475
  const [imageSource, setImageSource] = useState3("");
1475
- useEffect4(() => {
1476
+ useEffect2(() => {
1476
1477
  if (!uri.startsWith("urn:")) {
1477
1478
  void getImageSource(httpClient, uri).then(setImageSource);
1478
1479
  }
@@ -2710,7 +2711,7 @@ function RadioInputRendererComponent(props) {
2710
2711
 
2711
2712
  // ../renderers/src/SelectInputRenderer/TabInputRendererComponent.tsx
2712
2713
  import { Tabs } from "@transferwise/components";
2713
- import { useEffect as useEffect5 } from "react";
2714
+ import { useEffect as useEffect3 } from "react";
2714
2715
  import { Fragment as Fragment6, jsx as jsx50, jsxs as jsxs18 } from "react/jsx-runtime";
2715
2716
  function TabInputRendererComponent(props) {
2716
2717
  const {
@@ -2725,7 +2726,7 @@ function TabInputRendererComponent(props) {
2725
2726
  validationState,
2726
2727
  onSelect
2727
2728
  } = props;
2728
- useEffect5(() => {
2729
+ useEffect3(() => {
2729
2730
  if (!isValidIndex(selectedIndex, options.length)) {
2730
2731
  onSelect(0);
2731
2732
  }
@@ -2838,7 +2839,7 @@ function SelectInputRendererComponent(props) {
2838
2839
  }
2839
2840
 
2840
2841
  // ../renderers/src/SelectInputRenderer/SegmentedInputRendererComponent.tsx
2841
- import { useEffect as useEffect6 } from "react";
2842
+ import { useEffect as useEffect4 } from "react";
2842
2843
  import { SegmentedControl } from "@transferwise/components";
2843
2844
  import { Fragment as Fragment8, jsx as jsx52, jsxs as jsxs20 } from "react/jsx-runtime";
2844
2845
  function SegmentedInputRendererComponent(props) {
@@ -2853,7 +2854,7 @@ function SegmentedInputRendererComponent(props) {
2853
2854
  validationState,
2854
2855
  onSelect
2855
2856
  } = props;
2856
- useEffect6(() => {
2857
+ useEffect4(() => {
2857
2858
  if (!isValidIndex2(selectedIndex, options.length)) {
2858
2859
  onSelect(0);
2859
2860
  }
@@ -2958,12 +2959,12 @@ var mapStatus = (status) => {
2958
2959
 
2959
2960
  // ../renderers/src/utils/useCustomTheme.ts
2960
2961
  import { useTheme } from "@wise/components-theming";
2961
- import { useEffect as useEffect7, useMemo } from "react";
2962
+ import { useEffect as useEffect5, useMemo } from "react";
2962
2963
  var ThemeRequiredEventName = "Theme Required";
2963
2964
  var useCustomTheme = (theme, trackEvent) => {
2964
2965
  const previousThemeHookValue = useTheme();
2965
2966
  const previousTheme = useMemo(() => previousThemeHookValue.theme, []);
2966
- useEffect7(() => {
2967
+ useEffect5(() => {
2967
2968
  trackEvent(ThemeRequiredEventName, { theme });
2968
2969
  return theme !== previousTheme ? () => {
2969
2970
  trackEvent(ThemeRequiredEventName, { theme: previousTheme });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client-internal",
3
- "version": "4.20.0-experimental-1c8f72d",
3
+ "version": "4.20.0-experimental-189acbd",
4
4
  "description": "Dynamic Flow web client for Wise",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -75,8 +75,8 @@
75
75
  "tsx": "4.20.3",
76
76
  "typescript": "5.8.3",
77
77
  "@wise/dynamic-flow-fixtures": "0.0.1",
78
- "@wise/dynamic-flow-types": "3.9.0-experimental-1c8f72d",
79
- "@wise/dynamic-flow-renderers": "0.0.0"
78
+ "@wise/dynamic-flow-renderers": "0.0.0",
79
+ "@wise/dynamic-flow-types": "3.9.0-experimental-189acbd"
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-types": "3.9.0-experimental-1c8f72d",
95
- "@wise/dynamic-flow-client": "4.11.0-experimental-1c8f72d"
94
+ "@wise/dynamic-flow-client": "4.11.0-experimental-189acbd",
95
+ "@wise/dynamic-flow-types": "3.9.0-experimental-189acbd"
96
96
  },
97
97
  "scripts": {
98
98
  "dev": "pnpm build:visual-tests && storybook dev -p 3005",