@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.
Files changed (33) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +34 -0
  3. package/dist/generated/schemas.d.ts +1823 -0
  4. package/dist/generated/schemas.js +539 -0
  5. package/dist/index.d.ts +3 -0
  6. package/dist/index.js +2 -0
  7. package/package.json +46 -8
  8. package/schema/base/action.schema.json +12 -0
  9. package/schema/base/catalog.schema.json +37 -0
  10. package/schema/base/component.schema.json +41 -0
  11. package/schema/components/bundle-display.schema.json +47 -0
  12. package/schema/components/cart.schema.json +108 -0
  13. package/schema/components/category-facet.schema.json +292 -0
  14. package/schema/components/comparison-table.schema.json +54 -0
  15. package/schema/components/component-contracts.schema.json +55 -0
  16. package/schema/components/date-facet.schema.json +281 -0
  17. package/schema/components/facet-manager.schema.json +47 -0
  18. package/schema/components/next-actions-bar.schema.json +87 -0
  19. package/schema/components/numeric-facet.schema.json +303 -0
  20. package/schema/components/pagination.schema.json +123 -0
  21. package/schema/components/product-carousel.schema.json +52 -0
  22. package/schema/components/product-list.schema.json +46 -0
  23. package/schema/components/regular-facet.schema.json +385 -0
  24. package/schema/components/search-box.schema.json +74 -0
  25. package/schema/components/sort.schema.json +107 -0
  26. package/schema/definitions/action-item.schema.json +20 -0
  27. package/schema/definitions/bundle-tier.schema.json +44 -0
  28. package/schema/definitions/cart-item.schema.json +29 -0
  29. package/schema/definitions/comparison-attribute.schema.json +19 -0
  30. package/schema/definitions/comparison-product.schema.json +39 -0
  31. package/schema/definitions/facet-value-state.schema.json +8 -0
  32. package/schema/definitions/product.schema.json +92 -0
  33. package/schema/definitions/selectable-facet-value-state.schema.json +8 -0
