@thorprovider/storefront 0.4.0-mvp.2 → 0.5.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 (129) hide show
  1. package/README.md +13 -13
  2. package/assets/templates/app/app/[[...slug]]/page.tsx +32 -1
  3. package/assets/templates/app/app/[[...slug]]/renderer.tsx +43 -12
  4. package/assets/templates/app/lib/__STOREFRONT__/account-boundary.client.tsx +76 -0
  5. package/assets/templates/app/lib/__STOREFRONT__/account-lifecycle.client.tsx +461 -0
  6. package/assets/templates/app/lib/__STOREFRONT__/account-mutation.client.ts +46 -0
  7. package/assets/templates/app/lib/__STOREFRONT__/account-private.core.ts +103 -0
  8. package/assets/templates/app/lib/__STOREFRONT__/account-reconcile.client.ts +465 -0
  9. package/assets/templates/app/lib/__STOREFRONT__/account-session.core.ts +177 -0
  10. package/assets/templates/app/lib/__STOREFRONT__/account-session.ts +44 -0
  11. package/assets/templates/app/lib/__STOREFRONT__/account-user.core.ts +65 -0
  12. package/assets/templates/app/lib/__STOREFRONT__/actions.ts +76 -27
  13. package/assets/templates/app/lib/__STOREFRONT__/catalog.ts +4 -4
  14. package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +0 -10
  15. package/assets/templates/app/lib/__STOREFRONT__/composition.ts +1 -1
  16. package/assets/templates/app/lib/__STOREFRONT__/handlers.core.ts +3 -3
  17. package/assets/templates/app/lib/__STOREFRONT__/mappers.ts +17 -18
  18. package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.client.tsx +209 -0
  19. package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.ts +247 -0
  20. package/assets/templates/app/lib/__STOREFRONT__/registry.tsx +60 -29
  21. package/assets/templates/app/lib/__STOREFRONT__/schema.ts +83 -15
  22. package/assets/templates/app/lib/__STOREFRONT__/section-sources.ts +3 -5
  23. package/assets/templates/app/lib/__STOREFRONT__/shell/props.ts +1 -1
  24. package/assets/templates/app/lib/__STOREFRONT__/spec/index.ts +25 -0
  25. package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +7 -10
  26. package/assets/templates/app/lib/__STOREFRONT__/views/sections/cta.client.tsx +1 -1
  27. package/assets/templates/app/lib/__STOREFRONT__/views/sections/faq.client.tsx +1 -1
  28. package/assets/templates/app/lib/__STOREFRONT__/views/sections/logoCloud.tsx +1 -1
  29. package/assets/templates/app/lib/__STOREFRONT__/views/sections/pricing.tsx +1 -1
  30. package/assets/templates/app/lib/__STOREFRONT__/views/sections/products.client.tsx +16 -16
  31. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.products.ts +1 -1
  32. package/assets/templates/app/lib/__STOREFRONT__/views/sections/statistics.tsx +1 -1
  33. package/assets/templates/app/lib/__STOREFRONT__/views/sections/testimonials.tsx +26 -19
  34. package/assets/templates/features/checkout/state.ts +0 -5
  35. package/assets/templates/features/customer-auth/handlers.ts +19 -23
  36. package/assets/templates/features/customer-auth/state.ts +21 -0
  37. package/assets/templates/views/account/index.tsx +19 -7
  38. package/assets/templates/views/account/registry.tsx +263 -155
  39. package/assets/templates/views/account/schema.ts +1 -1
  40. package/assets/templates/views/cart/data.ts +7 -7
  41. package/assets/templates/views/cart/registry.tsx +4 -3
  42. package/assets/templates/views/category/assembly/assembly.json +2 -2
  43. package/assets/templates/views/category/assembly/index.skeleton.tsx +11 -7
  44. package/assets/templates/views/category/assembly/registry.skeleton.tsx +9 -9
  45. package/assets/templates/views/category/assembly/slots/breadcrumb/Breadcrumb/binding.json +1 -1
  46. package/assets/templates/views/category/assembly/slots/filter/CategoryListing/catalog.part +5 -0
  47. package/assets/templates/views/category/assembly/slots/filter/{CategoryFilter2 → CategoryListing}/element.part +5 -3
  48. package/assets/templates/views/category/assembly/slots/filter/{CategoryFilter2 → CategoryListing}/registry.part +9 -5
  49. package/assets/templates/views/category/content.ts +2 -1
  50. package/assets/templates/views/category/index.tsx +19 -13
  51. package/assets/templates/views/category/props.ts +1 -1
  52. package/assets/templates/views/category/registry.tsx +19 -15
  53. package/assets/templates/views/category/schema.ts +48 -21
  54. package/assets/templates/views/checkout/content.ts +60 -0
  55. package/assets/templates/views/checkout/props.ts +4 -5
  56. package/assets/templates/views/checkout/registry.tsx +12 -10
  57. package/assets/templates/views/checkout/schema.ts +10 -16
  58. package/assets/templates/views/home/assembly/assembly.json +4 -4
  59. package/assets/templates/views/home/assembly/index.skeleton.tsx +2 -3
  60. package/assets/templates/views/home/assembly/registry.skeleton.tsx +4 -1
  61. package/assets/templates/views/home/assembly/slots/benefits/cards/binding.json +5 -0
  62. package/assets/templates/views/home/assembly/slots/benefits/cards/registry.part +17 -0
  63. package/assets/templates/views/home/assembly/slots/benefits/split/binding.json +5 -0
  64. package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → split}/registry.part +6 -2
  65. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/binding.json +5 -0
  66. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/catalog.part +8 -0
  67. package/assets/templates/views/home/assembly/slots/categories/{ProductCategory2 → CategoryGrid}/element.part +1 -1
  68. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/registry.part +31 -0
  69. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/binding.json +5 -0
  70. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/catalog.part +4 -0
  71. package/assets/templates/views/home/assembly/slots/hero/{StorefrontHero1 → StorefrontHero}/registry.part +3 -1
  72. package/assets/templates/views/home/content.ts +22 -0
  73. package/assets/templates/views/home/index.tsx +11 -8
  74. package/assets/templates/views/home/props.ts +1 -0
  75. package/assets/templates/views/home/registry.tsx +39 -15
  76. package/assets/templates/views/home/schema.ts +141 -24
  77. package/assets/templates/views/product/data.ts +1 -1
  78. package/assets/templates/views/product/registry.tsx +10 -6
  79. package/assets/templates/views/product/schema.ts +36 -1
  80. package/examples/merchandising/category-led.json +1 -1
  81. package/examples/merchandising/collection-led.json +1 -1
  82. package/package.json +4 -5
  83. package/recipes/archetypes.json +39 -43
  84. package/recipes/catalog.json +212 -202
  85. package/recipes/catalog.mjs +10 -0
  86. package/recipes/catalog.schema.json +4 -0
  87. package/recipes/features.json +5 -5
  88. package/recipes/recipes.json +137 -43
  89. package/recipes/sections.json +4 -4
  90. package/recipes/validate.mjs +21 -4
  91. package/scripts/candidate.mjs +2 -2
  92. package/scripts/composers.mjs +2 -2
  93. package/scripts/file-classes.mjs +10 -0
  94. package/scripts/logical-controls.mjs +4 -4
  95. package/scripts/operation-registry.mjs +1 -1
  96. package/scripts/ownership-conflict.mjs +5 -2
  97. package/scripts/view-assembly.mjs +12 -4
  98. package/scripts/view-selection.mjs +1 -1
  99. package/skills/sf-view-gen/assets/recipes/archetypes.json +39 -43
  100. package/skills/sf-view-gen/assets/recipes/catalog.json +212 -202
  101. package/skills/sf-view-gen/assets/recipes/catalog.schema.json +4 -0
  102. package/skills/sf-view-gen/assets/recipes/features.json +5 -5
  103. package/skills/sf-view-gen/assets/recipes/recipes.json +137 -43
  104. package/skills/sf-view-gen/assets/recipes/sections.json +4 -4
  105. package/skills/sf-view-gen/assets/templates/views/sections/cta.client.tsx +1 -1
  106. package/skills/sf-view-gen/assets/templates/views/sections/faq.client.tsx +1 -1
  107. package/skills/sf-view-gen/assets/templates/views/sections/logoCloud.client.tsx +1 -1
  108. package/skills/sf-view-gen/assets/templates/views/sections/pricing.client.tsx +1 -1
  109. package/skills/sf-view-gen/assets/templates/views/sections/products.client.tsx +16 -16
  110. package/skills/sf-view-gen/assets/templates/views/sections/schema.products.ts +1 -1
  111. package/skills/sf-view-gen/assets/templates/views/sections/schema.testimonials.ts +21 -11
  112. package/skills/sf-view-gen/assets/templates/views/sections/statistics.client.tsx +1 -1
  113. package/skills/sf-view-gen/assets/templates/views/sections/testimonials.client.tsx +2 -8
  114. package/skills/sf-view-gen/scripts/catalog.mjs +10 -0
  115. package/skills/sf-view-gen/scripts/validate.mjs +21 -4
  116. package/assets/templates/views/category/assembly/slots/filter/CategoryFilter2/catalog.part +0 -5
  117. package/assets/templates/views/home/assembly/slots/benefits/Feature1/binding.json +0 -5
  118. package/assets/templates/views/home/assembly/slots/benefits/Feature2/binding.json +0 -5
  119. package/assets/templates/views/home/assembly/slots/benefits/Feature2/registry.part +0 -10
  120. package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/binding.json +0 -5
  121. package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/catalog.part +0 -4
  122. package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/registry.part +0 -16
  123. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/binding.json +0 -5
  124. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/catalog.part +0 -4
  125. /package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/catalog.part +0 -0
  126. /package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/element.part +0 -0
  127. /package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/catalog.part +0 -0
  128. /package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/element.part +0 -0
  129. /package/assets/templates/views/home/assembly/slots/hero/{StorefrontHero1 → StorefrontHero}/element.part +0 -0
