@wise/dynamic-flow-client 5.0.0 → 5.1.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/README.md +15 -30
- package/build/main.js +220 -108
- package/build/main.mjs +220 -108
- package/build/types/domain/components/step/StepDomainComponent.d.ts +4 -2
- package/build/types/domain/features/polling/getStepPolling.d.ts +3 -2
- package/build/types/domain/mappers/layout/alertLayoutToComponent.d.ts +1 -1
- package/build/types/domain/mappers/layout/decisionLayoutToComponent.d.ts +1 -1
- package/build/types/domain/mappers/layout/reviewLayoutToComponent.d.ts +1 -1
- package/build/types/domain/mappers/layout/statusListLayoutToComponent.d.ts +1 -1
- package/build/types/domain/mappers/mapStepToComponent.d.ts +1 -1
- package/build/types/domain/mappers/schema/types.d.ts +2 -1
- package/build/types/domain/mappers/utils/behavior-utils.d.ts +5 -2
- package/build/types/domain/mappers/utils/call-to-action-utils.d.ts +3 -2
- package/build/types/domain/mappers/utils/utils.d.ts +3 -2
- package/build/types/domain/prefetching/request-cache.d.ts +9 -0
- package/build/types/flow/executeSubmission.d.ts +4 -1
- package/build/types/flow/makeSafeHttpClient.d.ts +2 -0
- package/build/types/flow/makeSubmissionRequest.d.ts +3 -0
- package/package.json +28 -37
- package/build/types/domain/mappers/schema/tests/test-utils.d.ts +0 -34
- package/build/types/test-utils/NeptuneProviders.d.ts +0 -5
- package/build/types/test-utils/getRandomId.d.ts +0 -1
- package/build/types/test-utils/index.d.ts +0 -2
- package/build/types/test-utils/rtl-utils.d.ts +0 -2
- package/build/types/tests/renderers/TextInputRenderer.test.d.ts +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { AlertLayout } from '@wise/dynamic-flow-types/spec';
|
|
2
2
|
import { MapperProps } from '../schema/types';
|
|
3
|
-
export declare const alertLayoutToComponent: (uid: string, { control, markdown, margin, context, callToAction, analyticsId, tags, }: AlertLayout,
|
|
3
|
+
export declare const alertLayoutToComponent: (uid: string, { control, markdown, margin, context, callToAction, analyticsId, tags, }: AlertLayout, mapperProps: 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, { analyticsId, control, margin, options, tags, title, }: Omit<DecisionLayout, "options"> & {
|
|
4
4
|
options: DecisionLayoutOption[];
|
|
5
|
-
},
|
|
5
|
+
}, mapperProps: MapperProps) => import("../../components/DecisionComponent").DecisionComponent;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ReviewLayout } from '@wise/dynamic-flow-types/spec';
|
|
2
2
|
import type { MapperProps } from '../schema/types';
|
|
3
|
-
export declare const reviewLayoutToComponent: (uid: string, { analyticsId, fields, title, callToAction, control, margin, tags, orientation, action, }: ReviewLayout,
|
|
3
|
+
export declare const reviewLayoutToComponent: (uid: string, { analyticsId, fields, title, callToAction, control, margin, tags, orientation, action, }: ReviewLayout, mapperProps: MapperProps) => import("../../components/ReviewComponent").ReviewComponent;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { StatusListLayout } from '@wise/dynamic-flow-types/spec';
|
|
2
2
|
import { MapperProps } from '../schema/types';
|
|
3
|
-
export declare const statusListLayoutToComponent: (uid: string, { analyticsId, control, items, margin, tags, title }: StatusListLayout,
|
|
3
|
+
export declare const statusListLayoutToComponent: (uid: string, { analyticsId, control, items, margin, tags, title }: StatusListLayout, mapperProps: MapperProps) => import("../../components/StatusListComponent").StatusListComponent;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AnalyticsEventDispatcher } from '../features/events';
|
|
2
2
|
import type { LoadingState, OnPoll } from '../types';
|
|
3
3
|
import type { MapperProps } from './schema/types';
|
|
4
|
-
export type StepMapperProps = Omit<MapperProps, 'trackEvent'> & {
|
|
4
|
+
export type StepMapperProps = Omit<MapperProps, 'trackEvent' | 'registerSubmissionBehavior'> & {
|
|
5
5
|
uid: string;
|
|
6
6
|
etag: string | null;
|
|
7
7
|
loadingState: LoadingState;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Step as DFStep, Model, Schema, ValidationError } from '@wise/dynamic-flow-types/spec';
|
|
2
2
|
import type { HttpClient } from '../../../types';
|
|
3
3
|
import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../../features/events';
|
|
4
|
-
import type { LocalValue, OnBehavior, OnPersistAsync, OnValueChange, UpdateComponent } from '../../types';
|
|
4
|
+
import type { Behavior, LocalValue, OnBehavior, OnPersistAsync, OnValueChange, UpdateComponent } from '../../types';
|
|
5
5
|
import type { GetErrorMessageFunctions, PersistAsyncConfig } from '../types';
|
|
6
6
|
export type MapperProps = {
|
|
7
7
|
stepLocalValue: LocalValue;
|
|
@@ -13,6 +13,7 @@ export type MapperProps = {
|
|
|
13
13
|
updateComponent: UpdateComponent;
|
|
14
14
|
trackEvent: AnalyticsEventDispatcher;
|
|
15
15
|
logEvent: LoggingEventDispatcher;
|
|
16
|
+
registerSubmissionBehavior: (behavior: Behavior) => void;
|
|
16
17
|
};
|
|
17
18
|
export type SchemaMapperProps = {
|
|
18
19
|
uid: string;
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { Action, Behavior as SpecBehavior } from '@wise/dynamic-flow-types/spec';
|
|
2
2
|
import { Behavior } from '../../types';
|
|
3
|
-
|
|
3
|
+
import { MapperProps } from '../schema/types';
|
|
4
|
+
type WithActionBehavior = {
|
|
4
5
|
action?: Action;
|
|
5
6
|
behavior?: SpecBehavior;
|
|
6
|
-
}
|
|
7
|
+
};
|
|
8
|
+
export declare const getDomainLayerBehavior: ({ action, behavior: specBehavior }: WithActionBehavior, stepActions: Action[], registerSubmissionBehavior: MapperProps["registerSubmissionBehavior"]) => Behavior;
|
|
7
9
|
export declare const normaliseBehavior: (behavior: SpecBehavior, stepActions: Action[]) => Behavior;
|
|
8
10
|
export declare const inlineAction: (action: Action, stepActions?: Action[]) => Action;
|
|
11
|
+
export {};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Action, Behavior as SpecBehavior } from '@wise/dynamic-flow-types/spec';
|
|
2
|
-
import { CallToAction
|
|
2
|
+
import { CallToAction } from '../../types';
|
|
3
|
+
import { MapperProps } from '../schema/types';
|
|
3
4
|
type SpecCallToAction = {
|
|
4
5
|
title?: string;
|
|
5
6
|
accessibilityDescription?: string;
|
|
6
7
|
action?: Action;
|
|
7
8
|
behavior?: SpecBehavior;
|
|
8
9
|
};
|
|
9
|
-
export declare const getDomainLayerCallToAction: (callToAction: SpecCallToAction | undefined,
|
|
10
|
+
export declare const getDomainLayerCallToAction: (callToAction: SpecCallToAction | undefined, mapperProps: MapperProps) => CallToAction | undefined;
|
|
10
11
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AlertLayout, AdditionalInfo as SpecAdditionalInfo, InlineAlert as SpecInlineAlert } from '@wise/dynamic-flow-types/spec';
|
|
2
|
-
import { AdditionalInfo, InlineAlert
|
|
2
|
+
import { AdditionalInfo, InlineAlert } from '../../types';
|
|
3
|
+
import { MapperProps } from '../schema/types';
|
|
3
4
|
export declare const mapInlineAlert: (alert: SpecInlineAlert | undefined) => InlineAlert | undefined;
|
|
4
|
-
export declare const mapAdditionalInfo: (info: SpecAdditionalInfo | undefined,
|
|
5
|
+
export declare const mapAdditionalInfo: (info: SpecAdditionalInfo | undefined, mapperProps: MapperProps) => AdditionalInfo | undefined;
|
|
5
6
|
export declare const mapSchemaAlert: (alert: AlertLayout | undefined) => InlineAlert | undefined;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HttpClient } from '../../types';
|
|
2
|
+
export type SubmissionRequestCache = {
|
|
3
|
+
has: (...requestParams: Parameters<HttpClient>) => boolean;
|
|
4
|
+
get: (...requestParams: Parameters<HttpClient>) => Promise<Response | null> | undefined;
|
|
5
|
+
delete: (...requestParams: Parameters<HttpClient>) => boolean;
|
|
6
|
+
set: (...[input, init, response]: [...Parameters<HttpClient>, Promise<Response | null>]) => void;
|
|
7
|
+
clear: () => void;
|
|
8
|
+
};
|
|
9
|
+
export declare const makeRequestCache: () => SubmissionRequestCache;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { Action, ErrorResponseBody, Model, Step } from '@wise/dynamic-flow-types/spec';
|
|
2
2
|
import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../domain/features/events';
|
|
3
|
+
import { SubmissionRequestCache } from '../domain/prefetching/request-cache';
|
|
3
4
|
import type { Behavior } from '../domain/types';
|
|
5
|
+
import { HttpClient } from '../types';
|
|
4
6
|
type Command = {
|
|
5
7
|
type: 'complete';
|
|
6
8
|
result: Model;
|
|
@@ -32,7 +34,8 @@ export declare const executeSubmission: (props: {
|
|
|
32
34
|
action: Action;
|
|
33
35
|
model: Model;
|
|
34
36
|
isInitial: boolean;
|
|
35
|
-
|
|
37
|
+
requestCache: SubmissionRequestCache | undefined;
|
|
38
|
+
httpClient: HttpClient;
|
|
36
39
|
trackEvent: AnalyticsEventDispatcher;
|
|
37
40
|
logEvent: LoggingEventDispatcher;
|
|
38
41
|
}) => Promise<Command>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.js",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"import": "./build/main.mjs",
|
|
17
17
|
"require": "./build/main.js"
|
|
18
18
|
},
|
|
19
|
-
"./build/main.css": "./build/main.css"
|
|
19
|
+
"./build/main.css": "./build/main.css",
|
|
20
|
+
"./main.css": "./build/main.css"
|
|
20
21
|
},
|
|
21
22
|
"sideEffects": [
|
|
22
23
|
"*.css"
|
|
@@ -30,42 +31,31 @@
|
|
|
30
31
|
"url": "git+https://github.com/transferwise/dynamic-flow.git"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@
|
|
34
|
-
"@babel/plugin-syntax-flow": "7.27.1",
|
|
35
|
-
"@babel/plugin-transform-react-jsx": "7.27.1",
|
|
36
|
-
"@babel/preset-env": "7.28.5",
|
|
37
|
-
"@babel/preset-react": "7.28.5",
|
|
38
|
-
"@babel/preset-typescript": "7.28.5",
|
|
39
|
-
"@chromatic-com/storybook": "4.1.2",
|
|
34
|
+
"@chromatic-com/storybook": "4.1.3",
|
|
40
35
|
"@formatjs/cli": "^6.7.4",
|
|
41
|
-
"@storybook/addon-a11y": "^
|
|
42
|
-
"@storybook/addon-docs": "^
|
|
43
|
-
"@storybook/addon-links": "^
|
|
44
|
-
"@storybook/react-vite": "
|
|
36
|
+
"@storybook/addon-a11y": "^10.1.4",
|
|
37
|
+
"@storybook/addon-docs": "^10.1.4",
|
|
38
|
+
"@storybook/addon-links": "^10.1.4",
|
|
39
|
+
"@storybook/react-vite": "10.1.4",
|
|
45
40
|
"@testing-library/dom": "10.4.1",
|
|
46
41
|
"@testing-library/jest-dom": "6.9.1",
|
|
47
42
|
"@testing-library/react": "16.3.0",
|
|
48
43
|
"@testing-library/user-event": "14.6.1",
|
|
49
|
-
"@transferwise/components": "46.
|
|
44
|
+
"@transferwise/components": "^46.115.1",
|
|
50
45
|
"@transferwise/formatting": "^2.13.4",
|
|
51
46
|
"@transferwise/icons": "4.0.0",
|
|
52
|
-
"@transferwise/navigation-ui": "4.
|
|
53
|
-
"@transferwise/neptune-css": "14.25.
|
|
54
|
-
"@types/jest": "30.0.0",
|
|
47
|
+
"@transferwise/navigation-ui": "4.41.0",
|
|
48
|
+
"@transferwise/neptune-css": "14.25.2",
|
|
55
49
|
"@types/node": "22.19.1",
|
|
56
|
-
"@types/react": "18.3.
|
|
50
|
+
"@types/react": "18.3.27",
|
|
57
51
|
"@types/react-dom": "18.3.7",
|
|
58
52
|
"@types/react-intl": "3.0.0",
|
|
53
|
+
"@vitejs/plugin-react": "5.1.1",
|
|
59
54
|
"@wise/art": "2.24.7",
|
|
60
|
-
"@wise/components-theming": "^1.
|
|
61
|
-
"babel-jest": "30.2.0",
|
|
55
|
+
"@wise/components-theming": "^1.9.0",
|
|
62
56
|
"esbuild": "0.27.0",
|
|
63
|
-
"eslint-plugin-storybook": "
|
|
64
|
-
"framer-motion": "^12.23.
|
|
65
|
-
"jest": "30.2.0",
|
|
66
|
-
"jest-environment-jsdom": "30.2.0",
|
|
67
|
-
"jest-fetch-mock": "^3.0.3",
|
|
68
|
-
"jest-watch-typeahead": "^3.0.1",
|
|
57
|
+
"eslint-plugin-storybook": "10.1.4",
|
|
58
|
+
"framer-motion": "^12.23.25",
|
|
69
59
|
"npm-run-all2": "8.0.4",
|
|
70
60
|
"postcss": "^8.5.6",
|
|
71
61
|
"postcss-cli": "^11.0.1",
|
|
@@ -73,15 +63,17 @@
|
|
|
73
63
|
"react": "18.3.1",
|
|
74
64
|
"react-dom": "18.3.1",
|
|
75
65
|
"react-intl": "6.8.9",
|
|
76
|
-
"storybook": "^
|
|
77
|
-
"stylelint": "16.
|
|
66
|
+
"storybook": "^10.1.4",
|
|
67
|
+
"stylelint": "16.26.1",
|
|
78
68
|
"stylelint-config-standard": "36.0.1",
|
|
79
69
|
"stylelint-no-unsupported-browser-features": "8.0.5",
|
|
80
70
|
"stylelint-value-no-unknown-custom-properties": "6.0.1",
|
|
81
|
-
"tsx": "4.
|
|
71
|
+
"tsx": "4.21.0",
|
|
82
72
|
"typescript": "5.9.3",
|
|
83
|
-
"
|
|
84
|
-
"
|
|
73
|
+
"vitest": "4.0.15",
|
|
74
|
+
"vitest-fetch-mock": "0.4.5",
|
|
75
|
+
"@wise/dynamic-flow-fixtures": "0.0.1",
|
|
76
|
+
"@wise/dynamic-flow-renderers": "0.0.0"
|
|
85
77
|
},
|
|
86
78
|
"peerDependencies": {
|
|
87
79
|
"@transferwise/components": "^46.104.0",
|
|
@@ -94,7 +86,7 @@
|
|
|
94
86
|
"react-intl": "^6"
|
|
95
87
|
},
|
|
96
88
|
"dependencies": {
|
|
97
|
-
"@wise/dynamic-flow-types": "4.
|
|
89
|
+
"@wise/dynamic-flow-types": "4.1.0"
|
|
98
90
|
},
|
|
99
91
|
"scripts": {
|
|
100
92
|
"dev": "EXCLUDE_VISUAL_TESTS=true pnpm storybook dev -p 3003",
|
|
@@ -106,11 +98,10 @@
|
|
|
106
98
|
"build:messages-source": "formatjs extract 'src/**/{*.messages,messages}.{js,ts}' --out-file src/i18n/en.json --format simple && prettier --find-config-path --write src/i18n/*.json",
|
|
107
99
|
"build:compiled-messages": "mkdir -p build/i18n && cp src/i18n/*.json build/i18n",
|
|
108
100
|
"build:visual-tests": "tsx ./scripts/build-visual-tests.mjs",
|
|
109
|
-
"test": "npm-run-all test:once
|
|
110
|
-
"test:once": "
|
|
111
|
-
"test:coverage": "
|
|
112
|
-
"test:
|
|
113
|
-
"test:watch": "pnpm test:once --watch",
|
|
101
|
+
"test": "npm-run-all test:once",
|
|
102
|
+
"test:once": "vitest run",
|
|
103
|
+
"test:coverage": "vitest run --coverage",
|
|
104
|
+
"test:watch": "vitest",
|
|
114
105
|
"types": "pnpm tsc",
|
|
115
106
|
"types:watch": "pnpm tsc --watch",
|
|
116
107
|
"lint": "npm-run-all lint:ts lint:css",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { Schema, Step } from '@wise/dynamic-flow-types/spec';
|
|
2
|
-
import { RendererMapperProps } from '../../../../renderers/mappers/componentToRendererProps';
|
|
3
|
-
import type { DomainComponent } from '../../../types';
|
|
4
|
-
import type { MapperProps, SchemaMapperProps } from '../types';
|
|
5
|
-
import { StepMapperProps } from '../../mapStepToComponent';
|
|
6
|
-
export declare const getStepMapperProps: () => StepMapperProps;
|
|
7
|
-
export declare const getMockMapperProps: (mapperProps?: Partial<MapperProps>) => {
|
|
8
|
-
stepLocalValue: import("../../../types").LocalValue;
|
|
9
|
-
step: Step;
|
|
10
|
-
getErrorMessageFunctions: import("../../types").GetErrorMessageFunctions | jest.Mock<any, any, any>;
|
|
11
|
-
httpClient: typeof fetch | jest.Mock<any, any, any>;
|
|
12
|
-
onBehavior: import("../../../types").OnBehavior | jest.Mock<any, any, any>;
|
|
13
|
-
onValueChange: import("../../../types").OnValueChange | jest.Mock<any, any, any>;
|
|
14
|
-
updateComponent: import("../../../types").UpdateComponent | jest.Mock<any, any, any>;
|
|
15
|
-
trackEvent: import("../../../features/events").AnalyticsEventDispatcher | jest.Mock<any, any, any>;
|
|
16
|
-
logEvent: import("../../../features/events").LoggingEventDispatcher | jest.Mock<any, any, any>;
|
|
17
|
-
onLink: jest.Mock<any, any, any>;
|
|
18
|
-
};
|
|
19
|
-
export declare const getMockSchemaMapperProps: <S extends Schema>(schemaMapperProps: Partial<SchemaMapperProps> & {
|
|
20
|
-
schema: S;
|
|
21
|
-
}) => {
|
|
22
|
-
uid: string;
|
|
23
|
-
schemaId?: string | undefined;
|
|
24
|
-
schema: (Schema | undefined) & S;
|
|
25
|
-
model: import("@wise/dynamic-flow-types/spec").Model;
|
|
26
|
-
localValue: import("../../../types").LocalValue;
|
|
27
|
-
required: boolean;
|
|
28
|
-
validationErrors: import("@wise/dynamic-flow-types/spec").ValidationError;
|
|
29
|
-
persistAsyncConfig?: import("../../types").PersistAsyncConfig | undefined;
|
|
30
|
-
onPersistAsync?: import("../../../types").OnPersistAsync | undefined;
|
|
31
|
-
};
|
|
32
|
-
export declare const getMockRendererMapperProps: () => RendererMapperProps;
|
|
33
|
-
export declare const mockUpdateFunction: <C extends DomainComponent>(draftComponent: C) => jest.Mock<any, any, any>;
|
|
34
|
-
export declare const getUpdateFunctionMock: <C extends DomainComponent>(getComponent: () => C) => jest.Mock<void, [], any>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const getRandomId: () => string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|