@coveo/thermidor-schema 1.0.0-beta.5 → 1.0.0-beta.6

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 (32) hide show
  1. package/dist/generated/schemas.d.ts +1027 -348
  2. package/dist/generated/schemas.js +445 -229
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.js +1 -1
  5. package/package.json +20 -19
  6. package/schema/base/catalog.schema.json +3 -2
  7. package/schema/base/component.schema.json +24 -33
  8. package/schema/component-contracts.schema.json +1 -1
  9. package/schema/components/bundle-display.schema.json +9 -13
  10. package/schema/components/cart.schema.json +5 -14
  11. package/schema/components/category-facet.schema.json +29 -13
  12. package/schema/components/commerce-search.schema.json +15 -14
  13. package/schema/components/comparison-table.schema.json +21 -13
  14. package/schema/components/date-facet.schema.json +33 -13
  15. package/schema/components/facet-manager.schema.json +12 -14
  16. package/schema/components/layout-stack.schema.json +18 -15
  17. package/schema/components/next-actions-bar.schema.json +12 -15
  18. package/schema/components/numeric-facet.schema.json +37 -13
  19. package/schema/components/page-size.schema.json +13 -15
  20. package/schema/components/pagination.schema.json +21 -13
  21. package/schema/components/product-carousel.schema.json +13 -13
  22. package/schema/components/product-list.schema.json +9 -13
  23. package/schema/components/product-summary.schema.json +15 -14
  24. package/schema/components/query-suggestions.schema.json +17 -13
  25. package/schema/components/query-summary.schema.json +23 -14
  26. package/schema/components/regular-facet.schema.json +33 -13
  27. package/schema/components/sort.schema.json +13 -13
  28. package/schema/definitions/bundle-tier.schema.json +6 -1
  29. package/schema/definitions/child-list.schema.json +32 -0
  30. package/schema/definitions/component-id.schema.json +9 -0
  31. package/schema/definitions/data-binding.schema.json +16 -0
  32. package/schema/definitions/child-ref.schema.json +0 -8
@@ -38,6 +38,13 @@ export const ProductSchema = z.strictObject({
38
38
  ec_thumbnails: z.array(z.url()).optional(),
39
39
  permanentid: z.string(),
40
40
  });
41
+ export const DataBindingSchema = z.strictObject({
42
+ path: z.string(),
43
+ });
44
+ export const ChildListClassSchema = z.strictObject({
45
+ componentId: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')),
46
+ path: z.string(),
47
+ });
41
48
  export const ProductCarouselActionsSchema = z.strictObject({});
