@wise/dynamic-flow-client 2.9.3 → 2.9.5

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 (95) hide show
  1. package/build/i18n/pt.json +1 -1
  2. package/build/i18n/th.json +3 -3
  3. package/build/main.css +2 -2
  4. package/build/main.js +20 -11
  5. package/build/main.min.js +1 -1
  6. package/build/types/legacy/formControl/utils/getAutocompleteString.d.ts +1 -1
  7. package/build/types/legacy/layout/modal/DynamicModal.d.ts +3 -3
  8. package/build/types/revamp/DynamicFlowCore.d.ts +2 -3
  9. package/build/types/revamp/DynamicFlowWise.d.ts +1 -1
  10. package/build/types/revamp/domain/components/AllOfComponent.d.ts +3 -2
  11. package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +8 -4
  12. package/build/types/revamp/domain/components/ConstComponent.d.ts +3 -2
  13. package/build/types/revamp/domain/components/ContainerComponent.d.ts +3 -3
  14. package/build/types/revamp/domain/components/DateInputComponent.d.ts +7 -3
  15. package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +7 -3
  16. package/build/types/revamp/domain/components/MultiUploadInputComponent.d.ts +21 -0
  17. package/build/types/revamp/domain/components/NumberInputComponent.d.ts +7 -3
  18. package/build/types/revamp/domain/components/ObjectComponent.d.ts +4 -9
  19. package/build/types/revamp/domain/components/SelectInputComponent.d.ts +10 -7
  20. package/build/types/revamp/domain/components/TextInputComponent.d.ts +7 -3
  21. package/build/types/revamp/domain/components/UploadInputComponent.d.ts +9 -4
  22. package/build/types/revamp/domain/components/repeatableComponent/RepeatableComponent.d.ts +9 -13
  23. package/build/types/revamp/domain/components/utils/file-utils.d.ts +1 -0
  24. package/build/types/revamp/domain/components/utils/isPartialLocalValueMatch.d.ts +2 -0
  25. package/build/types/revamp/domain/features/events/getAnalyticsEventDispatcher.d.ts +1 -1
  26. package/build/types/revamp/domain/features/persistAsync/getComponentPersistAsync.d.ts +7 -1
  27. package/build/types/revamp/domain/features/persistAsync/getPerformPersistAsync.d.ts +4 -4
  28. package/build/types/revamp/domain/features/persistAsync/persist-async-utils.d.ts +3 -2
  29. package/build/types/revamp/domain/features/refresh/getPerformRefresh.d.ts +5 -0
  30. package/build/types/revamp/domain/features/search/getPerformSearchFunction.d.ts +1 -1
  31. package/build/types/revamp/domain/features/summary/summary-utils.d.ts +2 -2
  32. package/build/types/revamp/domain/features/validation/spec-utils.d.ts +2 -0
  33. package/build/types/revamp/domain/features/validation/validation-functions.d.ts +3 -3
  34. package/build/types/revamp/domain/features/validation/value-checks.d.ts +9 -6
  35. package/build/types/revamp/domain/mappers/layout/alertLayoutToComponent.d.ts +1 -1
  36. package/build/types/revamp/domain/mappers/layout/boxLayoutToComponents.d.ts +1 -1
  37. package/build/types/revamp/domain/mappers/layout/buttonLayoutToComponent.d.ts +1 -1
  38. package/build/types/revamp/domain/mappers/layout/columnsLayoutToComponent.d.ts +1 -1
  39. package/build/types/revamp/domain/mappers/layout/decisionLayoutToComponent.d.ts +1 -1
  40. package/build/types/revamp/domain/mappers/layout/dividerLayoutToComponent.d.ts +1 -1
  41. package/build/types/revamp/domain/mappers/layout/formLayoutToComponent.d.ts +1 -1
  42. package/build/types/revamp/domain/mappers/layout/headingLayoutToComponent.d.ts +1 -1
  43. package/build/types/revamp/domain/mappers/layout/imageLayoutToComponent.d.ts +1 -1
  44. package/build/types/revamp/domain/mappers/layout/infoLayoutToComponent.d.ts +1 -1
  45. package/build/types/revamp/domain/mappers/layout/instructionsLayoutToComponent.d.ts +1 -1
  46. package/build/types/revamp/domain/mappers/layout/listLayoutToComponent.d.ts +1 -1
  47. package/build/types/revamp/domain/mappers/layout/loadingIndicatorLayoutToComponent.d.ts +1 -1
  48. package/build/types/revamp/domain/mappers/layout/markdownLayoutToComponent.d.ts +1 -1
  49. package/build/types/revamp/domain/mappers/layout/modalLayoutToComponent.d.ts +1 -1
  50. package/build/types/revamp/domain/mappers/layout/paragraphLayoutToComponent.d.ts +1 -1
  51. package/build/types/revamp/domain/mappers/layout/reviewLayoutToComponent.d.ts +1 -1
  52. package/build/types/revamp/domain/mappers/layout/searchLayoutToComponent.d.ts +1 -1
  53. package/build/types/revamp/domain/mappers/layout/statusListLayoutToComponent.d.ts +1 -1
  54. package/build/types/revamp/domain/mappers/mapLayoutToComponent.d.ts +1 -1
  55. package/build/types/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToComponent.d.ts +1 -1
  56. package/build/types/revamp/domain/mappers/schema/arraySchemaToComponent/arraySchemaToMultiUploadComponent.d.ts +9 -0
  57. package/build/types/revamp/domain/mappers/schema/blobSchemaToComponent.d.ts +5 -0
  58. package/build/types/revamp/domain/mappers/schema/booleanSchemaToComponent.d.ts +1 -1
  59. package/build/types/revamp/domain/mappers/schema/constSchemaToComponent.d.ts +1 -1
  60. package/build/types/revamp/domain/mappers/schema/integerSchemaToComponent.d.ts +1 -1
  61. package/build/types/revamp/domain/mappers/schema/numberSchemaToComponent.d.ts +1 -1
  62. package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +4 -0
  63. package/build/types/revamp/domain/mappers/schema/types.d.ts +6 -2
  64. package/build/types/revamp/domain/mappers/schema/utils/getPersistAsyncInitialState.d.ts +5 -0
  65. package/build/types/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.d.ts +3 -4
  66. package/build/types/revamp/domain/mappers/types.d.ts +2 -0
  67. package/build/types/revamp/domain/types.d.ts +27 -18
  68. package/build/types/revamp/flow/executeRefresh.d.ts +19 -0
  69. package/build/types/revamp/flow/executeSubmission.d.ts +20 -0
  70. package/build/types/revamp/flow/getResponseType.d.ts +10 -0
  71. package/build/types/revamp/flow/response-utils.d.ts +6 -0
  72. package/build/types/revamp/renderers/CoreContainerRenderer.d.ts +2 -2
  73. package/build/types/revamp/renderers/mappers/instructionsComponentToProps.d.ts +2 -7
  74. package/build/types/revamp/renderers/mappers/multiUploadInputComponentToProps.d.ts +3 -0
  75. package/build/types/revamp/renderers/mappers/repeatableComponentToProps.d.ts +1 -1
  76. package/build/types/revamp/renderers/mappers/utils/inputComponentToProps.d.ts +3 -3
  77. package/build/types/revamp/renderers/types.d.ts +113 -66
  78. package/build/types/revamp/step/Step.d.ts +11 -4
  79. package/build/types/revamp/step/utils/getRenderFunction.d.ts +2 -2
  80. package/build/types/revamp/test-utils/step-utils.d.ts +2 -0
  81. package/build/types/revamp/types.d.ts +41 -0
  82. package/build/types/revamp/utils/component-utils.d.ts +3 -2
  83. package/build/types/revamp/utils/findComponent.d.ts +1 -1
  84. package/build/types/revamp/utils/type-utils.d.ts +13 -2
  85. package/build/types/revamp/utils/type-validators.d.ts +1 -0
  86. package/build/types/revamp/wise/renderers/MultiUploadInputRenderer.d.ts +3 -0
  87. package/build/types/revamp/wise/renderers/components/LabelContentWithHelp.d.ts +4 -0
  88. package/build/types/revamp/wise/renderers/components/UploadFieldInput.d.ts +11 -0
  89. package/build/types/revamp/wise/renderers/getWiseRenderers.d.ts +1 -2
  90. package/build/types/revamp/wise/renderers/utils/file-utils.d.ts +3 -0
  91. package/build/types/revamp/wise/renderers/utils/getRandomId.d.ts +1 -0
  92. package/package.json +24 -25
  93. package/build/types/revamp/domain/components/utils/isModelPartialOf.d.ts +0 -2
  94. package/build/types/revamp/dynamic-flow-types.d.ts +0 -38
  95. /package/build/types/{legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/multipleFileUploadSchema/MultipleFileUploadSchema.messages.d.ts → common/messages/multi-file-upload.messages.d.ts} +0 -0
