@thorprovider/storefront 0.7.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -2
- package/assets/templates/AGENTS.md +14 -2
- package/assets/templates/app/app/[[...slug]]/page.tsx +9 -2
- package/assets/templates/app/lib/__STOREFRONT__/account-address.ts +129 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-lifecycle.client.tsx +2 -2
- package/assets/templates/app/lib/__STOREFRONT__/account-private.core.ts +143 -0
- package/assets/templates/app/lib/__STOREFRONT__/account-profile.ts +220 -0
- package/assets/templates/app/lib/__STOREFRONT__/actions.ts +677 -80
- package/assets/templates/app/lib/__STOREFRONT__/addresses-port.ts +107 -0
- package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +477 -38
- package/assets/templates/app/lib/__STOREFRONT__/confirmation.core.ts +240 -0
- package/assets/templates/app/lib/__STOREFRONT__/customer-profile-port.ts +103 -0
- package/assets/templates/app/lib/__STOREFRONT__/fulfillment-evidence-port.ts +31 -0
- package/assets/templates/app/lib/__STOREFRONT__/handlers.core.ts +21 -4
- package/assets/templates/app/lib/__STOREFRONT__/mappers.ts +6 -2
- package/assets/templates/app/lib/__STOREFRONT__/order-detail-mapper.ts +642 -0
- package/assets/templates/app/lib/__STOREFRONT__/order-detail-port.ts +25 -0
- package/assets/templates/app/lib/__STOREFRONT__/orders-port.ts +30 -0
- package/assets/templates/app/lib/__STOREFRONT__/ports.ts +28 -0
- package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.client.tsx +4 -4
- package/assets/templates/app/lib/__STOREFRONT__/session.ts +24 -6
- package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +21 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/address-book-advanced.client.tsx +29 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/checkout-commerce-v1.client.tsx +19 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/checkout-commerce-v1.tsx +16 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/customer-profile.client.tsx +27 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/index.ts +4 -1
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/mega-menu-universal.client.tsx +19 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/mega-menu-universal.tsx +16 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.address-book-advanced.ts +437 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.checkout-commerce-v1.ts +398 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.customer-profile.ts +138 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.mega-menu-universal.ts +76 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.universal-banner.ts +217 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/universal-banner.client.tsx +24 -0
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/universal-banner.tsx +16 -0
- package/assets/templates/features/checkout/handlers.ts +24 -4
- package/assets/templates/features/customer-addresses/handlers.ts +11 -0
- package/assets/templates/features/customer-addresses/state.ts +33 -0
- package/assets/templates/features/customer-auth/state.ts +10 -0
- package/assets/templates/features/customer-profile/handlers.ts +11 -0
- package/assets/templates/features/customer-profile/state.ts +18 -0
- package/assets/templates/views/account/address-book-advanced.defaults.ts +534 -0
- package/assets/templates/views/account/assembly/assembly.json +36 -0
- package/assets/templates/views/account/assembly/index.skeleton.tsx +277 -0
- package/assets/templates/views/account/assembly/registry.skeleton.tsx +1057 -0
- package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/binding.json +5 -0
- package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/catalog.part +4 -0
- package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/element.part +5 -0
- package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/registry.part +1 -0
- package/assets/templates/views/account/assembly/slots/addresses/cards/catalog.part +5 -0
- package/assets/templates/views/account/assembly/slots/addresses/cards/element.part +10 -0
- package/assets/templates/views/account/assembly/slots/addresses/cards/registry.part +1 -0
- package/assets/templates/views/account/assembly/slots/login/card/catalog.part +4 -0
- package/assets/templates/views/account/assembly/slots/login/card/element.part +13 -0
- package/assets/templates/views/account/assembly/slots/login/card/registry.part +1 -0
- package/assets/templates/views/account/assembly/slots/orders/OrderHistory/catalog.part +5 -0
- package/assets/templates/views/account/assembly/slots/orders/OrderHistory/element.part +5 -0
- package/assets/templates/views/account/assembly/slots/orders/OrderHistory/registry.part +2 -0
- package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/binding.json +5 -0
- package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/catalog.part +5 -0
- package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/element.part +5 -0
- package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/registry.part +1 -0
- package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/binding.json +5 -0
- package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/catalog.part +4 -0
- package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/element.part +5 -0
- package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/registry.part +1 -0
- package/assets/templates/views/account/assembly/slots/profile/form/catalog.part +5 -0
- package/assets/templates/views/account/assembly/slots/profile/form/element.part +10 -0
- package/assets/templates/views/account/assembly/slots/profile/form/registry.part +1 -0
- package/assets/templates/views/account/assembly/slots/register/SignUpPage1/catalog.part +4 -0
- package/assets/templates/views/account/assembly/slots/register/SignUpPage1/element.part +13 -0
- package/assets/templates/views/account/assembly/slots/register/SignUpPage1/registry.part +1 -0
- package/assets/templates/views/account/assembly/slots/summary/stack/catalog.part +5 -0
- package/assets/templates/views/account/assembly/slots/summary/stack/element.part +5 -0
- package/assets/templates/views/account/assembly/slots/summary/stack/registry.part +1 -0
- package/assets/templates/views/account/assembly/slots/summary/tabs/catalog.part +5 -0
- package/assets/templates/views/account/assembly/slots/summary/tabs/element.part +5 -0
- package/assets/templates/views/account/assembly/slots/summary/tabs/registry.part +1 -0
- package/assets/templates/views/account/content.ts +326 -0
- package/assets/templates/views/account/customer-profile.defaults.ts +136 -0
- package/assets/templates/views/account/fulfillment-evidence.client.tsx +34 -0
- package/assets/templates/views/account/fulfillment-evidence.defaults.ts +145 -0
- package/assets/templates/views/account/fulfillment-evidence.schema.ts +15 -0
- package/assets/templates/views/account/index.tsx +259 -38
- package/assets/templates/views/account/order-detail.client.tsx +35 -0
- package/assets/templates/views/account/order-detail.defaults.ts +457 -0
- package/assets/templates/views/account/orders-advanced.client.tsx +77 -0
- package/assets/templates/views/account/orders-advanced.defaults.ts +230 -0
- package/assets/templates/views/account/registry.tsx +935 -420
- package/assets/templates/views/account/schema.ts +50 -0
- package/assets/templates/views/account/sections-data.ts +2 -0
- package/assets/templates/views/cart/content.ts +1 -0
- package/assets/templates/views/category/assembly/index.skeleton.tsx +1 -0
- package/assets/templates/views/category/assembly/slots/filter/CategoryListing/element.part +1 -0
- package/assets/templates/views/category/content.ts +2 -0
- package/assets/templates/views/category/index.tsx +2 -0
- package/assets/templates/views/category/sections-data.ts +2 -0
- package/assets/templates/views/checkout/checkout-commerce-hosted.tsx +1089 -0
- package/assets/templates/views/checkout/content.ts +51 -0
- package/assets/templates/views/checkout/index.tsx +1 -1
- package/assets/templates/views/checkout/props.ts +10 -2
- package/assets/templates/views/checkout/registry.tsx +104 -42
- package/assets/templates/views/checkout/schema.ts +76 -1
- package/assets/templates/views/home/assembly/assembly.json +23 -2
- package/assets/templates/views/home/assembly/index.skeleton.tsx +4 -1
- package/assets/templates/views/home/assembly/registry.skeleton.tsx +1 -0
- package/assets/templates/views/home/assembly/slots/hero/UniversalBanner/binding.json +5 -0
- package/assets/templates/views/home/assembly/slots/hero/UniversalBanner/catalog.part +4 -0
- package/assets/templates/views/home/assembly/slots/hero/UniversalBanner/element.part +4 -0
- package/assets/templates/views/home/assembly/slots/hero/UniversalBanner/registry.part +10 -0
- package/assets/templates/views/home/content.ts +247 -1
- package/assets/templates/views/home/data.ts +10 -1
- package/assets/templates/views/home/index.tsx +8 -6
- package/assets/templates/views/home/props.ts +7 -1
- package/assets/templates/views/home/registry.tsx +11 -28
- package/assets/templates/views/home/schema.ts +163 -0
- package/assets/templates/views/home/sections-data.ts +2 -0
- package/assets/templates/views/product/content.ts +1 -0
- package/assets/templates/views/static/content.ts +1 -0
- package/bin/storefront.js +356 -27
- package/package.json +2 -1
- package/recipes/adapter-surface.json +159 -0
- package/recipes/archetypes.json +43 -4
- package/recipes/catalog.json +147 -2
- package/recipes/feature.schema.json +9 -0
- package/recipes/features.json +72 -1
- package/recipes/manifest.schema.json +5 -0
- package/recipes/recipe.schema.json +13 -1
- package/recipes/recipes.json +37 -7
- package/recipes/section.schema.json +112 -0
- package/recipes/sections.json +281 -4
- package/recipes/validate.mjs +83 -1
- package/scripts/adapter-surface.mjs +41 -0
- package/scripts/agent-blocks.mjs +700 -0
- package/scripts/block-validator.mjs +45 -0
- package/scripts/candidate.mjs +56 -14
- package/scripts/composers.mjs +7 -2
- package/scripts/default-sections.mjs +78 -0
- package/scripts/file-classes.mjs +18 -0
- package/scripts/generate-adapter-surface.mjs +148 -0
- package/scripts/operations.mjs +100 -0
- package/scripts/reconcile.mjs +67 -39
- package/scripts/section-configure.mjs +316 -0
- package/scripts/sync-assets.mjs +1 -0
- package/scripts/view-assembly.mjs +101 -14
- package/skills/sf-feature/SKILL.md +19 -0
- package/skills/sf-view-gen/SKILL.md +73 -7
- package/skills/sf-view-gen/assets/recipes/archetypes.json +43 -4
- package/skills/sf-view-gen/assets/recipes/catalog.json +147 -2
- package/skills/sf-view-gen/assets/recipes/features.json +72 -1
- package/skills/sf-view-gen/assets/recipes/recipes.json +37 -7
- package/skills/sf-view-gen/assets/recipes/section.schema.json +112 -0
- package/skills/sf-view-gen/assets/recipes/sections.json +281 -4
- package/skills/sf-view-gen/assets/templates/views/sections/checkout-commerce-v1.client.tsx +19 -0
- package/skills/sf-view-gen/assets/templates/views/sections/checkout-commerce-v1.tsx +16 -0
- package/skills/sf-view-gen/assets/templates/views/sections/mega-menu-universal.client.tsx +19 -0
- package/skills/sf-view-gen/assets/templates/views/sections/mega-menu-universal.tsx +16 -0
- package/skills/sf-view-gen/assets/templates/views/sections/schema.checkout-commerce-v1.ts +398 -0
- package/skills/sf-view-gen/assets/templates/views/sections/schema.mega-menu-universal.ts +76 -0
- package/skills/sf-view-gen/assets/templates/views/sections/schema.universal-banner.ts +217 -0
- package/skills/sf-view-gen/assets/templates/views/sections/universal-banner.client.tsx +24 -0
- package/skills/sf-view-gen/assets/templates/views/sections/universal-banner.tsx +16 -0
- package/skills/sf-view-gen/scripts/validate.mjs +83 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PortError } from '@thorprovider/blocks/ports'
|
|
2
|
+
|
|
3
|
+
import { createAddressesPort } from './addresses-port'
|
|
4
|
+
import { createCustomerProfilePort } from './customer-profile-port'
|
|
5
|
+
import { createFulfillmentEvidencePort } from './fulfillment-evidence-port'
|
|
6
|
+
import { createOrderDetailPort } from './order-detail-port'
|
|
7
|
+
import { createOrdersPort } from './orders-port'
|
|
8
|
+
import { loadOrderDetailAction } from './actions'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Host-injected asynchronous ports. `orders` is the seam for the advanced
|
|
12
|
+
* account order history (the default `account.orders` surface); its runner is
|
|
13
|
+
* the token-scoped customer order read, wired for mock mode and Medusa.
|
|
14
|
+
* `orderDetail` is the seam for the /account/orders/[id] route; its runner is
|
|
15
|
+
* the ownership-scoped customer detail read, wired for mock mode. A live
|
|
16
|
+
* provider without a detail endpoint reports a typed `unavailable` outcome.
|
|
17
|
+
*/
|
|
18
|
+
export const ports = {
|
|
19
|
+
orders: createOrdersPort(),
|
|
20
|
+
orderDetail: createOrderDetailPort(async (orderId) => {
|
|
21
|
+
const result = await loadOrderDetailAction({ id: orderId })
|
|
22
|
+
if (!result.ok) throw new PortError(result.code, result.error)
|
|
23
|
+
return result.snapshot
|
|
24
|
+
}),
|
|
25
|
+
fulfillmentEvidence: createFulfillmentEvidencePort(),
|
|
26
|
+
customerProfile: createCustomerProfilePort(),
|
|
27
|
+
addresses: createAddressesPort(),
|
|
28
|
+
}
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
// retry/reconcile re-resolution, shell/4.2 claim) flows through `claimAccount`,
|
|
33
33
|
// the private reset happens AT the trigger even when the `/account` panel is
|
|
34
34
|
// unmounted and no effect can run. Same-identity claims are a no-op and the
|
|
35
|
-
// guest cart is never touched (`
|
|
35
|
+
// guest cart is never touched (`clearAccountPrivateState`).
|
|
36
36
|
|
|
37
37
|
import { createContext, useContext, useMemo, useRef, type ReactNode } from 'react'
|
|
38
38
|
import { useStateStore } from '@json-render/react'
|
|
39
39
|
import type { AccountIdentity, AccountResolution } from './account-session.core'
|
|
40
|
-
import { accountIdentityKey,
|
|
40
|
+
import { accountIdentityKey, clearAccountPrivateState } from './account-private.core'
|
|
41
41
|
import {
|
|
42
42
|
ACCOUNT_OWNED_KEYS,
|
|
43
43
|
createProjectionOwnership,
|
|
@@ -161,7 +161,7 @@ export function useAccountOwnership(): AccountOwnership {
|
|
|
161
161
|
// run. The prior key is read from the LIVE store (not a render closure),
|
|
162
162
|
// so it is correct regardless of which route is mounted. A same-identity
|
|
163
163
|
// claim (a re-resolution, or `beginMutation`'s snapshot claim) is a no-op,
|
|
164
|
-
// and `
|
|
164
|
+
// and `clearAccountPrivateState` never writes a guest cart key.
|
|
165
165
|
const priorKey = accountIdentityKey(
|
|
166
166
|
(getSnapshot().accountCustomer ?? null) as { id?: string | null } | null,
|
|
167
167
|
)
|
|
@@ -173,7 +173,7 @@ export function useAccountOwnership(): AccountOwnership {
|
|
|
173
173
|
})
|
|
174
174
|
// Clear BEFORE writing the new identity so no reader ever observes the
|
|
175
175
|
// new identity alongside the previous customer's private rows.
|
|
176
|
-
if (priorKey !== nextKey)
|
|
176
|
+
if (priorKey !== nextKey) clearAccountPrivateState(set)
|
|
177
177
|
set('/accountCustomer', accountCustomer)
|
|
178
178
|
set('/accountAuthenticated', accountAuthenticated)
|
|
179
179
|
set('/accountResolution', values.accountResolution)
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// printed; a missing or too-short secret throws before any cookie is written.
|
|
15
15
|
// No external SDK is called here; commerce data stays behind adapters/runtime.
|
|
16
16
|
|
|
17
|
-
import { cookies } from 'next/headers'
|
|
17
|
+
import { cookies, headers } from 'next/headers'
|
|
18
18
|
import type { StoreContext } from '@thorprovider/types'
|
|
19
19
|
import {
|
|
20
20
|
AUTH_TOKEN_TTL_SECONDS,
|
|
@@ -46,12 +46,30 @@ export function getSessionSecret(): string {
|
|
|
46
46
|
return secret
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
/**
|
|
50
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Hardened cookie flags: httpOnly, SameSite=Lax, request-aware `secure`, TTL.
|
|
51
|
+
*
|
|
52
|
+
* `secure` follows the request's actual scheme (`x-forwarded-proto`), never
|
|
53
|
+
* NODE_ENV alone: a production `next start` served over plain HTTP (a local or
|
|
54
|
+
* LAN demo, no TLS proxy) would otherwise set a `Secure` cookie the browser
|
|
55
|
+
* silently drops — sign-in survives one response and every reload logs the
|
|
56
|
+
* shopper out. HTTPS requests through any standard proxy carry the header and
|
|
57
|
+
* keep the `Secure` flag; direct HTTPS without the header is not weakened
|
|
58
|
+
* because TLS is the only channel. Cookie writes happen in actions/routes, so
|
|
59
|
+
* `headers()` always resolves here.
|
|
60
|
+
*/
|
|
61
|
+
async function cookieOptions(): Promise<{
|
|
62
|
+
httpOnly: true
|
|
63
|
+
sameSite: 'lax'
|
|
64
|
+
secure: boolean
|
|
65
|
+
path: '/'
|
|
66
|
+
maxAge: number
|
|
67
|
+
}> {
|
|
68
|
+
const forwarded = (await headers()).get('x-forwarded-proto')?.split(',')[0]?.trim().toLowerCase()
|
|
51
69
|
return {
|
|
52
70
|
httpOnly: true,
|
|
53
71
|
sameSite: 'lax' as const,
|
|
54
|
-
secure:
|
|
72
|
+
secure: forwarded === 'https',
|
|
55
73
|
path: '/',
|
|
56
74
|
maxAge: SESSION_TTL_SECONDS,
|
|
57
75
|
}
|
|
@@ -126,7 +144,7 @@ async function writeHostSession(
|
|
|
126
144
|
store.set(
|
|
127
145
|
sessionCookieName(context.storeId),
|
|
128
146
|
encodeHostSession(payload, getSessionSecret()),
|
|
129
|
-
cookieOptions(),
|
|
147
|
+
await cookieOptions(),
|
|
130
148
|
)
|
|
131
149
|
}
|
|
132
150
|
|
|
@@ -158,7 +176,7 @@ export async function writeAuthToken(context: StoreContext, token: string): Prom
|
|
|
158
176
|
store.set(
|
|
159
177
|
authCookieName(context.storeId),
|
|
160
178
|
encodeHostAuth(createHostAuth(context.storeId, token), getSessionSecret()),
|
|
161
|
-
{ ...cookieOptions(), maxAge: AUTH_TOKEN_TTL_SECONDS },
|
|
179
|
+
{ ...(await cookieOptions()), maxAge: AUTH_TOKEN_TTL_SECONDS },
|
|
162
180
|
)
|
|
163
181
|
}
|
|
164
182
|
|
|
@@ -139,6 +139,27 @@ export interface AccountOrderView {
|
|
|
139
139
|
items: AccountOrderItemView[]
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
/**
|
|
143
|
+
* One saved address in the authenticated customer's address book, mapped from
|
|
144
|
+
* the backend `Address`. Optional fields are omitted rather than serialized as
|
|
145
|
+
* empty strings; the view registry formats the display lines.
|
|
146
|
+
*/
|
|
147
|
+
export interface AccountAddressView {
|
|
148
|
+
id: string
|
|
149
|
+
firstName: string
|
|
150
|
+
lastName: string
|
|
151
|
+
address1?: string
|
|
152
|
+
address2?: string
|
|
153
|
+
city: string
|
|
154
|
+
province?: string
|
|
155
|
+
postalCode?: string
|
|
156
|
+
countryCode: string
|
|
157
|
+
phone?: string
|
|
158
|
+
label?: string
|
|
159
|
+
isDefaultShipping?: boolean
|
|
160
|
+
isDefaultBilling?: boolean
|
|
161
|
+
}
|
|
162
|
+
|
|
142
163
|
/**
|
|
143
164
|
* The completed-order receipt as ONE atomic value.
|
|
144
165
|
*
|
package/assets/templates/app/lib/__STOREFRONT__/views/sections/address-book-advanced.client.tsx
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
// Optional section fragment: address-book-advanced (mirrors recipes/sections.json) — client registry.
|
|
4
|
+
// The matching server-side catalog lives in address-book-advanced.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 { AddressBookAdvanced } from '@thorprovider/blocks'
|
|
9
|
+
import { ports } from '../../ports'
|
|
10
|
+
import { addressBookAdvancedPropsSchema } from './schema.address-book-advanced'
|
|
11
|
+
import type { ViewRegistry } from '../types'
|
|
12
|
+
|
|
13
|
+
export const addressBookAdvancedRegistry: ViewRegistry = {
|
|
14
|
+
AddressBookAdvanced: ({ props }) => {
|
|
15
|
+
const parsed = addressBookAdvancedPropsSchema.parse(props)
|
|
16
|
+
return (
|
|
17
|
+
<AddressBookAdvanced
|
|
18
|
+
context={parsed.context as Parameters<typeof AddressBookAdvanced>[0]["context"]}
|
|
19
|
+
permissions={parsed.permissions as Parameters<typeof AddressBookAdvanced>[0]["permissions"]}
|
|
20
|
+
config={parsed.config as Parameters<typeof AddressBookAdvanced>[0]["config"]}
|
|
21
|
+
labels={parsed.labels as Parameters<typeof AddressBookAdvanced>[0]["labels"]}
|
|
22
|
+
countries={parsed.countries as Parameters<typeof AddressBookAdvanced>[0]["countries"]}
|
|
23
|
+
addressLabels={parsed.addressLabels as Parameters<typeof AddressBookAdvanced>[0]["addressLabels"]}
|
|
24
|
+
title={parsed.title as Parameters<typeof AddressBookAdvanced>[0]["title"]}
|
|
25
|
+
port={ports.addresses}
|
|
26
|
+
/>
|
|
27
|
+
)
|
|
28
|
+
},
|
|
29
|
+
}
|
package/assets/templates/app/lib/__STOREFRONT__/views/sections/checkout-commerce-v1.client.tsx
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
// Optional section fragment: checkout-commerce-v1 (mirrors recipes/sections.json) — client registry.
|
|
4
|
+
// The matching server-side catalog lives in checkout-commerce-v1.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 { CheckoutCommerceV1 } from '@thorprovider/blocks'
|
|
9
|
+
import { checkoutCommerceV1PropsSchema } from './schema.checkout-commerce-v1'
|
|
10
|
+
import type { ViewRegistry } from '../types'
|
|
11
|
+
|
|
12
|
+
export const checkoutCommerceV1Registry: ViewRegistry = {
|
|
13
|
+
CheckoutCommerceV1: ({ props }) => {
|
|
14
|
+
const parsed = checkoutCommerceV1PropsSchema.parse(props)
|
|
15
|
+
return (
|
|
16
|
+
<CheckoutCommerceV1 data={parsed.data} />
|
|
17
|
+
)
|
|
18
|
+
},
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Optional section fragment: checkout-commerce-v1 (mirrors recipes/sections.json)
|
|
2
|
+
// Server-side part: element type + zod catalog entry. The component mappings
|
|
3
|
+
// live in checkout-commerce-v1.client.tsx ('use client') and are composed via composeSections.
|
|
4
|
+
|
|
5
|
+
import { checkoutCommerceV1PropsSchema } from './schema.checkout-commerce-v1'
|
|
6
|
+
|
|
7
|
+
export const checkoutCommerceV1Section = {
|
|
8
|
+
elementType: 'CheckoutCommerceV1',
|
|
9
|
+
catalog: {
|
|
10
|
+
CheckoutCommerceV1: {
|
|
11
|
+
props: checkoutCommerceV1PropsSchema,
|
|
12
|
+
description: 'CheckoutCommerceV1 presentation section (delivery checkout-commerce-v1).',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
registryModule: './checkout-commerce-v1.client',
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
// Optional section fragment: customer-profile (mirrors recipes/sections.json) — client registry.
|
|
4
|
+
// The matching server-side catalog lives in customer-profile.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 { CustomerProfile } from '@thorprovider/blocks'
|
|
9
|
+
import { ports } from '../../ports'
|
|
10
|
+
import { customerProfilePropsSchema } from './schema.customer-profile'
|
|
11
|
+
import type { ViewRegistry } from '../types'
|
|
12
|
+
|
|
13
|
+
export const customerProfileRegistry: ViewRegistry = {
|
|
14
|
+
CustomerProfile: ({ props }) => {
|
|
15
|
+
const parsed = customerProfilePropsSchema.parse(props)
|
|
16
|
+
return (
|
|
17
|
+
<CustomerProfile
|
|
18
|
+
labels={parsed.labels as Parameters<typeof CustomerProfile>[0]["labels"]}
|
|
19
|
+
capabilities={parsed.capabilities as Parameters<typeof CustomerProfile>[0]["capabilities"]}
|
|
20
|
+
permissions={parsed.permissions as Parameters<typeof CustomerProfile>[0]["permissions"]}
|
|
21
|
+
defaultEditing={parsed.defaultEditing as Parameters<typeof CustomerProfile>[0]["defaultEditing"]}
|
|
22
|
+
lang={parsed.lang as Parameters<typeof CustomerProfile>[0]["lang"]}
|
|
23
|
+
port={ports.customerProfile}
|
|
24
|
+
/>
|
|
25
|
+
)
|
|
26
|
+
},
|
|
27
|
+
}
|
|
@@ -6,12 +6,15 @@
|
|
|
6
6
|
// catalog never pulls the React graph.
|
|
7
7
|
|
|
8
8
|
import type { ViewCatalogEntry } from '../types'
|
|
9
|
+
import { checkoutCommerceV1Section } from './checkout-commerce-v1'
|
|
9
10
|
import { ctaSection } from './cta'
|
|
10
11
|
import { faqSection } from './faq'
|
|
11
12
|
import { marketplaceProductCardSection } from './marketplace-product-card'
|
|
13
|
+
import { megaMenuUniversalSection } from './mega-menu-universal'
|
|
12
14
|
import { productsSection } from './products'
|
|
15
|
+
import { universalBannerSection } from './universal-banner'
|
|
13
16
|
|
|
14
|
-
export const sectionModules = [faqSection, ctaSection, marketplaceProductCardSection, productsSection] as const
|
|
17
|
+
export const sectionModules = [checkoutCommerceV1Section, faqSection, ctaSection, marketplaceProductCardSection, megaMenuUniversalSection, productsSection, universalBannerSection] as const
|
|
15
18
|
|
|
16
19
|
export const sectionCatalog: Record<string, ViewCatalogEntry> = Object.assign(
|
|
17
20
|
{},
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
// Optional section fragment: mega-menu-universal (mirrors recipes/sections.json) — client registry.
|
|
4
|
+
// The matching server-side catalog lives in mega-menu-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 { MegaMenuUniversal } from '@thorprovider/blocks'
|
|
9
|
+
import { megaMenuUniversalPropsSchema } from './schema.mega-menu-universal'
|
|
10
|
+
import type { ViewRegistry } from '../types'
|
|
11
|
+
|
|
12
|
+
export const megaMenuUniversalRegistry: ViewRegistry = {
|
|
13
|
+
MegaMenuUniversal: ({ props }) => {
|
|
14
|
+
const parsed = megaMenuUniversalPropsSchema.parse(props)
|
|
15
|
+
return (
|
|
16
|
+
<MegaMenuUniversal data={parsed.data} />
|
|
17
|
+
)
|
|
18
|
+
},
|
|
19
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Optional section fragment: mega-menu-universal (mirrors recipes/sections.json)
|
|
2
|
+
// Server-side part: element type + zod catalog entry. The component mappings
|
|
3
|
+
// live in mega-menu-universal.client.tsx ('use client') and are composed via composeSections.
|
|
4
|
+
|
|
5
|
+
import { megaMenuUniversalPropsSchema } from './schema.mega-menu-universal'
|
|
6
|
+
|
|
7
|
+
export const megaMenuUniversalSection = {
|
|
8
|
+
elementType: 'MegaMenuUniversal',
|
|
9
|
+
catalog: {
|
|
10
|
+
MegaMenuUniversal: {
|
|
11
|
+
props: megaMenuUniversalPropsSchema,
|
|
12
|
+
description: 'MegaMenuUniversal presentation section (delivery mega-menu-universal).',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
registryModule: './mega-menu-universal.client',
|
|
16
|
+
}
|