@thorprovider/storefront 0.4.0-mvp.0 → 0.4.0

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 (225) hide show
  1. package/README.md +174 -156
  2. package/VENDOR.md +69 -0
  3. package/assets/openspec/config.yaml +38 -0
  4. package/assets/templates/AGENTS.md +76 -0
  5. package/assets/templates/app/app/[[...slug]]/page.tsx +56 -2
  6. package/assets/templates/app/app/[[...slug]]/renderer.tsx +44 -2
  7. package/assets/templates/app/app/globals.css +5 -8
  8. package/assets/templates/app/app/layout.tsx +1 -5
  9. package/assets/templates/app/app/robots.ts +9 -3
  10. package/assets/templates/app/app/sitemap.ts +64 -5
  11. package/assets/templates/app/lib/__STOREFRONT__/account-boundary.client.tsx +76 -0
  12. package/assets/templates/app/lib/__STOREFRONT__/account-lifecycle.client.tsx +461 -0
  13. package/assets/templates/app/lib/__STOREFRONT__/account-mutation.client.ts +46 -0
  14. package/assets/templates/app/lib/__STOREFRONT__/account-private.core.ts +103 -0
  15. package/assets/templates/app/lib/__STOREFRONT__/account-reconcile.client.ts +465 -0
  16. package/assets/templates/app/lib/__STOREFRONT__/account-session.core.ts +177 -0
  17. package/assets/templates/app/lib/__STOREFRONT__/account-session.ts +44 -0
  18. package/assets/templates/app/lib/__STOREFRONT__/account-user.core.ts +65 -0
  19. package/assets/templates/app/lib/__STOREFRONT__/actions.ts +135 -16
  20. package/assets/templates/app/lib/__STOREFRONT__/catalog.ts +19 -9
  21. package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +61 -0
  22. package/assets/templates/app/lib/__STOREFRONT__/composition.ts +26 -0
  23. package/assets/templates/app/lib/__STOREFRONT__/handlers.core.ts +36 -4
  24. package/assets/templates/app/lib/__STOREFRONT__/mappers.ts +17 -18
  25. package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.client.tsx +209 -0
  26. package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.ts +247 -0
  27. package/assets/templates/app/lib/__STOREFRONT__/registry.tsx +123 -62
  28. package/assets/templates/app/lib/__STOREFRONT__/runtime.ts +3 -0
  29. package/assets/templates/app/lib/__STOREFRONT__/schema.ts +78 -25
  30. package/assets/templates/app/lib/__STOREFRONT__/section-observation.ts +182 -0
  31. package/assets/templates/app/lib/__STOREFRONT__/section-sources.ts +128 -0
  32. package/assets/templates/app/lib/__STOREFRONT__/shell/content.ts +31 -7
  33. package/assets/templates/app/lib/__STOREFRONT__/shell/props.ts +4 -0
  34. package/assets/templates/app/lib/__STOREFRONT__/spec/index.ts +81 -26
  35. package/assets/templates/app/lib/__STOREFRONT__/spec/seo.ts +165 -0
  36. package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +4 -2
  37. package/assets/templates/app/lib/__STOREFRONT__/store-context.ts +26 -7
  38. package/assets/templates/app/lib/__STOREFRONT__/views/sections/cta.client.tsx +1 -1
  39. package/assets/templates/app/lib/__STOREFRONT__/views/sections/faq.client.tsx +1 -1
  40. package/assets/templates/app/lib/__STOREFRONT__/views/sections/index.ts +2 -1
  41. package/assets/templates/app/lib/__STOREFRONT__/views/sections/logoCloud.tsx +1 -1
  42. package/assets/templates/app/lib/__STOREFRONT__/views/sections/pricing.tsx +1 -1
  43. package/assets/templates/app/lib/__STOREFRONT__/views/sections/products.client.tsx +100 -0
  44. package/assets/templates/app/lib/__STOREFRONT__/views/sections/products.tsx +19 -0
  45. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.products.ts +39 -0
  46. package/assets/templates/app/lib/__STOREFRONT__/views/sections/statistics.tsx +1 -1
  47. package/assets/templates/app/lib/__STOREFRONT__/views/sections/testimonials.tsx +1 -1
  48. package/assets/templates/features/checkout/handlers.ts +6 -0
  49. package/assets/templates/features/customer-auth/handlers.ts +19 -23
  50. package/assets/templates/features/customer-auth/state.ts +31 -1
  51. package/assets/templates/views/account/index.tsx +20 -8
  52. package/assets/templates/views/account/registry.tsx +294 -154
  53. package/assets/templates/views/account/schema.ts +1 -0
  54. package/assets/templates/views/cart/content.ts +11 -0
  55. package/assets/templates/views/cart/data.ts +23 -0
  56. package/assets/templates/views/cart/index.tsx +53 -0
  57. package/assets/templates/views/cart/props.ts +12 -0
  58. package/assets/templates/views/cart/registry.tsx +82 -0
  59. package/assets/templates/views/cart/schema.ts +52 -0
  60. package/assets/templates/views/category/assembly/assembly.json +2 -1
  61. package/assets/templates/views/category/assembly/index.skeleton.tsx +64 -6
  62. package/assets/templates/views/category/assembly/registry.skeleton.tsx +7 -6
  63. package/assets/templates/views/category/assembly/slots/breadcrumb/Breadcrumb/binding.json +5 -0
  64. package/assets/templates/views/category/assembly/slots/breadcrumb/Breadcrumb/catalog.part +4 -0
  65. package/assets/templates/views/category/assembly/slots/breadcrumb/Breadcrumb/element.part +7 -0
  66. package/assets/templates/views/category/assembly/slots/breadcrumb/Breadcrumb/registry.part +18 -0
  67. package/assets/templates/views/category/index.tsx +76 -7
  68. package/assets/templates/views/category/props.ts +7 -0
  69. package/assets/templates/views/category/registry.tsx +25 -6
  70. package/assets/templates/views/category/schema.ts +13 -0
  71. package/assets/templates/views/checkout/registry.tsx +3 -5
  72. package/assets/templates/views/home/assembly/assembly.json +12 -3
  73. package/assets/templates/views/home/assembly/index.skeleton.tsx +24 -5
  74. package/assets/templates/views/home/assembly/registry.skeleton.tsx +4 -1
  75. package/assets/templates/views/home/assembly/slots/benefits/cards/binding.json +5 -0
  76. package/assets/templates/views/home/assembly/slots/benefits/cards/registry.part +17 -0
  77. package/assets/templates/views/home/assembly/slots/benefits/split/binding.json +5 -0
  78. package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → split}/registry.part +6 -2
  79. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/binding.json +5 -0
  80. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/catalog.part +8 -0
  81. package/assets/templates/views/home/assembly/slots/categories/{ProductCategory2 → CategoryGrid}/element.part +1 -1
  82. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/registry.part +31 -0
  83. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/binding.json +5 -0
  84. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/catalog.part +4 -0
  85. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/element.part +5 -0
  86. package/assets/templates/views/home/assembly/slots/hero/{StorefrontHero1 → StorefrontHero}/registry.part +5 -3
  87. package/assets/templates/views/home/content.ts +22 -0
  88. package/assets/templates/views/home/data.ts +9 -0
  89. package/assets/templates/views/home/index.tsx +34 -11
  90. package/assets/templates/views/home/props.ts +1 -0
  91. package/assets/templates/views/home/registry.tsx +41 -17
  92. package/assets/templates/views/home/schema.ts +141 -24
  93. package/assets/templates/views/product/data.ts +5 -3
  94. package/assets/templates/views/product/index.tsx +49 -5
  95. package/assets/templates/views/product/props.ts +7 -0
  96. package/assets/templates/views/product/registry.tsx +34 -5
  97. package/assets/templates/views/product/schema.ts +49 -1
  98. package/assets/templates/views/static/content.ts +4 -4
  99. package/assets/templates/views/static/index.tsx +1 -1
  100. package/bin/storefront.js +1231 -154
  101. package/examples/merchandising/category-led.json +37 -0
  102. package/examples/merchandising/collection-led.json +37 -0
  103. package/package.json +10 -7
  104. package/recipes/archetypes.json +33 -46
  105. package/recipes/catalog.json +245 -153
  106. package/recipes/catalog.mjs +10 -0
  107. package/recipes/catalog.schema.json +4 -0
  108. package/recipes/features.json +28 -5
  109. package/recipes/recipe.schema.json +1 -1
  110. package/recipes/recipes.json +159 -59
  111. package/recipes/sections.json +10 -0
  112. package/recipes/validate.mjs +75 -4
  113. package/scripts/candidate.mjs +4 -4
  114. package/scripts/composers.mjs +25 -5
  115. package/scripts/env-file.mjs +86 -0
  116. package/scripts/file-classes.mjs +15 -0
  117. package/scripts/migrate-english-routes.mjs +276 -0
  118. package/scripts/ownership-conflict.mjs +5 -2
  119. package/scripts/pinning.mjs +74 -5
  120. package/scripts/plan-apply.mjs +149 -5
  121. package/scripts/reconcile.mjs +49 -11
  122. package/scripts/render-templates.mjs +97 -44
  123. package/scripts/section-config.mjs +253 -0
  124. package/scripts/starter.mjs +17 -0
  125. package/scripts/theme/color.mjs +185 -0
  126. package/scripts/theme/css-theme.mjs +233 -0
  127. package/scripts/theme/fonts.mjs +123 -0
  128. package/scripts/theme/import-export.mjs +125 -0
  129. package/scripts/theme/preset.mjs +93 -0
  130. package/scripts/theme/theme-plan.mjs +292 -0
  131. package/scripts/theme/tokens.mjs +137 -0
  132. package/scripts/view-assembly.mjs +57 -3
  133. package/scripts/view-selection.mjs +1 -1
  134. package/skills/sf-feature/SKILL.md +32 -19
  135. package/skills/sf-setup/SKILL.md +79 -0
  136. package/skills/sf-theme-gen/SKILL.md +99 -36
  137. package/skills/sf-theme-gen/references/shadcn-theming.md +87 -0
  138. package/skills/{shadcn-theming/references/templates → sf-theme-gen/references}/theme-setup.md +15 -19
  139. package/skills/{shadcn-theming → sf-theme-gen}/references/theming-guide.md +6 -11
  140. package/skills/sf-view-gen/SKILL.md +63 -40
  141. package/skills/sf-view-gen/assets/recipes/archetypes.json +33 -46
  142. package/skills/sf-view-gen/assets/recipes/catalog.json +245 -153
  143. package/skills/sf-view-gen/assets/recipes/catalog.schema.json +4 -0
  144. package/skills/sf-view-gen/assets/recipes/features.json +28 -5
  145. package/skills/sf-view-gen/assets/recipes/recipes.json +159 -59
  146. package/skills/sf-view-gen/assets/recipes/sections.json +10 -0
  147. package/skills/sf-view-gen/assets/templates/views/sections/cta.client.tsx +1 -1
  148. package/skills/sf-view-gen/assets/templates/views/sections/faq.client.tsx +1 -1
  149. package/skills/sf-view-gen/assets/templates/views/sections/logoCloud.client.tsx +1 -1
  150. package/skills/sf-view-gen/assets/templates/views/sections/pricing.client.tsx +1 -1
  151. package/skills/sf-view-gen/assets/templates/views/sections/products.client.tsx +100 -0
  152. package/skills/sf-view-gen/assets/templates/views/sections/products.tsx +19 -0
  153. package/skills/sf-view-gen/assets/templates/views/sections/schema.products.ts +39 -0
  154. package/skills/sf-view-gen/assets/templates/views/sections/statistics.client.tsx +1 -1
  155. package/skills/sf-view-gen/assets/templates/views/sections/testimonials.client.tsx +1 -1
  156. package/skills/{json-render-core/SKILL.md → sf-view-gen/references/json-render-core.md} +4 -27
  157. package/skills/{json-render-next/SKILL.md → sf-view-gen/references/json-render-next.md} +5 -8
  158. package/skills/{json-render-react/SKILL.md → sf-view-gen/references/json-render-react.md} +3 -5
  159. package/skills/{json-render-shadcn/SKILL.md → sf-view-gen/references/json-render-shadcn.md} +3 -5
  160. package/skills/sf-view-gen/references/views.md +28 -37
  161. package/skills/sf-view-gen/scripts/catalog.mjs +10 -0
  162. package/skills/sf-view-gen/scripts/validate.mjs +75 -4
  163. package/skills/storefront-workflow/SKILL.md +94 -31
  164. package/skills/{storefront-best-practices/reference/design.md → storefront-workflow/references/design-consistency.md} +13 -29
  165. package/CHANGELOG.md +0 -84
  166. package/assets/templates/views/home/assembly/slots/benefits/Feature1/binding.json +0 -5
  167. package/assets/templates/views/home/assembly/slots/benefits/Feature2/binding.json +0 -5
  168. package/assets/templates/views/home/assembly/slots/benefits/Feature2/registry.part +0 -10
  169. package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/binding.json +0 -5
  170. package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/catalog.part +0 -4
  171. package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/registry.part +0 -16
  172. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/binding.json +0 -5
  173. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/catalog.part +0 -4
  174. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/element.part +0 -5
  175. package/assets/templates/views/user-panel/index.tsx +0 -106
  176. package/assets/templates/views/user-panel/registry.tsx +0 -54
  177. package/assets/templates/views/user-panel/schema.ts +0 -79
  178. package/commands/sf-add-view.md +0 -57
  179. package/commands/sf-feature.md +0 -28
  180. package/commands/sf-theme.md +0 -26
  181. package/commands/sf-view.md +0 -67
  182. package/skills/building-storefronts/SKILL.md +0 -178
  183. package/skills/building-storefronts/references/frontend-integration.md +0 -229
  184. package/skills/json-render-remotion/SKILL.md +0 -111
  185. package/skills/json-render-solid/SKILL.md +0 -204
  186. package/skills/nextjs-shadcn/SKILL.md +0 -367
  187. package/skills/nextjs-shadcn/references/architecture.md +0 -499
  188. package/skills/nextjs-shadcn/references/project-setup.md +0 -162
  189. package/skills/nextjs-shadcn/references/shadcn-platform.md +0 -261
  190. package/skills/nextjs-shadcn/references/sidebar.md +0 -274
  191. package/skills/nextjs-shadcn/references/styling.md +0 -555
  192. package/skills/shadcn-component-discovery/SKILL.md +0 -273
  193. package/skills/shadcn-component-discovery/references/registries.md +0 -226
  194. package/skills/shadcn-theming/SKILL.md +0 -104
  195. package/skills/storefront-best-practices/SKILL.md +0 -421
  196. package/skills/storefront-best-practices/reference/components/breadcrumbs.md +0 -123
  197. package/skills/storefront-best-practices/reference/components/cart-popup.md +0 -189
  198. package/skills/storefront-best-practices/reference/components/country-selector.md +0 -298
  199. package/skills/storefront-best-practices/reference/components/footer.md +0 -112
  200. package/skills/storefront-best-practices/reference/components/hero.md +0 -241
  201. package/skills/storefront-best-practices/reference/components/megamenu.md +0 -239
  202. package/skills/storefront-best-practices/reference/components/navbar.md +0 -397
  203. package/skills/storefront-best-practices/reference/components/popups.md +0 -221
  204. package/skills/storefront-best-practices/reference/components/product-card.md +0 -125
  205. package/skills/storefront-best-practices/reference/components/product-reviews.md +0 -217
  206. package/skills/storefront-best-practices/reference/components/product-slider.md +0 -174
  207. package/skills/storefront-best-practices/reference/components/search.md +0 -101
  208. package/skills/storefront-best-practices/reference/connecting-to-backend.md +0 -391
  209. package/skills/storefront-best-practices/reference/features/promotions.md +0 -307
  210. package/skills/storefront-best-practices/reference/features/wishlist.md +0 -230
  211. package/skills/storefront-best-practices/reference/layouts/account.md +0 -380
  212. package/skills/storefront-best-practices/reference/layouts/cart.md +0 -316
  213. package/skills/storefront-best-practices/reference/layouts/checkout.md +0 -486
  214. package/skills/storefront-best-practices/reference/layouts/home-page.md +0 -264
  215. package/skills/storefront-best-practices/reference/layouts/order-confirmation.md +0 -231
  216. package/skills/storefront-best-practices/reference/layouts/product-details.md +0 -527
  217. package/skills/storefront-best-practices/reference/layouts/product-listing.md +0 -520
  218. package/skills/storefront-best-practices/reference/layouts/static-pages.md +0 -356
  219. package/skills/storefront-best-practices/reference/medusa.md +0 -307
  220. /package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/catalog.part +0 -0
  221. /package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/element.part +0 -0
  222. /package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/catalog.part +0 -0
  223. /package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/element.part +0 -0
  224. /package/skills/{storefront-best-practices/reference → storefront-workflow/references}/mobile-responsiveness.md +0 -0
  225. /package/skills/{storefront-best-practices/reference → storefront-workflow/references}/seo.md +0 -0
