@coveo/thermidor-schema 1.0.0-beta.2 → 1.0.0-beta.21

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 (48) hide show
  1. package/README.md +32 -5
  2. package/dist/generated/schemas.d.ts +2651 -408
  3. package/dist/generated/schemas.js +738 -173
  4. package/dist/generated/zod3/index.d.ts +3 -0
  5. package/dist/generated/zod3/index.js +5 -0
  6. package/dist/generated/zod3/schemas.d.ts +24410 -0
  7. package/dist/generated/zod3/schemas.js +1106 -0
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.js +1 -1
  10. package/dist/zod3-compat.d.ts +79 -0
  11. package/dist/zod3-compat.js +82 -0
  12. package/package.json +26 -20
  13. package/schema/base/catalog.schema.json +5 -4
  14. package/schema/base/component.schema.json +22 -20
  15. package/schema/{components/component-contracts.schema.json → component-contracts.schema.json} +23 -5
  16. package/schema/components/bundle-display.schema.json +11 -6
  17. package/schema/components/cart.schema.json +85 -46
  18. package/schema/components/category-facet.schema.json +35 -26
  19. package/schema/components/commerce-search.schema.json +186 -0
  20. package/schema/components/comparison-table.schema.json +35 -11
  21. package/schema/components/date-facet.schema.json +39 -26
  22. package/schema/components/facet-manager.schema.json +16 -18
  23. package/schema/components/layout-stack.schema.json +50 -0
  24. package/schema/components/next-actions-bar.schema.json +43 -19
  25. package/schema/components/numeric-facet.schema.json +43 -28
  26. package/schema/components/page-size.schema.json +79 -0
  27. package/schema/components/pagination.schema.json +45 -19
  28. package/schema/components/product-carousel.schema.json +15 -7
  29. package/schema/components/product-list.schema.json +77 -7
  30. package/schema/components/product-research-card.schema.json +70 -0
  31. package/schema/components/product-summary.schema.json +64 -0
  32. package/schema/components/query-suggestions.schema.json +113 -0
  33. package/schema/components/query-summary.schema.json +76 -0
  34. package/schema/components/regular-facet.schema.json +42 -51
  35. package/schema/components/sort.schema.json +18 -18
  36. package/schema/definitions/action-item.schema.json +10 -13
  37. package/schema/definitions/bundle-tier.schema.json +9 -4
  38. package/schema/definitions/child-list.schema.json +31 -0
  39. package/schema/definitions/comparison-attribute.schema.json +2 -2
  40. package/schema/definitions/comparison-product.schema.json +2 -4
  41. package/schema/definitions/component-id.schema.json +9 -0
  42. package/schema/definitions/data-binding.schema.json +16 -0
  43. package/schema/definitions/followup-action-item.schema.json +20 -0
  44. package/schema/definitions/product.schema.json +3 -6
  45. package/schema/definitions/search-action-item.schema.json +20 -0
  46. package/schema/definitions/search-option-action-item.schema.json +25 -0
  47. package/schema/components/search-box.schema.json +0 -74
  48. package/schema/definitions/cart-item.schema.json +0 -29
@@ -1,11 +1,10 @@
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
- // The kind of action: "followup" triggers a conversational follow-up, "search" triggers a
5
- // standalone search.
6
- //
4
+ export const CartUpdateOperationSchema = z.enum(['add', 'remove', 'setQuantity']);
7
5
  // The kind of action selected: "followup" or "search".
8
- export const TypeSchema = z.enum(['followup', 'search']);
6
+ export const SelectActionPayloadTypeSchema = z.enum(['followup', 'search']);
7
+ export const ActionItemTypeSchema = z.enum(['followup', 'search', 'searchOption']);
9
8
  // The selection state of a facet value, shared across all commerce facet components.
10
9
  //
11
10
  // The selection state of this facet value.
@@ -20,52 +19,89 @@ export const ProductSchema = z.strictObject({
20
19
  get children() {
21
20
  return z.array(ProductSchema).optional();
22
21
  },
23
- clickUri: z.url().optional(),
22
+ clickUri: z.string().optional(),
24
23
  ec_brand: z.string().optional(),
25
24
  ec_category: z.array(z.string()).optional(),
26
25
  ec_color: z.string().optional(),
27
26
  ec_description: z.string().optional(),
28
- ec_images: z.array(z.url()).optional(),
27
+ ec_images: z.array(z.string()).optional(),
29
28
  ec_in_stock: z.boolean().optional(),
30
29
  ec_item_group_id: z.string().optional(),
31
30
  ec_item_group_name: z.string().optional(),
32
31
  ec_name: z.string(),
33
32
  ec_price: z.number().optional(),
34
33
  ec_promo_price: z.number().optional(),
35
- ec_rating: z.union([z.number().min(0).max(5), z.null()]).optional(),
34
+ ec_rating: z.union([z.number().min(0), z.null()]).optional(),
36
35
  ec_shortdesc: z.string().optional(),
37
- ec_thumbnails: z.array(z.url()).optional(),
36
+ ec_thumbnails: z.array(z.string()).optional(),
38
37
  permanentid: z.string(),
39
38
  });
39
+ export const DataBindingSchema = z.strictObject({
40
+ path: z.string(),
41
+ });
42
+ export const FollowupActionItemSchema = z.strictObject({
43
+ text: z.string(),
44
+ type: z.literal('followup'),
45
+ });
46
+ export const SearchActionItemSchema = z.strictObject({
47
+ text: z.string(),
48
+ type: z.literal('search'),
49
+ });
50
+ export const SearchOptionActionItemSchema = z.strictObject({
51
+ optionId: z.string().min(1),
52
+ text: z.string(),
53
+ type: z.literal('searchOption'),
54
+ });
55
+ export const ChildListClassSchema = z.strictObject({
56
+ componentId: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')),
57
+ path: z.string(),
58
+ });
40
59
  export const ProductCarouselActionsSchema = z.strictObject({});
41
60
  export const ProductCarouselStateSchema = z.strictObject({
42
61
  heading: z.string(),
43
62
  products: z.array(ProductSchema),
44
63
  });
