@wise/dynamic-flow-client 4.20.2 → 4.21.1

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,13 +1,16 @@
1
1
  import type { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
2
2
  import type { PerformValidationAsync } from '../features/validationAsync/getPerformValidationAsync';
3
- import type { BaseInputComponent, OnPersistAsync, OnValueChange, RepeatableSummary, UpdateComponent, ValidationAsyncState } from '../types';
3
+ import type { BaseInputComponent, InlineAlert, OnPersistAsync, OnValueChange, RepeatableSummary, UpdateComponent, ValidationAsyncState, SupportingValues } from '../types';
4
4
  export type BooleanInputComponent = BaseInputComponent<boolean> & {
5
5
  type: 'boolean';
6
6
  kind: 'input';
7
+ additionalText?: string;
8
+ inlineAlert?: InlineAlert;
9
+ supportingValues?: SupportingValues;
7
10
  validationAsyncState: ValidationAsyncState;
8
11
  onChange: (value: boolean) => void;
9
12
  };
10
- export declare const createBooleanInputComponent: (booleanInputProps: Pick<BooleanInputComponent, "uid" | "id" | "analyticsId" | "alert" | "control" | "description" | "disabled" | "errors" | "help" | "hidden" | "media" | "required" | "title" | "tags" | "value" | "validationAsyncState"> & {
13
+ export declare const createBooleanInputComponent: (booleanInputProps: Pick<BooleanInputComponent, "uid" | "id" | "additionalText" | "analyticsId" | "alert" | "control" | "description" | "disabled" | "errors" | "help" | "hidden" | "inlineAlert" | "media" | "required" | "supportingValues" | "title" | "tags" | "value" | "validationAsyncState"> & {
11
14
  schemaOnChange: SchemaOnChange | undefined;
12
15
  performValidationAsync: PerformValidationAsync | undefined;
13
16
  summariser: (value: boolean) => RepeatableSummary;
@@ -7,6 +7,10 @@ export type RootDomainComponent = BaseComponent & {
7
7
  type: 'root';
8
8
  kind: 'step';
9
9
  stepComponent: StepDomainComponent | null;
10
+ stepStack: StepDomainComponent[];
11
+ isNativeBackEnabled: boolean;
12
+ isFlowCancellable: boolean;
13
+ canPerformBack: () => boolean;
10
14
  dismissAllModals: () => void;
11
15
  dismissModal: () => void;
12
16
  showModal: (modal: ModalComponent) => void;
@@ -21,8 +25,16 @@ export type RootDomainComponent = BaseComponent & {
21
25
  getTrackEvent: () => AnalyticsEventDispatcher<string> | null;
22
26
  setLoadingState: (loadingState: LoadingState) => void;
23
27
  hasStep: () => boolean;
28
+ start: () => void;
24
29
  stop: () => void;
25
- setStep: (stepComponent: StepDomainComponent) => void;
30
+ getStep: () => StepDomainComponent | null;
31
+ pushStep: (stepComponent: StepDomainComponent) => void;
32
+ updateStep: (stepComponent: StepDomainComponent) => void;
33
+ clearStack: () => void;
34
+ navigateBack: () => void;
26
35
  getRefreshUrl: () => string | null;
27
36
  };
28
- export declare const createRootDomainComponent: (updateComponent: UpdateComponent, scrollToTop: ScrollToTop) => RootDomainComponent;
37
+ export declare const createRootDomainComponent: (updateComponent: UpdateComponent, scrollToTop: ScrollToTop, backConfig: {
38
+ isNativeBackEnabled: boolean;
39
+ isFlowCancellable: boolean;
40
+ }) => RootDomainComponent;
@@ -1,6 +1,7 @@
1
1
  import type { Model } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { AnalyticsEventDispatcher } from '../features/events';
3
3
  import type { SchemaOnChange } from '../features/schema-on-change/getSchemaOnChange';
4
+ import type { InlineAlert, SupportingValues } from '../types';
4
5
  import type { IsInvalidCheck } from '../features/validation/value-checks';
5
6
  import type { BaseInputComponent, LocalValue, Media, OnValueChange, RepeatableSummary, SchemaComponent, UpdateComponent } from '../types';
6
7
  export type SelectInputComponent = BaseInputComponent<LocalValue | null> & {
@@ -15,13 +16,16 @@ export type SelectInputComponent = BaseInputComponent<LocalValue | null> & {
15
16
  getSelectedChild: () => SchemaComponent | null;
16
17
  };
17
18
  export type SelectInputOption = {
19
+ additionalText?: string;
18
20
  analyticsId?: string;
19
- title: string;
20
21
  description?: string;
21
- media?: Media;
22
- keywords: string[];
23
22
  disabled: boolean;
23
+ inlineAlert?: InlineAlert;
24
+ keywords: string[];
25
+ media?: Media;
26
+ supportingValues?: SupportingValues;
24
27
  tags?: string[];
28
+ title: string;
25
29
  };
26
30
  export declare const createSelectInputComponent: (selectProps: Pick<SelectInputComponent, "uid" | "id" | "analyticsId" | "alert" | "autoComplete" | "control" | "errors" | "description" | "disabled" | "help" | "hidden" | "placeholder" | "required" | "title" | "tags"> & {
27
31
  initialModel: Model;
@@ -1,6 +1,6 @@
1
1
  import type { BaseComponent, DomainComponent, LayoutComponent, LoadingState, LocalValue, OnBehavior, SchemaComponent, UpdateComponent } from '../../types';
2
2
  import { Model } from '@wise/dynamic-flow-types';
3
- import type { Step } from '@wise/dynamic-flow-types/build/next';
3
+ import type { NavigationStackBehavior, Step } from '@wise/dynamic-flow-types/build/next';
4
4
  import type { AnalyticsEventDispatcher } from '../../features/events';
5
5
  import type { StepPolling } from '../../features/polling/getStepPolling';
6
6
  import { StepRefreshAfter } from '../../features/refreshAfter/getStepRefreshAfter';
@@ -20,7 +20,9 @@ export type StepDomainComponent = BaseComponent & {
20
20
  error?: string;
21
21
  externalConfirmation?: ExternalConfirmationComponent;
22
22
  loadingState: LoadingState;
23
+ stackBehavior: NavigationStackBehavior;
23
24
  step: Step;
25
+ etag: string | null;
24
26
  title?: string;
25
27
  modals: ModalComponent[];
26
28
  tags?: string[];
@@ -35,16 +37,16 @@ export type StepDomainComponent = BaseComponent & {
35
37
  validate: () => boolean;
36
38
  setLoadingState: (loadingState: LoadingState) => void;
37
39
  onBehavior: OnBehavior;
40
+ start: () => void;
38
41
  stop: () => void;
39
42
  trackEvent: AnalyticsEventDispatcher<string>;
40
43
  };
41
- type BackNavigation = {
44
+ export type BackNavigation = {
42
45
  title?: string;
43
46
  onClick: () => void;
44
47
  };
45
- export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "uid" | "back" | "toolbar" | "layoutComponents" | "schemaComponents" | "footerComponents" | "control" | "description" | "error" | "externalConfirmation" | "loadingState" | "step" | "title" | "tags" | "trackEvent" | "onBehavior"> & {
48
+ export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "uid" | "back" | "toolbar" | "layoutComponents" | "schemaComponents" | "footerComponents" | "control" | "description" | "error" | "externalConfirmation" | "loadingState" | "stackBehavior" | "etag" | "step" | "title" | "tags" | "trackEvent" | "onBehavior"> & {
46
49
  stepPolling?: StepPolling;
47
50
  stepRefreshAfter?: StepRefreshAfter;
48
51
  updateComponent: UpdateComponent;
49
52
  }) => StepDomainComponent;
50
- export {};
@@ -1,6 +1,6 @@
1
1
  export type AnalyticsEventHandler = (eventName: string, properties?: Record<string, unknown>) => void;
2
2
  export type AnalyticsEventDispatcher<E extends string = EventName> = (eventName: E, properties?: Record<string, unknown>) => void;
3
- export type EventName = 'Initiated' | 'Succeeded' | 'Failed' | 'Step Shown' | 'Action Triggered' | 'Action Succeeded' | 'Action Aborted' | 'Action Failed' | 'Refresh Triggered' | 'Refresh Succeeded' | 'Refresh Aborted' | 'Refresh Failed' | 'OneOf Selected' | 'PersistAsync Triggered' | 'PersistAsync Succeeded' | 'PersistAsync Failed' | 'Polling Failed' | 'ValidationAsync Triggered' | 'ValidationAsync Succeeded' | 'ValidationAsync Failed' | 'Value Changed';
3
+ export type EventName = 'Initiated' | 'Succeeded' | 'Failed' | 'Cancelled' | 'Step Shown' | 'Action Triggered' | 'Action Succeeded' | 'Action Aborted' | 'Action Failed' | 'Refresh Triggered' | 'Refresh Succeeded' | 'Refresh Aborted' | 'Refresh Failed' | 'OneOf Selected' | 'PersistAsync Triggered' | 'PersistAsync Succeeded' | 'PersistAsync Failed' | 'Polling Failed' | 'ValidationAsync Triggered' | 'ValidationAsync Succeeded' | 'ValidationAsync Failed' | 'Value Changed';
4
4
  export type LogLevel = 'info' | 'warning' | 'error';
5
5
  export type LoggingEventHandler = (level: LogLevel, message: string, extra: Record<string, unknown>) => void;
6
6
  export type LoggingEventDispatcher = (level: LogLevel, message: string, extra?: Record<string, unknown>) => void;
@@ -1,11 +1,14 @@
1
1
  import type { Polling } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { OnBehavior, OnPoll } from '../../types';
3
+ import { LoggingEventDispatcher } from '../events';
3
4
  export type StepPollingProps = {
4
5
  pollingConfig: Polling;
6
+ logEvent: LoggingEventDispatcher;
5
7
  onBehavior: OnBehavior;
6
8
  onPoll: OnPoll;
7
9
  };
8
10
  export type StepPolling = {
11
+ start: () => void;
9
12
  stop: () => void;
10
13
  };
11
- export declare const getStepPolling: ({ pollingConfig, onBehavior, onPoll, }: StepPollingProps) => StepPolling;
14
+ export declare const getStepPolling: ({ pollingConfig, logEvent, onBehavior, onPoll, }: StepPollingProps) => StepPolling;
@@ -1,10 +1,13 @@
1
1
  import { OnBehavior } from '../../types';
2
+ import { LoggingEventDispatcher } from '../events';
2
3
  export type StepRefreshAfter = {
4
+ start: () => void;
3
5
  stop: () => void;
4
6
  };
5
7
  type Props = {
6
8
  refreshAfter: string;
9
+ logEvent: LoggingEventDispatcher;
7
10
  onBehavior: OnBehavior;
8
11
  };
9
- export declare const getStepRefreshAfter: ({ refreshAfter, onBehavior }: Props) => StepRefreshAfter;
12
+ export declare const getStepRefreshAfter: ({ refreshAfter, logEvent, onBehavior, }: Props) => StepRefreshAfter;
10
13
  export {};
@@ -3,10 +3,11 @@ import type { LoadingState, OnPoll } from '../types';
3
3
  import type { MapperProps } from './schema/types';
4
4
  export type StepMapperProps = Omit<MapperProps, 'trackEvent'> & {
5
5
  uid: string;
6
+ etag: string | null;
6
7
  displayStepTitle: boolean;
7
8
  loadingState: LoadingState;
8
9
  trackEvent: AnalyticsEventDispatcher<string>;
9
- onPoll: OnPoll;
10
10
  features: Record<string, unknown>;
11
+ onPoll: OnPoll;
11
12
  };
12
13
  export declare const mapStepToComponent: ({ uid: rootUid, loadingState, displayStepTitle, features, trackEvent, onPoll, onBehavior, ...restProps }: StepMapperProps) => import("../components/step/StepDomainComponent").StepDomainComponent;
@@ -82,6 +82,9 @@ export declare const oneOfSchemaToComponent: (schemaMapperProps: SchemaMapperPro
82
82
  } & {
83
83
  type: "boolean";
84
84
  kind: "input";
85
+ additionalText?: string;
86
+ inlineAlert?: import("../../../types").InlineAlert;
87
+ supportingValues?: import("../../../types").SupportingValues;
85
88
  validationAsyncState: import("../../../types").ValidationAsyncState;
86
89
  onChange: (value: boolean) => void;
87
90
  } & {
@@ -56,6 +56,9 @@ export declare const persistAsyncSchemaToComponent: (schemaMapperProps: SchemaMa
56
56
  } & {
57
57
  type: "boolean";
58
58
  kind: "input";
59
+ additionalText?: string;
60
+ inlineAlert?: import("../../types").InlineAlert;
61
+ supportingValues?: import("../../types").SupportingValues;
59
62
  validationAsyncState: import("../../types").ValidationAsyncState;
60
63
  onChange: (value: boolean) => void;
61
64
  } & {
@@ -1,3 +1,3 @@
1
- type Feature = 'pinnedButtons';
1
+ type Feature = 'pinnedButtons' | 'nativeBack';
2
2
  export declare const isFeatureEnabled: (features: Record<string, unknown>, featureName: Feature) => boolean;
3
3
  export {};
@@ -1,4 +1,4 @@
1
- import type { ActionBehavior, CopyBehavior, DismissBehavior, Icon, JsonElement, LinkBehavior, Margin, ModalBehavior, Model } from '@wise/dynamic-flow-types/build/next';
1
+ import type { Action, ActionBehavior, CopyBehavior, DismissBehavior, Icon, JsonElement, LinkBehavior, Margin, ModalBehavior, Model } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { AlertComponent } from './components/AlertComponent';
3
3
  import type { AllOfComponent } from './components/AllOfComponent';
4
4
  import type { BooleanInputComponent } from './components/BooleanInputComponent';
@@ -66,13 +66,17 @@ export type CallToAction = {
66
66
  href: string;
67
67
  onClick: () => void;
68
68
  };
69
- export type Behavior = (ActionBehavior | CopyBehavior | DismissBehavior | LinkBehavior | ModalBehavior | NonMergingActionBehaviour | NullAction | RefreshBehavior) & {
69
+ export type Behavior = (ActionBehavior | CopyBehavior | DismissBehavior | LinkBehavior | ModalBehavior | NonMergingActionBehaviour | NullBehavior | RefreshBehavior | BackBehaviour) & {
70
70
  analytics?: Record<string, unknown>;
71
71
  };
72
72
  type NonMergingActionBehaviour = Omit<ActionBehavior, 'type'> & {
73
73
  type: 'non-merging-action';
74
74
  };
75
- type NullAction = {
75
+ type BackBehaviour = {
76
+ type: 'back';
77
+ action?: Action;
78
+ };
79
+ type NullBehavior = {
76
80
  type: 'none';
77
81
  };
78
82
  type RefreshBehavior = {
@@ -161,6 +165,7 @@ export type OnBehavior = (behavior: Behavior) => Promise<BehaviorController>;
161
165
  export type BehaviorController = {
162
166
  abort: () => void;
163
167
  };
168
+ export type OnBack = (action: Action | undefined) => void;
164
169
  export type OnPoll = (url: string, errorBehavior: Behavior, signal: AbortSignal) => Promise<boolean>;
165
170
  export type OnLink = (url: string) => boolean;
166
171
  export type OnValueChange = () => void;
@@ -1,4 +1,6 @@
1
1
  import type { StepRendererProps } from '@wise/dynamic-flow-types/build/renderers';
2
2
  import type { StepDomainComponent } from '../domain/components/step/StepDomainComponent';
3
3
  import { type RendererMapperProps } from './mappers/componentToRendererProps';
4
- export declare const stepComponentToProps: (component: StepDomainComponent, rendererMapperProps: RendererMapperProps) => StepRendererProps;
4
+ export declare const stepComponentToProps: (component: StepDomainComponent, rendererMapperProps: RendererMapperProps & {
5
+ showBack: boolean;
6
+ }) => StepRendererProps;
@@ -7,6 +7,7 @@ type DynamicFlowCorePropsBasic = {
7
7
  httpClient: HttpClient;
8
8
  renderers: Renderers;
9
9
  features?: Record<string, unknown>;
10
+ onCancellation?: () => void;
10
11
  onCompletion: (result: Model) => void;
11
12
  onCopy?: (copiedString: string | null) => void;
12
13
  onError: (error: unknown, status?: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "4.20.2",
3
+ "version": "4.21.1",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -36,12 +36,12 @@
36
36
  "@babel/preset-env": "7.28.5",
37
37
  "@babel/preset-react": "7.28.5",
38
38
  "@babel/preset-typescript": "7.28.5",
39
- "@chromatic-com/storybook": "4.1.1",
39
+ "@chromatic-com/storybook": "4.1.2",
40
40
  "@formatjs/cli": "^6.7.4",
41
- "@storybook/addon-a11y": "^9.1.15",
42
- "@storybook/addon-docs": "^9.1.15",
43
- "@storybook/addon-links": "^9.1.15",
44
- "@storybook/react-vite": "9.1.15",
41
+ "@storybook/addon-a11y": "^9.1.16",
42
+ "@storybook/addon-docs": "^9.1.16",
43
+ "@storybook/addon-links": "^9.1.16",
44
+ "@storybook/react-vite": "9.1.16",
45
45
  "@testing-library/dom": "10.4.1",
46
46
  "@testing-library/jest-dom": "6.9.1",
47
47
  "@testing-library/react": "16.3.0",
@@ -52,7 +52,7 @@
52
52
  "@transferwise/navigation-ui": "4.40.0",
53
53
  "@transferwise/neptune-css": "14.25.1",
54
54
  "@types/jest": "30.0.0",
55
- "@types/node": "22.18.12",
55
+ "@types/node": "22.19.0",
56
56
  "@types/react": "18.3.26",
57
57
  "@types/react-dom": "18.3.7",
58
58
  "@types/react-intl": "3.0.0",
@@ -60,8 +60,8 @@
60
60
  "@wise/components-theming": "^1.7.0",
61
61
  "babel-jest": "30.2.0",
62
62
  "esbuild": "0.25.9",
63
- "eslint-plugin-storybook": "9.1.15",
64
- "framer-motion": "^12.23.22",
63
+ "eslint-plugin-storybook": "9.1.16",
64
+ "framer-motion": "^12.23.24",
65
65
  "jest": "30.2.0",
66
66
  "jest-environment-jsdom": "30.2.0",
67
67
  "jest-fetch-mock": "^3.0.3",
@@ -73,7 +73,7 @@
73
73
  "react": "18.3.1",
74
74
  "react-dom": "18.3.1",
75
75
  "react-intl": "6.8.9",
76
- "storybook": "^9.1.15",
76
+ "storybook": "^9.1.16",
77
77
  "stylelint": "16.25.0",
78
78
  "stylelint-config-standard": "36.0.1",
79
79
  "stylelint-no-unsupported-browser-features": "8.0.5",
@@ -97,7 +97,7 @@
97
97
  "classnames": "2.5.1",
98
98
  "react-webcam": "^7.2.0",
99
99
  "screenfull": "^5.2.0",
100
- "@wise/dynamic-flow-types": "3.18.0"
100
+ "@wise/dynamic-flow-types": "3.19.0"
101
101
  },
102
102
  "scripts": {
103
103
  "dev": "EXCLUDE_VISUAL_TESTS=true pnpm storybook dev -p 3003",