@@ -30,7 +30,7 @@
30
30
  "name": "customer-auth",
31
31
  "mvp": true,
32
32
  "description": "Customer authentication: registration, login, logout, and a minimal signed-in state. Owns the account view.",
33
- "route": "/cuenta",
33
+ "route": "/account",
34
34
  "views": ["account"],
35
35
  "state": [
36
36
  "accountCustomer",
@@ -48,7 +48,7 @@
48
48
  "name": "static-pages",
49
49
  "mvp": true,
50
50
  "description": "Content-driven static pages (contact, legal, about) served with per-page metadata. Owns the static view.",
51
- "route": "/contacto",
51
+ "route": "/contact",
52
52
  "views": ["static"],
53
53
  "state": [],
54
54
  "handlers": [],
@@ -59,7 +59,7 @@
59
59
  {
60
60
  "name": "benefits",
61
61
  "mvp": true,
62
- "description": "Bounded editorial benefits feature that mounts at the home benefits slot; config selects the Feature1/Feature2 presentation while the item content stays user-owned.",
62
+ "description": "Bounded editorial benefits feature that mounts at the home benefits slot; config selects the canonical Feature block's presentation (compact -> cards, detailed -> split) while the item content stays user-owned.",
63
63
  "views": [],
64
64
  "state": [],
65
65
  "handlers": [],
@@ -71,7 +71,7 @@
71
71
  "presentation": { "type": "string", "enum": ["compact", "detailed"], "default": "compact" }
72
72
  }
73
73
  },
