@coveo/thermidor-schema 1.0.0-beta.7 → 1.0.0-beta.9

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.
@@ -118,6 +118,12 @@ export const ProductSummaryStateSchema = z.strictObject({
118
118
  categoryLabel: z.string(),
119
119
  product: z.union([ProductSchema, z.null()]),
120
120
  });
121
+ export const ProductResearchCardActionsSchema = z.strictObject({});
122
+ export const ProductResearchCardStateSchema = z.strictObject({
123
+ bullets: z.array(z.string().min(1)).min(1),
124
+ product: ProductSchema,
125
+ summary: z.string().min(1),
126
+ });
121
127
  export const SelectPagePayloadSchema = z.strictObject({
122
128
  page: z.number().int().min(0),
123
129
  });
@@ -312,6 +318,12 @@ export const ProductSummarySchema = z.looseObject({
312
318
  id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
313
319
  state: ProductSummaryStateSchema.optional(),
314
320
  });
321
+ export const ProductResearchCardSchema = z.looseObject({
322
+ actions: ProductResearchCardActionsSchema.optional(),
323
+ component: z.literal('ProductResearchCard'),
324
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
325
+ state: ProductResearchCardStateSchema.optional(),
326
+ });
315
327
  export const SelectPageSchema = z.strictObject({
316
328
  payload: SelectPagePayloadSchema,
317
329
  });
