@coveo/thermidor-schema 1.0.0-beta.4 → 1.0.0-beta.6

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 (32) hide show
  1. package/dist/generated/schemas.d.ts +1545 -339
  2. package/dist/generated/schemas.js +557 -208
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.js +1 -1
  5. package/package.json +20 -19
  6. package/schema/base/catalog.schema.json +3 -2
  7. package/schema/base/component.schema.json +24 -33
  8. package/schema/{components/component-contracts.schema.json → component-contracts.schema.json} +8 -2
  9. package/schema/components/bundle-display.schema.json +9 -13
  10. package/schema/components/cart.schema.json +147 -0
  11. package/schema/components/category-facet.schema.json +29 -13
  12. package/schema/components/commerce-search.schema.json +129 -15
  13. package/schema/components/comparison-table.schema.json +21 -13
  14. package/schema/components/date-facet.schema.json +33 -13
  15. package/schema/components/facet-manager.schema.json +12 -14
  16. package/schema/components/layout-stack.schema.json +18 -15
  17. package/schema/components/next-actions-bar.schema.json +12 -15
  18. package/schema/components/numeric-facet.schema.json +37 -13
  19. package/schema/components/page-size.schema.json +13 -15
  20. package/schema/components/pagination.schema.json +41 -14
  21. package/schema/components/product-carousel.schema.json +13 -13
  22. package/schema/components/product-list.schema.json +75 -14
  23. package/schema/components/product-summary.schema.json +15 -14
  24. package/schema/components/query-suggestions.schema.json +113 -0
  25. package/schema/components/query-summary.schema.json +23 -14
  26. package/schema/components/regular-facet.schema.json +33 -13
  27. package/schema/components/sort.schema.json +13 -13
  28. package/schema/definitions/bundle-tier.schema.json +6 -1
  29. package/schema/definitions/child-list.schema.json +32 -0
  30. package/schema/definitions/component-id.schema.json +9 -0
  31. package/schema/definitions/data-binding.schema.json +16 -0
  32. package/schema/definitions/child-ref.schema.json +0 -8
@@ -1,6 +1,7 @@
1
1
  // This file is generated from the canonical JSON Schema documents.
2
2
  // Do not edit it directly; run `mise run generate` from the repository root.
3
3
  import * as z from 'zod/v4';
4
+ export const CartUpdateOperationSchema = z.enum(['add', 'remove', 'setQuantity']);
4
5
  // The kind of action: "followup" triggers a conversational follow-up, "search" triggers a
5
6
  // standalone search.
6
7
  //
@@ -37,11 +38,43 @@ export const ProductSchema = z.strictObject({
37
38
  ec_thumbnails: z.array(z.url()).optional(),
38
39
  permanentid: z.string(),
39
40
  });
41
+ export const DataBindingSchema = z.strictObject({
42
+ path: z.string(),
43
+ });
44
+ export const ChildListClassSchema = z.strictObject({
45
+ componentId: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')),
46
+ path: z.string(),
47
+ });
40
48
  export const ProductCarouselActionsSchema = z.strictObject({});
41
49
  export const ProductCarouselStateSchema = z.strictObject({
42
50
  heading: z.string(),
43
51
  products: z.array(ProductSchema),
44
52
  });
