@wise/dynamic-flow-client 2.8.9 → 2.8.11

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 (89) hide show
  1. package/build/main.js +118 -132
  2. package/build/main.min.js +1 -1
  3. package/build/types/common/messages/validation.array.messages.d.ts +13 -0
  4. package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.d.ts +3 -3
  5. package/build/types/legacy/layout/button/DynamicButton.d.ts +3 -3
  6. package/build/types/legacy/layout/icon/DynamicIcon.d.ts +1 -1
  7. package/build/types/legacy/layout/icon/FlagIcon.d.ts +1 -1
  8. package/build/types/legacy/layout/icon/NamedIcon.d.ts +1 -1
  9. package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +9 -0
  10. package/build/types/revamp/domain/components/DateInputComponent.d.ts +4 -3
  11. package/build/types/revamp/domain/components/HiddenComponent.d.ts +4 -6
  12. package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +4 -3
  13. package/build/types/revamp/domain/components/NumberInputComponent.d.ts +4 -3
  14. package/build/types/revamp/domain/components/ObjectComponent.d.ts +8 -9
  15. package/build/types/revamp/domain/components/SelectInputComponent.d.ts +30 -0
  16. package/build/types/revamp/domain/components/TextInputComponent.d.ts +4 -3
  17. package/build/types/revamp/domain/components/UploadInputComponent.d.ts +4 -3
  18. package/build/types/revamp/domain/components/repeatableComponent/RepeatableComponent.d.ts +31 -0
  19. package/build/types/revamp/domain/components/searchComponent/SearchComponent.d.ts +25 -0
  20. package/build/types/revamp/domain/components/utils/debounce.d.ts +6 -0
  21. package/build/types/revamp/domain/components/utils/isModelPartialOf.d.ts +2 -0
  22. package/build/types/revamp/domain/{events → features/events}/getAnalyticsEventDispatcher.d.ts +1 -1
  23. package/build/types/revamp/domain/features/search/getPerformSearchFunction.d.ts +3 -0
  24. package/build/types/revamp/domain/features/summary/summary-utils.d.ts +32 -0
  25. package/build/types/revamp/domain/{validation → features/validation}/spec-utils.d.ts +2 -0
  26. package/build/types/revamp/domain/{validation → features/validation}/validateComponents.d.ts +1 -1
  27. package/build/types/revamp/domain/{validation → features/validation}/value-checks.d.ts +4 -2
  28. package/build/types/revamp/domain/mappers/layout/alertLayoutToComponent.d.ts +1 -1
  29. package/build/types/revamp/domain/mappers/layout/boxLayoutToComponents.d.ts +1 -1
  30. package/build/types/revamp/domain/mappers/layout/buttonLayoutToComponent.d.ts +1 -1
  31. package/build/types/revamp/domain/mappers/layout/columnsLayoutToComponent.d.ts +1 -1
  32. package/build/types/revamp/domain/mappers/layout/formLayoutToComponent.d.ts +1 -1
  33. package/build/types/revamp/domain/mappers/layout/headingLayoutToComponent.d.ts +1 -1
  34. package/build/types/revamp/domain/mappers/layout/paragraphLayoutToComponent.d.ts +1 -1
  35. package/build/types/revamp/domain/mappers/layout/searchLayoutToComponent.d.ts +3 -0
  36. package/build/types/revamp/domain/mappers/mapLayoutToComponent.d.ts +1 -1
  37. package/build/types/revamp/domain/mappers/mapSchemaToComponent.d.ts +1 -1
  38. package/build/types/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToComponent.d.ts +5 -0
  39. package/build/types/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToRepeatableComponent.d.ts +6 -0
  40. package/build/types/revamp/domain/mappers/schema/booleanSchemaToComponent.d.ts +5 -0
  41. package/build/types/revamp/domain/mappers/schema/constSchemaToComponent.d.ts +1 -1
  42. package/build/types/revamp/domain/mappers/schema/integerSchemaToComponent.d.ts +1 -1
  43. package/build/types/revamp/domain/mappers/schema/numberSchemaToComponent.d.ts +1 -1
  44. package/build/types/revamp/domain/mappers/schema/objectSchemaToComponent/objectSchemaToComponent.d.ts +1 -1
  45. package/build/types/revamp/domain/mappers/schema/oneOfSchemaToComponent/oneOfSchemaToComponent.d.ts +5 -0
  46. package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToComponent.d.ts +1 -1
  47. package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToDateInputComponent.d.ts +1 -1
  48. package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToTextInputComponent.d.ts +1 -1
  49. package/build/types/revamp/domain/mappers/schema/stringSchemaToComponent/stringSchemaToUploadInputComponent.d.ts +1 -1
  50. package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +4 -2
  51. package/build/types/revamp/domain/mappers/schema/types.d.ts +3 -1
  52. package/build/types/revamp/domain/mappers/types.d.ts +2 -0
  53. package/build/types/revamp/domain/mappers/utils/getRandomId.d.ts +1 -0
  54. package/build/types/revamp/domain/types.d.ts +20 -8
  55. package/build/types/revamp/domain/validation/validation-functions.d.ts +8 -0
  56. package/build/types/revamp/dynamic-flow-types.d.ts +1 -1
  57. package/build/types/revamp/renderers/mappers/booleanInputComponentToProps.d.ts +3 -0
  58. package/build/types/revamp/renderers/mappers/componentToRendererProps.d.ts +4 -3
  59. package/build/types/revamp/renderers/mappers/objectComponentToProps.d.ts +1 -1
  60. package/build/types/revamp/renderers/mappers/repeatableComponentToProps.d.ts +4 -0
  61. package/build/types/revamp/renderers/mappers/searchComponentToProps.d.ts +3 -0
  62. package/build/types/revamp/renderers/mappers/selectInputComponentToProps.d.ts +4 -0
  63. package/build/types/revamp/renderers/mappers/utils/inputComponentToProps.d.ts +19 -0
  64. package/build/types/revamp/renderers/types.d.ts +109 -30
  65. package/build/types/revamp/step/Step.d.ts +4 -2
  66. package/build/types/revamp/stories/utils/mockSearchHandler.d.ts +1 -0
  67. package/build/types/revamp/stories/visual-tests/array.d.ts +3 -0
  68. package/build/types/revamp/test-utils/component-utils.d.ts +2 -0
  69. package/build/types/revamp/utils/type-utils.d.ts +11 -5
  70. package/build/types/revamp/wise/renderers/BooleanInputRenderer.d.ts +3 -0
  71. package/build/types/revamp/wise/renderers/RepeatableRenderer.d.ts +3 -0
  72. package/build/types/revamp/wise/renderers/SearchRenderer.d.ts +14 -0
  73. package/build/types/revamp/wise/renderers/SelectInputRenderer/OptionMedia.d.ts +5 -0
  74. package/build/types/revamp/wise/renderers/SelectInputRenderer/RadioInputRendererComponent.d.ts +2 -0
  75. package/build/types/revamp/wise/renderers/SelectInputRenderer/SelectInputRenderer.d.ts +3 -0
  76. package/build/types/revamp/wise/renderers/SelectInputRenderer/SelectInputRendererComponent.d.ts +2 -0
  77. package/build/types/revamp/wise/renderers/SelectInputRenderer/SelectTriggerMedia.d.ts +5 -0
  78. package/build/types/revamp/wise/renderers/SelectInputRenderer/TabInputRendererComponent.d.ts +2 -0
  79. package/build/types/revamp/wise/renderers/components/FieldInput.d.ts +2 -1
  80. package/build/types/revamp/wise/renderers/components/icon/DynamicIcon.d.ts +6 -0
  81. package/build/types/revamp/wise/renderers/components/icon/FlagIcon.d.ts +6 -0
  82. package/build/types/revamp/wise/renderers/components/icon/NamedIcon.d.ts +6 -0
  83. package/build/types/revamp/wise/renderers/components/icon/NavigationOptionMedia.d.ts +5 -0
  84. package/build/types/test-utils/fetch-utils.d.ts +19 -0
  85. package/package.json +7 -6
  86. /package/build/types/{legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.messages.d.ts → common/messages/repeatable.messages.d.ts} +0 -0
  87. /package/build/types/revamp/domain/{events → features/events}/getLogggingEventDispatcher.d.ts +0 -0
  88. /package/build/types/revamp/domain/{events → features/events}/index.d.ts +0 -0
  89. /package/build/types/revamp/domain/{validation → features/validation}/getModelValidationErrors.d.ts +0 -0
