@thorprovider/storefront 0.14.0 → 0.15.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 (112) hide show
  1. package/README.md +28 -12
  2. package/assets/templates/app/app/[[...slug]]/page.tsx +6 -0
  3. package/assets/templates/app/app/layout.tsx +2 -2
  4. package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +11 -4
  5. package/assets/templates/app/lib/__STOREFRONT__/confirmation.core.ts +7 -4
  6. package/assets/templates/app/lib/__STOREFRONT__/mappers.ts +18 -3
  7. package/assets/templates/app/lib/__STOREFRONT__/registry.tsx +10 -0
  8. package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +8 -0
  9. package/assets/templates/app/lib/__STOREFRONT__/store-context.ts +84 -18
  10. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.universal-main-menu.ts +3 -1
  11. package/assets/templates/app/public/images/README.md +43 -0
  12. package/assets/templates/app/public/images/banners/banner-aurora-deal.webp +0 -0
  13. package/assets/templates/app/public/images/banners/banner-guia-regalo.webp +0 -0
  14. package/assets/templates/app/public/images/banners/banner-mesa-decor.webp +0 -0
  15. package/assets/templates/app/public/images/banners/banner-nuevas-llegadas.webp +0 -0
  16. package/assets/templates/app/public/images/banners/banner-salon-oferta.webp +0 -0
  17. package/assets/templates/app/public/images/categories/accessories.webp +0 -0
  18. package/assets/templates/app/public/images/categories/dresses.webp +0 -0
  19. package/assets/templates/app/public/images/categories/furniture.webp +0 -0
  20. package/assets/templates/app/public/images/categories/home.webp +0 -0
  21. package/assets/templates/app/public/images/categories/jackets.webp +0 -0
  22. package/assets/templates/app/public/images/editorial/studio.webp +0 -0
  23. package/assets/templates/app/public/images/products/alpine-jacket.webp +0 -0
  24. package/assets/templates/app/public/images/products/amber-dress.webp +0 -0
  25. package/assets/templates/app/public/images/products/atlas-lamp.webp +0 -0
  26. package/assets/templates/app/public/images/products/atlas-sofa.webp +0 -0
  27. package/assets/templates/app/public/images/products/aurora-jacket.webp +0 -0
  28. package/assets/templates/app/public/images/products/boreal-jacket.webp +0 -0
  29. package/assets/templates/app/public/images/products/camille-dress.webp +0 -0
  30. package/assets/templates/app/public/images/products/ceramic-table-lamp.webp +0 -0
  31. package/assets/templates/app/public/images/products/cinder-jacket.webp +0 -0
  32. package/assets/templates/app/public/images/products/copper-lamp.webp +0 -0
  33. package/assets/templates/app/public/images/products/cove-bag.webp +0 -0
  34. package/assets/templates/app/public/images/products/dahlia-dress.webp +0 -0
  35. package/assets/templates/app/public/images/products/drift-jacket.webp +0 -0
  36. package/assets/templates/app/public/images/products/dune-lamp.webp +0 -0
  37. package/assets/templates/app/public/images/products/elara-dress.webp +0 -0
  38. package/assets/templates/app/public/images/products/ember-jacket.webp +0 -0
  39. package/assets/templates/app/public/images/products/fable-bag.webp +0 -0
  40. package/assets/templates/app/public/images/products/fjord-jacket.webp +0 -0
  41. package/assets/templates/app/public/images/products/floor-cushion.webp +0 -0
  42. package/assets/templates/app/public/images/products/harbor-jacket.webp +0 -0
  43. package/assets/templates/app/public/images/products/helios-lamp.webp +0 -0
  44. package/assets/templates/app/public/images/products/iris-dress.webp +0 -0
  45. package/assets/templates/app/public/images/products/juniper-bag.webp +0 -0
  46. package/assets/templates/app/public/images/products/kestrel-bag.webp +0 -0
  47. package/assets/templates/app/public/images/products/linen-armchair.webp +0 -0
  48. package/assets/templates/app/public/images/products/lumen-dress.webp +0 -0
  49. package/assets/templates/app/public/images/products/luna-bag.webp +0 -0
  50. package/assets/templates/app/public/images/products/marble-coffee-table.webp +0 -0
  51. package/assets/templates/app/public/images/products/marlowe-bag.webp +0 -0
  52. package/assets/templates/app/public/images/products/meridian-jacket.webp +0 -0
  53. package/assets/templates/app/public/images/products/nomad-jacket.webp +0 -0
  54. package/assets/templates/app/public/images/products/nova-dress.webp +0 -0
  55. package/assets/templates/app/public/images/products/oak-dining-table.webp +0 -0
  56. package/assets/templates/app/public/images/products/onyx-lamp.webp +0 -0
  57. package/assets/templates/app/public/images/products/piper-bag.webp +0 -0
  58. package/assets/templates/app/public/images/products/quill-lamp.webp +0 -0
  59. package/assets/templates/app/public/images/products/rosalind-dress.webp +0 -0
  60. package/assets/templates/app/public/images/products/rune-bag.webp +0 -0
  61. package/assets/templates/app/public/images/products/side-table.webp +0 -0
  62. package/assets/templates/app/public/images/products/slate-lamp.webp +0 -0
  63. package/assets/templates/app/public/images/products/solis-dress.webp +0 -0
  64. package/assets/templates/app/public/images/products/storage-shelf.webp +0 -0
  65. package/assets/templates/app/public/images/products/terra-lamp.webp +0 -0
  66. package/assets/templates/app/public/images/products/tundra-jacket.webp +0 -0
  67. package/assets/templates/app/public/images/products/vantage-jacket.webp +0 -0
  68. package/assets/templates/app/public/images/products/vera-dress.webp +0 -0
  69. package/assets/templates/app/public/images/products/verdant-lamp.webp +0 -0
  70. package/assets/templates/app/public/images/products/wall-mirror.webp +0 -0
  71. package/assets/templates/app/public/images/products/wool-rug.webp +0 -0
  72. package/assets/templates/views/account/address-book-advanced.defaults.ts +1 -1
  73. package/assets/templates/views/cart/registry.tsx +9 -0
  74. package/assets/templates/views/checkout/checkout-commerce-hosted.tsx +5 -1
  75. package/assets/templates/views/home/assembly/assembly.json +0 -1
  76. package/assets/templates/views/home/assembly/index.skeleton.tsx +3 -7
  77. package/assets/templates/views/home/assembly/registry.skeleton.tsx +0 -3
  78. package/assets/templates/views/home/content.ts +34 -80
  79. package/assets/templates/views/home/data.ts +12 -0
  80. package/assets/templates/views/home/index.tsx +4 -21
  81. package/assets/templates/views/home/props.ts +1 -7
  82. package/assets/templates/views/home/registry.tsx +0 -35
  83. package/assets/templates/views/home/schema.ts +0 -36
  84. package/bin/storefront.js +12 -27
  85. package/package.json +3 -2
  86. package/recipes/archetypes.json +0 -21
  87. package/recipes/catalog.json +0 -22
  88. package/recipes/features.json +0 -2
  89. package/recipes/recipe.schema.json +5 -0
  90. package/recipes/recipes.json +19 -16
  91. package/recipes/validate.mjs +7 -0
  92. package/scripts/candidate.mjs +3 -3
  93. package/scripts/default-sections.mjs +1 -0
  94. package/scripts/env-file.mjs +10 -0
  95. package/scripts/file-classes.mjs +3 -0
  96. package/scripts/generate-demo-images.mjs +507 -0
  97. package/scripts/reconcile.mjs +32 -1
  98. package/scripts/render-templates.mjs +13 -1
  99. package/scripts/section-compat.mjs +10 -1
  100. package/scripts/section-operations.mjs +3 -0
  101. package/scripts/starter.mjs +25 -1
  102. package/scripts/theme/starter-theme.mjs +118 -0
  103. package/skills/sf-view-gen/assets/recipes/archetypes.json +0 -21
  104. package/skills/sf-view-gen/assets/recipes/catalog.json +0 -22
  105. package/skills/sf-view-gen/assets/recipes/features.json +0 -2
  106. package/skills/sf-view-gen/assets/recipes/recipes.json +19 -16
  107. package/skills/sf-view-gen/assets/templates/views/sections/schema.universal-main-menu.ts +3 -1
  108. package/skills/sf-view-gen/scripts/validate.mjs +7 -0
  109. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/binding.json +0 -5
  110. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/catalog.part +0 -8
  111. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/element.part +0 -5
  112. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/registry.part +0 -31
