@thorprovider/storefront 0.7.0 → 0.9.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 (151) hide show
  1. package/README.md +22 -2
  2. package/assets/templates/AGENTS.md +14 -2
  3. package/assets/templates/app/app/[[...slug]]/page.tsx +9 -2
  4. package/assets/templates/app/lib/__STOREFRONT__/account-address.ts +129 -0
  5. package/assets/templates/app/lib/__STOREFRONT__/account-lifecycle.client.tsx +2 -2
  6. package/assets/templates/app/lib/__STOREFRONT__/account-private.core.ts +143 -0
  7. package/assets/templates/app/lib/__STOREFRONT__/account-profile.ts +220 -0
  8. package/assets/templates/app/lib/__STOREFRONT__/actions.ts +621 -80
  9. package/assets/templates/app/lib/__STOREFRONT__/addresses-port.ts +107 -0
  10. package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +346 -38
  11. package/assets/templates/app/lib/__STOREFRONT__/confirmation.core.ts +240 -0
  12. package/assets/templates/app/lib/__STOREFRONT__/customer-profile-port.ts +103 -0
  13. package/assets/templates/app/lib/__STOREFRONT__/order-detail-port.ts +26 -0
  14. package/assets/templates/app/lib/__STOREFRONT__/orders-port.ts +30 -0
  15. package/assets/templates/app/lib/__STOREFRONT__/ports.ts +18 -0
  16. package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.client.tsx +4 -4
  17. package/assets/templates/app/lib/__STOREFRONT__/session.ts +24 -6
  18. package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +21 -0
  19. package/assets/templates/app/lib/__STOREFRONT__/views/sections/address-book-advanced.client.tsx +29 -0
  20. package/assets/templates/app/lib/__STOREFRONT__/views/sections/checkout-commerce-v1.client.tsx +19 -0
  21. package/assets/templates/app/lib/__STOREFRONT__/views/sections/checkout-commerce-v1.tsx +16 -0
  22. package/assets/templates/app/lib/__STOREFRONT__/views/sections/customer-profile.client.tsx +27 -0
  23. package/assets/templates/app/lib/__STOREFRONT__/views/sections/index.ts +4 -1
  24. package/assets/templates/app/lib/__STOREFRONT__/views/sections/mega-menu-universal.client.tsx +19 -0
  25. package/assets/templates/app/lib/__STOREFRONT__/views/sections/mega-menu-universal.tsx +16 -0
  26. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.address-book-advanced.ts +437 -0
  27. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.checkout-commerce-v1.ts +398 -0
  28. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.customer-profile.ts +138 -0
  29. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.mega-menu-universal.ts +76 -0
  30. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.universal-banner.ts +217 -0
  31. package/assets/templates/app/lib/__STOREFRONT__/views/sections/universal-banner.client.tsx +24 -0
  32. package/assets/templates/app/lib/__STOREFRONT__/views/sections/universal-banner.tsx +16 -0
  33. package/assets/templates/features/checkout/handlers.ts +24 -4
  34. package/assets/templates/features/customer-addresses/handlers.ts +11 -0
  35. package/assets/templates/features/customer-addresses/state.ts +33 -0
  36. package/assets/templates/features/customer-auth/state.ts +10 -0
  37. package/assets/templates/features/customer-profile/handlers.ts +11 -0
  38. package/assets/templates/features/customer-profile/state.ts +18 -0
  39. package/assets/templates/views/account/address-book-advanced.defaults.ts +534 -0
  40. package/assets/templates/views/account/assembly/assembly.json +41 -0
  41. package/assets/templates/views/account/assembly/index.skeleton.tsx +229 -0
  42. package/assets/templates/views/account/assembly/registry.skeleton.tsx +1116 -0
  43. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/binding.json +5 -0
  44. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/catalog.part +4 -0
  45. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/element.part +5 -0
  46. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/registry.part +1 -0
  47. package/assets/templates/views/account/assembly/slots/addresses/cards/catalog.part +5 -0
  48. package/assets/templates/views/account/assembly/slots/addresses/cards/element.part +10 -0
  49. package/assets/templates/views/account/assembly/slots/addresses/cards/registry.part +1 -0
  50. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/catalog.part +5 -0
  51. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/element.part +5 -0
  52. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/registry.part +1 -0
  53. package/assets/templates/views/account/assembly/slots/login/card/catalog.part +4 -0
  54. package/assets/templates/views/account/assembly/slots/login/card/element.part +13 -0
  55. package/assets/templates/views/account/assembly/slots/login/card/registry.part +1 -0
  56. package/assets/templates/views/account/assembly/slots/orders/OrderHistory/catalog.part +5 -0
  57. package/assets/templates/views/account/assembly/slots/orders/OrderHistory/element.part +5 -0
  58. package/assets/templates/views/account/assembly/slots/orders/OrderHistory/registry.part +2 -0
  59. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/binding.json +5 -0
  60. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/catalog.part +5 -0
  61. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/element.part +5 -0
  62. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/registry.part +1 -0
  63. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/binding.json +5 -0
  64. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/catalog.part +4 -0
  65. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/element.part +5 -0
  66. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/registry.part +1 -0
  67. package/assets/templates/views/account/assembly/slots/profile/form/catalog.part +5 -0
  68. package/assets/templates/views/account/assembly/slots/profile/form/element.part +10 -0
  69. package/assets/templates/views/account/assembly/slots/profile/form/registry.part +1 -0
  70. package/assets/templates/views/account/assembly/slots/register/SignUpPage1/catalog.part +4 -0
  71. package/assets/templates/views/account/assembly/slots/register/SignUpPage1/element.part +13 -0
  72. package/assets/templates/views/account/assembly/slots/register/SignUpPage1/registry.part +1 -0
  73. package/assets/templates/views/account/assembly/slots/summary/stack/catalog.part +5 -0
  74. package/assets/templates/views/account/assembly/slots/summary/stack/element.part +5 -0
  75. package/assets/templates/views/account/assembly/slots/summary/stack/registry.part +1 -0
  76. package/assets/templates/views/account/assembly/slots/summary/tabs/catalog.part +5 -0
  77. package/assets/templates/views/account/assembly/slots/summary/tabs/element.part +5 -0
  78. package/assets/templates/views/account/assembly/slots/summary/tabs/registry.part +1 -0
  79. package/assets/templates/views/account/content.ts +326 -0
  80. package/assets/templates/views/account/customer-profile.defaults.ts +136 -0
  81. package/assets/templates/views/account/index.tsx +218 -35
  82. package/assets/templates/views/account/order-detail.client.tsx +35 -0
  83. package/assets/templates/views/account/order-detail.defaults.ts +457 -0
  84. package/assets/templates/views/account/orders-advanced.client.tsx +166 -0
  85. package/assets/templates/views/account/orders-advanced.defaults.ts +230 -0
  86. package/assets/templates/views/account/registry.tsx +944 -369
  87. package/assets/templates/views/account/schema.ts +50 -0
  88. package/assets/templates/views/account/sections-data.ts +2 -0
  89. package/assets/templates/views/cart/content.ts +1 -0
  90. package/assets/templates/views/category/assembly/index.skeleton.tsx +1 -0
  91. package/assets/templates/views/category/assembly/slots/filter/CategoryListing/element.part +1 -0
  92. package/assets/templates/views/category/content.ts +2 -0
  93. package/assets/templates/views/category/index.tsx +2 -0
  94. package/assets/templates/views/category/sections-data.ts +2 -0
  95. package/assets/templates/views/checkout/checkout-commerce-hosted.tsx +1089 -0
  96. package/assets/templates/views/checkout/content.ts +51 -0
  97. package/assets/templates/views/checkout/index.tsx +1 -1
  98. package/assets/templates/views/checkout/props.ts +10 -2
  99. package/assets/templates/views/checkout/registry.tsx +104 -42
  100. package/assets/templates/views/checkout/schema.ts +76 -1
  101. package/assets/templates/views/home/assembly/assembly.json +22 -1
  102. package/assets/templates/views/home/assembly/index.skeleton.tsx +1 -0
  103. package/assets/templates/views/home/content.ts +2 -0
  104. package/assets/templates/views/home/index.tsx +1 -0
  105. package/assets/templates/views/home/sections-data.ts +2 -0
  106. package/assets/templates/views/product/content.ts +1 -0
  107. package/assets/templates/views/static/content.ts +1 -0
  108. package/bin/storefront.js +343 -13
  109. package/package.json +2 -1
  110. package/recipes/adapter-surface.json +158 -0
  111. package/recipes/archetypes.json +38 -3
  112. package/recipes/catalog.json +138 -1
  113. package/recipes/feature.schema.json +9 -0
  114. package/recipes/features.json +72 -1
  115. package/recipes/manifest.schema.json +5 -0
  116. package/recipes/recipe.schema.json +13 -1
  117. package/recipes/recipes.json +34 -5
  118. package/recipes/section.schema.json +112 -0
  119. package/recipes/sections.json +281 -4
  120. package/recipes/validate.mjs +83 -1
  121. package/scripts/adapter-surface.mjs +41 -0
  122. package/scripts/agent-blocks.mjs +700 -0
  123. package/scripts/block-validator.mjs +45 -0
  124. package/scripts/candidate.mjs +5 -4
  125. package/scripts/composers.mjs +7 -2
  126. package/scripts/default-sections.mjs +78 -0
  127. package/scripts/file-classes.mjs +14 -0
  128. package/scripts/generate-adapter-surface.mjs +148 -0
  129. package/scripts/operations.mjs +100 -0
  130. package/scripts/reconcile.mjs +67 -39
  131. package/scripts/section-configure.mjs +316 -0
  132. package/scripts/sync-assets.mjs +1 -0
  133. package/scripts/view-assembly.mjs +101 -14
  134. package/skills/sf-feature/SKILL.md +19 -0
  135. package/skills/sf-view-gen/SKILL.md +73 -7
  136. package/skills/sf-view-gen/assets/recipes/archetypes.json +38 -3
  137. package/skills/sf-view-gen/assets/recipes/catalog.json +138 -1
  138. package/skills/sf-view-gen/assets/recipes/features.json +72 -1
  139. package/skills/sf-view-gen/assets/recipes/recipes.json +34 -5
  140. package/skills/sf-view-gen/assets/recipes/section.schema.json +112 -0
  141. package/skills/sf-view-gen/assets/recipes/sections.json +281 -4
  142. package/skills/sf-view-gen/assets/templates/views/sections/checkout-commerce-v1.client.tsx +19 -0
  143. package/skills/sf-view-gen/assets/templates/views/sections/checkout-commerce-v1.tsx +16 -0
  144. package/skills/sf-view-gen/assets/templates/views/sections/mega-menu-universal.client.tsx +19 -0
  145. package/skills/sf-view-gen/assets/templates/views/sections/mega-menu-universal.tsx +16 -0
  146. package/skills/sf-view-gen/assets/templates/views/sections/schema.checkout-commerce-v1.ts +398 -0
  147. package/skills/sf-view-gen/assets/templates/views/sections/schema.mega-menu-universal.ts +76 -0
  148. package/skills/sf-view-gen/assets/templates/views/sections/schema.universal-banner.ts +217 -0
  149. package/skills/sf-view-gen/assets/templates/views/sections/universal-banner.client.tsx +24 -0
  150. package/skills/sf-view-gen/assets/templates/views/sections/universal-banner.tsx +16 -0
  151. package/skills/sf-view-gen/scripts/validate.mjs +83 -1