@@ -8,21 +8,47 @@
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", "products"],
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
  {
@@ -31,20 +57,39 @@
31
57
  "description": "Single product detail page with overview, gallery, and reviews",
32
58
  "route": "/products/[id]",
33
59
  "loader": "product",
34
- "requiredDataKeys": ["selectedProduct"],
60
+ "requiredDataKeys": [
61
+ "selectedProduct"
62
+ ],
35
63
  "defaultVariants": {
36
- "overview": "ProductOverview1",
64
+ "overview": "ProductOverview",
37
65
  "reviews": "ReviewRating1",
38
66
  "breadcrumb": "Breadcrumb"
39
67
  },
40
68
  "allowedVariants": {
41
- "overview": ["ProductOverview1", "ProductOverview2", "ProductOverview5"],
42
- "reviews": ["ReviewRating1", "ReviewRating2"],
43
- "breadcrumb": ["Breadcrumb"],
44
- "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
+ ]
45
82
  },
46
- "optionalSections": ["testimonials", "faq", "statistics"],
47
- "registeredSlots": ["overview", "reviews", "breadcrumb"],
83
+ "optionalSections": [
84
+ "testimonials",
85
+ "faq",
86
+ "statistics"
87
+ ],
88
+ "registeredSlots": [
89
+ "overview",
90
+ "reviews",
91
+ "breadcrumb"
92
+ ],
48
93
  "allowedSections": [],
