@wise/dynamic-flow-types 2.30.0 → 2.31.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 CHANGED
@@ -35,13 +35,13 @@ var __copyProps = (to, from, except, desc) => {
35
35
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
36
 
37
37
  // src/index.ts
38
- var src_exports = {};
39
- __export(src_exports, {
38
+ var index_exports = {};
39
+ __export(index_exports, {
40
40
  validateActionResponse: () => validateActionResponse,
41
41
  validateErrorResponse: () => validateErrorResponse,
42
42
  validateStep: () => validateStep
43
43
  });
44
- module.exports = __toCommonJS(src_exports);
44
+ module.exports = __toCommonJS(index_exports);
45
45
 
46
46
  // ../../node_modules/.pnpm/zod@3.24.1/node_modules/zod/lib/index.mjs
47
47
  var util;
@@ -18,6 +18,7 @@ export type BoxLayout = {
18
18
  width?: Size;
19
19
  /**
20
20
  * If true, a border is displayed around the box. Defaults to false.
21
+ * @deprecated Please use `bordered` or 'bordered-web' in `control` instead.
21
22
  */
22
23
  border?: boolean;
23
24
  /**
@@ -114,10 +114,12 @@ export type StringSchema = {
114
114
  disabled?: boolean;
115
115
  /**
116
116
  * An icon which the client can use to represent this schema.
117
+ * Icons can be shown inside text input fields.
117
118
  */
118
119
  icon?: Icon;
119
120
  /**
120
121
  * An image which the client can use to represent this schema.
122
+ * Images can be shown inside text input fields.
121
123
  */
122
124
  image?: Image;
123
125
  /**
@@ -5,5 +5,9 @@ export type ImageRendererProps = {
5
5
  accessibilityDescription?: string;
6
6
  size: Size;
7
7
  margin: Margin;
8
+ /**
9
+ * The `uri` property, if present should take precedence.
10
+ */
8
11
  url: string;
12
+ uri?: string;
9
13
  };
@@ -5,21 +5,21 @@ import type {
5
5
  Step,
6
6
  Schema,
7
7
  Layout,
8
- AllOfSchema,
8
+ ModalLayoutContent,
9
+ ModalLayout,
10
+ BoxLayout,
11
+ ColumnsLayout,
9
12
  ArraySchema,
10
- BooleanSchema,
11
- IntegerSchema,
12
- NumberSchema,
13
- ObjectSchema,
13
+ ArraySchemaList,
14
+ ArraySchemaTuple,
14
15
  OneOfSchema,
15
16
  StringSchema,
16
17
  PersistAsync,
17
- ArraySchemaList,
18
- ArraySchemaTuple,
19
- ModalLayout,
20
- ModalLayoutContent,
21
- ColumnsLayout,
22
- BoxLayout,
18
+ NumberSchema,
19
+ AllOfSchema,
20
+ ObjectSchema,
21
+ BooleanSchema,
22
+ IntegerSchema,
23
23
  } from '../next';
24
24
 
25
25
  export const jsonElementSchema: z.ZodSchema<JsonElement> = z.lazy(() =>
@@ -51,51 +51,33 @@ export const httpMethodSchema = z.union([
51
51
  z.literal('DELETE'),
52
52
  ]);
53
53
 
54
- export const errorResponseBodySchema = z.object({
55
- refreshFormUrl: z.string().optional(),
56
- analytics: z.record(z.string()).optional(),
57
- error: z.string().optional(),
58
- validation: jsonElementSchema.optional(),
59
- refreshUrl: z.string().optional(),
54
+ export const iconNamedSchema = z.object({
55
+ name: z.string(),
60
56
  });
61
57
 
62
- export const stringSchemaFormatSchema = z.union([
63
- z.literal('date'),
64
- z.literal('email'),
65
- z.literal('numeric'),
66
- z.literal('password'),
67
- z.literal('phone-number'),
68
- z.literal('base64url'),
58
+ export const sizeSchema = z.union([
59
+ z.literal('xs'),
60
+ z.literal('sm'),
61
+ z.literal('md'),
62
+ z.literal('lg'),
63
+ z.literal('xl'),
69
64
  ]);
70
65
 
71
- export const autocapitalizationTypeSchema = z.union([
72
- z.literal('none'),
73
- z.literal('characters'),
74
- z.literal('sentences'),
75
- z.literal('words'),
66
+ export const contextSchema = z.union([
67
+ z.literal('positive'),
68
+ z.literal('neutral'),
69
+ z.literal('warning'),
70
+ z.literal('negative'),
71
+ z.literal('success'),
72
+ z.literal('failure'),
73
+ z.literal('info'),
74
+ z.literal('primary'),
76
75
  ]);
77
76
 
78
- export const imageSchema = z.object({
79
- text: z.string().optional(),
80
- url: z.string(),
81
- accessibilityDescription: z.string().optional(),
82
- });
83
-
84
- export const summaryProviderSchema = z.object({
85
- providesTitle: z.boolean().optional(),
86
- providesDescription: z.boolean().optional(),
87
- providesIcon: z.boolean().optional(),
88
- providesImage: z.boolean().optional(),
89
- });
90
-
91
- export const validateAsyncSchema = z.object({
92
- param: z.string(),
93
- method: httpMethodSchema,
94
- url: z.string(),
77
+ export const iconTextSchema = z.object({
78
+ text: z.string(),
95
79
  });
96
80
 
97
- export const uploadSourceSchema = z.union([z.literal('camera'), z.literal('file')]);
98
-
99
81
  export const autocompleteTokenSchema = z.union([
100
82
  z.literal('on'),
101
83
  z.literal('name'),
@@ -162,59 +144,29 @@ export const autocompleteTokenSchema = z.union([
162
144
  z.literal('pager'),
163
145
  ]);
164
146
 
165
- export const helpSchema = z.object({
166
- markdown: z.string(),
167
- });
168
-
169
- export const iconNamedSchema = z.object({
170
- name: z.string(),
171
- });
172
-
173
- export const iconTextSchema = z.object({
174
- text: z.string(),
175
- });
147
+ export const iconSchema = z.union([iconNamedSchema, iconTextSchema]);
176
148
 
177
- export const contextSchema = z.union([
178
- z.literal('positive'),
179
- z.literal('neutral'),
180
- z.literal('warning'),
181
- z.literal('negative'),
182
- z.literal('success'),
183
- z.literal('failure'),
184
- z.literal('info'),
185
- z.literal('primary'),
149
+ export const autocapitalizationTypeSchema = z.union([
150
+ z.literal('none'),
151
+ z.literal('characters'),
152
+ z.literal('sentences'),
153
+ z.literal('words'),
186
154
  ]);
187
155
 
188
156
  export const alignSchema = z.union([z.literal('left'), z.literal('center'), z.literal('right')]);
189
157
 
190
- export const sizeSchema = z.union([
191
- z.literal('xs'),
192
- z.literal('sm'),
193
- z.literal('md'),
194
- z.literal('lg'),
195
- z.literal('xl'),
196
- ]);
197
-
198
- export const listLayoutStatusSchema = z.union([
199
- z.literal('warning'),
200
- z.literal('neutral'),
201
- z.literal('positive'),
202
- ]);
203
-
204
- export const modalLayoutTriggerSchema = z.object({
205
- title: z.string(),
158
+ export const imageSchema = z.object({
159
+ text: z.string().optional(),
160
+ url: z.string(),
161
+ accessibilityDescription: z.string().optional(),
206
162
  });
207
163
 
208
- export const columnsLayoutBiasSchema = z.union([
209
- z.literal('none'),
210
- z.literal('left'),
211
- z.literal('right'),
212
- ]);
213
-
214
- export const markdownLayoutSchema = z.object({
215
- type: z.literal('markdown'),
216
- content: z.string(),
217
- align: alignSchema.optional(),
164
+ export const imageLayoutSchema = z.object({
165
+ type: z.literal('image'),
166
+ text: z.string().optional(),
167
+ url: z.string(),
168
+ size: sizeSchema.optional(),
169
+ accessibilityDescription: z.string().optional(),
218
170
  control: z.string().optional(),
219
171
  margin: sizeSchema.optional(),
220
172
  });
@@ -225,38 +177,71 @@ export const statusListLayoutStatusSchema = z.union([
225
177
  z.literal('done'),
226
178
  ]);
227
179
 
228
- export const paragraphLayoutSchema = z.object({
229
- type: z.literal('paragraph'),
180
+ export const headingLayoutSchema = z.object({
181
+ type: z.literal('heading'),
230
182
  text: z.string(),
183
+ size: sizeSchema.optional(),
231
184
  align: alignSchema.optional(),
232
185
  control: z.string().optional(),
233
186
  margin: sizeSchema.optional(),
234
187
  });
235
188
 
236
- export const infoLayoutSchema = z.object({
237
- type: z.literal('info'),
238
- markdown: z.string(),
239
- align: alignSchema.optional(),
189
+ export const searchLayoutSchema = z.object({
190
+ type: z.literal('search'),
191
+ title: z.string(),
192
+ method: httpMethodSchema,
193
+ url: z.string(),
194
+ param: z.string(),
195
+ emptyMessage: z.string().optional(),
240
196
  control: z.string().optional(),
241
197
  margin: sizeSchema.optional(),
242
198
  });
243
199
 
244
- export const formLayoutSchemaReferenceSchema = z.object({
245
- $ref: z.string(),
200
+ export const modalLayoutTriggerSchema = z.object({
201
+ title: z.string(),
246
202
  });
247
203
 
248
- export const reviewLayoutFieldSchema = z.object({
249
- label: z.string(),
250
- value: z.string(),
251
- rawValue: z.string().optional(),
252
- help: helpSchema.optional(),
204
+ export const helpSchema = z.object({
205
+ markdown: z.string(),
253
206
  });
254
207
 
208
+ export const columnsLayoutBiasSchema = z.union([
209
+ z.literal('none'),
210
+ z.literal('left'),
211
+ z.literal('right'),
212
+ ]);
213
+
255
214
  export const instructionsLayoutItemSchema = z.object({
256
215
  text: z.string(),
257
216
  context: contextSchema,
258
217
  });
259
218
 
219
+ export const formLayoutSchemaReferenceSchema = z.object({
220
+ $ref: z.string(),
221
+ });
222
+
223
+ export const listLayoutStatusSchema = z.union([
224
+ z.literal('warning'),
225
+ z.literal('neutral'),
226
+ z.literal('positive'),
227
+ ]);
228
+
229
+ export const instructionsLayoutSchema = z.object({
230
+ type: z.literal('instructions'),
231
+ title: z.string().optional(),
232
+ items: z.array(instructionsLayoutItemSchema),
233
+ control: z.string().optional(),
234
+ margin: sizeSchema.optional(),
235
+ });
236
+
237
+ export const paragraphLayoutSchema = z.object({
238
+ type: z.literal('paragraph'),
239
+ text: z.string(),
240
+ align: alignSchema.optional(),
241
+ control: z.string().optional(),
242
+ margin: sizeSchema.optional(),
243
+ });
244
+
260
245
  export const dividerLayoutSchema = z.object({
261
246
  type: z.literal('divider'),
262
247
  control: z.string().optional(),
@@ -271,23 +256,14 @@ export const formLayoutSchema = z.object({
271
256
  margin: sizeSchema.optional(),
272
257
  });
273
258
 
274
- export const headingLayoutSchema = z.object({
275
- type: z.literal('heading'),
276
- text: z.string(),
277
- size: sizeSchema.optional(),
259
+ export const infoLayoutSchema = z.object({
260
+ type: z.literal('info'),
261
+ markdown: z.string(),
278
262
  align: alignSchema.optional(),
279
263
  control: z.string().optional(),
280
264
  margin: sizeSchema.optional(),
281
265
  });
282
266
 
283
- export const instructionsLayoutSchema = z.object({
284
- type: z.literal('instructions'),
285
- title: z.string().optional(),
286
- items: z.array(instructionsLayoutItemSchema),
287
- control: z.string().optional(),
288
- margin: sizeSchema.optional(),
289
- });
290
-
291
267
  export const loadingIndicatorLayoutSchema = z.object({
292
268
  type: z.literal('loading-indicator'),
293
269
  size: sizeSchema.optional(),
@@ -295,35 +271,93 @@ export const loadingIndicatorLayoutSchema = z.object({
295
271
  margin: sizeSchema.optional(),
296
272
  });
297
273
 
298
- export const searchLayoutSchema = z.object({
299
- type: z.literal('search'),
300
- title: z.string(),
301
- method: httpMethodSchema,
302
- url: z.string(),
303
- param: z.string(),
304
- emptyMessage: z.string().optional(),
274
+ export const markdownLayoutSchema = z.object({
275
+ type: z.literal('markdown'),
276
+ content: z.string(),
277
+ align: alignSchema.optional(),
305
278
  control: z.string().optional(),
306
279
  margin: sizeSchema.optional(),
307
280
  });
308
281
 
309
- export const linkSchema = z.object({
310
- url: z.string(),
282
+ export const summaryProviderSchema = z.object({
283
+ providesTitle: z.boolean().optional(),
284
+ providesDescription: z.boolean().optional(),
285
+ providesIcon: z.boolean().optional(),
286
+ providesImage: z.boolean().optional(),
311
287
  });
312
288
 
313
- export const navigationStackBehaviorSchema = z.union([
314
- z.literal('default'),
315
- z.literal('remove-previous'),
316
- z.literal('remove-all'),
317
- z.literal('replace-current'),
289
+ export const stringSchemaFormatSchema = z.union([
290
+ z.literal('date'),
291
+ z.literal('email'),
292
+ z.literal('numeric'),
293
+ z.literal('password'),
294
+ z.literal('phone-number'),
295
+ z.literal('base64url'),
318
296
  ]);
319
297
 
320
- export const actionTypeSchema = z.union([
321
- z.literal('primary'),
322
- z.literal('secondary'),
323
- z.literal('link'),
324
- z.literal('positive'),
325
- z.literal('negative'),
326
- ]);
298
+ export const validateAsyncSchema = z.object({
299
+ param: z.string(),
300
+ method: httpMethodSchema,
301
+ url: z.string(),
302
+ });
303
+
304
+ export const uploadSourceSchema = z.union([z.literal('camera'), z.literal('file')]);
305
+
306
+ export const summarySummariserSchema = z.object({
307
+ defaultTitle: z.string().optional(),
308
+ defaultDescription: z.string().optional(),
309
+ defaultIcon: iconSchema.optional(),
310
+ defaultImage: imageLayoutSchema.optional(),
311
+ providesTitle: z.boolean().optional(),
312
+ providesDescription: z.boolean().optional(),
313
+ providesIcon: z.boolean().optional(),
314
+ providesImage: z.boolean().optional(),
315
+ });
316
+
317
+ export const searchSearchRequestSchema = z.object({
318
+ url: z.string(),
319
+ method: httpMethodSchema,
320
+ param: z.string(),
321
+ query: z.string(),
322
+ });
323
+
324
+ export const searchResultSearchSchema = z.object({
325
+ type: z.literal('search'),
326
+ title: z.string(),
327
+ description: z.string().optional(),
328
+ icon: iconSchema.optional(),
329
+ image: imageLayoutSchema.optional(),
330
+ value: searchSearchRequestSchema,
331
+ });
332
+
333
+ export const errorResponseBodySchema = z.object({
334
+ refreshFormUrl: z.string().optional(),
335
+ analytics: z.record(z.string()).optional(),
336
+ error: z.string().optional(),
337
+ validation: jsonElementSchema.optional(),
338
+ refreshUrl: z.string().optional(),
339
+ });
340
+
341
+ export const actionTypeSchema = z.union([
342
+ z.literal('primary'),
343
+ z.literal('secondary'),
344
+ z.literal('link'),
345
+ z.literal('positive'),
346
+ z.literal('negative'),
347
+ ]);
348
+
349
+ export const navigationStackBehaviorSchema = z.union([
350
+ z.literal('default'),
351
+ z.literal('remove-previous'),
352
+ z.literal('remove-all'),
353
+ z.literal('replace-current'),
354
+ ]);
355
+
356
+ export const summarySchema = z.union([summaryProviderSchema, summarySummariserSchema]);
357
+
358
+ export const linkSchema = z.object({
359
+ url: z.string(),
360
+ });
327
361
 
328
362
  export const actionSchema = z.object({
329
363
  title: z.string().optional(),
@@ -346,49 +380,6 @@ export const linkHandlerSchema = z.object({
346
380
  action: actionSchema,
347
381
  });
348
382
 
349
- export const actionResponseBodySchema = z.object({
350
- action: actionSchema,
351
- });
352
-
353
- export const searchSearchRequestSchema = z.object({
354
- url: z.string(),
355
- method: httpMethodSchema,
356
- param: z.string(),
357
- query: z.string(),
358
- });
359
-
360
- export const iconSchema = z.union([iconNamedSchema, iconTextSchema]);
361
-
362
- export const imageLayoutSchema = z.object({
363
- type: z.literal('image'),
364
- text: z.string().optional(),
365
- url: z.string(),
366
- size: sizeSchema.optional(),
367
- accessibilityDescription: z.string().optional(),
368
- control: z.string().optional(),
369
- margin: sizeSchema.optional(),
370
- });
371
-
372
- export const searchResultActionSchema = z.object({
373
- type: z.literal('action'),
374
- title: z.string(),
375
- description: z.string().optional(),
376
- icon: iconSchema.optional(),
377
- image: imageLayoutSchema.optional(),
378
- value: actionSchema,
379
- });
380
-
381
- export const summarySummariserSchema = z.object({
382
- defaultTitle: z.string().optional(),
383
- defaultDescription: z.string().optional(),
384
- defaultIcon: iconSchema.optional(),
385
- defaultImage: imageLayoutSchema.optional(),
386
- providesTitle: z.boolean().optional(),
387
- providesDescription: z.boolean().optional(),
388
- providesIcon: z.boolean().optional(),
389
- providesImage: z.boolean().optional(),
390
- });
391
-
392
383
  export const listLayoutItemSchema = z.object({
393
384
  title: z.string(),
394
385
  description: z.string().optional(),
@@ -396,14 +387,6 @@ export const listLayoutItemSchema = z.object({
396
387
  status: listLayoutStatusSchema.optional(),
397
388
  });
398
389
 
399
- export const listLayoutSchema = z.object({
400
- type: z.literal('list'),
401
- items: z.array(listLayoutItemSchema),
402
- title: z.string().optional(),
403
- control: z.string().optional(),
404
- margin: sizeSchema.optional(),
405
- });
406
-
407
390
  export const decisionLayoutOptionSchema = z.object({
408
391
  action: actionSchema,
409
392
  title: z.string(),
@@ -413,11 +396,31 @@ export const decisionLayoutOptionSchema = z.object({
413
396
  image: imageLayoutSchema.optional(),
414
397
  });
415
398
 
399
+ export const behaviorSchema = z.object({
400
+ action: actionSchema.optional(),
401
+ link: linkSchema.optional(),
402
+ });
403
+
404
+ export const reviewLayoutFieldSchema = z.object({
405
+ label: z.string(),
406
+ value: z.string(),
407
+ rawValue: z.string().optional(),
408
+ help: helpSchema.optional(),
409
+ });
410
+
416
411
  export const reviewLayoutCallToActionSchema = z.object({
417
412
  title: z.string(),
418
413
  action: actionSchema,
419
414
  });
420
415
 
416
+ export const decisionLayoutSchema = z.object({
417
+ type: z.literal('decision'),
418
+ title: z.string().optional(),
419
+ options: z.array(decisionLayoutOptionSchema),
420
+ control: z.string().optional(),
421
+ margin: sizeSchema.optional(),
422
+ });
423
+
421
424
  export const buttonLayoutSchema = z.object({
422
425
  type: z.literal('button'),
423
426
  size: sizeSchema.optional(),
@@ -430,15 +433,19 @@ export const buttonLayoutSchema = z.object({
430
433
  margin: sizeSchema.optional(),
431
434
  });
432
435
 
433
- export const behaviorSchema = z.object({
434
- action: actionSchema.optional(),
435
- link: linkSchema.optional(),
436
+ export const searchResultActionSchema = z.object({
437
+ type: z.literal('action'),
438
+ title: z.string(),
439
+ description: z.string().optional(),
440
+ icon: iconSchema.optional(),
441
+ image: imageLayoutSchema.optional(),
442
+ value: actionSchema,
436
443
  });
437
444
 
438
- export const alertLayoutCallToActionSchema = z.object({
439
- title: z.string(),
440
- accessibilityDescription: z.string().optional(),
441
- behavior: behaviorSchema,
445
+ export const searchResultSchema = z.union([searchResultActionSchema, searchResultSearchSchema]);
446
+
447
+ export const actionResponseBodySchema = z.object({
448
+ action: actionSchema,
442
449
  });
443
450
 
444
451
  export const pollingOnErrorSchema = z.object({
@@ -450,8 +457,6 @@ export const navigationBackBehaviorSchema = z.object({
450
457
  action: actionSchema,
451
458
  });
452
459
 
453
- export const summarySchema = z.union([summaryProviderSchema, summarySummariserSchema]);
454
-
455
460
  export const pollingSchema = z.object({
456
461
  url: z.string(),
457
462
  interval: z.number().optional(),
@@ -467,36 +472,24 @@ export const navigationSchema = z.object({
467
472
  stackBehavior: navigationStackBehaviorSchema.optional(),
468
473
  });
469
474
 
470
- export const searchResultSearchSchema = z.object({
471
- type: z.literal('search'),
472
- title: z.string(),
473
- description: z.string().optional(),
474
- icon: iconSchema.optional(),
475
- image: imageLayoutSchema.optional(),
476
- value: searchSearchRequestSchema,
477
- });
478
-
479
- export const alertLayoutSchema = z.object({
480
- type: z.literal('alert'),
481
- markdown: z.string(),
482
- context: contextSchema.optional(),
475
+ export const listLayoutSchema = z.object({
476
+ type: z.literal('list'),
477
+ items: z.array(listLayoutItemSchema),
478
+ title: z.string().optional(),
483
479
  control: z.string().optional(),
484
480
  margin: sizeSchema.optional(),
485
- callToAction: alertLayoutCallToActionSchema.optional(),
486
481
  });
487
482
 
488
- export const itemCallToActionSchema = z.object({
483
+ export const alertLayoutCallToActionSchema = z.object({
489
484
  title: z.string(),
490
485
  accessibilityDescription: z.string().optional(),
491
486
  behavior: behaviorSchema,
492
487
  });
493
488
 
494
- export const decisionLayoutSchema = z.object({
495
- type: z.literal('decision'),
496
- title: z.string().optional(),
497
- options: z.array(decisionLayoutOptionSchema),
498
- control: z.string().optional(),
499
- margin: sizeSchema.optional(),
489
+ export const itemCallToActionSchema = z.object({
490
+ title: z.string(),
491
+ accessibilityDescription: z.string().optional(),
492
+ behavior: behaviorSchema,
500
493
  });
501
494
 
502
495
  export const reviewLayoutSchema = z.object({
@@ -510,29 +503,25 @@ export const reviewLayoutSchema = z.object({
510
503
  margin: sizeSchema.optional(),
511
504
  });
512
505
 
513
- export const searchResultSchema = z.union([searchResultActionSchema, searchResultSearchSchema]);
506
+ export const searchResponseBodySchema = z.object({
507
+ results: z.array(searchResultSchema),
508
+ });
514
509
 
515
- export const blobSchemaSchema = z.object({
516
- type: z.literal('blob'),
517
- promoted: z.boolean().optional(),
518
- $id: z.string().optional(),
519
- title: z.string().optional(),
510
+ export const statusListLayoutItemSchema = z.object({
511
+ title: z.string(),
520
512
  description: z.string().optional(),
513
+ icon: iconSchema,
514
+ status: statusListLayoutStatusSchema.optional(),
515
+ callToAction: itemCallToActionSchema.optional(),
516
+ });
517
+
518
+ export const alertLayoutSchema = z.object({
519
+ type: z.literal('alert'),
520
+ markdown: z.string(),
521
+ context: contextSchema.optional(),
521
522
  control: z.string().optional(),
522
- hidden: z.boolean().optional(),
523
- icon: iconSchema.optional(),
524
- image: imageSchema.optional(),
525
- keywords: z.array(z.string()).optional(),
526
- summary: summaryProviderSchema.optional(),
527
- analyticsId: z.string().optional(),
528
- validationAsync: validateAsyncSchema.optional(),
529
- validationMessages: z.record(z.string()).optional(),
530
- alert: alertLayoutSchema.optional(),
531
- cameraConfig: jsonElementSchema.optional(),
532
- accepts: z.array(z.string()).optional(),
533
- maxSize: z.number().optional(),
534
- source: uploadSourceSchema.optional(),
535
- disabled: z.boolean().optional(),
523
+ margin: sizeSchema.optional(),
524
+ callToAction: alertLayoutCallToActionSchema.optional(),
536
525
  });
537
526
 
538
527
  export const constSchemaSchema = z.object({
@@ -552,12 +541,27 @@ export const constSchemaSchema = z.object({
552
541
  disabled: z.boolean().optional(),
553
542
  });
554
543
 
555
- export const statusListLayoutItemSchema = z.object({
556
- title: z.string(),
544
+ export const blobSchemaSchema = z.object({
545
+ type: z.literal('blob'),
546
+ promoted: z.boolean().optional(),
547
+ $id: z.string().optional(),
548
+ title: z.string().optional(),
557
549
  description: z.string().optional(),
558
- icon: iconSchema,
559
- status: statusListLayoutStatusSchema.optional(),
560
- callToAction: itemCallToActionSchema.optional(),
550
+ control: z.string().optional(),
551
+ hidden: z.boolean().optional(),
552
+ icon: iconSchema.optional(),
553
+ image: imageSchema.optional(),
554
+ keywords: z.array(z.string()).optional(),
555
+ summary: summaryProviderSchema.optional(),
556
+ analyticsId: z.string().optional(),
557
+ validationAsync: validateAsyncSchema.optional(),
558
+ validationMessages: z.record(z.string()).optional(),
559
+ alert: alertLayoutSchema.optional(),
560
+ cameraConfig: jsonElementSchema.optional(),
561
+ accepts: z.array(z.string()).optional(),
562
+ maxSize: z.number().optional(),
563
+ source: uploadSourceSchema.optional(),
564
+ disabled: z.boolean().optional(),
561
565
  });
562
566
 
563
567
  export const statusListLayoutSchema = z.object({
@@ -568,10 +572,6 @@ export const statusListLayoutSchema = z.object({
568
572
  margin: sizeSchema.optional(),
569
573
  });
570
574
 
571
- export const searchResponseBodySchema = z.object({
572
- results: z.array(searchResultSchema),
573
- });
574
-
575
575
  export const stepSchema: z.ZodSchema<Step> = z.lazy(() =>
576
576
  z.object({
577
577
  key: z.string().optional(),
@@ -609,36 +609,84 @@ export const schemaSchema: z.ZodSchema<Schema> = z.lazy(() =>
609
609
  ]),
610
610
  );
611
611
 
612
- export const layoutSchema: z.ZodSchema<Layout> = z.lazy(() =>
613
- z.union([
614
- alertLayoutSchema,
615
- boxLayoutSchema,
616
- buttonLayoutSchema,
617
- columnsLayoutSchema,
618
- decisionLayoutSchema,
619
- dividerLayoutSchema,
620
- formLayoutSchema,
621
- headingLayoutSchema,
622
- imageLayoutSchema,
623
- infoLayoutSchema,
624
- instructionsLayoutSchema,
625
- listLayoutSchema,
626
- loadingIndicatorLayoutSchema,
627
- markdownLayoutSchema,
628
- modalLayoutSchema,
629
- paragraphLayoutSchema,
630
- reviewLayoutSchema,
631
- searchLayoutSchema,
632
- statusListLayoutSchema,
633
- ]),
612
+ export const layoutSchema: z.ZodSchema<Layout> = z.lazy(() =>
613
+ z.union([
614
+ alertLayoutSchema,
615
+ boxLayoutSchema,
616
+ buttonLayoutSchema,
617
+ columnsLayoutSchema,
618
+ decisionLayoutSchema,
619
+ dividerLayoutSchema,
620
+ formLayoutSchema,
621
+ headingLayoutSchema,
622
+ imageLayoutSchema,
623
+ infoLayoutSchema,
624
+ instructionsLayoutSchema,
625
+ listLayoutSchema,
626
+ loadingIndicatorLayoutSchema,
627
+ markdownLayoutSchema,
628
+ modalLayoutSchema,
629
+ paragraphLayoutSchema,
630
+ reviewLayoutSchema,
631
+ searchLayoutSchema,
632
+ statusListLayoutSchema,
633
+ ]),
634
+ );
635
+
636
+ export const modalLayoutContentSchema: z.ZodSchema<ModalLayoutContent> = z.lazy(() =>
637
+ z.object({
638
+ title: z.string().optional(),
639
+ components: z.array(layoutSchema),
640
+ }),
641
+ );
642
+
643
+ export const modalLayoutSchema: z.ZodSchema<ModalLayout> = z.lazy(() =>
644
+ z.object({
645
+ type: z.literal('modal'),
646
+ control: z.string().optional(),
647
+ margin: sizeSchema.optional(),
648
+ trigger: modalLayoutTriggerSchema,
649
+ content: modalLayoutContentSchema,
650
+ }),
651
+ );
652
+
653
+ export const boxLayoutSchema: z.ZodSchema<BoxLayout> = z.lazy(() =>
654
+ z.object({
655
+ type: z.literal('box'),
656
+ components: z.array(layoutSchema),
657
+ width: sizeSchema.optional(),
658
+ border: z.boolean().optional(),
659
+ control: z.string().optional(),
660
+ margin: sizeSchema.optional(),
661
+ }),
662
+ );
663
+
664
+ export const columnsLayoutSchema: z.ZodSchema<ColumnsLayout> = z.lazy(() =>
665
+ z.object({
666
+ type: z.literal('columns'),
667
+ left: z.array(layoutSchema),
668
+ right: z.array(layoutSchema),
669
+ bias: columnsLayoutBiasSchema.optional(),
670
+ control: z.string().optional(),
671
+ margin: sizeSchema.optional(),
672
+ }),
673
+ );
674
+
675
+ export const arraySchemaSchema: z.ZodSchema<ArraySchema> = z.lazy(() =>
676
+ z.union([arraySchemaListSchema, arraySchemaTupleSchema]),
634
677
  );
635
678
 
636
- export const allOfSchemaSchema: z.ZodSchema<AllOfSchema> = z.lazy(() =>
679
+ export const arraySchemaListSchema: z.ZodSchema<ArraySchemaList> = z.lazy(() =>
637
680
  z.object({
638
- disabled: z.boolean().optional(),
681
+ type: z.literal('array'),
639
682
  promoted: z.boolean().optional(),
640
- allOf: z.array(schemaSchema),
641
683
  $id: z.string().optional(),
684
+ items: schemaSchema,
685
+ addItemTitle: z.string(),
686
+ editItemTitle: z.string(),
687
+ minItems: z.number().optional(),
688
+ maxItems: z.number().optional(),
689
+ placeholder: z.string().optional(),
642
690
  title: z.string().optional(),
643
691
  description: z.string().optional(),
644
692
  control: z.string().optional(),
@@ -646,61 +694,90 @@ export const allOfSchemaSchema: z.ZodSchema<AllOfSchema> = z.lazy(() =>
646
694
  icon: iconSchema.optional(),
647
695
  image: imageSchema.optional(),
648
696
  keywords: z.array(z.string()).optional(),
649
- summary: summaryProviderSchema.optional(),
697
+ summary: summarySummariserSchema.optional(),
650
698
  analyticsId: z.string().optional(),
699
+ persistAsync: persistAsyncSchema.optional(),
700
+ validationAsync: validateAsyncSchema.optional(),
651
701
  alert: alertLayoutSchema.optional(),
702
+ validationMessages: z.record(z.string()).optional(),
703
+ disabled: z.boolean().optional(),
652
704
  }),
653
705
  );
654
706
 
655
- export const arraySchemaSchema: z.ZodSchema<ArraySchema> = z.lazy(() =>
656
- z.union([arraySchemaListSchema, arraySchemaTupleSchema]),
707
+ export const arraySchemaTupleSchema: z.ZodSchema<ArraySchemaTuple> = z.lazy(() =>
708
+ z.object({
709
+ type: z.literal('array'),
710
+ promoted: z.boolean().optional(),
711
+ $id: z.string().optional(),
712
+ items: z.array(schemaSchema),
713
+ title: z.string().optional(),
714
+ description: z.string().optional(),
715
+ control: z.string().optional(),
716
+ hidden: z.boolean().optional(),
717
+ icon: iconSchema.optional(),
718
+ image: imageSchema.optional(),
719
+ keywords: z.array(z.string()).optional(),
720
+ summary: summaryProviderSchema.optional(),
721
+ analyticsId: z.string().optional(),
722
+ persistAsync: persistAsyncSchema.optional(),
723
+ validationAsync: validateAsyncSchema.optional(),
724
+ alert: alertLayoutSchema.optional(),
725
+ }),
657
726
  );
658
727
 
659
- export const booleanSchemaSchema: z.ZodSchema<BooleanSchema> = z.lazy(() =>
728
+ export const oneOfSchemaSchema: z.ZodSchema<OneOfSchema> = z.lazy(() =>
660
729
  z.object({
661
- type: z.literal('boolean'),
662
730
  autofillProvider: z.string().optional(),
663
731
  promoted: z.boolean().optional(),
664
732
  refreshFormOnChange: z.boolean().optional(),
665
733
  refreshUrl: z.string().optional(),
666
734
  refreshFormUrl: z.string().optional(),
735
+ promotion: jsonElementSchema.optional(),
736
+ oneOf: z.array(schemaSchema),
737
+ placeholder: z.string().optional(),
667
738
  $id: z.string().optional(),
668
739
  title: z.string().optional(),
669
740
  description: z.string().optional(),
670
741
  control: z.string().optional(),
671
- default: z.boolean().optional(),
742
+ default: jsonElementSchema.optional(),
672
743
  hidden: z.boolean().optional(),
673
- disabled: z.boolean().optional(),
674
744
  icon: iconSchema.optional(),
675
745
  image: imageSchema.optional(),
676
746
  keywords: z.array(z.string()).optional(),
677
747
  summary: summaryProviderSchema.optional(),
678
748
  analyticsId: z.string().optional(),
679
- persistAsync: persistAsyncSchema.optional(),
680
749
  refreshStepOnChange: z.boolean().optional(),
681
- validationAsync: validateAsyncSchema.optional(),
682
750
  alert: alertLayoutSchema.optional(),
683
- autofillKey: z.string().optional(),
684
751
  help: helpSchema.optional(),
752
+ autocompleteHint: z.array(autocompleteTokenSchema).optional(),
753
+ autofillKey: z.string().optional(),
754
+ validationMessages: z.record(z.string()).optional(),
755
+ disabled: z.boolean().optional(),
685
756
  }),
686
757
  );
687
758
 
688
- export const integerSchemaSchema: z.ZodSchema<IntegerSchema> = z.lazy(() =>
759
+ export const stringSchemaSchema: z.ZodSchema<StringSchema> = z.lazy(() =>
689
760
  z.object({
690
- type: z.literal('integer'),
761
+ type: z.literal('string'),
691
762
  autofillProvider: z.string().optional(),
692
763
  promoted: z.boolean().optional(),
693
764
  refreshFormOnChange: z.boolean().optional(),
694
765
  refreshUrl: z.string().optional(),
695
766
  refreshFormUrl: z.string().optional(),
767
+ format: stringSchemaFormatSchema.optional(),
768
+ displayFormat: z.string().optional(),
696
769
  placeholder: z.string().optional(),
697
- minimum: z.number().optional(),
698
- maximum: z.number().optional(),
770
+ minLength: z.number().optional(),
771
+ maxLength: z.number().optional(),
772
+ minimum: z.string().optional(),
773
+ maximum: z.string().optional(),
774
+ pattern: z.string().optional(),
775
+ autocapitalization: autocapitalizationTypeSchema.optional(),
699
776
  $id: z.string().optional(),
700
777
  title: z.string().optional(),
701
778
  description: z.string().optional(),
702
779
  control: z.string().optional(),
703
- default: z.number().optional(),
780
+ default: z.string().optional(),
704
781
  hidden: z.boolean().optional(),
705
782
  disabled: z.boolean().optional(),
706
783
  icon: iconSchema.optional(),
@@ -713,12 +790,26 @@ export const integerSchemaSchema: z.ZodSchema<IntegerSchema> = z.lazy(() =>
713
790
  validationAsync: validateAsyncSchema.optional(),
714
791
  validationMessages: z.record(z.string()).optional(),
715
792
  alert: alertLayoutSchema.optional(),
793
+ cameraConfig: jsonElementSchema.optional(),
794
+ accepts: z.array(z.string()).optional(),
795
+ maxSize: z.number().optional(),
796
+ source: uploadSourceSchema.optional(),
716
797
  autocompleteHint: z.array(autocompleteTokenSchema).optional(),
717
798
  autofillKey: z.string().optional(),
718
799
  help: helpSchema.optional(),
719
800
  }),
720
801
  );
721
802
 
803
+ export const persistAsyncSchema: z.ZodSchema<PersistAsync> = z.lazy(() =>
804
+ z.object({
805
+ param: z.string(),
806
+ idProperty: z.string(),
807
+ schema: schemaSchema,
808
+ url: z.string(),
809
+ method: httpMethodSchema,
810
+ }),
811
+ );
812
+
722
813
  export const numberSchemaSchema: z.ZodSchema<NumberSchema> = z.lazy(() =>
723
814
  z.object({
724
815
  type: z.literal('number'),
@@ -753,15 +844,11 @@ export const numberSchemaSchema: z.ZodSchema<NumberSchema> = z.lazy(() =>
753
844
  }),
754
845
  );
755
846
 
756
- export const objectSchemaSchema: z.ZodSchema<ObjectSchema> = z.lazy(() =>
847
+ export const allOfSchemaSchema: z.ZodSchema<AllOfSchema> = z.lazy(() =>
757
848
  z.object({
758
- type: z.literal('object'),
759
849
  disabled: z.boolean().optional(),
760
850
  promoted: z.boolean().optional(),
761
- help: helpSchema.optional(),
762
- properties: z.record(schemaSchema),
763
- displayOrder: z.array(z.string()),
764
- required: z.array(z.string()).optional(),
851
+ allOf: z.array(schemaSchema),
765
852
  $id: z.string().optional(),
766
853
  title: z.string().optional(),
767
854
  description: z.string().optional(),
@@ -776,59 +863,42 @@ export const objectSchemaSchema: z.ZodSchema<ObjectSchema> = z.lazy(() =>
776
863
  }),
777
864
  );
778
865
 
779
- export const oneOfSchemaSchema: z.ZodSchema<OneOfSchema> = z.lazy(() =>
866
+ export const objectSchemaSchema: z.ZodSchema<ObjectSchema> = z.lazy(() =>
780
867
  z.object({
781
- autofillProvider: z.string().optional(),
868
+ type: z.literal('object'),
869
+ disabled: z.boolean().optional(),
782
870
  promoted: z.boolean().optional(),
783
- refreshFormOnChange: z.boolean().optional(),
784
- refreshUrl: z.string().optional(),
785
- refreshFormUrl: z.string().optional(),
786
- promotion: jsonElementSchema.optional(),
787
- oneOf: z.array(schemaSchema),
788
- placeholder: z.string().optional(),
871
+ help: helpSchema.optional(),
872
+ properties: z.record(schemaSchema),
873
+ displayOrder: z.array(z.string()),
874
+ required: z.array(z.string()).optional(),
789
875
  $id: z.string().optional(),
790
876
  title: z.string().optional(),
791
877
  description: z.string().optional(),
792
878
  control: z.string().optional(),
793
- default: jsonElementSchema.optional(),
794
879
  hidden: z.boolean().optional(),
795
880
  icon: iconSchema.optional(),
796
881
  image: imageSchema.optional(),
797
882
  keywords: z.array(z.string()).optional(),
798
883
  summary: summaryProviderSchema.optional(),
799
884
  analyticsId: z.string().optional(),
800
- refreshStepOnChange: z.boolean().optional(),
801
885
  alert: alertLayoutSchema.optional(),
802
- help: helpSchema.optional(),
803
- autocompleteHint: z.array(autocompleteTokenSchema).optional(),
804
- autofillKey: z.string().optional(),
805
- validationMessages: z.record(z.string()).optional(),
806
- disabled: z.boolean().optional(),
807
886
  }),
808
887
  );
809
888
 
810
- export const stringSchemaSchema: z.ZodSchema<StringSchema> = z.lazy(() =>
889
+ export const booleanSchemaSchema: z.ZodSchema<BooleanSchema> = z.lazy(() =>
811
890
  z.object({
812
- type: z.literal('string'),
891
+ type: z.literal('boolean'),
813
892
  autofillProvider: z.string().optional(),
814
893
  promoted: z.boolean().optional(),
815
894
  refreshFormOnChange: z.boolean().optional(),
816
895
  refreshUrl: z.string().optional(),
817
896
  refreshFormUrl: z.string().optional(),
818
- format: stringSchemaFormatSchema.optional(),
819
- displayFormat: z.string().optional(),
820
- placeholder: z.string().optional(),
821
- minLength: z.number().optional(),
822
- maxLength: z.number().optional(),
823
- minimum: z.string().optional(),
824
- maximum: z.string().optional(),
825
- pattern: z.string().optional(),
826
- autocapitalization: autocapitalizationTypeSchema.optional(),
827
897
  $id: z.string().optional(),
828
898
  title: z.string().optional(),
829
899
  description: z.string().optional(),
830
900
  control: z.string().optional(),
831
- default: z.string().optional(),
901
+ default: z.boolean().optional(),
832
902
  hidden: z.boolean().optional(),
833
903
  disabled: z.boolean().optional(),
834
904
  icon: iconSchema.optional(),
@@ -839,112 +909,42 @@ export const stringSchemaSchema: z.ZodSchema<StringSchema> = z.lazy(() =>
839
909
  persistAsync: persistAsyncSchema.optional(),
840
910
  refreshStepOnChange: z.boolean().optional(),
841
911
  validationAsync: validateAsyncSchema.optional(),
842
- validationMessages: z.record(z.string()).optional(),
843
912
  alert: alertLayoutSchema.optional(),
844
- cameraConfig: jsonElementSchema.optional(),
845
- accepts: z.array(z.string()).optional(),
846
- maxSize: z.number().optional(),
847
- source: uploadSourceSchema.optional(),
848
- autocompleteHint: z.array(autocompleteTokenSchema).optional(),
849
913
  autofillKey: z.string().optional(),
850
914
  help: helpSchema.optional(),
851
915
  }),
852
916
  );
853
917
 
854
- export const persistAsyncSchema: z.ZodSchema<PersistAsync> = z.lazy(() =>
855
- z.object({
856
- param: z.string(),
857
- idProperty: z.string(),
858
- schema: schemaSchema,
859
- url: z.string(),
860
- method: httpMethodSchema,
861
- }),
862
- );
863
-
864
- export const arraySchemaListSchema: z.ZodSchema<ArraySchemaList> = z.lazy(() =>
918
+ export const integerSchemaSchema: z.ZodSchema<IntegerSchema> = z.lazy(() =>
865
919
  z.object({
866
- type: z.literal('array'),
920
+ type: z.literal('integer'),
921
+ autofillProvider: z.string().optional(),
867
922
  promoted: z.boolean().optional(),
868
- $id: z.string().optional(),
869
- items: schemaSchema,
870
- addItemTitle: z.string(),
871
- editItemTitle: z.string(),
872
- minItems: z.number().optional(),
873
- maxItems: z.number().optional(),
923
+ refreshFormOnChange: z.boolean().optional(),
924
+ refreshUrl: z.string().optional(),
925
+ refreshFormUrl: z.string().optional(),
874
926
  placeholder: z.string().optional(),
875
- title: z.string().optional(),
876
- description: z.string().optional(),
877
- control: z.string().optional(),
878
- hidden: z.boolean().optional(),
879
- icon: iconSchema.optional(),
880
- image: imageSchema.optional(),
881
- keywords: z.array(z.string()).optional(),
882
- summary: summarySummariserSchema.optional(),
883
- analyticsId: z.string().optional(),
884
- persistAsync: persistAsyncSchema.optional(),
885
- validationAsync: validateAsyncSchema.optional(),
886
- alert: alertLayoutSchema.optional(),
887
- validationMessages: z.record(z.string()).optional(),
888
- disabled: z.boolean().optional(),
889
- }),
890
- );
891
-
892
- export const arraySchemaTupleSchema: z.ZodSchema<ArraySchemaTuple> = z.lazy(() =>
893
- z.object({
894
- type: z.literal('array'),
895
- promoted: z.boolean().optional(),
927
+ minimum: z.number().optional(),
928
+ maximum: z.number().optional(),
896
929
  $id: z.string().optional(),
897
- items: z.array(schemaSchema),
898
930
  title: z.string().optional(),
899
931
  description: z.string().optional(),
900
932
  control: z.string().optional(),
933
+ default: z.number().optional(),
901
934
  hidden: z.boolean().optional(),
935
+ disabled: z.boolean().optional(),
902
936
  icon: iconSchema.optional(),
903
937
  image: imageSchema.optional(),
904
938
  keywords: z.array(z.string()).optional(),
905
939
  summary: summaryProviderSchema.optional(),
906
940
  analyticsId: z.string().optional(),
907
941
  persistAsync: persistAsyncSchema.optional(),
942
+ refreshStepOnChange: z.boolean().optional(),
908
943
  validationAsync: validateAsyncSchema.optional(),
944
+ validationMessages: z.record(z.string()).optional(),
909
945
  alert: alertLayoutSchema.optional(),
910
- }),
911
- );
912
-
913
- export const modalLayoutSchema: z.ZodSchema<ModalLayout> = z.lazy(() =>
914
- z.object({
915
- type: z.literal('modal'),
916
- control: z.string().optional(),
917
- margin: sizeSchema.optional(),
918
- trigger: modalLayoutTriggerSchema,
919
- content: modalLayoutContentSchema,
920
- }),
921
- );
922
-
923
- export const modalLayoutContentSchema: z.ZodSchema<ModalLayoutContent> = z.lazy(() =>
924
- z.object({
925
- title: z.string().optional(),
926
- components: z.array(layoutSchema),
927
- }),
928
- );
929
-
930
- export const columnsLayoutSchema: z.ZodSchema<ColumnsLayout> = z.lazy(() =>
931
- z.object({
932
- type: z.literal('columns'),
933
- left: z.array(layoutSchema),
934
- right: z.array(layoutSchema),
935
- bias: columnsLayoutBiasSchema.optional(),
936
- control: z.string().optional(),
937
- margin: sizeSchema.optional(),
938
- }),
939
- );
940
-
941
- export const boxLayoutSchema: z.ZodSchema<BoxLayout> = z.lazy(() =>
942
- z.object({
943
- type: z.literal('box'),
944
- components: z.array(layoutSchema),
945
- width: sizeSchema.optional(),
946
- border: z.boolean().optional(),
947
- control: z.string().optional(),
948
- margin: sizeSchema.optional(),
946
+ autocompleteHint: z.array(autocompleteTokenSchema).optional(),
947
+ autofillKey: z.string().optional(),
948
+ help: helpSchema.optional(),
949
949
  }),
950
950
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-types",
3
- "version": "2.30.0",
3
+ "version": "2.31.0",
4
4
  "description": "Dynamic Flow TypeScript Types",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -30,9 +30,9 @@
30
30
  "build"
31
31
  ],
32
32
  "devDependencies": {
33
- "@formatjs/cli": "^6.3.15",
33
+ "@formatjs/cli": "^6.5.1",
34
34
  "@types/react": "18.3.18",
35
- "esbuild": "0.24.0",
35
+ "esbuild": "0.24.2",
36
36
  "npm-run-all2": "7.0.2",
37
37
  "ts-to-zod": "3.6.1",
38
38
  "typescript": "5.7.3"