@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
@@ -12,25 +12,33 @@ export const ctaSchema = z.object({
12
12
  href: z.string().optional(),
13
13
  })
14
14
 
15
- // Mirrors the StorefrontHero block contract (FeaturedProduct): the block
16
- // requires every field — including `colors` — to be defined at render.
15
+ // Mirrors the canonical StorefrontHero block contract (FeaturedProduct,
16
+ // @thorprovider/blocks). Every popularity, review, or availability field is
17
+ // host-supplied evidence: omitted fields render nothing (honest omission)
18
+ // instead of fabricated defaults.
17
19
  export const featuredProductSchema = z.object({
18
20
  id: z.string(),
19
21
  name: z.string(),
20
- brand: z.string(),
21
22
  price: z.number(),
22
- originalPrice: z.number(),
23
- rating: z.number(),
24
- reviewCount: z.number(),
25
- inStock: z.boolean(),
26
- isNew: z.boolean(),
27
- isOnSale: z.boolean(),
28
- image: z.string(),
29
- colors: z.array(z.string()),
23
+ // Real compare-at price. Discount treatments render only from a real
24
+ // `originalPrice > price` pair — never fabricated when the backend lacks one.
25
+ originalPrice: z.number().optional(),
26
+ image: z.string().optional(),
27
+ imageAlt: z.string().optional(),
28
+ brand: z.string().optional(),
29
+ colors: z.array(z.string()).optional(),
30
+ rating: z.number().optional(),
31
+ reviewCount: z.number().optional(),
32
+ inStock: z.boolean().optional(),
33
+ isNew: z.boolean().optional(),
34
+ tag: z.string().optional(),
30
35
  })
31
36
 