@@ -3,10 +3,7 @@ import type { ReactNode } from 'react';
3
3
  import type { DecisionOption as DomainDecisionOption } from '../domain/components/DecisionComponent';
4
4
  import type { InstructionItem as DomainInstructionItem } from '../domain/components/InstructionsComponent';
5
5
  import type { ReviewCallToAction as DomainReviewCallToAction, ReviewField as DomainReviewField } from '../domain/components/ReviewComponent';
6
- export type Renderer<P extends RendererProps> = {
7
- canRender: (props: RendererProps) => boolean;
8
- render: (props: P) => JSX.Element;
9
- };
6
+ import type { CoreContainerRendererProps } from './CoreContainerRenderer';
10
7
  export type Align = 'start' | 'center' | 'end';
11
8
  export type Bias = 'none' | 'start' | 'end';
12
9
  export type Context = 'positive' | 'negative' | 'warning' | 'neutral';
@@ -17,81 +14,96 @@ export type Image = {
17
14
  accessibilityDescription?: string;
18
15
  };
19
16
  export type Icon = DFIcon;
20
- export interface RendererProps {
21
- type: string;
22
- control?: string;
23
- }
24
- export interface AlertRendererProps extends RendererProps {
17
+ export type Renderer<P extends RendererProps> = {
18
+ canRenderType: P['type'];
19
+ canRender?: (props: P) => boolean;
20
+ render: (props: P) => JSX.Element;
21
+ };
22
+ export type RendererProps = CoreContainerRendererProps | AlertRendererProps | BoxRendererProps | ColumnsRendererProps | DecisionRendererProps | DividerRendererProps | FormRendererProps | HeadingRendererProps | InstructionsRendererProps | LoadingIndicatorRendererProps | MarkdownRendererProps | ImageRendererProps | ModalRendererProps | ParagraphRendererProps | ReviewRendererProps | SearchRendererProps | StatusListRendererProps | FormSectionRendererProps | BooleanInputRendererProps | ButtonRendererProps | DateInputRendererProps | HiddenRendererProps | IntegerInputRendererProps | NumberInputRendererProps | RepeatableRendererProps | SelectInputRendererProps | TextInputRendererProps | UploadInputRendererProps | MultiUploadInputRendererProps;
23
+ export type AlertRendererProps = {
25
24
  type: 'alert';
25
+ control?: string;
26
26
  context: Context;
27
27
  margin: Margin;
28
28
  markdown: string;
29
- }
30
- export interface BoxRendererProps extends RendererProps {
29
+ };
30
+ export type BoxRendererProps = {
31
31
  type: 'box';
32
+ control?: string;
32
33
  border: boolean;
33
34
  children: ReactNode;
34
35
  margin: Margin;
35
36
  width: Size;
36
- }
37
- export interface ColumnsRendererProps extends RendererProps {
37
+ };
38
+ export type ColumnsRendererProps = {
38
39
  type: 'columns';
40
+ control?: string;
39
41
  bias: Bias;
40
42
  margin: Margin;
41
43
  startChildren: ReactNode;
42
44
  endChildren: ReactNode;
43
- }
44
- export interface DecisionRendererProps extends RendererProps {
45
+ };
46
+ export type DecisionRendererProps = {
45
47
  type: 'decision';
48
+ control?: string;
46
49
  options: DecisionOption[];
47
50
  margin: Margin;
48
- }
51
+ };
49
52
  export type DecisionOption = DomainDecisionOption;
