@wise/dynamic-flow-client 2.5.0 → 2.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 +1 -1
- package/build/main.min.js +1 -1
- package/build/types/revamp/domain/components/AlertComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/ButtonComponent.d.ts +23 -0
- package/build/types/revamp/domain/components/HeadingComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/ObjectComponent.d.ts +15 -7
- package/build/types/revamp/domain/components/ParagraphComponent.d.ts +2 -0
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +4 -5
- package/build/types/revamp/domain/mappers/layout/alertLayoutToComponent.d.ts +2 -1
- package/build/types/revamp/domain/mappers/layout/buttonLayoutToComponent.d.ts +3 -0
- package/build/types/revamp/domain/mappers/layout/formLayoutToComponent.d.ts +3 -2
- package/build/types/revamp/domain/mappers/layout/headingLayoutToComponent.d.ts +2 -1
- package/build/types/revamp/domain/mappers/layout/paragraphLayoutToComponent.d.ts +2 -1
- package/build/types/revamp/domain/mappers/mapSchemaToComponents.d.ts +2 -2
- package/build/types/revamp/domain/mappers/mapStepToComponents.d.ts +7 -2
- package/build/types/revamp/domain/mappers/schema/objectSchemaToComponent.d.ts +3 -0
- package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent.d.ts +2 -2
- package/build/types/revamp/domain/mappers/schema/types.d.ts +6 -2
- package/build/types/revamp/domain/mappers/utils/legacy-utils.d.ts +2 -0
- package/build/types/revamp/domain/types.d.ts +12 -6
- package/build/types/revamp/renderers/mappers/buttonComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/componentToRendererProps.d.ts +2 -1
- package/build/types/revamp/renderers/mappers/objectComponentToProps.d.ts +4 -0
- package/build/types/revamp/renderers/types.d.ts +15 -0
- package/build/types/revamp/step/utils/render-utils.d.ts +5 -0
- package/build/types/revamp/utils/findComponent.d.ts +2 -0
- package/build/types/revamp/utils/getSubmittableData.d.ts +3 -0
- package/build/types/revamp/utils/type-utils.d.ts +4 -0
- package/build/types/revamp/wise/renderers/ButtonRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/ObjectRenderer.d.ts +3 -0
- package/package.json +7 -6
- package/build/types/revamp/domain/components/Step.d.ts +0 -9
|
@@ -4,8 +4,10 @@ export type AlertComponent = LayoutComponent & {
|
|
|
4
4
|
type: 'alert';
|
|
5
5
|
markdown: string;
|
|
6
6
|
context: Context;
|
|
7
|
+
getValue: () => null;
|
|
7
8
|
};
|
|
8
9
|
export declare const createAlertComponent: (alertProps: {
|
|
10
|
+
uid: string;
|
|
9
11
|
markdown: string;
|
|
10
12
|
context: Context;
|
|
11
13
|
margin: Margin;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Context, Margin } from '@wise/dynamic-flow-types';
|
|
2
|
+
import { LayoutComponent } from '../types';
|
|
3
|
+
export type ButtonComponent = LayoutComponent & {
|
|
4
|
+
type: 'button';
|
|
5
|
+
title: string;
|
|
6
|
+
context: Context;
|
|
7
|
+
control?: string;
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
margin: Margin;
|
|
10
|
+
pinOrder?: number;
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
getValue: () => null;
|
|
13
|
+
};
|
|
14
|
+
export declare const createButtonComponent: (buttonProps: {
|
|
15
|
+
uid: string;
|
|
16
|
+
title: string;
|
|
17
|
+
context: Context;
|
|
18
|
+
control?: string;
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
pinOrder?: number;
|
|
21
|
+
margin: Margin;
|
|
22
|
+
onClick: () => void;
|
|
23
|
+
}) => ButtonComponent;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { StepComponent } from '../types';
|
|
3
|
-
export type ObjectComponent = {
|
|
1
|
+
import { ObjectModel } from '@wise/dynamic-flow-types';
|
|
2
|
+
import { RenderableComponent, StepComponent } from '../types';
|
|
3
|
+
export type ObjectComponent = RenderableComponent & {
|
|
4
4
|
type: 'object';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
componentMap: Record<string, StepComponent>;
|
|
8
|
+
getChildren: () => StepComponent[];
|
|
9
|
+
getValue: () => ObjectModel;
|
|
8
10
|
};
|
|
9
|
-
export declare const createObjectComponent: (
|
|
11
|
+
export declare const createObjectComponent: (objectProps: {
|
|
12
|
+
uid: string;
|
|
13
|
+
title?: string | undefined;
|
|
14
|
+
description?: string | undefined;
|
|
15
|
+
displayOrder: string[];
|
|
16
|
+
components: Record<string, StepComponent>;
|
|
17
|
+
}) => ObjectComponent;
|
|
@@ -5,8 +5,10 @@ export type ParagraphComponent = LayoutComponent & {
|
|
|
5
5
|
text: string;
|
|
6
6
|
control?: 'copyable' | string;
|
|
7
7
|
align: Align;
|
|
8
|
+
getValue: () => null;
|
|
8
9
|
};
|
|
9
10
|
export declare const createParagraphComponent: (paragraphProps: {
|
|
11
|
+
uid: string;
|
|
10
12
|
text: string;
|
|
11
13
|
control?: string | undefined;
|
|
12
14
|
margin: Margin;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StringSchema } from '@wise/dynamic-flow-types';
|
|
2
|
-
import { InputComponent } from '../types';
|
|
2
|
+
import { InputComponent, UpdateComponent } from '../types';
|
|
3
3
|
type TextInputFormat = 'text' | 'date';
|
|
4
4
|
type TextInputControl = 'password' | 'textarea' | 'email' | 'numeric' | 'phone-number' | 'date-lookup' | string;
|
|
5
5
|
export type TextInputComponent = InputComponent & {
|
|
@@ -11,7 +11,7 @@ export type TextInputComponent = InputComponent & {
|
|
|
11
11
|
format: TextInputFormat;
|
|
12
12
|
value: string | undefined;
|
|
13
13
|
onChange: (value: string | undefined) => void;
|
|
14
|
-
getValue: () => string |
|
|
14
|
+
getValue: () => string | null;
|
|
15
15
|
};
|
|
16
16
|
export declare const createTextInputComponent: (textInputProps: {
|
|
17
17
|
uid: string;
|
|
@@ -19,9 +19,8 @@ export declare const createTextInputComponent: (textInputProps: {
|
|
|
19
19
|
title?: string | undefined;
|
|
20
20
|
description?: string | undefined;
|
|
21
21
|
placeholder?: string | undefined;
|
|
22
|
-
control
|
|
22
|
+
control?: StringSchema['control'];
|
|
23
23
|
format: StringSchema['format'];
|
|
24
24
|
value?: string | undefined;
|
|
25
|
-
|
|
26
|
-
}) => TextInputComponent;
|
|
25
|
+
}, updateComponent: UpdateComponent) => TextInputComponent;
|
|
27
26
|
export {};
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { AlertLayout } from '@wise/dynamic-flow-types';
|
|
2
|
-
|
|
2
|
+
import { MapperProps } from '../schema/types';
|
|
3
|
+
export declare const alertLayoutToComponent: ({ markdown, margin, context }: AlertLayout, { uid }: MapperProps) => import("../../components/AlertComponent").AlertComponent;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ButtonLayout } from '@wise/dynamic-flow-types';
|
|
2
|
+
import { MapperProps } from '../schema/types';
|
|
3
|
+
export declare const buttonLayoutToComponent: ({ title, action, context, disabled, control, margin }: ButtonLayout, { uid, onAction }: MapperProps) => import("../../components/ButtonComponent").ButtonComponent;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { FormLayout
|
|
1
|
+
import { FormLayout } from '@wise/dynamic-flow-types';
|
|
2
2
|
import { StepComponent } from '../../types';
|
|
3
|
-
|
|
3
|
+
import { MapperProps } from '../schema/types';
|
|
4
|
+
export declare const formLayoutToComponent: ({ schemaId }: FormLayout, mapperProps: MapperProps) => StepComponent;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { HeadingLayout } from '@wise/dynamic-flow-types';
|
|
2
|
-
|
|
2
|
+
import { MapperProps } from '../schema/types';
|
|
3
|
+
export declare const headingLayoutToComponent: ({ text, size, margin, align }: HeadingLayout, { uid }: MapperProps) => import("../../components/HeadingComponent").HeadingComponent;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { ParagraphLayout } from '@wise/dynamic-flow-types';
|
|
2
|
-
|
|
2
|
+
import { MapperProps } from '../schema/types';
|
|
3
|
+
export declare const paragraphLayoutToComponent: ({ text, control, align, margin }: ParagraphLayout, { uid }: MapperProps) => import("../../components/ParagraphComponent").ParagraphComponent;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Schema } from '@wise/dynamic-flow-types';
|
|
2
2
|
import { StepComponent } from '../types';
|
|
3
|
-
import {
|
|
4
|
-
export declare const mapSchemaToComponents: (schema: Schema, mapperProps:
|
|
3
|
+
import { MapperProps } from './schema/types';
|
|
4
|
+
export declare const mapSchemaToComponents: (schema: Schema, mapperProps: MapperProps) => StepComponent;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { Step as DFStep } from '@wise/dynamic-flow-types';
|
|
2
|
-
|
|
2
|
+
import { OnAction, StepComponent, UpdateComponent } from '../types';
|
|
3
|
+
type MapStepToComponentsProps = {
|
|
3
4
|
step: DFStep;
|
|
4
|
-
|
|
5
|
+
updateComponent: UpdateComponent;
|
|
6
|
+
onAction: OnAction;
|
|
7
|
+
};
|
|
8
|
+
export declare const mapStepToComponents: (mapStepToComponentsProps: MapStepToComponentsProps) => StepComponent[];
|
|
9
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { StringSchema } from '@wise/dynamic-flow-types';
|
|
2
|
-
import {
|
|
3
|
-
export declare const stringSchemaToComponent: (schema: StringSchema, mapperProps:
|
|
2
|
+
import { MapperProps } from './types';
|
|
3
|
+
export declare const stringSchemaToComponent: (schema: StringSchema, mapperProps: MapperProps) => import("../../components/TextInputComponent").TextInputComponent;
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { Step as DFStep } from '@wise/dynamic-flow-types';
|
|
2
|
+
import { OnAction, UpdateComponent } from '../../types';
|
|
3
|
+
export type MapperProps = {
|
|
2
4
|
uid: string;
|
|
3
|
-
|
|
5
|
+
step: DFStep;
|
|
6
|
+
onAction: OnAction;
|
|
7
|
+
updateComponent: UpdateComponent;
|
|
4
8
|
};
|
|
@@ -1,19 +1,25 @@
|
|
|
1
|
-
import { Margin } from '@wise/dynamic-flow-types';
|
|
1
|
+
import { Action, Margin, Model } from '@wise/dynamic-flow-types';
|
|
2
2
|
import { AlertComponent } from './components/AlertComponent';
|
|
3
|
+
import { ButtonComponent } from './components/ButtonComponent';
|
|
3
4
|
import { HeadingComponent } from './components/HeadingComponent';
|
|
4
5
|
import { ObjectComponent } from './components/ObjectComponent';
|
|
5
6
|
import { ParagraphComponent } from './components/ParagraphComponent';
|
|
6
7
|
import { TextInputComponent } from './components/TextInputComponent';
|
|
7
|
-
export type StepComponent = AlertComponent | HeadingComponent | ParagraphComponent | ObjectComponent | TextInputComponent;
|
|
8
|
+
export type StepComponent = AlertComponent | HeadingComponent | ParagraphComponent | ObjectComponent | TextInputComponent | ButtonComponent;
|
|
9
|
+
export type ContainerComponent = ObjectComponent;
|
|
8
10
|
export type BaseComponent = {
|
|
9
11
|
type: string;
|
|
12
|
+
uid: string;
|
|
13
|
+
getValue: () => Model;
|
|
14
|
+
};
|
|
15
|
+
export type RenderableComponent = BaseComponent & {
|
|
10
16
|
keyProp: string;
|
|
11
17
|
};
|
|
12
|
-
export type LayoutComponent =
|
|
18
|
+
export type LayoutComponent = RenderableComponent & {
|
|
13
19
|
margin: Margin;
|
|
14
20
|
};
|
|
15
|
-
export type InputComponent =
|
|
16
|
-
uid: string;
|
|
21
|
+
export type InputComponent = RenderableComponent & {
|
|
17
22
|
id: string;
|
|
18
|
-
propertyName: string;
|
|
19
23
|
};
|
|
24
|
+
export type UpdateComponent = (id: string, update: (component: StepComponent) => void) => void;
|
|
25
|
+
export type OnAction = (action: Action) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { StepComponent } from '../../domain/types';
|
|
2
3
|
import { RendererProps } from '../types';
|
|
3
|
-
export declare const componentToRendererProps: (component: StepComponent) => RendererProps
|
|
4
|
+
export declare const componentToRendererProps: (component: StepComponent, children?: ReactNode) => RendererProps;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ObjectComponent } from '../../domain/components/ObjectComponent';
|
|
3
|
+
import { ObjectRendererProps } from '../types';
|
|
4
|
+
export declare const objectComponentToProps: ({ keyProp, title, description }: ObjectComponent, children: ReactNode) => ObjectRendererProps;
|
|
@@ -33,6 +33,12 @@ export interface ParagraphRendererProps extends RendererProps {
|
|
|
33
33
|
margin: Margin;
|
|
34
34
|
align: Align;
|
|
35
35
|
}
|
|
36
|
+
export interface ObjectRendererProps extends RendererProps {
|
|
37
|
+
type: 'object';
|
|
38
|
+
title?: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
children: ReactNode;
|
|
41
|
+
}
|
|
36
42
|
export interface TextInputRendererProps extends RendererProps {
|
|
37
43
|
type: 'input-text';
|
|
38
44
|
control?: 'password' | 'textarea' | 'email' | 'numeric' | 'phone-number' | 'date-lookup' | string;
|
|
@@ -45,3 +51,12 @@ export interface TextInputRendererProps extends RendererProps {
|
|
|
45
51
|
value?: string;
|
|
46
52
|
onChange: (value: string | undefined) => void;
|
|
47
53
|
}
|
|
54
|
+
export interface ButtonRendererProps extends RendererProps {
|
|
55
|
+
type: 'button';
|
|
56
|
+
title: string;
|
|
57
|
+
control?: 'primary' | 'secondary' | 'tertiary' | string;
|
|
58
|
+
context: Context;
|
|
59
|
+
disabled: boolean;
|
|
60
|
+
margin: Margin;
|
|
61
|
+
onClick: () => void;
|
|
62
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { StepComponent } from '../../domain/types';
|
|
3
|
+
import { Renderer, RendererProps } from '../../renderers/types';
|
|
4
|
+
export declare const renderComponent: (component: StepComponent, render: (props: RendererProps) => ReactNode) => ReactNode;
|
|
5
|
+
export declare const getPropsRenderer: <P extends RendererProps>(renderers: Renderer<P>[]) => (props: P) => ReactNode;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Model } from '@wise/dynamic-flow-types';
|
|
2
|
+
import { StepComponent } from '../domain/types';
|
|
3
|
+
export declare const isContainerComponent: (component: StepComponent) => component is import("../domain/components/ObjectComponent").ObjectComponent;
|
|
4
|
+
export declare const isObjectModel: (model: Model) => model is Record<string, Model>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wise/dynamic-flow-client",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Dynamic Flow web client",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "./build/main.min.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@babel/preset-react": "7.23.3",
|
|
26
26
|
"@babel/preset-typescript": "7.23.3",
|
|
27
27
|
"@cfaester/enzyme-adapter-react-18": "0.7.1",
|
|
28
|
-
"@formatjs/cli": "^
|
|
28
|
+
"@formatjs/cli": "^6.2.3",
|
|
29
29
|
"@storybook/addon-a11y": "7.5.3",
|
|
30
30
|
"@storybook/addon-actions": "7.5.3",
|
|
31
31
|
"@storybook/addon-essentials": "7.5.3",
|
|
@@ -39,12 +39,12 @@
|
|
|
39
39
|
"@testing-library/react": "14.1.0",
|
|
40
40
|
"@testing-library/react-hooks": "8.0.1",
|
|
41
41
|
"@testing-library/user-event": "14.5.1",
|
|
42
|
-
"@transferwise/components": "45.
|
|
42
|
+
"@transferwise/components": "45.20.0",
|
|
43
43
|
"@transferwise/eslint-config": "8.2.0",
|
|
44
44
|
"@transferwise/formatting": "^2.10.0",
|
|
45
45
|
"@transferwise/icons": "3.12.0",
|
|
46
|
-
"@transferwise/neptune-css": "14.6.
|
|
47
|
-
"@transferwise/neptune-tokens": "8.
|
|
46
|
+
"@transferwise/neptune-css": "14.6.2",
|
|
47
|
+
"@transferwise/neptune-tokens": "8.7.0",
|
|
48
48
|
"@types/enzyme": "^3.10.16",
|
|
49
49
|
"@types/jest": "29.5.8",
|
|
50
50
|
"@types/react": "18",
|
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
"esbuild": "0.19.5",
|
|
60
60
|
"eslint": "8.53.0",
|
|
61
61
|
"eslint-plugin-storybook": "0.6.15",
|
|
62
|
+
"immer": "10.0.3",
|
|
62
63
|
"jest": "29.7.0",
|
|
63
64
|
"jest-environment-jsdom": "29.7.0",
|
|
64
65
|
"jest-fetch-mock": "^3.0.3",
|
|
@@ -67,7 +68,7 @@
|
|
|
67
68
|
"postcss": "^8.4.31",
|
|
68
69
|
"postcss-cli": "^10.1.0",
|
|
69
70
|
"postcss-import": "^15.1.0",
|
|
70
|
-
"prettier": "
|
|
71
|
+
"prettier": "3.1.0",
|
|
71
72
|
"react": "18.2.0",
|
|
72
73
|
"react-dom": "18.2.0",
|
|
73
74
|
"react-intl": "6.5.4",
|