@@ -1,26 +1,32 @@
1
- import type { Action, Margin, Model } from '@wise/dynamic-flow-types/build/next';
1
+ import type { Action, Icon, Image, Margin, Model } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { HiddenComponent } from './components/HiddenComponent';
3
3
  import type { AlertComponent } from './components/AlertComponent';
4
+ import type { BooleanInputComponent } from './components/BooleanInputComponent';
4
5
  import type { BoxComponent } from './components/BoxComponent';
5
6
  import type { ButtonComponent } from './components/ButtonComponent';
7
+ import type { ColumnsComponent } from './components/ColumnsComponent';
8
+ import type { ContainerComponent } from './components/ContainerComponent';
6
9
  import type { HeadingComponent } from './components/HeadingComponent';
10
+ import type { IntegerInputComponent } from './components/IntegerInputComponent';
11
+ import type { NumberInputComponent } from './components/NumberInputComponent';
7
12
  import type { ObjectComponent } from './components/ObjectComponent';
8
13
  import type { ParagraphComponent } from './components/ParagraphComponent';
14
+ import type { SelectInputComponent } from './components/SelectInputComponent';
9
15
  import type { TextInputComponent } from './components/TextInputComponent';
10
- import type { ColumnsComponent } from './components/ColumnsComponent';
11
- import type { NumberInputComponent } from './components/NumberInputComponent';
12
- import type { IntegerInputComponent } from './components/IntegerInputComponent';
13
16
  import type { DateInputComponent } from './components/DateInputComponent';
