@thorprovider/storefront 0.9.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/assets/templates/app/lib/__STOREFRONT__/actions.ts +57 -1
- package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +138 -7
- 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 +6 -7
- package/assets/templates/app/lib/__STOREFRONT__/ports.ts +13 -3
- package/assets/templates/views/account/assembly/assembly.json +0 -5
- package/assets/templates/views/account/assembly/index.skeleton.tsx +48 -0
- package/assets/templates/views/account/assembly/registry.skeleton.tsx +5 -64
- package/assets/templates/views/account/content.ts +7 -7
- 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 +41 -3
- package/assets/templates/views/account/orders-advanced.client.tsx +10 -99
- package/assets/templates/views/account/orders-advanced.defaults.ts +7 -7
- package/assets/templates/views/account/registry.tsx +5 -65
- package/assets/templates/views/home/assembly/assembly.json +1 -1
- package/assets/templates/views/home/assembly/index.skeleton.tsx +3 -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 +246 -2
- package/assets/templates/views/home/data.ts +10 -1
- package/assets/templates/views/home/index.tsx +7 -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/bin/storefront.js +13 -14
- package/package.json +1 -1
- package/recipes/adapter-surface.json +1 -0
- package/recipes/archetypes.json +5 -1
- package/recipes/catalog.json +9 -1
- package/recipes/recipes.json +5 -4
- package/scripts/candidate.mjs +55 -14
- package/scripts/file-classes.mjs +4 -0
- package/skills/sf-view-gen/assets/recipes/archetypes.json +5 -1
- package/skills/sf-view-gen/assets/recipes/catalog.json +9 -1
- package/skills/sf-view-gen/assets/recipes/recipes.json +5 -4
- package/assets/templates/views/account/assembly/slots/boot/AccountBoot/catalog.part +0 -5
- package/assets/templates/views/account/assembly/slots/boot/AccountBoot/element.part +0 -5
- package/assets/templates/views/account/assembly/slots/boot/AccountBoot/registry.part +0 -1
|
@@ -26,14 +26,14 @@ export const accountOrdersAdvancedDefaults: AccountOrdersAdvancedDefaults = {
|
|
|
26
26
|
paymentLabel: 'Pago',
|
|
27
27
|
fulfilmentLabel: 'Entrega',
|
|
28
28
|
capabilities: {
|
|
29
|
-
tableView:
|
|
30
|
-
shipmentTracking:
|
|
31
|
-
pickupTracking:
|
|
32
|
-
returns:
|
|
33
|
-
exchanges:
|
|
29
|
+
tableView: true,
|
|
30
|
+
shipmentTracking: true,
|
|
31
|
+
pickupTracking: true,
|
|
32
|
+
returns: true,
|
|
33
|
+
exchanges: true,
|
|
34
34
|
claims: false,
|
|
35
|
-
reorder:
|
|
36
|
-
invoices:
|
|
35
|
+
reorder: true,
|
|
36
|
+
invoices: true,
|
|
37
37
|
bulkSelection: false,
|
|
38
38
|
export: false,
|
|
39
39
|
companyOrders: false,
|
|
@@ -32,7 +32,6 @@ import {
|
|
|
32
32
|
OrderHistory as OrderHistoryBlock,
|
|
33
33
|
ProfileForm as ProfileFormBlock,
|
|
34
34
|
SignUpPage1 as SignUpBlock,
|
|
35
|
-
formatMoney,
|
|
36
35
|
} from '@thorprovider/blocks'
|
|
37
36
|
import type {
|
|
38
37
|
AddressBookLabels,
|
|
@@ -64,6 +63,7 @@ import type { AccountAddressView, AccountOrderView } from '../../state.core'
|
|
|
64
63
|
import type { ViewRegistry } from '../types'
|
|
65
64
|
import { accountContent } from './content'
|
|
66
65
|
import { AccountOrderDetailPanel } from './order-detail.client'
|
|
66
|
+
import { AccountFulfillmentEvidencePanel } from './fulfillment-evidence.client'
|
|
67
67
|
import {
|
|
68
68
|
accountAddressPropsSchema,
|
|
69
69
|
accountFramePropsSchema,
|
|
@@ -566,62 +566,6 @@ function toOrderHistoryOrder(order: AccountOrderView): OrderHistoryOrder {
|
|
|
566
566
|
}
|
|
567
567
|
}
|
|
568
568
|
|
|
569
|
-
function OrderDetail({ order, onClose }: { order: AccountOrderView; onClose: () => void }) {
|
|
570
|
-
const amount = (value: AccountOrderView['total']) => formatMoney(value) ?? '—'
|
|
571
|
-
const totals = (
|
|
572
|
-
[
|
|
573
|
-
{ label: 'Subtotal', value: order.subtotal },
|
|
574
|
-
{ label: 'Impuestos', value: order.tax },
|
|
575
|
-
{ label: 'Envío', value: order.shipping },
|
|
576
|
-
{ label: 'Total', value: order.total },
|
|
577
|
-
] as { label: string; value?: AccountOrderView['total'] }[]
|
|
578
|
-
).filter(
|
|
579
|
-
(row): row is { label: string; value: AccountOrderView['total'] } => row.value !== undefined,
|
|
580
|
-
)
|
|
581
|
-
return (
|
|
582
|
-
<div className="mx-auto w-full max-w-7xl px-4 pb-12 sm:px-6 lg:px-8">
|
|
583
|
-
<div className="rounded-lg border p-6">
|
|
584
|
-
<div className="flex items-start justify-between gap-4">
|
|
585
|
-
<div>
|
|
586
|
-
<h3 className="text-lg font-semibold">Pedido {order.number}</h3>
|
|
587
|
-
<p className="text-muted-foreground mt-1 text-sm">
|
|
588
|
-
{order.date} · {order.status}
|
|
589
|
-
</p>
|
|
590
|
-
</div>
|
|
591
|
-
<Button type="button" variant="outline" size="sm" onClick={onClose}>
|
|
592
|
-
Cerrar
|
|
593
|
-
</Button>
|
|
594
|
-
</div>
|
|
595
|
-
{order.address ? (
|
|
596
|
-
<p className="text-muted-foreground mt-2 text-sm">{order.address}</p>
|
|
597
|
-
) : null}
|
|
598
|
-
<ul className="mt-4 divide-y">
|
|
599
|
-
{order.items.map((item) => (
|
|
600
|
-
<li key={item.id} className="flex items-center justify-between py-2 text-sm">
|
|
601
|
-
<span>
|
|
602
|
-
{item.name}
|
|
603
|
-
{item.variant ? (
|
|
604
|
-
<span className="text-muted-foreground"> · {item.variant}</span>
|
|
605
|
-
) : null}
|
|
606
|
-
<span className="text-muted-foreground"> × {item.quantity}</span>
|
|
607
|
-
</span>
|
|
608
|
-
<span>{amount(item.lineTotal)}</span>
|
|
609
|
-
</li>
|
|
610
|
-
))}
|
|
611
|
-
</ul>
|
|
612
|
-
<dl className="mt-4 space-y-1 border-t pt-4 text-sm">
|
|
613
|
-
{totals.map((row) => (
|
|
614
|
-
<div key={row.label} className="flex justify-between">
|
|
615
|
-
<dt className="text-muted-foreground">{row.label}</dt>
|
|
616
|
-
<dd>{amount(row.value)}</dd>
|
|
617
|
-
</div>
|
|
618
|
-
))}
|
|
619
|
-
</dl>
|
|
620
|
-
</div>
|
|
621
|
-
</div>
|
|
622
|
-
)
|
|
623
|
-
}
|
|
624
|
-
|
|
625
569
|
function AccountLoginPanel({ props, emit }: PanelProps) {
|
|
626
570
|
const { state } = useStateStore()
|
|
627
571
|
const lifecycle = useAccountLifecycle()
|
|
@@ -943,6 +887,7 @@ function AccountAddressesPanel({ props }: PanelProps) {
|
|
|
943
887
|
}
|
|
944
888
|
|
|
945
889
|
function AccountOrdersPanel({ props }: PanelProps) {
|
|
890
|
+
const router = useRouter()
|
|
946
891
|
const { state, set, getSnapshot } = useStateStore()
|
|
947
892
|
const parsed = accountOrdersPropsSchema.parse(props)
|
|
948
893
|
const { identityKey, reconciling } = useAccountLifecycle()
|
|
@@ -1027,9 +972,6 @@ function AccountOrdersPanel({ props }: PanelProps) {
|
|
|
1027
972
|
typeof state.accountOrdersPageSize === 'number' && state.accountOrdersPageSize > 0
|
|
1028
973
|
? state.accountOrdersPageSize
|
|
1029
974
|
: ORDERS_PAGE_SIZE
|
|
1030
|
-
const selectedId =
|
|
1031
|
-
typeof state.accountSelectedOrderId === 'string' ? state.accountSelectedOrderId : null
|
|
1032
|
-
const selected = selectedId ? orders.find((order) => order.id === selectedId) ?? null : null
|
|
1033
975
|
const labels: Partial<OrderHistoryLabels> = {
|
|
1034
976
|
...(parsed.labels ?? {}),
|
|
1035
977
|
...(parsed.titleLabel === undefined ? {} : { title: parsed.titleLabel }),
|
|
@@ -1074,7 +1016,7 @@ function AccountOrdersPanel({ props }: PanelProps) {
|
|
|
1074
1016
|
orders={orders.map(toOrderHistoryOrder)}
|
|
1075
1017
|
presentation="cards"
|
|
1076
1018
|
labels={labels}
|
|
1077
|
-
onViewOrder={(id) =>
|
|
1019
|
+
onViewOrder={(id) => router.push(`/account/orders/${encodeURIComponent(id)}`)}
|
|
1078
1020
|
/>
|
|
1079
1021
|
{count > pageSize ? (
|
|
1080
1022
|
<div className="mx-auto flex w-full max-w-7xl items-center justify-between gap-4 px-4 pb-6 sm:px-6 lg:px-8">
|
|
@@ -1101,20 +1043,18 @@ function AccountOrdersPanel({ props }: PanelProps) {
|
|
|
1101
1043
|
</div>
|
|
1102
1044
|
</div>
|
|
1103
1045
|
) : null}
|
|
1104
|
-
{selected ? (
|
|
1105
|
-
<OrderDetail order={selected} onClose={() => set('/accountSelectedOrderId', null)} />
|
|
1106
|
-
) : null}
|
|
1107
1046
|
</div>
|
|
1108
1047
|
)
|
|
1109
1048
|
}
|
|
1110
1049
|
|
|
1111
1050
|
export const registry: ViewRegistry = {
|
|
1051
|
+
AccountBoot: ({ emit }) => <AccountBoundary emit={emit} />,
|
|
1112
1052
|
AccountOrderDetail: (ctx) => <AccountOrderDetailPanel {...ctx} />,
|
|
1053
|
+
AccountFulfillmentEvidence: (ctx) => <AccountFulfillmentEvidencePanel {...ctx} />,
|
|
1113
1054
|
AccountShell: (ctx) => <AccountShellPanel {...ctx} />,
|
|
1114
1055
|
AccountOverview: () => <AccountOverviewPanel />,
|
|
1115
1056
|
AccountModulePlaceholder: () => <AccountModulePlaceholderPanel />,
|
|
1116
1057
|
AccountOrders: (ctx) => <AccountOrdersPanel {...ctx} />,
|
|
1117
|
-
AccountBoot: ({ emit }) => <AccountBoundary emit={emit} />,
|
|
1118
1058
|
AccountLogin: (ctx) => <AccountLoginPanel {...ctx} />,
|
|
1119
1059
|
AccountRegister: (ctx) => <AccountRegisterPanel {...ctx} />,
|
|
1120
1060
|
AccountFrame: (ctx) => <AccountFramePanel {...ctx} />,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"view": "home",
|
|
3
3
|
"slots": [
|
|
4
|
-
{ "id": "home.hero", "slot": "hero", "default": "
|
|
4
|
+
{ "id": "home.hero", "slot": "hero", "default": "UniversalBanner" },
|
|
5
5
|
{ "id": "home.benefits", "slot": "benefits", "default": "cards" },
|
|
6
6
|
{ "id": "home.categories", "slot": "categories", "default": "CategoryGrid" }
|
|
7
7
|
],
|
|
@@ -12,6 +12,7 @@ import type { ViewModule } from '../types'
|
|
|
12
12
|
import { registry } from './registry'
|
|
13
13
|
import { sectionData } from './sections-data'
|
|
14
14
|
import { benefitsProps, categoriesProps, heroProps } from './props'
|
|
15
|
+
import * as homeProps from './props'
|
|
15
16
|
import * as homeData from './data'
|
|
16
17
|
import { toCategoryCard, toFeaturedProduct } from '../../mappers'
|
|
17
18
|
import { resolveSectionSources, resolveSectionViewStates } from '../../section-sources'
|
|
@@ -20,7 +21,8 @@ import {
|
|
|
20
21
|
categoryGridPropsSchema,
|
|
21
22
|
featurePropsSchema,
|
|
22
23
|
storefrontHeroPropsSchema,
|
|
23
|
-
} from './schema'
|
|
24
|
+
} from './schema'
|
|
25
|
+
import * as homeSchemas from './schema'@@SECTION_IMPORTS@@
|
|
24
26
|
|
|
25
27
|
// The element tree is derived wiring; the rendered props come from the
|
|
26
28
|
// user-owned ./props.ts module so they survive sync and unit removal.
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
import { CategoryCard as CategoryCardBlock } from '@thorprovider/blocks/blocks/e-commerce/product-categories/category-card'
|
|
14
14
|
@@BLOCK_IMPORTS@@@@SECTION_REGISTRY_IMPORTS@@
|
|
15
|
+
import { useEffect, useState } from 'react'
|
|
15
16
|
import { useStateStore } from '@json-render/react'
|
|
16
17
|
import { resolveIcon } from '../../icon-map'
|
|
17
18
|
import type { ViewRegistry } from '../types'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
UniversalBanner: ({ props }) => {
|
|
2
|
+
// The banner hero parses through the same contract the editorial section
|
|
3
|
+
// uses; `now` refreshes at mount so schedule awareness starts truthful.
|
|
4
|
+
const parsed = featureSchemas.universalBannerPropsSchema.parse(props)
|
|
5
|
+
const [now, setNow] = useState(parsed.data.now)
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
setNow(new Date().toISOString())
|
|
8
|
+
}, [])
|
|
9
|
+
return <UniversalBannerBlock data={{ ...parsed.data, now }} />
|
|
10
|
+
},
|
|
@@ -82,13 +82,257 @@ export const categoriesContent = {
|
|
|
82
82
|
viewAllLabel: 'Ver todas las categorías',
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
/**
|
|
86
|
+
* Banner-hero campaign (hero slot, UniversalBanner variant). Editorial content
|
|
87
|
+
* in the marketplace deal-wall voice: every destination is a real category or
|
|
88
|
+
* product handle, and every price, compare-at anchor, and discount percentage
|
|
89
|
+
* is derivable from real variant data in the connected catalog. Copy claims:
|
|
90
|
+
* Atlas $1.890 / antes $2.190 (−12%…−13% pair), Aurora $129 / antes $159
|
|
91
|
+
* (−19%), Luna $82, Helios $96. A conformance test pins each claim to the
|
|
92
|
+
* catalog fixtures, so editing a claim to an unsupported value fails CI.
|
|
93
|
+
*/
|
|
94
|
+
const bannerScene = (svg: string) =>
|
|
95
|
+
'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svg)
|
|
96
|
+
|
|
97
|
+
// Warm living-room scene for the salon anchor deal: cream wall, window light,
|
|
98
|
+
// bouclé sofa silhouette with a terracotta cushion.
|
|
99
|
+
const salonDesktop = bannerScene(
|
|
100
|
+
`<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='900' viewBox='0 0 1600 900'><defs><linearGradient id='wall' x1='0' y1='0' x2='0' y2='1'><stop offset='0' stop-color='#f2e9dd'/><stop offset='1' stop-color='#e5d6c3'/></linearGradient><linearGradient id='glow' x1='0' y1='0' x2='1' y2='0'><stop offset='0' stop-color='#fff6e8' stop-opacity='0.95'/><stop offset='1' stop-color='#fff6e8' stop-opacity='0'/></linearGradient></defs><rect width='1600' height='900' fill='url(#wall)'/><rect x='980' y='90' width='380' height='560' rx='18' fill='#fdfaf4' opacity='0.9'/><rect x='1010' y='120' width='320' height='500' rx='12' fill='url(#glow)'/><rect x='0' y='720' width='1600' height='180' fill='#d9c4a8'/><g fill='#efe3d2' stroke='#c9b295' stroke-width='6'><rect x='330' y='430' width='740' height='240' rx='46'/><rect x='330' y='340' width='360' height='140' rx='42'/><rect x='700' y='340' width='370' height='140' rx='42'/></g><rect x='620' y='470' width='120' height='90' rx='24' fill='#c96f4a'/><rect x='1120' y='250' width='140' height='470' rx='14' fill='#b7a184' opacity='0.7'/><circle cx='1190' cy='210' r='52' fill='#8a9b6e'/><text x='90' y='140' font-family='system-ui, sans-serif' font-size='40' fill='#8b7a63' opacity='0.55'>SALÓN</text></svg>`,
|
|
101
|
+
)
|
|
102
|
+
const salonMobile = bannerScene(
|
|
103
|
+
`<svg xmlns='http://www.w3.org/2000/svg' width='640' height='960' viewBox='0 0 640 960'><defs><linearGradient id='wallm' x1='0' y1='0' x2='0' y2='1'><stop offset='0' stop-color='#f2e9dd'/><stop offset='1' stop-color='#e5d6c3'/></linearGradient></defs><rect width='640' height='960' fill='url(#wallm)'/><rect x='60' y='140' width='520' height='300' rx='16' fill='#fdfaf4' opacity='0.9'/><rect x='0' y='760' width='640' height='200' fill='#d9c4a8'/><g fill='#efe3d2' stroke='#c9b295' stroke-width='5'><rect x='80' y='520' width='480' height='220' rx='40'/><rect x='80' y='440' width='230' height='120' rx='34'/><rect x='320' y='440' width='240' height='120' rx='34'/></g><rect x='270' y='550' width='100' height='76' rx='20' fill='#c96f4a'/></svg>`,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
// Cool quilted-jacket scene for the Aurora deal tile (catalog imageHue 222).
|
|
107
|
+
const auroraDesktop = bannerScene(
|
|
108
|
+
`<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='900' viewBox='0 0 1600 900'><defs><linearGradient id='night' x1='0' y1='0' x2='1' y2='1'><stop offset='0' stop-color='#2b3d55'/><stop offset='1' stop-color='#1d2940'/></linearGradient></defs><rect width='1600' height='900' fill='url(#night)'/><circle cx='1240' cy='260' r='150' fill='#3d5578' opacity='0.5'/><g fill='#31445e' stroke='#4c6588' stroke-width='8'><path d='M690 300 L910 300 L980 420 L940 470 L940 760 L660 760 L660 470 L620 420 Z'/><path d='M790 300 L790 420' stroke='#4c6588' stroke-width='6'/></g><g stroke='#4c6588' stroke-width='4' opacity='0.8'><path d='M700 440 h200 M700 500 h200 M700 560 h200 M700 620 h200 M700 680 h200'/></g><rect x='0' y='760' width='1600' height='140' fill='#16213a'/><text x='90' y='140' font-family='system-ui, sans-serif' font-size='40' fill='#8fa8c8' opacity='0.6'>MODA</text></svg>`,
|
|
109
|
+
)
|
|
110
|
+
const auroraMobile = bannerScene(
|
|
111
|
+
`<svg xmlns='http://www.w3.org/2000/svg' width='640' height='960' viewBox='0 0 640 960'><rect width='640' height='960' fill='#2b3d55'/><circle cx='480' cy='260' r='120' fill='#3d5578' opacity='0.5'/><g fill='#31445e' stroke='#4c6588' stroke-width='7'><path d='M230 380 L410 380 L470 480 L436 524 L436 780 L204 780 L204 524 L170 480 Z'/></g><g stroke='#4c6588' stroke-width='4' opacity='0.8'><path d='M216 540 h208 M216 600 h208 M216 660 h208 M216 720 h208'/></g><rect x='0' y='820' width='640' height='140' fill='#16213a'/></svg>`,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
// Sage-wall arch mirror scene for the arrivals tile.
|
|
115
|
+
const arrivalsDesktop = bannerScene(
|
|
116
|
+
`<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='900' viewBox='0 0 1600 900'><rect width='1600' height='900' fill='#dde4d8'/><rect x='0' y='700' width='1600' height='200' fill='#c2cbb8'/><g><path d='M620 660 L620 340 Q620 220 740 220 Q860 220 860 340 L860 660 Z' fill='#d9c9a8' stroke='#b09b74' stroke-width='10'/><path d='M650 640 L650 350 Q650 260 740 260 Q830 260 830 350 L830 640 Z' fill='#eef2ea'/><path d='M660 620 L660 356 Q660 276 740 276 Q800 276 812 320 L688 620 Z' fill='#ffffff' opacity='0.55'/></g><rect x='1020' y='420' width='90' height='280' rx='10' fill='#b7a184' opacity='0.8'/><circle cx='1065' cy='380' r='46' fill='#8a9b6e'/><circle cx='1045' cy='340' r='26' fill='#9daf80'/><rect x='240' y='560' width='120' height='140' rx='22' fill='#c96f4a' opacity='0.85'/><text x='90' y='140' font-family='system-ui, sans-serif' font-size='40' fill='#75816a' opacity='0.6'>HOGAR</text></svg>`,
|
|
117
|
+
)
|
|
118
|
+
const arrivalsMobile = bannerScene(
|
|
119
|
+
`<svg xmlns='http://www.w3.org/2000/svg' width='640' height='960' viewBox='0 0 640 960'><rect width='640' height='960' fill='#dde4d8'/><rect x='0' y='760' width='640' height='200' fill='#c2cbb8'/><path d='M210 700 L210 380 Q210 250 320 250 Q430 250 430 380 L430 700 Z' fill='#d9c9a8' stroke='#b09b74' stroke-width='9'/><path d='M236 680 L236 390 Q236 296 320 296 Q404 296 404 390 L404 680 Z' fill='#eef2ea'/><path d='M246 660 L246 400 Q246 316 320 316 Q376 316 388 356 L282 660 Z' fill='#ffffff' opacity='0.55'/><rect x='470' y='500' width='70' height='220' rx='10' fill='#b7a184' opacity='0.8'/><circle cx='505' cy='460' r='38' fill='#8a9b6e'/></svg>`,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
// Gift scene for the under-$100 tile: berry crossbody bag on a pedestal.
|
|
123
|
+
const giftsDesktop = bannerScene(
|
|
124
|
+
`<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='900' viewBox='0 0 1600 900'><rect width='1600' height='900' fill='#f3e7e2'/><rect x='0' y='720' width='1600' height='180' fill='#e0cdc6'/><rect x='560' y='640' width='480' height='90' rx='14' fill='#d8c2ba'/><rect x='600' y='300' width='400' height='350' rx='30' fill='#a4465c'/><path d='M700 300 Q700 210 800 210 Q900 210 900 300' fill='none' stroke='#7d3346' stroke-width='22'/><rect x='600' y='420' width='400' height='26' fill='#7d3346' opacity='0.5'/><rect x='770' y='392' width='60' height='80' rx='10' fill='#e8c8a0'/><circle cx='1160' cy='250' r='90' fill='#e8c8a0' opacity='0.5'/><text x='90' y='140' font-family='system-ui, sans-serif' font-size='40' fill='#9c7c74' opacity='0.6'>REGALO</text></svg>`,
|
|
125
|
+
)
|
|
126
|
+
const giftsMobile = bannerScene(
|
|
127
|
+
`<svg xmlns='http://www.w3.org/2000/svg' width='640' height='960' viewBox='0 0 640 960'><rect width='640' height='960' fill='#f3e7e2'/><rect x='0' y='780' width='640' height='180' fill='#e0cdc6'/><rect x='170' y='700' width='300' height='80' rx='12' fill='#d8c2ba'/><rect x='200' y='400' width='240' height='300' rx='26' fill='#a4465c'/><path d='M270 400 Q270 320 320 320 Q370 320 370 400' fill='none' stroke='#7d3346' stroke-width='20'/><rect x='200' y='510' width='240' height='22' fill='#7d3346' opacity='0.5'/><rect x='292' y='484' width='52' height='66' rx='9' fill='#e8c8a0'/></svg>`,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
export const heroBannerData = {
|
|
131
|
+
campaign: {
|
|
132
|
+
schemaVersion: 1,
|
|
133
|
+
campaignId: 'campaign-thor-salon',
|
|
134
|
+
banners: [
|
|
135
|
+
{
|
|
136
|
+
id: 'banner-salon-oferta',
|
|
137
|
+
campaignId: 'campaign-thor-salon',
|
|
138
|
+
content: {
|
|
139
|
+
name: 'El salón en oferta',
|
|
140
|
+
alt: 'Sofá modular de bouclé crema en un salón cálido con luz de ventana',
|
|
141
|
+
title: 'El salón está en oferta',
|
|
142
|
+
subtitle: 'Sofás, mesas y sillones con precio real',
|
|
143
|
+
description:
|
|
144
|
+
'Atlas modular en bouclé desde $1.890 (antes $2.190). Piezas seleccionadas de salón y comedor.',
|
|
145
|
+
badge: 'Oferta',
|
|
146
|
+
target: { kind: 'category', id: 'furniture' },
|
|
147
|
+
ctas: [
|
|
148
|
+
{ id: 'cta-salon', label: 'Ver salón', target: { kind: 'category', id: 'furniture' }, tone: 'primary' },
|
|
149
|
+
{ id: 'cta-atlas', label: 'Comprar Atlas', target: { kind: 'product', id: 'atlas-sofa' }, tone: 'secondary' },
|
|
150
|
+
],
|
|
151
|
+
},
|
|
152
|
+
media: { desktop: salonDesktop, mobile: salonMobile },
|
|
153
|
+
presentation: {
|
|
154
|
+
mode: 'overlay',
|
|
155
|
+
width: 'full',
|
|
156
|
+
height: 'auto',
|
|
157
|
+
heightToken: 'lg',
|
|
158
|
+
aspect: 'tall',
|
|
159
|
+
fit: 'cover',
|
|
160
|
+
focal: 'center',
|
|
161
|
+
align: 'start',
|
|
162
|
+
radius: '2xl',
|
|
163
|
+
surface: 'card',
|
|
164
|
+
overlay: 'gradient',
|
|
165
|
+
overlayOpacity: 'strong',
|
|
166
|
+
padding: 'lg',
|
|
167
|
+
textScale: 'lg',
|
|
168
|
+
},
|
|
169
|
+
visible: true,
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: 'banner-aurora-deal',
|
|
173
|
+
campaignId: 'campaign-thor-salon',
|
|
174
|
+
content: {
|
|
175
|
+
name: 'Aurora en oferta',
|
|
176
|
+
alt: 'Chaqueta acolchada azul medianoche sobre fondo frío',
|
|
177
|
+
title: '−19% en Aurora',
|
|
178
|
+
description: 'Chaqueta acolchada en medianoche: $129 (antes $159). Tallas S a M.',
|
|
179
|
+
badge: 'Oferta',
|
|
180
|
+
target: { kind: 'product', id: 'aurora-jacket' },
|
|
181
|
+
ctas: [
|
|
182
|
+
{ id: 'cta-aurora', label: 'Ver chaqueta', target: { kind: 'product', id: 'aurora-jacket' }, tone: 'primary' },
|
|
183
|
+
],
|
|
184
|
+
},
|
|
185
|
+
media: { desktop: auroraDesktop, mobile: auroraMobile },
|
|
186
|
+
presentation: {
|
|
187
|
+
mode: 'overlay',
|
|
188
|
+
width: 'full',
|
|
189
|
+
height: 'auto',
|
|
190
|
+
heightToken: 'sm',
|
|
191
|
+
aspect: 'photo',
|
|
192
|
+
fit: 'cover',
|
|
193
|
+
focal: 'center',
|
|
194
|
+
align: 'start',
|
|
195
|
+
radius: '2xl',
|
|
196
|
+
surface: 'card',
|
|
197
|
+
overlay: 'scrim',
|
|
198
|
+
overlayOpacity: 'medium',
|
|
199
|
+
padding: 'md',
|
|
200
|
+
textScale: 'sm',
|
|
201
|
+
},
|
|
202
|
+
visible: true,
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
id: 'banner-nuevas-llegadas',
|
|
206
|
+
campaignId: 'campaign-thor-salon',
|
|
207
|
+
content: {
|
|
208
|
+
name: 'Nuevas llegadas',
|
|
209
|
+
alt: 'Espejo de arco dorado junto a una planta sobre pared verde salvia',
|
|
210
|
+
title: 'Recién llegados a casa',
|
|
211
|
+
description: 'Espejo arco, cojines y la lámpara de cerámica ya están aquí.',
|
|
212
|
+
badge: 'Nuevo',
|
|
213
|
+
target: { kind: 'category', id: 'furniture' },
|
|
214
|
+
ctas: [
|
|
215
|
+
{ id: 'cta-novedades', label: 'Ver novedades', target: { kind: 'category', id: 'furniture' }, tone: 'secondary' },
|
|
216
|
+
],
|
|
217
|
+
},
|
|
218
|
+
media: { desktop: arrivalsDesktop, mobile: arrivalsMobile },
|
|
219
|
+
presentation: {
|
|
220
|
+
mode: 'overlay',
|
|
221
|
+
width: 'full',
|
|
222
|
+
height: 'auto',
|
|
223
|
+
heightToken: 'sm',
|
|
224
|
+
aspect: 'photo',
|
|
225
|
+
fit: 'cover',
|
|
226
|
+
focal: 'center',
|
|
227
|
+
align: 'start',
|
|
228
|
+
radius: '2xl',
|
|
229
|
+
surface: 'card',
|
|
230
|
+
overlay: 'scrim',
|
|
231
|
+
overlayOpacity: 'light',
|
|
232
|
+
padding: 'md',
|
|
233
|
+
textScale: 'sm',
|
|
234
|
+
},
|
|
235
|
+
visible: true,
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
id: 'banner-guia-regalo',
|
|
239
|
+
campaignId: 'campaign-thor-salon',
|
|
240
|
+
content: {
|
|
241
|
+
name: 'Guía de regalo',
|
|
242
|
+
alt: 'Bandolera color baya sobre un pedestal claro',
|
|
243
|
+
title: 'Regalos bajo $100',
|
|
244
|
+
description: 'Luna a $82 y Helios a $96: piezas listas para regalar.',
|
|
245
|
+
badge: 'Menos de $100',
|
|
246
|
+
target: { kind: 'category', id: 'accessories' },
|
|
247
|
+
ctas: [
|
|
248
|
+
{ id: 'cta-regalos', label: 'Ver regalos', target: { kind: 'category', id: 'accessories' }, tone: 'primary' },
|
|
249
|
+
],
|
|
250
|
+
},
|
|
251
|
+
media: { desktop: giftsDesktop, mobile: giftsMobile },
|
|
252
|
+
presentation: {
|
|
253
|
+
mode: 'overlay',
|
|
254
|
+
width: 'full',
|
|
255
|
+
height: 'auto',
|
|
256
|
+
heightToken: 'sm',
|
|
257
|
+
aspect: 'photo',
|
|
258
|
+
fit: 'cover',
|
|
259
|
+
focal: 'center',
|
|
260
|
+
align: 'start',
|
|
261
|
+
radius: '2xl',
|
|
262
|
+
surface: 'card',
|
|
263
|
+
overlay: 'scrim',
|
|
264
|
+
overlayOpacity: 'medium',
|
|
265
|
+
padding: 'md',
|
|
266
|
+
textScale: 'sm',
|
|
267
|
+
},
|
|
268
|
+
visible: true,
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
},
|
|
272
|
+
config: {
|
|
273
|
+
schemaVersion: 1,
|
|
274
|
+
blockId: 'home-hero-universal-banner',
|
|
275
|
+
name: 'Banners de portada',
|
|
276
|
+
visible: true,
|
|
277
|
+
scheduleAware: true,
|
|
278
|
+
responsiveEnabled: true,
|
|
279
|
+
presentation: 'grid',
|
|
280
|
+
preset: 'hero-three',
|
|
281
|
+
refs: [
|
|
282
|
+
{ bannerId: 'banner-salon-oferta' },
|
|
283
|
+
{ bannerId: 'banner-aurora-deal' },
|
|
284
|
+
{ bannerId: 'banner-nuevas-llegadas' },
|
|
285
|
+
{ bannerId: 'banner-guia-regalo' },
|
|
286
|
+
],
|
|
287
|
+
layout: {
|
|
288
|
+
gapX: 'md',
|
|
289
|
+
gapY: 'md',
|
|
290
|
+
maxWidth: 'full',
|
|
291
|
+
maxHeight: 'lg',
|
|
292
|
+
align: 'center',
|
|
293
|
+
radius: '2xl',
|
|
294
|
+
},
|
|
295
|
+
carousel: {
|
|
296
|
+
visible: { base: 1, md: 2, '2xl': 3 },
|
|
297
|
+
autoplay: false,
|
|
298
|
+
intervalMs: 6000,
|
|
299
|
+
loop: true,
|
|
300
|
+
indicators: true,
|
|
301
|
+
carouselOnMobile: false,
|
|
302
|
+
peek: true,
|
|
303
|
+
story: false,
|
|
304
|
+
},
|
|
305
|
+
rules: {
|
|
306
|
+
emptyLabel: 'No hay banners publicados ahora mismo.',
|
|
307
|
+
inactiveLabel: 'Esta campaña no está activa.',
|
|
308
|
+
danglingLabel: 'El destino de este banner ya no existe.',
|
|
309
|
+
},
|
|
310
|
+
},
|
|
311
|
+
now: '2026-01-01T00:00:00.000Z',
|
|
312
|
+
banner: {
|
|
313
|
+
carouselPrevious: 'Banner anterior',
|
|
314
|
+
carouselNext: 'Banner siguiente',
|
|
315
|
+
carouselStatus: 'Banner {page} de {pages}',
|
|
316
|
+
carouselRole: 'Carrusel de banners',
|
|
317
|
+
storyPrevious: 'Historia anterior',
|
|
318
|
+
storyNext: 'Historia siguiente',
|
|
319
|
+
storyRole: 'Historias de banners',
|
|
320
|
+
},
|
|
321
|
+
}
|
|
322
|
+
|
|
85
323
|
/**
|
|
86
324
|
* Editorial section instance content, keyed by the section instance id the
|
|
87
325
|
* manifest persists (`views[].sections[].id`, e.g. `home-faq-1`). The derived
|
|
88
326
|
* view module reads `sectionContent[id]`, so adding, reordering, or removing a
|
|
89
327
|
* section never rewrites this file and your copy survives `storefront sync`.
|
|
90
|
-
* A configured `sections/<id>.json` sidecar wins over this map for that instance.
|
|
91
328
|
* Plain data only, matching the section fragment's props; an unset id renders
|
|
92
329
|
* the section's neutral default.
|
|
93
330
|
*/
|
|
94
|
-
export const sectionContent: Record<string, Record<string, unknown>> = {
|
|
331
|
+
export const sectionContent: Record<string, Record<string, unknown>> = {
|
|
332
|
+
'home-products-1': {
|
|
333
|
+
heading: 'Los más vendidos en tu tienda',
|
|
334
|
+
description: 'Piezas reales del catálogo, con sus descuentos honestos.',
|
|
335
|
+
ctaLabel: 'Ver todo el catálogo',
|
|
336
|
+
ctaHref: '/categories',
|
|
337
|
+
},
|
|
338
|
+
}
|
|
@@ -21,4 +21,13 @@ export function toNavCategories(
|
|
|
21
21
|
// by default: a data-bound section with no entry renders an `unconfigured`
|
|
22
22
|
// state. Entries whose id is no longer referenced by the composition are kept
|
|
23
23
|
// but never queried, so re-adding the section with the same id restores them.
|
|
24
|
-
export const sectionSources: Record<string, unknown> = {
|
|
24
|
+
export const sectionSources: Record<string, unknown> = {
|
|
25
|
+
// The seeded merchandising grid: the mock catalog's real `best-sellers`
|
|
26
|
+
// collection through the canonical catalog bridge. The id matches the
|
|
27
|
+
// auto-minted instance id of the recipe's default `products` seed.
|
|
28
|
+
'home-products-1': {
|
|
29
|
+
kind: 'products',
|
|
30
|
+
query: { collections: ['best-sellers'], pageSize: 8 },
|
|
31
|
+
maxItems: 8,
|
|
32
|
+
},
|
|
33
|
+
}
|
|
@@ -12,6 +12,7 @@ import type { ViewModule } from '../types'
|
|
|
12
12
|
import { registry } from './registry'
|
|
13
13
|
import { sectionData } from './sections-data'
|
|
14
14
|
import { benefitsProps, categoriesProps, heroProps } from './props'
|
|
15
|
+
import * as homeProps from './props'
|
|
15
16
|
import * as homeData from './data'
|
|
16
17
|
import { toCategoryCard, toFeaturedProduct } from '../../mappers'
|
|
17
18
|
import { resolveSectionSources, resolveSectionViewStates } from '../../section-sources'
|
|
@@ -21,14 +22,14 @@ import {
|
|
|
21
22
|
featurePropsSchema,
|
|
22
23
|
storefrontHeroPropsSchema,
|
|
23
24
|
} from './schema'
|
|
25
|
+
import * as homeSchemas from './schema'
|
|
24
26
|
|
|
25
27
|
// The element tree is derived wiring; the rendered props come from the
|
|
26
28
|
// user-owned ./props.ts module so they survive sync and unit removal.
|
|
27
29
|
const elements: Record<string, StorefrontElement> = {
|
|
28
30
|
'home.hero': {
|
|
29
|
-
type: '
|
|
30
|
-
props:
|
|
31
|
-
on: { addClickedToCart: { action: 'addClickedToCart' }, openProduct: { action: 'openProduct' } },
|
|
31
|
+
type: 'UniversalBanner',
|
|
32
|
+
props: homeProps.heroBannerProps,
|
|
32
33
|
},
|
|
33
34
|
'home.benefits': {
|
|
34
35
|
type: 'Feature',
|
|
@@ -42,9 +43,9 @@ const elements: Record<string, StorefrontElement> = {
|
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
const catalog = {
|
|
45
|
-
|
|
46
|
-
props:
|
|
47
|
-
description: '
|
|
46
|
+
UniversalBanner: {
|
|
47
|
+
props: homeSchemas.universalBannerPropsSchema,
|
|
48
|
+
description: 'Campaign banner collection (presentations: single, grid, carousel).',
|
|
48
49
|
},
|
|
49
50
|
Feature: {
|
|
50
51
|
props: featurePropsSchema,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// and binds them into the element tree, so edits here survive `storefront sync`
|
|
5
5
|
// and unit removal. Plain data only: no React and no server imports.
|
|
6
6
|
|
|
7
|
-
import { benefitsContent, categoriesContent, heroContent, heroImage } from './content'
|
|
7
|
+
import { benefitsContent, categoriesContent, heroContent, heroBannerData, heroImage } from './content'
|
|
8
8
|
|
|
9
9
|
export const heroProps = {
|
|
10
10
|
...heroContent,
|
|
@@ -12,6 +12,12 @@ export const heroProps = {
|
|
|
12
12
|
heroImage,
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
+
// Banner-hero campaign props (hero slot, UniversalBanner variant). The wrapper
|
|
16
|
+
// shape mirrors `universalBannerPropsSchema` in ./schema.ts.
|
|
17
|
+
export const heroBannerProps = {
|
|
18
|
+
data: heroBannerData,
|
|
19
|
+
}
|
|
20
|
+
|
|
15
21
|
export const benefitsProps = {
|
|
16
22
|
...benefitsContent,
|
|
17
23
|
}
|
|
@@ -11,9 +11,10 @@
|
|
|
11
11
|
// the boundary instead of rendering undefined fields or literal icon tags.
|
|
12
12
|
|
|
13
13
|
import { CategoryCard as CategoryCardBlock } from '@thorprovider/blocks/blocks/e-commerce/product-categories/category-card'
|
|
14
|
+
import { UniversalBanner as UniversalBannerBlock } from '@thorprovider/blocks'
|
|
14
15
|
import { CategoryGrid as CategoryGridBlock } from '@thorprovider/blocks/blocks/e-commerce/product-categories/product-category-grid'
|
|
15
|
-
import { StorefrontHero as StorefrontHeroBlock } from '@thorprovider/blocks/blocks/e-commerce/storefront-hero/storefront-hero'
|
|
16
16
|
import { Feature as FeatureBlock } from '@thorprovider/blocks/blocks/marketing/features/feature'
|
|
17
|
+
import { useEffect, useState } from 'react'
|
|
17
18
|
import { useStateStore } from '@json-render/react'
|
|
18
19
|
import { resolveIcon } from '../../icon-map'
|
|
19
20
|
import type { ViewRegistry } from '../types'
|
|
@@ -26,33 +27,15 @@ import {
|
|
|
26
27
|
} from './schema'
|
|
27
28
|
|
|
28
29
|
export const registry: ViewRegistry = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
products={hero.products}
|
|
39
|
-
titleAccent={hero.titleAccent}
|
|
40
|
-
badge={hero.badge}
|
|
41
|
-
primaryCta={hero.primaryCta}
|
|
42
|
-
secondaryCta={hero.secondaryCta}
|
|
43
|
-
heroImage={hero.heroImage}
|
|
44
|
-
rotationInterval={hero.rotationInterval}
|
|
45
|
-
onAddToCart={(product) => {
|
|
46
|
-
// Product-card shortcut: add the first purchasable variant.
|
|
47
|
-
set('/lastClicked', product)
|
|
48
|
-
emit('addClickedToCart')
|
|
49
|
-
}}
|
|
50
|
-
onBuyNow={(product) => {
|
|
51
|
-
set('/lastClicked', product)
|
|
52
|
-
emit('openProduct')
|
|
53
|
-
}}
|
|
54
|
-
/>
|
|
55
|
-
)
|
|
30
|
+
UniversalBanner: ({ props }) => {
|
|
31
|
+
// The banner hero parses through the same contract the editorial section
|
|
32
|
+
// uses; `now` refreshes at mount so schedule awareness starts truthful.
|
|
33
|
+
const parsed = featureSchemas.universalBannerPropsSchema.parse(props)
|
|
34
|
+
const [now, setNow] = useState(parsed.data.now)
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
setNow(new Date().toISOString())
|
|
37
|
+
}, [])
|
|
38
|
+
return <UniversalBannerBlock data={{ ...parsed.data, now }} />
|
|
56
39
|
},
|
|
57
40
|
Feature: ({ props }) => {
|
|
58
41
|
const feature = featureSchemas.featureCardsSpecSchema.parse({
|