@wise/dynamic-flow-client-internal 5.0.0-experimental-c979470 → 5.0.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
@@ -2688,11 +2688,13 @@ var import_components_theming = require("@wise/components-theming");
2688
2688
  var import_react16 = require("react");
2689
2689
  var ThemeRequiredEventName = "Theme Required";
2690
2690
  var useCustomTheme = (theme, trackEvent) => {
2691
- const previousThemeHookValue = (0, import_components_theming.useTheme)();
2692
- const previousTheme = (0, import_react16.useMemo)(() => previousThemeHookValue.theme, []);
2691
+ const theming = (0, import_components_theming.useTheme)();
2692
+ const previousTheme = (0, import_react16.useMemo)(() => theming.theme, []);
2693
2693
  (0, import_react16.useEffect)(() => {
2694
+ theming.setTheme(theme);
2694
2695
  trackEvent(ThemeRequiredEventName, { theme });
2695
2696
  return theme !== previousTheme ? () => {
2697
+ theming.setTheme(previousTheme);
2696
2698
  trackEvent(ThemeRequiredEventName, { theme: previousTheme });
2697
2699
  } : () => {
2698
2700
  };
@@ -3729,10 +3731,25 @@ var getWiseRenderers = () => [
3729
3731
  ReviewLegacyRenderer_default
3730
3732
  ];
3731
3733
 
3734
+ // src/dynamicFlow/messages.ts
3735
+ var import_react_intl26 = require("react-intl");
3736
+ var messages_default = (0, import_react_intl26.defineMessages)({
3737
+ copied: {
3738
+ id: "df.wise.CopyFeedback.copy",
3739
+ defaultMessage: "Copied to clipboard",
3740
+ description: "Appears in a snackbar when the copy operation succeeds."
3741
+ },
3742
+ copyFailed: {
3743
+ id: "df.wise.CopyFeedback.copyFailed",
3744
+ defaultMessage: "Failed to copy to clipboard",
3745
+ description: "Appears in a snackbar when the copy operation fails."
3746
+ }
3747
+ });
3748
+
3732
3749
  // src/dynamicFlow/telemetry/app-version.ts
3733
3750
  var appVersion = (
3734
3751
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
3735
- typeof process !== "undefined" ? "4.38.0" : "0.0.0"
3752
+ typeof process !== "undefined" ? "5.0.0" : "0.0.0"
3736
3753
  );
3737
3754
 
3738
3755
  // src/dynamicFlow/telemetry/getLogEvent.ts
@@ -3758,34 +3775,13 @@ var logToRollbar = (level, message, extra) => {
3758
3775
  };
3759
3776
 
3760
3777
  // src/dynamicFlow/telemetry/getTrackEvent.ts
3761
- var import_components_theming2 = require("@wise/components-theming");
3762
- var getTrackEvent = (onEvent, onAnalytics, onThemeChange) => (name, properties) => {
3778
+ var getTrackEvent = (onEvent, onAnalytics) => (name, properties) => {
3763
3779
  onEvent == null ? void 0 : onEvent(name, properties);
3764
- if (name.includes(ThemeRequiredEventName)) {
3765
- const { theme } = properties != null ? properties : { theme: "personal" };
3766
- if (theme && (0, import_components_theming2.isThemeModern)(theme)) {
3767
- onThemeChange == null ? void 0 : onThemeChange(theme);
3768
- }
3769
- } else {
3780
+ if (!name.includes(ThemeRequiredEventName)) {
3770
3781
  onAnalytics == null ? void 0 : onAnalytics(name, properties);
3771
3782
  }
3772
3783
  };
3773
3784
 
3774
- // src/dynamicFlow/messages.ts
3775
- var import_react_intl26 = require("react-intl");
3776
- var messages_default = (0, import_react_intl26.defineMessages)({
3777
- copied: {
3778
- id: "df.wise.CopyFeedback.copy",
3779
- defaultMessage: "Copied to clipboard",
3780
- description: "Appears in a snackbar when the copy operation succeeds."
3781
- },
3782
- copyFailed: {
3783
- id: "df.wise.CopyFeedback.copyFailed",
3784
- defaultMessage: "Failed to copy to clipboard",
3785
- description: "Appears in a snackbar when the copy operation fails."
3786
- }
3787
- });
3788
-
3789
3785
  // src/dynamicFlow/DynamicFlow.tsx
3790
3786
  var import_jsx_runtime82 = require("react/jsx-runtime");
3791
3787
  var wiseRenderers = getWiseRenderers();
@@ -3799,18 +3795,14 @@ function DynamicFlow(props) {
3799
3795
  onAnalytics,
3800
3796
  onEvent,
3801
3797
  onLog,
3802
- onLink = openLinkInNewTab,
3803
- onThemeChange
3798
+ onLink = openLinkInNewTab
3804
3799
  } = props;
3805
3800
  const { formatMessage } = (0, import_react_intl27.useIntl)();
3806
3801
  const createSnackBar = useSnackBarIfAvailable();
3807
3802
  const httpClient = useWiseHttpClient(customFetch);
3808
3803
  const mergedRenderers = (0, import_react19.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
3809
3804
  const logEvent = (0, import_react19.useMemo)(() => getLogEvent(onLog), [onLog]);
3810
- const trackEvent = (0, import_react19.useMemo)(
3811
- () => getTrackEvent(onEvent, onAnalytics, onThemeChange),
3812
- [onEvent, onAnalytics, onThemeChange]
3813
- );
3805
+ const trackEvent = (0, import_react19.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
3814
3806
  const onCopy = (copiedContent) => {
3815
3807
  if (copiedContent) {
3816
3808
  createSnackBar({ text: formatMessage(messages_default.copied) });
@@ -3839,18 +3831,14 @@ var DynamicForm = (0, import_react19.forwardRef)(function DynamicForm2(props, re
3839
3831
  onAnalytics,
3840
3832
  onEvent,
3841
3833
  onLog,
3842
- onLink = openLinkInNewTab,
3843
- onThemeChange
3834
+ onLink = openLinkInNewTab
3844
3835
  } = props;
3845
3836
  const { formatMessage } = (0, import_react_intl27.useIntl)();
3846
3837
  const createSnackBar = useSnackBarIfAvailable();
3847
3838
  const httpClient = useWiseHttpClient(customFetch);
3848
3839
  const mergedRenderers = (0, import_react19.useMemo)(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
3849
3840
  const logEvent = (0, import_react19.useMemo)(() => getLogEvent(onLog), [onLog]);
3850
- const trackEvent = (0, import_react19.useMemo)(
3851
- () => getTrackEvent(onEvent, onAnalytics, onThemeChange),
3852
- [onEvent, onAnalytics, onThemeChange]
3853
- );
3841
+ const trackEvent = (0, import_react19.useMemo)(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
3854
3842
  const onCopy = (copiedContent) => {
3855
3843
  if (copiedContent) {
3856
3844
  createSnackBar({ text: formatMessage(messages_default.copied) });
package/build/main.mjs CHANGED
@@ -2676,11 +2676,13 @@ import { useTheme } from "@wise/components-theming";
2676
2676
  import { useEffect as useEffect8, useMemo } from "react";
2677
2677
  var ThemeRequiredEventName = "Theme Required";
2678
2678
  var useCustomTheme = (theme, trackEvent) => {
2679
- const previousThemeHookValue = useTheme();
2680
- const previousTheme = useMemo(() => previousThemeHookValue.theme, []);
2679
+ const theming = useTheme();
2680
+ const previousTheme = useMemo(() => theming.theme, []);
2681
2681
  useEffect8(() => {
2682
+ theming.setTheme(theme);
2682
2683
  trackEvent(ThemeRequiredEventName, { theme });
2683
2684
  return theme !== previousTheme ? () => {
2685
+ theming.setTheme(previousTheme);
2684
2686
  trackEvent(ThemeRequiredEventName, { theme: previousTheme });
2685
2687
  } : () => {
2686
2688
  };
@@ -3723,10 +3725,25 @@ var getWiseRenderers = () => [
3723
3725
  ReviewLegacyRenderer_default
3724
3726
  ];
3725
3727
 
3728
+ // src/dynamicFlow/messages.ts
3729
+ import { defineMessages as defineMessages12 } from "react-intl";
3730
+ var messages_default = defineMessages12({
3731
+ copied: {
3732
+ id: "df.wise.CopyFeedback.copy",
3733
+ defaultMessage: "Copied to clipboard",
3734
+ description: "Appears in a snackbar when the copy operation succeeds."
3735
+ },
3736
+ copyFailed: {
3737
+ id: "df.wise.CopyFeedback.copyFailed",
3738
+ defaultMessage: "Failed to copy to clipboard",
3739
+ description: "Appears in a snackbar when the copy operation fails."
3740
+ }
3741
+ });
3742
+
3726
3743
  // src/dynamicFlow/telemetry/app-version.ts
3727
3744
  var appVersion = (
3728
3745
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
3729
- typeof process !== "undefined" ? "4.38.0" : "0.0.0"
3746
+ typeof process !== "undefined" ? "5.0.0" : "0.0.0"
3730
3747
  );
3731
3748
 
3732
3749
  // src/dynamicFlow/telemetry/getLogEvent.ts
@@ -3752,34 +3769,13 @@ var logToRollbar = (level, message, extra) => {
3752
3769
  };
3753
3770
 
3754
3771
  // src/dynamicFlow/telemetry/getTrackEvent.ts
3755
- import { isThemeModern } from "@wise/components-theming";
3756
- var getTrackEvent = (onEvent, onAnalytics, onThemeChange) => (name, properties) => {
3772
+ var getTrackEvent = (onEvent, onAnalytics) => (name, properties) => {
3757
3773
  onEvent == null ? void 0 : onEvent(name, properties);
3758
- if (name.includes(ThemeRequiredEventName)) {
3759
- const { theme } = properties != null ? properties : { theme: "personal" };
3760
- if (theme && isThemeModern(theme)) {
3761
- onThemeChange == null ? void 0 : onThemeChange(theme);
3762
- }
3763
- } else {
3774
+ if (!name.includes(ThemeRequiredEventName)) {
3764
3775
  onAnalytics == null ? void 0 : onAnalytics(name, properties);
3765
3776
  }
3766
3777
  };
3767
3778
 
3768
- // src/dynamicFlow/messages.ts
3769
- import { defineMessages as defineMessages12 } from "react-intl";
3770
- var messages_default = defineMessages12({
3771
- copied: {
3772
- id: "df.wise.CopyFeedback.copy",
3773
- defaultMessage: "Copied to clipboard",
3774
- description: "Appears in a snackbar when the copy operation succeeds."
3775
- },
3776
- copyFailed: {
3777
- id: "df.wise.CopyFeedback.copyFailed",
3778
- defaultMessage: "Failed to copy to clipboard",
3779
- description: "Appears in a snackbar when the copy operation fails."
3780
- }
3781
- });
3782
-
3783
3779
  // src/dynamicFlow/DynamicFlow.tsx
3784
3780
  import { jsx as jsx82 } from "react/jsx-runtime";
3785
3781
  var wiseRenderers = getWiseRenderers();
@@ -3793,18 +3789,14 @@ function DynamicFlow(props) {
3793
3789
  onAnalytics,
3794
3790
  onEvent,
3795
3791
  onLog,
3796
- onLink = openLinkInNewTab,
3797
- onThemeChange
3792
+ onLink = openLinkInNewTab
3798
3793
  } = props;
3799
3794
  const { formatMessage } = useIntl15();
3800
3795
  const createSnackBar = useSnackBarIfAvailable();
3801
3796
  const httpClient = useWiseHttpClient(customFetch);
3802
3797
  const mergedRenderers = useMemo2(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
3803
3798
  const logEvent = useMemo2(() => getLogEvent(onLog), [onLog]);
3804
- const trackEvent = useMemo2(
3805
- () => getTrackEvent(onEvent, onAnalytics, onThemeChange),
3806
- [onEvent, onAnalytics, onThemeChange]
3807
- );
3799
+ const trackEvent = useMemo2(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
3808
3800
  const onCopy = (copiedContent) => {
3809
3801
  if (copiedContent) {
3810
3802
  createSnackBar({ text: formatMessage(messages_default.copied) });
@@ -3833,18 +3825,14 @@ var DynamicForm = forwardRef(function DynamicForm2(props, ref) {
3833
3825
  onAnalytics,
3834
3826
  onEvent,
3835
3827
  onLog,
3836
- onLink = openLinkInNewTab,
3837
- onThemeChange
3828
+ onLink = openLinkInNewTab
3838
3829
  } = props;
3839
3830
  const { formatMessage } = useIntl15();
3840
3831
  const createSnackBar = useSnackBarIfAvailable();
3841
3832
  const httpClient = useWiseHttpClient(customFetch);
3842
3833
  const mergedRenderers = useMemo2(() => [...renderers != null ? renderers : [], ...wiseRenderers], [renderers]);
3843
3834
  const logEvent = useMemo2(() => getLogEvent(onLog), [onLog]);
3844
- const trackEvent = useMemo2(
3845
- () => getTrackEvent(onEvent, onAnalytics, onThemeChange),
3846
- [onEvent, onAnalytics, onThemeChange]
3847
- );
3835
+ const trackEvent = useMemo2(() => getTrackEvent(onEvent, onAnalytics), [onEvent, onAnalytics]);
3848
3836
  const onCopy = (copiedContent) => {
3849
3837
  if (copiedContent) {
3850
3838
  createSnackBar({ text: formatMessage(messages_default.copied) });
@@ -1,8 +1,6 @@
1
1
  import type { ForwardRefExoticComponent, RefAttributes } from 'react';
2
2
  import type { DynamicFlowProps as DynamicFlowCoreProps, DynamicFormController } from '@wise/dynamic-flow-client';
3
- import { Theming } from '@wise/components-theming';
4
3
  type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
5
- export type OnThemeChange = (theme: Theming['theme']) => void;
6
4
  type Prettify<T> = {
7
5
  [K in keyof T]: T[K];
8
6
  } & {};
@@ -14,7 +12,6 @@ export type DynamicFlowProps = Prettify<MakeOptional<Omit<DynamicFlowCoreProps,
14
12
  displayStepTitle?: boolean;
15
13
  customFetch?: DynamicFlowCoreProps['httpClient'];
16
14
  onAnalytics?: DynamicFlowCoreProps['onEvent'];
17
- onThemeChange?: OnThemeChange;
18
15
  }>;
19
16
  export declare function DynamicFlow(props: DynamicFlowProps): import("react/jsx-runtime").JSX.Element;
20
17
  export type DynamicFormProps = Omit<DynamicFlowProps, 'onCompletion'> & {
@@ -1,5 +1,4 @@
1
1
  import { DynamicFlowProps } from '@wise/dynamic-flow-client';
2
- import { OnThemeChange } from '../DynamicFlow';
3
2
  type OnEvent = DynamicFlowProps['onEvent'];
4
- export declare const getTrackEvent: (onEvent: OnEvent, onAnalytics: OnEvent, onThemeChange: OnThemeChange | undefined) => OnEvent;
3
+ export declare const getTrackEvent: (onEvent: OnEvent, onAnalytics: OnEvent) => OnEvent;
5
4
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client-internal",
3
- "version": "5.0.0-experimental-c979470",
3
+ "version": "5.0.0",
4
4
  "description": "Dynamic Flow web client for Wise",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -54,10 +54,10 @@
54
54
  "@types/react": "18.3.26",
55
55
  "@types/react-dom": "18.3.7",
56
56
  "@wise/art": "2.24.7",
57
- "@wise/components-theming": "^1.7.0",
57
+ "@wise/components-theming": "^1.8.0",
58
58
  "babel-jest": "30.2.0",
59
59
  "currency-flags": "4.0.7",
60
- "esbuild": "0.25.9",
60
+ "esbuild": "0.27.0",
61
61
  "eslint-plugin-storybook": "9.1.16",
62
62
  "framer-motion": "^12.23.24",
63
63
  "jest": "30.2.0",
@@ -78,8 +78,8 @@
78
78
  "stylelint-value-no-unknown-custom-properties": "6.0.1",
79
79
  "tsx": "4.20.6",
80
80
  "typescript": "5.9.3",
81
+ "@wise/dynamic-flow-types": "4.0.0",
81
82
  "@wise/dynamic-flow-fixtures": "0.0.1",
82
- "@wise/dynamic-flow-types": "4.0.0-experimental-c979470",
83
83
  "@wise/dynamic-flow-renderers": "0.0.0"
84
84
  },
85
85
  "peerDependencies": {
@@ -88,14 +88,14 @@
88
88
  "@transferwise/icons": "^3 || ^4",
89
89
  "@transferwise/neptune-css": "^14.22.0",
90
90
  "@wise/art": "^2.19.0",
91
- "@wise/components-theming": "^0.7.1 || ^1",
91
+ "@wise/components-theming": "^1.8.0",
92
92
  "react": "^18",
93
93
  "react-dom": "^18",
94
94
  "react-intl": "^6"
95
95
  },
96
96
  "dependencies": {
97
- "@wise/dynamic-flow-types": "4.0.0-experimental-c979470",
98
- "@wise/dynamic-flow-client": "5.0.0-experimental-c979470"
97
+ "@wise/dynamic-flow-client": "5.0.0",
98
+ "@wise/dynamic-flow-types": "4.0.0"
99
99
  },
100
100
  "scripts": {
101
101
  "dev": "pnpm build:visual-tests && storybook dev -p 3005",