@wise/dynamic-flow-client 2.3.0 → 2.3.2

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 (54) hide show
  1. package/build/i18n/de.json +1 -0
  2. package/build/i18n/es.json +1 -0
  3. package/build/i18n/fr.json +1 -0
  4. package/build/i18n/hu.json +1 -0
  5. package/build/i18n/id.json +1 -0
  6. package/build/i18n/it.json +1 -0
  7. package/build/i18n/ja.json +1 -0
  8. package/build/i18n/pl.json +1 -0
  9. package/build/i18n/pt.json +1 -0
  10. package/build/i18n/ro.json +1 -0
  11. package/build/i18n/ru.json +1 -0
  12. package/build/i18n/th.json +1 -0
  13. package/build/i18n/tr.json +1 -0
  14. package/build/i18n/zh_CN.json +1 -0
  15. package/build/i18n/zh_HK.json +1 -0
  16. package/build/main.js +26 -11
  17. package/build/main.min.js +1 -1
  18. package/build/types/layout/utils/index.d.ts +1 -1
  19. package/build/types/revamp/domain/{AlertComponent.d.ts → components/AlertComponent.d.ts} +1 -3
  20. package/build/types/revamp/domain/{HeadingComponent.d.ts → components/HeadingComponent.d.ts} +1 -3
  21. package/build/types/revamp/domain/components/ObjectComponent.d.ts +9 -0
  22. package/build/types/revamp/domain/{ParagraphComponent.d.ts → components/ParagraphComponent.d.ts} +2 -4
  23. package/build/types/revamp/domain/{Step.d.ts → components/Step.d.ts} +1 -1
  24. package/build/types/revamp/domain/components/TextInputComponent.d.ts +27 -0
  25. package/build/types/revamp/domain/mappers/layout/alertLayoutToComponent.d.ts +2 -0
  26. package/build/types/revamp/domain/mappers/layout/formLayoutToComponent.d.ts +3 -0
  27. package/build/types/revamp/domain/mappers/layout/headingLayoutToComponent.d.ts +2 -0
  28. package/build/types/revamp/domain/mappers/layout/paragraphLayoutToComponent.d.ts +2 -0
  29. package/build/types/revamp/domain/mappers/mapSchemaToComponents.d.ts +4 -0
  30. package/build/types/revamp/domain/mappers/mapStepToComponents.d.ts +4 -0
  31. package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent.d.ts +3 -0
  32. package/build/types/revamp/domain/mappers/schema/types.d.ts +4 -0
  33. package/build/types/revamp/domain/types.d.ts +16 -5
  34. package/build/types/revamp/renderers/mappers/alertComponentToProps.d.ts +3 -0
  35. package/build/types/revamp/renderers/mappers/componentToRendererProps.d.ts +3 -0
  36. package/build/types/revamp/renderers/mappers/headingComponentToProps.d.ts +3 -0
  37. package/build/types/revamp/renderers/mappers/paragraphComponentToProps.d.ts +3 -0
  38. package/build/types/revamp/renderers/mappers/textInputComponentToProps.d.ts +3 -0
  39. package/build/types/revamp/renderers/types.d.ts +18 -2
  40. package/build/types/revamp/renderers/utils/mapping-utils.d.ts +3 -0
  41. package/build/types/revamp/{renderers/neptune → wise/renderers}/AlertRenderer.d.ts +1 -1
  42. package/build/types/revamp/{renderers/neptune → wise/renderers}/HeadingRenderer.d.ts +1 -1
  43. package/build/types/revamp/{renderers/neptune → wise/renderers}/ParagraphRenderer.d.ts +1 -1
  44. package/build/types/revamp/wise/renderers/TextInputRenderer.d.ts +3 -0
  45. package/build/types/revamp/{renderers/neptune → wise/renderers}/utils/layout-utils.d.ts +2 -2
  46. package/package.json +3 -2
  47. package/build/types/revamp/mappers/componentToProps/alertComponentToProps.d.ts +0 -3
  48. package/build/types/revamp/mappers/componentToProps/headingComponentToProps.d.ts +0 -3
  49. package/build/types/revamp/mappers/componentToProps/paragraphComponentToProps.d.ts +0 -3
  50. package/build/types/revamp/mappers/specToDomain/alertLayoutToDomain.d.ts +0 -2
  51. package/build/types/revamp/mappers/specToDomain/headingLayoutToDomain.d.ts +0 -2
  52. package/build/types/revamp/mappers/specToDomain/mapStepToDomain.d.ts +0 -4
  53. package/build/types/revamp/mappers/specToDomain/paragraphLayoutToDomain.d.ts +0 -2
  54. package/build/types/revamp/renderers/utils/renderComponent.d.ts +0 -7