74
- "presentations": { "compact": "Feature1", "detailed": "Feature2" },
74
+ "presentations": { "compact": "cards", "detailed": "split" },
75
75
  "mounts": [{ "id": "home-benefits", "host": "home", "slot": "benefits" }],
76
76
  "surfaces": []
77
77
  },
@@ -122,6 +122,29 @@
122
122
  "mounts": [{ "id": "category-filters", "host": "category", "slot": "filters" }],
123
123
  "surfaces": []
124
124
  },
125
+ {
126
+ "name": "navigability",
127
+ "mvp": true,
128
+ "description": "Cross-cutting navigability feature: entity-derived breadcrumbs with BreadcrumbList structured data on the product and category surfaces, plus skip-to-content, current-page indication, back-to-top, and a mobile bottom navigation in the shared shell.",
129
+ "views": [],
130
+ "state": [],
131
+ "handlers": [],
132
+ "adapter": { "needs": [] },
133
+ "config": {
134
+ "type": "object",
135
+ "additionalProperties": false,
136
+ "properties": {
137
+ "presentation": { "type": "string", "enum": ["default"], "default": "default" },
138
+ "showBackToTop": { "type": "boolean", "default": true }
139
+ }
140
+ },
141
+ "presentations": { "default": "Breadcrumb" },
142
+ "mounts": [
143
+ { "id": "category-breadcrumb", "host": "category", "slot": "breadcrumb" },
144
+ { "id": "product-breadcrumb", "host": "product", "slot": "breadcrumb" }
145
+ ],
146
+ "surfaces": []
147
+ },
125
148
  {
126
149
  "name": "recommendations",
127
150
  "mvp": false,
@@ -132,7 +155,7 @@
132
155
  "adapter": { "needs": ["getRelatedProducts"], "fallback": "catalog" },
133
156
  "config": { "type": "object", "additionalProperties": false, "properties": {} },
134
157
  "surfaces": [
135
- { "host": "product", "slot": "product.related", "element": "ProductCard" }
158
+ { "host": "product", "slot": "product.related", "element": "ProductGrid" }
136
159
  ]
137
160
  }
