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

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