@wise/dynamic-flow-client 4.3.6 → 4.3.8

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 (22) hide show
  1. package/build/main.js +263 -480
  2. package/build/main.mjs +263 -480
  3. package/build/types/revamp/domain/components/StatusListComponent.d.ts +0 -2
  4. package/build/types/revamp/domain/components/StepDomainComponent.d.ts +3 -3
  5. package/build/types/revamp/domain/components/searchComponent/SearchComponent.d.ts +2 -2
  6. package/build/types/revamp/domain/features/polling/getStepPolling.d.ts +3 -3
  7. package/build/types/revamp/domain/mappers/layout/alertLayoutToComponent.d.ts +1 -2
  8. package/build/types/revamp/domain/mappers/layout/decisionLayoutToComponent.d.ts +1 -1
  9. package/build/types/revamp/domain/mappers/layout/listLayoutToComponent.d.ts +1 -2
  10. package/build/types/revamp/domain/mappers/layout/reviewLayoutToComponent.d.ts +1 -1
  11. package/build/types/revamp/domain/mappers/layout/statusListLayoutToComponent.d.ts +1 -1
  12. package/build/types/revamp/domain/mappers/mapStepToComponent.d.ts +1 -1
  13. package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +3 -2
  14. package/build/types/revamp/domain/mappers/schema/types.d.ts +2 -3
  15. package/build/types/revamp/domain/mappers/utils/behavior-utils.d.ts +8 -0
  16. package/build/types/revamp/domain/mappers/utils/call-to-action-utils.d.ts +22 -0
  17. package/build/types/revamp/domain/types.d.ts +10 -4
  18. package/build/types/revamp/flow/executePoll.d.ts +5 -4
  19. package/build/types/revamp/renderers/stepComponentToProps.d.ts +1 -1
  20. package/build/types/revamp/useDynamicFlowCore.d.ts +1 -1
  21. package/package.json +18 -18
  22. package/build/types/revamp/domain/mappers/utils/inlineAction.d.ts +0 -2
@@ -12,14 +12,12 @@ export type StatusListItem = {
12
12
  } | {
13
13
  text: string;
14
14
  };
15
- href?: string;
16
15
  status?: 'not-done' | 'pending' | 'done';
17
16
  callToAction?: StatusListItemCallToAction;
18
17
  tag?: string;
19
18
  };
20
19
  export type StatusListItemCallToAction = {
21
20
  accessibilityDescription?: string;
22
- href?: string;
23
21
  title: string;
24
22
  onClick: () => void;
25
23
  };