138
161
  ]
@@ -23,7 +23,7 @@
23
23
  "properties": {
24
24
  "name": {
25
25
  "type": "string",
26
- "enum": ["home", "product", "category", "checkout", "account", "static", "user-panel"]
26
+ "enum": ["home", "product", "cart", "category", "checkout", "account", "static"]
27
27
  },
28
28
  "description": { "type": "string" },
29
29
  "route": { "type": "string" },
@@ -8,62 +8,156 @@
8
8
  "description": "Storefront landing page with hero, benefits, and category highlights",
9
9
  "route": "/",
10
10
  "loader": "home",
11
- "requiredDataKeys": ["heroProducts", "categories"],
11
+ "requiredDataKeys": [
12
+ "heroProducts",
13
+ "categories"
14
+ ],
12
15
  "defaultVariants": {
13
- "hero": "StorefrontHero1",
14
- "benefits": "Feature1",
15
- "categories": "ProductCategory2"
16
+ "hero": "StorefrontHero",
17
+ "benefits": "cards",
18
+ "categories": "CategoryGrid"
16
19
  },
17
20
  "allowedVariants": {
18
- "hero": ["StorefrontHero1", "StorefrontHero2", "StorefrontHero5", "StorefrontHero6"],
19
- "benefits": ["Feature1", "Feature2"],
20
- "categories": ["ProductCategory1", "ProductCategory2", "ProductCategory4", "ProductCategory5"],
21
- "productCard": ["ProductCard1", "ProductCard2", "ProductCard3", "ProductCard5"]
21
+ "hero": [
22
+ "StorefrontHero"
23
+ ],
24
+ "benefits": [
25
+ "cards",
26
+ "split"
27
+ ],
28
+ "categories": [
29
+ "CategoryGrid"
30
+ ],
31
+ "productCard": [
32
+ "ProductGrid"
33
+ ]
22
34
  },
23
- "optionalSections": ["testimonials", "faq", "statistics", "logoCloud", "pricing"],
24
- "registeredSlots": ["hero", "benefits", "categories"],
25
- "allowedSections": ["faq", "cta"],
35
+ "optionalSections": [
36
+ "testimonials",
37
+ "faq",
38
+ "statistics",
39
+ "logoCloud",
40
+ "pricing"
41
+ ],
42
+ "registeredSlots": [
43
+ "hero",
44
+ "benefits",
45
+ "categories"
46
+ ],
47
+ "allowedSections": [
48
+ "faq",
49
+ "cta",
50
+ "products"
51
+ ],
26
52
  "maxSections": 4
27
53
  },
28
54
  {
29
55
  "name": "product",
30
56
  "mvp": true,
31
57
  "description": "Single product detail page with overview, gallery, and reviews",
32
- "route": "/productos/[id]",
58
+ "route": "/products/[id]",
33
59
  "loader": "product",
34
- "requiredDataKeys": ["selectedProduct"],
60
+ "requiredDataKeys": [
61
+ "selectedProduct"
62
+ ],
35
63
  "defaultVariants": {
36
- "overview": "ProductOverview1",
37
- "reviews": "ReviewRating1"
64
+ "overview": "ProductOverview",
65
+ "reviews": "ReviewRating1",
66
+ "breadcrumb": "Breadcrumb"
38
67
  },
39
68
  "allowedVariants": {
40
- "overview": ["ProductOverview1", "ProductOverview2", "ProductOverview5"],
41
- "reviews": ["ReviewRating1", "ReviewRating2"],
42
- "productCard": ["ProductCard1", "ProductCard2", "ProductCard3", "ProductCard5"]
69
+ "overview": [
70
+ "ProductOverview"
71
+ ],
72
+ "reviews": [
73
+ "ReviewRating1",
74
+ "ReviewRating2"
75
+ ],
76
+ "breadcrumb": [
77
+ "Breadcrumb"
78
+ ],
79
+ "productCard": [
80
+ "ProductGrid"
81
+ ]
43
82
  },
44
- "optionalSections": ["testimonials", "faq", "statistics"],
45
- "registeredSlots": ["overview", "reviews"],
83
+ "optionalSections": [
84
+ "testimonials",
85
+ "faq",
86
+ "statistics"
87
+ ],
88
+ "registeredSlots": [
89
+ "overview",
90
+ "reviews",
91
+ "breadcrumb"
92
+ ],
46
93
  "allowedSections": [],
47
94
  "maxSections": 4
48
95
  },
96
+ {
97
+ "name": "cart",
98
+ "mvp": true,
99
+ "description": "Standalone cart review page with authoritative totals and quantity editing",
100
+ "route": "/cart",
101
+ "loader": "cart",
102
+ "requiredDataKeys": [
103
+ "cart"
104
+ ],
105
+ "defaultVariants": {
106
+ "view": "ShoppingCart"
107
+ },
108
+ "allowedVariants": {
109
+ "view": [
110
+ "ShoppingCart"
111
+ ]
112
+ },
113
+ "optionalSections": [],
114
+ "registeredSlots": [
115
+ "view"
116
+ ],
117
+ "allowedSections": [],
118
+ "maxSections": 0
119
+ },
49
120
  {
50
121
  "name": "category",
51
122
  "mvp": true,
52
123
  "description": "Product listing filtered by category with filters and sorting",
53
- "route": "/categorias/[[...slug]]",
124
+ "route": "/categories/[[...slug]]",
54
125
  "loader": "category",
55
- "requiredDataKeys": ["categoryProducts", "storeCategories"],
126
+ "requiredDataKeys": [
127
+ "categoryProducts",
128
+ "storeCategories"
129
+ ],
56
130
  "defaultVariants": {
57
131
  "filter": "CategoryFilter2",
58
- "productCard": "ProductCard1"
132
+ "productCard": "ProductGrid",
133
+ "breadcrumb": "Breadcrumb"
59
134
  },
60
135
  "allowedVariants": {
61
- "filter": ["CategoryFilter1", "CategoryFilter2", "CategoryFilter4"],
62
- "productCard": ["ProductCard1", "ProductCard2", "ProductCard3", "ProductCard5"]
136
+ "filter": [
137
+ "CategoryFilter1",
138
+ "CategoryFilter2",
139
+ "CategoryFilter4"
140
+ ],
141
+ "productCard": [
142
+ "ProductGrid"
143
+ ],
144
+ "breadcrumb": [
145
+ "Breadcrumb"
146
+ ]
63
147
  },
64
- "optionalSections": ["logoCloud", "testimonials"],
65
- "registeredSlots": ["filter", "productCard"],
66
- "allowedSections": ["faq", "cta"],
148
+ "optionalSections": [
149
+ "logoCloud",
150
+ "testimonials"
151
+ ],
152
+ "registeredSlots": [
153
+ "breadcrumb",
154
+ "filter",
155
+ "productCard"
156
+ ],
157
+ "allowedSections": [
158
+ "faq",
159
+ "cta"
160
+ ],
67
161
  "maxSections": 4
68
162
  },
69
163
  {
@@ -72,17 +166,29 @@
72
166
  "description": "Multi-step checkout with cart summary, shipping, and payment",
73
167
  "route": "/checkout",
74
168
  "loader": "checkout",
75
- "requiredDataKeys": ["checkoutCountries", "checkoutPaymentMethods"],
169
+ "requiredDataKeys": [
170
+ "checkoutCountries",
171
+ "checkoutPaymentMethods"
172
+ ],
76
173
  "defaultVariants": {
77
174
  "checkout": "CheckoutForm1",
78
175
  "confirmation": "CheckoutConfirmation"
79
176
  },
80
177
  "allowedVariants": {
81
- "checkout": ["CheckoutForm1", "CheckoutForm2", "CheckoutForm3"],
82
- "confirmation": ["CheckoutConfirmation"]
178
+ "checkout": [
179
+ "CheckoutForm1",
180
+ "CheckoutForm2",
181
+ "CheckoutForm3"
182
+ ],
183
+ "confirmation": [
184
+ "CheckoutConfirmation"
185
+ ]
83
186
  },
84
187
  "optionalSections": [],
85
- "registeredSlots": ["checkout", "confirmation"],
188
+ "registeredSlots": [
189
+ "checkout",
190
+ "confirmation"
191
+ ],
86
192
  "allowedSections": [],
87
193
  "maxSections": 4
88
194
  },
@@ -90,20 +196,34 @@
90
196
  "name": "account",
91
197
  "mvp": true,
92
198
  "description": "Customer account area with sign-in, registration, and a minimal signed-in state",
93
- "route": "/cuenta",
199
+ "route": "/account",
94
200
  "loader": "account",
95
- "requiredDataKeys": ["accountCustomer"],
201
+ "requiredDataKeys": [
202
+ "accountCustomer"
203
+ ],
96
204
  "defaultVariants": {
97
205
  "login": "LoginPage1",
98
206
  "register": "SignUpPage1"
99
207
  },