@@ -1,6 +1,6 @@
1
1
  import { Align, Size } from '@wise/dynamic-flow-types';
2
2
  export { getNavigationOptionMedia } from './getNavigationOptionMedia';
3
- declare const getMargin: (size: Size | undefined) => "" | "m-t-0" | "m-t-1" | "m-t-2" | "m-t-3" | "m-t-5";
3
+ declare const getMargin: (size: Size | undefined) => "" | "m-b-0" | "m-b-1" | "m-b-2" | "m-b-3" | "m-b-5";
4
4
  declare const getTextAlignmentAndMargin: (component: {
5
5
  align?: Align;
6
6
  margin?: Size;
@@ -1,13 +1,11 @@
1
1
  import { Context, Margin } from '@wise/dynamic-flow-types';
2
- import { LayoutComponent } from './types';
2
+ import { LayoutComponent } from '../types';
3
3
  export type AlertComponent = LayoutComponent & {
4
4
  type: 'alert';
5
5
  markdown: string;
6
6
  context: Context;
7
- margin: Margin;
8
7
  };
9
8
  export declare const createAlertComponent: (alertProps: {
10
- uid: string;
11
9
  markdown: string;
12
10
  context: Context;
13
11
  margin: Margin;
@@ -1,14 +1,12 @@
1
1
  import { Align, Margin, Size } from '@wise/dynamic-flow-types';
2
- import { LayoutComponent } from './types';
2
+ import { LayoutComponent } from '../types';
3
3
  export type HeadingComponent = LayoutComponent & {
4
4
  type: 'heading';
5
5
  text: string;
6
6
  align: Align;
7
- margin: Margin;
8
7
  size: Size;
9
8
  };
10
9
  export declare const createHeadingComponent: (headingProps: {
11
- uid: string;
12
10
  text: string;
13
11
  align: Align;
14
12
  margin: Margin;
@@ -0,0 +1,9 @@
1
+ import { SchemaMapperProps } from '../mappers/schema/types';
2
+ import { StepComponent } from '../types';
3
+ export type ObjectComponent = {
4
+ type: 'object';
5
+ uid?: string;
6
+ propertyName?: string;
7
+ childComponents: StepComponent[];
8
+ };
9
+ export declare const createObjectComponent: (components: StepComponent[], mapperProps: SchemaMapperProps) => ObjectComponent;
@@ -1,16 +1,14 @@
1
1
  import { Align, Margin } from '@wise/dynamic-flow-types';
2
- import { LayoutComponent } from './types';
2
+ import { LayoutComponent } from '../types';
3
3
  export type ParagraphComponent = LayoutComponent & {
4
4
  type: 'paragraph';
5
5
  text: string;
6
6
  control?: 'copyable' | string;
7
- margin: Margin;
8
7
  align: Align;
9
8
  };
10
9
  export declare const createParagraphComponent: (paragraphProps: {
11
- uid: string;
12
10
  text: string;
13
- control?: 'copyable' | string;
11
+ control?: string | undefined;
14
12
  margin: Margin;
15
13
  align: Align;
16
14
  }) => ParagraphComponent;
@@ -1,4 +1,4 @@
1
- import { StepComponent } from './types';
1
+ import { StepComponent } from '../types';
2
2
  export type Step = {
3
3
  id: string;
4
4
  components: StepComponent[];
@@ -0,0 +1,27 @@
1
+ import { StringSchema } from '@wise/dynamic-flow-types';
2
+ import { InputComponent } from '../types';
3
+ type TextInputFormat = 'text' | 'date';
4
+ type TextInputControl = 'password' | 'textarea' | 'email' | 'numeric' | 'phone-number' | 'date-lookup' | string;
5
+ export type TextInputComponent = InputComponent & {
6
+ type: 'text';
7
+ title?: string;
8
+ description?: string;
9
+ placeholder?: string;
10
+ control?: TextInputControl;
11
+ format: TextInputFormat;
12
+ value: string | undefined;
13
+ onChange: (value: string | undefined) => void;
14
+ getValue: () => string | undefined;
15
+ };
16
+ export declare const createTextInputComponent: (textInputProps: {
17
+ uid: string;
18
+ id: string;
19
+ title?: string | undefined;
20
+ description?: string | undefined;
21
+ placeholder?: string | undefined;
22
+ control: StringSchema['control'];
23
+ format: StringSchema['format'];
24
+ value?: string | undefined;
25
+ propertyName: string;
26
+ }) => TextInputComponent;
27
+ export {};
@@ -0,0 +1,2 @@
1
+ import { AlertLayout } from '@wise/dynamic-flow-types';
2
+ export declare const alertLayoutToComponent: ({ markdown, margin, context }: AlertLayout) => import("../../components/AlertComponent").AlertComponent;
@@ -0,0 +1,3 @@
1
+ import { FormLayout, Step as DFStep } from '@wise/dynamic-flow-types';
2
+ import { StepComponent } from '../../types';
3
+ export declare const formLayoutToComponent: ({ schemaId }: FormLayout, uid: string, step: DFStep) => StepComponent;
@@ -0,0 +1,2 @@
1
+ import { HeadingLayout } from '@wise/dynamic-flow-types';
2
+ export declare const headingLayoutToComponent: ({ text, size, margin, align }: HeadingLayout) => import("../../components/HeadingComponent").HeadingComponent;
@@ -0,0 +1,2 @@
1
+ import { ParagraphLayout } from '@wise/dynamic-flow-types';
2
+ export declare const paragraphLayoutToComponent: ({ text, control, align, margin }: ParagraphLayout) => import("../../components/ParagraphComponent").ParagraphComponent;
@@ -0,0 +1,4 @@
1
+ import { Schema } from '@wise/dynamic-flow-types';
2
+ import { StepComponent } from '../types';
3
+ import { SchemaMapperProps } from './schema/types';
4
+ export declare const mapSchemaToComponents: (schema: Schema, mapperProps: SchemaMapperProps) => StepComponent;
@@ -0,0 +1,4 @@
1
+ import { Step as DFStep } from '@wise/dynamic-flow-types';
2
+ export declare const mapStepToComponents: ({ step }: {
3
+ step: DFStep;
4
+ }) => import("../components/Step").Step;
@@ -0,0 +1,3 @@
1
+ import { StringSchema } from '@wise/dynamic-flow-types';
2
+ import { SchemaMapperProps } from './types';
3
+ export declare const stringSchemaToComponent: (schema: StringSchema, mapperProps: SchemaMapperProps) => import("../../components/TextInputComponent").TextInputComponent;
@@ -0,0 +1,4 @@
1
+ export type SchemaMapperProps = {
2
+ uid: string;
3
+ propertyName?: string;
4
+ };
@@ -1,8 +1,19 @@
1
- import { AlertComponent } from './AlertComponent';
2
- import { HeadingComponent } from './HeadingComponent';
3
- import { ParagraphComponent } from './ParagraphComponent';
4
- export type StepComponent = AlertComponent | HeadingComponent | ParagraphComponent;
5
- export type LayoutComponent = {
1
+ import { Margin } from '@wise/dynamic-flow-types';
2
+ import { AlertComponent } from './components/AlertComponent';
3
+ import { HeadingComponent } from './components/HeadingComponent';
4
+ import { ObjectComponent } from './components/ObjectComponent';
5
+ import { ParagraphComponent } from './components/ParagraphComponent';
6
+ import { TextInputComponent } from './components/TextInputComponent';
7
+ export type StepComponent = AlertComponent | HeadingComponent | ParagraphComponent | ObjectComponent | TextInputComponent;
8
+ export type BaseComponent = {
6
9
  type: string;
10
+ keyProp: string;
11
+ };
12
+ export type LayoutComponent = BaseComponent & {
13
+ margin: Margin;
14
+ };
15
+ export type InputComponent = BaseComponent & {
7
16
  uid: string;
17
+ id: string;
18
+ propertyName: string;
8
19
  };
@@ -0,0 +1,3 @@
1
+ import { AlertComponent } from '../../domain/components/AlertComponent';
2
+ import { AlertRendererProps } from '../types';
3
+ export declare const alertComponentToProps: ({ keyProp, markdown, margin, context, }: AlertComponent) => AlertRendererProps;
@@ -0,0 +1,3 @@
1
+ import { StepComponent } from '../../domain/types';
2
+ import { RendererProps } from '../types';
3
+ export declare const componentToRendererProps: (component: StepComponent) => RendererProps[];
@@ -0,0 +1,3 @@
1
+ import { HeadingComponent } from '../../domain/components/HeadingComponent';
2
+ import { HeadingRendererProps } from '../types';
3
+ export declare const headingComponentToProps: ({ keyProp, text, align, margin, size, }: HeadingComponent) => HeadingRendererProps;
@@ -0,0 +1,3 @@
1
+ import { ParagraphComponent } from '../../domain/components/ParagraphComponent';
2
+ import { ParagraphRendererProps } from '../types';
3
+ export declare const paragraphComponentToProps: ({ keyProp, text, control, align, margin, }: ParagraphComponent) => ParagraphRendererProps;
@@ -0,0 +1,3 @@
1
+ import { TextInputComponent } from '../../domain/components/TextInputComponent';
2
+ import { TextInputRendererProps } from '../types';
3
+ export declare const textComponentToProps: ({ keyProp, format, id, title, description, placeholder, value, onChange, }: TextInputComponent) => TextInputRendererProps;
@@ -1,12 +1,16 @@
1
- import { Align, Context, Margin, Size } from '@wise/dynamic-flow-types';
1
+ import { Context as DFContext, Margin as DFMargin, Size as DFSize } from '@wise/dynamic-flow-types';
2
2
  import { ReactNode } from 'react';
3
3
  export type Renderer<P extends RendererProps> = {
4
4
  canRender: (props: RendererProps) => boolean;
5
5
  render: (props: P) => ReactNode;
6
6
  };
7
+ export type Align = 'start' | 'center' | 'end';
8
+ export type Margin = DFMargin;
9
+ export type Context = DFContext;
10
+ export type Size = DFSize;
7
11
  export interface RendererProps {
8
12
  type: string;
9
- id: string;
13
+ keyProp: string;
10
14
  }
11
15
  export interface AlertRendererProps extends RendererProps {
12
16
  type: 'alert';
@@ -29,3 +33,15 @@ export interface ParagraphRendererProps extends RendererProps {
29
33
  margin: Margin;
30
34
  align: Align;
31
35
  }
36
+ export interface TextInputRendererProps extends RendererProps {
37
+ type: 'input-text';
38
+ control?: 'password' | 'textarea' | 'email' | 'numeric' | 'phone-number' | 'date-lookup' | string;
39
+ format: 'text' | 'date';
40
+ id: string;
41
+ name: string;
42
+ label?: string;
43
+ description?: string;
44
+ placeholder?: string;
45
+ value?: string;
46
+ onChange: (value: string | undefined) => void;
47
+ }
@@ -0,0 +1,3 @@
1
+ import { Align as DFAlign } from '@wise/dynamic-flow-types';
2
+ import { Align } from '../types';
3
+ export declare const mapAlign: (align: DFAlign) => Align;
@@ -1,3 +1,3 @@
1
- import { AlertRendererProps, Renderer } from '../types';
1
+ import { AlertRendererProps, Renderer } from '../../renderers/types';
2
2
  declare const AlertRenderer: Renderer<AlertRendererProps>;
3
3
  export default AlertRenderer;
@@ -1,3 +1,3 @@
1
- import { HeadingRendererProps, Renderer } from '../types';
1
+ import { HeadingRendererProps, Renderer } from '../../renderers/types';
2
2
  declare const HeadingRenderer: Renderer<HeadingRendererProps>;
3
3
  export default HeadingRenderer;
@@ -1,3 +1,3 @@
1
- import { ParagraphRendererProps, Renderer } from '../types';
1
+ import { ParagraphRendererProps, Renderer } from '../../renderers/types';
2
2
  declare const ParagraphRenderer: Renderer<ParagraphRendererProps>;
3
3
  export default ParagraphRenderer;
@@ -0,0 +1,3 @@
1
+ import { Renderer, TextInputRendererProps } from '../../renderers/types';
2
+ declare const TextInputRenderer: Renderer<TextInputRendererProps>;
3
+ export default TextInputRenderer;
@@ -1,5 +1,5 @@
1
- import { Align, Size } from '@wise/dynamic-flow-types';
2
- declare const getTopMargin: (size: Size) => "" | "m-t-0" | "m-t-1" | "m-t-2" | "m-t-3" | "m-t-5";
1
+ import { Align, Size } from '../../../renderers/types';
2
+ declare const getTopMargin: (size: Size) => "" | "m-t-2" | "m-t-0" | "m-t-1" | "m-t-3" | "m-t-5";
3
3
  declare const getTextAlignmentAndTopMargin: (component: {
4
4
  align: Align;
5
5
  margin: Size;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -52,6 +52,7 @@
52
52
  "@types/testing-library__jest-dom": "5.14.9",
53
53
  "@wise/art": "2.8.4",
54
54
  "@wise/components-theming": "^0.8.4",
55
+ "@wise/forms": "0.2.2",
55
56
  "babel-jest": "29.7.0",
56
57
  "currency-flags": "4.0.7",
57
58
  "enzyme": "^3.11.0",
@@ -80,7 +81,7 @@
80
81
  "@wise/dynamic-flow-fixtures": "0.0.1"
81
82
  },
82
83
  "peerDependencies": {
83
- "@transferwise/components": "^43",
84
+ "@transferwise/components": "43 || 44 || 45",
84
85
  "@transferwise/formatting": "^2",
85
86
  "@transferwise/icons": "^3",
86
87
  "@transferwise/neptune-css": "^14",
@@ -1,3 +0,0 @@
1
- import { AlertComponent } from '../../domain/AlertComponent';
2
- import { AlertRendererProps } from '../../renderers/types';
3
- export declare const alertComponentToProps: ({ uid, markdown, margin, context, }: AlertComponent) => AlertRendererProps;
@@ -1,3 +0,0 @@
1
- import { HeadingComponent } from '../../domain/HeadingComponent';
2
- import { HeadingRendererProps } from '../../renderers/types';
3
- export declare const headingComponentToProps: ({ uid, text, align, margin, size, }: HeadingComponent) => HeadingRendererProps;
@@ -1,3 +0,0 @@
1
- import { ParagraphComponent } from '../../domain/ParagraphComponent';
2
- import { ParagraphRendererProps } from '../../renderers/types';
3
- export declare const paragraphComponentToProps: ({ uid, text, control, align, margin, }: ParagraphComponent) => ParagraphRendererProps;
@@ -1,2 +0,0 @@
1
- import { AlertLayout } from '@wise/dynamic-flow-types';
2
- export declare const alertLayoutToDomain: ({ markdown, margin, context }: AlertLayout, uid: string) => import("../../domain/AlertComponent").AlertComponent;
@@ -1,2 +0,0 @@
1
- import { HeadingLayout } from '@wise/dynamic-flow-types';
2
- export declare const headingLayoutToDomain: ({ text, size, margin, align }: HeadingLayout, uid: string) => import("../../domain/HeadingComponent").HeadingComponent;
@@ -1,4 +0,0 @@
1
- import { Step as DFStep } from '@wise/dynamic-flow-types';
2
- export declare const mapStepToDomain: ({ step }: {
3
- step: DFStep;
4
- }) => import("../../domain/Step").Step;
@@ -1,2 +0,0 @@
1
- import { ParagraphLayout } from '@wise/dynamic-flow-types';
2
- export declare const paragraphLayoutToDomain: ({ text, control, align, margin }: ParagraphLayout, uid: string) => import("../../domain/ParagraphComponent").ParagraphComponent;
@@ -1,7 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { StepComponent } from '../../domain/types';
3
- import { Renderer, RendererProps } from '../types';
4
- export declare const renderComponent: ({ component, renderers, }: {
5
- component: StepComponent;
6
- renderers: Renderer<RendererProps>[];
7
- }) => ReactNode | ReactNode[];