@coveo/thermidor-schema 0.0.0 → 1.0.0-beta.2
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/LICENSE +201 -0
- package/README.md +34 -0
- package/dist/generated/schemas.d.ts +1823 -0
- package/dist/generated/schemas.js +539 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +2 -0
- package/package.json +46 -8
- package/schema/base/action.schema.json +12 -0
- package/schema/base/catalog.schema.json +37 -0
- package/schema/base/component.schema.json +41 -0
- package/schema/components/bundle-display.schema.json +47 -0
- package/schema/components/cart.schema.json +108 -0
- package/schema/components/category-facet.schema.json +292 -0
- package/schema/components/comparison-table.schema.json +54 -0
- package/schema/components/component-contracts.schema.json +55 -0
- package/schema/components/date-facet.schema.json +281 -0
- package/schema/components/facet-manager.schema.json +47 -0
- package/schema/components/next-actions-bar.schema.json +87 -0
- package/schema/components/numeric-facet.schema.json +303 -0
- package/schema/components/pagination.schema.json +123 -0
- package/schema/components/product-carousel.schema.json +52 -0
- package/schema/components/product-list.schema.json +46 -0
- package/schema/components/regular-facet.schema.json +385 -0
- package/schema/components/search-box.schema.json +74 -0
- package/schema/components/sort.schema.json +107 -0
- package/schema/definitions/action-item.schema.json +20 -0
- package/schema/definitions/bundle-tier.schema.json +44 -0
- package/schema/definitions/cart-item.schema.json +29 -0
- package/schema/definitions/comparison-attribute.schema.json +19 -0
- package/schema/definitions/comparison-product.schema.json +39 -0
- package/schema/definitions/facet-value-state.schema.json +8 -0
- package/schema/definitions/product.schema.json +92 -0
- package/schema/definitions/selectable-facet-value-state.schema.json +8 -0
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
// This file is generated from the canonical JSON Schema documents.
|
|
2
|
+
// Do not edit it directly; run `mise run generate` from the repository root.
|
|
3
|
+
import * as z from 'zod/v4';
|
|
4
|
+
// The kind of action: "followup" triggers a conversational follow-up, "search" triggers a
|
|
5
|
+
// standalone search.
|
|
6
|
+
//
|
|
7
|
+
// The kind of action selected: "followup" or "search".
|
|
8
|
+
export const TypeSchema = z.enum(['followup', 'search']);
|
|
9
|
+
// The selection state of a facet value, shared across all commerce facet components.
|
|
10
|
+
//
|
|
11
|
+
// The selection state of this facet value.
|
|
12
|
+
export const FacetValueStateSchema = z.enum(['excluded', 'idle', 'selected']);
|
|
13
|
+
// The selection state of a facet value that supports selection but not exclusion (e.g.
|
|
14
|
+
// numeric and date facets). Constrained to 'idle' or 'selected'.
|
|
15
|
+
//
|
|
16
|
+
// The selection state of this facet value (idle or selected; exclusion is not supported).
|
|
17
|
+
export const SelectableFacetValueStateSchema = z.enum(['idle', 'selected']);
|
|
18
|
+
export const ProductSchema = z.strictObject({
|
|
19
|
+
additionalFields: z.record(z.string(), z.unknown()),
|
|
20
|
+
get children() {
|
|
21
|
+
return z.array(ProductSchema).optional();
|
|
22
|
+
},
|
|
23
|
+
clickUri: z.url().optional(),
|
|
24
|
+
ec_brand: z.string().optional(),
|
|
25
|
+
ec_category: z.array(z.string()).optional(),
|
|
26
|
+
ec_color: z.string().optional(),
|
|
27
|
+
ec_description: z.string().optional(),
|
|
28
|
+
ec_images: z.array(z.url()).optional(),
|
|
29
|
+
ec_in_stock: z.boolean().optional(),
|
|
30
|
+
ec_item_group_id: z.string().optional(),
|
|
31
|
+
ec_item_group_name: z.string().optional(),
|
|
32
|
+
ec_name: z.string(),
|
|
33
|
+
ec_price: z.number().optional(),
|
|
34
|
+
ec_promo_price: z.number().optional(),
|
|
35
|
+
ec_rating: z.union([z.number().min(0).max(5), z.null()]).optional(),
|
|
36
|
+
ec_shortdesc: z.string().optional(),
|
|
37
|
+
ec_thumbnails: z.array(z.url()).optional(),
|
|
38
|
+
permanentid: z.string(),
|
|
39
|
+
});
|
|
40
|
+
export const ProductCarouselActionsSchema = z.strictObject({});
|
|
41
|
+
export const ProductCarouselStateSchema = z.strictObject({
|
|
42
|
+
heading: z.string(),
|
|
43
|
+
products: z.array(ProductSchema),
|
|
44
|
+
});
|
|
45
|
+
export const CartItemSchema = z.strictObject({
|
|
46
|
+
name: z.string(),
|
|
47
|
+
price: z.number().min(0),
|
|
48
|
+
productId: z.string(),
|
|
49
|
+
quantity: z.number().int().min(1),
|
|
50
|
+
});
|
|
51
|
+
export const UpdateItemQuantityPayloadSchema = z.strictObject({
|
|
52
|
+
item: CartItemSchema,
|
|
53
|
+
});
|
|
54
|
+
export const CartStateSchema = z.strictObject({
|
|
55
|
+
items: z.array(CartItemSchema),
|
|
56
|
+
});
|
|
57
|
+
export const SelectActionPayloadSchema = z.strictObject({
|
|
58
|
+
text: z.string(),
|
|
59
|
+
type: z.enum(['followup', 'search']),
|
|
60
|
+
});
|
|
61
|
+
export const ActionItemSchema = z.strictObject({
|
|
62
|
+
text: z.string(),
|
|
63
|
+
type: z.enum(['followup', 'search']),
|
|
64
|
+
});
|
|
65
|
+
export const BundleDisplayActionsSchema = z.strictObject({});
|
|
66
|
+
export const BundleSlotSchema = z.strictObject({
|
|
67
|
+
categoryLabel: z.string(),
|
|
68
|
+
surfaceRef: z.string(),
|
|
69
|
+
});
|
|
70
|
+
export const ComparisonTableActionsSchema = z.strictObject({});
|
|
71
|
+
export const ComparisonAttributeSchema = z.strictObject({
|
|
72
|
+
key: z.string(),
|
|
73
|
+
label: z.string(),
|
|
74
|
+
});
|
|
75
|
+
export const ComparisonProductSchema = z.strictObject({
|
|
76
|
+
imageUrl: z.url().optional(),
|
|
77
|
+
name: z.string(),
|
|
78
|
+
price: z.number().optional(),
|
|
79
|
+
productId: z.string(),
|
|
80
|
+
rating: z.number().min(0).max(5).optional(),
|
|
81
|
+
values: z.record(z.string(), z.string()),
|
|
82
|
+
});
|
|
83
|
+
export const ProductListActionsSchema = z.strictObject({});
|
|
84
|
+
export const ProductListStateSchema = z.strictObject({
|
|
85
|
+
products: z.array(ProductSchema),
|
|
86
|
+
});
|
|
87
|
+
export const SelectPagePayloadSchema = z.strictObject({
|
|
88
|
+
page: z.number().int().min(0),
|
|
89
|
+
});
|
|
90
|
+
export const SetPageSizePayloadSchema = z.strictObject({
|
|
91
|
+
pageSize: z.number().int().min(1),
|
|
92
|
+
});
|
|
93
|
+
export const PaginationStateSchema = z.strictObject({
|
|
94
|
+
page: z.number().int().min(0),
|
|
95
|
+
pageSize: z.number().int().min(1),
|
|
96
|
+
totalEntries: z.number().int().min(0),
|
|
97
|
+
totalPages: z.number().int().min(0),
|
|
98
|
+
});
|
|
99
|
+
export const SelectSortPayloadSchema = z.strictObject({
|
|
100
|
+
fields: z.array(z.unknown()),
|
|
101
|
+
sortCriteria: z.string(),
|
|
102
|
+
});
|
|
103
|
+
export const SortCriterionSchema = z.strictObject({
|
|
104
|
+
fields: z.array(z.unknown()),
|
|
105
|
+
sortCriteria: z.string(),
|
|
106
|
+
});
|
|
107
|
+
export const SubmitQueryPayloadSchema = z.strictObject({
|
|
108
|
+
query: z.string(),
|
|
109
|
+
});
|
|
110
|
+
export const SearchBoxStateSchema = z.strictObject({
|
|
111
|
+
query: z.string(),
|
|
112
|
+
});
|
|
113
|
+
export const ActionSchema = z.strictObject({
|
|
114
|
+
payload: z.unknown(),
|
|
115
|
+
});
|
|
116
|
+
export const SearchPayloadSchema = z.strictObject({
|
|
117
|
+
query: z.string().min(0).max(1024),
|
|
118
|
+
});
|
|
119
|
+
export const RegularFacetToggleExcludePayloadSchema = z.strictObject({
|
|
120
|
+
value: z.string().min(1).max(1024),
|
|
121
|
+
});
|
|
122
|
+
export const RegularFacetToggleSelectPayloadSchema = z.strictObject({
|
|
123
|
+
value: z.string().min(1).max(1024),
|
|
124
|
+
});
|
|
125
|
+
export const RegularFacetToggleSingleExcludePayloadSchema = z.strictObject({
|
|
126
|
+
value: z.string().min(1).max(1024),
|
|
127
|
+
});
|
|
128
|
+
export const RegularFacetToggleSingleSelectPayloadSchema = z.strictObject({
|
|
129
|
+
value: z.string().min(1).max(1024),
|
|
130
|
+
});
|
|
131
|
+
export const RegularFacetSearchResultSchema = z.strictObject({
|
|
132
|
+
numberOfResults: z.number().int().min(0).max(999999999),
|
|
133
|
+
value: z.string().min(1).max(1024),
|
|
134
|
+
});
|
|
135
|
+
export const RegularFacetValueSchema = z.strictObject({
|
|
136
|
+
numberOfResults: z.number().int().min(0).max(999999999),
|
|
137
|
+
state: z.enum(['idle', 'selected', 'excluded']),
|
|
138
|
+
value: z.string().min(1).max(1024),
|
|
139
|
+
});
|
|
140
|
+
export const NumericFacetApplyCustomRangePayloadSchema = z.strictObject({
|
|
141
|
+
end: z.number(),
|
|
142
|
+
start: z.number(),
|
|
143
|
+
});
|
|
144
|
+
export const NumericFacetToggleSelectPayloadSchema = z.strictObject({
|
|
145
|
+
end: z.number(),
|
|
146
|
+
start: z.number(),
|
|
147
|
+
});
|
|
148
|
+
export const NumericFacetToggleSingleSelectPayloadSchema = z.strictObject({
|
|
149
|
+
end: z.number(),
|
|
150
|
+
start: z.number(),
|
|
151
|
+
});
|
|
152
|
+
export const NumericFacetCustomRangeSchema = z.strictObject({
|
|
153
|
+
end: z.number(),
|
|
154
|
+
numberOfResults: z.number().int().min(0),
|
|
155
|
+
start: z.number(),
|
|
156
|
+
});
|
|
157
|
+
export const NumericFacetDomainSchema = z.strictObject({
|
|
158
|
+
max: z.number().optional(),
|
|
159
|
+
min: z.number().optional(),
|
|
160
|
+
});
|
|
161
|
+
export const NumericFacetValueSchema = z.strictObject({
|
|
162
|
+
end: z.number(),
|
|
163
|
+
numberOfResults: z.number().int().min(0),
|
|
164
|
+
start: z.number(),
|
|
165
|
+
state: z.enum(['idle', 'selected']),
|
|
166
|
+
});
|
|
167
|
+
export const DateFacetApplyCustomRangePayloadSchema = z.strictObject({
|
|
168
|
+
end: z.string(),
|
|
169
|
+
start: z.string(),
|
|
170
|
+
});
|
|
171
|
+
export const DateFacetToggleSelectPayloadSchema = z.strictObject({
|
|
172
|
+
end: z.string(),
|
|
173
|
+
start: z.string(),
|
|
174
|
+
});
|
|
175
|
+
export const DateFacetToggleSingleSelectPayloadSchema = z.strictObject({
|
|
176
|
+
end: z.string(),
|
|
177
|
+
start: z.string(),
|
|
178
|
+
});
|
|
179
|
+
export const DateFacetCustomRangeSchema = z.strictObject({
|
|
180
|
+
end: z.string(),
|
|
181
|
+
numberOfResults: z.number().int().min(0),
|
|
182
|
+
start: z.string(),
|
|
183
|
+
});
|
|
184
|
+
export const DateFacetValueSchema = z.strictObject({
|
|
185
|
+
end: z.string(),
|
|
186
|
+
numberOfResults: z.number().int().min(0),
|
|
187
|
+
start: z.string(),
|
|
188
|
+
state: z.enum(['idle', 'selected']),
|
|
189
|
+
});
|
|
190
|
+
export const CategoryFacetSearchPayloadSchema = z.strictObject({
|
|
191
|
+
query: z.string().max(256),
|
|
192
|
+
});
|
|
193
|
+
export const CategoryFacetSelectPathPayloadSchema = z.strictObject({
|
|
194
|
+
path: z.array(z.string()),
|
|
195
|
+
});
|
|
196
|
+
export const CategoryFacetValueSchema = z.strictObject({
|
|
197
|
+
numberOfResults: z.number().int().min(0),
|
|
198
|
+
path: z.array(z.string()),
|
|
199
|
+
value: z.string(),
|
|
200
|
+
});
|
|
201
|
+
export const CategoryFacetValuesSchema = z.strictObject({
|
|
202
|
+
ancestry: z.array(CategoryFacetValueSchema),
|
|
203
|
+
children: z.array(CategoryFacetValueSchema),
|
|
204
|
+
selected: z.union([CategoryFacetValueSchema, z.null()]),
|
|
205
|
+
});
|
|
206
|
+
export const FacetManagerActionsSchema = z.strictObject({});
|
|
207
|
+
export const FacetManagerStateSchema = z.strictObject({
|
|
208
|
+
facetIds: z.array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$'))),
|
|
209
|
+
});
|
|
210
|
+
export const ProductCarouselSchema = z.strictObject({
|
|
211
|
+
actions: ProductCarouselActionsSchema,
|
|
212
|
+
componentType: z.literal('product-carousel'),
|
|
213
|
+
state: ProductCarouselStateSchema,
|
|
214
|
+
});
|
|
215
|
+
export const SetItemsPayloadSchema = z.strictObject({
|
|
216
|
+
items: z.array(CartItemSchema),
|
|
217
|
+
});
|
|
218
|
+
export const UpdateItemQuantitySchema = z.strictObject({
|
|
219
|
+
payload: UpdateItemQuantityPayloadSchema,
|
|
220
|
+
});
|
|
221
|
+
export const SelectActionSchema = z.strictObject({
|
|
222
|
+
payload: SelectActionPayloadSchema,
|
|
223
|
+
});
|
|
224
|
+
export const NextActionsStateSchema = z.strictObject({
|
|
225
|
+
actions: z.array(ActionItemSchema),
|
|
226
|
+
});
|
|
227
|
+
export const BundleTierSchema = z.strictObject({
|
|
228
|
+
description: z.string(),
|
|
229
|
+
label: z.string(),
|
|
230
|
+
slots: z.array(BundleSlotSchema),
|
|
231
|
+
});
|
|
232
|
+
export const ComparisonTableStateSchema = z.strictObject({
|
|
233
|
+
attributes: z.array(ComparisonAttributeSchema),
|
|
234
|
+
products: z.array(ComparisonProductSchema),
|
|
235
|
+
});
|
|
236
|
+
export const ProductListSchema = z.strictObject({
|
|
237
|
+
actions: ProductListActionsSchema,
|
|
238
|
+
componentType: z.literal('product-list'),
|
|
239
|
+
state: ProductListStateSchema,
|
|
240
|
+
});
|
|
241
|
+
export const SelectPageSchema = z.strictObject({
|
|
242
|
+
payload: SelectPagePayloadSchema,
|
|
243
|
+
});
|
|
244
|
+
export const SetPageSizeSchema = z.strictObject({
|
|
245
|
+
payload: SetPageSizePayloadSchema,
|
|
246
|
+
});
|
|
247
|
+
export const SelectSortSchema = z.strictObject({
|
|
248
|
+
payload: SelectSortPayloadSchema,
|
|
249
|
+
});
|
|
250
|
+
export const SortStateSchema = z.strictObject({
|
|
251
|
+
appliedSort: SortCriterionSchema,
|
|
252
|
+
availableSorts: z.array(SortCriterionSchema),
|
|
253
|
+
});
|
|
254
|
+
export const SubmitQuerySchema = z.strictObject({
|
|
255
|
+
payload: SubmitQueryPayloadSchema,
|
|
256
|
+
});
|
|
257
|
+
export const SearchSchema = z.strictObject({
|
|
258
|
+
payload: SearchPayloadSchema,
|
|
259
|
+
});
|
|
260
|
+
export const RegularFacetToggleExcludeSchema = z.strictObject({
|
|
261
|
+
payload: RegularFacetToggleExcludePayloadSchema,
|
|
262
|
+
});
|
|
263
|
+
export const RegularFacetToggleSelectSchema = z.strictObject({
|
|
264
|
+
payload: RegularFacetToggleSelectPayloadSchema,
|
|
265
|
+
});
|
|
266
|
+
export const RegularFacetToggleSingleExcludeSchema = z.strictObject({
|
|
267
|
+
payload: RegularFacetToggleSingleExcludePayloadSchema,
|
|
268
|
+
});
|
|
269
|
+
export const RegularFacetToggleSingleSelectSchema = z.strictObject({
|
|
270
|
+
payload: RegularFacetToggleSingleSelectPayloadSchema,
|
|
271
|
+
});
|
|
272
|
+
export const RegularFacetSearchSchema = z.strictObject({
|
|
273
|
+
canShowMoreResults: z.boolean(),
|
|
274
|
+
query: z.string().min(0).max(1024),
|
|
275
|
+
results: z.array(RegularFacetSearchResultSchema).max(1000),
|
|
276
|
+
});
|
|
277
|
+
export const NumericFacetApplyCustomRangeSchema = z.strictObject({
|
|
278
|
+
payload: NumericFacetApplyCustomRangePayloadSchema,
|
|
279
|
+
});
|
|
280
|
+
export const NumericFacetToggleSelectSchema = z.strictObject({
|
|
281
|
+
payload: NumericFacetToggleSelectPayloadSchema,
|
|
282
|
+
});
|
|
283
|
+
export const NumericFacetToggleSingleSelectSchema = z.strictObject({
|
|
284
|
+
payload: NumericFacetToggleSingleSelectPayloadSchema,
|
|
285
|
+
});
|
|
286
|
+
export const NumericFacetStateSchema = z.strictObject({
|
|
287
|
+
canShowLessValues: z.boolean(),
|
|
288
|
+
canShowMoreValues: z.boolean(),
|
|
289
|
+
customRange: z.union([NumericFacetCustomRangeSchema, z.null()]),
|
|
290
|
+
displayName: z.string(),
|
|
291
|
+
domain: NumericFacetDomainSchema.optional(),
|
|
292
|
+
field: z.string(),
|
|
293
|
+
hasActiveValues: z.boolean(),
|
|
294
|
+
values: z.array(NumericFacetValueSchema).max(500),
|
|
295
|
+
});
|
|
296
|
+
export const DateFacetApplyCustomRangeSchema = z.strictObject({
|
|
297
|
+
payload: DateFacetApplyCustomRangePayloadSchema,
|
|
298
|
+
});
|
|
299
|
+
export const DateFacetToggleSelectSchema = z.strictObject({
|
|
300
|
+
payload: DateFacetToggleSelectPayloadSchema,
|
|
301
|
+
});
|
|
302
|
+
export const DateFacetToggleSingleSelectSchema = z.strictObject({
|
|
303
|
+
payload: DateFacetToggleSingleSelectPayloadSchema,
|
|
304
|
+
});
|
|
305
|
+
export const DateFacetStateSchema = z.strictObject({
|
|
306
|
+
canShowLessValues: z.boolean(),
|
|
307
|
+
canShowMoreValues: z.boolean(),
|
|
308
|
+
customRange: z.union([DateFacetCustomRangeSchema, z.null()]),
|
|
309
|
+
displayName: z.string(),
|
|
310
|
+
field: z.string(),
|
|
311
|
+
hasActiveValues: z.boolean(),
|
|
312
|
+
values: z.array(DateFacetValueSchema),
|
|
313
|
+
});
|
|
314
|
+
export const CategoryFacetSearchSchema = z.strictObject({
|
|
315
|
+
payload: CategoryFacetSearchPayloadSchema,
|
|
316
|
+
});
|
|
317
|
+
export const CategoryFacetSelectPathSchema = z.strictObject({
|
|
318
|
+
payload: CategoryFacetSelectPathPayloadSchema,
|
|
319
|
+
});
|
|
320
|
+
export const FacetSearchClassSchema = z.strictObject({
|
|
321
|
+
canShowMoreResults: z.boolean(),
|
|
322
|
+
query: z.string().max(256),
|
|
323
|
+
results: z.array(CategoryFacetValueSchema),
|
|
324
|
+
});
|
|
325
|
+
export const FacetManagerSchema = z.strictObject({
|
|
326
|
+
actions: FacetManagerActionsSchema,
|
|
327
|
+
componentType: z.literal('facet-manager'),
|
|
328
|
+
state: FacetManagerStateSchema,
|
|
329
|
+
});
|
|
330
|
+
export const SetItemsSchema = z.strictObject({
|
|
331
|
+
payload: SetItemsPayloadSchema,
|
|
332
|
+
});
|
|
333
|
+
export const NextActionsBarActionsSchema = z.strictObject({
|
|
334
|
+
selectAction: SelectActionSchema,
|
|
335
|
+
});
|
|
336
|
+
export const BundleDisplayStateSchema = z.strictObject({
|
|
337
|
+
tiers: z.array(BundleTierSchema),
|
|
338
|
+
});
|
|
339
|
+
export const ComparisonTableSchema = z.strictObject({
|
|
340
|
+
actions: ComparisonTableActionsSchema,
|
|
341
|
+
componentType: z.literal('comparison-table'),
|
|
342
|
+
state: ComparisonTableStateSchema,
|
|
343
|
+
});
|
|
344
|
+
export const PaginationActionsSchema = z.strictObject({
|
|
345
|
+
selectPage: SelectPageSchema,
|
|
346
|
+
setPageSize: SetPageSizeSchema,
|
|
347
|
+
});
|
|
348
|
+
export const SortActionsSchema = z.strictObject({
|
|
349
|
+
selectSort: SelectSortSchema,
|
|
350
|
+
});
|
|
351
|
+
export const SearchBoxActionsSchema = z.strictObject({
|
|
352
|
+
submitQuery: SubmitQuerySchema,
|
|
353
|
+
});
|
|
354
|
+
export const RegularFacetActionsSchema = z.strictObject({
|
|
355
|
+
clearAllActiveValues: ActionSchema,
|
|
356
|
+
clearSearch: ActionSchema,
|
|
357
|
+
search: SearchSchema,
|
|
358
|
+
showLessValues: ActionSchema,
|
|
359
|
+
showMoreSearchResults: ActionSchema,
|
|
360
|
+
showMoreValues: ActionSchema,
|
|
361
|
+
toggleExclude: RegularFacetToggleExcludeSchema,
|
|
362
|
+
toggleSelect: RegularFacetToggleSelectSchema,
|
|
363
|
+
toggleSingleExclude: RegularFacetToggleSingleExcludeSchema,
|
|
364
|
+
toggleSingleSelect: RegularFacetToggleSingleSelectSchema,
|
|
365
|
+
});
|
|
366
|
+
export const RegularFacetStateSchema = z.strictObject({
|
|
367
|
+
canShowLessValues: z.boolean(),
|
|
368
|
+
canShowMoreValues: z.boolean(),
|
|
369
|
+
displayName: z.string().min(1).max(255),
|
|
370
|
+
facetSearch: RegularFacetSearchSchema,
|
|
371
|
+
field: z.string().min(1).max(255),
|
|
372
|
+
hasActiveValues: z.boolean(),
|
|
373
|
+
values: z.array(RegularFacetValueSchema).max(1000),
|
|
374
|
+
});
|
|
375
|
+
export const NumericFacetActionsSchema = z.strictObject({
|
|
376
|
+
applyCustomRange: NumericFacetApplyCustomRangeSchema,
|
|
377
|
+
clearAllActiveValues: ActionSchema,
|
|
378
|
+
showLessValues: ActionSchema,
|
|
379
|
+
showMoreValues: ActionSchema,
|
|
380
|
+
toggleSelect: NumericFacetToggleSelectSchema,
|
|
381
|
+
toggleSingleSelect: NumericFacetToggleSingleSelectSchema,
|
|
382
|
+
});
|
|
383
|
+
export const DateFacetActionsSchema = z.strictObject({
|
|
384
|
+
applyCustomRange: DateFacetApplyCustomRangeSchema,
|
|
385
|
+
clearAllActiveValues: ActionSchema,
|
|
386
|
+
showLessValues: ActionSchema,
|
|
387
|
+
showMoreValues: ActionSchema,
|
|
388
|
+
toggleSelect: DateFacetToggleSelectSchema,
|
|
389
|
+
toggleSingleSelect: DateFacetToggleSingleSelectSchema,
|
|
390
|
+
});
|
|
391
|
+
export const CategoryFacetActionsSchema = z.strictObject({
|
|
392
|
+
clearSearch: ActionSchema,
|
|
393
|
+
clearSelectedPath: ActionSchema,
|
|
394
|
+
search: CategoryFacetSearchSchema,
|
|
395
|
+
selectPath: CategoryFacetSelectPathSchema,
|
|
396
|
+
showLessValues: ActionSchema,
|
|
397
|
+
showMoreSearchResults: ActionSchema,
|
|
398
|
+
showMoreValues: ActionSchema,
|
|
399
|
+
});
|
|
400
|
+
export const CategoryFacetStateSchema = z.strictObject({
|
|
401
|
+
canShowLessValues: z.boolean(),
|
|
402
|
+
canShowMoreValues: z.boolean(),
|
|
403
|
+
displayName: z.string(),
|
|
404
|
+
facetSearch: FacetSearchClassSchema,
|
|
405
|
+
field: z.string(),
|
|
406
|
+
values: CategoryFacetValuesSchema,
|
|
407
|
+
});
|
|
408
|
+
export const CartActionsSchema = z.strictObject({
|
|
409
|
+
setItems: SetItemsSchema,
|
|
410
|
+
updateItemQuantity: UpdateItemQuantitySchema,
|
|
411
|
+
});
|
|
412
|
+
export const NextActionsBarSchema = z.strictObject({
|
|
413
|
+
actions: NextActionsBarActionsSchema,
|
|
414
|
+
componentType: z.literal('next-actions-bar'),
|
|
415
|
+
state: NextActionsStateSchema,
|
|
416
|
+
});
|
|
417
|
+
export const BundleDisplaySchema = z.strictObject({
|
|
418
|
+
actions: BundleDisplayActionsSchema,
|
|
419
|
+
componentType: z.literal('bundle-display'),
|
|
420
|
+
state: BundleDisplayStateSchema,
|
|
421
|
+
});
|
|
422
|
+
export const PaginationSchema = z.strictObject({
|
|
423
|
+
actions: PaginationActionsSchema,
|
|
424
|
+
componentType: z.literal('pagination'),
|
|
425
|
+
state: PaginationStateSchema,
|
|
426
|
+
});
|
|
427
|
+
export const SortSchema = z.strictObject({
|
|
428
|
+
actions: SortActionsSchema,
|
|
429
|
+
componentType: z.literal('sort'),
|
|
430
|
+
state: SortStateSchema,
|
|
431
|
+
});
|
|
432
|
+
export const SearchBoxSchema = z.strictObject({
|
|
433
|
+
actions: SearchBoxActionsSchema,
|
|
434
|
+
componentType: z.literal('search-box'),
|
|
435
|
+
state: SearchBoxStateSchema,
|
|
436
|
+
});
|
|
437
|
+
export const RegularFacetSchema = z.strictObject({
|
|
438
|
+
actions: RegularFacetActionsSchema,
|
|
439
|
+
componentType: z.literal('regular-facet'),
|
|
440
|
+
state: RegularFacetStateSchema,
|
|
441
|
+
});
|
|
442
|
+
export const NumericFacetSchema = z.strictObject({
|
|
443
|
+
actions: NumericFacetActionsSchema,
|
|
444
|
+
componentType: z.literal('numeric-facet'),
|
|
445
|
+
state: NumericFacetStateSchema,
|
|
446
|
+
});
|
|
447
|
+
export const DateFacetSchema = z.strictObject({
|
|
448
|
+
actions: DateFacetActionsSchema,
|
|
449
|
+
componentType: z.literal('date-facet'),
|
|
450
|
+
state: DateFacetStateSchema,
|
|
451
|
+
});
|
|
452
|
+
export const CategoryFacetSchema = z.strictObject({
|
|
453
|
+
actions: CategoryFacetActionsSchema,
|
|
454
|
+
componentType: z.literal('category-facet'),
|
|
455
|
+
state: CategoryFacetStateSchema,
|
|
456
|
+
});
|
|
457
|
+
export const CartSchema = z.strictObject({
|
|
458
|
+
actions: CartActionsSchema,
|
|
459
|
+
componentType: z.literal('cart'),
|
|
460
|
+
state: CartStateSchema,
|
|
461
|
+
});
|
|
462
|
+
export const ComponentContractsSchema = z.discriminatedUnion('componentType', [
|
|
463
|
+
ProductCarouselSchema,
|
|
464
|
+
CartSchema,
|
|
465
|
+
NextActionsBarSchema,
|
|
466
|
+
BundleDisplaySchema,
|
|
467
|
+
ComparisonTableSchema,
|
|
468
|
+
ProductListSchema,
|
|
469
|
+
PaginationSchema,
|
|
470
|
+
SortSchema,
|
|
471
|
+
SearchBoxSchema,
|
|
472
|
+
RegularFacetSchema,
|
|
473
|
+
NumericFacetSchema,
|
|
474
|
+
DateFacetSchema,
|
|
475
|
+
CategoryFacetSchema,
|
|
476
|
+
FacetManagerSchema,
|
|
477
|
+
]);
|
|
478
|
+
/**
|
|
479
|
+
* Component props schemas.
|
|
480
|
+
* These props are injected by the A2-UI surface layer (backend) and passed to catalog
|
|
481
|
+
* renderers automatically. Consumers should NOT hardcode these values; they arrive via
|
|
482
|
+
* the createSurface message's components[].props.
|
|
483
|
+
*/
|
|
484
|
+
export const BundleDisplayPropsSchema = z.object({
|
|
485
|
+
componentId: z.string(),
|
|
486
|
+
componentType: z.literal('bundle-display'),
|
|
487
|
+
});
|
|
488
|
+
export const CartPropsSchema = z.object({
|
|
489
|
+
componentId: z.string(),
|
|
490
|
+
componentType: z.literal('cart'),
|
|
491
|
+
});
|
|
492
|
+
export const CategoryFacetPropsSchema = z.object({
|
|
493
|
+
componentId: z.string(),
|
|
494
|
+
componentType: z.literal('category-facet'),
|
|
495
|
+
});
|
|
496
|
+
export const ComparisonTablePropsSchema = z.object({
|
|
497
|
+
componentId: z.string(),
|
|
498
|
+
componentType: z.literal('comparison-table'),
|
|
499
|
+
});
|
|
500
|
+
export const DateFacetPropsSchema = z.object({
|
|
501
|
+
componentId: z.string(),
|
|
502
|
+
componentType: z.literal('date-facet'),
|
|
503
|
+
});
|
|
504
|
+
export const FacetManagerPropsSchema = z.object({
|
|
505
|
+
componentId: z.string(),
|
|
506
|
+
componentType: z.literal('facet-manager'),
|
|
507
|
+
});
|
|
508
|
+
export const NextActionsBarPropsSchema = z.object({
|
|
509
|
+
componentId: z.string(),
|
|
510
|
+
componentType: z.literal('next-actions-bar'),
|
|
511
|
+
});
|
|
512
|
+
export const NumericFacetPropsSchema = z.object({
|
|
513
|
+
componentId: z.string(),
|
|
514
|
+
componentType: z.literal('numeric-facet'),
|
|
515
|
+
});
|
|
516
|
+
export const PaginationPropsSchema = z.object({
|
|
517
|
+
componentId: z.string(),
|
|
518
|
+
componentType: z.literal('pagination'),
|
|
519
|
+
});
|
|
520
|
+
export const ProductCarouselPropsSchema = z.object({
|
|
521
|
+
componentId: z.string(),
|
|
522
|
+
componentType: z.literal('product-carousel'),
|
|
523
|
+
});
|
|
524
|
+
export const ProductListPropsSchema = z.object({
|
|
525
|
+
componentId: z.string(),
|
|
526
|
+
componentType: z.literal('product-list'),
|
|
527
|
+
});
|
|
528
|
+
export const RegularFacetPropsSchema = z.object({
|
|
529
|
+
componentId: z.string(),
|
|
530
|
+
componentType: z.literal('regular-facet'),
|
|
531
|
+
});
|
|
532
|
+
export const SearchBoxPropsSchema = z.object({
|
|
533
|
+
componentId: z.string(),
|
|
534
|
+
componentType: z.literal('search-box'),
|
|
535
|
+
});
|
|
536
|
+
export const SortPropsSchema = z.object({
|
|
537
|
+
componentId: z.string(),
|
|
538
|
+
componentType: z.literal('sort'),
|
|
539
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const THERMIDOR_CATALOG_ID = "https://schema.thermidor.coveo.com/a2-ui/catalog.json";
|
|
2
|
+
export { ActionItemSchema, BundleDisplaySchema, BundleDisplayStateSchema, BundleSlotSchema, BundleTierSchema, CartSchema, CartItemSchema, CartStateSchema, CategoryFacetSchema, CategoryFacetActionsSchema, CategoryFacetValueSchema, CategoryFacetSearchSchema, CategoryFacetSearchPayloadSchema, CategoryFacetSelectPathPayloadSchema, CategoryFacetStateSchema, CategoryFacetValuesSchema, ComparisonAttributeSchema, ComparisonProductSchema, ComparisonTableSchema, ComparisonTableStateSchema, ComponentContractsSchema, DateFacetSchema, DateFacetActionsSchema, DateFacetApplyCustomRangePayloadSchema, DateFacetCustomRangeSchema, DateFacetStateSchema, DateFacetToggleSelectPayloadSchema, DateFacetToggleSingleSelectPayloadSchema, DateFacetValueSchema, FacetManagerSchema, FacetManagerActionsSchema, FacetManagerStateSchema, FacetValueStateSchema, SelectableFacetValueStateSchema, NextActionsBarSchema, NextActionsStateSchema, NumericFacetSchema, NumericFacetActionsSchema, NumericFacetCustomRangeSchema, NumericFacetDomainSchema, NumericFacetApplyCustomRangePayloadSchema, NumericFacetStateSchema, NumericFacetToggleSelectPayloadSchema, NumericFacetToggleSingleSelectPayloadSchema, NumericFacetValueSchema, PaginationSchema, PaginationActionsSchema, PaginationStateSchema, ProductCarouselSchema, ProductCarouselStateSchema, ProductListSchema, ProductListActionsSchema, ProductListStateSchema, ProductSchema, RegularFacetSchema, RegularFacetActionsSchema, RegularFacetSearchSchema, RegularFacetSearchResultSchema, RegularFacetStateSchema, RegularFacetToggleExcludePayloadSchema, RegularFacetToggleSelectPayloadSchema, RegularFacetToggleSingleExcludePayloadSchema, RegularFacetToggleSingleSelectPayloadSchema, RegularFacetValueSchema, SearchBoxSchema, SearchBoxActionsSchema, SearchBoxStateSchema, SelectActionPayloadSchema, SelectPagePayloadSchema, SelectSortPayloadSchema, SetItemsPayloadSchema, SetPageSizePayloadSchema, SortSchema, SortActionsSchema, SortCriterionSchema, SortStateSchema, SubmitQueryPayloadSchema, UpdateItemQuantityPayloadSchema, BundleDisplayPropsSchema, CartPropsSchema, CategoryFacetPropsSchema, ComparisonTablePropsSchema, DateFacetPropsSchema, FacetManagerPropsSchema, NextActionsBarPropsSchema, NumericFacetPropsSchema, PaginationPropsSchema, ProductCarouselPropsSchema, ProductListPropsSchema, RegularFacetPropsSchema, SearchBoxPropsSchema, SortPropsSchema, } from './generated/schemas.js';
|
|
3
|
+
export type { ActionItem, BundleDisplay, BundleDisplayState, BundleSlot, BundleTier, Cart, CartItem, CartState, CategoryFacet, CategoryFacetActions, CategoryFacetValue, CategoryFacetSearch, CategoryFacetSearchPayload, CategoryFacetSelectPathPayload, CategoryFacetState, CategoryFacetValues, ComparisonAttribute, ComparisonProduct, ComparisonTable, ComparisonTableState, ComponentContracts, DateFacet, DateFacetActions, DateFacetApplyCustomRangePayload, DateFacetCustomRange, DateFacetState, DateFacetToggleSelectPayload, DateFacetToggleSingleSelectPayload, DateFacetValue, FacetManager, FacetManagerActions, FacetManagerState, FacetValueState, SelectableFacetValueState, NextActionsBar, NextActionsState, NumericFacet, NumericFacetActions, NumericFacetCustomRange, NumericFacetDomain, NumericFacetApplyCustomRangePayload, NumericFacetState, NumericFacetToggleSelectPayload, NumericFacetToggleSingleSelectPayload, NumericFacetValue, Pagination, PaginationActions, PaginationState, Product, ProductCarousel, ProductCarouselState, ProductList, ProductListActions, ProductListState, RegularFacet, RegularFacetActions, RegularFacetSearch, RegularFacetSearchResult, RegularFacetState, RegularFacetToggleExcludePayload, RegularFacetToggleSelectPayload, RegularFacetToggleSingleExcludePayload, RegularFacetToggleSingleSelectPayload, RegularFacetValue, SearchBox, SearchBoxActions, SearchBoxState, SelectActionPayload, SelectPagePayload, SelectSortPayload, SetItemsPayload, SetPageSizePayload, Sort, SortActions, SortCriterion, SortState, SubmitQueryPayload, UpdateItemQuantityPayload, BundleDisplayProps, CartProps, CategoryFacetProps, ComparisonTableProps, DateFacetProps, FacetManagerProps, NextActionsBarProps, NumericFacetProps, PaginationProps, ProductCarouselProps, ProductListProps, RegularFacetProps, SearchBoxProps, SortProps, } from './generated/schemas.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export const THERMIDOR_CATALOG_ID = 'https://schema.thermidor.coveo.com/a2-ui/catalog.json';
|
|
2
|
+
export { ActionItemSchema, BundleDisplaySchema, BundleDisplayStateSchema, BundleSlotSchema, BundleTierSchema, CartSchema, CartItemSchema, CartStateSchema, CategoryFacetSchema, CategoryFacetActionsSchema, CategoryFacetValueSchema, CategoryFacetSearchSchema, CategoryFacetSearchPayloadSchema, CategoryFacetSelectPathPayloadSchema, CategoryFacetStateSchema, CategoryFacetValuesSchema, ComparisonAttributeSchema, ComparisonProductSchema, ComparisonTableSchema, ComparisonTableStateSchema, ComponentContractsSchema, DateFacetSchema, DateFacetActionsSchema, DateFacetApplyCustomRangePayloadSchema, DateFacetCustomRangeSchema, DateFacetStateSchema, DateFacetToggleSelectPayloadSchema, DateFacetToggleSingleSelectPayloadSchema, DateFacetValueSchema, FacetManagerSchema, FacetManagerActionsSchema, FacetManagerStateSchema, FacetValueStateSchema, SelectableFacetValueStateSchema, NextActionsBarSchema, NextActionsStateSchema, NumericFacetSchema, NumericFacetActionsSchema, NumericFacetCustomRangeSchema, NumericFacetDomainSchema, NumericFacetApplyCustomRangePayloadSchema, NumericFacetStateSchema, NumericFacetToggleSelectPayloadSchema, NumericFacetToggleSingleSelectPayloadSchema, NumericFacetValueSchema, PaginationSchema, PaginationActionsSchema, PaginationStateSchema, ProductCarouselSchema, ProductCarouselStateSchema, ProductListSchema, ProductListActionsSchema, ProductListStateSchema, ProductSchema, RegularFacetSchema, RegularFacetActionsSchema, RegularFacetSearchSchema, RegularFacetSearchResultSchema, RegularFacetStateSchema, RegularFacetToggleExcludePayloadSchema, RegularFacetToggleSelectPayloadSchema, RegularFacetToggleSingleExcludePayloadSchema, RegularFacetToggleSingleSelectPayloadSchema, RegularFacetValueSchema, SearchBoxSchema, SearchBoxActionsSchema, SearchBoxStateSchema, SelectActionPayloadSchema, SelectPagePayloadSchema, SelectSortPayloadSchema, SetItemsPayloadSchema, SetPageSizePayloadSchema, SortSchema, SortActionsSchema, SortCriterionSchema, SortStateSchema, SubmitQueryPayloadSchema, UpdateItemQuantityPayloadSchema, BundleDisplayPropsSchema, CartPropsSchema, CategoryFacetPropsSchema, ComparisonTablePropsSchema, DateFacetPropsSchema, FacetManagerPropsSchema, NextActionsBarPropsSchema, NumericFacetPropsSchema, PaginationPropsSchema, ProductCarouselPropsSchema, ProductListPropsSchema, RegularFacetPropsSchema, SearchBoxPropsSchema, SortPropsSchema, } from './generated/schemas.js';
|
package/package.json
CHANGED
|
@@ -1,12 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coveo/thermidor-schema",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"license": "
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
3
|
+
"version": "1.0.0-beta.2",
|
|
4
|
+
"description": "Zod and TypeScript projections of the Thermidor JSON Schema contract.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"sideEffects": false,
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/coveo-platform/thermidor-schema.git",
|
|
11
|
+
"directory": "packages/typescript"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/coveo-platform/thermidor-schema/issues"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/coveo-platform/thermidor-schema#readme",
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22.14.0"
|
|
20
|
+
},
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./schema/*": "./schema/*"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"schema",
|
|
31
|
+
"README.md",
|
|
32
|
+
"LICENSE"
|
|
33
|
+
],
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"peerDependencies": {
|
|
38
|
+
"zod": "^4.4.3"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"typescript": "7.0.2",
|
|
42
|
+
"vitest": "4.1.11",
|
|
43
|
+
"zod": "4.4.3"
|
|
44
|
+
},
|
|
9
45
|
"scripts": {
|
|
10
|
-
"
|
|
46
|
+
"build": "node scripts/clean-build.mjs && tsc --project tsconfig.json",
|
|
47
|
+
"test": "vitest run",
|
|
48
|
+
"typecheck": "tsc --noEmit --project tsconfig.json"
|
|
11
49
|
}
|
|
12
|
-
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schema.thermidor.coveo.com/base/action.schema.json",
|
|
4
|
+
"title": "Action",
|
|
5
|
+
"description": "An Action is the only mechanism through which the frontend can trigger a state change on a Controller. Actions are emitted by the frontend and processed by the backend. The action name is the key in the Controller's actions map and payload carries the runtime parameters.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["payload"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"payload": true
|
|
10
|
+
},
|
|
11
|
+
"additionalProperties": false
|
|
12
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://schema.thermidor.coveo.com/base/catalog.schema.json",
|
|
4
|
+
"title": "Catalog",
|
|
5
|
+
"description": "A Catalog is the top-level registry of all available UI Components. It is the entry point of the Thermidor contract: both the backend (producer) and the frontend (consumer) reference the same Catalog to know what components exist and how they are structured. For the initial implementation, a Catalog corresponds to an A2-UI catalog.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["catalogId", "version", "components"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"catalogId": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"pattern": "^[a-z][a-z0-9-]*$",
|
|
12
|
+
"description": "Stable kebab-case identifier for this catalog (e.g. 'a2ui-commerce-v1'). Used by both producer and consumer to identify which contract version they are implementing."
|
|
13
|
+
},
|
|
14
|
+
"version": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"pattern": "^\\d+\\.\\d+\\.\\d+$",
|
|
17
|
+
"description": "Semantic version of this catalog definition (e.g. '0.1.0'). Versioning strategy is deferred to a future ADR."
|
|
18
|
+
},
|
|
19
|
+
"description": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "Human-readable description of what this catalog covers."
|
|
22
|
+
},
|
|
23
|
+
"components": {
|
|
24
|
+
"type": "array",
|
|
25
|
+
"minItems": 1,
|
|
26
|
+
"description": "The complete set of Components registered in this catalog. Order is not significant.",
|
|
27
|
+
"items": {
|
|
28
|
+
"$ref": "https://schema.thermidor.coveo.com/base/component.schema.json"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"$schema": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"description": "Optional JSON Schema meta-annotation. Included here so that catalog documents may carry a '$schema' pointer to this schema for tooling support (IDE validation, etc.) without failing additionalProperties checks."
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"additionalProperties": false
|
|
37
|
+
}
|