100
208
  "allowedVariants": {
101
- "login": ["LoginPage1", "LoginPage2"],
102
- "register": ["SignUpPage1"],
103
- "orders": ["OrderHistory1", "OrderHistory2"]
209
+ "login": [
210
+ "LoginPage1",
211
+ "LoginPage2"
212
+ ],
213
+ "register": [
214
+ "SignUpPage1"
215
+ ],
216
+ "orders": [
217
+ "OrderHistory1",
218
+ "OrderHistory2"
219
+ ]
104
220
  },
105
221
  "optionalSections": [],
106
- "registeredSlots": ["login", "register", "orders"],
222
+ "registeredSlots": [
223
+ "login",
224
+ "register",
225
+ "orders"
226
+ ],
107
227
  "allowedSections": [],
108
228
  "maxSections": 4
109
229
  },
@@ -111,7 +231,7 @@
111
231
  "name": "static",
112
232
  "mvp": true,
113
233
  "description": "Content-driven static pages (contact, legal, about) with per-page metadata",
114
- "route": "/contacto",
234
+ "route": "/contact",
115
235
  "loader": "static",
116
236
  "requiredDataKeys": [],
117
237
  "defaultVariants": {},
@@ -120,26 +240,6 @@
120
240
  "registeredSlots": [],
121
241
  "allowedSections": [],
122
242
  "maxSections": 0
123
- },
124
- {
125
- "name": "user-panel",
126
- "mvp": false,
127
- "description": "Customer account area with order history and account navigation",
128
- "route": "/cuenta",
129
- "loader": "userPanel",
130
- "requiredDataKeys": ["lastOrder", "lastOrderLines", "orderPlaced"],
131
- "defaultVariants": {
132
- "shell": "AppShell1",
133
- "orderHistory": "OrderHistory1"
134
- },
135
- "allowedVariants": {
136
- "shell": ["AppShell1"],
137
- "orderHistory": ["OrderHistory1", "OrderHistory2"]
138
- },
139
- "optionalSections": [],
140
- "registeredSlots": ["shell", "orderHistory"],
141
- "allowedSections": [],
142
- "maxSections": 4
143
243
  }
144
244
  ]
145
245
  }
@@ -31,6 +31,16 @@
31
31
  "propsHint": "badgeText, title, description, primaryCta/secondaryCta (label, href)",
32
32
  "status": "executable"
33
33
  },
34
+ {
35
+ "name": "products",
36
+ "description": "Data-bound product presentation (grid or combined grid-and-carousel) whose selection is configured independently per instance",
37
+ "elementType": "Products",
38
+ "variants": ["ProductGrid", "ProductShowcase1"],
39
+ "defaultVariant": "ProductGrid",
40
+ "dataBound": true,
41
+ "propsHint": "per-instance selection configured in views/<view>/data.ts sectionSources[id] (canonical category/collection/search/ordering query); heading, description, objective, ctaLabel/ctaHref are editorial content",
42
+ "status": "executable"
43
+ },
34
44
  {
35
45
  "name": "statistics",
36
46
  "description": "Key metrics or trust statistics",
@@ -455,6 +455,27 @@ export function sectionRegistry() {
455
455
  }))
456
456
  }
457
457
 
458
+ /**
459
+ * The full registry entry for a section type, or null when it is not
460
+ * registered. Unlike `sectionRegistry()` (the projected introspection view),
461
+ * this exposes every declared field — including `dataBound` and `variants` —
462
+ * so the CLI can tell which instances need user-owned source configuration.
463
+ */
464
+ export function sectionDefinitionByName(name) {
465
+ const list = Array.isArray(sections.sections) ? sections.sections : []
466
+ return list.find((entry) => isPlainObject(entry) && entry.name === name) ?? null
467
+ }
468
+
469
+ /**
470
+ * Whether a section type resolves its content from a data source configured by
471
+ * the user (for example the `products` type) rather than from static editorial
472
+ * content. Unregistered types are not data-bound.
473
+ */
474
+ export function sectionIsDataBound(name) {
475
+ const section = sectionDefinitionByName(name)
476
+ return section?.status === 'executable' && section.dataBound === true
477
+ }
478
+
458
479
  export function getRecipe(name) {
459
480
  return recipes.views.find((v) => v.name === name) ?? null
460
481
  }
@@ -485,6 +506,39 @@ export function isCuratedFeature(name) {
485
506
  return getFeature(name)?.mvp === true
486
507
  }
487
508
 