14
17
  import type { UploadInputComponent } from './components/UploadInputComponent';
15
- import type { ContainerComponent } from './components/ContainerComponent';
16
18
  import type { FormComponent } from './components/FormComponent';
17
- export type StepComponent = AlertComponent | BoxComponent | ButtonComponent | ColumnsComponent | ContainerComponent | DateInputComponent | FormComponent | HeadingComponent | HiddenComponent | IntegerInputComponent | NumberInputComponent | ObjectComponent | ParagraphComponent | TextInputComponent | UploadInputComponent;
18
- export type HasChildren = BoxComponent | ColumnsComponent | ContainerComponent | FormComponent | ObjectComponent;
19
+ import type { SearchComponent } from './components/searchComponent/SearchComponent';
20
+ import type { RepeatableComponent } from './components/repeatableComponent/RepeatableComponent';
21
+ export type StepComponent = AlertComponent | BooleanInputComponent | BoxComponent | ButtonComponent | ColumnsComponent | ContainerComponent | DateInputComponent | FormComponent | HeadingComponent | HiddenComponent | IntegerInputComponent | NumberInputComponent | ObjectComponent | ParagraphComponent | RepeatableComponent | SearchComponent | SelectInputComponent | TextInputComponent | UploadInputComponent;
22
+ export type HasChildren = BoxComponent | ColumnsComponent | ContainerComponent | FormComponent | RepeatableComponent | SelectInputComponent | ObjectComponent;
19
23
  export type BaseComponent<M extends Model> = {
20
24
  type: string;
21
25
  uid: string;
22
- validate: () => boolean;
26
+ analyticsId?: string;
23
27
  getValue: () => M | null;
28
+ getSummary: () => RepeatableSummary;
29
+ validate: () => boolean;
24
30
  };