@@ -100,7 +100,7 @@ export function classifySectionEntry(entry) {
100
100
  * @param {unknown[]} declaredSections the manifest `views[].sections` (may be
101
101
  * missing/empty, legacy, new-form, or a mix)
102
102
  * @param {string[]} registeredSlots the view's ordered core slots
103
- * @param {{ allowedSections?: string[], maxSections?: number }} [options]
103
+ * @param {{ allowedSections?: string[], maxSections?: number, retiredSlots?: string[] }} [options]
104
104
  * @returns {{ ok: boolean, sections: object[] | null, diagnostics: object[] }}
105
105
  * On failure `sections` is null (no output) and `diagnostics` is non-empty.
106
106
  */
@@ -108,6 +108,9 @@ export function normalizeViewSections(viewName, declaredSections, registeredSlot
108
108
  const slots = Array.isArray(registeredSlots) ? registeredSlots.filter(isNonEmptyString) : []
109
109
  const allowedSections = Array.isArray(options.allowedSections) ? options.allowedSections : null
110
110
  const maxSections = typeof options.maxSections === 'number' ? options.maxSections : null
111
+ const retiredSlots = Array.isArray(options.retiredSlots)
112
+ ? options.retiredSlots.filter(isNonEmptyString)
113
+ : []
111
114
  const declared = Array.isArray(declaredSections) ? declaredSections : []
112
115
 
113
116
  const diagnostics = []
@@ -140,6 +143,11 @@ export function normalizeViewSections(viewName, declaredSections, registeredSlot
140
143
  return
141
144
  }
142
145
  if (!slots.includes(entry.type)) {
146
+ // A slot the recipe has retired (for example `categories`) is dropped
147
+ // rather than refused: a manifest recorded against an earlier registry
148
+ // version must keep normalizing. A name that was never registered is
149
+ // still a typo and stays an error.
150
+ if (retiredSlots.includes(entry.type)) return
143
151
  push('E_UNKNOWN_HOST', `${path} names unregistered slot "${entry.type}".`, path)
144
152
  return
145
153
  }
@@ -296,5 +304,6 @@ export function normalizeViewSectionsForView(viewName, declaredSections) {
296
304
  return normalizeViewSections(viewName, declaredSections, recipe.registeredSlots ?? [], {
297
305
  allowedSections: recipe.allowedSections ?? [],
298
306
  maxSections: recipe.maxSections,
307
+ retiredSlots: recipe.retiredSlots ?? [],
299
308
  })
300
309
  }
@@ -186,6 +186,7 @@ export function reduceSectionAdd(manifest, op, options = {}) {
186
186
  const normalized = normalizeViewSections(viewName, installed.sections ?? [], registeredSlots, {
187
187
  allowedSections,
188
188
  maxSections,
189
+ retiredSlots: Array.isArray(recipe.retiredSlots) ? recipe.retiredSlots : [],
189
190
  })
190
191
  if (!normalized.ok) return { ok: false, diagnostics: normalized.diagnostics }
191
192
  const current = normalized.sections
@@ -329,6 +330,7 @@ export function reduceSectionRemove(manifest, op, options = {}) {
329
330
  const normalized = normalizeViewSections(viewName, installed.sections ?? [], registeredSlots, {
330
331
  allowedSections,
331
332
  maxSections,
333
+ retiredSlots: Array.isArray(recipe.retiredSlots) ? recipe.retiredSlots : [],
332
334
  })
333
335
  if (!normalized.ok) return { ok: false, diagnostics: normalized.diagnostics }
334
336
  const current = normalized.sections
@@ -415,6 +417,7 @@ export function reduceSectionReorder(manifest, op, options = {}) {
415
417
  const normalized = normalizeViewSections(viewName, installed.sections ?? [], registeredSlots, {
416
418
  allowedSections,
417
419
  maxSections,
420
+ retiredSlots: Array.isArray(recipe.retiredSlots) ? recipe.retiredSlots : [],
418
421
  })
419
422
  if (!normalized.ok) return { ok: false, diagnostics: normalized.diagnostics }
420
423
  const current = normalized.sections
@@ -6,12 +6,36 @@
6
6
  // feature and every curated view — including the views a feature owns, so each
7
7
  // installed feature satisfies the composition contract. The set is derived from
8
8
  // the registry (`recipes/validate.mjs`), never a hand-maintained list, so held
9
- // units are excluded by construction.
9
+ // units are excluded by construction and a curated unit opts out with
10
+ // `starter: false`.
10
11
 
11
12
  import { curatedViewNames, starterComposition } from '../recipes/validate.mjs'
13
+ import { MOCK_BACKEND_CAPABILITIES } from './mock-capabilities.mjs'
14
+ import { createManifest } from './manifest.mjs'
12
15
 
13
16
  export function scaffoldComposition({ starter = false } = {}) {
14
17
  if (!starter) return { views: ['home', 'cart'], features: [] }
15
18
  const { features } = starterComposition()
16
19
  return { views: curatedViewNames(), features }
17
20
  }
21
+
22
+ /**
23
+ * The manifest `create` starts from: the requested identity and theme, the
24
+ * composition for the requested branch, and the mock provider's advertised
25
+ * backend capabilities.
26
+ *
27
+ * `create` is offline by contract — it writes `.env.local` with
28
+ * `THOR_DATA_SOURCE=mock` and needs no backend — so the configured backend at
29
+ * that moment *is* the mock. Recording its flags is the truthful value and keeps
30
+ * the install gate intact: a capability-gated curated feature the starter
31
+ * installs (the account profile editor and address book) is installed on
32
+ * evidence, not on an assumption. `storefront setup` owns real-backend evidence
33
+ * and replaces this list with the live probe; `doctor` reports drift when a
34
+ * backend stops advertising a flag.
35
+ */
36
+ export function initialManifest({ name, siteName, mode, starter = false } = {}) {
37
+ const { views, features } = scaffoldComposition({ starter })
38
+ const manifest = createManifest({ name, siteName, mode, views, features })
39
+ manifest.capabilities = [...MOCK_BACKEND_CAPABILITIES]
40
+ return manifest
41
+ }
@@ -0,0 +1,118 @@
1
+ // The starter theme every `create` installs before any brand override.
2
+ //
3
+ // A marketplace identity: an orange call-to-action with dark text on it, dark
4
+ // navy chrome, a grey page field with white cards, and tight corners. Values are
5
+ // OKLCH so the lightness channel predicts contrast without a checker; every
6
+ // background/foreground pair the theme plan reports clears WCAG AA (see
7
+ // tests/starter-theme.test.ts).
8
+ //
9
+ // One source of truth: `create` applies this through the same theme-plan
10
+ // pipeline as `storefront theme --set`, so a starter palette and a hand-applied
11
+ // one cannot drift. A later `sync` never reverts it; `--brand` still wins for
12
+ // the primary family because it is applied after the starter tokens.
13
+
14
+ import { normalizeOperation, planCss } from './theme-plan.mjs'
15
+
16
+ export const STARTER_THEME = {
17
+ radius: '0.25rem',
18
+ light: {
19
+ background: 'oklch(0.944 0.003 197.1)',
20
+ foreground: 'oklch(0.175 0.003 196.9)',
21
+ card: 'oklch(1 0 0)',
22
+ 'card-foreground': 'oklch(0.175 0.003 196.9)',
23
+ popover: 'oklch(1 0 0)',
24
+ 'popover-foreground': 'oklch(0.175 0.003 196.9)',
25
+ primary: 'oklch(0.772 0.174 64.6)',
26
+ 'primary-foreground': 'oklch(0.175 0.003 196.9)',
27
+ 'primary-hover': 'oklch(0.715 0.161 64.8)',
28
+ 'primary-soft': 'oklch(0.969 0.028 79.5)',
29
+ secondary: 'oklch(0.966 0.001 197.1)',
30
+ 'secondary-foreground': 'oklch(0.175 0.003 196.9)',
31
+ muted: 'oklch(0.944 0.003 197.1)',
32
+ 'muted-foreground': 'oklch(0.461 0.004 197.0)',
33
+ accent: 'oklch(0.960 0.040 83.1)',
34
+ 'accent-foreground': 'oklch(0.175 0.003 196.9)',
35
+ border: 'oklch(0.882 0.004 197.1)',
36
+ input: 'oklch(0.882 0.004 197.1)',
37
+ ring: 'oklch(0.772 0.174 64.6)',
38
+ destructive: 'oklch(0.497 0.178 33.5)',
39
+ 'destructive-foreground': 'oklch(0.985 0.004 33.5)',
40
+ nav: 'oklch(0.211 0.018 255.7)',
41
+ promo: 'oklch(0.772 0.174 64.6)',
42
+ 'promo-foreground': 'oklch(0.175 0.003 196.9)',
43
+ stock: 'oklch(0.525 0.102 170.6)',
44
+ urgent: 'oklch(0.497 0.178 33.5)',
45
+ success: 'oklch(0.525 0.102 170.6)',
46
+ 'success-foreground': 'oklch(0.985 0.010 170.6)',
47
+ warning: 'oklch(0.792 0.167 68.9)',
48
+ 'warning-foreground': 'oklch(0.175 0.003 68.9)',
49
+ error: 'oklch(0.497 0.178 33.5)',
50
+ },
51
+ dark: {
52
+ background: 'oklch(0.189 0.015 253.2)',
53
+ foreground: 'oklch(0.963 0.001 197.1)',
54
+ card: 'oklch(0.240 0.021 251.7)',
55
+ 'card-foreground': 'oklch(0.963 0.001 197.1)',
56
+ popover: 'oklch(0.240 0.021 251.7)',
57
+ 'popover-foreground': 'oklch(0.963 0.001 197.1)',
58
+ primary: 'oklch(0.816 0.158 73.8)',
59
+ 'primary-foreground': 'oklch(0.175 0.003 196.9)',
60
+ 'primary-hover': 'oklch(0.866 0.140 78.0)',
61
+ 'primary-soft': 'oklch(0.330 0.060 72.0)',
62
+ secondary: 'oklch(0.313 0.020 251.5)',
63
+ 'secondary-foreground': 'oklch(0.963 0.001 197.1)',
64
+ muted: 'oklch(0.313 0.020 251.5)',
65
+ 'muted-foreground': 'oklch(0.791 0.014 248.0)',
66
+ accent: 'oklch(0.330 0.060 72.0)',
67
+ 'accent-foreground': 'oklch(0.963 0.001 197.1)',
68
+ border: 'oklch(0.330 0.018 252.0)',
69
+ input: 'oklch(0.330 0.018 252.0)',
70
+ ring: 'oklch(0.816 0.158 73.8)',
71
+ destructive: 'oklch(0.540 0.180 30.0)',
72
+ 'destructive-foreground': 'oklch(0.980 0.006 33.5)',
73
+ nav: 'oklch(0.171 0.015 253.2)',
74
+ promo: 'oklch(0.816 0.158 73.8)',
75
+ 'promo-foreground': 'oklch(0.175 0.003 196.9)',
76
+ stock: 'oklch(0.700 0.120 170.6)',
77
+ urgent: 'oklch(0.640 0.170 30.0)',
78
+ success: 'oklch(0.700 0.120 170.6)',
79
+ 'success-foreground': 'oklch(0.150 0.020 170.6)',
80
+ warning: 'oklch(0.820 0.150 72.0)',
81
+ 'warning-foreground': 'oklch(0.150 0.020 72.0)',
82
+ error: 'oklch(0.640 0.170 30.0)',
83
+ },
84
+ }
85
+
86
+ // `--set` entries for the starter palette, in the CLI's own vocabulary, so the
87
+ // create path and `storefront theme` accept identical input.
88
+ export function starterSets(theme = STARTER_THEME) {
89
+ const sets = []
90
+ for (const mode of ['light', 'dark']) {
91
+ for (const [name, value] of Object.entries(theme[mode] ?? {})) {
92
+ sets.push(`${mode}.${name}=${value}`)
93
+ }
94
+ }
95
+ if (theme.radius) sets.push(`shared.radius=${theme.radius}`)
96
+ return sets
97
+ }
98
+
99
+ // Apply the starter palette, then an explicit brand on top of it. Returns
100
+ // `{ css }` or `{ error }`; never writes. Brand is applied last because the
101
+ // theme plan resolves setters after shortcuts, and a builder brand must beat
102
+ // the starter's primary family.
103
+ export function applyStarterTheme(globalsCss, { brand = null, theme = STARTER_THEME } = {}) {
104
+ const apply = (css, input) => {
105
+ const { operation, diagnostics } = normalizeOperation(input)
106
+ const error = diagnostics.find((d) => d.severity === 'error')
107
+ if (error) return { error: error.message }
108
+ const planned = planCss(css, operation)
109
+ const planError = planned.diagnostics.find((d) => d.severity === 'error')
110
+ if (planError) return { error: planError.message }
111
+ return { css: planned.css }
112
+ }
113
+
114
+ const starter = apply(globalsCss, { sets: starterSets(theme) })
115
+ if (starter.error) return starter
116
+ if (!brand) return starter
117
+ return apply(starter.css, { brand })
118
+ }
@@ -41,27 +41,6 @@
41
41
  }
42
42
  }
43
43
  },
44
- "home.categories": {
45
- "default": "standard",
46
- "intents": {
47
- "standard": {
48
- "variant": "CategoryGrid",
49
- "when": "A balanced grid of category cards with image and label (canonical `presentation: 'grid'`)."
50
- },
51
- "iconGrid": {
52
- "variant": "CategoryGrid",
53
- "when": "A compact icon-based category grid for many small categories (canonical `presentation: 'icons'`)."
54
- },
55
- "featured": {
56
- "variant": "CategoryGrid",
57
- "when": "Few, large featured category tiles that act as primary navigation (canonical `presentation: 'icons'`)."
58
- },
59
- "editorial": {
60
- "variant": "CategoryGrid",
61
- "when": "Category tiles presented as a searchable list with subcategory chips (canonical `presentation: 'list'`)."
62
- }
63
- }
64
- },
65
44
  "product.overview": {
66
45
  "default": "standard",
67
46
  "intents": {
@@ -70,28 +70,6 @@
70
70
  }
71
71
  }
72
72
  },
73
- "home.categories": {
74
- "default": "CategoryGrid",
75
- "legacyAliases": {
76
- "ProductCategory": "CategoryGrid"
77
- },
78
- "variants": {
79
- "CategoryGrid": {
80
- "status": "executable",
81
- "block": "CategoryGrid",
82
- "dataShape": "CategoryCard[]",
83
- "events": [
84
- "browse",
85
- "viewAll",
86
- "queryChange"
87
- ],
88
- "state": "controlled",
89
- "requirements": [
90
- "categories"
91
- ]
92
- }
93
- }
94
- },
95
73
  "product.overview": {
96
74
  "default": "ProductOverview",
97
75
  "variants": {
@@ -49,7 +49,6 @@
49
49
  {
50
50
  "name": "customer-profile",
51
51
  "mvp": true,
52
- "starter": false,
53
52
  "status": "gated",
54
53
  "description": "Signed-in profile editor for the account area (name, phone, and email only where the backend supports changing it). Module of customer-auth.",
55
54
  "views": [],
@@ -64,7 +63,6 @@
64
63
  {
65
64
  "name": "customer-addresses",
66
65
  "mvp": true,
67
- "starter": false,
68
66
  "status": "gated",
69
67
  "description": "Signed-in address book for the account area (list, create, edit, delete, default shipping and billing). Module of customer-auth.",
70
68
  "views": [],
@@ -5,17 +5,15 @@
5
5
  {
6
6
  "name": "home",
7
7
  "mvp": true,
8
- "description": "Marketplace-style landing page: campaign hero, category departments, merchandising rails, trust band, and a closing call to action",
8
+ "description": "Marketplace-style landing page: campaign hero, four merchandising shelves (three rails, a product grid and a product showcase), a mid-page campaign band, and the trust band",
9
9
  "route": "/",
10
10
  "loader": "home",
11
11
  "requiredDataKeys": [
12
- "heroProducts",
13
- "categories"
12
+ "heroProducts"
14
13
  ],
15
14
  "defaultVariants": {
16
15
  "hero": "UniversalBanner",
17
- "benefits": "cards",
18
- "categories": "CategoryGrid"
16
+ "benefits": "cards"
19
17
  },
20
18
  "allowedVariants": {
21
19
  "hero": [
@@ -26,9 +24,6 @@
26
24
  "cards",
27
25
  "split"
28
26
  ],
29
- "categories": [
30
- "CategoryGrid"
31
- ],
32
27
  "productCard": [
33
28
  "ProductGrid"
34
29
  ]
@@ -42,9 +37,11 @@
42
37
  ],
43
38
  "registeredSlots": [
44
39
  "hero",
45
- "categories",
46
40
  "benefits"
47
41
  ],
42
+ "retiredSlots": [
43
+ "categories"
44
+ ],
48
45
  "allowedSections": [
49
46
  "faq",
50
47
  "cta",
@@ -59,28 +56,34 @@
59
56
  {
60
57
  "type": "products",
61
58
  "variant": "ProductSlider",
62
- "after": "categories"
59
+ "after": "hero"
63
60
  },
64
61
  {
65
62
  "type": "universal-banner",
66
- "after": "categories"
63
+ "after": "hero"
67
64
  },
68
65
  {
69
66
  "type": "products",
70
67
  "variant": "ProductSlider",
71
- "after": "categories"
68
+ "after": "hero"
72
69
  },
73
70
  {
74
71
  "type": "products",
75
72
  "variant": "ProductSlider",
76
- "after": "categories"
73
+ "after": "hero"
77
74
  },
78
75
  {
79
- "type": "cta",
80
- "after": "benefits"
76
+ "type": "products",
77
+ "variant": "ProductGrid",
78
+ "after": "hero"
79
+ },
80
+ {
81
+ "type": "products",
82
+ "variant": "ProductShowcase1",
83
+ "after": "hero"
81
84
  }
82
85
  ],
83
- "maxSections": 5
86
+ "maxSections": 6
84
87
  },
85
88
  {
86
89
  "name": "product",
@@ -1,5 +1,5 @@
1
1
  // Optional section fragment: universal-main-menu (mirrors recipes/sections.json) — shared contract.
2
- // Zod mirror of the UniversalMainMenu block contract (delivery universal-main-menu, contract version 4.3.2),
2
+ // Zod mirror of the UniversalMainMenu block contract (delivery universal-main-menu, contract version 4.6.1),
3
3
  // shared by the server catalog (universal-main-menu.tsx) and the client registry (universal-main-menu.client.tsx).
4
4
  // The React-only callbacks (onNavigate, onOpenChange) are intentionally excluded.
5
5
 
@@ -79,6 +79,8 @@ export const universalMainMenuDataSchema = z.object({
79
79
  }),
80
80
  behavior: z.object({
81
81
  platform: z.string().optional(),
82
+ anchor: z.string().optional(),
83
+ trigger: z.string().optional(),
82
84
  mobilePattern: z.string().optional(),
83
85
  openOnHover: z.boolean().optional(),
84
86
  openDelayMs: z.number().optional(),
@@ -861,6 +861,10 @@ export function validateComposition(composition) {
861
861
  const optionalSections = Array.isArray(recipe.optionalSections) ? recipe.optionalSections : []
862
862
  const allowedSections = Array.isArray(recipe.allowedSections) ? recipe.allowedSections : []
863
863
  const registeredSlots = Array.isArray(recipe.registeredSlots) ? recipe.registeredSlots : []
864
+ // A retired slot (for example `categories` on home) may still appear in a
865
+ // manifest written against an earlier registry version: it is dropped by the
866
+ // normalizer, so validating it here must not refuse the whole manifest.
867
+ const retiredSlots = Array.isArray(recipe.retiredSlots) ? recipe.retiredSlots : []
864
868
  const maxSections = typeof recipe.maxSections === 'number' ? recipe.maxSections : null
865
869
  const seenSectionIds = new Set()
866
870
  let editorialCount = 0
@@ -883,6 +887,9 @@ export function validateComposition(composition) {
883
887
  errors.push(
884
888
  `Reserved slot id "${section.id}" in view "${viewName}" must equal "slot:${section.type}".`
885
889
  )
890
+ } else if (!registeredSlots.includes(section.type) && retiredSlots.includes(section.type)) {
891
+ // Retired slot: tolerated here and dropped by the composition
892
+ // normalizer, so it never renders and never blocks a sync.
886
893
  } else if (!registeredSlots.includes(section.type)) {
887
894
  errors.push(
888
895
  `Slot "${section.type}" is not a registered slot of view "${viewName}".`
@@ -1,5 +0,0 @@
1
- {
2
- "module": "@thorprovider/blocks/blocks/e-commerce/product-categories/product-category-grid",
3
- "import": "CategoryGrid",
4
- "as": "CategoryGridBlock"
5
- }
@@ -1,8 +0,0 @@
1
- CategoryGrid: {
2
- props: categoryGridPropsSchema,
3
- description: 'Category listing that renders category cells.',
4
- },
5
- CategoryCard: {
6
- props: categoryCardPropsSchema,
7
- description: 'One category cell, without listing section chrome.',
8
- },
@@ -1,5 +0,0 @@
1
- 'home.categories': {
2
- type: 'CategoryGrid',
3
- props: categoriesProps,
4
- on: { openCategory: { action: 'openCategory' } },
5
- },
@@ -1,31 +0,0 @@
1
- CategoryCard: ({ props, emit }) => {
2
- const { set } = useStateStore()
3
- const card = categoryCardPropsSchema.parse(props)
4
- return (
5
- <CategoryCardBlock
6
- {...card}
7
- onBrowse={(category) => {
8
- set('/lastCategory', category.handle ?? String(category.id))
9
- emit('openCategory')
10
- }}
11
- />
12
- )
13
- },
14
- CategoryGrid: ({ props, emit }) => {
15
- const { set } = useStateStore()
16
- const grid = categoryGridPropsSchema.parse(props)
17
- return (
18
- <CategoryGridBlock
19
- {...grid}
20
- onBrowse={(category) => {
21
- set('/lastCategory', category.handle ?? String(category.id))
22
- emit('openCategory')
23
- }}
24
- onViewAll={() => {
25
- set('/lastCategory', '/categories')
26
- emit('openCategory')
27
- }}
28
- onQueryChange={(query) => set('/categoryQuery', query)}
29
- />
30
- )
31
- },