@thorprovider/storefront 0.15.0 → 0.15.2

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 (28) hide show
  1. package/README.md +9 -4
  2. package/assets/templates/app/app/[[...slug]]/page.tsx +22 -4
  3. package/assets/templates/app/app/layout.tsx +2 -2
  4. package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +11 -4
  5. package/assets/templates/app/lib/__STOREFRONT__/confirmation.core.ts +7 -4
  6. package/assets/templates/app/lib/__STOREFRONT__/header-universal.ts +363 -0
  7. package/assets/templates/app/lib/__STOREFRONT__/registry.tsx +49 -1
  8. package/assets/templates/app/lib/__STOREFRONT__/schema.ts +52 -0
  9. package/assets/templates/app/lib/__STOREFRONT__/shell/content.ts +43 -0
  10. package/assets/templates/app/lib/__STOREFRONT__/shell/props.ts +4 -0
  11. package/assets/templates/app/lib/__STOREFRONT__/spec/index.ts +16 -43
  12. package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +8 -0
  13. package/assets/templates/app/lib/__STOREFRONT__/store-context.ts +84 -18
  14. package/assets/templates/app/lib/__STOREFRONT__/views/sections/header-universal.client.tsx +33 -0
  15. package/assets/templates/app/lib/__STOREFRONT__/views/sections/header-universal.tsx +16 -0
  16. package/assets/templates/app/lib/__STOREFRONT__/views/sections/index.ts +2 -1
  17. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.header-universal.ts +360 -0
  18. package/assets/templates/views/cart/registry.tsx +9 -0
  19. package/assets/templates/views/checkout/checkout-commerce-hosted.tsx +5 -1
  20. package/package.json +1 -1
  21. package/recipes/sections.json +18 -0
  22. package/scripts/candidate.mjs +2 -2
  23. package/scripts/env-file.mjs +5 -0
  24. package/scripts/file-classes.mjs +7 -2
  25. package/skills/sf-view-gen/assets/recipes/sections.json +18 -0
  26. package/skills/sf-view-gen/assets/templates/views/sections/header-universal.client.tsx +33 -0
  27. package/skills/sf-view-gen/assets/templates/views/sections/header-universal.tsx +16 -0
  28. package/skills/sf-view-gen/assets/templates/views/sections/schema.header-universal.ts +360 -0
