@wise/dynamic-flow-types 4.19.0 → 4.20.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.
Files changed (29) hide show
  1. package/build/spec/feature/Behavior.d.ts +3 -1
  2. package/build/spec/feature/Behavior.d.ts.map +1 -1
  3. package/build/spec/feature/DelayBehavior.d.ts +24 -0
  4. package/build/spec/feature/DelayBehavior.d.ts.map +1 -0
  5. package/build/spec/feature/DispatchEventBehavior.d.ts +23 -0
  6. package/build/spec/feature/DispatchEventBehavior.d.ts.map +1 -0
  7. package/build/spec/index.d.ts +5 -0
  8. package/build/spec/index.d.ts.map +1 -1
  9. package/build/spec/layout/Layout.d.ts +2 -1
  10. package/build/spec/layout/Layout.d.ts.map +1 -1
  11. package/build/spec/layout/UpdatableLayout.d.ts +56 -0
  12. package/build/spec/layout/UpdatableLayout.d.ts.map +1 -0
  13. package/build/spec/layout/UpdatableLayoutErrorHandler.d.ts +12 -0
  14. package/build/spec/layout/UpdatableLayoutErrorHandler.d.ts.map +1 -0
  15. package/build/spec/layout/UpdatableLayoutOnEventTrigger.d.ts +14 -0
  16. package/build/spec/layout/UpdatableLayoutOnEventTrigger.d.ts.map +1 -0
  17. package/build/spec/layout/UpdatableLayoutState.d.ts +14 -0
  18. package/build/spec/layout/UpdatableLayoutState.d.ts.map +1 -0
  19. package/build/spec/layout/UpdatableLayoutTrigger.d.ts +6 -0
  20. package/build/spec/layout/UpdatableLayoutTrigger.d.ts.map +1 -0
  21. package/build/spec/main.js +56 -10
  22. package/build/spec/main.mjs +56 -10
  23. package/build/spec/misc/InlineAlert.d.ts +5 -0
  24. package/build/spec/misc/InlineAlert.d.ts.map +1 -1
  25. package/build/tsconfig.tsbuildinfo +1 -1
  26. package/build/zod/schemas.d.ts +160 -24
  27. package/build/zod/schemas.d.ts.map +1 -1
  28. package/build/zod/schemas.ts +81 -24
  29. package/package.json +1 -1
@@ -4,6 +4,9 @@ import {
4
4
  type JsonElement,
5
5
  type AdditionalInfo,
6
6
  type Behavior,
7
+ type UpdatableLayout,
8
+ type UpdatableLayoutState,
9
+ type UpdatableLayoutErrorHandler,
7
10
  type ReviewLayoutCallToAction,
8
11
  type AlertLayoutCallToAction,
9
12
  type ModalLayoutContent,
@@ -63,6 +66,7 @@ import {
63
66
  type SubflowBehavior,
64
67
  type ToolbarItem,
65
68
  type ToolbarButton,
69
+ type DelayBehavior,
66
70
  type ModalBehavior,
67
71
  } from '../spec';
68
72
 
@@ -144,10 +148,7 @@ export const supportingValuesSchema = z.object({
144
148
  subvalue: z.string().optional(),
145
149
  });
146
150
 
147
- export const inlineAlertSchema = z.object({
148
- content: z.string(),
149
- context: contextSchema.optional(),
150
- });
151
+ export const mediaSchema = z.union([mediaAvatarSchema, mediaImageSchema]);
151
152
 
152
153
  export const autocompleteTokenSchema = z.union([
153
154
  z.literal('on'),
@@ -237,6 +238,14 @@ export const imageSchema = z.object({
237
238
  accessibilityDescription: z.string().optional(),
238
239
  });
239
240
 
241
+ export const requestSchema = z.object({
242
+ url: z.string(),
243
+ method: httpMethodSchema,
244
+ body: jsonElementSchema.optional(),
245
+ prefetch: z.boolean().optional(),
246
+ headers: z.record(z.string()).optional(),
247
+ });
248
+
240
249
  export const helpSchema = z.object({
241
250
  markdown: z.string(),
242
251
  });
@@ -247,7 +256,16 @@ export const collectionLayoutSearchSchema = z.object({
247
256
  hint: z.string().optional(),
248
257
  });
249
258
 
250
- export const mediaSchema = z.union([mediaAvatarSchema, mediaImageSchema]);
259
+ export const mediaLayoutSchema = z.object({
260
+ type: z.literal('media'),
261
+ media: mediaSchema,
262
+ align: alignSchema.optional(),
263
+ size: sizeSchema.optional(),
264
+ analyticsId: z.string().optional(),
265
+ control: z.string().optional(),
266
+ margin: sizeSchema.optional(),
267
+ tags: z.array(z.string()).optional(),
268
+ });
251
269
 
252
270
  export const statusListLayoutStatusSchema = z.union([
253
271
  z.literal('not-done'),
@@ -281,12 +299,23 @@ export const collectionLayoutSelectFilterOptionSchema = z.object({
281
299
  selected: z.boolean().optional(),
282
300
  });
283
301
 
302
+ export const updatableLayoutOnEventTriggerSchema = z.object({
303
+ type: z.literal('on-event'),
304
+ eventName: z.string(),
305
+ });
306
+
284
307
  export const listLayoutStatusSchema = z.union([
285
308
  z.literal('warning'),
286
309
  z.literal('neutral'),
287
310
  z.literal('positive'),
288
311
  ]);
289
312
 
313
+ export const inlineAlertSchema = z.object({
314
+ content: z.string(),
315
+ context: contextSchema.optional(),
316
+ media: mediaSchema.optional(),
317
+ });
318
+
290
319
  export const dividerLayoutSchema = z.object({
291
320
  type: z.literal('divider'),
292
321
  control: z.string().optional(),
@@ -299,14 +328,6 @@ export const formLayoutSchemaReferenceSchema = z.object({
299
328
  $ref: z.string(),
300
329
  });
301
330
 
302
- export const requestSchema = z.object({
303
- url: z.string(),
304
- method: httpMethodSchema,
305
- body: jsonElementSchema.optional(),
306
- prefetch: z.boolean().optional(),
307
- headers: z.record(z.string()).optional(),
308
- });
309
-
310
331
  export const headingLayoutSchema = z.object({
311
332
  type: z.literal('heading'),
312
333
  text: z.string(),
@@ -399,17 +420,6 @@ export const infoLayoutSchema = z.object({
399
420
  analyticsId: z.string().optional(),
400
421
  });
401
422
 
402
- export const mediaLayoutSchema = z.object({
403
- type: z.literal('media'),
404
- media: mediaSchema,
405
- align: alignSchema.optional(),
406
- size: sizeSchema.optional(),
407
- analyticsId: z.string().optional(),
408
- control: z.string().optional(),
409
- margin: sizeSchema.optional(),
410
- tags: z.array(z.string()).optional(),
411
- });
412
-
413
423
  export const progressLayoutSchema = z.object({
414
424
  type: z.literal('progress'),
415
425
  title: z.string().optional(),
@@ -546,6 +556,12 @@ export const dismissBehaviorSchema = z.object({
546
556
  analytics: z.record(z.string()).optional(),
547
557
  });
548
558
 
559
+ export const dispatchEventBehaviorSchema = z.object({
560
+ type: z.literal('dispatch-event'),
561
+ eventName: z.string(),
562
+ analytics: z.record(z.string()).optional(),
563
+ });
564
+
549
565
  export const downloadBehaviorSchema = z.object({
550
566
  type: z.literal('download'),
551
567
  request: requestSchema,
@@ -603,6 +619,8 @@ export const containerBehaviorSchema = z.object({
603
619
  analytics: z.record(z.string()).optional(),
604
620
  });
605
621
 
622
+ export const updatableLayoutTriggerSchema = updatableLayoutOnEventTriggerSchema;
623
+
606
624
  export const collectionLayoutFilterSchema = collectionLayoutSelectFilterSchema;
607
625
 
608
626
  export const suggestionsSchema = z.object({
@@ -672,7 +690,9 @@ export const behaviorSchema: z.ZodSchema<Behavior> = z.lazy(() =>
672
690
  actionBehaviorSchema,
673
691
  containerBehaviorSchema,
674
692
  copyBehaviorSchema,
693
+ delayBehaviorSchema,
675
694
  dismissBehaviorSchema,
695
+ dispatchEventBehaviorSchema,
676
696
  downloadBehaviorSchema,
677
697
  linkBehaviorSchema,
678
698
  modalBehaviorSchema,
@@ -681,6 +701,33 @@ export const behaviorSchema: z.ZodSchema<Behavior> = z.lazy(() =>
681
701
  ]),
682
702
  );
683
703
 
704
+ export const updatableLayoutSchema: z.ZodSchema<UpdatableLayout> = z.lazy(() =>
705
+ z.object({
706
+ type: z.literal('updatable'),
707
+ baseRequest: requestSchema,
708
+ trigger: updatableLayoutTriggerSchema,
709
+ initialState: updatableLayoutStateSchema.optional(),
710
+ onError: updatableLayoutErrorHandlerSchema.optional(),
711
+ control: z.string().optional(),
712
+ margin: sizeSchema.optional(),
713
+ analyticsId: z.string().optional(),
714
+ tags: z.array(z.string()).optional(),
715
+ }),
716
+ );
717
+
718
+ export const updatableLayoutStateSchema: z.ZodSchema<UpdatableLayoutState> = z.lazy(() =>
719
+ z.object({
720
+ components: z.array(layoutSchema).optional(),
721
+ }),
722
+ );
723
+
724
+ export const updatableLayoutErrorHandlerSchema: z.ZodSchema<UpdatableLayoutErrorHandler> = z.lazy(
725
+ () =>
726
+ z.object({
727
+ fallbackLayout: z.array(layoutSchema).optional(),
728
+ }),
729
+ );
730
+
684
731
  export const reviewLayoutCallToActionSchema: z.ZodSchema<ReviewLayoutCallToAction> = z.lazy(() =>
685
732
  z.object({
686
733
  action: actionSchema.optional(),
@@ -733,6 +780,7 @@ export const layoutSchema: z.ZodSchema<Layout> = z.lazy(() =>
733
780
  sectionLayoutSchema,
734
781
  statusListLayoutSchema,
735
782
  tabsLayoutSchema,
783
+ updatableLayoutSchema,
736
784
  upsellLayoutSchema,
737
785
  ]),
738
786
  );
@@ -1625,6 +1673,15 @@ export const toolbarButtonSchema: z.ZodSchema<ToolbarButton> = z.lazy(() =>
1625
1673
  }),
1626
1674
  );
1627
1675
 
1676
+ export const delayBehaviorSchema: z.ZodSchema<DelayBehavior> = z.lazy(() =>
1677
+ z.object({
1678
+ type: z.literal('delay'),
1679
+ duration: z.number(),
1680
+ behavior: behaviorSchema,
1681
+ analytics: z.record(z.string()).optional(),
1682
+ }),
1683
+ );
1684
+
1628
1685
  export const modalBehaviorSchema: z.ZodSchema<ModalBehavior> = z.lazy(() =>
1629
1686
  z.object({
1630
1687
  type: z.literal('modal'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wise/dynamic-flow-types",
3
- "version": "4.19.0",
3
+ "version": "4.20.0",
4
4
  "description": "Dynamic Flow TypeScript Types",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {