@wise/dynamic-flow-client 4.1.0-experimental-6bb6f02 → 4.2.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.
@@ -1,6 +1,6 @@
1
1
  import type { PerformPersistAsync } from '../features/persistAsync/getPerformPersistAsync';
2
2
  import type { IsInvalidCheck } from '../features/validation/value-checks';
3
- import type { InputComponent, OnValueChange, PersistedState, RepeatableSummary, UpdateComponent, ValidationAsyncState } from '../types';
3
+ import type { InputComponent, OnValueChange, PersistedState, RepeatableSummary, Suggestions, UpdateComponent, ValidationAsyncState } from '../types';
4
4
  import type { PerformRefresh } from '../features/refresh/getPerformRefresh';
5
5
  import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
6
6
  export type DateInputComponent = InputComponent<string | null> & {
@@ -8,10 +8,11 @@ export type DateInputComponent = InputComponent<string | null> & {
8
8
  minimumDate?: string;
9
9
  maximumDate?: string;
10
10
  persistedState: PersistedState;
11
+ suggestions?: Suggestions;
11
12
  validationAsyncState: ValidationAsyncState;
12
13
  onChange: (value: string | null) => void;
13
14
  };
14
- export declare const createDateInputComponent: (textInputProps: Pick<DateInputComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "errors" | "description" | "disabled" | "help" | "hidden" | "icon" | "image" | "minimumDate" | "maximumDate" | "persistedState" | "placeholder" | "required" | "title" | "value" | "validationAsyncState"> & {
15
+ export declare const createDateInputComponent: (textInputProps: Pick<DateInputComponent, "uid" | "id" | "analyticsId" | "autoComplete" | "control" | "errors" | "description" | "disabled" | "help" | "hidden" | "icon" | "image" | "minimumDate" | "maximumDate" | "persistedState" | "placeholder" | "required" | "suggestions" | "title" | "value" | "validationAsyncState"> & {
15
16
  checks: IsInvalidCheck<string | null>[];
16
17
  performPersistAsync: PerformPersistAsync | undefined;
17
18
  performRefresh: PerformRefresh | undefined;
@@ -1,7 +1,8 @@
1
- import type { BaseComponent, DomainComponent, LoadingState, LocalValue, OnAction, OnRefresh, UpdateComponent } from '../types';
1
+ import type { BaseComponent, DomainComponent, LoadingState, LocalValue, OnAction, UpdateComponent } from '../types';
2
2
  import type { Step } from '@wise/dynamic-flow-types/build/next';
3
3
  import type { AnalyticsEventDispatcher } from '../features/events';
4
4
  import type { StepPolling } from '../features/polling/getStepPolling';
5
+ import { StepRefreshAfter } from '../features/refreshAfter/getStepRefreshAfter';
5
6
  export type StepDomainComponent = BaseComponent & {
6
7
  type: 'step';
7
8
  back?: BackNavigation;
@@ -15,10 +16,8 @@ export type StepDomainComponent = BaseComponent & {
15
16
  title?: string;
16
17
  getChildren: () => DomainComponent[];
17
18
  getLocalValue: () => LocalValue;
18
- getRefreshAfter: () => string | undefined;
19
19
  setLoadingState: (loadingState: LoadingState) => void;
20
20
  onAction: OnAction;
21
- onRefresh: OnRefresh;
22
21
  stop: () => void;
23
22
  trackEvent: AnalyticsEventDispatcher<string>;
24
23
  };
@@ -26,8 +25,9 @@ type BackNavigation = {
26
25
  title?: string;
27
26
  onClick: () => void;
28
27
  };
29
- export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "uid" | "back" | "components" | "control" | "description" | "error" | "external" | "loadingState" | "step" | "title" | "trackEvent" | "onAction" | "onRefresh"> & {
28
+ export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "uid" | "back" | "components" | "control" | "description" | "error" | "external" | "loadingState" | "step" | "title" | "trackEvent" | "onAction"> & {
30
29
  stepPolling?: StepPolling;
30
+ stepRefreshAfter?: StepRefreshAfter;
31
31
  updateComponent: UpdateComponent;
32
32
  }) => StepDomainComponent;
33
33
  export {};
@@ -2,7 +2,7 @@ import type { PerformPersistAsync } from '../features/persistAsync/getPerformPer
2
2
  import { type PerformRefresh } from '../features/refresh/getPerformRefresh';
3
3
  import type { IsInvalidCheck } from '../features/validation/value-checks';
4
4
  import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
5
- import type { Autocapitalization, InputComponent, OnValueChange, PersistedState, RepeatableSummary, UpdateComponent, ValidationAsyncState } from '../types';
5
+ import type { Autocapitalization, InputComponent, OnValueChange, PersistedState, RepeatableSummary, Suggestions, UpdateComponent, ValidationAsyncState } from '../types';
6
6
  export type TextInputComponent = InputComponent<string | null> & {
7
7
  type: 'text';
8
8
  autocapitalization?: Autocapitalization;
@@ -10,10 +10,11 @@ export type TextInputComponent = InputComponent<string | null> & {
10
10
  maxLength?: number;
11
11
  minLength?: number;
12
12
  persistedState: PersistedState;
13
+ suggestions?: Suggestions;
13
14
  validationAsyncState: ValidationAsyncState;
14
15
  onChange: (value: string | null) => void;
15
16
  };
16
- export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "uid" | "id" | "analyticsId" | "autocapitalization" | "autoComplete" | "control" | "errors" | "description" | "disabled" | "displayFormat" | "help" | "hidden" | "icon" | "image" | "maxLength" | "minLength" | "persistedState" | "placeholder" | "required" | "title" | "value" | "validationAsyncState"> & {
17
+ export declare const createTextInputComponent: (textInputProps: Pick<TextInputComponent, "uid" | "id" | "analyticsId" | "autocapitalization" | "autoComplete" | "control" | "errors" | "description" | "disabled" | "displayFormat" | "help" | "hidden" | "icon" | "image" | "maxLength" | "minLength" | "persistedState" | "placeholder" | "required" | "suggestions" | "title" | "value" | "validationAsyncState"> & {
17
18
  checks: IsInvalidCheck<string | null>[];
18
19
  performPersistAsync: PerformPersistAsync | undefined;
19
20
  performValidationAsync: PerformValidationAsync | undefined;
@@ -0,0 +1,2 @@
1
+ import { LocalValue } from '../../types';
2
+ export declare const isOrWasValid: <V extends LocalValue>(getErrors: (value: V) => string[], previous: V, current: V) => boolean;
@@ -0,0 +1,10 @@
1
+ import { OnRefresh } from '../../types';
2
+ export type StepRefreshAfter = {
3
+ stop: () => void;
4
+ };
5
+ type Props = {
6
+ refreshAfter: string;
7
+ onRefresh: OnRefresh;
8
+ };
9
+ export declare const getStepRefreshAfter: ({ refreshAfter, onRefresh }: Props) => StepRefreshAfter;
10
+ export {};
@@ -93,6 +93,16 @@ export type Autocapitalization = 'none' | 'sentences' | 'words' | 'characters';
93
93
  export type Bias = 'none' | 'start' | 'end';
94
94
  export type Context = 'positive' | 'negative' | 'warning' | 'neutral';
95
95
  export type UploadSource = 'file' | 'camera';
96
+ export type Suggestions = {
97
+ values: SuggestionsValue[];
98
+ };
99
+ export type SuggestionsValue = {
100
+ label: string;
101
+ value?: JsonElement;
102
+ icon?: Icon;
103
+ image?: Image;
104
+ tag?: string;
105
+ };
96
106
  export type RepeatableSummary = {
97
107
  title?: string;
98
108
  description?: string;
@@ -1,4 +1,4 @@
1
1
  import type { StepRendererProps } from '@wise/dynamic-flow-types/build/renderers';
2
2
  import type { StepDomainComponent } from '../domain/components/StepDomainComponent';
3
3
  import { type RendererMapperProps } from './mappers/componentToRendererProps';
4
- export declare const stepComponentToProps: ({ uid, back, control, description, error, external, loadingState, title, components, }: StepDomainComponent, rendererMapperProps: RendererMapperProps) => StepRendererProps;
4
+ export declare const stepComponentToProps: ({ uid, back, control, description, error, external, loadingState, step, title, components, onAction, }: StepDomainComponent, rendererMapperProps: RendererMapperProps) => StepRendererProps;
@@ -1,10 +1,15 @@
1
1
  import { DynamicFlowCorePropsWithInitialAction, DynamicFlowCorePropsWithInitialStep } from '../types';
2
+ import { Theming } from '@wise/components-theming';
2
3
  type MakeOptional<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
3
4
  export type DynamicFlowWisePropsWithInitialAction = MakeOptional<DynamicFlowCorePropsWithInitialAction, 'renderers' | 'onLink'>;
4
5
  export type DynamicFlowWisePropsWithInitialStep = MakeOptional<DynamicFlowCorePropsWithInitialStep, 'renderers' | 'onLink'>;
5
- export type DynamicFlowWiseProps = DynamicFlowWisePropsWithInitialAction | DynamicFlowWisePropsWithInitialStep;
6
+ export type DynamicFlowWiseProps = (DynamicFlowWisePropsWithInitialAction | DynamicFlowWisePropsWithInitialStep) & {
7
+ onAnalytics?: DynamicFlowWiseProps['onEvent'];
8
+ onThemeChange?: OnThemeChange;
9
+ };
6
10
  /**
7
11
  * This component is only used in tests.
8
12
  */
9
13
  declare function DynamicFlowWise(props: DynamicFlowWiseProps): import("react/jsx-runtime").JSX.Element;
14
+ type OnThemeChange = (theme: Theming['theme']) => void;
10
15
  export default DynamicFlowWise;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "4.1.0-experimental-6bb6f02",
3
+ "version": "4.2.0",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -30,34 +30,34 @@
30
30
  "url": "git+https://github.com/transferwise/dynamic-flow.git"
31
31
  },
32
32
  "devDependencies": {
33
- "@babel/core": "7.26.9",
33
+ "@babel/core": "7.26.10",
34
34
  "@babel/plugin-syntax-flow": "7.26.0",
35
35
  "@babel/plugin-transform-react-jsx": "7.25.9",
36
36
  "@babel/preset-env": "7.26.9",
37
37
  "@babel/preset-react": "7.26.3",
38
38
  "@babel/preset-typescript": "7.26.0",
39
- "@chromatic-com/storybook": "3.2.5",
39
+ "@chromatic-com/storybook": "3.2.6",
40
40
  "@formatjs/cli": "^6.6.1",
41
- "@storybook/addon-a11y": "^8.6.3",
42
- "@storybook/addon-actions": "^8.6.3",
43
- "@storybook/addon-essentials": "^8.6.3",
44
- "@storybook/addon-interactions": "^8.6.3",
45
- "@storybook/addon-links": "^8.6.3",
41
+ "@storybook/addon-a11y": "^8.6.7",
42
+ "@storybook/addon-actions": "^8.6.7",
43
+ "@storybook/addon-essentials": "^8.6.7",
44
+ "@storybook/addon-interactions": "^8.6.7",
45
+ "@storybook/addon-links": "^8.6.7",
46
46
  "@storybook/addon-webpack5-compiler-babel": "^3.0.5",
47
- "@storybook/manager-api": "^8.6.3",
48
- "@storybook/react": "^8.6.3",
49
- "@storybook/react-webpack5": "^8.6.3",
50
- "@storybook/test": "^8.6.3",
51
- "@storybook/types": "^8.6.3",
47
+ "@storybook/manager-api": "^8.6.7",
48
+ "@storybook/react": "^8.6.7",
49
+ "@storybook/react-webpack5": "^8.6.7",
50
+ "@storybook/test": "^8.6.7",
51
+ "@storybook/types": "^8.6.7",
52
52
  "@testing-library/dom": "10.4.0",
53
53
  "@testing-library/jest-dom": "6.6.3",
54
54
  "@testing-library/react": "16.2.0",
55
55
  "@testing-library/user-event": "14.6.1",
56
- "@transferwise/components": "46.94.0",
56
+ "@transferwise/components": "46.94.1",
57
57
  "@transferwise/formatting": "^2.13.1",
58
- "@transferwise/icons": "3.18.0",
58
+ "@transferwise/icons": "3.19.1",
59
59
  "@transferwise/neptune-css": "14.22.0",
60
- "@types/node": "22.13.9",
60
+ "@types/node": "22.13.10",
61
61
  "@types/jest": "29.5.14",
62
62
  "@types/react": "18.3.18",
63
63
  "@types/react-dom": "18.3.5",
@@ -65,20 +65,20 @@
65
65
  "@wise/art": "2.20.0",
66
66
  "@wise/components-theming": "^1.6.1",
67
67
  "babel-jest": "29.7.0",
68
- "esbuild": "0.25.0",
68
+ "esbuild": "0.25.1",
69
69
  "jest": "29.7.0",
70
70
  "jest-environment-jsdom": "29.7.0",
71
71
  "jest-fetch-mock": "^3.0.3",
72
72
  "jest-watch-typeahead": "^2.2.2",
73
73
  "npm-run-all2": "7.0.2",
74
74
  "postcss": "^8.5.3",
75
- "postcss-cli": "^11.0.0",
75
+ "postcss-cli": "^11.0.1",
76
76
  "postcss-import": "^16.1.0",
77
77
  "react": "18.3.1",
78
78
  "react-dom": "18.3.1",
79
79
  "react-intl": "6.8.9",
80
- "storybook": "^8.6.3",
81
- "stylelint": "16.15.0",
80
+ "storybook": "^8.6.7",
81
+ "stylelint": "16.16.0",
82
82
  "stylelint-config-standard": "36.0.1",
83
83
  "stylelint-no-unsupported-browser-features": "8.0.4",
84
84
  "stylelint-value-no-unknown-custom-properties": "6.0.1",
@@ -102,7 +102,7 @@
102
102
  "classnames": "2.5.1",
103
103
  "react-webcam": "^7.2.0",
104
104
  "screenfull": "^5.2.0",
105
- "@wise/dynamic-flow-types": "3.1.0-experimental-6bb6f02"
105
+ "@wise/dynamic-flow-types": "3.1.0"
106
106
  },
107
107
  "scripts": {
108
108
  "dev": "pnpm build:visual-tests && storybook dev -p 3003",
@@ -1,6 +0,0 @@
1
- /**
2
- * Given a timestamp, find the difference in ms between it and the time now
3
- * @param timestamp
4
- * @returns diff in ms between now and timestamp
5
- */
6
- export declare const getTimeDiffInMs: (timestamp: string) => number;