@@ -0,0 +1,41 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.thermidor.coveo.com/base/component.schema.json",
4
+ "title": "Component",
5
+ "description": "A Component is a discrete, renderable UI element. Components describe what can be rendered, not how it is rendered. Each component has a type, an observable state, and a set of available actions.",
6
+ "type": "object",
7
+ "required": ["componentId", "displayName", "componentType", "state", "actions"],
8
+ "properties": {
9
+ "componentId": {
10
+ "type": "string",
11
+ "pattern": "^[a-z][a-z0-9-]*$",
12
+ "description": "Stable kebab-case identifier for this component (e.g. 'product-carousel'). Must be unique within a Catalog."
13
+ },
14
+ "displayName": {
15
+ "type": "string",
16
+ "description": "Human-readable name for this component (e.g. 'Product Carousel')."
17
+ },
18
+ "description": {
19
+ "type": "string",
20
+ "description": "Human-readable description of this component's purpose and rendering intent."
21
+ },
22
+ "componentType": {
23
+ "type": "string",
24
+ "pattern": "^[a-z][a-z0-9]*(-[a-z0-9]+)*$",
25
+ "maxLength": 128,
26
+ "description": "Stable kebab-case type identifier (e.g. 'cart'). Used as discriminant for contract resolution."
27
+ },
28
+ "state": {
29
+ "type": "object",
30
+ "description": "The observable state owned by the backend. An empty object {} is valid for components with no observable state."
31
+ },
32
+ "actions": {
33
+ "type": "object",
34
+ "description": "Map of available actions. Each value conforms to base/action.schema.json. An empty object {} is valid for read-only components.",
35
+ "additionalProperties": {
36
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
37
+ }
38
+ }
39
+ },
40
+ "additionalProperties": false
41
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.thermidor.coveo.com/components/bundle-display.schema.json",
4
+ "title": "BundleDisplay",
5
+ "description": "Renders a tiered product bundle layout with budget, mid-range, and premium options. Each tier contains slots that reference product surfaces.",
6
+ "allOf": [
7
+ {
8
+ "$ref": "https://schema.thermidor.coveo.com/base/component.schema.json"
9
+ }
10
+ ],
11
+ "properties": {
12
+ "componentType": {
13
+ "type": "string",
14
+ "const": "bundle-display"
15
+ },
16
+ "state": {
17
+ "$ref": "#/$defs/BundleDisplayState"
18
+ },
19
+ "actions": {
20
+ "type": "object",
21
+ "properties": {},
22
+ "additionalProperties": false
23
+ }
24
+ },
25
+ "additionalProperties": false,
26
+ "$defs": {
27
+ "BundleDisplayState": {
28
+ "title": "BundleDisplayState",
29
+ "description": "The tiered product bundle layout. Owned exclusively by the backend; the frontend must not mutate this directly.",
30
+ "$comment": "This schema validates the runtime state value the backend pushes to the frontend.",
31
+ "type": "object",
32
+ "required": [
33
+ "tiers"
34
+ ],
35
+ "properties": {
36
+ "tiers": {
37
+ "type": "array",
38
+ "description": "Ordered list of bundle tiers to render.",
39
+ "items": {
40
+ "$ref": "https://schema.thermidor.coveo.com/definitions/bundle-tier.schema.json"
41
+ }
42
+ }
43
+ },
44
+ "additionalProperties": false
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,108 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.thermidor.coveo.com/components/cart.schema.json",
4
+ "title": "Cart",
5
+ "description": "Renders the current cart contents and exposes actions for the frontend to manage line items.",
6
+ "allOf": [
7
+ {
8
+ "$ref": "https://schema.thermidor.coveo.com/base/component.schema.json"
9
+ }
10
+ ],
11
+ "properties": {
12
+ "componentType": {
13
+ "type": "string",
14
+ "const": "cart"
15
+ },
16
+ "state": {
17
+ "$ref": "#/$defs/CartState"
18
+ },
19
+ "actions": {
20
+ "type": "object",
21
+ "required": [
22
+ "setItems",
23
+ "updateItemQuantity"
24
+ ],
25
+ "properties": {
26
+ "setItems": {
27
+ "$ref": "#/$defs/SetItemsAction"
28
+ },
29
+ "updateItemQuantity": {
30
+ "$ref": "#/$defs/UpdateItemQuantityAction"
31
+ }
32
+ },
33
+ "additionalProperties": false
34
+ }
35
+ },
36
+ "additionalProperties": false,
37
+ "$defs": {
38
+ "CartState": {
39
+ "title": "CartState",
40
+ "description": "The current contents of the cart. Owned exclusively by the backend; the frontend must not mutate this directly.",
41
+ "$comment": "This schema validates the runtime state value the backend pushes to the frontend.",
42
+ "type": "object",
43
+ "required": [
44
+ "items"
45
+ ],
46
+ "properties": {
47
+ "items": {
48
+ "type": "array",
49
+ "description": "The current line items in the cart.",
50
+ "items": {
51
+ "$ref": "https://schema.thermidor.coveo.com/definitions/cart-item.schema.json"
52
+ }
53
+ }
54
+ },
55
+ "additionalProperties": false
56
+ },
57
+ "SetItemsAction": {
58
+ "title": "setItems",
59
+ "description": "Replaces the entire cart contents with the provided list of items.",
60
+ "allOf": [
61
+ {
62
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
63
+ }
64
+ ],
65
+ "properties": {
66
+ "payload": {
67
+ "type": "object",
68
+ "required": [
69
+ "items"
70
+ ],
71
+ "properties": {
72
+ "items": {
73
+ "type": "array",
74
+ "description": "The new complete list of cart items. An empty array clears the cart.",
75
+ "items": {
76
+ "$ref": "https://schema.thermidor.coveo.com/definitions/cart-item.schema.json"
77
+ }
78
+ }
79
+ },
80
+ "additionalProperties": false
81
+ }
82
+ }
83
+ },
84
+ "UpdateItemQuantityAction": {
85
+ "title": "updateItemQuantity",
86
+ "description": "Updates the quantity of a single existing cart line item identified by productId.",
87
+ "allOf": [
88
+ {
89
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
90
+ }
91
+ ],
92
+ "properties": {
93
+ "payload": {
94
+ "type": "object",
95
+ "required": [
96
+ "item"
97
+ ],
98
+ "properties": {
99
+ "item": {
100
+ "$ref": "https://schema.thermidor.coveo.com/definitions/cart-item.schema.json"
101
+ }
102
+ },
103
+ "additionalProperties": false
104
+ }
105
+ }
106
+ }
107
+ }
108
+ }
@@ -0,0 +1,292 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.thermidor.coveo.com/components/category-facet.schema.json",
4
+ "title": "CategoryFacet",
5
+ "description": "A hierarchical category facet for a commerce surface. Renders a flat representation of the category tree (ancestry, selected value, and available children) with facet search. Dispatches selectPath, clearSelectedPath, search, and show-more/less actions.",
6
+ "allOf": [
7
+ {
8
+ "$ref": "https://schema.thermidor.coveo.com/base/component.schema.json"
9
+ }
10
+ ],
11
+ "properties": {
12
+ "componentType": {
13
+ "type": "string",
14
+ "const": "category-facet"
15
+ },
16
+ "state": {
17
+ "$ref": "#/$defs/CategoryFacetState"
18
+ },
19
+ "actions": {
20
+ "type": "object",
21
+ "required": [
22
+ "selectPath",
23
+ "clearSelectedPath",
24
+ "search",
25
+ "showMoreSearchResults",
26
+ "clearSearch",
27
+ "showMoreValues",
28
+ "showLessValues"
29
+ ],
30
+ "properties": {
31
+ "selectPath": {
32
+ "$ref": "#/$defs/CategoryFacetSelectPathAction"
33
+ },
34
+ "clearSelectedPath": {
35
+ "$ref": "#/$defs/CategoryFacetClearSelectedPathAction"
36
+ },
37
+ "search": {
38
+ "$ref": "#/$defs/CategoryFacetSearchAction"
39
+ },
40
+ "showMoreSearchResults": {
41
+ "$ref": "#/$defs/CategoryFacetShowMoreSearchResultsAction"
42
+ },
43
+ "clearSearch": {
44
+ "$ref": "#/$defs/CategoryFacetClearSearchAction"
45
+ },
46
+ "showMoreValues": {
47
+ "$ref": "#/$defs/CategoryFacetShowMoreValuesAction"
48
+ },
49
+ "showLessValues": {
50
+ "$ref": "#/$defs/CategoryFacetShowLessValuesAction"
51
+ }
52
+ },
53
+ "additionalProperties": false
54
+ }
55
+ },
56
+ "additionalProperties": false,
57
+ "$defs": {
58
+ "CategoryFacetState": {
59
+ "title": "CategoryFacetState",
60
+ "description": "The current category facet state. Owned exclusively by the backend. Presents a flat view of the category hierarchy: the ancestry path, the currently selected value, and the children available for further navigation.",
61
+ "type": "object",
62
+ "required": [
63
+ "field",
64
+ "displayName",
65
+ "values",
66
+ "canShowMoreValues",
67
+ "canShowLessValues",
68
+ "facetSearch"
69
+ ],
70
+ "properties": {
71
+ "field": {
72
+ "type": "string",
73
+ "description": "The index field this facet operates on."
74
+ },
75
+ "displayName": {
76
+ "type": "string",
77
+ "description": "The human-readable label for this facet."
78
+ },
79
+ "values": {
80
+ "$ref": "#/$defs/CategoryFacetValues",
81
+ "description": "The flat representation of the category hierarchy."
82
+ },
83
+ "canShowMoreValues": {
84
+ "type": "boolean",
85
+ "description": "Whether more child values can be shown at the current level."
86
+ },
87
+ "canShowLessValues": {
88
+ "type": "boolean",
89
+ "description": "Whether the number of shown child values can be reduced."
90
+ },
91
+ "facetSearch": {
92
+ "$ref": "#/$defs/CategoryFacetSearch",
93
+ "description": "The current category facet search state."
94
+ }
95
+ },
96
+ "additionalProperties": false
97
+ },
98
+ "CategoryFacetValues": {
99
+ "title": "CategoryFacetValues",
100
+ "description": "Flat representation of the category hierarchy. When no category is selected, ancestry and selected are null and children contains the top-level categories.",
101
+ "type": "object",
102
+ "required": [
103
+ "ancestry",
104
+ "selected",
105
+ "children"
106
+ ],
107
+ "properties": {
108
+ "ancestry": {
109
+ "type": "array",
110
+ "description": "The ordered list of ancestor categories leading to the selected value, from the root down. Empty when no category is selected.",
111
+ "items": {
112
+ "$ref": "#/$defs/CategoryFacetValue"
113
+ }
114
+ },
115
+ "selected": {
116
+ "description": "The currently selected category value. Null when no category is selected.",
117
+ "oneOf": [
118
+ {
119
+ "$ref": "#/$defs/CategoryFacetValue"
120
+ },
121
+ {
122
+ "type": "null"
123
+ }
124
+ ]
125
+ },
126
+ "children": {
127
+ "type": "array",
128
+ "description": "The child categories available for navigation. When no category is selected, these are the top-level categories. When a category is selected, these are its direct children.",
129
+ "items": {
130
+ "$ref": "#/$defs/CategoryFacetValue"
131
+ }
132
+ }
133
+ },
134
+ "additionalProperties": false
135
+ },
136
+ "CategoryFacetSearch": {
137
+ "title": "CategoryFacetSearch",
138
+ "description": "The current category facet search state.",
139
+ "type": "object",
140
+ "required": [
141
+ "query",
142
+ "canShowMoreResults",
143
+ "results"
144
+ ],
145
+ "properties": {
146
+ "query": {
147
+ "type": "string",
148
+ "maxLength": 256,
149
+ "description": "The current facet search query."
150
+ },
151
+ "canShowMoreResults": {
152
+ "type": "boolean",
153
+ "description": "Whether more facet search results can be shown for the current query."
154
+ },
155
+ "results": {
156
+ "type": "array",
157
+ "description": "The current facet search results.",
158
+ "items": {
159
+ "$ref": "#/$defs/CategoryFacetValue"
160
+ }
161
+ }
162
+ },
163
+ "additionalProperties": false
164
+ },
165
+ "CategoryFacetSelectPathAction": {
166
+ "title": "categoryFacetSelectPath",
167
+ "description": "Navigates to a category by selecting its path.",
168
+ "allOf": [
169
+ {
170
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
171
+ }
172
+ ],
173
+ "properties": {
174
+ "payload": {
175
+ "type": "object",
176
+ "required": [
177
+ "path"
178
+ ],
179
+ "properties": {
180
+ "path": {
181
+ "type": "array",
182
+ "description": "The path of the category to select.",
183
+ "items": {
184
+ "type": "string"
185
+ }
186
+ }
187
+ },
188
+ "additionalProperties": false
189
+ }
190
+ }
191
+ },
192
+ "CategoryFacetClearSelectedPathAction": {
193
+ "title": "categoryFacetClearSelectedPath",
194
+ "description": "Clears the current category selection, navigating back to the root.",
195
+ "allOf": [
196
+ {
197
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
198
+ }
199
+ ]
200
+ },
201
+ "CategoryFacetSearchAction": {
202
+ "title": "categoryFacetSearch",
203
+ "description": "Runs a category facet search for the given query.",
204
+ "allOf": [
205
+ {
206
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
207
+ }
208
+ ],
209
+ "properties": {
210
+ "payload": {
211
+ "type": "object",
212
+ "required": [
213
+ "query"
214
+ ],
215
+ "properties": {
216
+ "query": {
217
+ "type": "string",
218
+ "maxLength": 256,
219
+ "description": "The facet search query string."
220
+ }
221
+ },
222
+ "additionalProperties": false
223
+ }
224
+ }
225
+ },
226
+ "CategoryFacetShowMoreSearchResultsAction": {
227
+ "title": "categoryFacetShowMoreSearchResults",
228
+ "description": "Requests the next page of category facet search results.",
229
+ "allOf": [
230
+ {
231
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
232
+ }
233
+ ]
234
+ },
235
+ "CategoryFacetClearSearchAction": {
236
+ "title": "categoryFacetClearSearch",
237
+ "description": "Clears the category facet search query and results.",
238
+ "allOf": [
239
+ {
240
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
241
+ }
242
+ ]
243
+ },
244
+ "CategoryFacetShowMoreValuesAction": {
245
+ "title": "categoryFacetShowMoreValues",
246
+ "description": "Increases the number of child category values shown.",
247
+ "allOf": [
248
+ {
249
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
250
+ }
251
+ ]
252
+ },
253
+ "CategoryFacetShowLessValuesAction": {
254
+ "title": "categoryFacetShowLessValues",
255
+ "description": "Decreases the number of child category values shown.",
256
+ "allOf": [
257
+ {
258
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
259
+ }
260
+ ]
261
+ },
262
+ "CategoryFacetValue": {
263
+ "title": "CategoryFacetValue",
264
+ "description": "A single category value. Used throughout the category facet state (ancestry, selected value, children) and as facet search results.",
265
+ "type": "object",
266
+ "required": [
267
+ "path",
268
+ "value",
269
+ "numberOfResults"
270
+ ],
271
+ "properties": {
272
+ "path": {
273
+ "type": "array",
274
+ "description": "The ordered path of category segments from the root to this value.",
275
+ "items": {
276
+ "type": "string"
277
+ }
278
+ },
279
+ "value": {
280
+ "type": "string",
281
+ "description": "The display label of this category."
282
+ },
283
+ "numberOfResults": {
284
+ "type": "integer",
285
+ "minimum": 0,
286
+ "description": "The number of results matching this category."
287
+ }
288
+ },
289
+ "additionalProperties": false
290
+ }
291
+ }
292
+ }
@@ -0,0 +1,54 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.thermidor.coveo.com/components/comparison-table.schema.json",
4
+ "title": "ComparisonTable",
5
+ "description": "Renders a tabular product comparison with attribute columns. Read-only: the product set and attributes are owned by the backend.",
6
+ "allOf": [
7
+ {
8
+ "$ref": "https://schema.thermidor.coveo.com/base/component.schema.json"
9
+ }
10
+ ],
11
+ "properties": {
12
+ "componentType": {
13
+ "type": "string",
14
+ "const": "comparison-table"
15
+ },
16
+ "state": {
17
+ "$ref": "#/$defs/ComparisonTableState"
18
+ },
19
+ "actions": {
20
+ "type": "object",
21
+ "properties": {},
22
+ "additionalProperties": false
23
+ }
24
+ },
25
+ "additionalProperties": false,
26
+ "$defs": {
27
+ "ComparisonTableState": {
28
+ "title": "ComparisonTableState",
29
+ "description": "The comparison data to render. Contains a list of products with their attribute values and the attribute descriptors defining the columns.",
30
+ "type": "object",
31
+ "required": [
32
+ "products",
33
+ "attributes"
34
+ ],
35
+ "properties": {
36
+ "products": {
37
+ "type": "array",
38
+ "description": "Products to compare, each with attribute values keyed by attribute key.",
39
+ "items": {
40
+ "$ref": "https://schema.thermidor.coveo.com/definitions/comparison-product.schema.json"
41
+ }
42
+ },
43
+ "attributes": {
44
+ "type": "array",
45
+ "description": "Attribute descriptors defining the comparison columns.",
46
+ "items": {
47
+ "$ref": "https://schema.thermidor.coveo.com/definitions/comparison-attribute.schema.json"
48
+ }
49
+ }
50
+ },
51
+ "additionalProperties": false
52
+ }
53
+ }
54
+ }
@@ -0,0 +1,55 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.thermidor.coveo.com/components/component-contracts.schema.json",
4
+ "title": "Component Contracts",
5
+ "description": "Discriminated index of component runtime contracts. componentType is the stable discriminant; componentId identifies a particular instance outside this static contract.",
6
+ "$defs": {
7
+ "ComponentContracts": {
8
+ "title": "ComponentContracts",
9
+ "oneOf": [
10
+ {
11
+ "$ref": "https://schema.thermidor.coveo.com/components/product-carousel.schema.json"
12
+ },
13
+ {
14
+ "$ref": "https://schema.thermidor.coveo.com/components/cart.schema.json"
15
+ },
16
+ {
17
+ "$ref": "https://schema.thermidor.coveo.com/components/next-actions-bar.schema.json"
18
+ },
19
+ {
20
+ "$ref": "https://schema.thermidor.coveo.com/components/bundle-display.schema.json"
21
+ },
22
+ {
23
+ "$ref": "https://schema.thermidor.coveo.com/components/comparison-table.schema.json"
24
+ },
25
+ {
26
+ "$ref": "https://schema.thermidor.coveo.com/components/product-list.schema.json"
27
+ },
28
+ {
29
+ "$ref": "https://schema.thermidor.coveo.com/components/pagination.schema.json"
30
+ },
31
+ {
32
+ "$ref": "https://schema.thermidor.coveo.com/components/sort.schema.json"
33
+ },
34
+ {
35
+ "$ref": "https://schema.thermidor.coveo.com/components/search-box.schema.json"
36
+ },
37
+ {
38
+ "$ref": "https://schema.thermidor.coveo.com/components/regular-facet.schema.json"
39
+ },
40
+ {
41
+ "$ref": "https://schema.thermidor.coveo.com/components/numeric-facet.schema.json"
42
+ },
43
+ {
44
+ "$ref": "https://schema.thermidor.coveo.com/components/date-facet.schema.json"
45
+ },
46
+ {
47
+ "$ref": "https://schema.thermidor.coveo.com/components/category-facet.schema.json"
48
+ },
49
+ {
50
+ "$ref": "https://schema.thermidor.coveo.com/components/facet-manager.schema.json"
51
+ }
52
+ ]
53
+ }
54
+ }
55
+ }