@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.
Files changed (106) hide show
  1. package/README.md +10 -12
  2. package/assets/templates/app/app/[[...slug]]/page.tsx +14 -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__/handlers.core.ts +3 -3
  16. package/assets/templates/app/lib/__STOREFRONT__/mappers.ts +17 -18
  17. package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.client.tsx +209 -0
  18. package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.ts +247 -0
  19. package/assets/templates/app/lib/__STOREFRONT__/registry.tsx +48 -19
  20. package/assets/templates/app/lib/__STOREFRONT__/schema.ts +49 -11
  21. package/assets/templates/app/lib/__STOREFRONT__/section-sources.ts +3 -5
  22. package/assets/templates/app/lib/__STOREFRONT__/spec/index.ts +25 -0
  23. package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +4 -2
  24. package/assets/templates/app/lib/__STOREFRONT__/views/sections/cta.client.tsx +1 -1
  25. package/assets/templates/app/lib/__STOREFRONT__/views/sections/faq.client.tsx +1 -1
  26. package/assets/templates/app/lib/__STOREFRONT__/views/sections/logoCloud.tsx +1 -1
  27. package/assets/templates/app/lib/__STOREFRONT__/views/sections/pricing.tsx +1 -1
  28. package/assets/templates/app/lib/__STOREFRONT__/views/sections/products.client.tsx +16 -16
  29. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.products.ts +1 -1
  30. package/assets/templates/app/lib/__STOREFRONT__/views/sections/statistics.tsx +1 -1
  31. package/assets/templates/app/lib/__STOREFRONT__/views/sections/testimonials.tsx +1 -1
  32. package/assets/templates/features/customer-auth/handlers.ts +19 -23
  33. package/assets/templates/features/customer-auth/state.ts +21 -0
  34. package/assets/templates/views/account/index.tsx +19 -7
  35. package/assets/templates/views/account/registry.tsx +234 -155
  36. package/assets/templates/views/cart/data.ts +7 -7
  37. package/assets/templates/views/cart/registry.tsx +4 -3
  38. package/assets/templates/views/category/assembly/assembly.json +1 -1
  39. package/assets/templates/views/category/assembly/registry.skeleton.tsx +6 -6
  40. package/assets/templates/views/category/assembly/slots/breadcrumb/Breadcrumb/binding.json +1 -1
  41. package/assets/templates/views/category/registry.tsx +7 -7
  42. package/assets/templates/views/checkout/registry.tsx +3 -5
  43. package/assets/templates/views/home/assembly/assembly.json +4 -4
  44. package/assets/templates/views/home/assembly/index.skeleton.tsx +2 -1
  45. package/assets/templates/views/home/assembly/registry.skeleton.tsx +4 -1
  46. package/assets/templates/views/home/assembly/slots/benefits/cards/binding.json +5 -0
  47. package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/registry.part +7 -1
  48. package/assets/templates/views/home/assembly/slots/benefits/split/binding.json +5 -0
  49. package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/registry.part +6 -1
  50. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/binding.json +5 -0
  51. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/catalog.part +8 -0
  52. package/assets/templates/views/home/assembly/slots/categories/{ProductCategory2 → CategoryGrid}/element.part +1 -1
  53. package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/registry.part +31 -0
  54. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/binding.json +5 -0
  55. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero/catalog.part +4 -0
  56. package/assets/templates/views/home/assembly/slots/hero/{StorefrontHero1 → StorefrontHero}/registry.part +3 -1
  57. package/assets/templates/views/home/content.ts +22 -0
  58. package/assets/templates/views/home/index.tsx +11 -6
  59. package/assets/templates/views/home/props.ts +1 -0
  60. package/assets/templates/views/home/registry.tsx +39 -15
  61. package/assets/templates/views/home/schema.ts +141 -24
  62. package/assets/templates/views/product/data.ts +1 -1
  63. package/assets/templates/views/product/registry.tsx +10 -6
  64. package/assets/templates/views/product/schema.ts +36 -1
  65. package/package.json +4 -5
  66. package/recipes/archetypes.json +25 -25
  67. package/recipes/catalog.json +213 -160
  68. package/recipes/catalog.mjs +10 -0
  69. package/recipes/catalog.schema.json +4 -0
  70. package/recipes/features.json +3 -3
  71. package/recipes/recipes.json +138 -40
  72. package/recipes/sections.json +2 -2
  73. package/recipes/validate.mjs +21 -4
  74. package/scripts/candidate.mjs +2 -2
  75. package/scripts/file-classes.mjs +10 -0
  76. package/scripts/ownership-conflict.mjs +5 -2
  77. package/scripts/view-assembly.mjs +10 -2
  78. package/scripts/view-selection.mjs +1 -1
  79. package/skills/sf-view-gen/assets/recipes/archetypes.json +25 -25
  80. package/skills/sf-view-gen/assets/recipes/catalog.json +213 -160
  81. package/skills/sf-view-gen/assets/recipes/catalog.schema.json +4 -0
  82. package/skills/sf-view-gen/assets/recipes/features.json +3 -3
  83. package/skills/sf-view-gen/assets/recipes/recipes.json +138 -40
  84. package/skills/sf-view-gen/assets/recipes/sections.json +2 -2
  85. package/skills/sf-view-gen/assets/templates/views/sections/cta.client.tsx +1 -1
  86. package/skills/sf-view-gen/assets/templates/views/sections/faq.client.tsx +1 -1
  87. package/skills/sf-view-gen/assets/templates/views/sections/logoCloud.client.tsx +1 -1
  88. package/skills/sf-view-gen/assets/templates/views/sections/pricing.client.tsx +1 -1
  89. package/skills/sf-view-gen/assets/templates/views/sections/products.client.tsx +16 -16
  90. package/skills/sf-view-gen/assets/templates/views/sections/schema.products.ts +1 -1
  91. package/skills/sf-view-gen/assets/templates/views/sections/statistics.client.tsx +1 -1
  92. package/skills/sf-view-gen/assets/templates/views/sections/testimonials.client.tsx +1 -1
  93. package/skills/sf-view-gen/scripts/catalog.mjs +10 -0
  94. package/skills/sf-view-gen/scripts/validate.mjs +21 -4
  95. package/assets/templates/views/home/assembly/slots/benefits/Feature1/binding.json +0 -5
  96. package/assets/templates/views/home/assembly/slots/benefits/Feature2/binding.json +0 -5
  97. package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/binding.json +0 -5
  98. package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/catalog.part +0 -4
  99. package/assets/templates/views/home/assembly/slots/categories/ProductCategory2/registry.part +0 -16
  100. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/binding.json +0 -5
  101. package/assets/templates/views/home/assembly/slots/hero/StorefrontHero1/catalog.part +0 -4
  102. /package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/catalog.part +0 -0
  103. /package/assets/templates/views/home/assembly/slots/benefits/{Feature1 → cards}/element.part +0 -0
  104. /package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/catalog.part +0 -0
  105. /package/assets/templates/views/home/assembly/slots/benefits/{Feature2 → split}/element.part +0 -0
  106. /package/assets/templates/views/home/assembly/slots/hero/{StorefrontHero1 → StorefrontHero}/element.part +0 -0
@@ -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).
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.4.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
  }