@@ -0,0 +1,360 @@
1
+ // Optional section fragment: header-universal (mirrors recipes/sections.json) — shared contract.
2
+ // Zod mirror of the HeaderUniversal block contract (delivery header-universal),
3
+ // shared by the server catalog (header-universal.tsx) and the client registry
4
+ // (header-universal.client.tsx). The React-only callback (`onAction`) is
5
+ // intentionally excluded; the runtime commerce data (`context.cart`,
6
+ // `context.account`, …) is carried through `context` exactly as the host feeds
7
+ // it, so the section serializes the same shape the block renders.
8
+
9
+ import { z } from 'zod'
10
+ import { universalMainMenuDataSchema } from './schema.universal-main-menu'
11
+
12
+ const surfaceToken = z.enum(['transparent', 'background', 'card', 'muted', 'primary', 'accent'])
13
+ const accentToken = z.enum(['none', 'primary', 'accent', 'success'])
14
+ const densityToken = z.enum(['compact', 'comfortable'])
15
+ const radiusToken = z.enum(['none', 'sm', 'md', 'lg', 'xl'])
16
+ const spaceToken = z.enum(['none', 'xs', 'sm', 'md', 'lg', 'xl'])
17
+ const heightToken = z.enum(['xs', 'sm', 'md', 'lg', 'xl'])
18
+ const borderToken = z.enum(['none', 'bottom', 'top', 'all'])
19
+ const shadowToken = z.enum(['none', 'sm', 'md'])
20
+ const positionToken = z.enum(['static', 'sticky', 'fixed'])
21
+ const breakpointToken = z.enum(['base', 'md', '2xl'])
22
+ const zoneName = z.enum(['start', 'center', 'end'])
23
+ const presetId = z.enum(['commerce', 'minimal', 'marketplace', 'b2b', 'checkout', 'landing'])
24
+ const contextKind = z.enum(['guest', 'authenticated', 'b2b', 'checkout', 'landing'])
25
+ const pageKind = z.enum(['home', 'category', 'product', 'checkout', 'account', 'landing'])
26
+
27
+ const moduleType = z.enum([
28
+ 'logo',
29
+ 'navigation',
30
+ 'search',
31
+ 'cart',
32
+ 'account',
33
+ 'wishlist',
34
+ 'region',
35
+ 'language',
36
+ 'location',
37
+ 'organization',
38
+ 'announcement',
39
+ 'promotion-progress',
40
+ 'support',
41
+ 'notifications',
42
+ 'spacer',
43
+ 'divider',
44
+ 'text-label',
45
+ 'custom-link',
46
+ 'custom-button',
47
+ 'icon-action',
48
+ 'main-menu',
49
+ ])
50
+
51
+ const capabilityId = z.enum([
52
+ 'catalog',
53
+ 'catalog-search',
54
+ 'checkout',
55
+ 'customer-account',
56
+ 'saved-items',
57
+ 'reviews',
58
+ 'recommendations',
59
+ 'newsletter',
60
+ 'b2b',
61
+ 'notifications',
62
+ 'promotions',
63
+ 'locations',
64
+ ])
65
+
66
+ const headerActionName = z.enum([
67
+ 'navigate',
68
+ 'openCart',
69
+ 'closeCart',
70
+ 'goToCart',
71
+ 'goToCheckout',
72
+ 'openSearch',
73
+ 'closeSearch',
74
+ 'openAccount',
75
+ 'closeAccount',
76
+ 'openNotifications',
77
+ 'login',
78
+ 'register',
79
+ 'logout',
80
+ 'selectRegion',
81
+ 'selectLanguage',
82
+ 'selectLocation',
83
+ 'selectOrganization',
84
+ 'openComponent',
85
+ 'closeComponent',
86
+ 'changeCartQuantity',
87
+ 'removeCartLine',
88
+ 'selectNotification',
89
+ 'dismissAnnouncement',
90
+ ])
91
+
92
+ const modulePropsSchema = z.record(z.union([z.string(), z.number(), z.boolean()]))
93
+
94
+ const themeSchema = z.object({
95
+ surface: surfaceToken,
96
+ accent: accentToken,
97
+ density: densityToken,
98
+ radius: radiusToken,
99
+ })
100
+
101
+ const behaviorSchema = z.object({
102
+ position: positionToken,
103
+ transparent: z.boolean(),
104
+ overHero: z.boolean(),
105
+ scrolledSurface: z.boolean(),
106
+ compactOnScroll: z.boolean(),
107
+ hideOnScrollDown: z.boolean(),
108
+ showOnScrollUp: z.boolean(),
109
+ threshold: z.number(),
110
+ zIndex: z.number(),
111
+ reducedMotion: z.boolean(),
112
+ })
113
+
114
+ const rowStyleSchema = z.object({
115
+ minHeight: heightToken,
116
+ maxHeight: z.union([heightToken, z.literal('none')]),
117
+ paddingX: spaceToken,
118
+ paddingY: spaceToken,
119
+ gap: spaceToken,
120
+ align: z.enum(['start', 'center', 'end']),
121
+ justify: z.enum(['start', 'center', 'between', 'end']),
122
+ maxWidth: z.enum(['full', 'sm', 'md', 'lg', 'xl']),
123
+ surface: surfaceToken,
124
+ border: borderToken,
125
+ shadow: shadowToken,
126
+ separator: z.boolean(),
127
+ })
128
+
129
+ const headerActionSchema = z.object({
130
+ name: headerActionName,
131
+ payload: modulePropsSchema.optional(),
132
+ })
133
+
134
+ const moduleSchema = z.object({
135
+ id: z.string(),
136
+ type: moduleType,
137
+ enabled: z.boolean(),
138
+ requires: capabilityId.optional(),
139
+ props: modulePropsSchema,
140
+ style: z
141
+ .object({
142
+ surface: surfaceToken.optional(),
143
+ size: z.enum(['sm', 'md', 'lg']).optional(),
144
+ emphasis: z.enum(['none', 'accent']).optional(),
145
+ })
146
+ .optional(),
147
+ visibility: z
148
+ .object({
149
+ breakpoints: z.array(breakpointToken).optional(),
150
+ contexts: z.array(contextKind).optional(),
151
+ })
152
+ .optional(),
153
+ responsive: z
154
+ .record(
155
+ breakpointToken,
156
+ z.object({
157
+ row: z.string().optional(),
158
+ zone: zoneName.optional(),
159
+ order: z.number().optional(),
160
+ hidden: z.boolean().optional(),
161
+ props: modulePropsSchema.optional(),
162
+ }),
163
+ )
164
+ .optional(),
165
+ bindings: z.record(z.string(), z.string()).optional(),
166
+ actions: z.record(z.string(), headerActionSchema).optional(),
167
+ })
168
+
169
+ const rowSchema = rowStyleSchema.extend({
170
+ id: z.string(),
171
+ enabled: z.boolean(),
172
+ zones: z.record(zoneName, z.array(z.string())),
173
+ responsive: z
174
+ .record(
175
+ breakpointToken,
176
+ rowStyleSchema
177
+ .partial()
178
+ .extend({
179
+ zones: z.record(zoneName, z.array(z.string()).optional()).optional(),
180
+ hidden: z.boolean().optional(),
181
+ }),
182
+ )
183
+ .optional(),
184
+ })
185
+
186
+ const visibilityRuleSchema = z.object({
187
+ id: z.string(),
188
+ target: z.object({
189
+ rows: z.array(z.string()).optional(),
190
+ modules: z.array(z.string()).optional(),
191
+ }),
192
+ when: z.object({
193
+ capability: capabilityId.optional(),
194
+ context: contextKind.optional(),
195
+ page: pageKind.optional(),
196
+ from: z.string().optional(),
197
+ to: z.string().optional(),
198
+ }),
199
+ mode: z.literal('hide'),
200
+ })
201
+
202
+ export const headerConfigSchema = z.object({
203
+ schemaVersion: z.number(),
204
+ id: z.string(),
205
+ name: z.string(),
206
+ preset: presetId,
207
+ theme: themeSchema,
208
+ behavior: behaviorSchema,
209
+ layout: z.array(rowSchema),
210
+ modules: z.array(moduleSchema),
211
+ capabilities: z.record(capabilityId, z.boolean().optional()),
212
+ visibilityRules: z.array(visibilityRuleSchema),
213
+ fallbacks: z.object({
214
+ missingCapability: z.enum(['hide', 'placeholder']),
215
+ missingImage: z.enum(['fallback', 'label']),
216
+ missingAction: z.enum(['disable', 'hide']),
217
+ }),
218
+ analytics: z.object({ events: z.array(z.string()) }).optional(),
219
+ })
220
+
221
+ const moneySchema = z.object({ amount: z.string(), currencyCode: z.string() })
222
+
223
+ const brandSchema = z.object({
224
+ name: z.string(),
225
+ href: z.string(),
226
+ logo: z.string().optional(),
227
+ logoLight: z.string().optional(),
228
+ logoDark: z.string().optional(),
229
+ accent: z.string().optional(),
230
+ })
231
+
232
+ const cartStateKind = z.enum(['ready', 'empty', 'loading', 'error'])
233
+ const accountStateKind = z.enum(['guest', 'authenticated', 'loading', 'expired', 'error'])
234
+
235
+ const cartLineSchema = z.object({
236
+ id: z.string(),
237
+ name: z.string(),
238
+ price: z.number(),
239
+ quantity: z.number(),
240
+ variant: z.string().optional(),
241
+ image: z.string().optional(),
242
+ unitPrice: moneySchema.optional(),
243
+ lineTotal: moneySchema.optional(),
244
+ })
245
+
246
+ const headerCartSchema = z.object({
247
+ state: cartStateKind,
248
+ lines: z.array(cartLineSchema),
249
+ totals: z
250
+ .object({
251
+ subtotal: moneySchema,
252
+ total: moneySchema,
253
+ discount: moneySchema.optional(),
254
+ tax: moneySchema.optional(),
255
+ shipping: moneySchema.optional(),
256
+ })
257
+ .optional(),
258
+ quantity: z.number(),
259
+ lineCount: z.number(),
260
+ currency: z.string(),
261
+ shippingGroups: z.number(),
262
+ shippingNote: z.string().optional(),
263
+ subtotalUnavailableLabel: z.string(),
264
+ promotions: z.array(z.string()),
265
+ error: z.string().optional(),
266
+ })
267
+
268
+ const accountUserSchema = z.object({
269
+ email: z.string(),
270
+ name: z.string(),
271
+ initials: z.string(),
272
+ avatar: z.string().optional(),
273
+ })
274
+
275
+ const accountMenuItemSchema = z.object({
276
+ label: z.string(),
277
+ href: z.string(),
278
+ icon: z.enum(['orders', 'wishlist', 'addresses', 'settings']).optional(),
279
+ description: z.string().optional(),
280
+ })
281
+
282
+ const headerAccountSchema = z.object({
283
+ state: accountStateKind,
284
+ user: accountUserSchema.optional(),
285
+ menu: z.array(accountMenuItemSchema),
286
+ error: z.string().optional(),
287
+ })
288
+
289
+ const headerContextSchema = z.object({
290
+ brand: brandSchema,
291
+ menu: universalMainMenuDataSchema.optional(),
292
+ cart: headerCartSchema,
293
+ account: headerAccountSchema,
294
+ wishlist: z.object({ count: z.number(), lists: z.number() }),
295
+ regions: z.object({
296
+ activeId: z.string(),
297
+ options: z.array(z.object({ id: z.string(), label: z.string(), currencyCode: z.string() })),
298
+ }),
299
+ languages: z.object({
300
+ activeCode: z.string(),
301
+ options: z.array(z.object({ code: z.string(), label: z.string() })),
302
+ }),
303
+ locations: z.object({
304
+ activeId: z.string().optional(),
305
+ enabled: z.boolean(),
306
+ options: z.array(z.object({ id: z.string(), label: z.string(), detail: z.string().optional() })),
307
+ }),
308
+ organization: z
309
+ .object({
310
+ activeId: z.string(),
311
+ options: z.array(
312
+ z.object({
313
+ id: z.string(),
314
+ name: z.string(),
315
+ role: z.string(),
316
+ permissions: z.array(z.string()),
317
+ }),
318
+ ),
319
+ })
320
+ .optional(),
321
+ announcements: z.array(
322
+ z.object({
323
+ id: z.string(),
324
+ message: z.string(),
325
+ href: z.string().optional(),
326
+ linkLabel: z.string().optional(),
327
+ tone: z.enum(['info', 'accent', 'muted']),
328
+ from: z.string().optional(),
329
+ to: z.string().optional(),
330
+ dismissible: z.boolean(),
331
+ }),
332
+ ),
333
+ promotion: z
334
+ .object({
335
+ state: z.enum(['not-eligible', 'in-progress', 'complete']),
336
+ threshold: z.string().optional(),
337
+ current: z.string().optional(),
338
+ remaining: z.string().optional(),
339
+ message: z.string().optional(),
340
+ })
341
+ .optional(),
342
+ notifications: z.object({
343
+ available: z.boolean(),
344
+ unread: z.number(),
345
+ items: z.array(z.object({ id: z.string(), title: z.string(), href: z.string(), read: z.boolean() })),
346
+ }),
347
+ openComponents: z.array(z.string()),
348
+ now: z.string(),
349
+ capabilities: z.record(capabilityId, z.boolean().optional()),
350
+ context: contextKind,
351
+ page: pageKind,
352
+ })
353
+
354
+ export const universalHeaderPropsSchema = z.object({
355
+ config: headerConfigSchema,
356
+ context: headerContextSchema,
357
+ labels: z.record(z.string(), z.record(z.string(), z.string())).optional(),
358
+ breakpoint: breakpointToken.optional(),
359
+ className: z.string().optional(),
360
+ })
@@ -11,6 +11,7 @@ import ShoppingCart from '@thorprovider/blocks/blocks/e-commerce/shopping-carts/
11
11
  import { isAvailableMoney } from '@thorprovider/blocks/contracts'
