@wise/dynamic-flow-client 5.4.1 → 5.5.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.
@@ -0,0 +1,18 @@
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
+ cancel: () => void;
18
+ };
@@ -0,0 +1,4 @@
1
+ export declare const getRequestAbortController: () => {
2
+ abortAndGetNewSignal(): AbortSignal;
3
+ abort(): void;
4
+ };
@@ -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 is async because, for legacy reasons, we still need to parse the response body as JSON
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: (response: Response) => Promise<ResponseType>;
10
- export declare const getResponseTypeFromHeader: (response: Response) => ResponseType | undefined;
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,13 +1,14 @@
1
1
  import type { Size } from '@wise/dynamic-flow-types/spec';
2
- import type { BaseLayoutComponent, Context } from '../types';
2
+ import type { BaseLayoutComponent, Context, Media } from '../types';
3
3
  export type ButtonComponent = BaseLayoutComponent & {
4
4
  type: 'button';
5
5
  kind: 'layout';
6
6
  context: Context;
7
7
  disabled: boolean;
8
+ media?: Media;
8
9
  pinOrder?: number;
9
10
  size?: Size;
10
11
  title: string;
11
12
  onClick: () => void;
12
13
  };
13
- export declare const createButtonComponent: (buttonProps: Pick<ButtonComponent, "uid" | "context" | "control" | "disabled" | "margin" | "onClick" | "pinOrder" | "size" | "title" | "analyticsId" | "tags">) => ButtonComponent;
14
+ export declare const createButtonComponent: (buttonProps: Pick<ButtonComponent, "uid" | "context" | "control" | "disabled" | "margin" | "media" | "onClick" | "pinOrder" | "size" | "title" | "analyticsId" | "tags">) => ButtonComponent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "5.4.1",
3
+ "version": "5.5.1",
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-renderers": "0.0.0",
76
- "@wise/dynamic-flow-fixtures": "0.0.1"
75
+ "@wise/dynamic-flow-fixtures": "0.0.1",
76
+ "@wise/dynamic-flow-renderers": "0.0.0"
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.5.1"
89
+ "@wise/dynamic-flow-types": "4.6.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 {};