50
- export interface DividerRendererProps extends RendererProps {
53
+ export type DividerRendererProps = {
51
54
  type: 'divider';
55
+ control?: string;
52
56
  margin: Margin;
53
- }
54
- export interface FormRendererProps extends RendererProps {
57
+ };
58
+ export type FormRendererProps = {
55
59
  type: 'form';
60
+ control?: string;
56
61
  children: ReactNode;
57
62
  margin: Margin;
58
- }
63
+ };
59
64
  /**
60
65
  * Known values for "control" are: 'display'.
61
66
  */
62
- export interface HeadingRendererProps extends RendererProps {
67
+ export type HeadingRendererProps = {
63
68
  type: 'heading';
69
+ control?: string;
64
70
  align: Align;
65
71
  margin: Margin;
66
72
  size: Size;
67
73
  text: string;
68
- }
69
- export interface InstructionsRendererProps extends RendererProps {
74
+ };
75
+ export type InstructionsRendererProps = {
76
+ type: 'instructions';
77
+ control?: string;
70
78
  items: InstructionItem[];
71
79
  margin: Margin;
72
80
  title?: string;
73
- }
81
+ };
74
82
  export type InstructionItem = DomainInstructionItem;
75
- export interface LoadingIndicatorRendererProps extends RendererProps {
83
+ export type LoadingIndicatorRendererProps = {
76
84
  type: 'loading-indicator';
85
+ control?: string;
77
86
  margin: Margin;
78
87
  size: Size;
79
- }
80
- export interface MarkdownRendererProps extends RendererProps {
88
+ };
89
+ export type MarkdownRendererProps = {
81
90
  type: 'markdown';
91
+ control?: string;
82
92
  align: Align;
83
93
  margin: Margin;
84
94
  content: string;
85
- }
86
- export interface ImageRendererProps extends RendererProps {
95
+ };
96
+ export type ImageRendererProps = {
87
97
  type: 'image';
98
+ control?: string;
88
99
  accessibilityDescription?: string;
89
100
  size: Size;
90
101
  margin: Margin;
91
102
  url: string;
92
- }
93
- export interface ModalRendererProps extends RendererProps {
103
+ };
104
+ export type ModalRendererProps = {
94
105
  type: 'modal';
106
+ control?: string;
95
107
  content: {
96
108
  components: ReactNode;
97
109
  };
@@ -99,27 +111,30 @@ export interface ModalRendererProps extends RendererProps {
99
111
  trigger: {
100
112
  title: string;
101
113
  };
102
- }
114
+ };
103
115
  /**
104
116
  * Known values for "control" are: 'copyable'.
105
117
  */
106
- export interface ParagraphRendererProps extends RendererProps {
118
+ export type ParagraphRendererProps = {
107
119
  type: 'paragraph';
120
+ control?: string;
108
121
  align: Align;
109
122
  margin: Margin;
110
123
  text: string;
111
- }
112
- export interface ReviewRendererProps extends RendererProps {
124
+ };
125
+ export type ReviewRendererProps = {
113
126
  type: 'review';
127
+ control?: string;
114
128
  fields: ReviewField[];
115
129
  margin: Margin;
116
130
  title?: string;
117
131
  callToAction?: ReviewCallToAction;
118
- }
132
+ };
119
133
  export type ReviewCallToAction = DomainReviewCallToAction;
120
134
  export type ReviewField = DomainReviewField;
121
- export interface SearchRendererProps extends RendererProps {
135
+ export type SearchRendererProps = {
122
136
  type: 'search';
137
+ control?: string;
123
138
  id: string;
124
139
  emptyMessage?: string;
125
140
  isLoading: boolean;
@@ -128,7 +143,7 @@ export interface SearchRendererProps extends RendererProps {
128
143
  onChange: (query: string) => void;
129
144
  state: SearchState;
130
145
  title: string;
131
- }
146
+ };
132
147
  export type SearchState = PendingSearchState | NoResultsSearchState | ResultsSearchState | ErrorSearchState;
133
148
  export type PendingSearchState = {
134
149
  type: 'pending';
@@ -148,12 +163,13 @@ export type ResultsSearchState = {
148
163
  export type SearchResult = Pick<SearchResultSpec, 'description' | 'icon' | 'image' | 'title'> & {
149
164
  onClick: () => void;
150
165
  };
151
- export interface StatusListRendererProps extends RendererProps {
166
+ export type StatusListRendererProps = {
152
167
  type: 'status-list';
168
+ control?: string;
153
169
  items: StatusListItem[];
154
170
  margin: Margin;
155
171
  title?: string;
156
- }
172
+ };
157
173
  export type StatusListItem = {
158
174
  description?: string;
159
175
  icon: Icon;
@@ -161,15 +177,17 @@ export type StatusListItem = {
161
177
  title: string;
162
178
  };
163
179
  export type StatusListItemStatus = 'done' | 'not-done' | 'pending';
164
- export interface FormSectionRendererProps extends RendererProps {
180
+ export type FormSectionRendererProps = {
165
181
  type: 'form-section';
182
+ control?: string;
166
183
  title?: string;
167
184
  description?: string;
168
185
  help?: string;
169
186
  children: ReactNode;
170
- }
171
- interface BaseInputRendererProps<M extends string | number | boolean | null> extends RendererProps {
187
+ };
188
+ interface BaseInputRendererProps {
172
189
  id: string;
190
+ control?: string;
173
191
  autoComplete: string;
174
192
  description?: string;
175
193
  disabled: boolean;
@@ -178,20 +196,20 @@ interface BaseInputRendererProps<M extends string | number | boolean | null> ext
178
196
  label?: string;
179
197
  placeholder?: string;
180
198
  required: boolean;
181
- value: M | null;
182
- onChange: (value: M | null) => void;
183
199
  onBlur: () => void;
184
200
  onFocus: () => void;
185
201
  }
186
- export interface BooleanInputRendererProps extends BaseInputRendererProps<boolean> {
202
+ export interface BooleanInputRendererProps extends BaseInputRendererProps {
187
203
  type: 'input-boolean';
188
204
  value: boolean;
205
+ onChange: (value: boolean) => void;
189
206
  }
190
207
  /**
191
208
  * Known values for "control" are: 'primary' | 'secondary' | 'tertiary'.
192
209
  */
193
- export interface ButtonRendererProps extends RendererProps {
210
+ export type ButtonRendererProps = {
194
211
  type: 'button';
212
+ control?: string;
195
213
  context: Context;
196
214
  disabled: boolean;
197
215
  margin: Margin;
@@ -199,28 +217,37 @@ export interface ButtonRendererProps extends RendererProps {
199
217
  size?: Size;
200
218
  title: string;
201
219
  onClick: () => void;
202
- }
220
+ };
203
221
  /**
204
222
  * Known values for "control" are: 'date-lookup'.
205
223
  */
206
- export interface DateInputRendererProps extends BaseInputRendererProps<string> {
224
+ export type DateInputRendererProps = BaseInputRendererProps & {
207
225
  type: 'input-date';
208
226
  minimumDate?: string;
209
227
  maximumDate?: string;
210
- }
211
- export interface HiddenRendererProps extends RendererProps {
228
+ value: string | null;
229
+ onChange: (value: string | null) => void;
230
+ };
231
+ export type HiddenRendererProps = {
212
232
  type: 'hidden';
213
- }
214
- export interface IntegerInputRendererProps extends BaseInputRendererProps<number> {
233
+ control?: string;
234
+ };
235
+ export type IntegerInputRendererProps = BaseInputRendererProps & {
215
236
  type: 'input-integer';
216
- }
217
- export interface NumberInputRendererProps extends BaseInputRendererProps<number> {
237
+ value: number | null;
238
+ onChange: (value: number | null) => void;
239
+ };
240
+ export type NumberInputRendererProps = BaseInputRendererProps & {
218
241
  type: 'input-number';
219
- }
220
- export interface RepeatableRendererProps extends RendererProps {
242
+ value: number | null;
243
+ onChange: (value: number | null) => void;
244
+ };
245
+ export type RepeatableRendererProps = {
221
246
  type: 'repeatable';
247
+ control?: string;
222
248
  addItemTitle: string;
223
249
  description?: string;
250
+ children: ReactNode[];
224
251
  editableItem: ReactNode;
225
252
  editItemTitle: string;
226
253
  error?: string;
@@ -230,20 +257,21 @@ export interface RepeatableRendererProps extends RendererProps {
230
257
  onEdit: (itemIndex: number) => void;
231
258
  onSave: () => boolean;
232
259
  onRemove: () => void;
233
- }
234
- export interface RepeatableItemRendererProps {
260
+ };
261
+ export type RepeatableItemRendererProps = {
262
+ id: string;
235
263
  description?: string;
236
264
  icon?: Icon;
237
265
  image?: Image;
238
266
  title?: string;
239
- }
240
- export interface SelectInputRendererProps extends Omit<BaseInputRendererProps<null>, 'value' | 'onChange'> {
267
+ };
268
+ export type SelectInputRendererProps = BaseInputRendererProps & {
241
269
  type: 'input-select';
242
270
  children: ReactNode;
243
271
  options: SelectInputRendererOption[];
244
272
  selectedIndex: number | null;
245
273
  onSelect: (index: number | null) => void;
246
- }
274
+ };
247
275
  export type SelectInputRendererOption = {
248
276
  description?: string;
249
277
  disabled: boolean;
@@ -255,13 +283,32 @@ export type SelectInputRendererOption = {
255
283
  /**
256
284
  * Known values for "control" are: 'password' | 'textarea' | 'email' | 'numeric' | 'phone-number'.
257
285
  */
258
- export interface TextInputRendererProps extends BaseInputRendererProps<string> {
286
+ export type TextInputRendererProps = BaseInputRendererProps & {
259
287
  type: 'input-text';
260
288
  displayFormat?: string;
261
- }
262
- export interface UploadInputRendererProps extends BaseInputRendererProps<string> {
289
+ value: string | null;
290
+ onChange: (value: string | null) => void;
291
+ };
292
+ export type UploadInputRendererProps = BaseInputRendererProps & {
263
293
  type: 'input-upload';
264
294
  maxSize?: number;
265
295
  accepts?: string[];
266
- }
296
+ value: File | null;
297
+ onUpload: (file: File | null) => Promise<void>;
298
+ };
299
+ export type MultiUploadInputRendererProps = BaseInputRendererProps & {
300
+ type: 'input-upload-multi';
301
+ maxSize?: number;
302
+ minItems?: number;
303
+ maxItems?: number;
304
+ accepts?: string[];
305
+ uploadLabel?: string;
306
+ value: FileWithId[];
307
+ onUpload: (file: File, fileId: string) => Promise<void>;
308
+ onDelete: (fileId: string) => Promise<void>;
309
+ };
310
+ type FileWithId = {
311
+ id: string;
312
+ file: File;
313
+ };
267
314
  export {};
@@ -1,14 +1,21 @@
1
1
  import type { Action, Step as DFStep, Model } from '@wise/dynamic-flow-types/build/next';
2
- import type { StepComponent } from '../domain/types';
2
+ import type { LocalValue, StepComponent } from '../domain/types';
3
3
  import type { AnalyticsEventDispatcher, LoggingEventDispatcher } from '../domain/features/events';
4
- import type { HttpClient } from '../dynamic-flow-types';
4
+ import type { HttpClient } from '../types';
5
5
  type StepProps = {
6
+ localValue: LocalValue;
6
7
  step: DFStep;
7
8
  render: (component: StepComponent) => JSX.Element;
8
9
  httpClient: HttpClient;
9
10
  trackEvent: AnalyticsEventDispatcher;
10
11
  logEvent: LoggingEventDispatcher;
11
- onStepAction: (type: 'submit' | 'refresh', action: Action, model: Model) => Promise<void>;
12
+ triggerSubmission: (action: Action, model: Model) => Promise<void>;
13
+ triggerRefresh: (props: {
14
+ refreshUrl: string;
15
+ model: Model;
16
+ localValue: LocalValue;
17
+ schemaId: string | undefined;
18
+ }) => Promise<void>;
12
19
  };
13
- declare function Step({ step, render, httpClient, trackEvent, logEvent, onStepAction }: StepProps): JSX.Element;
20
+ declare function Step({ localValue, step, render, httpClient, trackEvent, logEvent, triggerSubmission, triggerRefresh, }: StepProps): JSX.Element;
14
21
  export default Step;
@@ -1,3 +1,3 @@
1
1
  import type { StepComponent } from '../../domain/types';
2
- import type { Renderer, RendererProps } from '../../renderers/types';
3
- export declare const getRenderFunction: (renderers: Renderer<RendererProps>[]) => (component: StepComponent) => JSX.Element;
2
+ import type { Renderers } from '../../types';
3
+ export declare const getRenderFunction: (renderers: Renderers) => (component: StepComponent) => JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { Step } from '@wise/dynamic-flow-types/build/next';
2
+ export declare const createEmptyStep: () => Step;
@@ -0,0 +1,41 @@
1
+ import type { Step, Model } from '@wise/dynamic-flow-types/build/next';
2
+ import type { AnalyticsEventHandler, LoggingEventHandler } from './domain/features/events';
3
+ import type { CoreContainerRendererProps } from './renderers/CoreContainerRenderer';
4
+ import type { Renderer, AlertRendererProps, BoxRendererProps, ColumnsRendererProps, DecisionRendererProps, DividerRendererProps, FormRendererProps, HeadingRendererProps, InstructionsRendererProps, LoadingIndicatorRendererProps, MarkdownRendererProps, ImageRendererProps, ModalRendererProps, ParagraphRendererProps, ReviewRendererProps, SearchRendererProps, StatusListRendererProps, FormSectionRendererProps, BooleanInputRendererProps, ButtonRendererProps, DateInputRendererProps, HiddenRendererProps, IntegerInputRendererProps, NumberInputRendererProps, RepeatableRendererProps, SelectInputRendererProps, TextInputRendererProps, UploadInputRendererProps, MultiUploadInputRendererProps } from './renderers/types';
5
+ export type DynamicFlowProps = DynamicFlowPropsWithInitialAction | DynamicFlowPropsWithInitialStep;
6
+ export type DynamicFlowPropsWithInitialAction = DynamicFlowPropsBasic & {
7
+ initialAction: InitialAction;
8
+ initialStep?: never;
9
+ };
10
+ export type DynamicFlowPropsWithInitialStep = DynamicFlowPropsBasic & {
11
+ initialAction?: never;
12
+ initialStep: Step;
13
+ };
14
+ export type InitialAction = {
15
+ $id?: string;
16
+ url: string;
17
+ method?: 'GET';
18
+ data?: never;
19
+ } | {
20
+ $id?: string;
21
+ url: string;
22
+ method: 'POST';
23
+ data: Model;
24
+ };
25
+ type DynamicFlowPropsBasic = {
26
+ flowId: string;
27
+ displayStepTitle?: boolean;
28
+ features?: Feature[];
29
+ httpClient: HttpClient;
30
+ onCompletion: (result: Model) => void;
31
+ onError: (error: unknown, status?: number) => void;
32
+ onEvent?: AnalyticsEventHandler;
33
+ onLog?: LoggingEventHandler;
34
+ };
35
+ export type HttpClient = typeof fetch;
36
+ type Feature = {
37
+ featureName: string;
38
+ variant: number | null;
39
+ };
40
+ export type Renderers = (Renderer<CoreContainerRendererProps> | Renderer<AlertRendererProps> | Renderer<BoxRendererProps> | Renderer<ColumnsRendererProps> | Renderer<DecisionRendererProps> | Renderer<DividerRendererProps> | Renderer<FormRendererProps> | Renderer<HeadingRendererProps> | Renderer<InstructionsRendererProps> | Renderer<LoadingIndicatorRendererProps> | Renderer<MarkdownRendererProps> | Renderer<ImageRendererProps> | Renderer<ModalRendererProps> | Renderer<ParagraphRendererProps> | Renderer<ReviewRendererProps> | Renderer<SearchRendererProps> | Renderer<StatusListRendererProps> | Renderer<FormSectionRendererProps> | Renderer<BooleanInputRendererProps> | Renderer<ButtonRendererProps> | Renderer<DateInputRendererProps> | Renderer<HiddenRendererProps> | Renderer<IntegerInputRendererProps> | Renderer<NumberInputRendererProps> | Renderer<RepeatableRendererProps> | Renderer<SelectInputRendererProps> | Renderer<TextInputRendererProps> | Renderer<UploadInputRendererProps> | Renderer<MultiUploadInputRendererProps>)[];
41
+ export {};
@@ -1,5 +1,6 @@
1
1
  import type { Model } from '@wise/dynamic-flow-types/build/next';
2
- import type { StepComponent } from '../domain/types';
2
+ import type { LocalValue, StepComponent } from '../domain/types';
3
3
  export declare const getSubmittableData: (components: StepComponent[]) => Promise<Model>;
4
- export declare const getLocalValues: (components: StepComponent[]) => Model;
4
+ export declare const getLocalValues: (components: StepComponent[]) => LocalValue;
5
+ export declare const mergeLocalValues: (valueA: LocalValue, valueB: LocalValue) => LocalValue;
5
6
  export declare const mergeModels: (valueA: Model, valueB: Model) => Model;
@@ -1,2 +1,2 @@
1
1
  import type { StepComponent } from '../domain/types';
2
- export declare const findComponent: (components: StepComponent[], id: string) => StepComponent | undefined;
2
+ export declare const findComponent: (components: StepComponent[], id: string) => StepComponent;
@@ -1,11 +1,19 @@
1
- import type { AllOfSchema, ArraySchema, ArraySchemaList, ArraySchemaTuple, BooleanSchema, ConstSchema, IntegerSchema, Model, NumberSchema, ObjectSchema, OneOfSchema, Schema, StringSchema } from '@wise/dynamic-flow-types/build/next';
2
- import type { StepComponent } from '../domain/types';
1
+ import type { AllOfSchema, ArraySchema, ArraySchemaList, ArraySchemaTuple, BooleanSchema, ConstSchema, IntegerSchema, Model, NumberSchema, ObjectSchema, OneOfSchema, Schema, StringSchema, BlobSchema } from '@wise/dynamic-flow-types/build/next';
2
+ import type { LocalValue, LocalValueObject, StepComponent } from '../domain/types';
3
3
  import type { ColumnsComponent } from '../domain/components/ColumnsComponent';
4
4
  import type { RepeatableComponent } from '../domain/components/repeatableComponent/RepeatableComponent';
5
5
  import type { PersistAsync } from '@wise/dynamic-flow-types/build/next/feature/PersistAsync';
6
6
  type SchemaWithPersistAsync = (ArraySchemaList | ArraySchemaTuple | BooleanSchema | IntegerSchema | NumberSchema | StringSchema) & {
7
7
  persistAsync: PersistAsync;
8
8
  };
9
+ export type StringSchemaWithUpload = StringSchema & {
10
+ format: 'base64url';
11
+ };
12
+ export type PersistAsyncWithUploadSchema = Schema & {
13
+ persistAsync: PersistAsync & {
14
+ schema: BlobSchema | StringSchemaWithUpload;
15
+ };
16
+ };
9
17
  export declare const hasChildren: (component: StepComponent) => component is StepComponent & {
10
18
  getChildren: () => StepComponent[];
11
19
  };
@@ -14,10 +22,12 @@ export declare const isHiddenComponent: (component: StepComponent) => component
14
22
  hidden: true;
15
23
  };
16
24
  export declare const isRepeatableComponent: (component: StepComponent) => component is RepeatableComponent;
25
+ export declare const isObjectLocalValue: (value: LocalValue) => value is LocalValueObject;
17
26
  export declare const isObjectModel: (model: Model) => model is Record<string, import("@wise/dynamic-flow-types/build/next").JsonElement>;
18
27
  export declare const isArrayModel: (model: Model) => model is import("@wise/dynamic-flow-types/build/next").JsonElement[];
19
28
  export declare const isAllOfSchema: (schema: Schema) => schema is AllOfSchema;
20
29
  export declare const isBooleanSchema: (schema: Schema) => schema is BooleanSchema;
30
+ export declare const isBlobSchema: (schema: Schema) => schema is BlobSchema;
21
31
  export declare const isConstSchema: (schema: Schema) => schema is ConstSchema;
22
32
  export declare const isIntegerSchema: (schema: Schema) => schema is IntegerSchema;
23
33
  export declare const isNumberSchema: (schema: Schema) => schema is NumberSchema;
@@ -26,5 +36,6 @@ export declare const isOneOfSchema: (schema: Schema) => schema is OneOfSchema;
26
36
  export declare const isArraySchema: (schema: Schema) => schema is ArraySchema;
27
37
  export declare const isArrayListSchema: (schema: Schema) => schema is ArraySchemaList;
28
38
  export declare const isStringSchema: (schema: Schema) => schema is StringSchema;
39
+ export declare const isStringSchemaWithUpload: (schema: Schema) => schema is StringSchemaWithUpload;
29
40
  export declare const isSchemaWithPersistAsync: (schema: Schema) => schema is SchemaWithPersistAsync;
30
41
  export {};
@@ -7,3 +7,4 @@ export declare const isArray: (value: unknown) => value is unknown[];
7
7
  export declare const isNull: (value: unknown) => value is null;
8
8
  export declare const isUndefined: (value: unknown) => value is undefined;
9
9
  export declare const isNullish: (v: unknown) => v is null | undefined;
10
+ export declare const isFile: (value: unknown) => value is File;
@@ -0,0 +1,3 @@
1
+ import type { MultiUploadInputRendererProps, Renderer } from '../../renderers/types';
2
+ declare const MultiUploadInputRenderer: Renderer<MultiUploadInputRendererProps>;
3
+ export default MultiUploadInputRenderer;
@@ -0,0 +1,4 @@
1
+ export declare function LabelContentWithHelp({ text, help }: {
2
+ text: string;
3
+ help: string;
4
+ }): JSX.Element;
@@ -0,0 +1,11 @@
1
+ import type { ReactNode } from 'react';
2
+ type UploadFieldInputProps = {
3
+ id?: string;
4
+ children: ReactNode;
5
+ description?: string;
6
+ error?: string;
7
+ help?: string;
8
+ label?: string;
9
+ };
10
+ declare function UploadFieldInput({ id, children, label, description, error, help, }: UploadFieldInputProps): JSX.Element;
11
+ export default UploadFieldInput;
@@ -1,2 +1 @@
1
- import type { Renderer, RendererProps } from '../../renderers/types';
2
- export declare const getWiseRenderers: () => Renderer<RendererProps>[];
1
+ export declare const getWiseRenderers: () => (import("../../renderers/types").Renderer<import("../../renderers/types").AlertRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").BoxRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").ColumnsRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").DecisionRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").DividerRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").FormRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").HeadingRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").InstructionsRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").LoadingIndicatorRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").MarkdownRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").ImageRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").ModalRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").ParagraphRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").ReviewRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").SearchRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").StatusListRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").FormSectionRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").BooleanInputRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").ButtonRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").DateInputRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").IntegerInputRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").NumberInputRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").RepeatableRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").SelectInputRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").TextInputRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").UploadInputRendererProps> | import("../../renderers/types").Renderer<import("../../renderers/types").MultiUploadInputRendererProps>)[];
@@ -0,0 +1,3 @@
1
+ export declare const getAcceptsString: (accepts?: string[]) => string;
2
+ export declare const toKilobytes: (sizeInBytes: number) => number;
3
+ export declare const toFile: (base64Url: string, name: string) => Promise<File>;
@@ -0,0 +1 @@
1
+ export declare const getRandomId: () => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-client",
3
- "version": "2.9.3",
3
+ "version": "2.9.5",
4
4
  "description": "Dynamic Flow web client",