@@ -1,4 +1,4 @@
1
- import type { BaseComponent, DomainComponent, LoadingState, LocalValue, OnAction, UpdateComponent } from '../types';
1
+ import type { BaseComponent, DomainComponent, LoadingState, LocalValue, OnBehavior, 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';
@@ -17,7 +17,7 @@ export type StepDomainComponent = BaseComponent & {
17
17
  getChildren: () => DomainComponent[];
18
18
  getLocalValue: () => LocalValue;
19
19
  setLoadingState: (loadingState: LoadingState) => void;
20
- onAction: OnAction;
20
+ onBehavior: OnBehavior;
21
21
  stop: () => void;
22
22
  trackEvent: AnalyticsEventDispatcher<string>;
23
23
  };
@@ -25,7 +25,7 @@ type BackNavigation = {
25
25
  title?: string;
26
26
  onClick: () => void;
27
27
  };
28
- export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "uid" | "back" | "components" | "control" | "description" | "error" | "external" | "loadingState" | "step" | "title" | "trackEvent" | "onAction"> & {
28
+ export declare const createStepComponent: (stepProps: Pick<StepDomainComponent, "uid" | "back" | "components" | "control" | "description" | "error" | "external" | "loadingState" | "step" | "title" | "trackEvent" | "onBehavior"> & {
29
29
  stepPolling?: StepPolling;
30
30
  stepRefreshAfter?: StepRefreshAfter;
31
31
  updateComponent: UpdateComponent;
@@ -1,5 +1,5 @@
1
1
  import type { SearchResult } from '@wise/dynamic-flow-types/build/next';
2
- import type { LayoutComponent, OnAction, UpdateComponent } from '../../types';
2
+ import type { LayoutComponent, OnBehavior, UpdateComponent } from '../../types';
3
3
  export type SearchConfig = {
4
4
  method: string;
5
5
  param: string;
@@ -22,4 +22,4 @@ export type SearchComponent = LayoutComponent & {
22
22
  onChange: (query: string) => void;
23
23
  onSelect: (result: SearchResult) => void;
24
24
  };
25
- export declare const createSearchComponent: (searchProps: Pick<SearchComponent, "uid" | "control" | "emptyMessage" | "margin" | "title">, performSearch: PerformSearch, onAction: OnAction, updateComponent: UpdateComponent) => SearchComponent;
25
+ export declare const createSearchComponent: (searchProps: Pick<SearchComponent, "uid" | "control" | "emptyMessage" | "margin" | "title">, performSearch: PerformSearch, onBehavior: OnBehavior, updateComponent: UpdateComponent) => SearchComponent;
@@ -1,11 +1,11 @@
1
1
  import type { Polling } from '@wise/dynamic-flow-types/build/next';
2
- import type { OnAction, OnPoll } from '../../types';
2
+ import type { OnBehavior, OnPoll } from '../../types';
3
3
  export type StepPollingProps = {
4
4
  pollingConfig: Polling;
5
- onAction: OnAction;
5
+ onBehavior: OnBehavior;
6
6
  onPoll: OnPoll;
7
7
  };
8
8
  export type StepPolling = {
9
9
  stop: () => void;
10
10
  };
11
- export declare const getStepPolling: ({ pollingConfig, onAction, onPoll, }: StepPollingProps) => StepPolling;
11
+ export declare const getStepPolling: ({ pollingConfig, onBehavior, onPoll, }: StepPollingProps) => StepPolling;
@@ -1,4 +1,3 @@
1
1
  import type { AlertLayout } from '@wise/dynamic-flow-types/build/next';
2
- import { AlertComponent } from '../../components/AlertComponent';
3
2
  import { MapperProps } from '../schema/types';
4
- export declare const alertLayoutToComponent: (uid: string, { control, markdown, margin, context, callToAction }: AlertLayout, { onAction }: MapperProps) => AlertComponent;
3
+ export declare const alertLayoutToComponent: (uid: string, { control, markdown, margin, context, callToAction }: AlertLayout, { onBehavior, step }: MapperProps) => import("../../components/AlertComponent").AlertComponent;
@@ -2,4 +2,4 @@ import type { DecisionLayout, DecisionLayoutOption } from '@wise/dynamic-flow-ty
2
2
  import type { MapperProps } from '../schema/types';
3
3
  export declare const decisionLayoutToComponent: (uid: string, { control, margin, options, title, }: Omit<DecisionLayout, "options"> & {
4
4
  options: DecisionLayoutOption[];
5
- }, mapperProps: MapperProps) => import("../../components/DecisionComponent").DecisionComponent;
5
+ }, { onBehavior, step }: MapperProps) => import("../../components/DecisionComponent").DecisionComponent;
@@ -1,4 +1,3 @@
1
1
  import { ListLayout } from '@wise/dynamic-flow-types/build/next';
2
- import { ListComponent } from '../../components/ListComponent';
3
2
  import { MapperProps } from '../schema/types';
4
- export declare const listLayoutToComponent: (uid: string, { callToAction, control, items, margin, title }: ListLayout, mapperProps: MapperProps) => ListComponent;
3
+ export declare const listLayoutToComponent: (uid: string, { callToAction, control, items, margin, title }: ListLayout, mapperProps: MapperProps) => import("../../components/ListComponent").ListComponent;
@@ -1,3 +1,3 @@
1
1
  import type { ReviewLayout } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { MapperProps } from '../schema/types';
3
- export declare const reviewLayoutToComponent: (uid: string, { fields, title, callToAction, control, margin, orientation, action }: ReviewLayout, { onAction, onLink }: MapperProps) => import("../../components/ReviewComponent").ReviewComponent;
3
+ export declare const reviewLayoutToComponent: (uid: string, { fields, title, callToAction, control, margin, orientation, action }: ReviewLayout, { onBehavior, step }: MapperProps) => import("../../components/ReviewComponent").ReviewComponent;
@@ -1,3 +1,3 @@
1
1
  import type { StatusListLayout } from '@wise/dynamic-flow-types/build/next';
2
2
  import { MapperProps } from '../schema/types';
3
- export declare const statusListLayoutToComponent: (uid: string, { control, items, margin, title }: StatusListLayout, { onAction, onLink }: MapperProps) => import("../../components/StatusListComponent").StatusListComponent;
3
+ export declare const statusListLayoutToComponent: (uid: string, { control, items, margin, title }: StatusListLayout, { onBehavior, step }: MapperProps) => import("../../components/StatusListComponent").StatusListComponent;
@@ -8,4 +8,4 @@ export type StepMapperProps = Omit<MapperProps, 'trackEvent'> & {
8
8
  trackEvent: AnalyticsEventDispatcher<string>;
9
9
  onPoll: OnPoll;
10
10
  };
11
- export declare const mapStepToComponent: ({ uid: rootUid, loadingState, displayStepTitle, trackEvent, onPoll, ...restProps }: StepMapperProps) => import("../components/StepDomainComponent").StepDomainComponent;
11
+ export declare const mapStepToComponent: ({ uid: rootUid, loadingState, displayStepTitle, trackEvent, onPoll, onBehavior, ...restProps }: StepMapperProps) => import("../components/StepDomainComponent").StepDomainComponent;
@@ -9,13 +9,14 @@ export declare const getMockMapperProps: (mapperProps?: Partial<MapperProps>) =>
9
9
  step: Step;
10
10
  getErrorMessageFunctions: import("../../types").GetErrorMessageFunctions | jest.Mock<any, any, any>;
11
11
  httpClient: typeof fetch | jest.Mock<any, any, any>;
12
- onLink: import("../../../types").OnLink | jest.Mock<any, any, any>;
13
- onAction: import("../../../types").OnAction | jest.Mock<any, any, any>;
12
+ onBehavior: import("../../../types").OnBehavior | jest.Mock<any, any, any>;
14
13
  onRefresh: import("../../../types").OnRefresh | jest.Mock<any, any, any>;
15
14
  onValueChange: import("../../../types").OnValueChange | jest.Mock<any, any, any>;
16
15
  updateComponent: import("../../../types").UpdateComponent | jest.Mock<any, any, any>;
17
16
  trackEvent: import("../../../features/events").AnalyticsEventDispatcher | jest.Mock<any, any, any>;
18
17
  logEvent: import("../../../features/events").LoggingEventDispatcher | jest.Mock<any, any, any>;
18
+ onAction: jest.Mock<any, any, any>;
19
+ onLink: jest.Mock<any, any, any>;
19
20
  };
20
21
  export declare const getMockSchemaMapperProps: <S extends Schema>(schemaMapperProps: Partial<SchemaMapperProps> & {
21
22
  schema: S;
@@ -1,15 +1,14 @@
1
1
  import type { Step as DFStep, Model, Schema, ValidationError } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { HttpClient } from '../../../types';
3
3
  import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../../features/events';
4
- import type { LocalValue, OnAction, OnLink, OnRefresh, OnValueChange, UpdateComponent } from '../../types';
4
+ import type { LocalValue, OnBehavior, OnRefresh, OnValueChange, UpdateComponent } from '../../types';
5
5
  import type { GetErrorMessageFunctions, PersistAsyncConfig } from '../types';
6
6
  export type MapperProps = {
7
7
  stepLocalValue: LocalValue;
8
8
  step: DFStep;
9
9
  getErrorMessageFunctions: GetErrorMessageFunctions;
10
10
  httpClient: HttpClient;
11
- onLink: OnLink;
12
- onAction: OnAction;
11
+ onBehavior: OnBehavior;
13
12
  onRefresh: OnRefresh;
14
13
  onValueChange: OnValueChange;
15
14
  updateComponent: UpdateComponent;
@@ -0,0 +1,8 @@
1
+ import { Action, Behavior as SpecBehavior } from '@wise/dynamic-flow-types/build/next';
2
+ import { Behavior } from '../../types';
3
+ export declare const getDomainLayerBehavior: ({ action, behavior, }: {
4
+ action?: Action;
5
+ behavior?: SpecBehavior;
6
+ }, stepActions: Action[]) => Behavior;
7
+ export declare const skipValidation: (behavior: Behavior) => Behavior;
8
+ export declare const inlineAction: (action: Action, stepActions?: Action[]) => Action;
@@ -0,0 +1,22 @@
1
+ import { Action, Behavior as SpecBehavior } from '@wise/dynamic-flow-types/build/next';
2
+ import { OnBehavior } from '../../types';
3
+ type CallToAction = {
4
+ type: 'action';
5
+ title: string;
6
+ accessibilityDescription?: string;
7
+ onClick: () => void;
8
+ } | {
9
+ type: 'link';
10
+ title: string;
11
+ accessibilityDescription?: string;
12
+ href: string;
13
+ onClick: () => void;
14
+ };
15
+ type SpecCallToAction = {
16
+ title?: string;
17
+ accessibilityDescription?: string;
18
+ action?: Action;
19
+ behavior?: SpecBehavior;
20
+ };
21
+ export declare const getDomainLayerCallToAction: (callToAction: SpecCallToAction | undefined, onBehavior: OnBehavior, stepActions: Action[]) => CallToAction | undefined;
22
+ export {};
@@ -1,4 +1,6 @@
1
1
  import type { Action, Icon, JsonElement, Margin, Model } from '@wise/dynamic-flow-types/build/next';
2
+ import type { ActionBehavior } from '@wise/dynamic-flow-types/build/next/feature/ActionBehavior';
3
+ import type { LinkBehavior } from '@wise/dynamic-flow-types/build/next/feature/LinkBehavior';
2
4
  import type { AlertComponent } from './components/AlertComponent';
3
5
  import type { AllOfComponent } from './components/AllOfComponent';
4
6
  import type { BooleanInputComponent } from './components/BooleanInputComponent';
@@ -15,6 +17,7 @@ import type { HeadingComponent } from './components/HeadingComponent';
15
17
  import type { ImageComponent } from './components/ImageComponent';
16
18
  import type { InstructionsComponent } from './components/InstructionsComponent';
17
19
  import type { IntegerInputComponent } from './components/IntegerInputComponent';
20
+ import type { ListComponent } from './components/ListComponent';
18
21
  import type { LoadingIndicatorComponent } from './components/LoadingIndicatorComponent';
19
22
  import type { MarkdownComponent } from './components/MarkdownComponent';
20
23
  import type { ModalComponent } from './components/ModalComponent';
@@ -25,15 +28,14 @@ import type { ObjectComponent } from './components/ObjectComponent';
25
28
  import type { ParagraphComponent } from './components/ParagraphComponent';
26
29
  import type { RepeatableComponent } from './components/RepeatableComponent';
27
30
  import type { ReviewComponent } from './components/ReviewComponent';
31
+ import type { RootDomainComponent } from './components/RootDomainComponent';
28
32
  import type { SearchComponent } from './components/searchComponent/SearchComponent';
29
33
  import type { SelectInputComponent } from './components/SelectInputComponent';
30
34
  import type { StatusListComponent } from './components/StatusListComponent';
31
35
  import type { StepDomainComponent } from './components/StepDomainComponent';
32
36
  import type { TextInputComponent } from './components/TextInputComponent';
33
- import { TupleComponent } from './components/TupleComponent';
37
+ import type { TupleComponent } from './components/TupleComponent';
34
38
  import type { UploadInputComponent } from './components/UploadInputComponent';
35
- import { ListComponent } from './components/ListComponent';
36
- import { RootDomainComponent } from './components/RootDomainComponent';
37
39
  export type DomainComponent = RootDomainComponent | StepDomainComponent | AlertComponent | AllOfComponent | BooleanInputComponent | BoxComponent | ButtonComponent | ColumnsComponent | ConstComponent | ContainerComponent | DateInputComponent | DecisionComponent | DividerComponent | FormComponent | HeadingComponent | ImageComponent | InstructionsComponent | IntegerInputComponent | ListComponent | LoadingIndicatorComponent | MarkdownComponent | ModalComponent | MultiSelectComponent | MultiUploadInputComponent | NumberInputComponent | ObjectComponent | ParagraphComponent | RepeatableComponent | ReviewComponent | SearchComponent | SelectInputComponent | StatusListComponent | TextInputComponent | TupleComponent | UploadInputComponent;
38
40
  export type LocalValue = LocalValuePrimitive | LocalValueObject | LocalValueArray;
39
41
  export type LocalValuePrimitive = string | number | boolean | File | null;
@@ -41,6 +43,9 @@ export interface LocalValueObject extends Record<string, LocalValuePrimitive | L
41
43
  }
42
44
  export interface LocalValueArray extends Array<LocalValuePrimitive | LocalValueObject | LocalValueArray> {
43
45
  }
46
+ export type Behavior = ActionBehavior | LinkBehavior | {
47
+ type: 'none';
48
+ };
44
49
  export type BaseComponent = {
45
50
  type: string;
46
51
  uid: string;
@@ -84,9 +89,10 @@ export type InputComponent<V extends LocalValue> = ComponentWithTitle & {
84
89
  getLocalValue: () => V;
85
90
  };
86
91
  export type UpdateComponent = (id: string, update: (component: DomainComponent) => void) => void;
92
+ export type OnBehavior = (behavior: Behavior) => Promise<void>;
87
93
  export type OnAction = (action: Action) => Promise<void>;
88
94
  export type OnRefresh = (schemaId: string | undefined, url?: string) => Promise<void> | void;
89
- export type OnPoll = (url: string, errorAction: Action, signal: AbortSignal) => Promise<boolean>;
95
+ export type OnPoll = (url: string, errorBehavior: Behavior, signal: AbortSignal) => Promise<boolean>;
90
96
  export type OnLink = (url: string) => boolean;
91
97
  export type OnValueChange = () => void;
92
98
  export type Align = 'start' | 'center' | 'end';
@@ -1,5 +1,6 @@
1
- import { Action, Model, Step } from '@wise/dynamic-flow-types/build/next';
1
+ import { Model, Step } from '@wise/dynamic-flow-types/build/next';
2
2
  import { AnalyticsEventDispatcher } from '../domain/features/events';
3
+ import { Behavior } from '../domain/types';
3
4
  type Command = {
4
5
  type: 'complete';
5
6
  result: Model;
@@ -10,13 +11,13 @@ type Command = {
10
11
  } | {
11
12
  type: 'continue';
12
13
  } | {
13
- type: 'action';
14
- action: Action;
14
+ type: 'behavior';
15
+ behavior: Behavior;
15
16
  };
16
17
  export declare const executePoll: (props: {
17
18
  httpClient: typeof fetch;
18
19
  url: string;
19
- errorAction: Action;
20
+ errorBehavior: Behavior;
20
21
  signal: AbortSignal;
21
22
  trackEvent: AnalyticsEventDispatcher;
22
23
  }) => Promise<Command>;
@@ -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, step, title, components, onAction, }: StepDomainComponent, rendererMapperProps: RendererMapperProps) => StepRendererProps;
4
+ export declare const stepComponentToProps: ({ uid, back, control, description, error, external, loadingState, step, title, components, onBehavior, }: StepDomainComponent, rendererMapperProps: RendererMapperProps) => StepRendererProps;
@@ -1,6 +1,6 @@
1
+ import { RootDomainComponent } from './domain/components/RootDomainComponent';
1
2
  import type { OnValueChange } from './domain/types';
2
3
  import type { DynamicFlowCoreProps } from './types';
3
- import { RootDomainComponent } from './domain/components/RootDomainComponent';
4
4
  type UseDynamicFlowCoreProps = Omit<DynamicFlowCoreProps, 'renderers'> & {
5
5
  onValueChange?: OnValueChange;
6
6
  onLink: (url: string) => boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "4.3.6",
3
+ "version": "4.3.8",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.js",
@@ -38,29 +38,29 @@
38
38
  "@babel/preset-typescript": "7.27.0",
39
39
  "@chromatic-com/storybook": "3.2.6",
40
40
  "@formatjs/cli": "^6.6.3",
41
- "@storybook/addon-a11y": "^8.6.11",
42
- "@storybook/addon-actions": "^8.6.11",
43
- "@storybook/addon-essentials": "^8.6.11",
44
- "@storybook/addon-interactions": "^8.6.11",
45
- "@storybook/addon-links": "^8.6.11",
46
- "@storybook/addon-webpack5-compiler-babel": "^3.0.5",
47
- "@storybook/manager-api": "^8.6.11",
48
- "@storybook/react": "^8.6.11",
49
- "@storybook/react-webpack5": "^8.6.11",
50
- "@storybook/test": "^8.6.11",
51
- "@storybook/types": "^8.6.11",
41
+ "@storybook/addon-a11y": "^8.6.12",
42
+ "@storybook/addon-actions": "^8.6.12",
43
+ "@storybook/addon-essentials": "^8.6.12",
44
+ "@storybook/addon-interactions": "^8.6.12",
45
+ "@storybook/addon-links": "^8.6.12",
46
+ "@storybook/addon-webpack5-compiler-babel": "^3.0.6",
47
+ "@storybook/manager-api": "^8.6.12",
48
+ "@storybook/react": "^8.6.12",
49
+ "@storybook/react-webpack5": "^8.6.12",
50
+ "@storybook/test": "^8.6.12",
51
+ "@storybook/types": "^8.6.12",
52
52
  "@testing-library/dom": "10.4.0",
53
53
  "@testing-library/jest-dom": "6.6.3",
54
- "@testing-library/react": "16.2.0",
54
+ "@testing-library/react": "16.3.0",
55
55
  "@testing-library/user-event": "14.6.1",
56
56
  "@transferwise/components": "46.94.2",
57
57
  "@transferwise/formatting": "^2.13.1",
58
58
  "@transferwise/icons": "3.19.1",
59
59
  "@transferwise/neptune-css": "14.23.0",
60
- "@types/node": "22.13.14",
60
+ "@types/node": "22.14.0",
61
61
  "@types/jest": "29.5.14",
62
62
  "@types/react": "18.3.20",
63
- "@types/react-dom": "18.3.5",
63
+ "@types/react-dom": "18.3.6",
64
64
  "@types/react-intl": "3.0.0",
65
65
  "@wise/art": "2.20.0",
66
66
  "@wise/components-theming": "^1.6.1",
@@ -77,13 +77,13 @@
77
77
  "react": "18.3.1",
78
78
  "react-dom": "18.3.1",
79
79
  "react-intl": "6.8.9",
80
- "storybook": "^8.6.11",
81
- "stylelint": "16.17.0",
80
+ "storybook": "^8.6.12",
81
+ "stylelint": "16.18.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",
85
85
  "tsx": "4.19.3",
86
- "typescript": "5.8.2",
86
+ "typescript": "5.8.3",
87
87
  "webpack": "5.98.0",
88
88
  "@wise/dynamic-flow-fixtures": "0.0.1",
89
89
  "@wise/dynamic-flow-renderers": "0.0.0"
@@ -1,2 +0,0 @@
1
- import type { Action } from '@wise/dynamic-flow-types/build/next';
2
- export declare const inlineAction: (action: Action, stepActions?: Action[]) => Action;