45
- export const CartItemSchema = z.strictObject({
46
- name: z.string(),
47
- price: z.number().min(0),
48
- productId: z.string(),
64
+ export const PurchaseProductSchema = z.strictObject({
65
+ name: z.string().optional(),
66
+ price: z.union([z.number(), z.null()]).optional(),
67
+ productId: z.string().min(1),
49
68
  quantity: z.number().int().min(1),
50
69
  });
51
- export const UpdateItemQuantityPayloadSchema = z.strictObject({
52
- item: CartItemSchema,
70
+ export const TransactionSchema = z.strictObject({
71
+ id: z.string().min(1),
72
+ revenue: z.number(),
53
73
  });
54
- export const CartStateSchema = z.strictObject({
55
- items: z.array(CartItemSchema),
74
+ export const UpdateCartPayloadSchema = z.strictObject({
75
+ name: z.string().optional(),
76
+ operation: z.enum(['add', 'remove', 'setQuantity']),
77
+ price: z.union([z.number(), z.null()]).optional(),
78
+ productId: z.string().min(1),
79
+ quantity: z.number().int().min(1),
80
+ });
81
+ export const CartStateSchema = z.strictObject({});
82
+ export const FetchSuggestionsPayloadSchema = z.strictObject({
83
+ query: z.string(),
84
+ });
85
+ export const QueryCompletionSchema = z.strictObject({
86
+ expression: z.string(),
87
+ score: z.number().optional(),
56
88
  });
57
89
  export const SelectActionPayloadSchema = z.strictObject({
58
90
  text: z.string(),
59
91
  type: z.enum(['followup', 'search']),
60
92
  });
61
- export const ActionItemSchema = z.strictObject({
62
- text: z.string(),
63
- type: z.enum(['followup', 'search']),
93
+ export const SelectSearchOptionPayloadSchema = z.strictObject({
94
+ optionId: z.string().min(1),
64
95
  });
96
+ export const ActionItemSchema = z.discriminatedUnion('type', [
97
+ FollowupActionItemSchema,
98
+ SearchActionItemSchema,
99
+ SearchOptionActionItemSchema,
100
+ ]);
65
101
  export const BundleDisplayActionsSchema = z.strictObject({});
66
102
  export const BundleSlotSchema = z.strictObject({
67
103
  categoryLabel: z.string(),
68
- surfaceRef: z.string(),
104
+ childId: z.string(),
69
105
  });
70
106
  export const ComparisonTableActionsSchema = z.strictObject({});
71
107
  export const ComparisonAttributeSchema = z.strictObject({
@@ -73,23 +109,43 @@ export const ComparisonAttributeSchema = z.strictObject({
73
109
  label: z.string(),
74
110
  });
75
111
  export const ComparisonProductSchema = z.strictObject({
76
- imageUrl: z.url().optional(),
112
+ imageUrl: z.string().optional(),
77
113
  name: z.string(),
78
114
  price: z.number().optional(),
79
115
  productId: z.string(),
80
- rating: z.number().min(0).max(5).optional(),
81
- values: z.record(z.string(), z.string()),
116
+ rating: z.number().min(0).optional(),
117
+ values: z.record(z.string(), z.string()).optional(),
118
+ });
119
+ export const ProductClickPayloadSchema = z.strictObject({
120
+ name: z.string().optional(),
121
+ position: z.number().int().min(0),
122
+ price: z.union([z.number(), z.null()]).optional(),
123
+ productId: z.string().min(1),
124
+ });
125
+ export const SelectProductsPayloadSchema = z.strictObject({
126
+ productIds: z.array(z.string().min(1)),
82
127
  });
83
- export const ProductListActionsSchema = z.strictObject({});
84
128
  export const ProductListStateSchema = z.strictObject({
85
129
  products: z.array(ProductSchema),
86
130
  });
131
+ export const ProductSummaryActionsSchema = z.strictObject({});
132
+ export const ProductSummaryStateSchema = z.strictObject({
133
+ categoryLabel: z.string(),
134
+ product: z.union([ProductSchema, z.null()]),
135
+ });
136
+ export const ProductResearchCardActionsSchema = z.strictObject({});
137
+ export const ProductResearchCardStateSchema = z.strictObject({
138
+ bullets: z.array(z.string().min(1)).min(1),
139
+ product: ProductSchema,
140
+ summary: z.string().min(1),
141
+ });
87
142
  export const SelectPagePayloadSchema = z.strictObject({
88
143
  page: z.number().int().min(0),
89
144
  });
90
- export const SetPageSizePayloadSchema = z.strictObject({
145
+ export const PayloadSchema = z.strictObject({
91
146
  pageSize: z.number().int().min(1),
92
147
  });
148
+ export const ShowMorePayloadSchema = z.strictObject({});
93
149
  export const PaginationStateSchema = z.strictObject({
94
150
  page: z.number().int().min(0),
95
151
  pageSize: z.number().int().min(1),
@@ -104,38 +160,32 @@ export const SortCriterionSchema = z.strictObject({
104
160
  fields: z.array(z.unknown()),
105
161
  sortCriteria: z.string(),
106
162
  });
107
- export const SubmitQueryPayloadSchema = z.strictObject({
108
- query: z.string(),
109
- });
110
- export const SearchBoxStateSchema = z.strictObject({
111
- query: z.string(),
112
- });
113
163
  export const ActionSchema = z.strictObject({
114
164
  payload: z.unknown(),
115
165
  });
116
166
  export const SearchPayloadSchema = z.strictObject({
117
- query: z.string().min(0).max(1024),
167
+ query: z.string(),
118
168
  });
119
169
  export const RegularFacetToggleExcludePayloadSchema = z.strictObject({
120
- value: z.string().min(1).max(1024),
170
+ value: z.string().min(1),
121
171
  });
122
172
  export const RegularFacetToggleSelectPayloadSchema = z.strictObject({
123
- value: z.string().min(1).max(1024),
173
+ value: z.string().min(1),
124
174
  });
125
175
  export const RegularFacetToggleSingleExcludePayloadSchema = z.strictObject({
126
- value: z.string().min(1).max(1024),
176
+ value: z.string().min(1),
127
177
  });
128
178
  export const RegularFacetToggleSingleSelectPayloadSchema = z.strictObject({
129
- value: z.string().min(1).max(1024),
179
+ value: z.string().min(1),
130
180
  });
131
181
  export const RegularFacetSearchResultSchema = z.strictObject({
132
- numberOfResults: z.number().int().min(0).max(999999999),
133
- value: z.string().min(1).max(1024),
182
+ numberOfResults: z.number().int().min(0),
183
+ value: z.string().min(1),
134
184
  });
135
185
  export const RegularFacetValueSchema = z.strictObject({
136
- numberOfResults: z.number().int().min(0).max(999999999),
186
+ numberOfResults: z.number().int().min(0),
137
187
  state: z.enum(['idle', 'selected', 'excluded']),
138
- value: z.string().min(1).max(1024),
188
+ value: z.string().min(1),
139
189
  });
140
190
  export const NumericFacetApplyCustomRangePayloadSchema = z.strictObject({
141
191
  end: z.number(),
@@ -188,7 +238,7 @@ export const DateFacetValueSchema = z.strictObject({
188
238
  state: z.enum(['idle', 'selected']),
189
239
  });
190
240
  export const CategoryFacetSearchPayloadSchema = z.strictObject({
191
- query: z.string().max(256),
241
+ query: z.string(),
192
242
  });
193
243
  export const CategoryFacetSelectPathPayloadSchema = z.strictObject({
194
244
  path: z.array(z.string()),
@@ -204,45 +254,102 @@ export const CategoryFacetValuesSchema = z.strictObject({
204
254
  selected: z.union([CategoryFacetValueSchema, z.null()]),
205
255
  });
206
256
  export const FacetManagerActionsSchema = z.strictObject({});
207
- export const FacetManagerStateSchema = z.strictObject({
208
- facetIds: z.array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$'))),
257
+ export const FacetManagerStateSchema = z.strictObject({});
258
+ export const OverrideCorrectionPayloadSchema = z.strictObject({
259
+ originalQuery: z.string().min(1),
209
260
  });
210
- export const ProductCarouselSchema = z.strictObject({
211
- actions: ProductCarouselActionsSchema,
212
- componentType: z.literal('product-carousel'),
213
- state: ProductCarouselStateSchema,
261
+ export const NumericRangeRestoreSchema = z.strictObject({
262
+ end: z.number(),
263
+ endInclusive: z.boolean().optional(),
264
+ start: z.number(),
214
265
  });
215
- export const SetItemsPayloadSchema = z.strictObject({
216
- items: z.array(CartItemSchema),
266
+ export const SubmitQueryPayloadSchema = z.strictObject({
267
+ query: z.string(),
217
268
  });
218
- export const UpdateItemQuantitySchema = z.strictObject({
219
- payload: UpdateItemQuantityPayloadSchema,
269
+ export const CommerceSearchStateSchema = z.strictObject({});
270
+ export const LayoutStackActionsSchema = z.strictObject({});
271
+ export const LayoutStackStateSchema = z.strictObject({});
272
+ export const QuerySummaryActionsSchema = z.strictObject({});
273
+ export const QuerySummaryStateSchema = z.strictObject({
274
+ firstIndex: z.number().int().min(0),
275
+ lastIndex: z.number().int().min(0),
276
+ query: z.string(),
277
+ totalEntries: z.number().int().min(0),
278
+ });
279
+ export const SetPageSizePayloadSchema = z.strictObject({
280
+ pageSize: z.number().int().min(1),
281
+ });
282
+ export const PageSizeStateSchema = z.strictObject({
283
+ pageSize: z.number().int().min(1),
284
+ });
285
+ export const ProductCarouselSchema = z.looseObject({
286
+ actions: ProductCarouselActionsSchema.optional(),
287
+ component: z.literal('ProductCarousel'),
288
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
289
+ state: ProductCarouselStateSchema.optional(),
290
+ });
291
+ export const PurchasePayloadSchema = z.strictObject({
292
+ products: z.array(PurchaseProductSchema),
293
+ transaction: TransactionSchema,
294
+ });
295
+ export const UpdateCartSchema = z.strictObject({
296
+ payload: UpdateCartPayloadSchema,
297
+ });
298
+ export const FetchSuggestionsSchema = z.strictObject({
299
+ payload: FetchSuggestionsPayloadSchema,
300
+ });
301
+ export const QuerySuggestionsStateSchema = z.strictObject({
302
+ completions: z.array(QueryCompletionSchema),
303
+ products: z.array(ProductSchema),
304
+ query: z.string(),
220
305
  });
221
306
  export const SelectActionSchema = z.strictObject({
222
307
  payload: SelectActionPayloadSchema,
223
308
  });
309
+ export const SelectSearchOptionSchema = z.strictObject({
310
+ payload: SelectSearchOptionPayloadSchema,
311
+ });
224
312
  export const NextActionsStateSchema = z.strictObject({
225
- actions: z.array(ActionItemSchema),
313
+ suggestedActions: z.array(ActionItemSchema),
226
314
  });
227
315
  export const BundleTierSchema = z.strictObject({
228
316
  description: z.string(),
229
317
  label: z.string(),
230
318
  slots: z.array(BundleSlotSchema),
319
+ total: z.number().min(0),
231
320
  });
232
321
  export const ComparisonTableStateSchema = z.strictObject({
233
322
  attributes: z.array(ComparisonAttributeSchema),
323
+ heading: z.string(),
234
324
  products: z.array(ComparisonProductSchema),
325
+ summary: z.string(),
326
+ });
327
+ export const ProductClickSchema = z.strictObject({
328
+ payload: ProductClickPayloadSchema,
235
329
  });
236
- export const ProductListSchema = z.strictObject({
237
- actions: ProductListActionsSchema,
238
- componentType: z.literal('product-list'),
239
- state: ProductListStateSchema,
330
+ export const SelectProductsSchema = z.strictObject({
331
+ payload: SelectProductsPayloadSchema,
332
+ });
333
+ export const ProductSummarySchema = z.looseObject({
334
+ actions: ProductSummaryActionsSchema.optional(),
335
+ component: z.literal('ProductSummary'),
336
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
337
+ state: ProductSummaryStateSchema.optional(),
338
+ });
339
+ export const ProductResearchCardSchema = z.looseObject({
340
+ actions: ProductResearchCardActionsSchema.optional(),
341
+ component: z.literal('ProductResearchCard'),
342
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
343
+ state: ProductResearchCardStateSchema.optional(),
240
344
  });
241
345
  export const SelectPageSchema = z.strictObject({
242
346
  payload: SelectPagePayloadSchema,
243
347
  });
244
- export const SetPageSizeSchema = z.strictObject({
245
- payload: SetPageSizePayloadSchema,
348
+ export const PurpleSetPageSizeSchema = z.strictObject({
349
+ payload: PayloadSchema,
350
+ });
351
+ export const ShowMoreSchema = z.strictObject({
352
+ payload: ShowMorePayloadSchema,
246
353
  });
247
354
  export const SelectSortSchema = z.strictObject({
248
355
  payload: SelectSortPayloadSchema,
@@ -251,9 +358,6 @@ export const SortStateSchema = z.strictObject({
251
358
  appliedSort: SortCriterionSchema,
252
359
  availableSorts: z.array(SortCriterionSchema),
253
360
  });
254
- export const SubmitQuerySchema = z.strictObject({
255
- payload: SubmitQueryPayloadSchema,
256
- });
257
361
  export const SearchSchema = z.strictObject({
258
362
  payload: SearchPayloadSchema,
259
363
  });
@@ -271,8 +375,8 @@ export const RegularFacetToggleSingleSelectSchema = z.strictObject({
271
375
  });
272
376
  export const RegularFacetSearchSchema = z.strictObject({
273
377
  canShowMoreResults: z.boolean(),
274
- query: z.string().min(0).max(1024),
275
- results: z.array(RegularFacetSearchResultSchema).max(1000),
378
+ query: z.string(),
379
+ results: z.array(RegularFacetSearchResultSchema),
276
380
  });
277
381
  export const NumericFacetApplyCustomRangeSchema = z.strictObject({
278
382
  payload: NumericFacetApplyCustomRangePayloadSchema,
@@ -291,7 +395,7 @@ export const NumericFacetStateSchema = z.strictObject({
291
395
  domain: NumericFacetDomainSchema.optional(),
292
396
  field: z.string(),
293
397
  hasActiveValues: z.boolean(),
294
- values: z.array(NumericFacetValueSchema).max(500),
398
+ values: z.array(NumericFacetValueSchema),
295
399
  });
296
400
  export const DateFacetApplyCustomRangeSchema = z.strictObject({
297
401
  payload: DateFacetApplyCustomRangePayloadSchema,
@@ -319,38 +423,72 @@ export const CategoryFacetSelectPathSchema = z.strictObject({
319
423
  });
320
424
  export const FacetSearchClassSchema = z.strictObject({
321
425
  canShowMoreResults: z.boolean(),
322
- query: z.string().max(256),
426
+ query: z.string(),
323
427
  results: z.array(CategoryFacetValueSchema),
324
428
  });
325
- export const FacetManagerSchema = z.strictObject({
326
- actions: FacetManagerActionsSchema,
327
- componentType: z.literal('facet-manager'),
328
- state: FacetManagerStateSchema,
429
+ export const FacetManagerSchema = z.looseObject({
430
+ actions: FacetManagerActionsSchema.optional(),
431
+ component: z.literal('FacetManager'),
432
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
433
+ state: FacetManagerStateSchema.optional(),
434
+ });
435
+ export const OverrideCorrectionSchema = z.strictObject({
436
+ payload: OverrideCorrectionPayloadSchema,
437
+ });
438
+ export const FacetRestoreSchema = z.strictObject({
439
+ facetId: z.string().min(1),
440
+ numericRanges: z.array(NumericRangeRestoreSchema).optional(),
441
+ values: z.array(z.string()).optional(),
442
+ });
443
+ export const SubmitQuerySchema = z.strictObject({
444
+ payload: SubmitQueryPayloadSchema,
329
445
  });
330
- export const SetItemsSchema = z.strictObject({
331
- payload: SetItemsPayloadSchema,
446
+ export const LayoutStackSchema = z.looseObject({
447
+ actions: LayoutStackActionsSchema.optional(),
448
+ component: z.literal('LayoutStack'),
449
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
450
+ state: LayoutStackStateSchema.optional(),
451
+ });
452
+ export const QuerySummarySchema = z.looseObject({
453
+ actions: QuerySummaryActionsSchema.optional(),
454
+ component: z.literal('QuerySummary'),
455
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
456
+ state: QuerySummaryStateSchema.optional(),
457
+ });
458
+ export const FluffySetPageSizeSchema = z.strictObject({
459
+ payload: SetPageSizePayloadSchema,
460
+ });
461
+ export const PurchaseSchema = z.strictObject({
462
+ payload: PurchasePayloadSchema,
463
+ });
464
+ export const QuerySuggestionsActionsSchema = z.strictObject({
465
+ fetchSuggestions: FetchSuggestionsSchema,
332
466
  });
333
467
  export const NextActionsBarActionsSchema = z.strictObject({
334
468
  selectAction: SelectActionSchema,
469
+ selectSearchOption: SelectSearchOptionSchema,
335
470
  });
336
471
  export const BundleDisplayStateSchema = z.strictObject({
337
472
  tiers: z.array(BundleTierSchema),
338
473
  });
339
- export const ComparisonTableSchema = z.strictObject({
340
- actions: ComparisonTableActionsSchema,
341
- componentType: z.literal('comparison-table'),
342
- state: ComparisonTableStateSchema,
474
+ export const ComparisonTableSchema = z.looseObject({
475
+ actions: ComparisonTableActionsSchema.optional(),
476
+ component: z.literal('ComparisonTable'),
477
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
478
+ state: ComparisonTableStateSchema.optional(),
479
+ });
480
+ export const ProductListActionsSchema = z.strictObject({
481
+ productClick: ProductClickSchema,
482
+ selectProducts: SelectProductsSchema,
343
483
  });
344
484
  export const PaginationActionsSchema = z.strictObject({
345
485
  selectPage: SelectPageSchema,
346
- setPageSize: SetPageSizeSchema,
486
+ setPageSize: PurpleSetPageSizeSchema,
487
+ showMore: ShowMoreSchema,
347
488
  });
348
489
  export const SortActionsSchema = z.strictObject({
349
490
  selectSort: SelectSortSchema,
350
491
  });
351
- export const SearchBoxActionsSchema = z.strictObject({
352
- submitQuery: SubmitQuerySchema,
353
- });
354
492
  export const RegularFacetActionsSchema = z.strictObject({
355
493
  clearAllActiveValues: ActionSchema,
356
494
  clearSearch: ActionSchema,
@@ -366,11 +504,11 @@ export const RegularFacetActionsSchema = z.strictObject({
366
504
  export const RegularFacetStateSchema = z.strictObject({
367
505
  canShowLessValues: z.boolean(),
368
506
  canShowMoreValues: z.boolean(),
369
- displayName: z.string().min(1).max(255),
507
+ displayName: z.string(),
370
508
  facetSearch: RegularFacetSearchSchema,
371
- field: z.string().min(1).max(255),
509
+ field: z.string().min(1),
372
510
  hasActiveValues: z.boolean(),
373
- values: z.array(RegularFacetValueSchema).max(1000),
511
+ values: z.array(RegularFacetValueSchema),
374
512
  });
375
513
  export const NumericFacetActionsSchema = z.strictObject({
376
514
  applyCustomRange: NumericFacetApplyCustomRangeSchema,
@@ -405,135 +543,562 @@ export const CategoryFacetStateSchema = z.strictObject({
405
543
  field: z.string(),
406
544
  values: CategoryFacetValuesSchema,
407
545
  });
546
+ export const RestoreStatePayloadSchema = z.strictObject({
547
+ facets: z.array(FacetRestoreSchema).optional(),
548
+ page: z.number().int().min(0),
549
+ pageSize: z.number().int().min(1),
550
+ pinnedProducts: z.array(z.string()).optional(),
551
+ query: z.string(),
552
+ sortCriteria: z.string().optional(),
553
+ });
554
+ export const PageSizeActionsSchema = z.strictObject({
555
+ setPageSize: FluffySetPageSizeSchema,
556
+ });
408
557
  export const CartActionsSchema = z.strictObject({
409
- setItems: SetItemsSchema,
410
- updateItemQuantity: UpdateItemQuantitySchema,
411
- });
412
- export const NextActionsBarSchema = z.strictObject({
413
- actions: NextActionsBarActionsSchema,
414
- componentType: z.literal('next-actions-bar'),
415
- state: NextActionsStateSchema,
416
- });
417
- export const BundleDisplaySchema = z.strictObject({
418
- actions: BundleDisplayActionsSchema,
419
- componentType: z.literal('bundle-display'),
420
- state: BundleDisplayStateSchema,
421
- });
422
- export const PaginationSchema = z.strictObject({
423
- actions: PaginationActionsSchema,
424
- componentType: z.literal('pagination'),
425
- state: PaginationStateSchema,
426
- });
427
- export const SortSchema = z.strictObject({
428
- actions: SortActionsSchema,
429
- componentType: z.literal('sort'),
430
- state: SortStateSchema,
431
- });
432
- export const SearchBoxSchema = z.strictObject({
433
- actions: SearchBoxActionsSchema,
434
- componentType: z.literal('search-box'),
435
- state: SearchBoxStateSchema,
436
- });
437
- export const RegularFacetSchema = z.strictObject({
438
- actions: RegularFacetActionsSchema,
439
- componentType: z.literal('regular-facet'),
440
- state: RegularFacetStateSchema,
441
- });
442
- export const NumericFacetSchema = z.strictObject({
443
- actions: NumericFacetActionsSchema,
444
- componentType: z.literal('numeric-facet'),
445
- state: NumericFacetStateSchema,
446
- });
447
- export const DateFacetSchema = z.strictObject({
448
- actions: DateFacetActionsSchema,
449
- componentType: z.literal('date-facet'),
450
- state: DateFacetStateSchema,
451
- });
452
- export const CategoryFacetSchema = z.strictObject({
453
- actions: CategoryFacetActionsSchema,
454
- componentType: z.literal('category-facet'),
455
- state: CategoryFacetStateSchema,
456
- });
457
- export const CartSchema = z.strictObject({
458
- actions: CartActionsSchema,
459
- componentType: z.literal('cart'),
460
- state: CartStateSchema,
461
- });
462
- export const ComponentContractsSchema = z.discriminatedUnion('componentType', [
558
+ purchase: PurchaseSchema,
559
+ updateCart: UpdateCartSchema,
560
+ });
561
+ export const QuerySuggestionsSchema = z.looseObject({
562
+ actions: QuerySuggestionsActionsSchema.optional(),
563
+ component: z.literal('QuerySuggestions'),
564
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
565
+ state: QuerySuggestionsStateSchema.optional(),
566
+ });
567
+ export const NextActionsBarSchema = z.looseObject({
568
+ actions: NextActionsBarActionsSchema.optional(),
569
+ component: z.literal('NextActionsBar'),
570
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
571
+ state: NextActionsStateSchema.optional(),
572
+ });
573
+ export const BundleDisplaySchema = z.looseObject({
574
+ actions: BundleDisplayActionsSchema.optional(),
575
+ component: z.literal('BundleDisplay'),
576
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
577
+ state: BundleDisplayStateSchema.optional(),
578
+ });
579
+ export const ProductListSchema = z.looseObject({
580
+ actions: ProductListActionsSchema.optional(),
581
+ component: z.literal('ProductList'),
582
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
583
+ state: ProductListStateSchema.optional(),
584
+ });
585
+ export const PaginationSchema = z.looseObject({
586
+ actions: PaginationActionsSchema.optional(),
587
+ component: z.literal('Pagination'),
588
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
589
+ state: PaginationStateSchema.optional(),
590
+ });
591
+ export const SortSchema = z.looseObject({
592
+ actions: SortActionsSchema.optional(),
593
+ component: z.literal('Sort'),
594
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
595
+ state: SortStateSchema.optional(),
596
+ });
597
+ export const RegularFacetSchema = z.looseObject({
598
+ actions: RegularFacetActionsSchema.optional(),
599
+ component: z.literal('RegularFacet'),
600
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
601
+ state: RegularFacetStateSchema.optional(),
602
+ });
603
+ export const NumericFacetSchema = z.looseObject({
604
+ actions: NumericFacetActionsSchema.optional(),
605
+ component: z.literal('NumericFacet'),
606
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
607
+ state: NumericFacetStateSchema.optional(),
608
+ });
609
+ export const DateFacetSchema = z.looseObject({
610
+ actions: DateFacetActionsSchema.optional(),
611
+ component: z.literal('DateFacet'),
612
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
613
+ state: DateFacetStateSchema.optional(),
614
+ });
615
+ export const CategoryFacetSchema = z.looseObject({
616
+ actions: CategoryFacetActionsSchema.optional(),
617
+ component: z.literal('CategoryFacet'),
618
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
619
+ state: CategoryFacetStateSchema.optional(),
620
+ });
621
+ export const RestoreStateSchema = z.strictObject({
622
+ payload: RestoreStatePayloadSchema,
623
+ });
624
+ export const PageSizeSchema = z.looseObject({
625
+ actions: PageSizeActionsSchema.optional(),
626
+ component: z.literal('PageSize'),
627
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
628
+ state: PageSizeStateSchema.optional(),
629
+ });
630
+ export const CartSchema = z.looseObject({
631
+ actions: CartActionsSchema.optional(),
632
+ component: z.literal('Cart'),
633
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
634
+ state: CartStateSchema.optional(),
635
+ });
636
+ export const CommerceSearchActionsSchema = z.strictObject({
637
+ overrideCorrection: OverrideCorrectionSchema,
638
+ restoreState: RestoreStateSchema,
639
+ submitQuery: SubmitQuerySchema,
640
+ });
641
+ export const CommerceSearchSchema = z.looseObject({
642
+ actions: CommerceSearchActionsSchema.optional(),
643
+ component: z.literal('CommerceSearch'),
644
+ id: z.string().min(1).regex(new RegExp('^[a-z][a-z0-9-]*$')),
645
+ state: CommerceSearchStateSchema.optional(),
646
+ });
647
+ export const ComponentContractsSchema = z.discriminatedUnion('component', [
463
648
  ProductCarouselSchema,
464
649
  CartSchema,
650
+ QuerySuggestionsSchema,
465
651
  NextActionsBarSchema,
466
652
  BundleDisplaySchema,
467
653
  ComparisonTableSchema,
468
654
  ProductListSchema,
655
+ ProductSummarySchema,
656
+ ProductResearchCardSchema,
469
657
  PaginationSchema,
470
658
  SortSchema,
471
- SearchBoxSchema,
472
659
  RegularFacetSchema,
473
660
  NumericFacetSchema,
474
661
  DateFacetSchema,
475
662
  CategoryFacetSchema,
476
663
  FacetManagerSchema,
664
+ CommerceSearchSchema,
665
+ LayoutStackSchema,
666
+ QuerySummarySchema,
667
+ PageSizeSchema,
477
668
  ]);
478
669
  /**
479
- * Component props schemas.
480
- * These props are injected by the A2-UI surface layer (backend) and passed to catalog
481
- * renderers automatically. Consumers should NOT hardcode these values; they arrive via
482
- * the createSurface message's components[].props.
670
+ * A2-UI dynamic-value building blocks (self-contained; no renderer / @a2ui/web_core dependency).
671
+ * A bindable prop is an A2-UI Dynamic_Value: a union admitting a literal resolved value, an
672
+ * A2-UI Data_Binding object { path }, or a function-call form. The frozen renderer's binder
673
+ * classifies a field as resolvable only when its schema is such a union including DataBinding,
674
+ * so it dereferences the { path } against the data model before the renderer sees it.
675
+ *
676
+ * `DataBindingSchema` is projected from the shared definitions/data-binding.schema.json (like
677
+ * ComponentId / ChildList), so it is not re-declared here; the unions below reference it.
483
678
  */
484
- export const BundleDisplayPropsSchema = z.object({
485
- componentId: z.string(),
486
- componentType: z.literal('bundle-display'),
679
+ export const FunctionCallSchema = z.object({
680
+ call: z.string(),
681
+ args: z.record(z.string(), z.any()),
682
+ returnType: z
683
+ .enum(['string', 'number', 'boolean', 'array', 'object', 'any', 'void'])
684
+ .default('boolean'),
685
+ });
686
+ export const DynamicNumberSchema = z.union([z.number(), DataBindingSchema, FunctionCallSchema]);
687
+ export const DynamicStringSchema = z.union([z.string(), DataBindingSchema, FunctionCallSchema]);
688
+ export const DynamicBooleanSchema = z.union([z.boolean(), DataBindingSchema, FunctionCallSchema]);
689
+ export const DynamicStringListSchema = z.union([
690
+ z.array(z.string()),
691
+ DataBindingSchema,
692
+ FunctionCallSchema,
693
+ ]);
694
+ export const DynamicValueSchema = z.union([z.unknown(), DataBindingSchema, FunctionCallSchema]);
695
+ /**
696
+ * The A2-UI Action schema for an action-typed prop: the standard A2-UI event shape
697
+ * { event: { name; context } }. Named DynamicAction to stay distinct from the generated base
698
+ * action-contract ActionSchema and from a component's dispatchable *Actions contract.
699
+ */
700
+ export const DynamicActionSchema = z.object({
701
+ event: z.object({
702
+ name: z.string(),
703
+ context: z.unknown().optional(),
704
+ }),
487
705
  });
488
- export const CartPropsSchema = z.object({
489
- componentId: z.string(),
490
- componentType: z.literal('cart'),
706
+ /**
707
+ * Per-component props schemas for the renderer catalog (one per component), passed to
708
+ * `createCatalog` as each component's `{ props }` schema. Each bindable prop is an A2-UI
709
+ * Dynamic_Value, so the renderer's binder resolves its `{ path }` binding against the A2-UI
710
+ * data model; composition child-ref props stay static so child ids reach the renderer
711
+ * untouched. The resolved shape a renderer actually reads is the `XxxProps` type.
712
+ */
713
+ export const BundleDisplayPropsSchema = z.object({
714
+ tiers: z.union([BundleDisplayStateSchema.shape['tiers'], DataBindingSchema, FunctionCallSchema]),
491
715
  });
716
+ export const CartPropsSchema = z.object({});
492
717
  export const CategoryFacetPropsSchema = z.object({
493
- componentId: z.string(),
494
- componentType: z.literal('category-facet'),
718
+ field: DynamicStringSchema,
719
+ displayName: DynamicStringSchema,
720
+ values: z.union([
721
+ CategoryFacetStateSchema.shape['values'],
722
+ DataBindingSchema,
723
+ FunctionCallSchema,
724
+ ]),
725
+ canShowMoreValues: DynamicBooleanSchema,
726
+ canShowLessValues: DynamicBooleanSchema,
727
+ facetSearch: z.union([
728
+ CategoryFacetStateSchema.shape['facetSearch'],
729
+ DataBindingSchema,
730
+ FunctionCallSchema,
731
+ ]),
732
+ });
733
+ export const CommerceSearchPropsSchema = z.object({
734
+ sidebarChild: z.string().optional(),
735
+ mainChild: z.string().optional(),
495
736
  });
496
737
  export const ComparisonTablePropsSchema = z.object({
497
- componentId: z.string(),
498
- componentType: z.literal('comparison-table'),
738
+ heading: DynamicStringSchema,
739
+ summary: DynamicStringSchema,
740
+ products: z.union([
741
+ ComparisonTableStateSchema.shape['products'],
742
+ DataBindingSchema,
743
+ FunctionCallSchema,
744
+ ]),
745
+ attributes: z.union([
746
+ ComparisonTableStateSchema.shape['attributes'],
747
+ DataBindingSchema,
748
+ FunctionCallSchema,
749
+ ]),
499
750
  });
500
751
  export const DateFacetPropsSchema = z.object({
501
- componentId: z.string(),
502
- componentType: z.literal('date-facet'),
752
+ field: DynamicStringSchema,
753
+ displayName: DynamicStringSchema,
754
+ values: z.union([DateFacetStateSchema.shape['values'], DataBindingSchema, FunctionCallSchema]),
755
+ customRange: z.union([
756
+ DateFacetStateSchema.shape['customRange'],
757
+ DataBindingSchema,
758
+ FunctionCallSchema,
759
+ ]),
760
+ hasActiveValues: DynamicBooleanSchema,
761
+ canShowMoreValues: DynamicBooleanSchema,
762
+ canShowLessValues: DynamicBooleanSchema,
503
763
  });
504
764
  export const FacetManagerPropsSchema = z.object({
505
- componentId: z.string(),
506
- componentType: z.literal('facet-manager'),
765
+ children: z.array(z.string()).optional(),
766
+ });
767
+ export const LayoutStackPropsSchema = z.object({
768
+ direction: z.string().optional(),
769
+ children: z.array(z.string()).optional(),
507
770
  });
508
771
  export const NextActionsBarPropsSchema = z.object({
509
- componentId: z.string(),
510
- componentType: z.literal('next-actions-bar'),
772
+ suggestedActions: z.union([
773
+ NextActionsStateSchema.shape['suggestedActions'],
774
+ DataBindingSchema,
775
+ FunctionCallSchema,
776
+ ]),
511
777
  });
512
778
  export const NumericFacetPropsSchema = z.object({
513
- componentId: z.string(),
514
- componentType: z.literal('numeric-facet'),
779
+ field: DynamicStringSchema,
780
+ displayName: DynamicStringSchema,
781
+ values: z.union([NumericFacetStateSchema.shape['values'], DataBindingSchema, FunctionCallSchema]),
782
+ customRange: z.union([
783
+ NumericFacetStateSchema.shape['customRange'],
784
+ DataBindingSchema,
785
+ FunctionCallSchema,
786
+ ]),
787
+ hasActiveValues: DynamicBooleanSchema,
788
+ canShowMoreValues: DynamicBooleanSchema,
789
+ canShowLessValues: DynamicBooleanSchema,
790
+ domain: z.union([NumericFacetStateSchema.shape['domain'], DataBindingSchema, FunctionCallSchema]),
791
+ });
792
+ export const PageSizePropsSchema = z.object({
793
+ pageSize: DynamicNumberSchema,
515
794
  });
516
795
  export const PaginationPropsSchema = z.object({
517
- componentId: z.string(),
518
- componentType: z.literal('pagination'),
796
+ page: DynamicNumberSchema,
797
+ pageSize: DynamicNumberSchema,
798
+ totalEntries: DynamicNumberSchema,
799
+ totalPages: DynamicNumberSchema,
519
800
  });
520
801
  export const ProductCarouselPropsSchema = z.object({
521
- componentId: z.string(),
522
- componentType: z.literal('product-carousel'),
802
+ heading: DynamicStringSchema,
803
+ products: z.union([
804
+ ProductCarouselStateSchema.shape['products'],
805
+ DataBindingSchema,
806
+ FunctionCallSchema,
807
+ ]),
523
808
  });
524
809
  export const ProductListPropsSchema = z.object({
525
- componentId: z.string(),
526
- componentType: z.literal('product-list'),
810
+ products: z.union([
811
+ ProductListStateSchema.shape['products'],
812
+ DataBindingSchema,
813
+ FunctionCallSchema,
814
+ ]),
815
+ });
816
+ export const ProductResearchCardPropsSchema = z.object({
817
+ product: z.union([
818
+ ProductResearchCardStateSchema.shape['product'],
819
+ DataBindingSchema,
820
+ FunctionCallSchema,
821
+ ]),
822
+ summary: DynamicStringSchema,
823
+ bullets: DynamicStringListSchema,
824
+ });
825
+ export const ProductSummaryPropsSchema = z.object({
826
+ categoryLabel: DynamicStringSchema,
827
+ product: z.union([
828
+ ProductSummaryStateSchema.shape['product'],
829
+ DataBindingSchema,
830
+ FunctionCallSchema,
831
+ ]),
832
+ });
833
+ export const QuerySuggestionsPropsSchema = z.object({
834
+ query: DynamicStringSchema,
835
+ completions: z.union([
836
+ QuerySuggestionsStateSchema.shape['completions'],
837
+ DataBindingSchema,
838
+ FunctionCallSchema,
839
+ ]),
840
+ products: z.union([
841
+ QuerySuggestionsStateSchema.shape['products'],
842
+ DataBindingSchema,
843
+ FunctionCallSchema,
844
+ ]),
845
+ });
846
+ export const QuerySummaryPropsSchema = z.object({
847
+ query: DynamicStringSchema,
848
+ firstIndex: DynamicNumberSchema,
849
+ lastIndex: DynamicNumberSchema,
850
+ totalEntries: DynamicNumberSchema,
527
851
  });
528
852
  export const RegularFacetPropsSchema = z.object({
529
- componentId: z.string(),
530
- componentType: z.literal('regular-facet'),
531
- });
532
- export const SearchBoxPropsSchema = z.object({
533
- componentId: z.string(),
534
- componentType: z.literal('search-box'),
853
+ field: DynamicStringSchema,
854
+ displayName: DynamicStringSchema,
855
+ values: z.union([RegularFacetStateSchema.shape['values'], DataBindingSchema, FunctionCallSchema]),
856
+ hasActiveValues: DynamicBooleanSchema,
857
+ canShowMoreValues: DynamicBooleanSchema,
858
+ canShowLessValues: DynamicBooleanSchema,
859
+ facetSearch: z.union([
860
+ RegularFacetStateSchema.shape['facetSearch'],
861
+ DataBindingSchema,
862
+ FunctionCallSchema,
863
+ ]),
535
864
  });
536
865
  export const SortPropsSchema = z.object({
537
- componentId: z.string(),
538
- componentType: z.literal('sort'),
866
+ appliedSort: z.union([
867
+ SortStateSchema.shape['appliedSort'],
868
+ DataBindingSchema,
869
+ FunctionCallSchema,
870
+ ]),
871
+ availableSorts: z.union([
872
+ SortStateSchema.shape['availableSorts'],
873
+ DataBindingSchema,
874
+ FunctionCallSchema,
875
+ ]),
539
876
  });
877
+ /**
878
+ * Per-component action unions in the standard A2-UI event shape
879
+ * { event: { name: <literal>; context: <typed payload> } }, one member per declared action.
880
+ * Derived from each component's *Actions contract (action-map key -> payload), NOT from
881
+ * quicktype's auto-named payload wrappers. A component with no actions has `type XxxAction =
882
+ * never`. The wire field is `context`; the internal validation layer calls the same data
883
+ * `payload` (see design: Action typing).
884
+ */
885
+ export const BundleDisplayActionSchema = z.never();
886
+ export const CartActionSchema = z.union([
887
+ z.object({
888
+ event: z.object({
889
+ name: z.literal('updateCart'),
890
+ context: z.strictObject({
891
+ productId: z.string(),
892
+ name: z.string().optional(),
893
+ price: z.unknown().optional(),
894
+ quantity: z.number().int().min(1),
895
+ operation: z.enum(['add', 'remove', 'setQuantity']),
896
+ }),
897
+ }),
898
+ }),
899
+ z.object({
900
+ event: z.object({
901
+ name: z.literal('purchase'),
902
+ context: z.strictObject({ products: z.array(z.unknown()), transaction: z.unknown() }),
903
+ }),
904
+ }),
905
+ ]);
906
+ export const CategoryFacetActionSchema = z.union([
907
+ z.object({
908
+ event: z.object({
909
+ name: z.literal('selectPath'),
910
+ context: z.strictObject({ path: z.array(z.string()) }),
911
+ }),
912
+ }),
913
+ z.object({ event: z.object({ name: z.literal('clearSelectedPath'), context: z.unknown() }) }),
914
+ z.object({
915
+ event: z.object({ name: z.literal('search'), context: z.strictObject({ query: z.string() }) }),
916
+ }),
917
+ z.object({ event: z.object({ name: z.literal('showMoreSearchResults'), context: z.unknown() }) }),
918
+ z.object({ event: z.object({ name: z.literal('clearSearch'), context: z.unknown() }) }),
919
+ z.object({ event: z.object({ name: z.literal('showMoreValues'), context: z.unknown() }) }),
920
+ z.object({ event: z.object({ name: z.literal('showLessValues'), context: z.unknown() }) }),
921
+ ]);
922
+ export const CommerceSearchActionSchema = z.union([
923
+ z.object({
924
+ event: z.object({ name: z.literal('submitQuery'), context: z.strictObject({ query: z.string() }) }),
925
+ }),
926
+ z.object({
927
+ event: z.object({
928
+ name: z.literal('restoreState'),
929
+ context: z.strictObject({
930
+ query: z.string(),
931
+ page: z.number().int().min(0),
932
+ pageSize: z.number().int().min(1),
933
+ sortCriteria: z.string().optional(),
934
+ facets: z.array(z.unknown()).optional(),
935
+ pinnedProducts: z.array(z.string()).optional(),
936
+ }),
937
+ }),
938
+ }),
939
+ z.object({
940
+ event: z.object({
941
+ name: z.literal('overrideCorrection'),
942
+ context: z.strictObject({ originalQuery: z.string() }),
943
+ }),
944
+ }),
945
+ ]);
946
+ export const ComparisonTableActionSchema = z.never();
947
+ export const DateFacetActionSchema = z.union([
948
+ z.object({
949
+ event: z.object({
950
+ name: z.literal('toggleSelect'),
951
+ context: z.strictObject({ start: z.string(), end: z.string() }),
952
+ }),
953
+ }),
954
+ z.object({
955
+ event: z.object({
956
+ name: z.literal('toggleSingleSelect'),
957
+ context: z.strictObject({ start: z.string(), end: z.string() }),
958
+ }),
959
+ }),
960
+ z.object({ event: z.object({ name: z.literal('clearAllActiveValues'), context: z.unknown() }) }),
961
+ z.object({
962
+ event: z.object({
963
+ name: z.literal('applyCustomRange'),
964
+ context: z.strictObject({ start: z.string(), end: z.string() }),
965
+ }),
966
+ }),
967
+ z.object({ event: z.object({ name: z.literal('showMoreValues'), context: z.unknown() }) }),
968
+ z.object({ event: z.object({ name: z.literal('showLessValues'), context: z.unknown() }) }),
969
+ ]);
970
+ export const FacetManagerActionSchema = z.never();
971
+ export const LayoutStackActionSchema = z.never();
972
+ export const NextActionsBarActionSchema = z.union([
973
+ z.object({
974
+ event: z.object({
975
+ name: z.literal('selectAction'),
976
+ context: z.strictObject({ text: z.string(), type: z.enum(['followup', 'search']) }),
977
+ }),
978
+ }),
979
+ z.object({
980
+ event: z.object({
981
+ name: z.literal('selectSearchOption'),
982
+ context: z.strictObject({ optionId: z.string() }),
983
+ }),
984
+ }),
985
+ ]);
986
+ export const NumericFacetActionSchema = z.union([
987
+ z.object({
988
+ event: z.object({
989
+ name: z.literal('toggleSelect'),
990
+ context: z.strictObject({ start: z.number(), end: z.number() }),
991
+ }),
992
+ }),
993
+ z.object({
994
+ event: z.object({
995
+ name: z.literal('toggleSingleSelect'),
996
+ context: z.strictObject({ start: z.number(), end: z.number() }),
997
+ }),
998
+ }),
999
+ z.object({ event: z.object({ name: z.literal('clearAllActiveValues'), context: z.unknown() }) }),
1000
+ z.object({
1001
+ event: z.object({
1002
+ name: z.literal('applyCustomRange'),
1003
+ context: z.strictObject({ start: z.number(), end: z.number() }),
1004
+ }),
1005
+ }),
1006
+ z.object({ event: z.object({ name: z.literal('showMoreValues'), context: z.unknown() }) }),
1007
+ z.object({ event: z.object({ name: z.literal('showLessValues'), context: z.unknown() }) }),
1008
+ ]);
1009
+ export const PageSizeActionSchema = z.union([
1010
+ z.object({
1011
+ event: z.object({
1012
+ name: z.literal('setPageSize'),
1013
+ context: z.strictObject({ pageSize: z.number().int().min(1) }),
1014
+ }),
1015
+ }),
1016
+ ]);
1017
+ export const PaginationActionSchema = z.union([
1018
+ z.object({
1019
+ event: z.object({
1020
+ name: z.literal('selectPage'),
1021
+ context: z.strictObject({ page: z.number().int().min(0) }),
1022
+ }),
1023
+ }),
1024
+ z.object({
1025
+ event: z.object({
1026
+ name: z.literal('setPageSize'),
1027
+ context: z.strictObject({ pageSize: z.number().int().min(1) }),
1028
+ }),
1029
+ }),
1030
+ z.object({ event: z.object({ name: z.literal('showMore'), context: z.strictObject({}) }) }),
1031
+ ]);
1032
+ export const ProductCarouselActionSchema = z.never();
1033
+ export const ProductListActionSchema = z.union([
1034
+ z.object({
1035
+ event: z.object({
1036
+ name: z.literal('selectProducts'),
1037
+ context: z.strictObject({ productIds: z.array(z.string()) }),
1038
+ }),
1039
+ }),
1040
+ z.object({
1041
+ event: z.object({
1042
+ name: z.literal('productClick'),
1043
+ context: z.strictObject({
1044
+ productId: z.string(),
1045
+ name: z.string().optional(),
1046
+ price: z.unknown().optional(),
1047
+ position: z.number().int().min(0),
1048
+ }),
1049
+ }),
1050
+ }),
1051
+ ]);
1052
+ export const ProductResearchCardActionSchema = z.never();
1053
+ export const ProductSummaryActionSchema = z.never();
1054
+ export const QuerySuggestionsActionSchema = z.union([
1055
+ z.object({
1056
+ event: z.object({
1057
+ name: z.literal('fetchSuggestions'),
1058
+ context: z.strictObject({ query: z.string() }),
1059
+ }),
1060
+ }),
1061
+ ]);
1062
+ export const QuerySummaryActionSchema = z.never();
1063
+ export const RegularFacetActionSchema = z.union([
1064
+ z.object({
1065
+ event: z.object({
1066
+ name: z.literal('toggleSelect'),
1067
+ context: z.strictObject({ value: z.string() }),
1068
+ }),
1069
+ }),
1070
+ z.object({
1071
+ event: z.object({
1072
+ name: z.literal('toggleExclude'),
1073
+ context: z.strictObject({ value: z.string() }),
1074
+ }),
1075
+ }),
1076
+ z.object({
1077
+ event: z.object({
1078
+ name: z.literal('toggleSingleSelect'),
1079
+ context: z.strictObject({ value: z.string() }),
1080
+ }),
1081
+ }),
1082
+ z.object({
1083
+ event: z.object({
1084
+ name: z.literal('toggleSingleExclude'),
1085
+ context: z.strictObject({ value: z.string() }),
1086
+ }),
1087
+ }),
1088
+ z.object({ event: z.object({ name: z.literal('clearAllActiveValues'), context: z.unknown() }) }),
1089
+ z.object({
1090
+ event: z.object({ name: z.literal('search'), context: z.strictObject({ query: z.string() }) }),
1091
+ }),
1092
+ z.object({ event: z.object({ name: z.literal('showMoreSearchResults'), context: z.unknown() }) }),
1093
+ z.object({ event: z.object({ name: z.literal('clearSearch'), context: z.unknown() }) }),
1094
+ z.object({ event: z.object({ name: z.literal('showMoreValues'), context: z.unknown() }) }),
1095
+ z.object({ event: z.object({ name: z.literal('showLessValues'), context: z.unknown() }) }),
1096
+ ]);
1097
+ export const SortActionSchema = z.union([
1098
+ z.object({
1099
+ event: z.object({
1100
+ name: z.literal('selectSort'),
1101
+ context: z.strictObject({ sortCriteria: z.string(), fields: z.array(z.unknown()) }),
1102
+ }),
1103
+ }),
1104
+ ]);