53
+ export const PurchaseProductSchema = z.strictObject({
54
+ name: z.string().optional(),
55
+ price: z.union([z.number(), z.null()]).optional(),
56
+ productId: z.string().min(1),
57
+ quantity: z.number().int().min(1),
58
+ });
59
+ export const TransactionSchema = z.strictObject({
60
+ id: z.string().min(1),
61
+ revenue: z.number(),
62
+ });
63
+ export const UpdateCartPayloadSchema = z.strictObject({
64
+ name: z.string().optional(),
65
+ operation: z.enum(['add', 'remove', 'setQuantity']),
66
+ price: z.union([z.number(), z.null()]).optional(),
67
+ productId: z.string().min(1),
68
+ quantity: z.number().int().min(1),
69
+ });
70
+ export const CartStateSchema = z.strictObject({});
71
+ export const FetchSuggestionsPayloadSchema = z.strictObject({
72
+ query: z.string(),
73
+ });
74
+ export const QueryCompletionSchema = z.strictObject({
75
+ expression: z.string(),
76
+ score: z.number().optional(),
77
+ });
45
78
  export const SelectActionPayloadSchema = z.strictObject({
46
79
  text: z.string(),
47
80
  type: z.enum(['followup', 'search']),
@@ -68,7 +101,15 @@ export const ComparisonProductSchema = z.strictObject({
68
101
  rating: z.number().min(0).max(5).optional(),
69
102
  values: z.record(z.string(), z.string()).optional(),
70
103
  });
71
- export const ProductListActionsSchema = z.strictObject({});
104
+ export const ProductClickPayloadSchema = z.strictObject({
105
+ name: z.string().optional(),
106
+ position: z.number().int().min(0),
107
+ price: z.union([z.number(), z.null()]).optional(),
108
+ productId: z.string().min(1),
109
+ });
110
+ export const SelectProductsPayloadSchema = z.strictObject({
111
+ productIds: z.array(z.string().min(1)),
112
+ });
72
113
  export const ProductListStateSchema = z.strictObject({
73
114
  products: z.array(ProductSchema),
74
115
  });
@@ -83,6 +124,7 @@ export const SelectPagePayloadSchema = z.strictObject({
83
124
  export const PayloadSchema = z.strictObject({
84
125
  pageSize: z.number().int().min(1),
85
126
  });
127
+ export const ShowMorePayloadSchema = z.strictObject({});
86
128
  export const PaginationStateSchema = z.strictObject({
87
129
  page: z.number().int().min(0),
88
130
  pageSize: z.number().int().min(1),
@@ -192,6 +234,14 @@ export const CategoryFacetValuesSchema = z.strictObject({
192
234
  });
193
235
  export const FacetManagerActionsSchema = z.strictObject({});
194
236
  export const FacetManagerStateSchema = z.strictObject({});
237
+ export const OverrideCorrectionPayloadSchema = z.strictObject({
238
+ originalQuery: z.string().min(1),
239
+ });
240
+ export const NumericRangeRestoreSchema = z.strictObject({
241
+ end: z.number(),
242
+ endInclusive: z.boolean().optional(),
243
+ start: z.number(),
244
+ });
195
245
  export const SubmitQueryPayloadSchema = z.strictObject({
196
246
  query: z.string(),
197
247
  });
@@ -211,26 +261,38 @@ export const SetPageSizePayloadSchema = z.strictObject({
211
261
  export const PageSizeStateSchema = z.strictObject({
212
262
  pageSize: z.number().int().min(1),
213
263
  });
214
- export const ProductCarouselSchema = z.strictObject({
215
- actions: ProductCarouselActionsSchema,
216
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
217
- children: z
218
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
219
- .max(1000)
220
- .optional(),
221
- componentType: z.literal('product-carousel'),
222
- state: ProductCarouselStateSchema,
264
+ export const ProductCarouselSchema = z.looseObject({
265
+ actions: ProductCarouselActionsSchema.optional(),
266
+ component: z.literal('ProductCarousel'),
267
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
268
+ state: ProductCarouselStateSchema.optional(),
269
+ });
270
+ export const PurchasePayloadSchema = z.strictObject({
271
+ products: z.array(PurchaseProductSchema),
272
+ transaction: TransactionSchema,
273
+ });
274
+ export const UpdateCartSchema = z.strictObject({
275
+ payload: UpdateCartPayloadSchema,
276
+ });
277
+ export const FetchSuggestionsSchema = z.strictObject({
278
+ payload: FetchSuggestionsPayloadSchema,
279
+ });
280
+ export const QuerySuggestionsStateSchema = z.strictObject({
281
+ completions: z.array(QueryCompletionSchema),
282
+ products: z.array(ProductSchema),
283
+ query: z.string(),
223
284
  });
224
285
  export const SelectActionSchema = z.strictObject({
225
286
  payload: SelectActionPayloadSchema,
226
287
  });
227
288
  export const NextActionsStateSchema = z.strictObject({
228
- actions: z.array(ActionItemSchema),
289
+ suggestedActions: z.array(ActionItemSchema),
229
290
  });
230
291
  export const BundleTierSchema = z.strictObject({
231
292
  description: z.string(),
232
293
  label: z.string(),
233
294
  slots: z.array(BundleSlotSchema),
295
+ total: z.number().min(0),
234
296
  });
235
297
  export const ComparisonTableStateSchema = z.strictObject({
236
298
  attributes: z.array(ComparisonAttributeSchema),
@@ -238,25 +300,17 @@ export const ComparisonTableStateSchema = z.strictObject({
238
300
  products: z.array(ComparisonProductSchema),
239
301
  summary: z.string(),
240
302
  });
241
- export const ProductListSchema = z.strictObject({
242
- actions: ProductListActionsSchema,
243
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
244
- children: z
245
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
246
- .max(1000)
247
- .optional(),
248
- componentType: z.literal('product-list'),
249
- state: ProductListStateSchema,
250
- });
251
- export const ProductSummarySchema = z.strictObject({
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,
303
+ export const ProductClickSchema = z.strictObject({
304
+ payload: ProductClickPayloadSchema,
305
+ });
306
+ export const SelectProductsSchema = z.strictObject({
307
+ payload: SelectProductsPayloadSchema,
308
+ });
309
+ export const ProductSummarySchema = z.looseObject({
310
+ actions: ProductSummaryActionsSchema.optional(),
311
+ component: z.literal('ProductSummary'),
312
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
313
+ state: ProductSummaryStateSchema.optional(),
260
314
  });
261
315
  export const SelectPageSchema = z.strictObject({
262
316
  payload: SelectPagePayloadSchema,
@@ -264,6 +318,9 @@ export const SelectPageSchema = z.strictObject({
264
318
  export const PurpleSetPageSizeSchema = z.strictObject({
265
319
  payload: PayloadSchema,
266
320
  });
321
+ export const ShowMoreSchema = z.strictObject({
322
+ payload: ShowMorePayloadSchema,
323
+ });
267
324
  export const SelectSortSchema = z.strictObject({
268
325
  payload: SelectSortPayloadSchema,
269
326
  });
@@ -339,61 +396,64 @@ export const FacetSearchClassSchema = z.strictObject({
339
396
  query: z.string().max(256),
340
397
  results: z.array(CategoryFacetValueSchema),
341
398
  });
342
- export const FacetManagerSchema = z.strictObject({
343
- actions: FacetManagerActionsSchema,
344
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
345
- children: z
346
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
347
- .max(1000)
348
- .optional(),
349
- componentType: z.literal('facet-manager'),
350
- state: FacetManagerStateSchema,
399
+ export const FacetManagerSchema = z.looseObject({
400
+ actions: FacetManagerActionsSchema.optional(),
401
+ component: z.literal('FacetManager'),
402
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
403
+ state: FacetManagerStateSchema.optional(),
404
+ });
405
+ export const OverrideCorrectionSchema = z.strictObject({
406
+ payload: OverrideCorrectionPayloadSchema,
407
+ });
408
+ export const FacetRestoreSchema = z.strictObject({
409
+ facetId: z.string().min(1),
410
+ numericRanges: z.array(NumericRangeRestoreSchema).optional(),
411
+ values: z.array(z.string()).optional(),
351
412
  });
352
413
  export const SubmitQuerySchema = z.strictObject({
353
414
  payload: SubmitQueryPayloadSchema,
354
415
  });
355
- export const LayoutStackSchema = z.strictObject({
356
- actions: LayoutStackActionsSchema,
357
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
358
- children: z
359
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
360
- .max(1000)
361
- .optional(),
362
- componentType: z.literal('layout-stack'),
363
- state: LayoutStackStateSchema,
364
- });
365
- export const QuerySummarySchema = z.strictObject({
366
- actions: QuerySummaryActionsSchema,
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,
416
+ export const LayoutStackSchema = z.looseObject({
417
+ actions: LayoutStackActionsSchema.optional(),
418
+ component: z.literal('LayoutStack'),
419
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
420
+ state: LayoutStackStateSchema.optional(),
421
+ });
422
+ export const QuerySummarySchema = z.looseObject({
423
+ actions: QuerySummaryActionsSchema.optional(),
424
+ component: z.literal('QuerySummary'),
425
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
426
+ state: QuerySummaryStateSchema.optional(),
374
427
  });
375
428
  export const FluffySetPageSizeSchema = z.strictObject({
376
429
  payload: SetPageSizePayloadSchema,
377
430
  });
431
+ export const PurchaseSchema = z.strictObject({
432
+ payload: PurchasePayloadSchema,
433
+ });
434
+ export const QuerySuggestionsActionsSchema = z.strictObject({
435
+ fetchSuggestions: FetchSuggestionsSchema,
436
+ });
378
437
  export const NextActionsBarActionsSchema = z.strictObject({
379
438
  selectAction: SelectActionSchema,
380
439
  });
381
440
  export const BundleDisplayStateSchema = z.strictObject({
382
441
  tiers: z.array(BundleTierSchema),
383
442
  });
384
- export const ComparisonTableSchema = z.strictObject({
385
- actions: ComparisonTableActionsSchema,
386
- child: z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')).optional(),
387
- children: z
388
- .array(z.string().regex(new RegExp('^[a-z][a-z0-9-]*$')))
389
- .max(1000)
390
- .optional(),
391
- componentType: z.literal('comparison-table'),
392
- state: ComparisonTableStateSchema,
443
+ export const ComparisonTableSchema = z.looseObject({
444
+ actions: ComparisonTableActionsSchema.optional(),
445
+ component: z.literal('ComparisonTable'),
446
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
447
+ state: ComparisonTableStateSchema.optional(),
448
+ });
449
+ export const ProductListActionsSchema = z.strictObject({
450
+ productClick: ProductClickSchema,
451
+ selectProducts: SelectProductsSchema,
393
452
  });
394
453
  export const PaginationActionsSchema = z.strictObject({
395
454
  selectPage: SelectPageSchema,
396
455
  setPageSize: PurpleSetPageSizeSchema,
456
+ showMore: ShowMoreSchema,
397
457
  });
398
458
  export const SortActionsSchema = z.strictObject({
399
459
  selectSort: SelectSortSchema,
@@ -452,114 +512,111 @@ export const CategoryFacetStateSchema = z.strictObject({
452
512
  field: z.string(),
453
513
  values: CategoryFacetValuesSchema,
454
514
  });
455
- export const CommerceSearchActionsSchema = z.strictObject({
456
- submitQuery: SubmitQuerySchema,
515
+ export const RestoreStatePayloadSchema = z.strictObject({
516
+ facets: z.array(FacetRestoreSchema).optional(),
517
+ page: z.number().int().min(0),
518
+ pageSize: z.number().int().min(1),
519
+ pinnedProducts: z.array(z.string()).optional(),
520
+ query: z.string(),
521
+ sortCriteria: z.string().optional(),
457
522
  });
458
523
  export const PageSizeActionsSchema = z.strictObject({
459
524
  setPageSize: FluffySetPageSizeSchema,
460
525
  });
461
- export const NextActionsBarSchema = z.strictObject({
462
- actions: NextActionsBarActionsSchema,
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,
560
- });
561
- export const ComponentContractsSchema = z.discriminatedUnion('componentType', [
526
+ export const CartActionsSchema = z.strictObject({
527
+ purchase: PurchaseSchema,
528
+ updateCart: UpdateCartSchema,
529
+ });
530
+ export const QuerySuggestionsSchema = z.looseObject({
531
+ actions: QuerySuggestionsActionsSchema.optional(),
532
+ component: z.literal('QuerySuggestions'),
533
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
534
+ state: QuerySuggestionsStateSchema.optional(),
535
+ });
536
+ export const NextActionsBarSchema = z.looseObject({
537
+ actions: NextActionsBarActionsSchema.optional(),
538
+ component: z.literal('NextActionsBar'),
539
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
540
+ state: NextActionsStateSchema.optional(),
541
+ });
542
+ export const BundleDisplaySchema = z.looseObject({
543
+ actions: BundleDisplayActionsSchema.optional(),
544
+ component: z.literal('BundleDisplay'),
545
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
546
+ state: BundleDisplayStateSchema.optional(),
547
+ });
548
+ export const ProductListSchema = z.looseObject({
549
+ actions: ProductListActionsSchema.optional(),
550
+ component: z.literal('ProductList'),
551
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
552
+ state: ProductListStateSchema.optional(),
553
+ });
554
+ export const PaginationSchema = z.looseObject({
555
+ actions: PaginationActionsSchema.optional(),
556
+ component: z.literal('Pagination'),
557
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
558
+ state: PaginationStateSchema.optional(),
559
+ });
560
+ export const SortSchema = z.looseObject({
561
+ actions: SortActionsSchema.optional(),
562
+ component: z.literal('Sort'),
563
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
564
+ state: SortStateSchema.optional(),
565
+ });
566
+ export const RegularFacetSchema = z.looseObject({
567
+ actions: RegularFacetActionsSchema.optional(),
568
+ component: z.literal('RegularFacet'),
569
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
570
+ state: RegularFacetStateSchema.optional(),
571
+ });
572
+ export const NumericFacetSchema = z.looseObject({
573
+ actions: NumericFacetActionsSchema.optional(),
574
+ component: z.literal('NumericFacet'),
575
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
576
+ state: NumericFacetStateSchema.optional(),
577
+ });
578
+ export const DateFacetSchema = z.looseObject({
579
+ actions: DateFacetActionsSchema.optional(),
580
+ component: z.literal('DateFacet'),
581
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
582
+ state: DateFacetStateSchema.optional(),
583
+ });
584
+ export const CategoryFacetSchema = z.looseObject({
585
+ actions: CategoryFacetActionsSchema.optional(),
586
+ component: z.literal('CategoryFacet'),
587
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
588
+ state: CategoryFacetStateSchema.optional(),
589
+ });
590
+ export const RestoreStateSchema = z.strictObject({
591
+ payload: RestoreStatePayloadSchema,
592
+ });
593
+ export const PageSizeSchema = z.looseObject({
594
+ actions: PageSizeActionsSchema.optional(),
595
+ component: z.literal('PageSize'),
596
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
597
+ state: PageSizeStateSchema.optional(),
598
+ });
599
+ export const CartSchema = z.looseObject({
600
+ actions: CartActionsSchema.optional(),
601
+ component: z.literal('Cart'),
602
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
603
+ state: CartStateSchema.optional(),
604
+ });
605
+ export const CommerceSearchActionsSchema = z.strictObject({
606
+ overrideCorrection: OverrideCorrectionSchema,
607
+ restoreState: RestoreStateSchema,
608
+ submitQuery: SubmitQuerySchema,
609
+ });
610
+ export const CommerceSearchSchema = z.looseObject({
611
+ actions: CommerceSearchActionsSchema.optional(),
612
+ component: z.literal('CommerceSearch'),
613
+ id: z.string().min(1).max(256).regex(new RegExp('^[a-z][a-z0-9-]*$')),
614
+ state: CommerceSearchStateSchema.optional(),
615
+ });
616
+ export const ComponentContractsSchema = z.discriminatedUnion('component', [
562
617
  ProductCarouselSchema,
618
+ CartSchema,
619
+ QuerySuggestionsSchema,
563
620
  NextActionsBarSchema,
564
621
  BundleDisplaySchema,
565
622
  ComparisonTableSchema,
@@ -578,76 +635,368 @@ export const ComponentContractsSchema = z.discriminatedUnion('componentType', [
578
635
  PageSizeSchema,
579
636
  ]);
580
637
  /**
581
- * Component props schemas.
582
- * These props are injected by the A2-UI surface layer (backend) and passed to catalog
583
- * renderers automatically. Consumers should NOT hardcode these values; they arrive via
584
- * the createSurface message's components[].props.
638
+ * A2-UI dynamic-value building blocks (self-contained; no renderer / @a2ui/web_core dependency).
639
+ * A bindable prop is an A2-UI Dynamic_Value: a union admitting a literal resolved value, an
640
+ * A2-UI Data_Binding object { path }, or a function-call form. The frozen renderer's binder
641
+ * classifies a field as resolvable only when its schema is such a union including DataBinding,
642
+ * so it dereferences the { path } against the data model before the renderer sees it.
643
+ *
644
+ * `DataBindingSchema` is projected from the shared definitions/data-binding.schema.json (like
645
+ * ComponentId / ChildList), so it is not re-declared here; the unions below reference it.
646
+ */
647
+ export const FunctionCallSchema = z.object({
648
+ functionName: z.string(),
649
+ args: z.array(z.unknown()).optional(),
650
+ });
651
+ export const DynamicNumberSchema = z.union([z.number(), DataBindingSchema, FunctionCallSchema]);
652
+ export const DynamicStringSchema = z.union([z.string(), DataBindingSchema, FunctionCallSchema]);
653
+ export const DynamicBooleanSchema = z.union([z.boolean(), DataBindingSchema, FunctionCallSchema]);
654
+ export const DynamicStringListSchema = z.union([
655
+ z.array(z.string()),
656
+ DataBindingSchema,
657
+ FunctionCallSchema,
658
+ ]);
659
+ export const DynamicValueSchema = z.union([z.unknown(), DataBindingSchema, FunctionCallSchema]);
660
+ /**
661
+ * The A2-UI Action schema for an action-typed prop: the standard A2-UI event shape
662
+ * { event: { name; context } }. Named DynamicAction to stay distinct from the generated base
663
+ * action-contract ActionSchema and from a component's dispatchable *Actions contract.
664
+ */
665
+ export const DynamicActionSchema = z.object({
666
+ event: z.object({
667
+ name: z.string(),
668
+ context: z.unknown().optional(),
669
+ }),
670
+ });
671
+ /**
672
+ * Per-component props schemas for the renderer catalog (one per component), passed to
673
+ * `createCatalog` as each component's `{ props }` schema. Each bindable prop is an A2-UI
674
+ * Dynamic_Value, so the renderer's binder resolves its `{ path }` binding against the A2-UI
675
+ * data model; composition child-ref props stay static so child ids reach the renderer
676
+ * untouched. The resolved shape a renderer actually reads is the `XxxProps` type.
585
677
  */
586
678
  export const BundleDisplayPropsSchema = z.object({
587
- componentId: z.string(),
588
- componentType: z.literal('bundle-display'),
679
+ tiers: DynamicValueSchema,
589
680
  });
681
+ export const CartPropsSchema = z.object({});
590
682
  export const CategoryFacetPropsSchema = z.object({
591
- componentId: z.string(),
592
- componentType: z.literal('category-facet'),
683
+ field: DynamicStringSchema,
684
+ displayName: DynamicStringSchema,
685
+ values: DynamicValueSchema,
686
+ canShowMoreValues: DynamicBooleanSchema,
687
+ canShowLessValues: DynamicBooleanSchema,
688
+ facetSearch: DynamicValueSchema,
593
689
  });
594
690
  export const CommerceSearchPropsSchema = z.object({
595
- componentId: z.string(),
596
- componentType: z.literal('commerce-search'),
691
+ sidebarChild: z.string().optional(),
692
+ mainChild: z.string().optional(),
597
693
  });
598
694
  export const ComparisonTablePropsSchema = z.object({
599
- componentId: z.string(),
600
- componentType: z.literal('comparison-table'),
695
+ heading: DynamicStringSchema,
696
+ summary: DynamicStringSchema,
697
+ products: DynamicValueSchema,
698
+ attributes: DynamicValueSchema,
601
699
  });
602
700
  export const DateFacetPropsSchema = z.object({
603
- componentId: z.string(),
604
- componentType: z.literal('date-facet'),
701
+ field: DynamicStringSchema,
702
+ displayName: DynamicStringSchema,
703
+ values: DynamicValueSchema,
704
+ customRange: DynamicValueSchema,
705
+ hasActiveValues: DynamicBooleanSchema,
706
+ canShowMoreValues: DynamicBooleanSchema,
707
+ canShowLessValues: DynamicBooleanSchema,
605
708
  });
606
709
  export const FacetManagerPropsSchema = z.object({
607
- componentId: z.string(),
608
- componentType: z.literal('facet-manager'),
710
+ children: z.array(z.string()).optional(),
609
711
  });
610
712
  export const LayoutStackPropsSchema = z.object({
611
- componentId: z.string(),
612
- componentType: z.literal('layout-stack'),
713
+ direction: z.string().optional(),
714
+ children: z.array(z.string()).optional(),
613
715
  });
614
716
  export const NextActionsBarPropsSchema = z.object({
615
- componentId: z.string(),
616
- componentType: z.literal('next-actions-bar'),
717
+ suggestedActions: DynamicValueSchema,
617
718
  });
618
719
  export const NumericFacetPropsSchema = z.object({
619
- componentId: z.string(),
620
- componentType: z.literal('numeric-facet'),
720
+ field: DynamicStringSchema,
721
+ displayName: DynamicStringSchema,
722
+ values: DynamicValueSchema,
723
+ customRange: DynamicValueSchema,
724
+ hasActiveValues: DynamicBooleanSchema,
725
+ canShowMoreValues: DynamicBooleanSchema,
726
+ canShowLessValues: DynamicBooleanSchema,
727
+ domain: DynamicValueSchema,
621
728
  });
622
729
  export const PageSizePropsSchema = z.object({
623
- componentId: z.string(),
624
- componentType: z.literal('page-size'),
730
+ pageSize: DynamicNumberSchema,
625
731
  });
626
732
  export const PaginationPropsSchema = z.object({
627
- componentId: z.string(),
628
- componentType: z.literal('pagination'),
733
+ page: DynamicNumberSchema,
734
+ pageSize: DynamicNumberSchema,
735
+ totalEntries: DynamicNumberSchema,
736
+ totalPages: DynamicNumberSchema,
629
737
  });
630
738
  export const ProductCarouselPropsSchema = z.object({
631
- componentId: z.string(),
632
- componentType: z.literal('product-carousel'),
739
+ heading: DynamicStringSchema,
740
+ products: DynamicValueSchema,
633
741
  });
634
742
  export const ProductListPropsSchema = z.object({
635
- componentId: z.string(),
636
- componentType: z.literal('product-list'),
743
+ products: DynamicValueSchema,
637
744
  });
638
745
  export const ProductSummaryPropsSchema = z.object({
639
- componentId: z.string(),
640
- componentType: z.literal('product-summary'),
746
+ categoryLabel: DynamicStringSchema,
747
+ product: DynamicValueSchema,
748
+ });
749
+ export const QuerySuggestionsPropsSchema = z.object({
750
+ query: DynamicStringSchema,
751
+ completions: DynamicValueSchema,
752
+ products: DynamicValueSchema,
641
753
  });
642
754
  export const QuerySummaryPropsSchema = z.object({
643
- componentId: z.string(),
644
- componentType: z.literal('query-summary'),
755
+ query: DynamicStringSchema,
756
+ firstIndex: DynamicNumberSchema,
757
+ lastIndex: DynamicNumberSchema,
758
+ totalEntries: DynamicNumberSchema,
645
759
  });
646
760
  export const RegularFacetPropsSchema = z.object({
647
- componentId: z.string(),
648
- componentType: z.literal('regular-facet'),
761
+ field: DynamicStringSchema,
762
+ displayName: DynamicStringSchema,
763
+ values: DynamicValueSchema,
764
+ hasActiveValues: DynamicBooleanSchema,
765
+ canShowMoreValues: DynamicBooleanSchema,
766
+ canShowLessValues: DynamicBooleanSchema,
767
+ facetSearch: DynamicValueSchema,
649
768
  });
650
769
  export const SortPropsSchema = z.object({
651
- componentId: z.string(),
652
- componentType: z.literal('sort'),
770
+ appliedSort: DynamicValueSchema,
771
+ availableSorts: DynamicValueSchema,
653
772
  });
773
+ /**
774
+ * Per-component action unions in the standard A2-UI event shape
775
+ * { event: { name: <literal>; context: <typed payload> } }, one member per declared action.
776
+ * Derived from each component's *Actions contract (action-map key -> payload), NOT from
777
+ * quicktype's auto-named payload wrappers. A component with no actions has `type XxxAction =
778
+ * never`. The wire field is `context`; the internal validation layer calls the same data
779
+ * `payload` (see design: Action typing).
780
+ */
781
+ export const BundleDisplayActionSchema = z.never();
782
+ export const CartActionSchema = z.union([
783
+ z.object({
784
+ event: z.object({
785
+ name: z.literal('updateCart'),
786
+ context: z.strictObject({
787
+ productId: z.string(),
788
+ name: z.string().optional(),
789
+ price: z.unknown().optional(),
790
+ quantity: z.number().int().min(1),
791
+ operation: z.enum(['add', 'remove', 'setQuantity']),
792
+ }),
793
+ }),
794
+ }),
795
+ z.object({
796
+ event: z.object({
797
+ name: z.literal('purchase'),
798
+ context: z.strictObject({ products: z.array(z.unknown()), transaction: z.unknown() }),
799
+ }),
800
+ }),
801
+ ]);
802
+ export const CategoryFacetActionSchema = z.union([
803
+ z.object({
804
+ event: z.object({
805
+ name: z.literal('selectPath'),
806
+ context: z.strictObject({ path: z.array(z.string()) }),
807
+ }),
808
+ }),
809
+ z.object({ event: z.object({ name: z.literal('clearSelectedPath'), context: z.unknown() }) }),
810
+ z.object({
811
+ event: z.object({
812
+ name: z.literal('search'),
813
+ context: z.strictObject({ query: z.string().max(256) }),
814
+ }),
815
+ }),
816
+ z.object({ event: z.object({ name: z.literal('showMoreSearchResults'), context: z.unknown() }) }),
817
+ z.object({ event: z.object({ name: z.literal('clearSearch'), context: z.unknown() }) }),
818
+ z.object({ event: z.object({ name: z.literal('showMoreValues'), context: z.unknown() }) }),
819
+ z.object({ event: z.object({ name: z.literal('showLessValues'), context: z.unknown() }) }),
820
+ ]);
821
+ export const CommerceSearchActionSchema = z.union([
822
+ z.object({
823
+ event: z.object({
824
+ name: z.literal('submitQuery'),
825
+ context: z.strictObject({ query: z.string() }),
826
+ }),
827
+ }),
828
+ z.object({
829
+ event: z.object({
830
+ name: z.literal('restoreState'),
831
+ context: z.strictObject({
832
+ query: z.string(),
833
+ page: z.number().int().min(0),
834
+ pageSize: z.number().int().min(1),
835
+ sortCriteria: z.string().optional(),
836
+ facets: z.array(z.unknown()).optional(),
837
+ pinnedProducts: z.array(z.string()).optional(),
838
+ }),
839
+ }),
840
+ }),
841
+ z.object({
842
+ event: z.object({
843
+ name: z.literal('overrideCorrection'),
844
+ context: z.strictObject({ originalQuery: z.string() }),
845
+ }),
846
+ }),
847
+ ]);
848
+ export const ComparisonTableActionSchema = z.never();
849
+ export const DateFacetActionSchema = z.union([
850
+ z.object({
851
+ event: z.object({
852
+ name: z.literal('toggleSelect'),
853
+ context: z.strictObject({ start: z.string(), end: z.string() }),
854
+ }),
855
+ }),
856
+ z.object({
857
+ event: z.object({
858
+ name: z.literal('toggleSingleSelect'),
859
+ context: z.strictObject({ start: z.string(), end: z.string() }),
860
+ }),
861
+ }),
862
+ z.object({ event: z.object({ name: z.literal('clearAllActiveValues'), context: z.unknown() }) }),
863
+ z.object({
864
+ event: z.object({
865
+ name: z.literal('applyCustomRange'),
866
+ context: z.strictObject({ start: z.string(), end: z.string() }),
867
+ }),
868
+ }),
869
+ z.object({ event: z.object({ name: z.literal('showMoreValues'), context: z.unknown() }) }),
870
+ z.object({ event: z.object({ name: z.literal('showLessValues'), context: z.unknown() }) }),
871
+ ]);
872
+ export const FacetManagerActionSchema = z.never();
873
+ export const LayoutStackActionSchema = z.never();
874
+ export const NextActionsBarActionSchema = z.union([
875
+ z.object({
876
+ event: z.object({
877
+ name: z.literal('selectAction'),
878
+ context: z.strictObject({ text: z.string(), type: z.enum(['followup', 'search']) }),
879
+ }),
880
+ }),
881
+ ]);
882
+ export const NumericFacetActionSchema = z.union([
883
+ z.object({
884
+ event: z.object({
885
+ name: z.literal('toggleSelect'),
886
+ context: z.strictObject({ start: z.number(), end: z.number() }),
887
+ }),
888
+ }),
889
+ z.object({
890
+ event: z.object({
891
+ name: z.literal('toggleSingleSelect'),
892
+ context: z.strictObject({ start: z.number(), end: z.number() }),
893
+ }),
894
+ }),
895
+ z.object({ event: z.object({ name: z.literal('clearAllActiveValues'), context: z.unknown() }) }),
896
+ z.object({
897
+ event: z.object({
898
+ name: z.literal('applyCustomRange'),
899
+ context: z.strictObject({ start: z.number(), end: z.number() }),
900
+ }),
901
+ }),
902
+ z.object({ event: z.object({ name: z.literal('showMoreValues'), context: z.unknown() }) }),
903
+ z.object({ event: z.object({ name: z.literal('showLessValues'), context: z.unknown() }) }),
904
+ ]);
905
+ export const PageSizeActionSchema = z.union([
906
+ z.object({
907
+ event: z.object({
908
+ name: z.literal('setPageSize'),
909
+ context: z.strictObject({ pageSize: z.number().int().min(1) }),
910
+ }),
911
+ }),
912
+ ]);
913
+ export const PaginationActionSchema = z.union([
914
+ z.object({
915
+ event: z.object({
916
+ name: z.literal('selectPage'),
917
+ context: z.strictObject({ page: z.number().int().min(0) }),
918
+ }),
919
+ }),
920
+ z.object({
921
+ event: z.object({
922
+ name: z.literal('setPageSize'),
923
+ context: z.strictObject({ pageSize: z.number().int().min(1) }),
924
+ }),
925
+ }),
926
+ z.object({ event: z.object({ name: z.literal('showMore'), context: z.strictObject({}) }) }),
927
+ ]);
928
+ export const ProductCarouselActionSchema = z.never();
929
+ export const ProductListActionSchema = z.union([
930
+ z.object({
931
+ event: z.object({
932
+ name: z.literal('selectProducts'),
933
+ context: z.strictObject({ productIds: z.array(z.string()) }),
934
+ }),
935
+ }),
936
+ z.object({
937
+ event: z.object({
938
+ name: z.literal('productClick'),
939
+ context: z.strictObject({
940
+ productId: z.string(),
941
+ name: z.string().optional(),
942
+ price: z.unknown().optional(),
943
+ position: z.number().int().min(0),
944
+ }),
945
+ }),
946
+ }),
947
+ ]);
948
+ export const ProductSummaryActionSchema = z.never();
949
+ export const QuerySuggestionsActionSchema = z.union([
950
+ z.object({
951
+ event: z.object({
952
+ name: z.literal('fetchSuggestions'),
953
+ context: z.strictObject({ query: z.string() }),
954
+ }),
955
+ }),
956
+ ]);
957
+ export const QuerySummaryActionSchema = z.never();
958
+ export const RegularFacetActionSchema = z.union([
959
+ z.object({
960
+ event: z.object({
961
+ name: z.literal('toggleSelect'),
962
+ context: z.strictObject({ value: z.string().max(1024) }),
963
+ }),
964
+ }),
965
+ z.object({
966
+ event: z.object({
967
+ name: z.literal('toggleExclude'),
968
+ context: z.strictObject({ value: z.string().max(1024) }),
969
+ }),
970
+ }),
971
+ z.object({
972
+ event: z.object({
973
+ name: z.literal('toggleSingleSelect'),
974
+ context: z.strictObject({ value: z.string().max(1024) }),
975
+ }),
976
+ }),
977
+ z.object({
978
+ event: z.object({
979
+ name: z.literal('toggleSingleExclude'),
980
+ context: z.strictObject({ value: z.string().max(1024) }),
981
+ }),
982
+ }),
983
+ z.object({ event: z.object({ name: z.literal('clearAllActiveValues'), context: z.unknown() }) }),
984
+ z.object({
985
+ event: z.object({
986
+ name: z.literal('search'),
987
+ context: z.strictObject({ query: z.string().max(1024) }),
988
+ }),
989
+ }),
990
+ z.object({ event: z.object({ name: z.literal('showMoreSearchResults'), context: z.unknown() }) }),
991
+ z.object({ event: z.object({ name: z.literal('clearSearch'), context: z.unknown() }) }),
992
+ z.object({ event: z.object({ name: z.literal('showMoreValues'), context: z.unknown() }) }),
993
+ z.object({ event: z.object({ name: z.literal('showLessValues'), context: z.unknown() }) }),
994
+ ]);
995
+ export const SortActionSchema = z.union([
996
+ z.object({
997
+ event: z.object({
998
+ name: z.literal('selectSort'),
999
+ context: z.strictObject({ sortCriteria: z.string(), fields: z.array(z.unknown()) }),
1000
+ }),
1001
+ }),
1002
+ ]);