42
49
  export const ProductCarouselStateSchema = z.strictObject({
43
50
  heading: z.string(),
@@ -254,15 +261,11 @@ export const SetPageSizePayloadSchema = z.strictObject({
254
261
  export const PageSizeStateSchema = z.strictObject({
255
262
  pageSize: z.number().int().min(1),
256
263
  });
257
- export const ProductCarouselSchema = z.strictObject({
258
- actions: ProductCarouselActionsSchema,
259
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
260
- children: z
261
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
262
- .max(1000)
263
- .optional(),
264
- componentType: z.literal('product-carousel'),
265
- state: ProductCarouselStateSchema,
264
+ export const ProductCarouselSchema = z.looseObject({
265
+ actions: ProductCarouselActionsSchema.optional(),
266
+ component: z.literal('ProductCarousel'),
267
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
268
+ state: ProductCarouselStateSchema.optional(),
266
269
  });
267
270
  export const PurchasePayloadSchema = z.strictObject({
268
271
  products: z.array(PurchaseProductSchema),
@@ -283,12 +286,13 @@ export const SelectActionSchema = z.strictObject({
283
286
  payload: SelectActionPayloadSchema,
284
287
  });
285
288
  export const NextActionsStateSchema = z.strictObject({
286
- actions: z.array(ActionItemSchema),
289
+ suggestedActions: z.array(ActionItemSchema),
287
290
  });
288
291
  export const BundleTierSchema = z.strictObject({
289
292
  description: z.string(),
290
293
  label: z.string(),
291
294
  slots: z.array(BundleSlotSchema),
295
+ total: z.number().min(0),
292
296
  });
293
297
  export const ComparisonTableStateSchema = z.strictObject({
294
298
  attributes: z.array(ComparisonAttributeSchema),
@@ -302,15 +306,11 @@ export const ProductClickSchema = z.strictObject({
302
306
  export const SelectProductsSchema = z.strictObject({
303
307
  payload: SelectProductsPayloadSchema,
304
308
  });
305
- export const ProductSummarySchema = z.strictObject({
306
- actions: ProductSummaryActionsSchema,
307
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
308
- children: z
309
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
310
- .max(1000)
311
- .optional(),
312
- componentType: z.literal('product-summary'),
313
- state: ProductSummaryStateSchema,
309
+ export const ProductSummarySchema = z.looseObject({
310
+ actions: ProductSummaryActionsSchema.optional(),
311
+ component: z.literal('ProductSummary'),
312
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
313
+ state: ProductSummaryStateSchema.optional(),
314
314
  });
315
315
  export const SelectPageSchema = z.strictObject({
316
316
  payload: SelectPagePayloadSchema,
@@ -396,15 +396,11 @@ export const FacetSearchClassSchema = z.strictObject({
396
396
  query: z.string().max(256),
397
397
  results: z.array(CategoryFacetValueSchema),
398
398
  });
399
- export const FacetManagerSchema = z.strictObject({
400
- actions: FacetManagerActionsSchema,
401
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
402
- children: z
403
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
404
- .max(1000)
405
- .optional(),
406
- componentType: z.literal('facet-manager'),
407
- state: FacetManagerStateSchema,
399
+ export const FacetManagerSchema = z.looseObject({
400
+ actions: FacetManagerActionsSchema.optional(),
401
+ component: z.literal('FacetManager'),
402
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
403
+ state: FacetManagerStateSchema.optional(),
408
404
  });
409
405
  export const OverrideCorrectionSchema = z.strictObject({
410
406
  payload: OverrideCorrectionPayloadSchema,
@@ -417,25 +413,17 @@ export const FacetRestoreSchema = z.strictObject({
417
413
  export const SubmitQuerySchema = z.strictObject({
418
414
  payload: SubmitQueryPayloadSchema,
419
415
  });
420
- export const LayoutStackSchema = z.strictObject({
421
- actions: LayoutStackActionsSchema,
422
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
423
- children: z
424
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
425
- .max(1000)
426
- .optional(),
427
- componentType: z.literal('layout-stack'),
428
- state: LayoutStackStateSchema,
429
- });
430
- export const QuerySummarySchema = z.strictObject({
431
- actions: QuerySummaryActionsSchema,
432
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
433
- children: z
434
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
435
- .max(1000)
436
- .optional(),
437
- componentType: z.literal('query-summary'),
438
- state: QuerySummaryStateSchema,
416
+ export const LayoutStackSchema = z.looseObject({
417
+ actions: LayoutStackActionsSchema.optional(),
418
+ component: z.literal('LayoutStack'),
419
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
420
+ state: LayoutStackStateSchema.optional(),
421
+ });
422
+ export const QuerySummarySchema = z.looseObject({
423
+ actions: QuerySummaryActionsSchema.optional(),
424
+ component: z.literal('QuerySummary'),
425
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
426
+ state: QuerySummaryStateSchema.optional(),
439
427
  });
440
428
  export const FluffySetPageSizeSchema = z.strictObject({
441
429
  payload: SetPageSizePayloadSchema,
@@ -452,15 +440,11 @@ export const NextActionsBarActionsSchema = z.strictObject({
452
440
  export const BundleDisplayStateSchema = z.strictObject({
453
441
  tiers: z.array(BundleTierSchema),
454
442
  });
455
- export const ComparisonTableSchema = z.strictObject({
456
- actions: ComparisonTableActionsSchema,
457
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
458
- children: z
459
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
460
- .max(1000)
461
- .optional(),
462
- componentType: z.literal('comparison-table'),
463
- state: ComparisonTableStateSchema,
443
+ export const ComparisonTableSchema = z.looseObject({
444
+ actions: ComparisonTableActionsSchema.optional(),
445
+ component: z.literal('ComparisonTable'),
446
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
447
+ state: ComparisonTableStateSchema.optional(),
464
448
  });
465
449
  export const ProductListActionsSchema = z.strictObject({
466
450
  productClick: ProductClickSchema,
@@ -543,145 +527,93 @@ export const CartActionsSchema = z.strictObject({
543
527
  purchase: PurchaseSchema,
544
528
  updateCart: UpdateCartSchema,
545
529
  });
546
- export const QuerySuggestionsSchema = z.strictObject({
547
- actions: QuerySuggestionsActionsSchema,
548
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
549
- children: z
550
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
551
- .max(1000)
552
- .optional(),
553
- componentType: z.literal('query-suggestions'),
554
- state: QuerySuggestionsStateSchema,
555
- });
556
- export const NextActionsBarSchema = z.strictObject({
557
- actions: NextActionsBarActionsSchema,
558
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
559
- children: z
560
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
561
- .max(1000)
562
- .optional(),
563
- componentType: z.literal('next-actions-bar'),
564
- state: NextActionsStateSchema,
565
- });
566
- export const BundleDisplaySchema = z.strictObject({
567
- actions: BundleDisplayActionsSchema,
568
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
569
- children: z
570
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
571
- .max(1000)
572
- .optional(),
573
- componentType: z.literal('bundle-display'),
574
- state: BundleDisplayStateSchema,
575
- });
576
- export const ProductListSchema = z.strictObject({
577
- actions: ProductListActionsSchema,
578
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
579
- children: z
580
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
581
- .max(1000)
582
- .optional(),
583
- componentType: z.literal('product-list'),
584
- state: ProductListStateSchema,
585
- });
586
- export const PaginationSchema = z.strictObject({
587
- actions: PaginationActionsSchema,
588
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
589
- children: z
590
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
591
- .max(1000)
592
- .optional(),
593
- componentType: z.literal('pagination'),
594
- state: PaginationStateSchema,
595
- });
596
- export const SortSchema = z.strictObject({
597
- actions: SortActionsSchema,
598
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
599
- children: z
600
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
601
- .max(1000)
602
- .optional(),
603
- componentType: z.literal('sort'),
604
- state: SortStateSchema,
605
- });
606
- export const RegularFacetSchema = z.strictObject({
607
- actions: RegularFacetActionsSchema,
608
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
609
- children: z
610
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
611
- .max(1000)
612
- .optional(),
613
- componentType: z.literal('regular-facet'),
614
- state: RegularFacetStateSchema,
615
- });
616
- export const NumericFacetSchema = z.strictObject({
617
- actions: NumericFacetActionsSchema,
618
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
619
- children: z
620
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
621
- .max(1000)
622
- .optional(),
623
- componentType: z.literal('numeric-facet'),
624
- state: NumericFacetStateSchema,
625
- });
626
- export const DateFacetSchema = z.strictObject({
627
- actions: DateFacetActionsSchema,
628
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
629
- children: z
630
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
631
- .max(1000)
632
- .optional(),
633
- componentType: z.literal('date-facet'),
634
- state: DateFacetStateSchema,
635
- });
636
- export const CategoryFacetSchema = z.strictObject({
637
- actions: CategoryFacetActionsSchema,
638
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
639
- children: z
640
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
641
- .max(1000)
642
- .optional(),
643
- componentType: z.literal('category-facet'),
644
- state: CategoryFacetStateSchema,
530
+ export const QuerySuggestionsSchema = z.looseObject({
531
+ actions: QuerySuggestionsActionsSchema.optional(),
532
+ component: z.literal('QuerySuggestions'),
533
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
534
+ state: QuerySuggestionsStateSchema.optional(),
535
+ });
536
+ export const NextActionsBarSchema = z.looseObject({
537
+ actions: NextActionsBarActionsSchema.optional(),
538
+ component: z.literal('NextActionsBar'),
539
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
540
+ state: NextActionsStateSchema.optional(),
541
+ });
542
+ export const BundleDisplaySchema = z.looseObject({
543
+ actions: BundleDisplayActionsSchema.optional(),
544
+ component: z.literal('BundleDisplay'),
545
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
546
+ state: BundleDisplayStateSchema.optional(),
547
+ });
548
+ export const ProductListSchema = z.looseObject({
549
+ actions: ProductListActionsSchema.optional(),
550
+ component: z.literal('ProductList'),
551
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
552
+ state: ProductListStateSchema.optional(),
553
+ });
554
+ export const PaginationSchema = z.looseObject({
555
+ actions: PaginationActionsSchema.optional(),
556
+ component: z.literal('Pagination'),
557
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
558
+ state: PaginationStateSchema.optional(),
559
+ });
560
+ export const SortSchema = z.looseObject({
561
+ actions: SortActionsSchema.optional(),
562
+ component: z.literal('Sort'),
563
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
564
+ state: SortStateSchema.optional(),
565
+ });
566
+ export const RegularFacetSchema = z.looseObject({
567
+ actions: RegularFacetActionsSchema.optional(),
568
+ component: z.literal('RegularFacet'),
569
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
570
+ state: RegularFacetStateSchema.optional(),
571
+ });
572
+ export const NumericFacetSchema = z.looseObject({
573
+ actions: NumericFacetActionsSchema.optional(),
574
+ component: z.literal('NumericFacet'),
575
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
576
+ state: NumericFacetStateSchema.optional(),
577
+ });
578
+ export const DateFacetSchema = z.looseObject({
579
+ actions: DateFacetActionsSchema.optional(),
580
+ component: z.literal('DateFacet'),
581
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
582
+ state: DateFacetStateSchema.optional(),
583
+ });
584
+ export const CategoryFacetSchema = z.looseObject({
585
+ actions: CategoryFacetActionsSchema.optional(),
586
+ component: z.literal('CategoryFacet'),
587
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
588
+ state: CategoryFacetStateSchema.optional(),
645
589
  });
646
590
  export const RestoreStateSchema = z.strictObject({
647
591
  payload: RestoreStatePayloadSchema,
648
592
  });
649
- export const PageSizeSchema = z.strictObject({
650
- actions: PageSizeActionsSchema,
651
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
652
- children: z
653
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
654
- .max(1000)
655
- .optional(),
656
- componentType: z.literal('page-size'),
657
- state: PageSizeStateSchema,
658
- });
659
- export const CartSchema = z.strictObject({
660
- actions: CartActionsSchema,
661
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
662
- children: z
663
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
664
- .max(1000)
665
- .optional(),
666
- componentType: z.literal('cart'),
667
- state: CartStateSchema,
593
+ export const PageSizeSchema = z.looseObject({
594
+ actions: PageSizeActionsSchema.optional(),
595
+ component: z.literal('PageSize'),
596
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
597
+ state: PageSizeStateSchema.optional(),
598
+ });
599
+ export const CartSchema = z.looseObject({
600
+ actions: CartActionsSchema.optional(),
601
+ component: z.literal('Cart'),
602
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
603
+ state: CartStateSchema.optional(),
668
604
  });
669
605
  export const CommerceSearchActionsSchema = z.strictObject({
670
606
  overrideCorrection: OverrideCorrectionSchema,
671
607
  restoreState: RestoreStateSchema,
672
608
  submitQuery: SubmitQuerySchema,
673
609
  });
674
- export const CommerceSearchSchema = z.strictObject({
675
- actions: CommerceSearchActionsSchema,
676
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
677
- children: z
678
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
679
- .max(1000)
680
- .optional(),
681
- componentType: z.literal('commerce-search'),
682
- state: CommerceSearchStateSchema,
683
- });
684
- export const ComponentContractsSchema = z.discriminatedUnion('componentType', [
610
+ export const CommerceSearchSchema = z.looseObject({
611
+ actions: CommerceSearchActionsSchema.optional(),
612
+ component: z.literal('CommerceSearch'),
613
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
614
+ state: CommerceSearchStateSchema.optional(),
615
+ });
616
+ export const ComponentContractsSchema = z.discriminatedUnion('component', [
685
617
  ProductCarouselSchema,
686
618
  CartSchema,
687
619
  QuerySuggestionsSchema,
@@ -703,84 +635,368 @@ export const ComponentContractsSchema = z.discriminatedUnion('componentType', [
703
635
  PageSizeSchema,
704
636
  ]);
705
637
  /**
706
- * Component props schemas.
707
- * These props are injected by the A2-UI surface layer (backend) and passed to catalog
708
- * renderers automatically. Consumers should NOT hardcode these values; they arrive via
709
- * the createSurface message's components[].props.
638
+ * A2-UI dynamic-value building blocks (self-contained; no renderer / @a2ui/web_core dependency).
639
+ * A bindable prop is an A2-UI Dynamic_Value: a union admitting a literal resolved value, an
640
+ * A2-UI Data_Binding object { path }, or a function-call form. The frozen renderer's binder
641
+ * classifies a field as resolvable only when its schema is such a union including DataBinding,
642
+ * so it dereferences the { path } against the data model before the renderer sees it.
643
+ *
644
+ * `DataBindingSchema` is projected from the shared definitions/data-binding.schema.json (like
645
+ * ComponentId / ChildList), so it is not re-declared here; the unions below reference it.
710
646
  */
711
- export const BundleDisplayPropsSchema = z.object({
712
- componentId: z.string(),
713
- componentType: z.literal('bundle-display'),
647
+ export const FunctionCallSchema = z.object({
648
+ functionName: z.string(),
649
+ args: z.array(z.unknown()).optional(),
650
+ });
651
+ export const DynamicNumberSchema = z.union([z.number(), DataBindingSchema, FunctionCallSchema]);
652
+ export const DynamicStringSchema = z.union([z.string(), DataBindingSchema, FunctionCallSchema]);
653
+ export const DynamicBooleanSchema = z.union([z.boolean(), DataBindingSchema, FunctionCallSchema]);
654
+ export const DynamicStringListSchema = z.union([
655
+ z.array(z.string()),
656
+ DataBindingSchema,
657
+ FunctionCallSchema,
658
+ ]);
659
+ export const DynamicValueSchema = z.union([z.unknown(), DataBindingSchema, FunctionCallSchema]);
660
+ /**
661
+ * The A2-UI Action schema for an action-typed prop: the standard A2-UI event shape
662
+ * { event: { name; context } }. Named DynamicAction to stay distinct from the generated base
663
+ * action-contract ActionSchema and from a component's dispatchable *Actions contract.
664
+ */
665
+ export const DynamicActionSchema = z.object({
666
+ event: z.object({
667
+ name: z.string(),
668
+ context: z.unknown().optional(),
669
+ }),
714
670
  });
715
- export const CartPropsSchema = z.object({
716
- componentId: z.string(),
717
- componentType: z.literal('cart'),
671
+ /**
672
+ * Per-component props schemas for the renderer catalog (one per component), passed to
673
+ * `createCatalog` as each component's `{ props }` schema. Each bindable prop is an A2-UI
674
+ * Dynamic_Value, so the renderer's binder resolves its `{ path }` binding against the A2-UI
675
+ * data model; composition child-ref props stay static so child ids reach the renderer
676
+ * untouched. The resolved shape a renderer actually reads is the `XxxProps` type.
677
+ */
678
+ export const BundleDisplayPropsSchema = z.object({
679
+ tiers: DynamicValueSchema,
718
680
  });
681
+ export const CartPropsSchema = z.object({});
719
682
  export const CategoryFacetPropsSchema = z.object({
720
- componentId: z.string(),
721
- componentType: z.literal('category-facet'),
683
+ field: DynamicStringSchema,
684
+ displayName: DynamicStringSchema,
685
+ values: DynamicValueSchema,
686
+ canShowMoreValues: DynamicBooleanSchema,
687
+ canShowLessValues: DynamicBooleanSchema,
688
+ facetSearch: DynamicValueSchema,
722
689
  });
723
690
  export const CommerceSearchPropsSchema = z.object({
724
- componentId: z.string(),
725
- componentType: z.literal('commerce-search'),
691
+ sidebarChild: z.string().optional(),
692
+ mainChild: z.string().optional(),
726
693
  });
727
694
  export const ComparisonTablePropsSchema = z.object({
728
- componentId: z.string(),
729
- componentType: z.literal('comparison-table'),
695
+ heading: DynamicStringSchema,
696
+ summary: DynamicStringSchema,
697
+ products: DynamicValueSchema,
698
+ attributes: DynamicValueSchema,
730
699
  });
731
700
  export const DateFacetPropsSchema = z.object({
732
- componentId: z.string(),
733
- componentType: z.literal('date-facet'),
701
+ field: DynamicStringSchema,
702
+ displayName: DynamicStringSchema,
703
+ values: DynamicValueSchema,
704
+ customRange: DynamicValueSchema,
705
+ hasActiveValues: DynamicBooleanSchema,
706
+ canShowMoreValues: DynamicBooleanSchema,
707
+ canShowLessValues: DynamicBooleanSchema,
734
708
  });
735
709
  export const FacetManagerPropsSchema = z.object({
736
- componentId: z.string(),
737
- componentType: z.literal('facet-manager'),
710
+ children: z.array(z.string()).optional(),
738
711
  });
739
712
  export const LayoutStackPropsSchema = z.object({
740
- componentId: z.string(),
741
- componentType: z.literal('layout-stack'),
713
+ direction: z.string().optional(),
714
+ children: z.array(z.string()).optional(),
742
715
  });
743
716
  export const NextActionsBarPropsSchema = z.object({
744
- componentId: z.string(),
745
- componentType: z.literal('next-actions-bar'),
717
+ suggestedActions: DynamicValueSchema,
746
718
  });
747
719
  export const NumericFacetPropsSchema = z.object({
748
- componentId: z.string(),
749
- componentType: z.literal('numeric-facet'),
720
+ field: DynamicStringSchema,
721
+ displayName: DynamicStringSchema,
722
+ values: DynamicValueSchema,
723
+ customRange: DynamicValueSchema,
724
+ hasActiveValues: DynamicBooleanSchema,
725
+ canShowMoreValues: DynamicBooleanSchema,
726
+ canShowLessValues: DynamicBooleanSchema,
727
+ domain: DynamicValueSchema,
750
728
  });
751
729
  export const PageSizePropsSchema = z.object({
752
- componentId: z.string(),
753
- componentType: z.literal('page-size'),
730
+ pageSize: DynamicNumberSchema,
754
731
  });
755
732
  export const PaginationPropsSchema = z.object({
756
- componentId: z.string(),
757
- componentType: z.literal('pagination'),
733
+ page: DynamicNumberSchema,
734
+ pageSize: DynamicNumberSchema,
735
+ totalEntries: DynamicNumberSchema,
736
+ totalPages: DynamicNumberSchema,
758
737
  });
759
738
  export const ProductCarouselPropsSchema = z.object({
760
- componentId: z.string(),
761
- componentType: z.literal('product-carousel'),
739
+ heading: DynamicStringSchema,
740
+ products: DynamicValueSchema,
762
741
  });
763
742
  export const ProductListPropsSchema = z.object({
764
- componentId: z.string(),
765
- componentType: z.literal('product-list'),
743
+ products: DynamicValueSchema,
766
744
  });
767
745
  export const ProductSummaryPropsSchema = z.object({
768
- componentId: z.string(),
769
- componentType: z.literal('product-summary'),
746
+ categoryLabel: DynamicStringSchema,
747
+ product: DynamicValueSchema,
770
748
  });
771
749
  export const QuerySuggestionsPropsSchema = z.object({
772
- componentId: z.string(),
773
- componentType: z.literal('query-suggestions'),
750
+ query: DynamicStringSchema,
751
+ completions: DynamicValueSchema,
752
+ products: DynamicValueSchema,
774
753
  });
775
754
  export const QuerySummaryPropsSchema = z.object({
776
- componentId: z.string(),
777
- componentType: z.literal('query-summary'),
755
+ query: DynamicStringSchema,
756
+ firstIndex: DynamicNumberSchema,
757
+ lastIndex: DynamicNumberSchema,
758
+ totalEntries: DynamicNumberSchema,
778
759
  });
779
760
  export const RegularFacetPropsSchema = z.object({
780
- componentId: z.string(),
781
- componentType: z.literal('regular-facet'),
761
+ field: DynamicStringSchema,
762
+ displayName: DynamicStringSchema,
763
+ values: DynamicValueSchema,
764
+ hasActiveValues: DynamicBooleanSchema,
765
+ canShowMoreValues: DynamicBooleanSchema,
766
+ canShowLessValues: DynamicBooleanSchema,
767
+ facetSearch: DynamicValueSchema,
782
768
  });
783
769
  export const SortPropsSchema = z.object({
784
- componentId: z.string(),
785
- componentType: z.literal('sort'),
770
+ appliedSort: DynamicValueSchema,
771
+ availableSorts: DynamicValueSchema,
786
772
  });
773
+ /**
774
+ * Per-component action unions in the standard A2-UI event shape
775
+ * { event: { name: <literal>; context: <typed payload> } }, one member per declared action.
776
+ * Derived from each component's *Actions contract (action-map key -> payload), NOT from
777
+ * quicktype's auto-named payload wrappers. A component with no actions has `type XxxAction =
778
+ * never`. The wire field is `context`; the internal validation layer calls the same data
779
+ * `payload` (see design: Action typing).
780
+ */
781
+ export const BundleDisplayActionSchema = z.never();
782
+ export const CartActionSchema = z.union([
783
+ z.object({
784
+ event: z.object({
785
+ name: z.literal('updateCart'),
786
+ context: z.strictObject({
787
+ productId: z.string(),
788
+ name: z.string().optional(),
789
+ price: z.unknown().optional(),
790
+ quantity: z.number().int().min(1),
791
+ operation: z.enum(['add', 'remove', 'setQuantity']),
792
+ }),
793
+ }),
794
+ }),
795
+ z.object({
796
+ event: z.object({
797
+ name: z.literal('purchase'),
798
+ context: z.strictObject({ products: z.array(z.unknown()), transaction: z.unknown() }),
799
+ }),
800
+ }),
801
+ ]);
802
+ export const CategoryFacetActionSchema = z.union([
803
+ z.object({
804
+ event: z.object({
805
+ name: z.literal('selectPath'),
806
+ context: z.strictObject({ path: z.array(z.string()) }),
807
+ }),
808
+ }),
809
+ z.object({ event: z.object({ name: z.literal('clearSelectedPath'), context: z.unknown() }) }),
810
+ z.object({
811
+ event: z.object({
812
+ name: z.literal('search'),
813
+ context: z.strictObject({ query: z.string().max(256) }),
814
+ }),
815
+ }),
816
+ z.object({ event: z.object({ name: z.literal('showMoreSearchResults'), context: z.unknown() }) }),
817
+ z.object({ event: z.object({ name: z.literal('clearSearch'), context: z.unknown() }) }),
818
+ z.object({ event: z.object({ name: z.literal('showMoreValues'), context: z.unknown() }) }),
819
+ z.object({ event: z.object({ name: z.literal('showLessValues'), context: z.unknown() }) }),
820
+ ]);
821
+ export const CommerceSearchActionSchema = z.union([
822
+ z.object({
823
+ event: z.object({
824
+ name: z.literal('submitQuery'),
825
+ context: z.strictObject({ query: z.string() }),
826
+ }),
827
+ }),
828
+ z.object({
829
+ event: z.object({
830
+ name: z.literal('restoreState'),
831
+ context: z.strictObject({
832
+ query: z.string(),
833
+ page: z.number().int().min(0),
834
+ pageSize: z.number().int().min(1),
835
+ sortCriteria: z.string().optional(),
836
+ facets: z.array(z.unknown()).optional(),
837
+ pinnedProducts: z.array(z.string()).optional(),
838
+ }),
839
+ }),
840
+ }),
841
+ z.object({
842
+ event: z.object({
843
+ name: z.literal('overrideCorrection'),
844
+ context: z.strictObject({ originalQuery: z.string() }),
845
+ }),
846
+ }),
847
+ ]);
848
+ export const ComparisonTableActionSchema = z.never();
849
+ export const DateFacetActionSchema = z.union([
850
+ z.object({
851
+ event: z.object({
852
+ name: z.literal('toggleSelect'),
853
+ context: z.strictObject({ start: z.string(), end: z.string() }),
854
+ }),
855
+ }),
856
+ z.object({
857
+ event: z.object({
858
+ name: z.literal('toggleSingleSelect'),
859
+ context: z.strictObject({ start: z.string(), end: z.string() }),
860
+ }),
861
+ }),
862
+ z.object({ event: z.object({ name: z.literal('clearAllActiveValues'), context: z.unknown() }) }),
863
+ z.object({
864
+ event: z.object({
865
+ name: z.literal('applyCustomRange'),
866
+ context: z.strictObject({ start: z.string(), end: z.string() }),
867
+ }),
868
+ }),
869
+ z.object({ event: z.object({ name: z.literal('showMoreValues'), context: z.unknown() }) }),
870
+ z.object({ event: z.object({ name: z.literal('showLessValues'), context: z.unknown() }) }),
871
+ ]);
872
+ export const FacetManagerActionSchema = z.never();
873
+ export const LayoutStackActionSchema = z.never();
874
+ export const NextActionsBarActionSchema = z.union([
875
+ z.object({
876
+ event: z.object({
877
+ name: z.literal('selectAction'),
878
+ context: z.strictObject({ text: z.string(), type: z.enum(['followup', 'search']) }),
879
+ }),
880
+ }),
881
+ ]);
882
+ export const NumericFacetActionSchema = z.union([
883
+ z.object({
884
+ event: z.object({
885
+ name: z.literal('toggleSelect'),
886
+ context: z.strictObject({ start: z.number(), end: z.number() }),
887
+ }),
888
+ }),
889
+ z.object({
890
+ event: z.object({
891
+ name: z.literal('toggleSingleSelect'),
892
+ context: z.strictObject({ start: z.number(), end: z.number() }),
893
+ }),
894
+ }),
895
+ z.object({ event: z.object({ name: z.literal('clearAllActiveValues'), context: z.unknown() }) }),
896
+ z.object({
897
+ event: z.object({
898
+ name: z.literal('applyCustomRange'),
899
+ context: z.strictObject({ start: z.number(), end: z.number() }),
900
+ }),
901
+ }),
902
+ z.object({ event: z.object({ name: z.literal('showMoreValues'), context: z.unknown() }) }),
903
+ z.object({ event: z.object({ name: z.literal('showLessValues'), context: z.unknown() }) }),
904
+ ]);
905
+ export const PageSizeActionSchema = z.union([
906
+ z.object({
907
+ event: z.object({
908
+ name: z.literal('setPageSize'),
909
+ context: z.strictObject({ pageSize: z.number().int().min(1) }),
910
+ }),
911
+ }),
912
+ ]);
913
+ export const PaginationActionSchema = z.union([
914
+ z.object({
915
+ event: z.object({
916
+ name: z.literal('selectPage'),
917
+ context: z.strictObject({ page: z.number().int().min(0) }),
918
+ }),
919
+ }),
920
+ z.object({
921
+ event: z.object({
922
+ name: z.literal('setPageSize'),
923
+ context: z.strictObject({ pageSize: z.number().int().min(1) }),
924
+ }),
925
+ }),
926
+ z.object({ event: z.object({ name: z.literal('showMore'), context: z.strictObject({}) }) }),
927
+ ]);
928
+ export const ProductCarouselActionSchema = z.never();
929
+ export const ProductListActionSchema = z.union([
930
+ z.object({
931
+ event: z.object({
932
+ name: z.literal('selectProducts'),
933
+ context: z.strictObject({ productIds: z.array(z.string()) }),
934
+ }),
935
+ }),
936
+ z.object({
937
+ event: z.object({
938
+ name: z.literal('productClick'),
939
+ context: z.strictObject({
940
+ productId: z.string(),
941
+ name: z.string().optional(),
942
+ price: z.unknown().optional(),
943
+ position: z.number().int().min(0),
944
+ }),
945
+ }),
946
+ }),
947
+ ]);
948
+ export const ProductSummaryActionSchema = z.never();
949
+ export const QuerySuggestionsActionSchema = z.union([
950
+ z.object({
951
+ event: z.object({
952
+ name: z.literal('fetchSuggestions'),
953
+ context: z.strictObject({ query: z.string() }),
954
+ }),
955
+ }),
956
+ ]);
957
+ export const QuerySummaryActionSchema = z.never();
958
+ export const RegularFacetActionSchema = z.union([
959
+ z.object({
960
+ event: z.object({
961
+ name: z.literal('toggleSelect'),
962
+ context: z.strictObject({ value: z.string().max(1024) }),
963
+ }),
964
+ }),
965
+ z.object({
966
+ event: z.object({
967
+ name: z.literal('toggleExclude'),
968
+ context: z.strictObject({ value: z.string().max(1024) }),
969
+ }),
970
+ }),
971
+ z.object({
972
+ event: z.object({
973
+ name: z.literal('toggleSingleSelect'),
974
+ context: z.strictObject({ value: z.string().max(1024) }),
975
+ }),
976
+ }),
977
+ z.object({
978
+ event: z.object({
979
+ name: z.literal('toggleSingleExclude'),
980
+ context: z.strictObject({ value: z.string().max(1024) }),
981
+ }),
982
+ }),
983
+ z.object({ event: z.object({ name: z.literal('clearAllActiveValues'), context: z.unknown() }) }),
984
+ z.object({
985
+ event: z.object({
986
+ name: z.literal('search'),
987
+ context: z.strictObject({ query: z.string().max(1024) }),
988
+ }),
989
+ }),
990
+ z.object({ event: z.object({ name: z.literal('showMoreSearchResults'), context: z.unknown() }) }),
991
+ z.object({ event: z.object({ name: z.literal('clearSearch'), context: z.unknown() }) }),
992
+ z.object({ event: z.object({ name: z.literal('showMoreValues'), context: z.unknown() }) }),
993
+ z.object({ event: z.object({ name: z.literal('showLessValues'), context: z.unknown() }) }),
994
+ ]);
995
+ export const SortActionSchema = z.union([
996
+ z.object({
997
+ event: z.object({
998
+ name: z.literal('selectSort'),
999
+ context: z.strictObject({ sortCriteria: z.string(), fields: z.array(z.unknown()) }),
1000
+ }),
1001
+ }),
1002
+ ]);