509
+ /**
510
+ * The starter composition: every curated (installable) feature plus every
511
+ * curated view no installed curated feature owns. A feature-owned view (for
512
+ * example `checkout`, owned by the `checkout` feature) is installed through its
513
+ * feature, not listed directly. The set is derived from the registry's
514
+ * `mvp: true` declaration — never a hand-maintained list — so a curated unit
515
+ * added or removed flows automatically and a held unit (`recommendations`, a
516
+ * held section) is excluded by construction.
517
+ *
518
+ * `registries` is the injection seam for tests: pass fixture `{ views }` /
519
+ * `{ features }` sources to exercise the derivation without mutating the loaded
520
+ * registry.
521
+ */
522
+ export function starterComposition(registries = {}) {
523
+ const recipeSource = registries.recipes ?? recipes
524
+ const featureSource = registries.features ?? features
525
+ const featureNames = featureSource.features
526
+ .filter((f) => f.mvp === true)
527
+ .map((f) => f.name)
528
+ const ownedViews = new Set()
529
+ for (const name of featureNames) {
530
+ const feature = featureSource.features.find((f) => f.name === name)
531
+ for (const view of Array.isArray(feature?.views) ? feature.views : []) {
532
+ ownedViews.add(view)
533
+ }
534
+ }
535
+ const viewNames = recipeSource.views
536
+ .filter((v) => v.mvp === true)
537
+ .map((v) => v.name)
538
+ .filter((name) => !ownedViews.has(name))
539
+ return { views: viewNames, features: featureNames }
540
+ }
541
+
488
542
  /**
489
543
  * The catalog entry for one slot ("<view>.<slot>"), or null when the slot is
490
544
  * outside the catalog scope (a held, non-curated view). The catalog is the
@@ -496,15 +550,30 @@ export function getCatalogSlot(viewName, slot) {
496
550
  return hasOwn(slots, key) ? slots[key] : null
497
551
  }
498
552
 
553
+ /**
554
+ * The legacy alias target for a slot variant name, or the input unchanged when
555
+ * it is not an alias. The canonical selection surface is the catalog's variant
556
+ * set (the canonical block's presentations); retired numbered names survive
557
+ * only as slot-level `legacyAliases` and resolve here, at the single catalog
558
+ * authority, before any validation or fragment lookup.
559
+ */
560
+ export function resolveLegacyVariant(viewName, slot, variant) {
561
+ const slotEntry = getCatalogSlot(viewName, slot)
562
+ const aliases = isPlainObject(slotEntry?.legacyAliases) ? slotEntry.legacyAliases : {}
563
+ return hasOwn(aliases, variant) ? aliases[variant] : variant
564
+ }
565
+
499
566
  /**
500
567
  * The catalog entry for one variant of a slot, or null when the slot or the
501
568
  * variant is outside the catalog scope. Used to name a held variant's reason at
502
- * the point a selection is rejected (E1 task 1.4 / CU-07).
569
+ * the point a selection is rejected (E1 task 1.4 / CU-07). Legacy alias names
570
+ * resolve to their canonical variant's entry.
503
571
  */
504
572
  export function getCatalogVariant(viewName, slot, variant) {
505
573
  const slotEntry = getCatalogSlot(viewName, slot)
506
574
  const variants = isPlainObject(slotEntry?.variants) ? slotEntry.variants : {}
507
- return hasOwn(variants, variant) ? variants[variant] : null
575
+ const canonical = resolveLegacyVariant(viewName, slot, variant)
576
+ return hasOwn(variants, canonical) ? variants[canonical] : null
508
577
  }
509
578
 
510
579
  /**
@@ -576,7 +645,7 @@ export function supportedVariant(viewName, slot) {
576
645
  }
577
646
 
578
647
  export function isSupportedVariant(viewName, slot, variant) {
579
- return executableVariants(viewName, slot).includes(variant)
648
+ return executableVariants(viewName, slot).includes(resolveLegacyVariant(viewName, slot, variant))
580
649
  }
581
650
 
582
651
  /**
@@ -608,7 +677,9 @@ export function isAllowedVariant(viewName, slot, variant) {
608
677
  const allowedBySlot = isPlainObject(recipe.allowedVariants) ? recipe.allowedVariants : {}
609
678
  if (!hasOwn(allowedBySlot, slot)) return false
610
679
  const allowed = allowedBySlot[slot]
611
- return Array.isArray(allowed) && allowed.includes(variant)
680
+ return (
681
+ Array.isArray(allowed) && allowed.includes(resolveLegacyVariant(viewName, slot, variant))
682
+ )
612
683
  }
613
684
 
614
685
  export function isAllowedSection(viewName, sectionName) {
@@ -42,10 +42,10 @@ export const CANDIDATE_TOOLSET = Object.freeze({
42
42
  '@json-render/next': '0.21.0',
43
43
  }),
44
44
  local: Object.freeze({
45
- '@thorprovider/blocks': '0.1.1',
46
- '@thorprovider/adapters': '5.0.11',
47
- '@thorprovider/runtime': '0.1.2',
48
- '@thorprovider/types': '5.7.7',
45
+ '@thorprovider/blocks': '0.1.4',
46
+ '@thorprovider/adapters': '5.0.12',
47
+ '@thorprovider/runtime': '0.1.4',
48
+ '@thorprovider/types': '5.9.0',
49
49
  }),
50
50
  })
51
51
 
@@ -83,16 +83,27 @@ function isPlainObject(value) {
83
83
  * derived from the manifest — never hardcoded as always-mounted.
84
84
  *
85
85
  * `features` accepts bare names or `{ name, config }` entries (the fresh
86
- * scaffold and a later reconcile both pass manifest entries).
86
+ * scaffold and a later reconcile both pass manifest entries). `views` accepts
87
+ * bare view names or `{ name }` entries; it drives the typed route/action
88
+ * availability flags below so the generated host can suppress links to routes
89
+ * that are not installed (e.g. the cart review page or checkout).
87
90
  */