49
94
  "maxSections": 4
50
95
  },
@@ -54,15 +99,21 @@
54
99
  "description": "Standalone cart review page with authoritative totals and quantity editing",
55
100
  "route": "/cart",
56
101
  "loader": "cart",
57
- "requiredDataKeys": ["cart"],
102
+ "requiredDataKeys": [
103
+ "cart"
104
+ ],
58
105
  "defaultVariants": {
59
- "view": "ShoppingCart4"
106
+ "view": "ShoppingCart"
60
107
  },
61
108
  "allowedVariants": {
62
- "view": ["ShoppingCart4"]
109
+ "view": [
110
+ "ShoppingCart"
111
+ ]
63
112
  },
64
113
  "optionalSections": [],
65
- "registeredSlots": ["view"],
114
+ "registeredSlots": [
115
+ "view"
116
+ ],
66
117
  "allowedSections": [],
67
118
  "maxSections": 0
68
119
  },
@@ -72,20 +123,39 @@
72
123
  "description": "Product listing filtered by category with filters and sorting",
73
124
  "route": "/categories/[[...slug]]",
74
125
  "loader": "category",
75
- "requiredDataKeys": ["categoryProducts", "storeCategories"],
126
+ "requiredDataKeys": [
127
+ "categoryProducts",
128
+ "storeCategories"
129
+ ],
76
130
  "defaultVariants": {
77
- "filter": "CategoryFilter2",
78
- "productCard": "ProductCard1",
131
+ "filter": "CategoryListing",
132
+ "productCard": "ProductGrid",
79
133
  "breadcrumb": "Breadcrumb"
80
134
  },
