@thorprovider/storefront 0.4.0-mvp.2 → 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.
- package/README.md +10 -12
- package/assets/templates/app/app/[[...slug]]/page.tsx +14 -1
- package/assets/templates/app/app/[[...slug]]/renderer.tsx +43 -12
- package/assets/templates/app/lib/__STOREFRONT__/account-boundary.client.tsx +76 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-lifecycle.client.tsx +461 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-mutation.client.ts +46 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-private.core.ts +103 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-reconcile.client.ts +465 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-session.core.ts +177 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-session.ts +44 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-user.core.ts +65 -0
- package/assets/templates/app/lib/__STOREFRONT__/actions.ts +76 -27
- package/assets/templates/app/lib/__STOREFRONT__/catalog.ts +4 -4
- package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +0 -10
- package/assets/templates/app/lib/__STOREFRONT__/handlers.core.ts +3 -3
- package/assets/templates/app/lib/__STOREFRONT__/mappers.ts +17 -18
- package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.client.tsx +209 -0
- package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.ts +247 -0
- package/assets/templates/app/lib/__STOREFRONT__/registry.tsx +48 -19
- package/assets/templates/app/lib/__STOREFRONT__/schema.ts +49 -11
- package/assets/templates/app/lib/__STOREFRONT__/section-sources.ts +3 -5
- package/assets/templates/app/lib/__STOREFRONT__/spec/index.ts +25 -0
- package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +4 -2
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/cta.client.tsx +1 -1
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/faq.client.tsx +1 -1
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/logoCloud.tsx +1 -1
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/pricing.tsx +1 -1
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/products.client.tsx +16 -16
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.products.ts +1 -1
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/statistics.tsx +1 -1
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/testimonials.tsx +1 -1
- package/assets/templates/features/customer-auth/handlers.ts +19 -23
- package/assets/templates/features/customer-auth/state.ts +21 -0
- package/assets/templates/views/account/index.tsx +19 -7
- package/assets/templates/views/account/registry.tsx +234 -155
- package/assets/templates/views/cart/data.ts +7 -7
- package/assets/templates/views/cart/registry.tsx +4 -3
- package/assets/templates/views/category/assembly/assembly.json +1 -1
- package/assets/templates/views/category/assembly/registry.skeleton.tsx +6 -6
- package/assets/templates/views/category/assembly/slots/breadcrumb/Breadcrumb/binding.json +1 -1
- package/assets/templates/views/category/registry.tsx +7 -7
- package/assets/templates/views/checkout/registry.tsx +3 -5
- package/assets/templates/views/home/assembly/assembly.json +4 -4
- package/assets/templates/views/home/assembly/index.skeleton.tsx +2 -1
- package/assets/templates/views/home/assembly/registry.skeleton.tsx +4 -1
- package/assets/templates/views/home/assembly/slots/benefits/cards/binding.json +5 -0
- package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/registry.part +7 -1
- package/assets/templates/views/home/assembly/slots/benefits/split/binding.json +5 -0
- package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/registry.part +6 -1
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/binding.json +5 -0
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/catalog.part +8 -0
- package/assets/templates/views/home/assembly/slots/categories/{ProductCategory2 → CategoryGrid}/element.part +1 -1
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/registry.part +31 -0
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/binding.json +5 -0
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/catalog.part +4 -0
- package/assets/templates/views/home/assembly/slots/hero/{StorefrontHero1 → StorefrontHero}/registry.part +3 -1
- package/assets/templates/views/home/content.ts +22 -0
- package/assets/templates/views/home/index.tsx +11 -6
- package/assets/templates/views/home/props.ts +1 -0
- package/assets/templates/views/home/registry.tsx +39 -15
- package/assets/templates/views/home/schema.ts +141 -24
- package/assets/templates/views/product/data.ts +1 -1
- package/assets/templates/views/product/registry.tsx +10 -6
- package/assets/templates/views/product/schema.ts +36 -1
- package/package.json +4 -5
- package/recipes/archetypes.json +25 -25
- package/recipes/catalog.json +213 -160
- package/recipes/catalog.mjs +10 -0
- package/recipes/catalog.schema.json +4 -0
- package/recipes/features.json +3 -3
- package/recipes/recipes.json +138 -40
- package/recipes/sections.json +2 -2
- package/recipes/validate.mjs +21 -4
- package/scripts/candidate.mjs +2 -2
- package/scripts/file-classes.mjs +10 -0
- package/scripts/ownership-conflict.mjs +5 -2
- package/scripts/view-assembly.mjs +10 -2
- package/scripts/view-selection.mjs +1 -1
- package/skills/sf-view-gen/assets/recipes/archetypes.json +25 -25
- package/skills/sf-view-gen/assets/recipes/catalog.json +213 -160
- package/skills/sf-view-gen/assets/recipes/catalog.schema.json +4 -0
- package/skills/sf-view-gen/assets/recipes/features.json +3 -3
- package/skills/sf-view-gen/assets/recipes/recipes.json +138 -40
- package/skills/sf-view-gen/assets/recipes/sections.json +2 -2
- package/skills/sf-view-gen/assets/templates/views/sections/cta.client.tsx +1 -1
- package/skills/sf-view-gen/assets/templates/views/sections/faq.client.tsx +1 -1
- package/skills/sf-view-gen/assets/templates/views/sections/logoCloud.client.tsx +1 -1
- package/skills/sf-view-gen/assets/templates/views/sections/pricing.client.tsx +1 -1
- package/skills/sf-view-gen/assets/templates/views/sections/products.client.tsx +16 -16
- package/skills/sf-view-gen/assets/templates/views/sections/schema.products.ts +1 -1
- package/skills/sf-view-gen/assets/templates/views/sections/statistics.client.tsx +1 -1
- package/skills/sf-view-gen/assets/templates/views/sections/testimonials.client.tsx +1 -1
- package/skills/sf-view-gen/scripts/catalog.mjs +10 -0
- package/skills/sf-view-gen/scripts/validate.mjs +21 -4
- package/assets/templates/views/home/assembly/slots/benefits/Feature1/binding.json +0 -5
- package/assets/templates/views/home/assembly/slots/benefits/Feature2/binding.json +0 -5
- package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/binding.json +0 -5
- package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/catalog.part +0 -4
- package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/registry.part +0 -16
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/binding.json +0 -5
- package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/catalog.part +0 -4
- /package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/catalog.part +0 -0
- /package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/element.part +0 -0
- /package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/catalog.part +0 -0
- /package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/element.part +0 -0
- /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": [
|
|
11
|
+
"requiredDataKeys": [
|
|
12
|
+
"heroProducts",
|
|
13
|
+
"categories"
|
|
14
|
+
],
|
|
12
15
|
"defaultVariants": {
|
|
13
|
-
"hero": "
|
|
14
|
-
"benefits": "
|
|
15
|
-
"categories": "
|
|
16
|
+
"hero": "StorefrontHero",
|
|
17
|
+
"benefits": "cards",
|
|
18
|
+
"categories": "CategoryGrid"
|
|
16
19
|
},
|
|
17
20
|
"allowedVariants": {
|
|
18
|
-
"hero": [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"
|
|
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": [
|
|
24
|
-
|
|
25
|
-
|
|
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": [
|
|
60
|
+
"requiredDataKeys": [
|
|
61
|
+
"selectedProduct"
|
|
62
|
+
],
|
|
35
63
|
"defaultVariants": {
|
|
36
|
-
"overview": "
|
|
64
|
+
"overview": "ProductOverview",
|
|
37
65
|
"reviews": "ReviewRating1",
|
|
38
66
|
"breadcrumb": "Breadcrumb"
|
|
39
67
|
},
|
|
40
68
|
"allowedVariants": {
|
|
41
|
-
"overview": [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"
|
|
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": [
|
|
47
|
-
|
|
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": [
|
|
102
|
+
"requiredDataKeys": [
|
|
103
|
+
"cart"
|
|
104
|
+
],
|
|
58
105
|
"defaultVariants": {
|
|
59
|
-
"view": "
|
|
106
|
+
"view": "ShoppingCart"
|
|
60
107
|
},
|
|
61
108
|
"allowedVariants": {
|
|
62
|
-
"view": [
|
|
109
|
+
"view": [
|
|
110
|
+
"ShoppingCart"
|
|
111
|
+
]
|
|
63
112
|
},
|
|
64
113
|
"optionalSections": [],
|
|
65
|
-
"registeredSlots": [
|
|
114
|
+
"registeredSlots": [
|
|
115
|
+
"view"
|
|
116
|
+
],
|
|
66
117
|
"allowedSections": [],
|
|
67
118
|
"maxSections": 0
|
|
68
119
|
},
|
|
@@ -72,20 +123,41 @@
|
|
|
72
123
|
"description": "Product listing filtered by category with filters and sorting",
|
|
73
124
|
"route": "/categories/[[...slug]]",
|
|
74
125
|
"loader": "category",
|
|
75
|
-
"requiredDataKeys": [
|
|
126
|
+
"requiredDataKeys": [
|
|
127
|
+
"categoryProducts",
|
|
128
|
+
"storeCategories"
|
|
129
|
+
],
|
|
76
130
|
"defaultVariants": {
|
|
77
131
|
"filter": "CategoryFilter2",
|
|
78
|
-
"productCard": "
|
|
132
|
+
"productCard": "ProductGrid",
|
|
79
133
|
"breadcrumb": "Breadcrumb"
|
|
80
134
|
},
|
|
81
135
|
"allowedVariants": {
|
|
82
|
-
"filter": [
|
|
83
|
-
|
|
84
|
-
|
|
136
|
+
"filter": [
|
|
137
|
+
"CategoryFilter1",
|
|
138
|
+
"CategoryFilter2",
|
|
139
|
+
"CategoryFilter4"
|
|
140
|
+
],
|
|
141
|
+
"productCard": [
|
|
142
|
+
"ProductGrid"
|
|
143
|
+
],
|
|
144
|
+
"breadcrumb": [
|
|
145
|
+
"Breadcrumb"
|
|
146
|
+
]
|
|
85
147
|
},
|
|
86
|
-
"optionalSections": [
|
|
87
|
-
|
|
88
|
-
|
|
148
|
+
"optionalSections": [
|
|
149
|
+
"logoCloud",
|
|
150
|
+
"testimonials"
|
|
151
|
+
],
|
|
152
|
+
"registeredSlots": [
|
|
153
|
+
"breadcrumb",
|
|
154
|
+
"filter",
|
|
155
|
+
"productCard"
|
|
156
|
+
],
|
|
157
|
+
"allowedSections": [
|
|
158
|
+
"faq",
|
|
159
|
+
"cta"
|
|
160
|
+
],
|
|
89
161
|
"maxSections": 4
|
|
90
162
|
},
|
|
91
163
|
{
|
|
@@ -94,17 +166,29 @@
|
|
|
94
166
|
"description": "Multi-step checkout with cart summary, shipping, and payment",
|
|
95
167
|
"route": "/checkout",
|
|
96
168
|
"loader": "checkout",
|
|
97
|
-
"requiredDataKeys": [
|
|
169
|
+
"requiredDataKeys": [
|
|
170
|
+
"checkoutCountries",
|
|
171
|
+
"checkoutPaymentMethods"
|
|
172
|
+
],
|
|
98
173
|
"defaultVariants": {
|
|
99
174
|
"checkout": "CheckoutForm1",
|
|
100
175
|
"confirmation": "CheckoutConfirmation"
|
|
101
176
|
},
|
|
102
177
|
"allowedVariants": {
|
|
103
|
-
"checkout": [
|
|
104
|
-
|
|
178
|
+
"checkout": [
|
|
179
|
+
"CheckoutForm1",
|
|
180
|
+
"CheckoutForm2",
|
|
181
|
+
"CheckoutForm3"
|
|
182
|
+
],
|
|
183
|
+
"confirmation": [
|
|
184
|
+
"CheckoutConfirmation"
|
|
185
|
+
]
|
|
105
186
|
},
|
|
106
187
|
"optionalSections": [],
|
|
107
|
-
"registeredSlots": [
|
|
188
|
+
"registeredSlots": [
|
|
189
|
+
"checkout",
|
|
190
|
+
"confirmation"
|
|
191
|
+
],
|
|
108
192
|
"allowedSections": [],
|
|
109
193
|
"maxSections": 4
|
|
110
194
|
},
|
|
@@ -114,18 +198,32 @@
|
|
|
114
198
|
"description": "Customer account area with sign-in, registration, and a minimal signed-in state",
|
|
115
199
|
"route": "/account",
|
|
116
200
|
"loader": "account",
|
|
117
|
-
"requiredDataKeys": [
|
|
201
|
+
"requiredDataKeys": [
|
|
202
|
+
"accountCustomer"
|
|
203
|
+
],
|
|
118
204
|
"defaultVariants": {
|
|
119
205
|
"login": "LoginPage1",
|
|
120
206
|
"register": "SignUpPage1"
|
|
121
207
|
},
|
|
122
208
|
"allowedVariants": {
|
|
123
|
-
"login": [
|
|
124
|
-
|
|
125
|
-
|
|
209
|
+
"login": [
|
|
210
|
+
"LoginPage1",
|
|
211
|
+
"LoginPage2"
|
|
212
|
+
],
|
|
213
|
+
"register": [
|
|
214
|
+
"SignUpPage1"
|
|
215
|
+
],
|
|
216
|
+
"orders": [
|
|
217
|
+
"OrderHistory1",
|
|
218
|
+
"OrderHistory2"
|
|
219
|
+
]
|
|
126
220
|
},
|
|
127
221
|
"optionalSections": [],
|
|
128
|
-
"registeredSlots": [
|
|
222
|
+
"registeredSlots": [
|
|
223
|
+
"login",
|
|
224
|
+
"register",
|
|
225
|
+
"orders"
|
|
226
|
+
],
|
|
129
227
|
"allowedSections": [],
|
|
130
228
|
"maxSections": 4
|
|
131
229
|
},
|
|
@@ -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": ["
|
|
39
|
-
"defaultVariant": "
|
|
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 (
|
|
6
|
-
// grid-and-carousel ProductShowcase1) chosen by the resolved
|
|
7
|
-
// selection and resolved products arrive through the view state;
|
|
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
|
-
|
|
12
|
-
|
|
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:
|
|
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:
|
|
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
|
|
88
|
+
<ProductShowcase1Block
|
|
89
|
+
{...shared}
|
|
90
|
+
heading={parsed.heading}
|
|
91
|
+
description={parsed.description}
|
|
92
|
+
products={parsed.products}
|
|
93
|
+
/>
|
|
94
94
|
) : (
|
|
95
|
-
<
|
|
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
|
|
@@ -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 { Testimonial1 as TestimonialBlock } from '@thorprovider/blocks/blocks/marketing/testimonials/testimonial-1'
|
|
7
7
|
import { testimonialsPropsSchema } from './schema.testimonials'
|
|
8
8
|
import type { ViewRegistry } from '../types'
|
|
9
9
|
|
|
@@ -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
|
-
|
|
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
|
|
680
|
+
return (
|
|
681
|
+
Array.isArray(allowed) && allowed.includes(resolveLegacyVariant(viewName, slot, variant))
|
|
682
|
+
)
|
|
666
683
|
}
|
|
667
684
|
|
|
668
685
|
export function isAllowedSection(viewName, sectionName) {
|
package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/registry.part
DELETED
|
@@ -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
|
-
},
|
/package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/catalog.part
RENAMED
|
File without changes
|
/package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/element.part
RENAMED
|
File without changes
|
/package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/catalog.part
RENAMED
|
File without changes
|
/package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/element.part
RENAMED
|
File without changes
|
|
File without changes
|