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