@thorprovider/storefront 0.9.0 → 0.11.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 (66) hide show
  1. package/README.md +8 -5
  2. package/assets/templates/app/app/globals.css +0 -1
  3. package/assets/templates/app/lib/__STOREFRONT__/account-session.core.ts +4 -2
  4. package/assets/templates/app/lib/__STOREFRONT__/account-user.core.ts +2 -1
  5. package/assets/templates/app/lib/__STOREFRONT__/actions.ts +130 -12
  6. package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +156 -9
  7. package/assets/templates/app/lib/__STOREFRONT__/confirmation.core.ts +38 -3
  8. package/assets/templates/app/lib/__STOREFRONT__/fulfillment-evidence-port.ts +31 -0
  9. package/assets/templates/app/lib/__STOREFRONT__/handlers.core.ts +21 -4
  10. package/assets/templates/app/lib/__STOREFRONT__/mappers.ts +6 -2
  11. package/assets/templates/app/lib/__STOREFRONT__/order-detail-aftersales.ts +55 -0
  12. package/assets/templates/app/lib/__STOREFRONT__/order-detail-capabilities.ts +79 -0
  13. package/assets/templates/app/lib/__STOREFRONT__/order-detail-mapper.ts +653 -0
  14. package/assets/templates/app/lib/__STOREFRONT__/order-detail-money.ts +39 -0
  15. package/assets/templates/app/lib/__STOREFRONT__/order-detail-port.ts +6 -7
  16. package/assets/templates/app/lib/__STOREFRONT__/order-detail-reorder.ts +62 -0
  17. package/assets/templates/app/lib/__STOREFRONT__/ports.ts +13 -3
  18. package/assets/templates/views/account/assembly/assembly.json +0 -5
  19. package/assets/templates/views/account/assembly/index.skeleton.tsx +51 -0
  20. package/assets/templates/views/account/assembly/registry.skeleton.tsx +120 -68
  21. package/assets/templates/views/account/content.ts +13 -7
  22. package/assets/templates/views/account/fulfillment-evidence.client.tsx +34 -0
  23. package/assets/templates/views/account/fulfillment-evidence.defaults.ts +145 -0
  24. package/assets/templates/views/account/fulfillment-evidence.schema.ts +15 -0
  25. package/assets/templates/views/account/index.tsx +44 -3
  26. package/assets/templates/views/account/order-detail-flows.defaults.ts +106 -0
  27. package/assets/templates/views/account/order-detail-invoice.ts +136 -0
  28. package/assets/templates/views/account/order-detail-sheet.tsx +100 -0
  29. package/assets/templates/views/account/order-detail-sheets.tsx +122 -0
  30. package/assets/templates/views/account/order-detail.client.tsx +401 -1
  31. package/assets/templates/views/account/orders-advanced.client.tsx +10 -99
  32. package/assets/templates/views/account/orders-advanced.defaults.ts +7 -7
  33. package/assets/templates/views/account/registry.tsx +120 -69
  34. package/assets/templates/views/account/schema.ts +2 -0
  35. package/assets/templates/views/home/assembly/assembly.json +1 -1
  36. package/assets/templates/views/home/assembly/index.skeleton.tsx +3 -1
  37. package/assets/templates/views/home/assembly/registry.skeleton.tsx +1 -0
  38. package/assets/templates/views/home/assembly/slots/hero/UniversalBanner/binding.json +5 -0
  39. package/assets/templates/views/home/assembly/slots/hero/UniversalBanner/catalog.part +4 -0
  40. package/assets/templates/views/home/assembly/slots/hero/UniversalBanner/element.part +4 -0
  41. package/assets/templates/views/home/assembly/slots/hero/UniversalBanner/registry.part +10 -0
  42. package/assets/templates/views/home/content.ts +248 -2
  43. package/assets/templates/views/home/data.ts +10 -1
  44. package/assets/templates/views/home/index.tsx +7 -6
  45. package/assets/templates/views/home/props.ts +7 -1
  46. package/assets/templates/views/home/registry.tsx +11 -28
  47. package/assets/templates/views/home/schema.ts +163 -0
  48. package/assets/templates/views/product/data.ts +13 -6
  49. package/assets/templates/views/product/index.tsx +3 -3
  50. package/bin/storefront.js +18 -18
  51. package/package.json +1 -1
  52. package/recipes/adapter-surface.json +1 -0
  53. package/recipes/archetypes.json +5 -1
  54. package/recipes/catalog.json +9 -1
  55. package/recipes/recipes.json +5 -4
  56. package/scripts/candidate.mjs +59 -14
  57. package/scripts/file-classes.mjs +4 -0
  58. package/scripts/mock-capabilities.mjs +22 -0
  59. package/scripts/reconcile.mjs +5 -2
  60. package/scripts/render-templates.mjs +126 -43
  61. package/skills/sf-view-gen/assets/recipes/archetypes.json +5 -1
  62. package/skills/sf-view-gen/assets/recipes/catalog.json +9 -1
  63. package/skills/sf-view-gen/assets/recipes/recipes.json +5 -4
  64. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/catalog.part +0 -5
  65. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/element.part +0 -5
  66. 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: false,