@@ -0,0 +1,217 @@
1
+ // Optional section fragment: universal-banner (mirrors recipes/sections.json) — shared contract.
2
+ // Zod mirror of the UniversalBanner block contract (delivery universal-banner, contract version 4.1.0),
3
+ // shared by the server catalog (universal-banner.tsx) and the client registry (universal-banner.client.tsx).
4
+ // The React-only callbacks (onBannerClick, onCtaClick) are intentionally excluded.
5
+
6
+ import { z } from 'zod'
7
+
8
+ export const universalBannerDataSchema = z.object({
9
+ campaign: z.object({
10
+ schemaVersion: z.number(),
11
+ campaignId: z.string(),
12
+ banners: z.array(z.object({
13
+ id: z.string(),
14
+ campaignId: z.string(),
15
+ content: z.object({
16
+ name: z.string(),
17
+ alt: z.string(),
18
+ title: z.string().optional(),
19
+ subtitle: z.string().optional(),
20
+ description: z.string().optional(),
21
+ badge: z.string().optional(),
22
+ target: z.object({
23
+ kind: z.string(),
24
+ id: z.string().optional(),
25
+ slug: z.string().optional(),
26
+ query: z.string().optional(),
27
+ url: z.string().optional(),
28
+ }).optional(),
29
+ ctas: z.array(z.object({
30
+ id: z.string(),
31
+ label: z.string(),
32
+ target: z.object({
33
+ kind: z.string(),
34
+ id: z.string().optional(),
35
+ slug: z.string().optional(),
36
+ query: z.string().optional(),
37
+ url: z.string().optional(),
38
+ }),
39
+ tone: z.enum(["primary", "secondary"]),
40
+ })),
41
+ }),
42
+ media: z.object({
43
+ desktop: z.string().optional(),
44
+ tablet: z.string().optional(),
45
+ mobile: z.string().optional(),
46
+ }),
47
+ presentation: z.object({
48
+ mode: z.enum(["image-only", "overlay", "split"]),
49
+ width: z.enum(["full", "content", "custom"]),
50
+ maxWidth: z.enum(["sm", "md", "lg", "xl"]).optional(),
51
+ height: z.enum(["auto", "fixed", "adaptive"]),
52
+ heightToken: z.enum(["sm", "md", "lg", "xl"]).optional(),
53
+ aspect: z.enum(["square", "video", "photo", "wide", "tall", "natural"]),
54
+ fit: z.enum(["natural", "cover", "contain"]),
55
+ focal: z.enum(["top-left", "top", "top-right", "left", "center", "right", "bottom-left", "bottom", "bottom-right"]),
56
+ align: z.enum(["center", "start", "end"]),
57
+ radius: z.enum(["md", "lg", "xl", "none", "2xl"]),
58
+ surface: z.enum(["primary", "secondary", "none", "card", "muted", "accent"]),
59
+ overlay: z.enum(["none", "scrim", "gradient"]),
60
+ overlayOpacity: z.enum(["light", "medium", "strong"]),
61
+ padding: z.enum(["sm", "md", "lg", "none"]),
62
+ textScale: z.enum(["sm", "md", "lg"]),
63
+ splitSide: z.enum(["media-start", "media-end"]).optional(),
64
+ hiddenFields: z.array(z.string()).optional(),
65
+ }),
66
+ responsive: z.object({
67
+ md: z.object({
68
+ mode: z.enum(["image-only", "overlay", "split"]).optional(),
69
+ width: z.enum(["full", "content", "custom"]).optional(),
70
+ maxWidth: z.enum(["sm", "md", "lg", "xl"]).optional(),
71
+ height: z.enum(["auto", "fixed", "adaptive"]).optional(),
72
+ heightToken: z.enum(["sm", "md", "lg", "xl"]).optional(),
73
+ aspect: z.enum(["square", "video", "photo", "wide", "tall", "natural"]).optional(),
74
+ fit: z.enum(["natural", "cover", "contain"]).optional(),
75
+ focal: z.enum(["top-left", "top", "top-right", "left", "center", "right", "bottom-left", "bottom", "bottom-right"]).optional(),
76
+ align: z.enum(["center", "start", "end"]).optional(),
77
+ radius: z.enum(["md", "lg", "xl", "none", "2xl"]).optional(),
78
+ surface: z.enum(["primary", "secondary", "none", "card", "muted", "accent"]).optional(),
79
+ overlay: z.enum(["none", "scrim", "gradient"]).optional(),
80
+ overlayOpacity: z.enum(["light", "medium", "strong"]).optional(),
81
+ padding: z.enum(["sm", "md", "lg", "none"]).optional(),
82
+ textScale: z.enum(["sm", "md", "lg"]).optional(),
83
+ splitSide: z.enum(["media-start", "media-end"]).optional(),
84
+ hiddenFields: z.array(z.string()).optional(),
85
+ }).optional(),
86
+ "2xl": z.object({
87
+ mode: z.enum(["image-only", "overlay", "split"]).optional(),
88
+ width: z.enum(["full", "content", "custom"]).optional(),
89
+ maxWidth: z.enum(["sm", "md", "lg", "xl"]).optional(),
90
+ height: z.enum(["auto", "fixed", "adaptive"]).optional(),
91
+ heightToken: z.enum(["sm", "md", "lg", "xl"]).optional(),
92
+ aspect: z.enum(["square", "video", "photo", "wide", "tall", "natural"]).optional(),
93
+ fit: z.enum(["natural", "cover", "contain"]).optional(),
94
+ focal: z.enum(["top-left", "top", "top-right", "left", "center", "right", "bottom-left", "bottom", "bottom-right"]).optional(),
95
+ align: z.enum(["center", "start", "end"]).optional(),
96
+ radius: z.enum(["md", "lg", "xl", "none", "2xl"]).optional(),
97
+ surface: z.enum(["primary", "secondary", "none", "card", "muted", "accent"]).optional(),
98
+ overlay: z.enum(["none", "scrim", "gradient"]).optional(),
99
+ overlayOpacity: z.enum(["light", "medium", "strong"]).optional(),
100
+ padding: z.enum(["sm", "md", "lg", "none"]).optional(),
101
+ textScale: z.enum(["sm", "md", "lg"]).optional(),
102
+ splitSide: z.enum(["media-start", "media-end"]).optional(),
103
+ hiddenFields: z.array(z.string()).optional(),
104
+ }).optional(),
105
+ base: z.object({
106
+ mode: z.enum(["image-only", "overlay", "split"]).optional(),
107
+ width: z.enum(["full", "content", "custom"]).optional(),
108
+ maxWidth: z.enum(["sm", "md", "lg", "xl"]).optional(),
109
+ height: z.enum(["auto", "fixed", "adaptive"]).optional(),
110
+ heightToken: z.enum(["sm", "md", "lg", "xl"]).optional(),
111
+ aspect: z.enum(["square", "video", "photo", "wide", "tall", "natural"]).optional(),
112
+ fit: z.enum(["natural", "cover", "contain"]).optional(),
113
+ focal: z.enum(["top-left", "top", "top-right", "left", "center", "right", "bottom-left", "bottom", "bottom-right"]).optional(),
114
+ align: z.enum(["center", "start", "end"]).optional(),
115
+ radius: z.enum(["md", "lg", "xl", "none", "2xl"]).optional(),
116
+ surface: z.enum(["primary", "secondary", "none", "card", "muted", "accent"]).optional(),
117
+ overlay: z.enum(["none", "scrim", "gradient"]).optional(),
118
+ overlayOpacity: z.enum(["light", "medium", "strong"]).optional(),
119
+ padding: z.enum(["sm", "md", "lg", "none"]).optional(),
120
+ textScale: z.enum(["sm", "md", "lg"]).optional(),
121
+ splitSide: z.enum(["media-start", "media-end"]).optional(),
122
+ hiddenFields: z.array(z.string()).optional(),
123
+ }).optional(),
124
+ }).optional(),
125
+ schedule: z.object({
126
+ from: z.string().optional(),
127
+ to: z.string().optional(),
128
+ timezone: z.string(),
129
+ }).optional(),
130
+ visible: z.boolean(),
131
+ })),
132
+ }),
133
+ config: z.object({
134
+ schemaVersion: z.number(),
135
+ blockId: z.string(),
136
+ name: z.string(),
137
+ visible: z.boolean(),
138
+ schedule: z.object({
139
+ from: z.string().optional(),
140
+ to: z.string().optional(),
141
+ timezone: z.string(),
142
+ }).optional(),
143
+ scheduleAware: z.boolean(),
144
+ responsiveEnabled: z.boolean(),
145
+ presentation: z.enum(["single", "grid", "carousel"]),
146
+ preset: z.enum(["custom", "one", "two", "three", "four", "mosaic", "hero-two", "hero-three"]),
147
+ refs: z.array(z.object({
148
+ bannerId: z.string(),
149
+ overrides: z.object({
150
+ mode: z.enum(["image-only", "overlay", "split"]).optional(),
151
+ width: z.enum(["full", "content", "custom"]).optional(),
152
+ maxWidth: z.enum(["sm", "md", "lg", "xl"]).optional(),
153
+ height: z.enum(["auto", "fixed", "adaptive"]).optional(),
154
+ heightToken: z.enum(["sm", "md", "lg", "xl"]).optional(),
155
+ aspect: z.enum(["square", "video", "photo", "wide", "tall", "natural"]).optional(),
156
+ fit: z.enum(["natural", "cover", "contain"]).optional(),
157
+ focal: z.enum(["top-left", "top", "top-right", "left", "center", "right", "bottom-left", "bottom", "bottom-right"]).optional(),
158
+ align: z.enum(["center", "start", "end"]).optional(),
159
+ radius: z.enum(["md", "lg", "xl", "none", "2xl"]).optional(),
160
+ surface: z.enum(["primary", "secondary", "none", "card", "muted", "accent"]).optional(),
161
+ overlay: z.enum(["none", "scrim", "gradient"]).optional(),
162
+ overlayOpacity: z.enum(["light", "medium", "strong"]).optional(),
163
+ padding: z.enum(["sm", "md", "lg", "none"]).optional(),
164
+ textScale: z.enum(["sm", "md", "lg"]).optional(),
165
+ splitSide: z.enum(["media-start", "media-end"]).optional(),
166
+ hiddenFields: z.array(z.string()).optional(),
167
+ }).optional(),
168
+ })),
169
+ layout: z.object({
170
+ gapX: z.enum(["sm", "md", "lg", "xl", "none"]),
171
+ gapY: z.enum(["sm", "md", "lg", "xl", "none"]),
172
+ maxWidth: z.enum(["full", "sm", "md", "lg", "xl"]),
173
+ maxHeight: z.enum(["sm", "md", "lg", "xl", "none"]),
174
+ align: z.enum(["center", "start", "end"]),
175
+ radius: z.enum(["md", "lg", "xl", "none", "2xl"]),
176
+ columns: z.object({
177
+ md: z.number(),
178
+ "2xl": z.number(),
179
+ base: z.number(),
180
+ }).optional(),
181
+ spans: z.array(z.number()).optional(),
182
+ }),
183
+ carousel: z.object({
184
+ visible: z.object({
185
+ md: z.number(),
186
+ "2xl": z.number(),
187
+ base: z.number(),
188
+ }),
189
+ autoplay: z.boolean(),
190
+ intervalMs: z.number(),
191
+ loop: z.boolean(),
192
+ indicators: z.boolean(),
193
+ carouselOnMobile: z.boolean(),
194
+ peek: z.boolean(),
195
+ story: z.boolean(),
196
+ }),
197
+ rules: z.object({
198
+ emptyLabel: z.string(),
199
+ inactiveLabel: z.string(),
200
+ danglingLabel: z.string(),
201
+ }),
202
+ }),
203
+ now: z.string(),
204
+ banner: z.object({
205
+ carouselPrevious: z.string(),
206
+ carouselNext: z.string(),
207
+ carouselStatus: z.string(),
208
+ carouselRole: z.string(),
209
+ storyPrevious: z.string(),
210
+ storyNext: z.string(),
211
+ storyRole: z.string(),
212
+ }),
213
+ })
214
+
215
+ export const universalBannerPropsSchema = z.object({
216
+ data: universalBannerDataSchema,
217
+ })
@@ -0,0 +1,24 @@
1
+ 'use client'
2
+
3
+ // Optional section fragment: universal-banner (mirrors recipes/sections.json) — client registry.
4
+ // The matching server-side catalog lives in universal-banner.tsx. @thorprovider/blocks ships a
5
+ // 'use client' boundary, but this fragment keeps the explicit client boundary so
6
+ // the section composes identically in any consumer graph.
7
+
8
+ import { useEffect, useState } from 'react'
9
+ import { UniversalBanner } from '@thorprovider/blocks'
10
+ import { universalBannerPropsSchema } from './schema.universal-banner'
11
+ import type { ViewRegistry } from '../types'
12
+
13
+ export const universalBannerRegistry: ViewRegistry = {
14
+ UniversalBanner: ({ props }) => {
15
+ const parsed = universalBannerPropsSchema.parse(props)
16
+ const [now, setNow] = useState(parsed.data.now)
17
+ useEffect(() => {
18
+ setNow(new Date().toISOString())
19
+ }, [])
20
+ return (
21
+ <UniversalBanner data={{ ...parsed.data, now }} />
22
+ )
23
+ },
24
+ }
@@ -0,0 +1,16 @@
1
+ // Optional section fragment: universal-banner (mirrors recipes/sections.json)
2
+ // Server-side part: element type + zod catalog entry. The component mappings
3
+ // live in universal-banner.client.tsx ('use client') and are composed via composeSections.
4
+
5
+ import { universalBannerPropsSchema } from './schema.universal-banner'
6
+
7
+ export const universalBannerSection = {
8
+ elementType: 'UniversalBanner',
9
+ catalog: {
10
+ UniversalBanner: {
11
+ props: universalBannerPropsSchema,
12
+ description: 'UniversalBanner presentation section (delivery universal-banner).',
13
+ },
14
+ },
15
+ registryModule: './universal-banner.client',
16
+ }
@@ -78,8 +78,14 @@ export function useCheckoutHandlers() {
78
78
  // A confirmed, persisted order — observed only on a genuine order result
79
79
  // (not captured funds) and only when a section origin exists.
80
80
  recordConfirmedTransition('order_confirmed')
81
- // ONE atomic write carries the order and its backend lines.
82
- set('/lastReceipt', { order: result.order, lines: result.lines })
81
+ // ONE atomic write carries the order, its backend lines and the
82
+ // host-confirmed confirmation model, so the designer confirmation
83
+ // survives a reload without browser-only state.
84
+ set('/lastReceipt', {
85
+ order: result.order,
86
+ lines: result.lines,
87
+ confirmation: result.confirmation,
88
+ })
83
89
  set('/orderStatus', 'complete')
84
90
  set('/checkoutError', null)
85
91
  set('/checkoutErrorKind', null)
@@ -97,6 +103,10 @@ export function useCheckoutHandlers() {
97
103
  set('/checkoutShippingState', 'idle')
98
104
  return
99
105
  }
106
+ if (result.code === 'AUTH_REQUIRED') {
107
+ navigate('/account')
108
+ return
109
+ }
100
110
  // error | cart-error | unresolved. `orderStatus` only carries the UI
101
111
  // states; the native discriminator is preserved in `checkoutErrorKind`.
102
112
  // The active cart is NEVER cleared here, so a cart-with-error keeps its
@@ -209,13 +219,23 @@ export function useCheckoutHandlers() {
209
219
  set('/checkoutErrorKind', 'error')
210
220
  return
211
221
  }
222
+ const paymentMethodId =
223
+ typeof get('/checkout/paymentMethod') === 'string'
224
+ ? (get('/checkout/paymentMethod') as string)
225
+ : ''
226
+ if (!paymentMethodId) {
227
+ set('/checkoutPending', false)
228
+ set('/checkoutError', 'Selecciona un método de pago antes de confirmar.')
229
+ set('/checkoutErrorKind', 'error')
230
+ return
231
+ }
212
232
  set('/checkoutPending', true)
213
233
  set('/checkoutError', null)
214
234
  set('/checkoutErrorKind', null)
215
235
  set('/cartNotice', null)
216
236
  const request = selections
217
- ? placeOrderAction({ shippingGroups: selections })
218
- : placeOrderAction()
237
+ ? placeOrderAction({ shippingGroups: selections, paymentMethodId })
238
+ : placeOrderAction({ paymentMethodId })
219
239
  void request.then(applyResult).catch(onError('placeOrder'))
220
240
  },
