@coveo/thermidor-schema 1.0.0-beta.3 → 1.0.0-beta.30

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