12
12
  import { useStateStore } from '@json-render/react'
13
13
  import { checkoutAvailable } from '../../composition'
14
+ import { createStoreMoneyFormatter, DEFAULT_STORE_LOCALE } from '../../store-context'
14
15
  import type { ViewRegistry } from '../types'
15
16
  import { toCartViewItems } from './data'
16
17
  import { cartViewPropsSchema } from './schema'
@@ -20,6 +21,13 @@ export const registry: ViewRegistry = {
20
21
  const { state, set } = useStateStore()
21
22
  const parsed = cartViewPropsSchema.parse(props)
22
23
  const cart = parsed.items
24
+ // The same store-locale formatter the shell chrome uses, so the cart page
25
+ // and the cart sheet render one Money identically (design D4).
26
+ const storeLocale =
27
+ typeof state.storeLocale === 'string' && state.storeLocale.trim() !== ''
28
+ ? state.storeLocale
29
+ : DEFAULT_STORE_LOCALE
30
+ const formatMoney = createStoreMoneyFormatter(storeLocale)
23
31
  const cartError = typeof state.cartError === 'string' ? state.cartError : undefined
24
32
  const readError = typeof state.cartReadError === 'string' ? state.cartReadError : undefined
25
33
  const isPending = state.cartPending === true
@@ -55,6 +63,7 @@ export const registry: ViewRegistry = {
55
63
  items={toCartViewItems(cart)}
56
64
  promotions={[]}
57
65
  totals={parsed.totals ?? undefined}
66
+ formatMoney={formatMoney}
58
67
  totalsState={totalsState}
59
68
  totalsErrorLabel={errorLabel}
60
69
  titleLabel={parsed.titleLabel}
@@ -58,6 +58,8 @@ export type HostedCheckoutState = {
58
58
  checkoutShippingState: CheckoutReadState;
59
59
  checkoutPaymentState: CheckoutReadState;
60
60
  checkoutFieldErrors?: Record<string, unknown>;
61
+ /** The store's shopper locale, seeded by the catch-all host (design D4). */
62
+ storeLocale: string;
61
63
  };
62
64
 
63
65
  type HostedSetter = (path: string, value: unknown) => void;
@@ -655,7 +657,9 @@ export function toHostedCheckoutModel(
655
657
 
656
658
  return {
657
659
  labels: copyFor(props),
658
- locale: 'es-ES',
660
+ // One store locale for every money surface: the checkout summary formats
661
+ // with the same locale as the cart and `<html lang>` (design D4).
662
+ locale: state.storeLocale,
659
663
  currencyCode,
660
664
  countries: (props.shippingLocations?.countries ?? [])
661
665
  .filter((country) => country.value.trim() !== '' && country.label.trim() !== '')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thorprovider/storefront",
3
- "version": "0.15.0",
3
+ "version": "0.15.2",
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
6
  "bin": "bin/storefront.js",
@@ -366,6 +366,24 @@
366
366
  "propsHint": "data (categories[], config, labels, promotion, preview)",
367
367
  "status": "executable",
368
368
  "agent": {"status":"pending","section":"universal-main-menu","elementType":"UniversalMainMenu","variants":["UniversalMainMenu"],"kind":"pending-card","reason":"The menu's data is the shop's catalog taxonomy; an agent-editable card needs a reviewed authoring contract for recursive category trees before automatic configuration is enabled.","owner":"design intake — universal-main-menu"}
369
+ },
370
+ {
371
+ "name": "header-universal",
372
+ "description": "HeaderUniversal presentation section (delivery header-universal).",
373
+ "elementType": "HeaderUniversal",
374
+ "variants": ["HeaderUniversal"],
375
+ "defaultVariant": "HeaderUniversal",
376
+ "propsHint": "config (header configuration), context (brand, menu, capabilities)",
377
+ "status": "executable",
378
+ "agent": {
379
+ "status": "exempt",
380
+ "section": "header-universal",
381
+ "elementType": "HeaderUniversal",
382
+ "variants": ["HeaderUniversal"],
383
+ "kind": "host-only",
384
+ "reason": "The header and its menu are storefront-shell concerns: the header is the shop's navigation chrome and its menu data is the host's catalog taxonomy, so this section must be configured by the host rather than selected as page content.",
385
+ "owner": "Wave 1 — storefront shell"
386
+ }
369
387
  }
370
388
  ]
371
389
  }
@@ -47,8 +47,8 @@ export const CANDIDATE_TOOLSET = Object.freeze({
47
47
  '@json-render/next': '0.21.0',
48
48
  }),
49
49
  local: Object.freeze({
50
- '@thorprovider/blocks': '4.8.0',
51
- '@thorprovider/adapters': '5.8.0',
50
+ '@thorprovider/blocks': '4.10.0',
51
+ '@thorprovider/adapters': '5.8.1',
52
52
  '@thorprovider/runtime': '0.10.0',
53
53
  '@thorprovider/types': '7.8.0',
54
54
  }),
@@ -29,6 +29,11 @@ export function envExample(name) {
29
29
  'THOR_DATA_SOURCE=mock',
30
30
  '# Store identity (written by create; required only in real mode).',
31
31
  `THOR_STORE_ID=${name}`,
32
+ '# Shopper locale (BCP-47): governs <html lang> and every money surface',
33
+ '# (cart, cart sheet, checkout summary, order confirmation). Optional —',
34
+ '# unset or blank falls back to es-UY, the scaffold default that matches',
35
+ '# the mock Uruguay region (UYU).',
36
+ 'THOR_STORE_LOCALE=es-UY',
32
37
  '# Demo imagery base (mock mode only). The starter ships local product,',
33
38
  '# category and banner shots under public/images; drop this to fall back to',
34
39
  '# the generated SVG placeholders.',
@@ -64,6 +64,9 @@ const RULES = [
64
64
  // The footer content contract and its neutral defaults are package-owned;
65
65
  // a merchant overrides copy through the user-owned shell content seam.
66
66
  'app/lib/*/footer-content.ts',
67
+ // The universal header's authored config and menu builder are package-owned
68
+ // shell chrome, not merchant content.
69
+ 'app/lib/*/header-universal.ts',
67
70
  'app/lib/*/account-lifecycle.client.tsx',
68
71
  'app/lib/*/account-boundary.client.tsx',
69
72
  'app/lib/*/account-mutation.client.ts',
@@ -74,8 +77,7 @@ const RULES = [
74
77
  'app/lib/*/commerce.ts',
75
78
  'app/lib/*/ports.ts',
76
79
  'app/lib/*/orders-port.ts',
77
- 'app/lib/*/order-detail-port.ts',
78
- 'app/lib/*/order-detail-mapper.ts',
80
+ 'app/lib/*/order-detail-*.ts',
79
81
  'app/lib/*/fulfillment-evidence-port.ts',
80
82
  'app/lib/*/addresses-port.ts',
81
83
  'app/lib/*/customer-profile-port.ts',
@@ -98,6 +100,9 @@ const RULES = [
98
100
  'views/*/registry.tsx',
99
101
  'views/*/orders-advanced.client.tsx',
100
102
  'views/*/order-detail.client.tsx',
103
+ 'views/*/order-detail-invoice.ts',
104
+ 'views/*/order-detail-sheet.tsx',
105
+ 'views/*/order-detail-sheets.tsx',
101
106
  'views/*/fulfillment-evidence.client.tsx',
102
107
  'views/*/fulfillment-evidence.schema.ts',
103
108
  'views/*/*.defaults.ts',
@@ -366,6 +366,24 @@
366
366
  "propsHint": "data (categories[], config, labels, promotion, preview)",
367
367
  "status": "executable",
368
368
  "agent": {"status":"pending","section":"universal-main-menu","elementType":"UniversalMainMenu","variants":["UniversalMainMenu"],"kind":"pending-card","reason":"The menu's data is the shop's catalog taxonomy; an agent-editable card needs a reviewed authoring contract for recursive category trees before automatic configuration is enabled.","owner":"design intake — universal-main-menu"}
369
+ },
370
+ {
371
+ "name": "header-universal",
372
+ "description": "HeaderUniversal presentation section (delivery header-universal).",
373
+ "elementType": "HeaderUniversal",
374
+ "variants": ["HeaderUniversal"],
375
+ "defaultVariant": "HeaderUniversal",
376
+ "propsHint": "config (header configuration), context (brand, menu, capabilities)",
377
+ "status": "executable",
378
+ "agent": {
379
+ "status": "exempt",
380
+ "section": "header-universal",
381
+ "elementType": "HeaderUniversal",
382
+ "variants": ["HeaderUniversal"],
383
+ "kind": "host-only",
384
+ "reason": "The header and its menu are storefront-shell concerns: the header is the shop's navigation chrome and its menu data is the host's catalog taxonomy, so this section must be configured by the host rather than selected as page content.",
385
+ "owner": "Wave 1 — storefront shell"
386
+ }
369
387
  }
370
388
  ]
371
389
  }
@@ -0,0 +1,33 @@
1
+ 'use client'
2
+
3
+ // Optional section fragment: header-universal (mirrors recipes/sections.json) — client registry.
4
+ // The matching server-side catalog lives in header-universal.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 { useRouter } from 'next/navigation'
9
+ import { HeaderUniversal } from '@thorprovider/blocks'
10
+ import { universalHeaderPropsSchema } from './schema.header-universal'
11
+ import type { ViewRegistry } from '../types'
12
+
13
+ export const headerUniversalRegistry: ViewRegistry = {
14
+ HeaderUniversal: ({ props }) => {
15
+ const router = useRouter()
16
+ const parsed = universalHeaderPropsSchema.parse(props)
17
+ return (
18
+ <HeaderUniversal
19
+ config={parsed.config}
20
+ context={parsed.context}
21
+ labels={parsed.labels}
22
+ breakpoint={parsed.breakpoint}
23
+ className={parsed.className}
24
+ onAction={(action) => {
25
+ if (action.name === 'navigate') {
26
+ const href = action.payload?.href
27
+ if (typeof href === 'string' && href.startsWith('/')) router.push(href)
28
+ }
29
+ }}
30
+ />
31
+ )
32
+ },
33
+ }
@@ -0,0 +1,16 @@
1
+ // Optional section fragment: header-universal (mirrors recipes/sections.json)
2
+ // Server-side part: element type + zod catalog entry. The component mappings
3
+ // live in header-universal.client.tsx ('use client') and are composed via composeSections.
4
+
5
+ import { universalHeaderPropsSchema } from './schema.header-universal'
6
+
7
+ export const headerUniversalSection = {
8
+ elementType: 'HeaderUniversal',
9
+ catalog: {
10
+ HeaderUniversal: {
11
+ props: universalHeaderPropsSchema,
12
+ description: 'HeaderUniversal presentation section (delivery header-universal).',
13
+ },
14
+ },
15
+ registryModule: './header-universal.client',
16
+ }