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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  // This file is generated from the canonical JSON Schema documents.
2
2
  // Do not edit it directly; run `mise run generate` from the repository root.
3
3
  import * as z from 'zod/v4';
4
+ export const CartUpdateOperationSchema = z.enum(['add', 'remove', 'setQuantity']);
4
5
  // The kind of action: "followup" triggers a conversational follow-up, "search" triggers a
5
6
  // standalone search.
6
7
  //
@@ -42,6 +43,31 @@ export const ProductCarouselStateSchema = z.strictObject({
42
43
  heading: z.string(),
43
44
  products: z.array(ProductSchema),
44
45
  });
46
+ export const PurchaseProductSchema = z.strictObject({
47
+ name: z.string().optional(),
48
+ price: z.union([z.number(), z.null()]).optional(),
49
+ productId: z.string().min(1),
50
+ quantity: z.number().int().min(1),
51
+ });
52
+ export const TransactionSchema = z.strictObject({
53
+ id: z.string().min(1),
54
+ revenue: z.number(),
55
+ });
56
+ export const UpdateCartPayloadSchema = z.strictObject({
57
+ name: z.string().optional(),
58
+ operation: z.enum(['add', 'remove', 'setQuantity']),
59
+ price: z.union([z.number(), z.null()]).optional(),
60
+ productId: z.string().min(1),
61
+ quantity: z.number().int().min(1),
62
+ });
63
+ export const CartStateSchema = z.strictObject({});
64
+ export const FetchSuggestionsPayloadSchema = z.strictObject({
65
+ query: z.string(),
66
+ });
67
+ export const QueryCompletionSchema = z.strictObject({
68
+ expression: z.string(),
69
+ score: z.number().optional(),
70
+ });
45
71
  export const SelectActionPayloadSchema = z.strictObject({
46
72
  text: z.string(),
47
73
  type: z.enum(['followup', 'search']),
@@ -68,7 +94,15 @@ export const ComparisonProductSchema = z.strictObject({
68
94
  rating: z.number().min(0).max(5).optional(),
69
95
  values: z.record(z.string(), z.string()).optional(),
70
96
  });
71
- export const ProductListActionsSchema = z.strictObject({});
97
+ export const ProductClickPayloadSchema = z.strictObject({
98
+ name: z.string().optional(),
99
+ position: z.number().int().min(0),
100
+ price: z.union([z.number(), z.null()]).optional(),
101
+ productId: z.string().min(1),
102
+ });
103
+ export const SelectProductsPayloadSchema = z.strictObject({
104
+ productIds: z.array(z.string().min(1)),
105
+ });
72
106
  export const ProductListStateSchema = z.strictObject({
73
107
  products: z.array(ProductSchema),
74
108
  });
@@ -83,6 +117,7 @@ export const SelectPagePayloadSchema = z.strictObject({
83
117
  export const PayloadSchema = z.strictObject({
84
118
  pageSize: z.number().int().min(1),
85
119
  });
120
+ export const ShowMorePayloadSchema = z.strictObject({});
86
121
  export const PaginationStateSchema = z.strictObject({
87
122
  page: z.number().int().min(0),
88
123
  pageSize: z.number().int().min(1),
@@ -192,6 +227,14 @@ export const CategoryFacetValuesSchema = z.strictObject({
192
227
  });
193
228
  export const FacetManagerActionsSchema = z.strictObject({});
194
229
  export const FacetManagerStateSchema = z.strictObject({});
230
+ export const OverrideCorrectionPayloadSchema = z.strictObject({
231
+ originalQuery: z.string().min(1),
232
+ });
233
+ export const NumericRangeRestoreSchema = z.strictObject({
234
+ end: z.number(),
235
+ endInclusive: z.boolean().optional(),
236
+ start: z.number(),
237
+ });
195
238
  export const SubmitQueryPayloadSchema = z.strictObject({
196
239
  query: z.string(),
197
240
  });
@@ -221,6 +264,21 @@ export const ProductCarouselSchema = z.strictObject({
221
264
  componentType: z.literal('product-carousel'),
222
265
  state: ProductCarouselStateSchema,
223
266
  });
267
+ export const PurchasePayloadSchema = z.strictObject({
268
+ products: z.array(PurchaseProductSchema),
269
+ transaction: TransactionSchema,
270
+ });
271
+ export const UpdateCartSchema = z.strictObject({
272
+ payload: UpdateCartPayloadSchema,
273
+ });
274
+ export const FetchSuggestionsSchema = z.strictObject({
275
+ payload: FetchSuggestionsPayloadSchema,
276
+ });
277
+ export const QuerySuggestionsStateSchema = z.strictObject({
278
+ completions: z.array(QueryCompletionSchema),
279
+ products: z.array(ProductSchema),
280
+ query: z.string(),
281
+ });
224
282
  export const SelectActionSchema = z.strictObject({
225
283
  payload: SelectActionPayloadSchema,
226
284
  });
@@ -238,15 +296,11 @@ export const ComparisonTableStateSchema = z.strictObject({
238
296
  products: z.array(ComparisonProductSchema),
239
297
  summary: z.string(),
240
298
  });
241
- export const ProductListSchema = z.strictObject({
242
- actions: ProductListActionsSchema,
243
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
244
- children: z
245
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
246
- .max(1000)
247
- .optional(),
248
- componentType: z.literal('product-list'),
249
- state: ProductListStateSchema,
299
+ export const ProductClickSchema = z.strictObject({
300
+ payload: ProductClickPayloadSchema,
301
+ });
302
+ export const SelectProductsSchema = z.strictObject({
303
+ payload: SelectProductsPayloadSchema,
250
304
  });
251
305
  export const ProductSummarySchema = z.strictObject({
252
306
  actions: ProductSummaryActionsSchema,
@@ -264,6 +318,9 @@ export const SelectPageSchema = z.strictObject({
264
318
  export const PurpleSetPageSizeSchema = z.strictObject({
265
319
  payload: PayloadSchema,
266
320
  });
321
+ export const ShowMoreSchema = z.strictObject({
322
+ payload: ShowMorePayloadSchema,
323
+ });
267
324
  export const SelectSortSchema = z.strictObject({
268
325
  payload: SelectSortPayloadSchema,
269
326
  });
@@ -349,6 +406,14 @@ export const FacetManagerSchema = z.strictObject({
349
406
  componentType: z.literal('facet-manager'),
350
407
  state: FacetManagerStateSchema,
351
408
  });
409
+ export const OverrideCorrectionSchema = z.strictObject({
410
+ payload: OverrideCorrectionPayloadSchema,
411
+ });
412
+ export const FacetRestoreSchema = z.strictObject({
413
+ facetId: z.string().min(1),
414
+ numericRanges: z.array(NumericRangeRestoreSchema).optional(),
415
+ values: z.array(z.string()).optional(),
416
+ });
352
417
  export const SubmitQuerySchema = z.strictObject({
353
418
  payload: SubmitQueryPayloadSchema,
354
419
  });
@@ -375,6 +440,12 @@ export const QuerySummarySchema = z.strictObject({
375
440
  export const FluffySetPageSizeSchema = z.strictObject({
376
441
  payload: SetPageSizePayloadSchema,
377
442
  });
443
+ export const PurchaseSchema = z.strictObject({
444
+ payload: PurchasePayloadSchema,
445
+ });
446
+ export const QuerySuggestionsActionsSchema = z.strictObject({
447
+ fetchSuggestions: FetchSuggestionsSchema,
448
+ });
378
449
  export const NextActionsBarActionsSchema = z.strictObject({
379
450
  selectAction: SelectActionSchema,
380
451
  });
@@ -391,9 +462,14 @@ export const ComparisonTableSchema = z.strictObject({
391
462
  componentType: z.literal('comparison-table'),
392
463
  state: ComparisonTableStateSchema,
393
464
  });
465
+ export const ProductListActionsSchema = z.strictObject({
466
+ productClick: ProductClickSchema,
467
+ selectProducts: SelectProductsSchema,
468
+ });
394
469
  export const PaginationActionsSchema = z.strictObject({
395
470
  selectPage: SelectPageSchema,
396
471
  setPageSize: PurpleSetPageSizeSchema,
472
+ showMore: ShowMoreSchema,
397
473
  });
398
474
  export const SortActionsSchema = z.strictObject({
399
475
  selectSort: SelectSortSchema,
@@ -452,12 +528,31 @@ export const CategoryFacetStateSchema = z.strictObject({
452
528
  field: z.string(),
453
529
  values: CategoryFacetValuesSchema,
454
530
  });
455
- export const CommerceSearchActionsSchema = z.strictObject({
456
- submitQuery: SubmitQuerySchema,
531
+ export const RestoreStatePayloadSchema = z.strictObject({
532
+ facets: z.array(FacetRestoreSchema).optional(),
533
+ page: z.number().int().min(0),
534
+ pageSize: z.number().int().min(1),
535
+ pinnedProducts: z.array(z.string()).optional(),
536
+ query: z.string(),
537
+ sortCriteria: z.string().optional(),
457
538
  });
458
539
  export const PageSizeActionsSchema = z.strictObject({
459
540
  setPageSize: FluffySetPageSizeSchema,
460
541
  });
542
+ export const CartActionsSchema = z.strictObject({
543
+ purchase: PurchaseSchema,
544
+ updateCart: UpdateCartSchema,
545
+ });
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
+ });
461
556
  export const NextActionsBarSchema = z.strictObject({
462
557
  actions: NextActionsBarActionsSchema,
463
558
  child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
@@ -478,6 +573,16 @@ export const BundleDisplaySchema = z.strictObject({
478
573
  componentType: z.literal('bundle-display'),
479
574
  state: BundleDisplayStateSchema,
480
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
+ });
481
586
  export const PaginationSchema = z.strictObject({
482
587
  actions: PaginationActionsSchema,
483
588
  child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
@@ -538,28 +643,48 @@ export const CategoryFacetSchema = z.strictObject({
538
643
  componentType: z.literal('category-facet'),
539
644
  state: CategoryFacetStateSchema,
540
645
  });
541
- export const CommerceSearchSchema = z.strictObject({
542
- actions: CommerceSearchActionsSchema,
646
+ export const RestoreStateSchema = z.strictObject({
647
+ payload: RestoreStatePayloadSchema,
648
+ });
649
+ export const PageSizeSchema = z.strictObject({
650
+ actions: PageSizeActionsSchema,
543
651
  child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
544
652
  children: z
545
653
  .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
546
654
  .max(1000)
547
655
  .optional(),
548
- componentType: z.literal('commerce-search'),
549
- state: CommerceSearchStateSchema,
656
+ componentType: z.literal('page-size'),
657
+ state: PageSizeStateSchema,
550
658
  });
551
- export const PageSizeSchema = z.strictObject({
552
- actions: PageSizeActionsSchema,
659
+ export const CartSchema = z.strictObject({
660
+ actions: CartActionsSchema,
553
661
  child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
554
662
  children: z
555
663
  .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
556
664
  .max(1000)
557
665
  .optional(),
558
- componentType: z.literal('page-size'),
559
- state: PageSizeStateSchema,
666
+ componentType: z.literal('cart'),
667
+ state: CartStateSchema,
668
+ });
669
+ export const CommerceSearchActionsSchema = z.strictObject({
670
+ overrideCorrection: OverrideCorrectionSchema,
671
+ restoreState: RestoreStateSchema,
672
+ submitQuery: SubmitQuerySchema,
673
+ });
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,
560
683
  });
561
684
  export const ComponentContractsSchema = z.discriminatedUnion('componentType', [
562
685
  ProductCarouselSchema,
686
+ CartSchema,
687
+ QuerySuggestionsSchema,
563
688
  NextActionsBarSchema,
564
689
  BundleDisplaySchema,
565
690
  ComparisonTableSchema,
@@ -587,6 +712,10 @@ export const BundleDisplayPropsSchema = z.object({
587
712
  componentId: z.string(),
588
713
  componentType: z.literal('bundle-display'),
589
714
  });
715
+ export const CartPropsSchema = z.object({
716
+ componentId: z.string(),
717
+ componentType: z.literal('cart'),
718
+ });
590
719
  export const CategoryFacetPropsSchema = z.object({
591
720
  componentId: z.string(),
592
721
  componentType: z.literal('category-facet'),
@@ -639,6 +768,10 @@ export const ProductSummaryPropsSchema = z.object({
639
768
  componentId: z.string(),
640
769
  componentType: z.literal('product-summary'),
641
770
  });
771
+ export const QuerySuggestionsPropsSchema = z.object({
772
+ componentId: z.string(),
773
+ componentType: z.literal('query-suggestions'),
774
+ });
642
775
  export const QuerySummaryPropsSchema = z.object({
643
776
  componentId: z.string(),
644
777
  componentType: z.literal('query-summary'),
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export declare const THERMIDOR_CATALOG_ID = "https://schema.thermidor.coveo.com/a2-ui/catalog.json";
2
- export { ActionItemSchema, BundleDisplaySchema, BundleDisplayStateSchema, BundleSlotSchema, BundleTierSchema, CategoryFacetSchema, CategoryFacetActionsSchema, CategoryFacetValueSchema, CategoryFacetSearchSchema, CategoryFacetSearchPayloadSchema, CategoryFacetSelectPathPayloadSchema, CategoryFacetStateSchema, CategoryFacetValuesSchema, CommerceSearchSchema, CommerceSearchActionsSchema, CommerceSearchStateSchema, SubmitQuerySchema, SubmitQueryPayloadSchema, ComparisonAttributeSchema, ComparisonProductSchema, ComparisonTableSchema, ComparisonTableStateSchema, ComponentContractsSchema, DateFacetSchema, DateFacetActionsSchema, DateFacetApplyCustomRangePayloadSchema, DateFacetCustomRangeSchema, DateFacetStateSchema, DateFacetToggleSelectPayloadSchema, DateFacetToggleSingleSelectPayloadSchema, DateFacetValueSchema, FacetManagerSchema, FacetManagerActionsSchema, FacetManagerStateSchema, FacetValueStateSchema, SelectableFacetValueStateSchema, LayoutStackSchema, LayoutStackStateSchema, NextActionsBarSchema, NextActionsStateSchema, NumericFacetSchema, NumericFacetActionsSchema, NumericFacetCustomRangeSchema, NumericFacetDomainSchema, NumericFacetApplyCustomRangePayloadSchema, NumericFacetStateSchema, NumericFacetToggleSelectPayloadSchema, NumericFacetToggleSingleSelectPayloadSchema, NumericFacetValueSchema, PageSizeSchema, PageSizeActionsSchema, PageSizeStateSchema, PaginationSchema, PaginationActionsSchema, PaginationStateSchema, ProductCarouselSchema, ProductCarouselStateSchema, ProductListSchema, ProductListActionsSchema, ProductListStateSchema, ProductSummarySchema, ProductSummaryActionsSchema, ProductSummaryStateSchema, QuerySummarySchema, QuerySummaryStateSchema, ProductSchema, RegularFacetSchema, RegularFacetActionsSchema, RegularFacetSearchSchema, RegularFacetSearchResultSchema, RegularFacetStateSchema, RegularFacetToggleExcludePayloadSchema, RegularFacetToggleSelectPayloadSchema, RegularFacetToggleSingleExcludePayloadSchema, RegularFacetToggleSingleSelectPayloadSchema, RegularFacetValueSchema, SelectActionPayloadSchema, SelectPagePayloadSchema, SelectSortPayloadSchema, SetPageSizePayloadSchema, SortSchema, SortActionsSchema, SortCriterionSchema, SortStateSchema, BundleDisplayPropsSchema, CategoryFacetPropsSchema, CommerceSearchPropsSchema, ComparisonTablePropsSchema, DateFacetPropsSchema, FacetManagerPropsSchema, LayoutStackPropsSchema, NextActionsBarPropsSchema, NumericFacetPropsSchema, PageSizePropsSchema, PaginationPropsSchema, ProductCarouselPropsSchema, ProductListPropsSchema, ProductSummaryPropsSchema, QuerySummaryPropsSchema, RegularFacetPropsSchema, SortPropsSchema, } from './generated/schemas.js';
3
- export type { ActionItem, BundleDisplay, BundleDisplayState, BundleSlot, BundleTier, CategoryFacet, CategoryFacetActions, CategoryFacetValue, CategoryFacetSearch, CategoryFacetSearchPayload, CategoryFacetSelectPathPayload, CategoryFacetState, CategoryFacetValues, CommerceSearch, CommerceSearchActions, CommerceSearchState, SubmitQuery, SubmitQueryPayload, ComparisonAttribute, ComparisonProduct, ComparisonTable, ComparisonTableState, ComponentContracts, DateFacet, DateFacetActions, DateFacetApplyCustomRangePayload, DateFacetCustomRange, DateFacetState, DateFacetToggleSelectPayload, DateFacetToggleSingleSelectPayload, DateFacetValue, FacetManager, FacetManagerActions, FacetManagerState, FacetValueState, SelectableFacetValueState, LayoutStack, LayoutStackState, NextActionsBar, NextActionsState, NumericFacet, NumericFacetActions, NumericFacetCustomRange, NumericFacetDomain, NumericFacetApplyCustomRangePayload, NumericFacetState, NumericFacetToggleSelectPayload, NumericFacetToggleSingleSelectPayload, NumericFacetValue, PageSize, PageSizeActions, PageSizeState, Pagination, PaginationActions, PaginationState, Product, ProductCarousel, ProductCarouselState, ProductList, ProductListActions, ProductListState, ProductSummary, ProductSummaryActions, ProductSummaryState, QuerySummary, QuerySummaryState, RegularFacet, RegularFacetActions, RegularFacetSearch, RegularFacetSearchResult, RegularFacetState, RegularFacetToggleExcludePayload, RegularFacetToggleSelectPayload, RegularFacetToggleSingleExcludePayload, RegularFacetToggleSingleSelectPayload, RegularFacetValue, SelectActionPayload, SelectPagePayload, SelectSortPayload, SetPageSizePayload, Sort, SortActions, SortCriterion, SortState, BundleDisplayProps, CategoryFacetProps, CommerceSearchProps, ComparisonTableProps, DateFacetProps, FacetManagerProps, LayoutStackProps, NextActionsBarProps, NumericFacetProps, PageSizeProps, PaginationProps, ProductCarouselProps, ProductListProps, ProductSummaryProps, QuerySummaryProps, RegularFacetProps, SortProps, } from './generated/schemas.js';
2
+ export { ActionItemSchema, CartSchema, CartActionsSchema, CartStateSchema, UpdateCartSchema, UpdateCartPayloadSchema, CartUpdateOperationSchema, PurchaseSchema, PurchasePayloadSchema, PurchaseProductSchema, TransactionSchema, QuerySuggestionsSchema, QuerySuggestionsActionsSchema, QuerySuggestionsStateSchema, QueryCompletionSchema, FetchSuggestionsSchema, FetchSuggestionsPayloadSchema, RestoreStateSchema, RestoreStatePayloadSchema, FacetRestoreSchema, NumericRangeRestoreSchema, OverrideCorrectionSchema, OverrideCorrectionPayloadSchema, ShowMoreSchema, ShowMorePayloadSchema, SelectProductsSchema, SelectProductsPayloadSchema, ProductClickSchema, ProductClickPayloadSchema, BundleDisplaySchema, BundleDisplayStateSchema, BundleSlotSchema, BundleTierSchema, CategoryFacetSchema, CategoryFacetActionsSchema, CategoryFacetValueSchema, CategoryFacetSearchSchema, CategoryFacetSearchPayloadSchema, CategoryFacetSelectPathPayloadSchema, CategoryFacetStateSchema, CategoryFacetValuesSchema, CommerceSearchSchema, CommerceSearchActionsSchema, CommerceSearchStateSchema, SubmitQuerySchema, SubmitQueryPayloadSchema, ComparisonAttributeSchema, ComparisonProductSchema, ComparisonTableSchema, ComparisonTableStateSchema, ComponentContractsSchema, DateFacetSchema, DateFacetActionsSchema, DateFacetApplyCustomRangePayloadSchema, DateFacetCustomRangeSchema, DateFacetStateSchema, DateFacetToggleSelectPayloadSchema, DateFacetToggleSingleSelectPayloadSchema, DateFacetValueSchema, FacetManagerSchema, FacetManagerActionsSchema, FacetManagerStateSchema, FacetValueStateSchema, SelectableFacetValueStateSchema, LayoutStackSchema, LayoutStackStateSchema, NextActionsBarSchema, NextActionsStateSchema, NumericFacetSchema, NumericFacetActionsSchema, NumericFacetCustomRangeSchema, NumericFacetDomainSchema, NumericFacetApplyCustomRangePayloadSchema, NumericFacetStateSchema, NumericFacetToggleSelectPayloadSchema, NumericFacetToggleSingleSelectPayloadSchema, NumericFacetValueSchema, PageSizeSchema, PageSizeActionsSchema, PageSizeStateSchema, PaginationSchema, PaginationActionsSchema, PaginationStateSchema, ProductCarouselSchema, ProductCarouselStateSchema, ProductListSchema, ProductListActionsSchema, ProductListStateSchema, ProductSummarySchema, ProductSummaryActionsSchema, ProductSummaryStateSchema, QuerySummarySchema, QuerySummaryStateSchema, ProductSchema, RegularFacetSchema, RegularFacetActionsSchema, RegularFacetSearchSchema, RegularFacetSearchResultSchema, RegularFacetStateSchema, RegularFacetToggleExcludePayloadSchema, RegularFacetToggleSelectPayloadSchema, RegularFacetToggleSingleExcludePayloadSchema, RegularFacetToggleSingleSelectPayloadSchema, RegularFacetValueSchema, SelectActionPayloadSchema, SelectPagePayloadSchema, SelectSortPayloadSchema, SetPageSizePayloadSchema, SortSchema, SortActionsSchema, SortCriterionSchema, SortStateSchema, BundleDisplayPropsSchema, CategoryFacetPropsSchema, CommerceSearchPropsSchema, ComparisonTablePropsSchema, DateFacetPropsSchema, FacetManagerPropsSchema, LayoutStackPropsSchema, NextActionsBarPropsSchema, NumericFacetPropsSchema, PageSizePropsSchema, PaginationPropsSchema, ProductCarouselPropsSchema, ProductListPropsSchema, ProductSummaryPropsSchema, QuerySummaryPropsSchema, RegularFacetPropsSchema, SortPropsSchema, } from './generated/schemas.js';
3
+ export type { ActionItem, Cart, CartActions, CartState, UpdateCart, UpdateCartPayload, CartUpdateOperation, Purchase, PurchasePayload, PurchaseProduct, Transaction, QuerySuggestions, QuerySuggestionsActions, QuerySuggestionsState, QueryCompletion, FetchSuggestions, FetchSuggestionsPayload, RestoreState, RestoreStatePayload, FacetRestore, NumericRangeRestore, OverrideCorrection, OverrideCorrectionPayload, ShowMore, ShowMorePayload, SelectProducts, SelectProductsPayload, ProductClick, ProductClickPayload, BundleDisplay, BundleDisplayState, BundleSlot, BundleTier, CategoryFacet, CategoryFacetActions, CategoryFacetValue, CategoryFacetSearch, CategoryFacetSearchPayload, CategoryFacetSelectPathPayload, CategoryFacetState, CategoryFacetValues, CommerceSearch, CommerceSearchActions, CommerceSearchState, SubmitQuery, SubmitQueryPayload, ComparisonAttribute, ComparisonProduct, ComparisonTable, ComparisonTableState, ComponentContracts, DateFacet, DateFacetActions, DateFacetApplyCustomRangePayload, DateFacetCustomRange, DateFacetState, DateFacetToggleSelectPayload, DateFacetToggleSingleSelectPayload, DateFacetValue, FacetManager, FacetManagerActions, FacetManagerState, FacetValueState, SelectableFacetValueState, LayoutStack, LayoutStackState, NextActionsBar, NextActionsState, NumericFacet, NumericFacetActions, NumericFacetCustomRange, NumericFacetDomain, NumericFacetApplyCustomRangePayload, NumericFacetState, NumericFacetToggleSelectPayload, NumericFacetToggleSingleSelectPayload, NumericFacetValue, PageSize, PageSizeActions, PageSizeState, Pagination, PaginationActions, PaginationState, Product, ProductCarousel, ProductCarouselState, ProductList, ProductListActions, ProductListState, ProductSummary, ProductSummaryActions, ProductSummaryState, QuerySummary, QuerySummaryState, RegularFacet, RegularFacetActions, RegularFacetSearch, RegularFacetSearchResult, RegularFacetState, RegularFacetToggleExcludePayload, RegularFacetToggleSelectPayload, RegularFacetToggleSingleExcludePayload, RegularFacetToggleSingleSelectPayload, RegularFacetValue, SelectActionPayload, SelectPagePayload, SelectSortPayload, SetPageSizePayload, Sort, SortActions, SortCriterion, SortState, BundleDisplayProps, CategoryFacetProps, CommerceSearchProps, ComparisonTableProps, DateFacetProps, FacetManagerProps, LayoutStackProps, NextActionsBarProps, NumericFacetProps, PageSizeProps, PaginationProps, ProductCarouselProps, ProductListProps, ProductSummaryProps, QuerySummaryProps, RegularFacetProps, SortProps, } from './generated/schemas.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const THERMIDOR_CATALOG_ID = 'https://schema.thermidor.coveo.com/a2-ui/catalog.json';
2
- export { ActionItemSchema, BundleDisplaySchema, BundleDisplayStateSchema, BundleSlotSchema, BundleTierSchema, CategoryFacetSchema, CategoryFacetActionsSchema, CategoryFacetValueSchema, CategoryFacetSearchSchema, CategoryFacetSearchPayloadSchema, CategoryFacetSelectPathPayloadSchema, CategoryFacetStateSchema, CategoryFacetValuesSchema, CommerceSearchSchema, CommerceSearchActionsSchema, CommerceSearchStateSchema, SubmitQuerySchema, SubmitQueryPayloadSchema, ComparisonAttributeSchema, ComparisonProductSchema, ComparisonTableSchema, ComparisonTableStateSchema, ComponentContractsSchema, DateFacetSchema, DateFacetActionsSchema, DateFacetApplyCustomRangePayloadSchema, DateFacetCustomRangeSchema, DateFacetStateSchema, DateFacetToggleSelectPayloadSchema, DateFacetToggleSingleSelectPayloadSchema, DateFacetValueSchema, FacetManagerSchema, FacetManagerActionsSchema, FacetManagerStateSchema, FacetValueStateSchema, SelectableFacetValueStateSchema, LayoutStackSchema, LayoutStackStateSchema, NextActionsBarSchema, NextActionsStateSchema, NumericFacetSchema, NumericFacetActionsSchema, NumericFacetCustomRangeSchema, NumericFacetDomainSchema, NumericFacetApplyCustomRangePayloadSchema, NumericFacetStateSchema, NumericFacetToggleSelectPayloadSchema, NumericFacetToggleSingleSelectPayloadSchema, NumericFacetValueSchema, PageSizeSchema, PageSizeActionsSchema, PageSizeStateSchema, PaginationSchema, PaginationActionsSchema, PaginationStateSchema, ProductCarouselSchema, ProductCarouselStateSchema, ProductListSchema, ProductListActionsSchema, ProductListStateSchema, ProductSummarySchema, ProductSummaryActionsSchema, ProductSummaryStateSchema, QuerySummarySchema, QuerySummaryStateSchema, ProductSchema, RegularFacetSchema, RegularFacetActionsSchema, RegularFacetSearchSchema, RegularFacetSearchResultSchema, RegularFacetStateSchema, RegularFacetToggleExcludePayloadSchema, RegularFacetToggleSelectPayloadSchema, RegularFacetToggleSingleExcludePayloadSchema, RegularFacetToggleSingleSelectPayloadSchema, RegularFacetValueSchema, SelectActionPayloadSchema, SelectPagePayloadSchema, SelectSortPayloadSchema, SetPageSizePayloadSchema, SortSchema, SortActionsSchema, SortCriterionSchema, SortStateSchema, BundleDisplayPropsSchema, CategoryFacetPropsSchema, CommerceSearchPropsSchema, ComparisonTablePropsSchema, DateFacetPropsSchema, FacetManagerPropsSchema, LayoutStackPropsSchema, NextActionsBarPropsSchema, NumericFacetPropsSchema, PageSizePropsSchema, PaginationPropsSchema, ProductCarouselPropsSchema, ProductListPropsSchema, ProductSummaryPropsSchema, QuerySummaryPropsSchema, RegularFacetPropsSchema, SortPropsSchema, } from './generated/schemas.js';
2
+ export { ActionItemSchema, CartSchema, CartActionsSchema, CartStateSchema, UpdateCartSchema, UpdateCartPayloadSchema, CartUpdateOperationSchema, PurchaseSchema, PurchasePayloadSchema, PurchaseProductSchema, TransactionSchema, QuerySuggestionsSchema, QuerySuggestionsActionsSchema, QuerySuggestionsStateSchema, QueryCompletionSchema, FetchSuggestionsSchema, FetchSuggestionsPayloadSchema, RestoreStateSchema, RestoreStatePayloadSchema, FacetRestoreSchema, NumericRangeRestoreSchema, OverrideCorrectionSchema, OverrideCorrectionPayloadSchema, ShowMoreSchema, ShowMorePayloadSchema, SelectProductsSchema, SelectProductsPayloadSchema, ProductClickSchema, ProductClickPayloadSchema, BundleDisplaySchema, BundleDisplayStateSchema, BundleSlotSchema, BundleTierSchema, CategoryFacetSchema, CategoryFacetActionsSchema, CategoryFacetValueSchema, CategoryFacetSearchSchema, CategoryFacetSearchPayloadSchema, CategoryFacetSelectPathPayloadSchema, CategoryFacetStateSchema, CategoryFacetValuesSchema, CommerceSearchSchema, CommerceSearchActionsSchema, CommerceSearchStateSchema, SubmitQuerySchema, SubmitQueryPayloadSchema, ComparisonAttributeSchema, ComparisonProductSchema, ComparisonTableSchema, ComparisonTableStateSchema, ComponentContractsSchema, DateFacetSchema, DateFacetActionsSchema, DateFacetApplyCustomRangePayloadSchema, DateFacetCustomRangeSchema, DateFacetStateSchema, DateFacetToggleSelectPayloadSchema, DateFacetToggleSingleSelectPayloadSchema, DateFacetValueSchema, FacetManagerSchema, FacetManagerActionsSchema, FacetManagerStateSchema, FacetValueStateSchema, SelectableFacetValueStateSchema, LayoutStackSchema, LayoutStackStateSchema, NextActionsBarSchema, NextActionsStateSchema, NumericFacetSchema, NumericFacetActionsSchema, NumericFacetCustomRangeSchema, NumericFacetDomainSchema, NumericFacetApplyCustomRangePayloadSchema, NumericFacetStateSchema, NumericFacetToggleSelectPayloadSchema, NumericFacetToggleSingleSelectPayloadSchema, NumericFacetValueSchema, PageSizeSchema, PageSizeActionsSchema, PageSizeStateSchema, PaginationSchema, PaginationActionsSchema, PaginationStateSchema, ProductCarouselSchema, ProductCarouselStateSchema, ProductListSchema, ProductListActionsSchema, ProductListStateSchema, ProductSummarySchema, ProductSummaryActionsSchema, ProductSummaryStateSchema, QuerySummarySchema, QuerySummaryStateSchema, ProductSchema, RegularFacetSchema, RegularFacetActionsSchema, RegularFacetSearchSchema, RegularFacetSearchResultSchema, RegularFacetStateSchema, RegularFacetToggleExcludePayloadSchema, RegularFacetToggleSelectPayloadSchema, RegularFacetToggleSingleExcludePayloadSchema, RegularFacetToggleSingleSelectPayloadSchema, RegularFacetValueSchema, SelectActionPayloadSchema, SelectPagePayloadSchema, SelectSortPayloadSchema, SetPageSizePayloadSchema, SortSchema, SortActionsSchema, SortCriterionSchema, SortStateSchema, BundleDisplayPropsSchema, CategoryFacetPropsSchema, CommerceSearchPropsSchema, ComparisonTablePropsSchema, DateFacetPropsSchema, FacetManagerPropsSchema, LayoutStackPropsSchema, NextActionsBarPropsSchema, NumericFacetPropsSchema, PageSizePropsSchema, PaginationPropsSchema, ProductCarouselPropsSchema, ProductListPropsSchema, ProductSummaryPropsSchema, QuerySummaryPropsSchema, RegularFacetPropsSchema, SortPropsSchema, } from './generated/schemas.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coveo/thermidor-schema",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.0-beta.5",
4
4
  "description": "Zod and TypeScript projections of the Thermidor JSON Schema contract.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://schema.thermidor.coveo.com/components/component-contracts.schema.json",
3
+ "$id": "https://schema.thermidor.coveo.com/component-contracts.schema.json",
4
4
  "title": "Component Contracts",
5
5
  "description": "Discriminated index of component runtime contracts. componentType is the stable discriminant; componentId identifies a particular instance outside this static contract.",
6
6
  "$defs": {
@@ -10,6 +10,12 @@
10
10
  {
11
11
  "$ref": "https://schema.thermidor.coveo.com/components/product-carousel.schema.json"
12
12
  },
13
+ {
14
+ "$ref": "https://schema.thermidor.coveo.com/components/cart.schema.json"
15
+ },
16
+ {
17
+ "$ref": "https://schema.thermidor.coveo.com/components/query-suggestions.schema.json"
18
+ },
13
19
  {
14
20
  "$ref": "https://schema.thermidor.coveo.com/components/next-actions-bar.schema.json"
15
21
  },
@@ -0,0 +1,156 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.thermidor.coveo.com/components/cart.schema.json",
4
+ "title": "Cart",
5
+ "description": "Represents a commerce cart or checkout surface. The backend owns cart state; semantic cart mutations and purchase completion are dispatched through this component.",
6
+ "allOf": [
7
+ {
8
+ "$ref": "https://schema.thermidor.coveo.com/base/component.schema.json"
9
+ }
10
+ ],
11
+ "properties": {
12
+ "componentType": {
13
+ "type": "string",
14
+ "const": "cart"
15
+ },
16
+ "state": {
17
+ "$ref": "#/$defs/CartState"
18
+ },
19
+ "actions": {
20
+ "type": "object",
21
+ "required": ["updateCart", "purchase"],
22
+ "properties": {
23
+ "updateCart": {
24
+ "$ref": "#/$defs/UpdateCartAction"
25
+ },
26
+ "purchase": {
27
+ "$ref": "#/$defs/PurchaseAction"
28
+ }
29
+ },
30
+ "additionalProperties": false
31
+ },
32
+ "children": {
33
+ "type": "array",
34
+ "items": {
35
+ "$ref": "https://schema.thermidor.coveo.com/definitions/child-ref.schema.json"
36
+ },
37
+ "maxItems": 1000,
38
+ "$comment": "TODO: Revisit this provisional cart-child limit when the cart composition model is defined.",
39
+ "default": []
40
+ },
41
+ "child": {
42
+ "$ref": "https://schema.thermidor.coveo.com/definitions/child-ref.schema.json"
43
+ }
44
+ },
45
+ "additionalProperties": false,
46
+ "$defs": {
47
+ "CartState": {
48
+ "title": "CartState",
49
+ "description": "Cart state is backend-owned. This initial contract intentionally carries no presentation fields; it provides the canonical action anchor for cart mutations and checkout completion.",
50
+ "type": "object",
51
+ "properties": {},
52
+ "additionalProperties": false
53
+ },
54
+ "UpdateCartAction": {
55
+ "title": "updateCart",
56
+ "description": "Applies a semantic item update to the cart and records the corresponding commerce cart event.",
57
+ "allOf": [
58
+ {
59
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
60
+ }
61
+ ],
62
+ "properties": {
63
+ "payload": {
64
+ "type": "object",
65
+ "required": ["productId", "quantity", "operation"],
66
+ "properties": {
67
+ "productId": {
68
+ "type": "string",
69
+ "minLength": 1
70
+ },
71
+ "name": {
72
+ "type": "string"
73
+ },
74
+ "price": {
75
+ "type": ["number", "null"]
76
+ },
77
+ "quantity": {
78
+ "type": "integer",
79
+ "minimum": 1
80
+ },
81
+ "operation": {
82
+ "title": "CartUpdateOperation",
83
+ "type": "string",
84
+ "enum": ["add", "remove", "setQuantity"]
85
+ }
86
+ },
87
+ "additionalProperties": false
88
+ }
89
+ }
90
+ },
91
+ "PurchaseAction": {
92
+ "title": "purchase",
93
+ "description": "Records a completed commerce transaction.",
94
+ "allOf": [
95
+ {
96
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
97
+ }
98
+ ],
99
+ "properties": {
100
+ "payload": {
101
+ "type": "object",
102
+ "required": ["products", "transaction"],
103
+ "properties": {
104
+ "products": {
105
+ "type": "array",
106
+ "items": {
107
+ "$ref": "#/$defs/PurchaseProduct"
108
+ }
109
+ },
110
+ "transaction": {
111
+ "$ref": "#/$defs/Transaction"
112
+ }
113
+ },
114
+ "additionalProperties": false
115
+ }
116
+ }
117
+ },
118
+ "PurchaseProduct": {
119
+ "title": "PurchaseProduct",
120
+ "type": "object",
121
+ "required": ["productId", "quantity"],
122
+ "properties": {
123
+ "productId": {
124
+ "type": "string",
125
+ "minLength": 1
126
+ },
127
+ "name": {
128
+ "type": "string"
129
+ },
130
+ "price": {
131
+ "type": ["number", "null"]
132
+ },
133
+ "quantity": {
134
+ "type": "integer",
135
+ "minimum": 1
136
+ }
137
+ },
138
+ "additionalProperties": false
139
+ },
140
+ "Transaction": {
141
+ "title": "Transaction",
142
+ "type": "object",
143
+ "required": ["id", "revenue"],
144
+ "properties": {
145
+ "id": {
146
+ "type": "string",
147
+ "minLength": 1
148
+ },
149
+ "revenue": {
150
+ "type": "number"
151
+ }
152
+ },
153
+ "additionalProperties": false
154
+ }
155
+ }
156
+ }
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "https://schema.thermidor.coveo.com/components/commerce-search.schema.json",
4
4
  "title": "CommerceSearch",
5
- "description": "Surface-root component for a commerce search surface. Its componentType carries the surface intent; it owns the surface's top-level components via children and dispatches submitQuery when the user submits a new query.",
5
+ "description": "Surface-root component for a commerce search surface. Its componentType carries the surface intent; it owns the surface's top-level components via children and dispatches search lifecycle actions.",
6
6
  "allOf": [
7
7
  {
8
8
  "$ref": "https://schema.thermidor.coveo.com/base/component.schema.json"
@@ -18,10 +18,16 @@
18
18
  },
19
19
  "actions": {
20
20
  "type": "object",
21
- "required": ["submitQuery"],
21
+ "required": ["submitQuery", "restoreState", "overrideCorrection"],
22
22
  "properties": {
23
23
  "submitQuery": {
24
24
  "$ref": "#/$defs/SubmitQueryAction"
25
+ },
26
+ "restoreState": {
27
+ "$ref": "#/$defs/RestoreStateAction"
28
+ },
29
+ "overrideCorrection": {
30
+ "$ref": "#/$defs/OverrideCorrectionAction"
25
31
  }
26
32
  },
27
33
  "additionalProperties": false
@@ -67,6 +73,113 @@
67
73
  "additionalProperties": false
68
74
  }
69
75
  }
76
+ },
77
+ "RestoreStateAction": {
78
+ "title": "restoreState",
79
+ "description": "Restores a commerce-search surface from externally persisted search state.",
80
+ "allOf": [
81
+ {
82
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
83
+ }
84
+ ],
85
+ "properties": {
86
+ "payload": {
87
+ "type": "object",
88
+ "required": ["query", "page", "pageSize"],
89
+ "properties": {
90
+ "query": {
91
+ "type": "string"
92
+ },
93
+ "page": {
94
+ "type": "integer",
95
+ "minimum": 0
96
+ },
97
+ "pageSize": {
98
+ "type": "integer",
99
+ "minimum": 1
100
+ },
101
+ "sortCriteria": {
102
+ "type": "string"
103
+ },
104
+ "facets": {
105
+ "type": "array",
106
+ "items": {
107
+ "$ref": "#/$defs/FacetRestore"
108
+ }
109
+ },
110
+ "pinnedProducts": {
111
+ "type": "array",
112
+ "items": {
113
+ "type": "string"
114
+ }
115
+ }
116
+ },
117
+ "additionalProperties": false
118
+ }
119
+ }
120
+ },
121
+ "OverrideCorrectionAction": {
122
+ "title": "overrideCorrection",
123
+ "description": "Re-runs a search with the shopper's original query instead of an automatic correction.",
124
+ "allOf": [
125
+ {
126
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
127
+ }
128
+ ],
129
+ "properties": {
130
+ "payload": {
131
+ "type": "object",
132
+ "required": ["originalQuery"],
133
+ "properties": {
134
+ "originalQuery": {
135
+ "type": "string",
136
+ "minLength": 1
137
+ }
138
+ },
139
+ "additionalProperties": false
140
+ }
141
+ }
142
+ },
143
+ "FacetRestore": {
144
+ "title": "FacetRestore",
145
+ "type": "object",
146
+ "required": ["facetId"],
147
+ "properties": {
148
+ "facetId": {
149
+ "type": "string",
150
+ "minLength": 1
151
+ },
152
+ "values": {
153
+ "type": "array",
154
+ "items": {
155
+ "type": "string"
156
+ }
157
+ },
158
+ "numericRanges": {
159
+ "type": "array",
160
+ "items": {
161
+ "$ref": "#/$defs/NumericRangeRestore"
162
+ }
163
+ }
164
+ },
165
+ "additionalProperties": false
166
+ },
167
+ "NumericRangeRestore": {
168
+ "title": "NumericRangeRestore",
169
+ "type": "object",
170
+ "required": ["start", "end"],
171
+ "properties": {
172
+ "start": {
173
+ "type": "number"
174
+ },
175
+ "end": {
176
+ "type": "number"
177
+ },
178
+ "endInclusive": {
179
+ "type": "boolean"
180
+ }
181
+ },
182
+ "additionalProperties": false
70
183
  }
71
184
  }
72
185
  }