5
5
  "license": "Apache-2.0",
6
6
  "main": "./build/main.min.js",
@@ -26,57 +26,56 @@
26
26
  "@babel/preset-typescript": "7.23.3",
27
27
  "@cfaester/enzyme-adapter-react-18": "0.7.1",
28
28
  "@formatjs/cli": "^6.2.7",
29
- "@storybook/addon-a11y": "7.6.10",
30
- "@storybook/addon-actions": "7.6.10",
31
- "@storybook/addon-essentials": "7.6.10",
32
- "@storybook/addon-interactions": "7.6.10",
33
- "@storybook/addon-links": "7.6.10",
34
- "@storybook/react": "7.6.10",
35
- "@storybook/react-webpack5": "7.6.10",
29
+ "@storybook/addon-a11y": "7.6.17",
30
+ "@storybook/addon-actions": "7.6.17",
31
+ "@storybook/addon-essentials": "7.6.17",
32
+ "@storybook/addon-interactions": "7.6.17",
33
+ "@storybook/addon-links": "7.6.17",
34
+ "@storybook/react": "7.6.17",
35
+ "@storybook/react-webpack5": "7.6.17",
36
36
  "@storybook/testing-library": "0.2.2",
37
37
  "@testing-library/dom": "9.3.4",
38
- "@testing-library/jest-dom": "6.3.0",
39
- "@testing-library/react": "14.1.2",
38
+ "@testing-library/jest-dom": "6.4.2",
39
+ "@testing-library/react": "14.2.1",
40
40
  "@testing-library/react-hooks": "8.0.1",
