@coveo/thermidor-schema 0.0.0 → 1.0.0-beta.1

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,281 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.thermidor.coveo.com/components/date-facet.schema.json",
4
+ "title": "DateFacet",
5
+ "description": "Renders a range-based date commerce facet. Presents date range values with their result counts and selection state, and dispatches actions to select, clear active values, apply a custom date range, and show more or fewer values.",
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": "date-facet"
15
+ },
16
+ "state": {
17
+ "$ref": "#/$defs/DateFacetState"
18
+ },
19
+ "actions": {
20
+ "type": "object",
21
+ "required": [
22
+ "toggleSelect",
23
+ "toggleSingleSelect",
24
+ "clearAllActiveValues",
25
+ "applyCustomRange",
26
+ "showMoreValues",
27
+ "showLessValues"
28
+ ],
29
+ "properties": {
30
+ "toggleSelect": {
31
+ "$ref": "#/$defs/DateFacetToggleSelectAction"
32
+ },
33
+ "toggleSingleSelect": {
34
+ "$ref": "#/$defs/DateFacetToggleSingleSelectAction"
35
+ },
36
+ "clearAllActiveValues": {
37
+ "$ref": "#/$defs/DateFacetClearAllActiveValuesAction"
38
+ },
39
+ "applyCustomRange": {
40
+ "$ref": "#/$defs/DateFacetApplyCustomRangeAction"
41
+ },
42
+ "showMoreValues": {
43
+ "$ref": "#/$defs/DateFacetShowMoreValuesAction"
44
+ },
45
+ "showLessValues": {
46
+ "$ref": "#/$defs/DateFacetShowLessValuesAction"
47
+ }
48
+ },
49
+ "additionalProperties": false
50
+ }
51
+ },
52
+ "additionalProperties": false,
53
+ "$defs": {
54
+ "DateFacetState": {
55
+ "title": "DateFacetState",
56
+ "description": "The observable state of a date facet. Owned exclusively by the backend.",
57
+ "type": "object",
58
+ "required": [
59
+ "field",
60
+ "displayName",
61
+ "values",
62
+ "customRange",
63
+ "hasActiveValues",
64
+ "canShowMoreValues",
65
+ "canShowLessValues"
66
+ ],
67
+ "properties": {
68
+ "field": {
69
+ "type": "string",
70
+ "description": "The commerce index field the facet operates on."
71
+ },
72
+ "displayName": {
73
+ "type": "string",
74
+ "description": "Human-readable label for the facet."
75
+ },
76
+ "values": {
77
+ "type": "array",
78
+ "description": "The date range values currently exposed by the facet.",
79
+ "items": {
80
+ "$ref": "#/$defs/DateFacetValue"
81
+ }
82
+ },
83
+ "customRange": {
84
+ "description": "The currently applied custom range, or null when none is active. Mutually exclusive with selected values.",
85
+ "oneOf": [
86
+ {
87
+ "$ref": "#/$defs/DateFacetCustomRange"
88
+ },
89
+ {
90
+ "type": "null"
91
+ }
92
+ ]
93
+ },
94
+ "hasActiveValues": {
95
+ "type": "boolean",
96
+ "description": "Whether at least one range value is not in the idle state."
97
+ },
98
+ "canShowMoreValues": {
99
+ "type": "boolean",
100
+ "description": "Whether more values than currently shown are available."
101
+ },
102
+ "canShowLessValues": {
103
+ "type": "boolean",
104
+ "description": "Whether the number of shown values can be reduced."
105
+ }
106
+ },
107
+ "additionalProperties": false
108
+ },
109
+ "DateFacetValue": {
110
+ "title": "DateFacetValue",
111
+ "description": "A single selectable date range within a date facet.",
112
+ "type": "object",
113
+ "required": [
114
+ "start",
115
+ "end",
116
+ "numberOfResults",
117
+ "state"
118
+ ],
119
+ "properties": {
120
+ "start": {
121
+ "type": "string",
122
+ "description": "The inclusive start of the date range."
123
+ },
124
+ "end": {
125
+ "type": "string",
126
+ "description": "The end of the date range."
127
+ },
128
+ "numberOfResults": {
129
+ "type": "integer",
130
+ "minimum": 0,
131
+ "description": "The number of results matching this range."
132
+ },
133
+ "state": {
134
+ "$ref": "https://schema.thermidor.coveo.com/definitions/selectable-facet-value-state.schema.json",
135
+ "description": "The selection state of this facet value (idle or selected; exclusion is not supported)."
136
+ }
137
+ },
138
+ "additionalProperties": false
139
+ },
140
+ "DateFacetCustomRange": {
141
+ "title": "DateFacetCustomRange",
142
+ "description": "A custom date range applied by the user, with its result count.",
143
+ "type": "object",
144
+ "required": [
145
+ "start",
146
+ "end",
147
+ "numberOfResults"
148
+ ],
149
+ "properties": {
150
+ "start": {
151
+ "type": "string",
152
+ "description": "The inclusive start of the custom date range."
153
+ },
154
+ "end": {
155
+ "type": "string",
156
+ "description": "The end of the custom date range."
157
+ },
158
+ "numberOfResults": {
159
+ "type": "integer",
160
+ "minimum": 0,
161
+ "description": "The number of results matching this custom range."
162
+ }
163
+ },
164
+ "additionalProperties": false
165
+ },
166
+ "DateFacetToggleSelectAction": {
167
+ "title": "dateFacetToggleSelect",
168
+ "description": "Toggles the selection of a date facet value.",
169
+ "allOf": [
170
+ {
171
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
172
+ }
173
+ ],
174
+ "properties": {
175
+ "payload": {
176
+ "type": "object",
177
+ "required": [
178
+ "start",
179
+ "end"
180
+ ],
181
+ "properties": {
182
+ "start": {
183
+ "type": "string",
184
+ "description": "The inclusive start of the date range to toggle."
185
+ },
186
+ "end": {
187
+ "type": "string",
188
+ "description": "The end of the date range to toggle."
189
+ }
190
+ },
191
+ "additionalProperties": false
192
+ }
193
+ }
194
+ },
195
+ "DateFacetToggleSingleSelectAction": {
196
+ "title": "dateFacetToggleSingleSelect",
197
+ "description": "Toggles the selection of a range value, deselecting all other values (single-select behavior).",
198
+ "allOf": [
199
+ {
200
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
201
+ }
202
+ ],
203
+ "properties": {
204
+ "payload": {
205
+ "type": "object",
206
+ "required": [
207
+ "start",
208
+ "end"
209
+ ],
210
+ "properties": {
211
+ "start": {
212
+ "type": "string",
213
+ "description": "The inclusive lower bound of the range to single-select."
214
+ },
215
+ "end": {
216
+ "type": "string",
217
+ "description": "The upper bound of the range to single-select."
218
+ }
219
+ },
220
+ "additionalProperties": false
221
+ }
222
+ }
223
+ },
224
+ "DateFacetClearAllActiveValuesAction": {
225
+ "title": "dateFacetClearAllActiveValues",
226
+ "description": "Resets all date range values to the idle state, clearing every selection.",
227
+ "allOf": [
228
+ {
229
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
230
+ }
231
+ ]
232
+ },
233
+ "DateFacetApplyCustomRangeAction": {
234
+ "title": "dateFacetApplyCustomRange",
235
+ "description": "Applies a single custom date range, clearing any selected displayed ranges.",
236
+ "allOf": [
237
+ {
238
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
239
+ }
240
+ ],
241
+ "properties": {
242
+ "payload": {
243
+ "type": "object",
244
+ "required": [
245
+ "start",
246
+ "end"
247
+ ],
248
+ "properties": {
249
+ "start": {
250
+ "type": "string",
251
+ "description": "The inclusive start of the custom date range."
252
+ },
253
+ "end": {
254
+ "type": "string",
255
+ "description": "The end of the custom date range."
256
+ }
257
+ },
258
+ "additionalProperties": false
259
+ }
260
+ }
261
+ },
262
+ "DateFacetShowMoreValuesAction": {
263
+ "title": "dateFacetShowMoreValues",
264
+ "description": "Increases the number of date range values shown.",
265
+ "allOf": [
266
+ {
267
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
268
+ }
269
+ ]
270
+ },
271
+ "DateFacetShowLessValuesAction": {
272
+ "title": "dateFacetShowLessValues",
273
+ "description": "Decreases the number of date range values shown.",
274
+ "allOf": [
275
+ {
276
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
277
+ }
278
+ ]
279
+ }
280
+ }
281
+ }
@@ -0,0 +1,47 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.thermidor.coveo.com/components/facet-manager.schema.json",
4
+ "title": "FacetManager",
5
+ "description": "Manages facet ordering and cross-facet concerns. Holds the backend-determined order of facet components as state. The position of each identifier (indexed from 0) determines the facet's rendering rank. Ready to gain cross-facet actions (e.g., clear all facets, reorder) as needs arise.",
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": "facet-manager"
15
+ },
16
+ "state": {
17
+ "$ref": "#/$defs/FacetManagerState"
18
+ },
19
+ "actions": {
20
+ "type": "object",
21
+ "properties": {},
22
+ "additionalProperties": false
23
+ }
24
+ },
25
+ "additionalProperties": false,
26
+ "$defs": {
27
+ "FacetManagerState": {
28
+ "title": "FacetManagerState",
29
+ "description": "The facet manager state. Holds the ordered list of facet component identifiers. Owned exclusively by the backend.",
30
+ "type": "object",
31
+ "required": [
32
+ "facetIds"
33
+ ],
34
+ "properties": {
35
+ "facetIds": {
36
+ "type": "array",
37
+ "description": "Ordered facet component identifiers. Position (indexed from 0) determines the facet's rendering rank. Each identifier is expected to match the 'componentId' of a facet component registered in the catalog; referential integrity is enforced outside JSON Schema.",
38
+ "items": {
39
+ "type": "string",
40
+ "pattern": "^[a-z][a-z0-9-]*$"
41
+ }
42
+ }
43
+ },
44
+ "additionalProperties": false
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,87 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://schema.thermidor.coveo.com/components/next-actions-bar.schema.json",
4
+ "title": "NextActionsBar",
5
+ "description": "Renders a set of suggested next actions the user can pick from. The selectAction action is dispatched when the user clicks an action button.",
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": "next-actions-bar"
15
+ },
16
+ "state": {
17
+ "$ref": "#/$defs/NextActionsState"
18
+ },
19
+ "actions": {
20
+ "type": "object",
21
+ "required": [
22
+ "selectAction"
23
+ ],
24
+ "properties": {
25
+ "selectAction": {
26
+ "$ref": "#/$defs/SelectActionAction"
27
+ }
28
+ },
29
+ "additionalProperties": false
30
+ }
31
+ },
32
+ "additionalProperties": false,
33
+ "$defs": {
34
+ "NextActionsState": {
35
+ "title": "NextActionsState",
36
+ "description": "The list of suggested actions to render. Owned exclusively by the backend; the frontend must not mutate this directly.",
37
+ "$comment": "This schema validates the runtime state value the backend pushes to the frontend.",
38
+ "type": "object",
39
+ "required": [
40
+ "actions"
41
+ ],
42
+ "properties": {
43
+ "actions": {
44
+ "type": "array",
45
+ "description": "Suggested actions the assistant offers the user.",
46
+ "items": {
47
+ "$ref": "https://schema.thermidor.coveo.com/definitions/action-item.schema.json"
48
+ }
49
+ }
50
+ },
51
+ "additionalProperties": false
52
+ },
53
+ "SelectActionAction": {
54
+ "title": "selectAction",
55
+ "description": "Signals that the user selected one of the suggested actions.",
56
+ "allOf": [
57
+ {
58
+ "$ref": "https://schema.thermidor.coveo.com/base/action.schema.json"
59
+ }
60
+ ],
61
+ "properties": {
62
+ "payload": {
63
+ "type": "object",
64
+ "required": [
65
+ "text",
66
+ "type"
67
+ ],
68
+ "properties": {
69
+ "text": {
70
+ "type": "string",
71
+ "description": "The display text of the action the user selected."
72
+ },
73
+ "type": {
74
+ "type": "string",
75
+ "enum": [
76
+ "followup",
77
+ "search"
78
+ ],
79
+ "description": "The kind of action selected: \"followup\" or \"search\"."
80
+ }
81
+ },
82
+ "additionalProperties": false
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }