@wise/dynamic-flow-client 5.5.0 → 5.6.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 +5015 -5033
- package/build/main.mjs +6479 -6497
- package/build/types/controller/FlowController.d.ts +19 -0
- package/build/types/controller/getRequestAbortController.d.ts +4 -0
- package/build/types/{flow → controller}/getResponseType.d.ts +4 -3
- package/build/types/controller/getStepCounter.d.ts +9 -0
- package/build/types/{flow → controller}/response-utils.d.ts +0 -1
- package/build/types/domain/mappers/utils/layout-utils.d.ts +6 -1
- package/package.json +4 -4
- package/build/types/useDynamicFlowController.d.ts +0 -19
- /package/build/types/{flow → controller}/executePoll.d.ts +0 -0
- /package/build/types/{flow → controller}/executeRefresh.d.ts +0 -0
- /package/build/types/{flow → controller}/executeRequest.d.ts +0 -0
- /package/build/types/{flow → controller}/executeSubmission.d.ts +0 -0
- /package/build/types/{flow → controller}/getErrorMessage.d.ts +0 -0
- /package/build/types/{flow → controller}/getSafeHttpClient.d.ts +0 -0
- /package/build/types/{flow → controller}/handleErrorResponse.d.ts +0 -0
- /package/build/types/{flow → controller}/makeSafeHttpClient.d.ts +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BackConfig } from '../domain/components/RootDomainComponent';
|
|
2
|
+
import { GetErrorMessageFunctions } from '../domain/mappers/types';
|
|
3
|
+
import { FeatureFlags } from '../domain/mappers/utils/FeatureFlags';
|
|
4
|
+
import { OnValueChange, ScrollToTop } from '../domain/types';
|
|
5
|
+
import { DynamicFlowCoreProps } from '../types';
|
|
6
|
+
export type FlowControllerProps = Omit<DynamicFlowCoreProps, 'renderers' | 'features'> & {
|
|
7
|
+
backConfig: BackConfig;
|
|
8
|
+
features: FeatureFlags;
|
|
9
|
+
getErrorMessageFunctions: GetErrorMessageFunctions;
|
|
10
|
+
onChange: () => void;
|
|
11
|
+
onValueChange: OnValueChange;
|
|
12
|
+
scrollToTop: ScrollToTop;
|
|
13
|
+
onLink: (url: string) => boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const createFlowController: (props: FlowControllerProps) => {
|
|
16
|
+
rootComponent: import("../domain/components/RootDomainComponent").RootDomainComponent;
|
|
17
|
+
start: () => void;
|
|
18
|
+
cancel: () => void;
|
|
19
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { JsonElement } from '@wise/dynamic-flow-types/spec';
|
|
1
2
|
declare const responseTypes: readonly ["step", "action", "exit", "modal", "subflow"];
|
|
2
3
|
export type ResponseType = (typeof responseTypes)[number];
|
|
3
4
|
/**
|
|
4
5
|
* Returns either 'step', 'action', or 'exit' based on the response headers and body.
|
|
5
|
-
* This function
|
|
6
|
+
* This function takes a response body parameter because, for legacy reasons, we still need to consider the body
|
|
6
7
|
* to determine the response type, in cases where the response headers are not set.
|
|
7
8
|
* Ideally it should just be a matter of checking the "X-Df-Response-Type" response header.
|
|
8
9
|
*/
|
|
9
|
-
export declare const getResponseType: (
|
|
10
|
-
export declare const getResponseTypeFromHeader: (
|
|
10
|
+
export declare const getResponseType: (headers: Headers, body: JsonElement) => ResponseType;
|
|
11
|
+
export declare const getResponseTypeFromHeader: (headers: Headers) => ResponseType | undefined;
|
|
11
12
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* To ensure there are no uid collisions between consecutive steps, we use a
|
|
3
|
+
* counter that is appended to the step id. This means that even steps with the
|
|
4
|
+
* same structure and ids will not have the same component uids.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getStepCounter: () => {
|
|
7
|
+
increment(): void;
|
|
8
|
+
readonly current: number;
|
|
9
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ActionResponseBody, ErrorResponseBody, JsonElement, ModalBehavior, Step, SubflowResponseBody } from '@wise/dynamic-flow-types/spec';
|
|
2
|
-
export declare const assertResponseIsValid: (response: unknown) => void;
|
|
3
2
|
export declare const parseResponseBodyAsJsonElement: (response: Response) => Promise<JsonElement>;
|
|
4
3
|
export declare const parseResponseBodyAsText: (response: Response) => Promise<string | null>;
|
|
5
4
|
export declare function isActionResponseBody(body: unknown): body is ActionResponseBody;
|
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
import type { Layout } from '@wise/dynamic-flow-types/spec';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes the margin of the last layout component in the container by removing its margin if it is not explicitly set.
|
|
4
|
+
* @param container The array of layout components.
|
|
5
|
+
* @returns The array of layout components with the last component's margin normalized if needed.
|
|
6
|
+
*/
|
|
7
|
+
export declare const normaliseMarginInLastComponent: (container: Layout[]) => Layout[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.js",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"typescript": "5.9.3",
|
|
73
73
|
"vitest": "4.0.18",
|
|
74
74
|
"vitest-fetch-mock": "0.4.5",
|
|
75
|
-
"@wise/dynamic-flow-
|
|
76
|
-
"@wise/dynamic-flow-
|
|
75
|
+
"@wise/dynamic-flow-renderers": "0.0.0",
|
|
76
|
+
"@wise/dynamic-flow-fixtures": "0.0.1"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|
|
79
79
|
"@transferwise/components": "^46.104.0",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"react-intl": "^6 || ^7"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@wise/dynamic-flow-types": "4.
|
|
89
|
+
"@wise/dynamic-flow-types": "4.7.0"
|
|
90
90
|
},
|
|
91
91
|
"scripts": {
|
|
92
92
|
"dev": "EXCLUDE_VISUAL_TESTS=true pnpm storybook dev -p 3003",
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { BackConfig, RootDomainComponent } from './domain/components/RootDomainComponent';
|
|
2
|
-
import { GetErrorMessageFunctions } from './domain/mappers/types';
|
|
3
|
-
import { FeatureFlags } from './domain/mappers/utils/FeatureFlags';
|
|
4
|
-
import type { OnValueChange, ScrollToTop } from './domain/types';
|
|
5
|
-
import type { DynamicFlowCoreProps } from './types';
|
|
6
|
-
type UseDynamicFlowCoreProps = Omit<DynamicFlowCoreProps, 'renderers' | 'features'> & {
|
|
7
|
-
backConfig: BackConfig;
|
|
8
|
-
features: FeatureFlags;
|
|
9
|
-
getErrorMessageFunctions: GetErrorMessageFunctions;
|
|
10
|
-
onChange: () => void;
|
|
11
|
-
onValueChange: OnValueChange;
|
|
12
|
-
scrollToTop: ScrollToTop;
|
|
13
|
-
onLink: (url: string) => boolean;
|
|
14
|
-
};
|
|
15
|
-
export declare function useDynamicFlowController(props: UseDynamicFlowCoreProps): {
|
|
16
|
-
rootComponent: RootDomainComponent;
|
|
17
|
-
cancel: () => void;
|
|
18
|
-
};
|
|
19
|
-
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|