81
135
  "allowedVariants": {
82
- "filter": ["CategoryFilter1", "CategoryFilter2", "CategoryFilter4"],
83
- "productCard": ["ProductCard1", "ProductCard2", "ProductCard3", "ProductCard5"],
84
- "breadcrumb": ["Breadcrumb"]
136
+ "filter": [
137
+ "CategoryListing"
138
+ ],
139
+ "productCard": [
140
+ "ProductGrid"
141
+ ],
142
+ "breadcrumb": [
143
+ "Breadcrumb"
144
+ ]
85
145
  },
86
- "optionalSections": ["logoCloud", "testimonials"],
87
- "registeredSlots": ["breadcrumb", "filter", "productCard"],
88
- "allowedSections": ["faq", "cta"],
146
+ "optionalSections": [
147
+ "logoCloud",
148
+ "testimonials"
149
+ ],
150
+ "registeredSlots": [
151
+ "breadcrumb",
152
+ "filter",
153
+ "productCard"
154
+ ],
155
+ "allowedSections": [
156
+ "faq",
157
+ "cta"
158
+ ],
89
159
  "maxSections": 4
90
160
  },
91
161
  {
@@ -94,17 +164,27 @@
94
164
  "description": "Multi-step checkout with cart summary, shipping, and payment",
95
165
  "route": "/checkout",
96
166
  "loader": "checkout",
97
- "requiredDataKeys": ["checkoutCountries", "checkoutPaymentMethods"],
167
+ "requiredDataKeys": [
168
+ "checkoutCountries",
169
+ "checkoutPaymentMethods"
170
+ ],
98
171
  "defaultVariants": {
99
- "checkout": "CheckoutForm1",
172
+ "checkout": "Checkout",
100
173
  "confirmation": "CheckoutConfirmation"
101
174
  },
102
175
  "allowedVariants": {
103
- "checkout": ["CheckoutForm1", "CheckoutForm2", "CheckoutForm3"],
104
- "confirmation": ["CheckoutConfirmation"]
176
+ "checkout": [
177
+ "Checkout"
178
+ ],
179
+ "confirmation": [
180
+ "CheckoutConfirmation"
181
+ ]
105
182
  },
106
183
  "optionalSections": [],
107
- "registeredSlots": ["checkout", "confirmation"],
184
+ "registeredSlots": [
185
+ "checkout",
186
+ "confirmation"
187
+ ],
108
188
  "allowedSections": [],
109
189
  "maxSections": 4
110
190
  },
@@ -114,18 +194,32 @@
114
194
  "description": "Customer account area with sign-in, registration, and a minimal signed-in state",
115
195
  "route": "/account",
116
196
  "loader": "account",
117
- "requiredDataKeys": ["accountCustomer"],
197
+ "requiredDataKeys": [
198
+ "accountCustomer"
199
+ ],
118
200
  "defaultVariants": {
119
- "login": "LoginPage1",
201
+ "login": "card",
120
202
  "register": "SignUpPage1"
121
203
  },
122
204
  "allowedVariants": {
123
- "login": ["LoginPage1", "LoginPage2"],
124
- "register": ["SignUpPage1"],
125
- "orders": ["OrderHistory1", "OrderHistory2"]
205
+ "login": [
206
+ "card",
207
+ "social"
208
+ ],
209
+ "register": [
210
+ "SignUpPage1"
211
+ ],
212
+ "orders": [
213
+ "OrderHistory1",
214
+ "OrderHistory2"
215
+ ]
126
216
  },
127
217
  "optionalSections": [],
128
- "registeredSlots": ["login", "register", "orders"],
218
+ "registeredSlots": [
219
+ "login",
220
+ "register",
221
+ "orders"
222
+ ],
129
223
  "allowedSections": [],
