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