30
- shipmentTracking: false,
31
- pickupTracking: false,
32
- returns: false,
33
- exchanges: false,
29
+ tableView: true,
30
+ shipmentTracking: true,
31
+ pickupTracking: true,
32
+ returns: true,
33
+ exchanges: true,
34
34
  claims: false,
35
- reorder: false,
36
- invoices: false,
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,
@@ -120,6 +120,15 @@ const SHELL_DEFAULTS = {
120
120
  },
121
121
  overview: {
122
122
  sections: 'Secciones de tu cuenta',
123
+ // The card summaries are preformatted text, exactly what the host passes. A
124
+ // module with nothing inside keeps its card summary-less: the overview never
125
+ // prints a zero to fill space.
126
+ summaries: {
127
+ orders: '{count} pedidos',
128
+ ordersOne: '1 pedido',
129
+ addresses: '{count} guardadas',
130
+ addressesOne: '1 guardada',
131
+ },
123
132
  },
124
133
  placeholder: {
125
134
  badge: 'Próximamente',
@@ -184,6 +193,10 @@ const shellContent = {
184
193
  overview: {
185
194
  ...SHELL_DEFAULTS.overview,
186
195
  ...(accountContentCompat.overview ?? {}),
196
+ summaries: {
197
+ ...SHELL_DEFAULTS.overview.summaries,
198
+ ...(accountContentCompat.overview?.summaries ?? {}),
199
+ },
187
200
  },
188
201
  placeholder: {
189
202
  ...SHELL_DEFAULTS.placeholder,
@@ -362,14 +375,29 @@ function shellCustomer(customer: Customer): CustomerAccountV1Props['context']['c
362
375
  .map((part) => part[0])
363
376
  .join('')
364
377
  .toUpperCase() || customer.email.slice(0, 2).toUpperCase()
378
+ const memberSince = memberSinceLabel(customer.createdAt)
365
379
  return {
366
380
  name,
367
381
  email: customer.email,
368
382
  initials,
369
383
  ...(customer.phone ? { phone: customer.phone } : {}),
384
+ ...(memberSince ? { memberSince } : {}),
370
385
  }
371
386
  }
372
387
 
388
+ /**
389
+ * The join date the header prints as "Cliente desde {date}". Only the month and
390
+ * year leave the store ("marzo de 2023"), the same granularity the account
391
+ * surface needs; an absent or unparseable date simply hides the line instead of
392
+ * inventing one.
393
+ */
394
+ function memberSinceLabel(createdAt: string | null | undefined): string | undefined {
395
+ if (!createdAt) return undefined
396
+ const date = new Date(createdAt)
397
+ if (Number.isNaN(date.getTime())) return undefined
398
+ return new Intl.DateTimeFormat('es-ES', { month: 'long', year: 'numeric' }).format(date)
399
+ }
400
+
373
401
  function shellState(state: AccountState): CustomerAccountV1Props['state'] {
374
402
  if (state.accountReconciling === true) return { status: 'loading' }
375
403
  if (state.accountResolution === 'unavailable') {
@@ -434,10 +462,93 @@ function AccountShellPanel({ children }: ShellPanelProps) {
434
462
  )
435
463
  }
436
464
 
465
+ /** One order row is enough to read the authoritative page count. */
466
+ const OVERVIEW_ORDERS_PAGE_SIZE = 1
467
+
468
+ function summaryText(template: string, single: string, count: number): string {
469
+ return count === 1 ? single : template.replaceAll('{count}', String(count))
470
+ }
471
+
472
+ /**
473
+ * Preformatted card summaries. The overview names how much is waiting inside the
474
+ * modules, so it reads the two counters the modules load anyway: the order page
475
+ * count and the saved-address list. Nothing is invented — a module the store
476
+ * does not offer is never counted, a failed read leaves the card summary-less,
477
+ * and an empty module prints no zero.
478
+ */
479
+ function overviewSummaries(
480
+ state: AccountState,
481
+ capabilities: CustomerAccountOverviewProps['capabilities'],
482
+ ): Record<string, string> {
483
+ const summaries: Record<string, string> = {}
484
+ const orderCount =
485
+ typeof state.accountOrdersCount === 'number' ? state.accountOrdersCount : 0
486
+ const addressCount = Array.isArray(state.accountAddresses)
487
+ ? state.accountAddresses.length
488
+ : 0
489
+ if (capabilities.orderHistory === true && orderCount > 0) {
490
+ summaries.orders = summaryText(
491
+ shellContent.overview.summaries.orders,
492
+ shellContent.overview.summaries.ordersOne,
493
+ orderCount,
494
+ )
495
+ }
496
+ if (capabilities.addressBook === true && addressCount > 0) {
497
+ summaries.addresses = summaryText(
498
+ shellContent.overview.summaries.addresses,
499
+ shellContent.overview.summaries.addressesOne,
500
+ addressCount,
501
+ )
502
+ }
503
+ return summaries
504
+ }
505
+
437
506
  function AccountOverviewPanel() {
438
- const { state } = useStateStore()
507
+ const { state, set } = useStateStore()
439
508
  const pathname = usePathname()
440
509
  const router = useRouter()
510
+ const { identityKey, reconciling } = useAccountLifecycle()
511
+ const loadedKeyRef = useRef<string | null>(null)
512
+ const capabilities = shellCapabilities(state)
513
+ const authenticated = state.accountAuthenticated === true
514
+ const wantsOrders = capabilities.orderHistory === true
515
+ const wantsAddresses = capabilities.addressBook === true
516
+
517
+ // The overview is the only surface that needs a count without rendering the
518
+ // module, so it performs the same reads the module would and stores their
519
+ // result in the shared account state. Keyed by identity: a new shopper never
520
+ // inherits the previous one's counters, and a read that lands after an
521
+ // identity change is dropped instead of overwriting the new state.
522
+ useEffect(() => {
523
+ if (!authenticated || reconciling) return
524
+ if (pathname !== '/account') return
525
+ if (identityKey === 'anonymous') return
526
+ if (loadedKeyRef.current === identityKey) return
527
+ loadedKeyRef.current = identityKey
528
+ if (wantsOrders) {
529
+ void loadOrdersPageAction({ page: 1, pageSize: OVERVIEW_ORDERS_PAGE_SIZE })
530
+ .then((result) => {
531
+ if (result.ok && loadedKeyRef.current === identityKey) {
532
+ set('/accountOrdersCount', result.count)
533
+ }
534
+ })
535
+ .catch(() => {
536
+ // A failed count read is not an account error: the card keeps its
537
+ // description and simply shows no summary.
538
+ })
539
+ }
540
+ if (wantsAddresses) {
541
+ void loadAccountAddressesAction()
542
+ .then((result) => {
543
+ if (result.ok && loadedKeyRef.current === identityKey) {
544
+ set('/accountAddresses', result.addresses)
545
+ }
546
+ })
547
+ .catch(() => {
548
+ // Same rule as the order count: no summary beats a made-up number.
549
+ })
550
+ }
551
+ }, [authenticated, reconciling, pathname, identityKey, wantsOrders, wantsAddresses, set])
441
552
 
442
553
  useEffect(() => {
443
554
  if (pathname !== '/account') return
@@ -450,12 +561,12 @@ function AccountOverviewPanel() {
450
561
  return () => cancelAnimationFrame(frame)
451
562
  }, [pathname])
452
563
 
453
- if (!state.accountAuthenticated) return null
564
+ if (!authenticated) return null
454
565
  return (
455
566
  <AccountOverviewBlock
456
567
  title={shellContent.shellModules.overview.label}
457
- model={{ cards: shellCards(), summaries: {}, notice: null }}
458
- capabilities={shellCapabilities(state)}
568
+ model={{ cards: shellCards(), summaries: overviewSummaries(state, capabilities), notice: null }}
569
+ capabilities={capabilities}
459
570
  labels={{ sections: shellContent.overview.sections }}
460
571
  onOpenCard={(cardId) => {
461
572
  sessionStorage.setItem('account:origin-card', cardId)
@@ -566,62 +677,6 @@ function toOrderHistoryOrder(order: AccountOrderView): OrderHistoryOrder {
566
677
  }
567
678
  }
568
679
 
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
680
  function AccountLoginPanel({ props, emit }: PanelProps) {
626
681
  const { state } = useStateStore()
627
682
  const lifecycle = useAccountLifecycle()
@@ -943,6 +998,7 @@ function AccountAddressesPanel({ props }: PanelProps) {
943
998
  }
944
999
 
945
1000
  function AccountOrdersPanel({ props }: PanelProps) {
1001
+ const router = useRouter()
946
1002
  const { state, set, getSnapshot } = useStateStore()
947
1003
  const parsed = accountOrdersPropsSchema.parse(props)
948
1004
  const { identityKey, reconciling } = useAccountLifecycle()
@@ -1027,9 +1083,6 @@ function AccountOrdersPanel({ props }: PanelProps) {
1027
1083
  typeof state.accountOrdersPageSize === 'number' && state.accountOrdersPageSize > 0
1028
1084
  ? state.accountOrdersPageSize
1029
1085
  : 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
1086
  const labels: Partial<OrderHistoryLabels> = {
1034
1087
  ...(parsed.labels ?? {}),
1035
1088
  ...(parsed.titleLabel === undefined ? {} : { title: parsed.titleLabel }),
@@ -1074,7 +1127,7 @@ function AccountOrdersPanel({ props }: PanelProps) {
1074
1127
  orders={orders.map(toOrderHistoryOrder)}
1075
1128
  presentation="cards"
1076
1129
  labels={labels}
1077
- onViewOrder={(id) => set('/accountSelectedOrderId', id)}
1130
+ onViewOrder={(id) => router.push(`/account/orders/${encodeURIComponent(id)}`)}
1078
1131
  />
1079
1132
  {count > pageSize ? (
1080
1133
  <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 +1154,18 @@ function AccountOrdersPanel({ props }: PanelProps) {
1101
1154
  </div>
1102
1155
  </div>
1103
1156
  ) : null}
1104
- {selected ? (
1105
- <OrderDetail order={selected} onClose={() => set('/accountSelectedOrderId', null)} />
1106
- ) : null}
1107
1157
  </div>
1108
1158
  )
1109
1159
  }
1110
1160
 
1111
1161
  export const registry: ViewRegistry = {
1162
+ AccountBoot: ({ emit }) => <AccountBoundary emit={emit} />,
1112
1163
  AccountOrderDetail: (ctx) => <AccountOrderDetailPanel {...ctx} />,
1164
+ AccountFulfillmentEvidence: (ctx) => <AccountFulfillmentEvidencePanel {...ctx} />,
1113
1165
  AccountShell: (ctx) => <AccountShellPanel {...ctx} />,
1114
1166
  AccountOverview: () => <AccountOverviewPanel />,
1115
1167
  AccountModulePlaceholder: () => <AccountModulePlaceholderPanel />,
1116
1168
  AccountOrders: (ctx) => <AccountOrdersPanel {...ctx} />,
1117
- AccountBoot: ({ emit }) => <AccountBoundary emit={emit} />,
1118
1169
  AccountLogin: (ctx) => <AccountLoginPanel {...ctx} />,
1119
1170
  AccountRegister: (ctx) => <AccountRegisterPanel {...ctx} />,
1120
1171
  AccountFrame: (ctx) => <AccountFramePanel {...ctx} />,
@@ -118,6 +118,8 @@ export const accountOrderDetailPropsSchema = z.object({
118
118
  presentation: z.record(z.string(), z.unknown()).optional(),
119
119
  openSections: z.array(z.string()).optional(),
120
120
  access: z.enum(['allowed', 'forbidden']).optional(),
121
+ supportHref: z.string().optional(),
122
+ flows: z.record(z.string(), z.unknown()).optional(),
121
123
  })
122
124
 
123
125
  export type AccountOrderDetailProps = z.infer<typeof accountOrderDetailPropsSchema>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "view": "home",
3
3
  "slots": [
4
- { "id": "home.hero", "slot": "hero", "default": "StorefrontHero" },
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'@@SECTION_IMPORTS@@
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,5 @@
1
+ {
2
+ "module": "@thorprovider/blocks",
3
+ "import": "UniversalBanner",
4
+ "as": "UniversalBannerBlock"
5
+ }
@@ -0,0 +1,4 @@
1
+ UniversalBanner: {
2
+ props: homeSchemas.universalBannerPropsSchema,
3
+ description: 'Campaign banner collection (presentations: single, grid, carousel).',
4
+ },
@@ -0,0 +1,4 @@
1
+ 'home.hero': {
2
+ type: 'UniversalBanner',
3
+ props: homeProps.heroBannerProps,
4
+ },
@@ -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,259 @@ 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
+ // No media cap: the tall hero spans three grid rows, and a capped media
292
+ // leaves the rest of the card empty. Each cell sizes its own media.
293
+ maxHeight: 'none',
294
+ align: 'center',
295
+ radius: '2xl',
296
+ },
297
+ carousel: {
298
+ visible: { base: 1, md: 2, '2xl': 3 },
299
+ autoplay: false,
300
+ intervalMs: 6000,
301
+ loop: true,
302
+ indicators: true,
303
+ carouselOnMobile: false,
304
+ peek: true,
305
+ story: false,
306
+ },
307
+ rules: {
308
+ emptyLabel: 'No hay banners publicados ahora mismo.',
309
+ inactiveLabel: 'Esta campaña no está activa.',
310
+ danglingLabel: 'El destino de este banner ya no existe.',
311
+ },
312
+ },
313
+ now: '2026-01-01T00:00:00.000Z',
314
+ banner: {
315
+ carouselPrevious: 'Banner anterior',
316
+ carouselNext: 'Banner siguiente',
317
+ carouselStatus: 'Banner {page} de {pages}',
318
+ carouselRole: 'Carrusel de banners',
319
+ storyPrevious: 'Historia anterior',
320
+ storyNext: 'Historia siguiente',
321
+ storyRole: 'Historias de banners',
322
+ },
323
+ }
324
+
85
325
  /**
86
326
  * Editorial section instance content, keyed by the section instance id the
87
327
  * manifest persists (`views[].sections[].id`, e.g. `home-faq-1`). The derived
88
328
  * view module reads `sectionContent[id]`, so adding, reordering, or removing a
89
329
  * 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
330
  * Plain data only, matching the section fragment's props; an unset id renders
92
331
  * the section's neutral default.
93
332
  */
94
- export const sectionContent: Record<string, Record<string, unknown>> = {}
333
+ export const sectionContent: Record<string, Record<string, unknown>> = {
334
+ 'home-products-1': {
335
+ heading: 'Los más vendidos en tu tienda',
336
+ description: 'Piezas reales del catálogo, con sus descuentos honestos.',
337
+ ctaLabel: 'Ver todo el catálogo',
338
+ ctaHref: '/categories',
339
+ },
340
+ }