130
224
  "maxSections": 4
131
225
  },
@@ -7,8 +7,8 @@
7
7
  "name": "testimonials",
8
8
  "description": "Customer testimonials or social proof",
9
9
  "elementType": "Testimonials",
10
- "variants": ["Testimonial1", "Testimonial2"],
11
- "defaultVariant": "Testimonial1",
10
+ "variants": ["carousel", "bento"],
11
+ "defaultVariant": "carousel",
12
12
  "propsHint": "title, badge, items[] (quote, author, role, avatar)",
13
13
  "status": "held",
14
14
  "reason": "bounded curation: no verified presentation bridge/provenance in the current composition and no verified backend/data source for the MVP"
@@ -35,8 +35,8 @@
35
35
  "name": "products",
36
36
  "description": "Data-bound product presentation (grid or combined grid-and-carousel) whose selection is configured independently per instance",
37
37
  "elementType": "Products",
38
- "variants": ["ProductCard1", "ProductShowcase1"],
39
- "defaultVariant": "ProductCard1",
38
+ "variants": ["ProductGrid", "ProductShowcase1"],
39
+ "defaultVariant": "ProductGrid",
40
40
  "dataBound": true,
41
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
42
  "status": "executable"
@@ -5,7 +5,7 @@
5
5
  // 'use client' boundary, but this fragment keeps the explicit client boundary so
6
6
  // the section composes identically in any consumer graph.
7
7
 
8
- import { CtaSection1 as CtaBlock } from '@thorprovider/blocks'
8
+ import { CtaSection1 as CtaBlock } from '@thorprovider/blocks/blocks/marketing/cta/cta-section-1'
9
9
  import { ctaSection1PropsSchema } from './schema.cta'
10
10
  import type { ViewRegistry } from '../types'
11
11
 
@@ -5,7 +5,7 @@
5
5
  // 'use client' boundary, but this fragment keeps the explicit client boundary so
6
6
  // the section composes identically in any consumer graph.
7
7
 
8
- import { FaqBlock1 as FaqBlock } from '@thorprovider/blocks'
8
+ import { FaqBlock1 as FaqBlock } from '@thorprovider/blocks/blocks/marketing/faq/faq-block-1'
9
9
  import { faqPropsSchema } from './schema.faq'
10
10
  import type { ViewRegistry } from '../types'
11
11
 
@@ -3,7 +3,7 @@
3
3
  // Optional section fragment: logoCloud (mirrors recipes/sections.json) — client registry.
4
4
  // The matching server-side catalog entry lives in logoCloud.tsx.
5
5
 
6
- import { LogoCloud1 as LogoCloudBlock } from '@thorprovider/blocks'
6
+ import { LogoCloud1 as LogoCloudBlock } from '@thorprovider/blocks/blocks/marketing/logo-clouds/logo-cloud-1'
7
7
  import { logoCloudPropsSchema } from './schema.logoCloud'
8
8
  import type { ViewRegistry } from '../types'
9
9
 
@@ -3,7 +3,7 @@
3
3
  // Optional section fragment: pricing (mirrors recipes/sections.json) — client registry.
4
4
  // The matching server-side catalog entry lives in pricing.tsx.
5
5
 
6
- import { PricingSection1 as PricingBlock } from '@thorprovider/blocks'
6
+ import { PricingSection1 as PricingBlock } from '@thorprovider/blocks/blocks/marketing/pricing/pricing-section-1'
7
7
  import { pricingPropsSchema } from './schema.pricing'
8
8
  import type { ViewRegistry } from '../types'
9
9
 
@@ -2,16 +2,14 @@
2
2
 
3
3
  // Optional section fragment: products (mirrors recipes/sections.json) — client registry.
4
4
  // The matching server-side catalog lives in products.tsx. A data-bound section
5
- // renders one of two verified presentations (ProductCard1 grid, or the combined
6
- // grid-and-carousel ProductShowcase1) chosen by the resolved `variant`. The
7
- // selection and resolved products arrive through the view state; this boundary
8
- // only validates them and wires navigation/purchase callbacks.
5
+ // renders one of two verified presentations (the canonical ProductGrid listing,
6
+ // or the combined grid-and-carousel ProductShowcase1) chosen by the resolved
7
+ // `variant`. The selection and resolved products arrive through the view state;
8
+ // this boundary only validates them and wires navigation/purchase callbacks.
9
9
 