41
41
  "@testing-library/user-event": "14.5.2",
42
42
  "@transferwise/components": "46.1.0",
43
- "@transferwise/formatting": "^2.11.1",
43
+ "@transferwise/formatting": "^2.13.0",
44
44
  "@transferwise/icons": "3.13.0",
45
45
  "@transferwise/neptune-css": "14.8.0",
46
46
  "@transferwise/neptune-tokens": "8.7.0",
47
47
  "@types/enzyme": "^3.10.18",
48
- "@types/jest": "29.5.11",
48
+ "@types/jest": "29.5.12",
49
49
  "@types/react": "18",
50
50
  "@types/react-dom": "18",
51
51
  "@types/react-intl": "3.0.0",
52
52
  "@types/testing-library__jest-dom": "5.14.9",
53
- "@wise/art": "2.9.1",
53
+ "@wise/art": "2.9.2",
54
54
  "@wise/components-theming": "^0.8.4",
55
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",
59
- "esbuild": "0.20.0",
60
- "immer": "10.0.3",
59
+ "esbuild": "0.20.1",
61
60
  "jest": "29.7.0",
62
61
  "jest-environment-jsdom": "29.7.0",
63
62
  "jest-fetch-mock": "^3.0.3",
64
63
  "jest-watch-typeahead": "^2.2.2",