88
- export function buildCompositionComposer(features) {
91
+ export function buildCompositionComposer(features, views = []) {
89
92
  const entries = (Array.isArray(features) ? features : []).map((feature) =>
90
93
  typeof feature === 'string' ? { name: feature, config: {} } : feature,
91
94
  )
92
95
  const installed = new Set(entries.map((entry) => entry.name))
96
+ const viewNames = (Array.isArray(views) ? views : []).map((view) =>
97
+ typeof view === 'string' ? view : view.name,
98
+ )
99
+ const installedViews = new Set(viewNames)
100
+ const cartViewAvailable = installedViews.has('cart')
101
+ const checkoutAvailable = installed.has('checkout') || installedViews.has('checkout')
93
102
  const names = CATALOG_FEATURE_NAMES.filter((name) => installed.has(name))
94
103
  const list = names.map((name) => JSON.stringify(name)).join(', ')
95
- const configLines = names
104
+ const installedNames = [...installed].sort()
105
+ const featureNameList = installedNames.map((name) => JSON.stringify(name)).join(', ')
106
+ const configLines = installedNames
96
107
  .map((name) => {
97
108
  const entry = entries.find((candidate) => candidate.name === name)
98
109
  const config = entry && isPlainObject(entry.config) ? entry.config : {}
@@ -109,9 +120,18 @@ export function buildCompositionComposer(features) {
109
120
  `// visibility/config from the installed manifest only.\n\n` +
110
121
  `import type { CatalogFeatureName } from '@thorprovider/runtime/contracts'\n\n` +
111
122
  `export const mountedFeatures: readonly CatalogFeatureName[] = [${list}]\n\n` +
112
- `export const mountedFeatureConfigs: Partial<Record<CatalogFeatureName, Record<string, unknown>>> = {\n` +
123
+ `// Every installed feature name, unfiltered by the catalog URL boundary. The\n` +
124
+ `// general presence seam cross-cutting features read to gate their own\n` +
125
+ `// contributions (e.g. the navigability feature's shell chrome).\n` +
126
+ `export const mountedFeatureNames: readonly string[] = [${featureNameList}]\n\n` +
127
+ `export const mountedFeatureConfigs: Partial<Record<string, Record<string, unknown>>> = {\n` +
113
128
  `${configLines ? `${configLines}\n` : ''}` +
114
- `}\n`
129
+ `}\n\n` +
130
+ `// Typed route/action availability derived from the installed manifest. The\n` +
131
+ `// generated host uses these to hide links to routes that are not installed,\n` +
132
+ `// so a removed view never leaves an active dead-end navigation target.\n` +
133
+ `export const cartViewAvailable = ${cartViewAvailable}\n\n` +
134
+ `export const checkoutAvailable = ${checkoutAvailable}\n`
115
135
  )
116
136
  }
117
137
 
@@ -0,0 +1,86 @@
1
+ // Environment-file helpers for the scaffold.
2
+ //
3
+ // `create` starts a storefront in mock mode with a minimal, working `.env.local`
4
+ // and never writes a blank `MEDUSA_*` value; `setup` later upserts the real-backend
5
+ // keys without disturbing anything else in the file. Both behaviours are pure
6
+ // enough to unit-test here rather than only through the network-heavy create path.
7
+ import { existsSync, readFileSync } from 'node:fs'
8
+ import { writeFile } from 'node:fs/promises'
9
+ import { randomBytes } from 'node:crypto'
10
+ import { join } from 'node:path'
11
+
12
+ // The minimal mock environment `create` writes: an explicit mock data source, the
13
+ // store identity, and the per-install session secret the guest cart and checkout
14
+ // cookie signing requires. No backend key is written here.
15
+ export function initialEnvLocal(name, sessionSecret) {
16
+ return [
17
+ 'THOR_DATA_SOURCE=mock',
18
+ `THOR_STORE_ID=${name}`,
19
+ `THOR_SESSION_SECRET=${sessionSecret}`,
20
+ ].join('\n') + '\n'
21
+ }
22
+
23
+ // The committed example documenting both modes. The real-backend keys are blank
24
+ // placeholders — `storefront setup` fills them.
25
+ export function envExample(name) {
26
+ return [
27
+ '# Data source: "mock" for explicit demo data (no backend needed), "medusa" for a real backend.',
28
+ 'THOR_DATA_SOURCE=mock',
29
+ '# Store identity (written by create; required only in real mode).',
30
+ `THOR_STORE_ID=${name}`,
31
+ '# Real backend configuration (required only when THOR_DATA_SOURCE=medusa).',
32
+ '# Run `storefront setup` to write these: it takes the sales channel id (from the',
33
+ '# Medusa admin) and derives the currency from the selected region.',
34
+ 'MEDUSA_BASE_URL=http://localhost:9000',
35
+ 'MEDUSA_PUBLISHABLE_KEY=',
36
+ 'MEDUSA_REGION_ID=',
37
+ 'MEDUSA_SALES_CHANNEL_ID=',
38
+ 'MEDUSA_CURRENCY_CODE=',
39
+ '# Host-only cookie signing secret; >=16 chars, 32 recommended. Generated by create.',
40
+ 'THOR_SESSION_SECRET=',
41
+ ].join('\n') + '\n'
42
+ }
43
+
44
+ // Write the initial `.env.local` only when one is absent (an existing file is
45
+ // user-owned — a `setup` run or a hand edit — and is never clobbered), and always
46
+ // refresh the committed `.env.example`. Returns whether `.env.local` was written.
47
+ export async function writeInitialEnv(target, name) {
48
+ const envPath = join(target, '.env.local')
49
+ let wrote = false
50
+ if (!existsSync(envPath)) {
51
+ const sessionSecret = randomBytes(32).toString('base64url')
52
+ await writeFile(envPath, initialEnvLocal(name, sessionSecret), 'utf8')
53
+ wrote = true
54
+ }
55
+ await writeFile(join(target, '.env.example'), envExample(name), 'utf8')
56
+ return wrote
57
+ }
58
+
59
+ // Replace the managed keys in a dotenv-style file, appending any that are absent,
60
+ // and leave every other line (comments, blank lines, unrelated keys) exactly as it
61
+ // was. Idempotent: re-running with the same values produces the same file.
62
+ export function upsertEnv(text, managed) {
63
+ const seen = new Set()
64
+ const lines = text.length ? text.split('\n') : []
65
+ const out = lines.map((line) => {
66
+ const match = /^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=/.exec(line)
67
+ if (match && Object.prototype.hasOwnProperty.call(managed, match[1])) {
68
+ seen.add(match[1])
69
+ return `${match[1]}=${managed[match[1]]}`
70
+ }
71
+ return line
72
+ })
73
+ const missing = Object.keys(managed).filter((key) => !seen.has(key))
74
+ // Drop trailing blank lines before appending so re-runs do not accumulate them.
75
+ while (out.length && out[out.length - 1] === '') out.pop()
76
+ if (missing.length) {
77
+ if (out.length) out.push('')
78
+ for (const key of missing) out.push(`${key}=${managed[key]}`)
79
+ }
80
+ return out.join('\n') + '\n'
81
+ }
82
+
83
+ // Read a dotenv file as text, or '' when it does not exist.
84
+ export function readEnvFile(path) {
85
+ return existsSync(path) ? readFileSync(path, 'utf8') : ''
86
+ }