@@ -622,6 +634,7 @@ export const ComponentContractsSchema = z.discriminatedUnion('component', [
622
634
  ComparisonTableSchema,
623
635
  ProductListSchema,
624
636
  ProductSummarySchema,
637
+ ProductResearchCardSchema,
625
638
  PaginationSchema,
626
639
  SortSchema,
627
640
  RegularFacetSchema,
@@ -645,8 +658,11 @@ export const ComponentContractsSchema = z.discriminatedUnion('component', [
645
658
  * ComponentId / ChildList), so it is not re-declared here; the unions below reference it.
646
659
  */
647
660
  export const FunctionCallSchema = z.object({
648
- functionName: z.string(),
649
- args: z.array(z.unknown()).optional(),
661
+ call: z.string(),
662
+ args: z.record(z.string(), z.any()),
663
+ returnType: z
664
+ .enum(['string', 'number', 'boolean', 'array', 'object', 'any', 'void'])
665
+ .default('boolean'),
650
666
  });
651
667
  export const DynamicNumberSchema = z.union([z.number(), DataBindingSchema, FunctionCallSchema]);
652
668
  export const DynamicStringSchema = z.union([z.string(), DataBindingSchema, FunctionCallSchema]);
@@ -676,16 +692,24 @@ export const DynamicActionSchema = z.object({
676
692
  * untouched. The resolved shape a renderer actually reads is the `XxxProps` type.
677
693
  */
678
694
  export const BundleDisplayPropsSchema = z.object({
679
- tiers: DynamicValueSchema,
695
+ tiers: z.union([BundleDisplayStateSchema.shape['tiers'], DataBindingSchema, FunctionCallSchema]),
680
696
  });
681
697
  export const CartPropsSchema = z.object({});
682
698
  export const CategoryFacetPropsSchema = z.object({
683
699
  field: DynamicStringSchema,
684
700
  displayName: DynamicStringSchema,
685
- values: DynamicValueSchema,
701
+ values: z.union([
702
+ CategoryFacetStateSchema.shape['values'],
703
+ DataBindingSchema,
704
+ FunctionCallSchema,
705
+ ]),
686
706
  canShowMoreValues: DynamicBooleanSchema,
687
707
  canShowLessValues: DynamicBooleanSchema,
688
- facetSearch: DynamicValueSchema,
708
+ facetSearch: z.union([
709
+ CategoryFacetStateSchema.shape['facetSearch'],
710
+ DataBindingSchema,
711
+ FunctionCallSchema,
712
+ ]),
689
713
  });
690
714
  export const CommerceSearchPropsSchema = z.object({
691
715
  sidebarChild: z.string().optional(),
@@ -694,14 +718,26 @@ export const CommerceSearchPropsSchema = z.object({
694
718
  export const ComparisonTablePropsSchema = z.object({
695
719
  heading: DynamicStringSchema,
696
720
  summary: DynamicStringSchema,
697
- products: DynamicValueSchema,
698
- attributes: DynamicValueSchema,
721
+ products: z.union([
722
+ ComparisonTableStateSchema.shape['products'],
723
+ DataBindingSchema,
724
+ FunctionCallSchema,
725
+ ]),
726
+ attributes: z.union([
727
+ ComparisonTableStateSchema.shape['attributes'],
728
+ DataBindingSchema,
729
+ FunctionCallSchema,
730
+ ]),
699
731
  });
700
732
  export const DateFacetPropsSchema = z.object({
701
733
  field: DynamicStringSchema,
702
734
  displayName: DynamicStringSchema,
703
- values: DynamicValueSchema,
704
- customRange: DynamicValueSchema,
735
+ values: z.union([DateFacetStateSchema.shape['values'], DataBindingSchema, FunctionCallSchema]),
736
+ customRange: z.union([
737
+ DateFacetStateSchema.shape['customRange'],
738
+ DataBindingSchema,
739
+ FunctionCallSchema,
740
+ ]),
705
741
  hasActiveValues: DynamicBooleanSchema,
706
742
  canShowMoreValues: DynamicBooleanSchema,
707
743
  canShowLessValues: DynamicBooleanSchema,
@@ -714,17 +750,25 @@ export const LayoutStackPropsSchema = z.object({
714
750
  children: z.array(z.string()).optional(),
715
751
  });
716
752
  export const NextActionsBarPropsSchema = z.object({
717
- suggestedActions: DynamicValueSchema,
753
+ suggestedActions: z.union([
754
+ NextActionsStateSchema.shape['suggestedActions'],
755
+ DataBindingSchema,
756
+ FunctionCallSchema,
757
+ ]),
718
758
  });
719
759
  export const NumericFacetPropsSchema = z.object({
720
760
  field: DynamicStringSchema,
721
761
  displayName: DynamicStringSchema,
722
- values: DynamicValueSchema,
723
- customRange: DynamicValueSchema,
762
+ values: z.union([NumericFacetStateSchema.shape['values'], DataBindingSchema, FunctionCallSchema]),
763
+ customRange: z.union([
764
+ NumericFacetStateSchema.shape['customRange'],
765
+ DataBindingSchema,
766
+ FunctionCallSchema,
767
+ ]),
724
768
  hasActiveValues: DynamicBooleanSchema,
725
769
  canShowMoreValues: DynamicBooleanSchema,
726
770
  canShowLessValues: DynamicBooleanSchema,
727
- domain: DynamicValueSchema,
771
+ domain: z.union([NumericFacetStateSchema.shape['domain'], DataBindingSchema, FunctionCallSchema]),
728
772
  });
729
773
  export const PageSizePropsSchema = z.object({
730
774
  pageSize: DynamicNumberSchema,
@@ -737,19 +781,48 @@ export const PaginationPropsSchema = z.object({
737
781
  });
738
782
  export const ProductCarouselPropsSchema = z.object({
739
783
  heading: DynamicStringSchema,
740
- products: DynamicValueSchema,
784
+ products: z.union([
785
+ ProductCarouselStateSchema.shape['products'],
786
+ DataBindingSchema,
787
+ FunctionCallSchema,
788
+ ]),
741
789
  });
742
790
  export const ProductListPropsSchema = z.object({
743
- products: DynamicValueSchema,
791
+ products: z.union([
792
+ ProductListStateSchema.shape['products'],
793
+ DataBindingSchema,
794
+ FunctionCallSchema,
795
+ ]),
796
+ });
797
+ export const ProductResearchCardPropsSchema = z.object({
798
+ product: z.union([
799
+ ProductResearchCardStateSchema.shape['product'],
800
+ DataBindingSchema,
801
+ FunctionCallSchema,
802
+ ]),
803
+ summary: DynamicStringSchema,
804
+ bullets: DynamicStringListSchema,
744
805
  });
745
806
  export const ProductSummaryPropsSchema = z.object({
746
807
  categoryLabel: DynamicStringSchema,
747
- product: DynamicValueSchema,
808
+ product: z.union([
809
+ ProductSummaryStateSchema.shape['product'],
810
+ DataBindingSchema,
811
+ FunctionCallSchema,
812
+ ]),
748
813
  });
749
814
  export const QuerySuggestionsPropsSchema = z.object({
750
815
  query: DynamicStringSchema,
751
- completions: DynamicValueSchema,
752
- products: DynamicValueSchema,
816
+ completions: z.union([
817
+ QuerySuggestionsStateSchema.shape['completions'],
818
+ DataBindingSchema,
819
+ FunctionCallSchema,
820
+ ]),
821
+ products: z.union([
822
+ QuerySuggestionsStateSchema.shape['products'],
823
+ DataBindingSchema,
824
+ FunctionCallSchema,
825
+ ]),
753
826
  });
754
827
  export const QuerySummaryPropsSchema = z.object({
755
828
  query: DynamicStringSchema,
@@ -760,15 +833,27 @@ export const QuerySummaryPropsSchema = z.object({
760
833
  export const RegularFacetPropsSchema = z.object({
761
834
  field: DynamicStringSchema,
762
835
  displayName: DynamicStringSchema,
763
- values: DynamicValueSchema,
836
+ values: z.union([RegularFacetStateSchema.shape['values'], DataBindingSchema, FunctionCallSchema]),
764
837
  hasActiveValues: DynamicBooleanSchema,
765
838
  canShowMoreValues: DynamicBooleanSchema,
766
839
  canShowLessValues: DynamicBooleanSchema,
767
- facetSearch: DynamicValueSchema,
840
+ facetSearch: z.union([
841
+ RegularFacetStateSchema.shape['facetSearch'],
842
+ DataBindingSchema,
843
+ FunctionCallSchema,
844
+ ]),
768
845
  });
769
846
  export const SortPropsSchema = z.object({
770
- appliedSort: DynamicValueSchema,
771
- availableSorts: DynamicValueSchema,
847
+ appliedSort: z.union([
848
+ SortStateSchema.shape['appliedSort'],
849
+ DataBindingSchema,
850
+ FunctionCallSchema,
851
+ ]),
852
+ availableSorts: z.union([
853
+ SortStateSchema.shape['availableSorts'],
854
+ DataBindingSchema,
855
+ FunctionCallSchema,
856
+ ]),
772
857
  });
773
858
  /**
774
859
  * Per-component action unions in the standard A2-UI event shape
@@ -942,6 +1027,7 @@ export const ProductListActionSchema = z.union([
942
1027
  }),
943
1028
  }),
944
1029
  ]);
1030
+ export const ProductResearchCardActionSchema = z.never();
945
1031
  export const ProductSummaryActionSchema = z.never();
946
1032
  export const QuerySuggestionsActionSchema = z.union([
947
1033
  z.object({