@coveo/thermidor-schema 1.0.0-beta.3 → 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,7 +227,17 @@ export const CategoryFacetValuesSchema = z.strictObject({
192
227
  });
193
228
  export const FacetManagerActionsSchema = z.strictObject({});
194
229
  export const FacetManagerStateSchema = z.strictObject({});
195
- export const CommerceSearchActionsSchema = 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
+ });
238
+ export const SubmitQueryPayloadSchema = z.strictObject({
239
+ query: z.string(),
240
+ });
196
241
  export const CommerceSearchStateSchema = z.strictObject({});
197
242
  export const LayoutStackActionsSchema = z.strictObject({});
198
243
  export const LayoutStackStateSchema = z.strictObject({});
@@ -219,6 +264,21 @@ export const ProductCarouselSchema = z.strictObject({
219
264
  componentType: z.literal('product-carousel'),
220
265
  state: ProductCarouselStateSchema,
221
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
+ });
222
282
  export const SelectActionSchema = z.strictObject({
223
283
  payload: SelectActionPayloadSchema,
224
284
  });
@@ -236,15 +296,11 @@ export const ComparisonTableStateSchema = z.strictObject({
236
296
  products: z.array(ComparisonProductSchema),
237
297
  summary: z.string(),
238
298
  });
239
- export const ProductListSchema = z.strictObject({
240
- actions: ProductListActionsSchema,
241
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
242
- children: z
243
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
244
- .max(1000)
245
- .optional(),
246
- componentType: z.literal('product-list'),
247
- state: ProductListStateSchema,
299
+ export const ProductClickSchema = z.strictObject({
300
+ payload: ProductClickPayloadSchema,
301
+ });
302
+ export const SelectProductsSchema = z.strictObject({
303
+ payload: SelectProductsPayloadSchema,
248
304
  });
249
305
  export const ProductSummarySchema = z.strictObject({
250
306
  actions: ProductSummaryActionsSchema,
@@ -262,6 +318,9 @@ export const SelectPageSchema = z.strictObject({
262
318
  export const PurpleSetPageSizeSchema = z.strictObject({
263
319
  payload: PayloadSchema,
264
320
  });
321
+ export const ShowMoreSchema = z.strictObject({
322
+ payload: ShowMorePayloadSchema,
323
+ });
265
324
  export const SelectSortSchema = z.strictObject({
266
325
  payload: SelectSortPayloadSchema,
267
326
  });
@@ -347,15 +406,16 @@ export const FacetManagerSchema = z.strictObject({
347
406
  componentType: z.literal('facet-manager'),
348
407
  state: FacetManagerStateSchema,
349
408
  });
350
- export const CommerceSearchSchema = z.strictObject({
351
- actions: CommerceSearchActionsSchema,
352
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
353
- children: z
354
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
355
- .max(1000)
356
- .optional(),
357
- componentType: z.literal('commerce-search'),
358
- state: CommerceSearchStateSchema,
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
+ });
417
+ export const SubmitQuerySchema = z.strictObject({
418
+ payload: SubmitQueryPayloadSchema,
359
419
  });
360
420
  export const LayoutStackSchema = z.strictObject({
361
421
  actions: LayoutStackActionsSchema,
@@ -380,6 +440,12 @@ export const QuerySummarySchema = z.strictObject({
380
440
  export const FluffySetPageSizeSchema = z.strictObject({
381
441
  payload: SetPageSizePayloadSchema,
382
442
  });
443
+ export const PurchaseSchema = z.strictObject({
444
+ payload: PurchasePayloadSchema,
445
+ });
446
+ export const QuerySuggestionsActionsSchema = z.strictObject({
447
+ fetchSuggestions: FetchSuggestionsSchema,
448
+ });
383
449
  export const NextActionsBarActionsSchema = z.strictObject({
384
450
  selectAction: SelectActionSchema,
385
451
  });
@@ -396,9 +462,14 @@ export const ComparisonTableSchema = z.strictObject({
396
462
  componentType: z.literal('comparison-table'),
397
463
  state: ComparisonTableStateSchema,
398
464
  });
465
+ export const ProductListActionsSchema = z.strictObject({
466
+ productClick: ProductClickSchema,
467
+ selectProducts: SelectProductsSchema,
468
+ });
399
469
  export const PaginationActionsSchema = z.strictObject({
400
470
  selectPage: SelectPageSchema,
401
471
  setPageSize: PurpleSetPageSizeSchema,
472
+ showMore: ShowMoreSchema,
402
473
  });
403
474
  export const SortActionsSchema = z.strictObject({
404
475
  selectSort: SelectSortSchema,
@@ -457,9 +528,31 @@ export const CategoryFacetStateSchema = z.strictObject({
457
528
  field: z.string(),
458
529
  values: CategoryFacetValuesSchema,
459
530
  });
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(),
538
+ });
460
539
  export const PageSizeActionsSchema = z.strictObject({
461
540
  setPageSize: FluffySetPageSizeSchema,
462
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
+ });
463
556
  export const NextActionsBarSchema = z.strictObject({
464
557
  actions: NextActionsBarActionsSchema,
465
558
  child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
@@ -480,6 +573,16 @@ export const BundleDisplaySchema = z.strictObject({
480
573
  componentType: z.literal('bundle-display'),
481
574
  state: BundleDisplayStateSchema,
482
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
+ });
483
586
  export const PaginationSchema = z.strictObject({
484
587
  actions: PaginationActionsSchema,
485
588
  child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
@@ -540,6 +643,9 @@ export const CategoryFacetSchema = z.strictObject({
540
643
  componentType: z.literal('category-facet'),
541
644
  state: CategoryFacetStateSchema,
542
645
  });
646
+ export const RestoreStateSchema = z.strictObject({
647
+ payload: RestoreStatePayloadSchema,
648
+ });
543
649
  export const PageSizeSchema = z.strictObject({
544
650
  actions: PageSizeActionsSchema,
545
651
  child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
@@ -550,8 +656,35 @@ export const PageSizeSchema = z.strictObject({
550
656
  componentType: z.literal('page-size'),
551
657
  state: PageSizeStateSchema,
552
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,
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,
683
+ });
553
684
  export const ComponentContractsSchema = z.discriminatedUnion('componentType', [
554
685
  ProductCarouselSchema,
686
+ CartSchema,
687
+ QuerySuggestionsSchema,
555
688
  NextActionsBarSchema,
556
689
  BundleDisplaySchema,
557
690
  ComparisonTableSchema,
@@ -579,6 +712,10 @@ export const BundleDisplayPropsSchema = z.object({
579
712
  componentId: z.string(),
580
713
  componentType: z.literal('bundle-display'),
581
714
  });
715
+ export const CartPropsSchema = z.object({
716
+ componentId: z.string(),
717
+ componentType: z.literal('cart'),
718
+ });
582
719
  export const CategoryFacetPropsSchema = z.object({
583
720
  componentId: z.string(),
584
721
  componentType: z.literal('category-facet'),
@@ -631,6 +768,10 @@ export const ProductSummaryPropsSchema = z.object({
631
768
  componentId: z.string(),
632
769
  componentType: z.literal('product-summary'),
633
770
  });
771
+ export const QuerySuggestionsPropsSchema = z.object({
772
+ componentId: z.string(),
773
+ componentType: z.literal('query-suggestions'),
774
+ });
634
775
  export const QuerySummaryPropsSchema = z.object({
635
776
  componentId: z.string(),
636
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, CommerceSearchStateSchema, 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, CommerceSearchState, 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, CommerceSearchStateSchema, 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.3",
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
+ }