65
- "nanoid": "5.0.4",
66
- "npm-run-all": "4.1.5",
67
- "postcss": "^8.4.33",
64
+ "nanoid": "5.0.6",
65
+ "npm-run-all2": "5.0.2",
66
+ "postcss": "^8.4.35",
68
67
  "postcss-cli": "^10.1.0",
69
68
  "postcss-import": "^15.1.0",
70
69
  "react": "18.2.0",
71
70
  "react-dom": "18.2.0",
72
71
  "react-intl": "6.6.2",
73
- "storybook": "7.6.10",
74
- "stylelint": "14.16.1",
75
- "stylelint-config-standard": "25.0.0",
72
+ "storybook": "7.6.17",
73
+ "stylelint": "16.2.1",
74
+ "stylelint-config-standard": "36.0.0",
76
75
  "stylelint-no-unsupported-browser-features": "5.0.4",
77
- "stylelint-value-no-unknown-custom-properties": "4.0.0",
76
+ "stylelint-value-no-unknown-custom-properties": "6.0.1",
78
77
  "typescript": "4.9.5",
79
- "webpack": "5.90.0",
78
+ "webpack": "5.90.3",
80
79
  "@wise/dynamic-flow-fixtures": "0.0.1"
81
80
  },
82
81
  "peerDependencies": {
@@ -92,7 +91,7 @@
92
91
  "classnames": "2.5.1",
93
92
  "react-webcam": "^7.2.0",
94
93
  "screenfull": "^5.2.0",
95
- "@wise/dynamic-flow-types": "2.6.5"
94
+ "@wise/dynamic-flow-types": "2.6.7"
96
95
  },
97
96
  "scripts": {
98
97
  "dev": "storybook dev -p 3003",
@@ -111,6 +110,6 @@
111
110
  "lint": "npm-run-all lint:ts lint:css",
112
111
  "lint:ts": "eslint 'src/**/*.{js,jsx,ts,tsx}' --quiet",
113
112
  "lint:css": "stylelint './src/**/*.css'",
114
- "build-storybook": "storybook build -c .storybook"
113
+ "build-storybook": "storybook build -c .storybook --disable-telemetry"
115
114
  }
116
115
  }
@@ -1,2 +0,0 @@
1
- import type { Model } from '@wise/dynamic-flow-types/build/next';
2
- export declare const isModelPartialOf: (partialModel: Model, model: Model) => boolean;