10
- import {
11
- ProductCard1 as ProductCard1Block,
12
- ProductShowcase1 as ProductShowcase1Block,
13
- type ProductCard1Product,
14
- } from '@thorprovider/blocks'
10
+ import { ProductGrid as ProductGridBlock } from '@thorprovider/blocks/blocks/e-commerce/product-list/product-grid'
11
+ import ProductShowcase1Block from '@thorprovider/blocks/blocks/e-commerce/product-list/product-showcase-1'
12
+ import type { ProductPresentation } from '@thorprovider/blocks/contracts'
15
13
  import { useStateStore } from '@json-render/react'
16
14
  import { useSectionObservation } from '../../section-observation'
17
15
  import { productsPropsSchema, type ProductsStatus } from './schema.products'
@@ -65,7 +63,7 @@ export const productsRegistry: ViewRegistry = {
65
63
 
66
64
  // The detail affordance opens the product so a variant is chosen explicitly.
67
65
  // It is also the section's observation origin (disabled by default).
68
- const openProduct = (product: ProductCard1Product) => {
66
+ const openProduct = (product: ProductPresentation) => {
69
67
  noteProductClick(product)
70
68
  set('/lastClicked', product)
71
69
  emit('openProduct')
@@ -74,15 +72,12 @@ export const productsRegistry: ViewRegistry = {
74
72
  // Product-card shortcut: the add affordance adds the product's first
75
73
  // purchasable variant (resolved server-side from the product id), then opens
76
74
  // the mini-cart. It is not the section's observation origin.
77
- const addToCart = (product: ProductCard1Product) => {
75
+ const addToCart = (product: ProductPresentation) => {
78
76
  set('/lastClicked', product)
79
77
  emit('addClickedToCart')
80
78
  }
81
79
 
82
80
  const shared = {
83
- products: parsed.products,
84
- heading: parsed.heading,
85
- description: parsed.description,
86
81
  onAddToCart: addToCart,
87
82
  onProductClick: openProduct,
88
83
  }
@@ -90,9 +85,14 @@ export const productsRegistry: ViewRegistry = {
90
85
  return (
91
86
  <div ref={containerRef}>
92
87
  {parsed.variant === 'ProductShowcase1' ? (
93
- <ProductShowcase1Block {...shared} />
88
+ <ProductShowcase1Block
89
+ {...shared}
90
+ heading={parsed.heading}
91
+ description={parsed.description}
92
+ products={parsed.products}
93
+ />
94
94
  ) : (
95
- <ProductCard1Block {...shared} />
95
+ <ProductGridBlock {...shared} heading={parsed.heading} items={parsed.products} />
96
96
  )}
97
97
  </div>
98
98
  )
@@ -5,7 +5,7 @@
5
5
  // section renders exactly what the host mapped from the catalog result.
6
6
 
7
7
  import { z } from 'zod'
8
- import { productPresentationSchema } from '@thorprovider/blocks'
8
+ import { productPresentationSchema } from '@thorprovider/blocks/contracts'
9
9
 
10
10
  // The per-instance resolution status the host loader computes for a data-bound
11
11
  // section. `ready`/`empty` carry resolved products; the remaining states carry no
@@ -1,5 +1,5 @@
1
1
  // Optional section fragment: testimonials (mirrors recipes/sections.json) — shared contract.
2
- // Zod mirror of the Testimonial1Item/Testimonial1Props block contracts, shared
2
+ // Zod mirror of the canonical TestimonialSection contract, shared
3
3
  // by the server catalog (testimonials.tsx) and the client registry
4
4
  // (testimonials.client.tsx).
5
5
 
@@ -8,16 +8,26 @@ import { z } from 'zod'
8
8
  export const testimonialItemSchema = z.object({
9
9
  id: z.string(),
10
10
  name: z.string(),
11
- role: z.string(),
12
- avatar: z.string(),
13
11
  content: z.string(),
14
- rating: z.number(),
12
+ role: z.string().optional(),
13
+ avatar: z.string().optional(),
14
+ rating: z.number().optional(),
15
15
  })
16
16
 
17
- export const testimonialsPropsSchema = z.object({
18
- title: z.string().optional(),
19
- prevLabel: z.string().optional(),
20
- nextLabel: z.string().optional(),
21
- slideAriaLabel: z.string().optional(),
22
- items: z.array(testimonialItemSchema),
23
- })
17
+ export const testimonialsPropsSchema = z.discriminatedUnion('presentation', [
18
+ z.object({
19
+ presentation: z.literal('carousel'),
20
+ carouselLabels: z.object({ previous: z.string(), next: z.string(), slide: z.string() }),
21
+ items: z.array(testimonialItemSchema),
22
+ title: z.string().optional(),
23
+ description: z.string().optional(),
24
+ className: z.string().optional(),
25
+ }),
26
+ z.object({
27
+ presentation: z.literal('bento'),
28
+ items: z.array(testimonialItemSchema),
29
+ title: z.string().optional(),
30
+ description: z.string().optional(),
31
+ className: z.string().optional(),
32
+ }),
33
+ ])
@@ -3,7 +3,7 @@
3
3
  // Optional section fragment: statistics (mirrors recipes/sections.json) — client registry.
4
4
  // The matching server-side catalog entry lives in statistics.tsx.
5
5
 
6
- import { Statistic1 as StatisticBlock } from '@thorprovider/blocks'
6
+ import { Statistic1 as StatisticBlock } from '@thorprovider/blocks/blocks/marketing/statistics/statistic-1'
7
7
  import { statisticsPropsSchema } from './schema.statistics'
8
8
  import { resolveIcon } from '../../icon-map'
9
9
  import type { ViewRegistry } from '../types'
@@ -3,7 +3,7 @@
3
3
  // Optional section fragment: testimonials (mirrors recipes/sections.json) — client registry.
4
4
  // The matching server-side catalog entry lives in testimonials.tsx.
5
5
 
6
- import { Testimonial1 as TestimonialBlock } from '@thorprovider/blocks'
6
+ import { TestimonialSection } from '@thorprovider/blocks'
7
7
  import { testimonialsPropsSchema } from './schema.testimonials'
8
8
  import type { ViewRegistry } from '../types'
9
9
 
@@ -11,13 +11,7 @@ export const registry: ViewRegistry = {
11
11
  Testimonials: ({ props }) => {
12
12
  const parsed = testimonialsPropsSchema.parse(props)
13
13
  return (
14
- <TestimonialBlock
15
- title={parsed.title ?? 'Lo que dicen nuestros clientes'}
16
- items={parsed.items}
17
- prevLabel={parsed.prevLabel ?? 'Anterior'}
18
- nextLabel={parsed.nextLabel ?? 'Siguiente'}
19
- slideAriaLabel={parsed.slideAriaLabel ?? 'Testimonio'}
20
- />
14
+ <TestimonialSection {...parsed} />
21
15
  )
22
16
  },
23
17
  }
@@ -100,6 +100,16 @@ export function validateCatalog(catalog) {
100
100
  if (typeof slot.default === 'string' && !hasOwn(variants, slot.default)) {
101
101
  errors.push(`Slot "${slotId}" default "${slot.default}" is not a declared variant.`)
102
102
  }
103
+ // A legacy alias must land on a declared variant of the same slot: an alias
104
+ // pointing outside the variant set would resolve selections to nothing.
105
+ const aliases = isPlainObject(slot.legacyAliases) ? slot.legacyAliases : {}
106
+ for (const [alias, target] of Object.entries(aliases)) {
107
+ if (!hasOwn(variants, target)) {
108
+ errors.push(
109
+ `Slot "${slotId}" legacy alias "${alias}" maps to "${target}", which is not a declared variant.`
110
+ )
111
+ }
112
+ }
103
113
  for (const [variantName, entry] of Object.entries(variants)) {
104
114
  if (!isPlainObject(entry)) continue
105
115
  if (entry.status === 'held' && !(typeof entry.reason === 'string' && entry.reason.length > 0)) {
@@ -550,15 +550,30 @@ export function getCatalogSlot(viewName, slot) {
550
550
  return hasOwn(slots, key) ? slots[key] : null
551
551
  }
552
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
+
553
566
  /**
554
567
  * The catalog entry for one variant of a slot, or null when the slot or the
555
568
  * variant is outside the catalog scope. Used to name a held variant's reason at
556
- * 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.
557
571
  */
558
572
  export function getCatalogVariant(viewName, slot, variant) {
559
573
  const slotEntry = getCatalogSlot(viewName, slot)
560
574
  const variants = isPlainObject(slotEntry?.variants) ? slotEntry.variants : {}
561
- return hasOwn(variants, variant) ? variants[variant] : null
575
+ const canonical = resolveLegacyVariant(viewName, slot, variant)
576
+ return hasOwn(variants, canonical) ? variants[canonical] : null
562
577
  }
563
578
 
564
579
  /**
@@ -630,7 +645,7 @@ export function supportedVariant(viewName, slot) {
630
645
  }
631
646
 
632
647
  export function isSupportedVariant(viewName, slot, variant) {
633
- return executableVariants(viewName, slot).includes(variant)
648
+ return executableVariants(viewName, slot).includes(resolveLegacyVariant(viewName, slot, variant))
634
649
  }
635
650
 
636
651
  /**
@@ -662,7 +677,9 @@ export function isAllowedVariant(viewName, slot, variant) {
662
677
  const allowedBySlot = isPlainObject(recipe.allowedVariants) ? recipe.allowedVariants : {}
663
678
  if (!hasOwn(allowedBySlot, slot)) return false
664
679
  const allowed = allowedBySlot[slot]
665
- return Array.isArray(allowed) && allowed.includes(variant)
680
+ return (
681
+ Array.isArray(allowed) && allowed.includes(resolveLegacyVariant(viewName, slot, variant))
682
+ )
666
683
  }
667
684
 
668
685
  export function isAllowedSection(viewName, sectionName) {
@@ -1,5 +0,0 @@
1
- CategoryFilter2: {
2
- props: categoryFilterPropsSchema,
3
- description:
4
- 'Listado de categoría: una sola presentación controlada CategoryFilter2 con productos, paginación, búsqueda y filtros opcionales.',
5
- },
@@ -1,5 +0,0 @@
1
- {
2
- "module": "@thorprovider/blocks",
3
- "import": "Feature1",
4
- "as": "FeatureBlock"
5
- }
@@ -1,5 +0,0 @@
1
- {
2
- "module": "@thorprovider/blocks",
3
- "import": "Feature2",
4
- "as": "FeatureBlock"
5
- }
@@ -1,10 +0,0 @@
1
- Feature: ({ props }) => {
2
- const feature = featurePropsSchema.parse(props)
3
- return (
4
- <FeatureBlock
5
- items={feature.items.map((item) => ({ ...item, icon: resolveIcon(item.icon) }))}
6
- title={feature.title}
7
- description={feature.description}
8
- />
9
- )
10
- },
@@ -1,5 +0,0 @@
1
- {
2
- "module": "@thorprovider/blocks",
3
- "import": "ProductCategory2",
4
- "as": "CategoryCardsBlock"
5
- }
@@ -1,4 +0,0 @@
1
- CategoryCards: {
2
- props: categoryCardsPropsSchema,
3
- description: 'Category grid.',
4
- },
@@ -1,16 +0,0 @@
1
- CategoryCards: ({ props, emit }) => {
2
- const { set } = useStateStore()
3
- const cards = categoryCardsPropsSchema.parse(props)
4
- return (
5
- <CategoryCardsBlock
6
- title={cards.title}
7
- description={cards.description}
8
- categories={cards.categories}
9
- cta={cards.cta}
10
- onBrowse={(category) => {
11
- set('/lastCategory', category.handle ?? String(category.id))
12
- emit('openCategory')
13
- }}
14
- />
15
- )
16
- },
@@ -1,5 +0,0 @@
1
- {
2
- "module": "@thorprovider/blocks",
3
- "import": "StorefrontHero1",
4
- "as": "StorefrontHeroBlock"
5
- }
@@ -1,4 +0,0 @@
1
- StorefrontHero: {
2
- props: storefrontHeroPropsSchema,
3
- description: 'Landing hero.',
4
- },