221
241
  reconcileOrder: () => {
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+
3
+ // Generated by Thor Commerce storefront (feature: customer-addresses — handlers)
4
+ // The addresses module is driven by the account view registry (it calls the
5
+ // account Server Actions directly and keeps its pending/error state in the
6
+ // shared store). The handlers composer requires one hook per installed feature,
7
+ // so this module is intentionally a no-op: no global action needs registering.
8
+
9
+ export function useCustomerAddressesHandlers() {
10
+ return
11
+ }
@@ -0,0 +1,33 @@
1
+ // Generated by Thor Commerce storefront (feature: customer-addresses — state slice)
2
+ // The customer-addresses capability's state. Installed only when the feature is in
3
+ // the manifest, so `accountAddressesAvailable` is the presence flag the account
4
+ // view reads: absent (undefined) means no address module, no navigation entry,
5
+ // and no address read.
6
+
7
+ import type { AccountAddressView } from '../../state.core'
8
+
9
+ export interface CustomerAddressesState {
10
+ /** Present only while the feature is installed. */
11
+ accountAddressesAvailable: boolean
12
+ accountAddresses: AccountAddressView[]
13
+ accountAddressesPending: boolean
14
+ accountAddressesError: string | null
15
+ /** The add/edit form is open when an id or the create flag is set. */
16
+ accountAddressFormOpen: boolean
17
+ accountAddressEditingId: string | null
18
+ accountAddressMutationPending: boolean
19
+ accountAddressMutationError: string | null
20
+ accountAddressFieldErrors: Record<string, string>
21
+ }
22
+
23
+ export const customerAddressesState: CustomerAddressesState = {
24
+ accountAddressesAvailable: true,
25
+ accountAddresses: [],
26
+ accountAddressesPending: false,
27
+ accountAddressesError: null,
28
+ accountAddressFormOpen: false,
29
+ accountAddressEditingId: null,
30
+ accountAddressMutationPending: false,
31
+ accountAddressMutationError: null,
32
+ accountAddressFieldErrors: {},
33
+ }
@@ -18,6 +18,14 @@ export interface CustomerAuthState {
18
18
  accountResolution: AccountResolution | 'unresolved'
19
19
  /** Which auth surface is mounted: the sign-in page or the registration page. */
20
20
  accountMode: 'login' | 'register'
21
+ /**
22
+ * The account area's current shape, seeded by the frame from its generation
23
+ * selection. `stack` renders every installed module in order; `tabs` shows one
24
+ * at a time. Client-owned so an RSC refresh never resets the active tab.
25
+ */
26
+ accountShape: 'stack' | 'tabs'
27
+ /** The module shown in the tabbed shape; null in the stacked shape. */
28
+ accountTab: string | null
21
29
  accountPending: boolean
22
30
  /**
23
31
  * True while a cross-tab invalidation or a foreground/resume recheck is in
@@ -48,6 +56,8 @@ export const customerAuthState: CustomerAuthState = {
48
56
  accountAuthenticated: false,
49
57
  accountResolution: 'unresolved',
50
58
  accountMode: 'login',
59
+ accountShape: 'stack',
60
+ accountTab: null,
51
61
  accountPending: false,
52
62
  accountReconciling: false,
53
63
  accountError: null,
@@ -0,0 +1,11 @@
1
+ 'use client'
2
+
3
+ // Generated by Thor Commerce storefront (feature: customer-profile — handlers)
4
+ // The profile module is driven by the account view registry (it calls the
5
+ // account Server Actions directly and keeps its pending/error state in the
6
+ // shared store). The handlers composer requires one hook per installed feature,
7
+ // so this module is intentionally a no-op: no global action needs registering.
8
+
9
+ export function useCustomerProfileHandlers() {
10
+ return
11
+ }
@@ -0,0 +1,18 @@
1
+ // Generated by Thor Commerce storefront (feature: customer-profile — state slice)
2
+ // The customer-profile capability's state. Installed only when the feature is in
3
+ // the manifest, so `accountProfileAvailable` is the presence flag the account
4
+ // view reads: absent (undefined) means the module does not render and performs
5
+ // no profile read.
6
+
7
+ export interface CustomerProfileState {
8
+ /** Present only while the feature is installed. */
9
+ accountProfileAvailable: boolean
10
+ accountProfilePending: boolean
11
+ accountProfileError: string | null
12
+ }
13
+
14
+ export const customerProfileState: CustomerProfileState = {
15
+ accountProfileAvailable: true,
16
+ accountProfilePending: false,
17
+ accountProfileError: null,
18
+ }