32
- // Mirrors the Feature1 block contract; `icon` is a NAME here and only becomes
33
- // a component when the registry resolves it through the shared icon map.
37
+ // Mirrors the canonical Feature block contract (@thorprovider/blocks
38
+ // featurePropsSchema); `icon` is a NAME here and only becomes a component when
39
+ // the registry resolves it through the shared icon map. The presentation
40
+ // selects the bounded cards/split surface; CTA/learn-more are cards-only
41
+ // labels, the image a split-only column.
34
42
  export const featureItemSchema = z.object({
35
43
  id: z.string(),
36
44
  title: z.string(),
@@ -38,18 +46,22 @@ export const featureItemSchema = z.object({
38
46
  icon: z.string(),
39
47
  })
40
48
 
41
- // Mirrors the ProductCategory2 block contract (ProductCategory2Category).
42
- // `itemCount` is optional: when the backend count is unknown the projection
43
- // omits it (the block renders no count) rather than fabricating a `0`. A real
44
- // `0` is preserved.
49
+ // Mirrors the canonical category item contract (@thorprovider/blocks
50
+ // productCategoryItemSchema). `itemCount` is optional: when the backend count is
51
+ // unknown the projection omits it (the block renders no count) rather than
52
+ // fabricating a `0`; a real `0` is preserved. `icon` is a serializable icon-key
53
+ // resolved by the block; `subcategories`/`featured` feed the `list` reading.
45
54
  export const categoryCardSchema = z.object({
46
55
  id: z.string(),
47
56
  handle: z.string().optional(),
48
57
  name: z.string(),
49
- description: z.string(),
58
+ description: z.string().optional(),
50
59
  itemCount: z.number().optional(),
51
- image: z.string(),
52
- trending: z.boolean(),
60
+ image: z.string().optional(),
61
+ trending: z.boolean().optional(),
62
+ icon: z.string().optional(),
63
+ subcategories: z.array(z.string()).optional(),
64
+ featured: z.boolean().optional(),
53
65
  })
54
66
 
55
67
  // Optional editorial hero image (mirrors the StorefrontHero block contract).
@@ -60,34 +72,139 @@ export const heroImageSchema = z.object({
60
72
  alt: z.string(),
61
73
  })
62
74
 
75
+ // Mirrors the canonical StorefrontHero block contract
76
+ // (storefrontHeroPropsSchema, @thorprovider/blocks). The bounded presentation
77
+ // option reuses the registry's archetype intent vocabulary. Callbacks are
78
+ // consumer bindings, not serializable props, so they are bound in registry.tsx
79
+ // and deliberately absent here.
80
+ export const heroDepartmentSchema = z.object({
81
+ id: z.string(),
82
+ name: z.string(),
83
+ image: z.string().optional(),
84
+ imageAlt: z.string().optional(),
85
+ count: z.string().optional(),
86
+ href: z.string().optional(),
87
+ })
88
+
89
+ export const heroFeaturedDealSchema = z.object({
90
+ id: z.string(),
91
+ name: z.string(),
92
+ description: z.string().optional(),
93
+ image: z.string().optional(),
94
+ imageAlt: z.string().optional(),
95
+ price: z.number(),
96
+ originalPrice: z.number().optional(),
97
+ cta: ctaSchema.optional(),
98
+ })
99
+
100
+ export const heroStoreLocatorSchema = z.object({
101
+ title: z.string(),
102
+ description: z.string(),
103
+ ctaLabel: z.string(),
104
+ ctaHref: z.string().optional(),
105
+ })
106
+
107
+ export const heroDealSchema = z.object({
108
+ id: z.string(),
109
+ title: z.string(),
110
+ discount: z.string().optional(),
111
+ endTime: z.string().optional(),
112
+ })
113
+
114
+ export const heroCategorySchema = z.object({
115
+ id: z.string(),
116
+ name: z.string(),
117
+ image: z.string().optional(),
118
+ imageAlt: z.string().optional(),
119
+ count: z.string().optional(),
120
+ href: z.string().optional(),
121
+ })
122
+
63
123
  export const storefrontHeroPropsSchema = z.object({
64
124
  title: z.string(),
65
125
  description: z.string(),
66
- titleAccent: z.string().optional(),
126
+ presentation: z.enum(['compact', 'showcase', 'editorial', 'promotional']).optional(),
127
+ currency: z.string().optional(),
67
128
  badge: z.string().optional(),
129
+ titleAccent: z.string().optional(),
68
130
  products: z.array(featuredProductSchema),
69
131
  primaryCta: ctaSchema.optional(),
70
132
  secondaryCta: ctaSchema.optional(),
71
133
  heroImage: heroImageSchema.optional(),
134
+ departments: z.array(heroDepartmentSchema).optional(),
135
+ featuredDeals: z.array(heroFeaturedDealSchema).optional(),
136
+ storeLocator: heroStoreLocatorSchema.optional(),
137
+ shippingInfo: z.string().optional(),
138
+ deals: z.array(heroDealSchema).optional(),
139
+ categories: z.array(heroCategorySchema).optional(),
140
+ rotationInterval: z.number().optional(),
72
141
  })
73
142
 
74
- export const featurePropsSchema = z.object({
143
+ export const featureCardsSpecSchema = z.object({
75
144
  items: z.array(featureItemSchema),
145
+ presentation: z.literal('cards').optional(),
76
146
  badge: z.string().optional(),
77
147
  title: z.string().optional(),
78
148
  description: z.string().optional(),
149
+ ctaLabel: z.string().optional(),
150
+ learnMoreLabel: z.string().optional(),
79
151
  })
80
152
 
81
- export const categoryCardsPropsSchema = z.object({
153
+ export const featureSplitSpecSchema = z.object({
154
+ items: z.array(featureItemSchema),
155
+ presentation: z.literal('split'),
82
156
  title: z.string().optional(),
83
157
  description: z.string().optional(),
158
+ image: z.object({ src: z.string().trim().min(1), alt: z.string() }),
159
+ })
160
+
161
+ export const featurePropsSchema = z.union([featureSplitSpecSchema, featureCardsSpecSchema])
162
+
163
+ export const categoryCardPropsSchema = z.object({
164
+ category: categoryCardSchema,
165
+ presentation: z.enum(['grid', 'icons', 'list']).optional(),
166
+ browseLabel: z.string().optional(),
167
+ itemsLabel: z.string().optional(),
168
+ trendingLabel: z.string().optional(),
169
+ featuredLabel: z.string().optional(),
170
+ imageFallback: z.string().optional(),
171
+ })
172
+
173
+ export const categoryGridPropsSchema = z.object({
174
+ title: z.string().optional(),
175
+ description: z.string().optional(),
176
+ badge: z.string().optional(),
177
+ presentation: z.enum(['grid', 'icons', 'list']).optional(),
84
178
  categories: z.array(categoryCardSchema),
85
179
  cta: ctaSchema.optional(),
180
+ query: z.string().optional(),
181
+ searchPlaceholder: z.string().optional(),
182
+ searchLabel: z.string().optional(),
183
+ emptyLabel: z.string().optional(),
184
+ noResultsLabel: z.string().optional(),
185
+ browseLabel: z.string().optional(),
186
+ viewAllLabel: z.string().optional(),
187
+ trendingLabel: z.string().optional(),
188
+ featuredLabel: z.string().optional(),
189
+ itemsLabel: z.string().optional(),
190
+ imageFallback: z.string().optional(),
191
+ className: z.string().optional(),
192
+ maxItems: z.number().int().positive().optional(),
193
+ loading: z.boolean().optional(),
194
+ skeletonCount: z.number().int().positive().optional(),
86
195
  })
87
196
 
88
197
  export type FeaturedProduct = z.infer<typeof featuredProductSchema>
89
198
  export type FeatureItem = z.infer<typeof featureItemSchema>
90
199
  export type CategoryCard = z.infer<typeof categoryCardSchema>
200
+ export type HeroDepartment = z.infer<typeof heroDepartmentSchema>
201
+ export type HeroFeaturedDeal = z.infer<typeof heroFeaturedDealSchema>
202
+ export type HeroStoreLocator = z.infer<typeof heroStoreLocatorSchema>
203
+ export type HeroDeal = z.infer<typeof heroDealSchema>
204
+ export type HeroCategory = z.infer<typeof heroCategorySchema>
91
205
  export type StorefrontHeroProps = z.infer<typeof storefrontHeroPropsSchema>
92
206
  export type FeatureProps = z.infer<typeof featurePropsSchema>
93
- export type CategoryCardsProps = z.infer<typeof categoryCardsPropsSchema>
207
+ export type FeatureCardsSpecProps = z.infer<typeof featureCardsSpecSchema>
208
+ export type FeatureSplitSpecProps = z.infer<typeof featureSplitSpecSchema>
209
+ export type CategoryCardProps = z.infer<typeof categoryCardPropsSchema>
210
+ export type CategoryGridProps = z.infer<typeof categoryGridPropsSchema>
@@ -9,7 +9,7 @@ import type { ProductDetailProduct } from '@thorprovider/blocks'
9
9
 
10
10
  /**
11
11
  * Map the runtime's canonical product detail (real variants, options,
12
- * availability, Money) to the ProductOverview1 block contract.
12
+ * availability, Money) to the canonical ProductOverview block contract.
13
13
  *
14
14
  * Price availability is preserved, not collapsed: a variant whose backend price
15
15
  * is unresolved carries `price: null` (the block treats that as unavailable and
@@ -6,11 +6,9 @@
6
6
  // on the client side of the RSC graph. Kept separate from index.tsx so the view
7
7
  // spec (elements/catalog/route/loader) stays a pure Server Component module.
8
8
 
9
- import {
10
- Breadcrumb as BreadcrumbBlock,
11
- ProductOverview1 as ProductOverviewBlock,
12
- ReviewRating1 as ReviewsBlock,
13
- } from '@thorprovider/blocks'
9
+ import { Breadcrumb as BreadcrumbBlock } from '@thorprovider/blocks/blocks/e-commerce/navigation/breadcrumb'
10
+ import ProductOverviewBlock from '@thorprovider/blocks/blocks/e-commerce/product-overview/product-overview'
11
+ import ReviewsBlock from '@thorprovider/blocks/blocks/e-commerce/reviews/review-rating-1'
14
12
  import { isAvailableMoney } from '@thorprovider/blocks/contracts'
15
13
  import { useStateStore } from '@json-render/react'
16
14
  import { useProductVisitObservation } from '../../section-observation'
@@ -47,8 +45,15 @@ export const registry: ViewRegistry = {
47
45
  return (
48
46
  <ProductOverviewBlock
49
47
  product={parsed.product}
48
+ presentation={parsed.presentation}
50
49
  selectedVariantId={parsed.selectedVariantId ?? null}
51
50
  quantity={parsed.quantity}
51
+ rating={parsed.rating}
52
+ deliveryEstimate={parsed.deliveryEstimate}
53
+ shipping={parsed.shipping}
54
+ specifications={parsed.specifications}
55
+ features={parsed.features}
56
+ reviews={parsed.reviews}
52
57
  sizesLabel={parsed.sizesLabel}
53
58
  variantLabel={parsed.variantLabel}
54
59
  reviewsLabel={parsed.reviewsLabel}
@@ -78,7 +83,6 @@ export const registry: ViewRegistry = {
78
83
  })
79
84
  emit('addToCart')
80
85
  }}
81
- onToggleWishlist={() => {}}
82
86
  />
83
87
  )
84
88
  },
@@ -41,7 +41,7 @@ const productDetailVariantSchema = z.object({
41
41
  image: imageSchema.optional(),
42
42
  })
43
43
 
44
- // Mirrors ProductDetailProduct (the ProductOverview1 block contract).
44
+ // Mirrors ProductDetailProduct (the canonical ProductOverview block contract).
45
45
  export const productDetailProductSchema = z.object({
46
46
  id: z.string(),
47
47
  handle: z.string().optional(),
@@ -54,10 +54,27 @@ export const productDetailProductSchema = z.object({
54
54
  featuredImage: imageSchema.optional(),
55
55
  })
56
56
 
57
+ // Mirrors the canonical ProductOverview review item (rich presentation only).
58
+ export const productOverviewReviewSchema = z.object({
59
+ id: z.number(),
60
+ author: z.string(),
61
+ rating: z.number(),
62
+ comment: z.string(),
63
+ date: z.string(),
64
+ helpful: z.number().optional(),
65
+ })
66
+
57
67
  export const productOverviewPropsSchema = z.object({
58
68
  product: productDetailProductSchema,
69
+ presentation: z.enum(['standard', 'gallery', 'rich']).optional(),
59
70
  selectedVariantId: z.string().nullable().optional(),
60
71
  quantity: z.number().optional(),
72
+ rating: z.object({ value: z.number(), count: z.number() }).optional(),
73
+ deliveryEstimate: z.string().optional(),
74
+ shipping: moneySchema.optional(),
75
+ specifications: z.record(z.string(), z.string()).optional(),
76
+ features: z.array(z.string()).optional(),
77
+ reviews: z.array(productOverviewReviewSchema).optional(),
61
78
  sizesLabel: z.string().optional(),
62
79
  variantLabel: z.string().optional(),
63
80
  reviewsLabel: z.string().optional(),
@@ -66,6 +83,24 @@ export const productOverviewPropsSchema = z.object({
66
83
  unavailablePriceLabel: z.string().optional(),
67
84
  selectVariantLabel: z.string().optional(),
68
85
  quantityLabel: z.string().optional(),
86
+ deliveryEstimateLabel: z.string().optional(),
87
+ shippingLabel: z.string().optional(),
88
+ badgeLabel: z.string().optional(),
89
+ availabilityLabel: z.string().optional(),
90
+ skuLabel: z.string().optional(),
91
+ overviewLabel: z.string().optional(),
92
+ specsLabel: z.string().optional(),
93
+ featuresLabel: z.string().optional(),
94
+ specificationsLabel: z.string().optional(),
95
+ galleryLabel: z.string().optional(),
96
+ photosLabel: z.string().optional(),
97
+ saveLabel: z.string().optional(),
98
+ savedLabel: z.string().optional(),
99
+ shareLabel: z.string().optional(),
100
+ basedOnReviewsLabel: z.string().optional(),
101
+ foundHelpfulLabel: z.string().optional(),
102
+ ofCounterLabel: z.string().optional(),
103
+ freeDeliveryLabel: z.string().optional(),
69
104
  })
70
105
 
71
106
  // Mirrors ReviewRating1Review (real reviews only; never seeded).
@@ -24,7 +24,7 @@
24
24
  {
25
25
  "id": "home-products-2",
26
26
  "type": "products",
27
- "variant": "ProductCard1",
27
+ "variant": "ProductGrid",
28
28
  "objective": "Cross-sell a related category below the carousel",
29
29
  "destination": "/categories/accesorios",
30
30
  "source": {
@@ -8,7 +8,7 @@
8
8
  {
9
9
  "id": "home-products-1",
10
10
  "type": "products",
11
- "variant": "ProductCard1",
11
+ "variant": "ProductGrid",
12
12
  "objective": "Move collection browsers into the featured collection",
13
13
  "destination": "/collections/featured",
14
14
  "source": {
package/package.json CHANGED
@@ -1,11 +1,9 @@
1
1
  {
2
2
  "name": "@thorprovider/storefront",
3
- "version": "0.4.0-mvp.2",
3
+ "version": "0.5.0",
4
4
  "description": "Deterministic storefront scaffolder and installable OpenCode skill suite for Thor Commerce (Next.js, @thorprovider/blocks, @thorprovider/adapters, Medusa)",
5
5
  "type": "module",
6
- "bin": {
7
- "storefront": "bin/storefront.js"
8
- },
6
+ "bin": "bin/storefront.js",
9
7
  "files": [
10
8
  "assets",
11
9
  "bin",
@@ -24,7 +22,8 @@
24
22
  "check-assets": "node ./scripts/sync-assets.mjs --check",
25
23
  "pretest": "node ./scripts/sync-assets.mjs --check",
26
24
  "test": "vitest run --config vitest.config.ts",
27
- "test:integration": "vitest run --config vitest.config.ts tests/scaffold-integration.test.ts tests/starter-integration.test.ts"
25
+ "test:integration": "vitest run --config vitest.config.ts tests/scaffold-integration.test.ts tests/starter-integration.test.ts",
26
+ "test:browser": "node ./tests/support/projection-ownership.browser.mjs"
28
27
  },
29
28
  "publishConfig": {
30
29
  "access": "public",
@@ -7,20 +7,20 @@
7
7
  "default": "compact",
8
8
  "intents": {
9
9
  "compact": {
10
- "variant": "StorefrontHero1",
11
- "when": "A simple, text-forward hero with a single call to action and no product showcase."
10
+ "variant": "StorefrontHero",
11
+ "when": "A simple, text-forward hero with a single call to action (canonical `presentation: 'compact'`)."
12
12
  },
13
13
  "showcase": {
14
- "variant": "StorefrontHero2",
15
- "when": "A product-led hero that displays featured products alongside the headline."
14
+ "variant": "StorefrontHero",
15
+ "when": "A product-led hero with a search affordance and rotating featured products (canonical `presentation: 'showcase'`)."
16
16
  },
17
17
  "editorial": {
18
- "variant": "StorefrontHero5",
19
- "when": "A storytelling or brand-editorial hero with strong imagery and a narrative tone."
18
+ "variant": "StorefrontHero",
19
+ "when": "A storytelling hero with department navigation and optional curated deals (canonical `presentation: 'editorial'`)."
20
20
  },
21
21
  "promotional": {
22
- "variant": "StorefrontHero6",
23
- "when": "A campaign hero built around an offer, discount, or seasonal promotion."
22
+ "variant": "StorefrontHero",
23
+ "when": "A campaign hero built around real, host-supplied offers (canonical `presentation: 'promotional'`)."
24
24
  }
25
25
  }
26
26
  },
@@ -28,11 +28,11 @@
28
28
  "default": "compact",
29
29
  "intents": {
30
30
  "compact": {
31
- "variant": "Feature1",
31
+ "variant": "cards",
32
32
  "when": "A short list of benefits with icons and one-line descriptions."
33
33
  },
34
34
  "detailed": {
35
- "variant": "Feature2",
35
+ "variant": "split",
36
36
  "when": "Benefits that need longer explanations, richer layout, or supporting media."
37
37
  }
38
38
  }
@@ -41,20 +41,20 @@
41
41
  "default": "standard",
42
42
  "intents": {
43
43
  "standard": {
44
- "variant": "ProductCategory2",
45
- "when": "A balanced grid of category cards with image and label."
44
+ "variant": "CategoryGrid",
45
+ "when": "A balanced grid of category cards with image and label (canonical `presentation: 'grid'`)."
46
46
  },
47
47
  "iconGrid": {
48
- "variant": "ProductCategory1",
49
- "when": "A compact icon-based category grid for many small categories."
48
+ "variant": "CategoryGrid",
49
+ "when": "A compact icon-based category grid for many small categories (canonical `presentation: 'icons'`)."
50
50
  },
51
51
  "featured": {
52
- "variant": "ProductCategory4",
53
- "when": "Few, large featured category tiles that act as primary navigation."
52
+ "variant": "CategoryGrid",
53
+ "when": "Few, large featured category tiles that act as primary navigation (canonical `presentation: 'icons'`)."
54
54
  },
55
55
  "editorial": {
56
- "variant": "ProductCategory5",
57
- "when": "Category tiles presented as editorial imagery blocks."
56
+ "variant": "CategoryGrid",
57
+ "when": "Category tiles presented as a searchable list with subcategory chips (canonical `presentation: 'list'`)."
58
58
  }
59
59
  }
60
60
  },
@@ -62,16 +62,16 @@
62
62
  "default": "standard",
63
63
  "intents": {
64
64
  "standard": {
65
- "variant": "ProductOverview1",
66
- "when": "A straightforward product detail layout: gallery, title, price, add to cart."
65
+ "variant": "ProductOverview",
66
+ "when": "A straightforward product detail layout: gallery, title, price, add to cart (canonical `presentation: 'standard'`)."
67
67
  },
68
68
  "gallery": {
69
- "variant": "ProductOverview2",
70
- "when": "The product needs emphasis on a large image gallery with thumbnails."
69
+ "variant": "ProductOverview",
70
+ "when": "The product needs emphasis on a large image gallery with thumbnails (canonical `presentation: 'gallery'`)."
71
71
  },
72
72
  "rich": {
73
- "variant": "ProductOverview5",
74
- "when": "A detailed product page with tabs, specs, and extensive structured information."
73
+ "variant": "ProductOverview",
74
+ "when": "A detailed product page with tabs, specs, and extensive structured information (canonical `presentation: 'rich'`)."
75
75
  }
76
76
  }
77
77
  },
@@ -92,7 +92,7 @@
92
92
  "default": "review",
93
93
  "intents": {
94
94
  "review": {
95
- "variant": "ShoppingCart4",
95
+ "variant": "ShoppingCart",
96
96
  "when": "A standalone cart review page: line editing plus backend-authoritative totals before checkout."
97
97
  }
98
98
  }
@@ -100,34 +100,30 @@
100
100
  "category.filter": {
101
101
  "default": "sidebar",
102
102
  "intents": {
103
- "inline": {
104
- "variant": "CategoryFilter1",
105
- "when": "A compact inline filter bar above the product grid."
106
- },
107
103
  "sidebar": {
108
- "variant": "CategoryFilter2",
109
- "when": "A left sidebar with facets, price range, and sort controls."
104
+ "variant": "CategoryListing",
105
+ "when": "A persistent left sidebar with filters, price range, and sort controls."
110
106
  },
111
- "rich": {
112
- "variant": "CategoryFilter4",
113
- "when": "Advanced faceted filtering with multiple facet groups and active-filter chips."
107
+ "toolbar": {
108
+ "variant": "CategoryListing",
109
+ "when": "A sticky toolbar with a filter drawer, active-filter chips, and a sort sheet."
114
110
  }
115
111
  }
116
112
  },
117
113
  "checkout.checkout": {
118
- "default": "singlePage",
114
+ "default": "multiStep",
119
115
  "intents": {
120
116
  "singlePage": {
121
- "variant": "CheckoutForm1",
122
- "when": "A single-page checkout combining contact, shipping, and payment."
117
+ "variant": "Checkout",
118
+ "when": "A single-page checkout with contact, shipping, and payment sections visible at once (canonical `presentation: 'single-page'`)."
123
119
  },
124
120
  "multiStep": {
125
- "variant": "CheckoutForm2",
126
- "when": "A stepper checkout split into address, delivery, and payment steps."
121
+ "variant": "Checkout",
122
+ "when": "A step-by-step checkout that shows one step at a time (canonical `presentation: 'stepper'`)."
127
123
  },
128
- "compact": {
129
- "variant": "CheckoutForm3",
130
- "when": "A minimal one-column checkout for fast, low-friction purchase."
124
+ "reviewStep": {
125
+ "variant": "Checkout",
126
+ "when": "A step-by-step checkout that appends a confirmation review before submission (canonical `presentation: 'stepper'` with `showReviewStep`)."
131
127
  }
132
128
  }
133
129
  },
@@ -135,7 +131,7 @@
135
131
  "default": "signIn",
136
132
  "intents": {
137
133
  "signIn": {
138
- "variant": "LoginPage1",
134
+ "variant": "card",
139
135
  "when": "A full sign-in page with email and password and a link to create an account."
140
136
  }
141
137
  }