25
31
  export type LayoutComponent = BaseComponent<Model> & {
26
32
  control?: string;
@@ -48,3 +54,9 @@ export type OnAction = (action: Action) => void;
48
54
  export type Align = 'start' | 'center' | 'end';
49
55
  export type Bias = 'none' | 'start' | 'end';
50
56
  export type Context = 'positive' | 'negative' | 'warning' | 'neutral';
57
+ export type RepeatableSummary = {
58
+ title?: string;
59
+ description?: string;
60
+ icon?: Icon;
61
+ image?: Image;
62
+ };
@@ -0,0 +1,8 @@
1
+ import type { Model } from '@wise/dynamic-flow-types/build/next';
2
+ import type { StepComponent } from '../types';
3
+ import type { IsInvalidCheck } from '../features/validation/value-checks';
4
+ export declare const validateComponents: (components: StepComponent[]) => boolean;
5
+ export declare const getModelValidationErrors: <M extends Model>({ checks, model, }: {
6
+ checks: IsInvalidCheck<M>[];
7
+ model: M;
8
+ }) => string[];
@@ -1,5 +1,5 @@
1
1
  import type { Step, Model } from '@wise/dynamic-flow-types/build/next';
2
- import type { AnalyticsEventHandler, LoggingEventHandler } from './domain/events';
2
+ import type { AnalyticsEventHandler, LoggingEventHandler } from './domain/features/events';
3
3
  export type DynamicFlowProps = DynamicFlowPropsWithInitialAction | DynamicFlowPropsWithInitialStep;
4
4
  export type DynamicFlowPropsWithInitialAction = DynamicFlowPropsBasic & {
5
5
  initialAction: InitialAction;
@@ -0,0 +1,3 @@
1
+ import type { BooleanInputComponent } from '../../domain/components/BooleanInputComponent';
2
+ import type { BooleanInputRendererProps } from '../types';
3
+ export declare const booleanInputComponentToProps: (component: BooleanInputComponent) => BooleanInputRendererProps;
@@ -2,7 +2,8 @@ import type { ReactNode } from 'react';
2
2
  import type { StepComponent } from '../../domain/types';
3
3
  import type { RendererProps } from '../types';
4
4
  export declare const componentToRendererProps: (component: StepComponent, nestedContent: {
5
- children?: ReactNode;
6
- startChildren?: ReactNode;
7
- endChildren?: ReactNode;
5
+ children?: ReactNode[] | undefined;
6
+ startChildren?: ReactNode[] | undefined;
7
+ endChildren?: ReactNode[] | undefined;
8
+ editableItemChildren?: ReactNode;
8
9
  }) => RendererProps;
@@ -1,4 +1,4 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { ObjectComponent } from '../../domain/components/ObjectComponent';
3
3
  import type { ObjectRendererProps } from '../types';
4
- export declare const objectComponentToProps: ({ title, description, help }: ObjectComponent, children: ReactNode) => ObjectRendererProps;
4
+ export declare const objectComponentToProps: ({ control, description, help, title }: ObjectComponent, children: ReactNode) => ObjectRendererProps;
@@ -0,0 +1,4 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { RepeatableRendererProps } from '../types';
3
+ import type { RepeatableComponent } from '../../domain/components/repeatableComponent/RepeatableComponent';
4
+ export declare const repeatableComponentToProps: (component: RepeatableComponent, editableItemChildren: ReactNode) => RepeatableRendererProps;
@@ -0,0 +1,3 @@
1
+ import type { SearchComponent } from '../../domain/components/searchComponent/SearchComponent';
2
+ import type { SearchRendererProps } from '../types';
3
+ export declare const searchComponentToProps: (component: SearchComponent) => SearchRendererProps;
@@ -0,0 +1,4 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { SelectInputComponent } from '../../domain/components/SelectInputComponent';
3
+ import type { SelectInputRendererProps } from '../types';
4
+ export declare const selectInputComponentToProps: (component: SelectInputComponent, children: ReactNode[]) => SelectInputRendererProps;
@@ -0,0 +1,19 @@
1
+ import type { Model } from '@wise/dynamic-flow-types/build/next';
2
+ import type { InputComponent } from '../../../domain/types';
3
+ export declare const inputComponentToProps: <T extends string, M extends Model>(component: Omit<InputComponent<M>, "onChange">, type: T) => {
4
+ type: T;
5
+ autoComplete: string;
6
+ control: string | undefined;
7
+ description: string | undefined;
8
+ disabled: boolean;
9
+ error: string;
10
+ help: string | undefined;
11
+ id: string;
12
+ label: string | undefined;
13
+ name: string;
14
+ placeholder: string | undefined;
15
+ required: boolean;
16
+ value: M | null;
17
+ onBlur: () => void;
18
+ onFocus: () => void;
19
+ };
@@ -1,4 +1,4 @@
1
- import type { Margin as DFMargin, Size as DFSize } from '@wise/dynamic-flow-types/build/next';
1
+ import type { Margin as DFMargin, Size as DFSize, SearchResult as SearchResultSpec, Icon as DFIcon } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { ReactNode } from 'react';
3
3
  export type Renderer<P extends RendererProps> = {
4
4
  canRender: (props: RendererProps) => boolean;
@@ -9,13 +9,18 @@ export type Bias = 'none' | 'start' | 'end';
9
9
  export type Context = 'positive' | 'negative' | 'warning' | 'neutral';
10
10
  export type Margin = DFMargin;
11
11
  export type Size = DFSize;
12
+ export type Image = {
13
+ url: string;
14
+ accessibilityDescription?: string;
15
+ };
16
+ export type Icon = DFIcon;
12
17
  export interface RendererProps {
13
18
  type: string;
19
+ control?: string;
14
20
  }
15
21
  export interface AlertRendererProps extends RendererProps {
16
22
  type: 'alert';
17
23
  context: Context;
18
- control?: string;
19
24
  margin: Margin;
20
25
  markdown: string;
21
26
  }
@@ -23,13 +28,11 @@ export interface BoxRendererProps extends RendererProps {
23
28
  type: 'box';
24
29
  border: boolean;
25
30
  children: ReactNode;
26
- control?: string;
27
31
  margin: Margin;
28
32
  width: Size;
29
33
  }
30
34
  export interface ColumnsRendererProps extends RendererProps {
31
35
  type: 'columns';
32
- control?: string;
33
36
  bias: Bias;
34
37
  margin: Margin;
35
38
  startChildren: ReactNode;
@@ -38,24 +41,57 @@ export interface ColumnsRendererProps extends RendererProps {
38
41
  export interface FormRendererProps extends RendererProps {
39
42
  type: 'form';
40
43
  children: ReactNode;
41
- control?: string;
42
44
  margin: Margin;
43
45
  }
46
+ /**
47
+ * Known values for "control" are: 'display'.
48
+ */
44
49
  export interface HeadingRendererProps extends RendererProps {
45
50
  type: 'heading';
46
51
  text: string;
47
- control?: string;
48
52
  align: Align;
49
53
  margin: Margin;
50
54
  size: Size;
51
55
  }
56
+ /**
57
+ * Known values for "control" are: 'copyable'.
58
+ */
52
59
  export interface ParagraphRendererProps extends RendererProps {
53
60
  type: 'paragraph';
54
61
  align: Align;
55
- control?: string;
56
62
  margin: Margin;
57
63
  text: string;
58
64
  }
65
+ export interface SearchRendererProps extends RendererProps {
66
+ type: 'search';
67
+ control?: string;
68
+ emptyMessage?: string;
69
+ isLoading: boolean;
70
+ margin: Margin;
71
+ query: string;
72
+ onChange: (query: string) => void;
73
+ state: SearchState;
74
+ title: string;
75
+ }
76
+ export type SearchState = PendingSearchState | NoResultsSearchState | ResultsSearchState | ErrorSearchState;
77
+ export type PendingSearchState = {
78
+ type: 'pending';
79
+ };
80
+ export type NoResultsSearchState = {
81
+ type: 'noResults';
82
+ message: string;
83
+ };
84
+ export type ErrorSearchState = {
85
+ type: 'error';
86
+ onRetry: () => void;
87
+ };
88
+ export type ResultsSearchState = {
89
+ type: 'results';
90
+ results: SearchResult[];
91
+ };
92
+ export type SearchResult = Pick<SearchResultSpec, 'description' | 'icon' | 'image' | 'title'> & {
93
+ onClick: () => void;
94
+ };
59
95
  export interface ObjectRendererProps extends RendererProps {
60
96
  type: 'object';
61
97
  title?: string;
@@ -63,14 +99,12 @@ export interface ObjectRendererProps extends RendererProps {
63
99
  help?: string;
64
100
  children: ReactNode;
65
101
  }
66
- interface BaseInputRendererProps<M extends string | number> extends RendererProps {
102
+ interface BaseInputRendererProps<M extends string | number | boolean | null> extends RendererProps {
67
103
  id: string;
68
104
  autoComplete: string;
69
- control?: string;
70
105
  description?: string;
71
106
  disabled: boolean;
72
107
  error?: string;
73
- format?: 'date';
74
108
  help?: string;
75
109
  label?: string;
76
110
  name: string;
@@ -81,39 +115,84 @@ interface BaseInputRendererProps<M extends string | number> extends RendererProp
81
115
  onBlur: () => void;
82
116
  onFocus: () => void;
83
117
  }
84
- export interface TextInputRendererProps extends BaseInputRendererProps<string> {
85
- type: 'input-text';
86
- control?: string;
87
- displayFormat?: string;
118
+ export interface BooleanInputRendererProps extends BaseInputRendererProps<boolean> {
119
+ type: 'input-boolean';
120
+ value: boolean;
88
121
  }
122
+ /**
123
+ * Known values for "control" are: 'primary' | 'secondary' | 'tertiary'.
124
+ */
125
+ export interface ButtonRendererProps extends RendererProps {
126
+ type: 'button';
127
+ context: Context;
128
+ disabled: boolean;
129
+ margin: Margin;
130
+ pinOrder?: number;
131
+ size?: Size;
132
+ title: string;
133
+ onClick: () => void;
134
+ }
135
+ /**
136
+ * Known values for "control" are: 'date-lookup'.
137
+ */
89
138
  export interface DateInputRendererProps extends BaseInputRendererProps<string> {
90
139
  type: 'input-date';
91
- control?: string;
92
140
  minimumDate?: string;
93
141
  maximumDate?: string;
94
142
  }
95
- export interface NumberInputRendererProps extends BaseInputRendererProps<number> {
96
- type: 'input-number';
143
+ export interface HiddenRendererProps extends RendererProps {
144
+ type: 'hidden';
97
145
  }
98
146
  export interface IntegerInputRendererProps extends BaseInputRendererProps<number> {
99
147
  type: 'input-integer';
100
148
  }
101
- export interface UploadInputRendererProps extends BaseInputRendererProps<string> {
102
- type: 'input-upload';
103
- accepts?: string[];
149
+ export interface NumberInputRendererProps extends BaseInputRendererProps<number> {
150
+ type: 'input-number';
104
151
  }
105
- export interface ButtonRendererProps extends RendererProps {
106
- type: 'button';
107
- context: Context;
108
- control?: string;
152
+ export interface RepeatableRendererProps extends RendererProps {
153
+ type: 'repeatable';
154
+ addItemTitle: string;
155
+ description?: string;
156
+ editableItem: ReactNode;
157
+ editItemTitle: string;
158
+ error?: string;
159
+ items: RepeatableItemRendererProps[];
160
+ title: string;
161
+ onAdd: () => void;
162
+ onEdit: (itemIndex: number) => void;
163
+ onSave: () => boolean;
164
+ onRemove: () => void;
165
+ }
166
+ export interface RepeatableItemRendererProps {
167
+ description?: string;
168
+ icon?: Icon;
169
+ image?: Image;
170
+ title?: string;
171
+ }
172
+ export interface SelectInputRendererProps extends Omit<BaseInputRendererProps<null>, 'value' | 'onChange'> {
173
+ type: 'input-select';
174
+ children: ReactNode;
175
+ options: SelectInputRendererOption[];
176
+ selectedIndex: number | null;
177
+ onSelect: (index: number | null) => void;
178
+ }
179
+ export type SelectInputRendererOption = {
180
+ description?: string;
109
181
  disabled: boolean;
110
- margin: Margin;
111
- pinOrder?: number;
112
- size?: Size;
182
+ icon?: Icon;
183
+ image?: Image;
184
+ keywords?: string[];
113
185
  title: string;
114
- onClick: () => void;
186
+ };
187
+ /**
188
+ * Known values for "control" are: 'password' | 'textarea' | 'email' | 'numeric' | 'phone-number'.
189
+ */
190
+ export interface TextInputRendererProps extends BaseInputRendererProps<string> {
191
+ type: 'input-text';
192
+ displayFormat?: string;
115
193
  }
116
- export interface HiddenRendererProps extends RendererProps {
117
- type: 'hidden';
194
+ export interface UploadInputRendererProps extends BaseInputRendererProps<string> {
195
+ type: 'input-upload';
196
+ accepts?: string[];
118
197
  }
119
198
  export {};
@@ -1,11 +1,13 @@
1
1
  import type { Step as DFStep } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { Renderer, RendererProps } from '../renderers/types';
3
- import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../domain/events';
3
+ import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../domain/features/events';
4
+ import type { HttpClient } from '../dynamic-flow-types';
4
5
  type StepProps = {
5
6
  step: DFStep;
6
7
  renderers: Renderer<RendererProps>[];
8
+ httpClient: HttpClient;
7
9
  trackEvent: AnalyticsEventDispatcher;
8
10
  logEvent: LoggingEventDispatcher;
9
11
  };
10
- declare function Step({ step, renderers, trackEvent, logEvent }: StepProps): JSX.Element;
12
+ declare function Step({ step, renderers, httpClient, trackEvent, logEvent }: StepProps): JSX.Element;
11
13
  export default Step;
@@ -0,0 +1 @@
1
+ export declare const mockSearchHandler: typeof fetch;
@@ -0,0 +1,3 @@
1
+ import type { Step } from '@wise/dynamic-flow-types/build/next';
2
+ declare const step: Step;
3
+ export default step;
@@ -0,0 +1,2 @@
1
+ import { createTextInputComponent } from '../domain/components/TextInputComponent';
2
+ export declare const createMockTextInputComponent: (props?: Partial<Parameters<typeof createTextInputComponent>[0]>) => import("../domain/components/TextInputComponent").TextInputComponent;
@@ -1,13 +1,19 @@
1
- import type { AllOfSchema, ConstSchema, IntegerSchema, Model, NumberSchema, ObjectSchema, OneOfSchema, Schema, StringSchema } from '@wise/dynamic-flow-types/build/next';
1
+ import type { AllOfSchema, ArrayModel, ArraySchema, ArraySchemaList, BooleanSchema, ConstSchema, IntegerSchema, Model, NumberSchema, ObjectSchema, OneOfSchema, Schema, StringSchema } from '@wise/dynamic-flow-types/build/next';
2
2
  import type { HasChildren, StepComponent } from '../domain/types';
3
3
  import type { ColumnsComponent } from '../domain/components/ColumnsComponent';
4
+ import type { RepeatableComponent } from '../domain/components/repeatableComponent/RepeatableComponent';
4
5
  export declare const hasChildren: (component: StepComponent) => component is HasChildren;
5
6
  export declare const isColumnsComponent: (component: StepComponent) => component is ColumnsComponent;
7
+ export declare const isRepeatableComponent: (component: StepComponent) => component is RepeatableComponent;
6
8
  export declare const isObjectModel: (model: Model) => model is Record<string, Model>;
9
+ export declare const isArrayModel: (model: Model) => model is ArrayModel;
7
10
  export declare const isAllOfSchema: (schema: Schema) => schema is AllOfSchema;
8
- export declare const isOneOfSchema: (schema: Schema) => schema is OneOfSchema;
11
+ export declare const isBooleanSchema: (schema: Schema) => schema is BooleanSchema;
12
+ export declare const isConstSchema: (schema: Schema) => schema is ConstSchema;
13
+ export declare const isIntegerSchema: (schema: Schema) => schema is IntegerSchema;
14
+ export declare const isNumberSchema: (schema: Schema) => schema is NumberSchema;
9
15
  export declare const isObjectSchema: (schema: Schema) => schema is ObjectSchema;
16
+ export declare const isOneOfSchema: (schema: Schema) => schema is OneOfSchema;
17
+ export declare const isArraySchema: (schema: Schema) => schema is ArraySchema;
18
+ export declare const isArrayListSchema: (schema: Schema) => schema is ArraySchemaList;
10
19
  export declare const isStringSchema: (schema: Schema) => schema is StringSchema;
11
- export declare const isNumberSchema: (schema: Schema) => schema is NumberSchema;
12
- export declare const isIntegerSchema: (schema: Schema) => schema is IntegerSchema;
13
- export declare const isConstSchema: (schema: Schema) => schema is ConstSchema;
@@ -0,0 +1,3 @@
1
+ import type { Renderer, BooleanInputRendererProps } from '../../renderers/types';
2
+ declare const BooleanInputRenderer: Renderer<BooleanInputRendererProps>;
3
+ export default BooleanInputRenderer;
@@ -0,0 +1,3 @@
1
+ import type { Renderer, RepeatableRendererProps } from '../../renderers/types';
2
+ declare const RepeatableRenderer: Renderer<RepeatableRendererProps>;
3
+ export default RepeatableRenderer;
@@ -0,0 +1,14 @@
1
+ import type { ErrorSearchState, Renderer, ResultsSearchState, SearchRendererProps } from '../../renderers/types';
2
+ declare const SearchRenderer: Renderer<SearchRendererProps>;
3
+ export declare function SearchInput({ query, onChange, }: {
4
+ query: string;
5
+ onChange: (query: string) => void;
6
+ }): JSX.Element;
7
+ export declare function ErrorResult({ state }: {
8
+ state: ErrorSearchState;
9
+ }): JSX.Element;
10
+ export declare function SearchResults({ state, }: {
11
+ state: ResultsSearchState;
12
+ onChange: (query: string) => void;
13
+ }): JSX.Element;
14
+ export default SearchRenderer;
@@ -0,0 +1,5 @@
1
+ import type { Icon, Image } from '../../../renderers/types';
2
+ export declare function OptionMedia({ icon, image }: {
3
+ icon?: Icon;
4
+ image?: Image;
5
+ }): JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ import type { SelectInputRendererProps } from '../../../renderers/types';
2
+ export declare function RadioInputRendererComponent(props: SelectInputRendererProps): JSX.Element;
@@ -0,0 +1,3 @@
1
+ import type { Renderer, SelectInputRendererProps } from '../../../renderers/types';
2
+ declare const SelectInputRenderer: Renderer<SelectInputRendererProps>;
3
+ export default SelectInputRenderer;
@@ -0,0 +1,2 @@
1
+ import type { SelectInputRendererProps } from '../../../renderers/types';
2
+ export declare function SelectInputRendererComponent(props: SelectInputRendererProps): JSX.Element;
@@ -0,0 +1,5 @@
1
+ import type { Icon, Image } from '../../../renderers/types';
2
+ export declare function SelectTriggerMedia({ icon, image }: {
3
+ icon?: Icon;
4
+ image?: Image;
5
+ }): JSX.Element | null;
@@ -0,0 +1,2 @@
1
+ import type { SelectInputRendererProps } from '../../../renderers/types';
2
+ export declare function TabInputRendererComponent(props: SelectInputRendererProps): JSX.Element;
@@ -1,10 +1,11 @@
1
1
  import type { ReactNode } from 'react';
2
2
  type FieldInputProps = {
3
+ id?: string;
3
4
  children: ReactNode;
4
5
  description: string | undefined;
5
6
  error: string | undefined;
6
7
  help: string | undefined;
7
8
  label: string | undefined;
8
9
  };
9
- declare function FieldInput({ children, label, error, description, help }: FieldInputProps): JSX.Element;
10
+ declare function FieldInput({ id, children, label, error, description, help }: FieldInputProps): JSX.Element;
10
11
  export default FieldInput;
@@ -0,0 +1,6 @@
1
+ export type Props = {
2
+ name: string;
3
+ };
4
+ declare function DynamicIcon({ name }: Props): JSX.Element | null;
5
+ export declare function isValidIconName(name: string): boolean;
6
+ export default DynamicIcon;
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ name: string;
3
+ };
4
+ export declare const isFlagIcon: (name: string) => boolean;
5
+ export declare function FlagIcon({ name }: Props): JSX.Element | null;
6
+ export {};
@@ -0,0 +1,6 @@
1
+ type Props = {
2
+ name: string;
3
+ };
4
+ export declare const isNamedIcon: (name: string) => boolean;
5
+ export declare function NamedIcon({ name }: Props): JSX.Element | null;
6
+ export {};
@@ -0,0 +1,5 @@
1
+ import type { Icon, Image } from '../../../../renderers/types';
2
+ export declare function NavigationOptionMedia({ icon, image }: {
3
+ icon?: Icon;
4
+ image?: Image;
5
+ }): JSX.Element | null;
@@ -0,0 +1,19 @@
1
+ import type { ActionResponseBody, Step } from '@wise/dynamic-flow-types';
2
+ type HttpClient = typeof fetch;
3
+ /**
4
+ * Returns a mock http client you can use in your DynamicFlow.
5
+ *
6
+ * @param handlers Map of flow URL to http clients
7
+ * @returns An http client that will handle real URLs and URLs in the handlers map
8
+ * @example getMockHttpClient({
9
+ * '/form': () => respondWith(formStep),
10
+ * '/recipient': () => respondWith(recipientStep),
11
+ * })
12
+ */
13
+ export declare const getMockHttpClient: (handlers: Record<string, HttpClient | undefined>) => HttpClient;
14
+ export declare const respondWith: (step: Step | ActionResponseBody | Record<string, unknown>, init?: ResponseInit) => Promise<Response>;
15
+ export declare const respondWithEtag: (step: Step) => Promise<Response>;
16
+ export declare const respondWithEmptyOk: () => Promise<Response>;
17
+ export declare const respondWithEmptyAndEtag: (step: Step) => Promise<Response>;
18
+ export declare const abortableDelay: (delayMs: number, signal: AbortSignal | null | undefined) => Promise<unknown>;
19
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "2.8.9",
3
+ "version": "2.8.11",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -39,10 +39,10 @@
39
39
  "@testing-library/react": "14.1.2",
40
40
  "@testing-library/react-hooks": "8.0.1",
41
41
  "@testing-library/user-event": "14.5.2",
42
- "@transferwise/components": "45.21.3",
42
+ "@transferwise/components": "46.1.0",
43
43
  "@transferwise/formatting": "^2.10.0",
44
44
  "@transferwise/icons": "3.13.0",
45
- "@transferwise/neptune-css": "14.7.0",
45
+ "@transferwise/neptune-css": "14.8.0",
46
46
  "@transferwise/neptune-tokens": "8.7.0",
47
47
  "@types/enzyme": "^3.10.18",
48
48
  "@types/jest": "29.5.11",
@@ -52,7 +52,7 @@
52
52
  "@types/testing-library__jest-dom": "5.14.9",
53
53
  "@wise/art": "2.8.5",
54
54
  "@wise/components-theming": "^0.8.4",
55
- "@wise/forms": "0.3.0",
55
+ "@wise/forms": "0.3.1",
56
56
  "babel-jest": "29.7.0",
57
57
  "currency-flags": "4.0.7",
58
58
  "enzyme": "^3.11.0",
@@ -62,6 +62,7 @@
62
62
  "jest-environment-jsdom": "29.7.0",
63
63
  "jest-fetch-mock": "^3.0.3",
64
64
  "jest-watch-typeahead": "^2.2.2",
65
+ "nanoid": "5.0.4",
65
66
  "npm-run-all": "4.1.5",
66
67
  "postcss": "^8.4.33",
67
68
  "postcss-cli": "^10.1.0",
@@ -79,7 +80,7 @@
79
80
  "@wise/dynamic-flow-fixtures": "0.0.1"
80
81
  },
81
82
  "peerDependencies": {
82
- "@transferwise/components": "43 || 44 || 45",
83
+ "@transferwise/components": "43 || 44 || 45 || 46",
83
84
  "@transferwise/formatting": "^2",
84
85
  "@transferwise/icons": "^3",
85
86
  "@transferwise/neptune-css": "^14",
@@ -91,7 +92,7 @@
91
92
  "classnames": "2.5.1",
92
93
  "react-webcam": "^7.2.0",
93
94
  "screenfull": "^5.2.0",
94
- "@wise/dynamic-flow-types": "2.5.0"
95
+ "@wise/dynamic-flow-types": "2.5.2"
95
96
  },
96
97
  "scripts": {
97
98
  "dev": "storybook dev -p 3003",