@thorprovider/storefront 0.14.0 → 0.15.1
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 +28 -12
- package/assets/templates/app/app/[[...slug]]/page.tsx +6 -0
- package/assets/templates/app/app/layout.tsx +2 -2
- package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +11 -4
- package/assets/templates/app/lib/__STOREFRONT__/confirmation.core.ts +7 -4
- package/assets/templates/app/lib/__STOREFRONT__/mappers.ts +18 -3
- package/assets/templates/app/lib/__STOREFRONT__/registry.tsx +10 -0
- package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +8 -0
- package/assets/templates/app/lib/__STOREFRONT__/store-context.ts +84 -18
- package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.universal-main-menu.ts +3 -1
- package/assets/templates/app/public/images/README.md +43 -0
- package/assets/templates/app/public/images/banners/banner-aurora-deal.webp +0 -0
- package/assets/templates/app/public/images/banners/banner-guia-regalo.webp +0 -0
- package/assets/templates/app/public/images/banners/banner-mesa-decor.webp +0 -0
- package/assets/templates/app/public/images/banners/banner-nuevas-llegadas.webp +0 -0
- package/assets/templates/app/public/images/banners/banner-salon-oferta.webp +0 -0
- package/assets/templates/app/public/images/categories/accessories.webp +0 -0
- package/assets/templates/app/public/images/categories/dresses.webp +0 -0
- package/assets/templates/app/public/images/categories/furniture.webp +0 -0
- package/assets/templates/app/public/images/categories/home.webp +0 -0
- package/assets/templates/app/public/images/categories/jackets.webp +0 -0
- package/assets/templates/app/public/images/editorial/studio.webp +0 -0
- package/assets/templates/app/public/images/products/alpine-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/amber-dress.webp +0 -0
- package/assets/templates/app/public/images/products/atlas-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/atlas-sofa.webp +0 -0
- package/assets/templates/app/public/images/products/aurora-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/boreal-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/camille-dress.webp +0 -0
- package/assets/templates/app/public/images/products/ceramic-table-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/cinder-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/copper-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/cove-bag.webp +0 -0
- package/assets/templates/app/public/images/products/dahlia-dress.webp +0 -0
- package/assets/templates/app/public/images/products/drift-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/dune-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/elara-dress.webp +0 -0
- package/assets/templates/app/public/images/products/ember-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/fable-bag.webp +0 -0
- package/assets/templates/app/public/images/products/fjord-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/floor-cushion.webp +0 -0
- package/assets/templates/app/public/images/products/harbor-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/helios-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/iris-dress.webp +0 -0
- package/assets/templates/app/public/images/products/juniper-bag.webp +0 -0
- package/assets/templates/app/public/images/products/kestrel-bag.webp +0 -0
- package/assets/templates/app/public/images/products/linen-armchair.webp +0 -0
- package/assets/templates/app/public/images/products/lumen-dress.webp +0 -0
- package/assets/templates/app/public/images/products/luna-bag.webp +0 -0
- package/assets/templates/app/public/images/products/marble-coffee-table.webp +0 -0
- package/assets/templates/app/public/images/products/marlowe-bag.webp +0 -0
- package/assets/templates/app/public/images/products/meridian-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/nomad-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/nova-dress.webp +0 -0
- package/assets/templates/app/public/images/products/oak-dining-table.webp +0 -0
- package/assets/templates/app/public/images/products/onyx-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/piper-bag.webp +0 -0
- package/assets/templates/app/public/images/products/quill-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/rosalind-dress.webp +0 -0
- package/assets/templates/app/public/images/products/rune-bag.webp +0 -0
- package/assets/templates/app/public/images/products/side-table.webp +0 -0
- package/assets/templates/app/public/images/products/slate-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/solis-dress.webp +0 -0
- package/assets/templates/app/public/images/products/storage-shelf.webp +0 -0
- package/assets/templates/app/public/images/products/terra-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/tundra-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/vantage-jacket.webp +0 -0
- package/assets/templates/app/public/images/products/vera-dress.webp +0 -0
- package/assets/templates/app/public/images/products/verdant-lamp.webp +0 -0
- package/assets/templates/app/public/images/products/wall-mirror.webp +0 -0
- package/assets/templates/app/public/images/products/wool-rug.webp +0 -0
- package/assets/templates/views/account/address-book-advanced.defaults.ts +1 -1
- package/assets/templates/views/cart/registry.tsx +9 -0
- package/assets/templates/views/checkout/checkout-commerce-hosted.tsx +5 -1
- package/assets/templates/views/home/assembly/assembly.json +0 -1
- package/assets/templates/views/home/assembly/index.skeleton.tsx +3 -7
- package/assets/templates/views/home/assembly/registry.skeleton.tsx +0 -3
- package/assets/templates/views/home/content.ts +34 -80
- package/assets/templates/views/home/data.ts +12 -0
- package/assets/templates/views/home/index.tsx +4 -21
- package/assets/templates/views/home/props.ts +1 -7
- package/assets/templates/views/home/registry.tsx +0 -35
- package/assets/templates/views/home/schema.ts +0 -36
- package/bin/storefront.js +12 -27
- package/package.json +3 -2
- package/recipes/archetypes.json +0 -21
- package/recipes/catalog.json +0 -22
- package/recipes/features.json +0 -2
- package/recipes/recipe.schema.json +5 -0
- package/recipes/recipes.json +19 -16
- package/recipes/validate.mjs +7 -0
- package/scripts/candidate.mjs +3 -3
- package/scripts/default-sections.mjs +1 -0
- package/scripts/env-file.mjs +10 -0
- package/scripts/file-classes.mjs +3 -0
- package/scripts/generate-demo-images.mjs +507 -0
- package/scripts/reconcile.mjs +32 -1
- package/scripts/render-templates.mjs +13 -1
- package/scripts/section-compat.mjs +10 -1
- package/scripts/section-operations.mjs +3 -0
- package/scripts/starter.mjs +25 -1
- package/scripts/theme/starter-theme.mjs +118 -0
- package/skills/sf-view-gen/assets/recipes/archetypes.json +0 -21
- package/skills/sf-view-gen/assets/recipes/catalog.json +0 -22
- package/skills/sf-view-gen/assets/recipes/features.json +0 -2
- package/skills/sf-view-gen/assets/recipes/recipes.json +19 -16
- package/skills/sf-view-gen/assets/templates/views/sections/schema.universal-main-menu.ts +3 -1
- package/skills/sf-view-gen/scripts/validate.mjs +7 -0
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/binding.json +0 -5
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/catalog.part +0 -8
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/element.part +0 -5
- package/assets/templates/views/home/assembly/slots/categories/CategoryGrid/registry.part +0 -31
|
Binary file
|
|
Binary file
|
|
@@ -11,6 +11,7 @@ import ShoppingCart from '@thorprovider/blocks/blocks/e-commerce/shopping-carts/
|
|
|
11
11
|
import { isAvailableMoney } from '@thorprovider/blocks/contracts'
|
|
12
12
|
import { useStateStore } from '@json-render/react'
|
|
13
13
|
import { checkoutAvailable } from '../../composition'
|
|
14
|
+
import { createStoreMoneyFormatter, DEFAULT_STORE_LOCALE } from '../../store-context'
|
|
14
15
|
import type { ViewRegistry } from '../types'
|
|
15
16
|
import { toCartViewItems } from './data'
|
|
16
17
|
import { cartViewPropsSchema } from './schema'
|
|
@@ -20,6 +21,13 @@ export const registry: ViewRegistry = {
|
|
|
20
21
|
const { state, set } = useStateStore()
|
|
21
22
|
const parsed = cartViewPropsSchema.parse(props)
|
|
22
23
|
const cart = parsed.items
|
|
24
|
+
// The same store-locale formatter the shell chrome uses, so the cart page
|
|
25
|
+
// and the cart sheet render one Money identically (design D4).
|
|
26
|
+
const storeLocale =
|
|
27
|
+
typeof state.storeLocale === 'string' && state.storeLocale.trim() !== ''
|
|
28
|
+
? state.storeLocale
|
|
29
|
+
: DEFAULT_STORE_LOCALE
|
|
30
|
+
const formatMoney = createStoreMoneyFormatter(storeLocale)
|
|
23
31
|
const cartError = typeof state.cartError === 'string' ? state.cartError : undefined
|
|
24
32
|
const readError = typeof state.cartReadError === 'string' ? state.cartReadError : undefined
|
|
25
33
|
const isPending = state.cartPending === true
|
|
@@ -55,6 +63,7 @@ export const registry: ViewRegistry = {
|
|
|
55
63
|
items={toCartViewItems(cart)}
|
|
56
64
|
promotions={[]}
|
|
57
65
|
totals={parsed.totals ?? undefined}
|
|
66
|
+
formatMoney={formatMoney}
|
|
58
67
|
totalsState={totalsState}
|
|
59
68
|
totalsErrorLabel={errorLabel}
|
|
60
69
|
titleLabel={parsed.titleLabel}
|
|
@@ -58,6 +58,8 @@ export type HostedCheckoutState = {
|
|
|
58
58
|
checkoutShippingState: CheckoutReadState;
|
|
59
59
|
checkoutPaymentState: CheckoutReadState;
|
|
60
60
|
checkoutFieldErrors?: Record<string, unknown>;
|
|
61
|
+
/** The store's shopper locale, seeded by the catch-all host (design D4). */
|
|
62
|
+
storeLocale: string;
|
|
61
63
|
};
|
|
62
64
|
|
|
63
65
|
type HostedSetter = (path: string, value: unknown) => void;
|
|
@@ -655,7 +657,9 @@ export function toHostedCheckoutModel(
|
|
|
655
657
|
|
|
656
658
|
return {
|
|
657
659
|
labels: copyFor(props),
|
|
658
|
-
locale:
|
|
660
|
+
// One store locale for every money surface: the checkout summary formats
|
|
661
|
+
// with the same locale as the cart and `<html lang>` (design D4).
|
|
662
|
+
locale: state.storeLocale,
|
|
659
663
|
currencyCode,
|
|
660
664
|
countries: (props.shippingLocations?.countries ?? [])
|
|
661
665
|
.filter((country) => country.value.trim() !== '' && country.label.trim() !== '')
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
"view": "home",
|
|
3
3
|
"slots": [
|
|
4
4
|
{ "id": "home.hero", "slot": "hero", "default": "UniversalBanner" },
|
|
5
|
-
{ "id": "home.categories", "slot": "categories", "default": "CategoryGrid" },
|
|
6
5
|
{ "id": "home.benefits", "slot": "benefits", "default": "cards" }
|
|
7
6
|
],
|
|
8
7
|
"sections": {
|
|
@@ -11,14 +11,12 @@ import type { StorefrontElement } from '../../spec/types'
|
|
|
11
11
|
import type { ViewModule } from '../types'
|
|
12
12
|
import { registry } from './registry'
|
|
13
13
|
import { sectionData } from './sections-data'
|
|
14
|
-
import { benefitsProps,
|
|
14
|
+
import { benefitsProps, heroProps } from './props'
|
|
15
15
|
import * as homeProps from './props'
|
|
16
16
|
import * as homeData from './data'
|
|
17
|
-
import {
|
|
17
|
+
import { toFeaturedProduct } from '../../mappers'
|
|
18
18
|
import { resolveSectionSources, resolveSectionViewStates } from '../../section-sources'
|
|
19
19
|
import {
|
|
20
|
-
categoryCardPropsSchema,
|
|
21
|
-
categoryGridPropsSchema,
|
|
22
20
|
featurePropsSchema,
|
|
23
21
|
storefrontHeroPropsSchema,
|
|
24
22
|
} from './schema'
|
|
@@ -67,10 +65,9 @@ export const home: ViewModule = {
|
|
|
67
65
|
sections = {}
|
|
68
66
|
}
|
|
69
67
|
try {
|
|
70
|
-
const { products,
|
|
68
|
+
const { products, source } = await getCatalog()
|
|
71
69
|
return {
|
|
72
70
|
heroProducts: homeData.selectHeroProducts(products).map(toFeaturedProduct),
|
|
73
|
-
categories: categories.map(toCategoryCard),
|
|
74
71
|
dataSource: source,
|
|
75
72
|
dataError: null,
|
|
76
73
|
sections,
|
|
@@ -80,7 +77,6 @@ export const home: ViewModule = {
|
|
|
80
77
|
// data. Mock mode is labelled by `dataSource`.
|
|
81
78
|
return {
|
|
82
79
|
heroProducts: [],
|
|
83
|
-
categories: [],
|
|
84
80
|
dataSource: getDataSource(),
|
|
85
81
|
dataError:
|
|
86
82
|
error instanceof Error ? error.message : 'No se pudo cargar el catálogo.',
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
// schema (./schema.ts) before binding, so a contract mismatch fails loudly at
|
|
11
11
|
// the boundary instead of rendering undefined fields or literal icon tags.
|
|
12
12
|
|
|
13
|
-
import { CategoryCard as CategoryCardBlock } from '@thorprovider/blocks/blocks/e-commerce/product-categories/category-card'
|
|
14
13
|
@@BLOCK_IMPORTS@@@@SECTION_REGISTRY_IMPORTS@@
|
|
15
14
|
import { useEffect, useState } from 'react'
|
|
16
15
|
import { useStateStore } from '@json-render/react'
|
|
@@ -18,8 +17,6 @@ import { resolveIcon } from '../../icon-map'
|
|
|
18
17
|
import type { ViewRegistry } from '../types'
|
|
19
18
|
import * as featureSchemas from './schema'
|
|
20
19
|
import {
|
|
21
|
-
categoryCardPropsSchema,
|
|
22
|
-
categoryGridPropsSchema,
|
|
23
20
|
featurePropsSchema,
|
|
24
21
|
storefrontHeroPropsSchema,
|
|
25
22
|
} from './schema'
|
|
@@ -34,11 +34,7 @@ export const heroContent = {
|
|
|
34
34
|
* user-owned content, not in the block library.
|
|
35
35
|
*/
|
|
36
36
|
const editorialImage = {
|
|
37
|
-
src:
|
|
38
|
-
'data:image/svg+xml;charset=utf-8,' +
|
|
39
|
-
encodeURIComponent(
|
|
40
|
-
`<svg xmlns='http://www.w3.org/2000/svg' width='1200' height='900'><rect width='100%' height='100%' fill='#e2e8f0'/><circle cx='360' cy='300' r='170' fill='#cbd5e1'/><rect x='560' y='180' width='420' height='420' rx='24' fill='#94a3b8' opacity='.55'/><path d='M120 720h960' stroke='#94a3b8' stroke-width='14' stroke-linecap='round'/></svg>`,
|
|
41
|
-
),
|
|
37
|
+
src: '/images/editorial/studio.webp',
|
|
42
38
|
alt: '',
|
|
43
39
|
}
|
|
44
40
|
|
|
@@ -70,18 +66,6 @@ export const benefitsContent = {
|
|
|
70
66
|
],
|
|
71
67
|
}
|
|
72
68
|
|
|
73
|
-
export const categoriesContent = {
|
|
74
|
-
title: 'Compra por categoría',
|
|
75
|
-
description: 'Explora nuestro catálogo completo.',
|
|
76
|
-
browseLabel: 'Explorar',
|
|
77
|
-
itemsLabel: 'productos',
|
|
78
|
-
searchLabel: 'Buscar categorías',
|
|
79
|
-
searchPlaceholder: 'Buscar categorías',
|
|
80
|
-
emptyLabel: 'No hay categorías disponibles.',
|
|
81
|
-
noResultsLabel: 'No se encontraron categorías.',
|
|
82
|
-
viewAllLabel: 'Ver todas las categorías',
|
|
83
|
-
}
|
|
84
|
-
|
|
85
69
|
/**
|
|
86
70
|
* Banner-hero campaign (hero slot, UniversalBanner variant). Editorial content
|
|
87
71
|
* in the marketplace deal-wall voice: every destination is a real category or
|
|
@@ -91,49 +75,13 @@ export const categoriesContent = {
|
|
|
91
75
|
* (−19%), Luna $82, Helios $96. A conformance test pins each claim to the
|
|
92
76
|
* catalog fixtures, so editing a claim to an unsupported value fails CI.
|
|
93
77
|
*/
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
-
// Dining-table scene for the decor tile: oak table, linen runner, plate stack.
|
|
131
|
-
const decorDesktop = bannerScene(
|
|
132
|
-
`<svg xmlns='http://www.w3.org/2000/svg' width='1600' height='900' viewBox='0 0 1600 900'><rect width='1600' height='900' fill='#eef1ec'/><rect x='0' y='640' width='1600' height='260' fill='#d5dccf'/><rect x='180' y='470' width='1240' height='190' rx='18' fill='#c9a879'/><rect x='120' y='660' width='60' height='150' rx='10' fill='#a98d63'/><rect x='1420' y='660' width='60' height='150' rx='10' fill='#a98d63'/><rect x='560' y='440' width='480' height='60' rx='8' fill='#f6f2ea'/><g fill='#ffffff' stroke='#cdd6c6' stroke-width='6'><circle cx='430' cy='440' r='110'/><circle cx='760' cy='430' r='86'/><circle cx='1050' cy='445' r='110'/></g><circle cx='430' cy='440' r='60' fill='#e8e3d6'/><circle cx='1050' cy='445' r='60' fill='#e8e3d6'/><g><rect x='1240' y='330' width='90' height='150' rx='16' fill='#b7a184'/><path d='M1265 330 q20 -70 40 0' fill='none' stroke='#8a9b6e' stroke-width='10'/><circle cx='1285' cy='248' r='34' fill='#9daf80'/></g><text x='90' y='140' font-family='system-ui, sans-serif' font-size='40' fill='#7c8778' opacity='0.6'>MESA</text></svg>`,
|
|
133
|
-
)
|
|
134
|
-
const decorMobile = bannerScene(
|
|
135
|
-
`<svg xmlns='http://www.w3.org/2000/svg' width='640' height='960' viewBox='0 0 640 960'><rect width='640' height='960' fill='#eef1ec'/><rect x='0' y='700' width='640' height='260' fill='#d5dccf'/><rect x='40' y='560' width='560' height='170' rx='16' fill='#c9a879'/><rect x='180' y='530' width='280' height='50' rx='8' fill='#f6f2ea'/><g fill='#ffffff' stroke='#cdd6c6' stroke-width='6'><circle cx='230' cy='520' r='80'/><circle cx='430' cy='525' r='80'/></g><g><rect x='470' y='380' width='70' height='120' rx='14' fill='#b7a184'/><path d='M490 380 q16 -54 32 0' fill='none' stroke='#8a9b6e' stroke-width='9'/><circle cx='506' cy='318' r='28' fill='#9daf80'/></g></svg>`,
|
|
136
|
-
)
|
|
78
|
+
/**
|
|
79
|
+
* Demo photography for the campaign banners: local static files under
|
|
80
|
+
* `public/images/banners`, shipped by the starter and replaced in place (see the
|
|
81
|
+
* folder README). The banner id is the file name, so a new shot needs no code
|
|
82
|
+
* change — remove a file and the block falls back to its own placeholder.
|
|
83
|
+
*/
|
|
84
|
+
const bannerImage = (id: string) => `/images/banners/${id}.webp`
|
|
137
85
|
|
|
138
86
|
export const heroBannerData = {
|
|
139
87
|
campaign: {
|
|
@@ -157,7 +105,7 @@ export const heroBannerData = {
|
|
|
157
105
|
{ id: 'cta-atlas', label: 'Comprar Atlas', target: { kind: 'product', id: 'atlas-sofa' }, tone: 'secondary' },
|
|
158
106
|
],
|
|
159
107
|
},
|
|
160
|
-
media: { desktop:
|
|
108
|
+
media: { desktop: bannerImage('banner-salon-oferta') },
|
|
161
109
|
presentation: {
|
|
162
110
|
mode: 'overlay',
|
|
163
111
|
width: 'full',
|
|
@@ -170,7 +118,7 @@ export const heroBannerData = {
|
|
|
170
118
|
radius: '2xl',
|
|
171
119
|
surface: 'card',
|
|
172
120
|
overlay: 'gradient',
|
|
173
|
-
overlayOpacity: '
|
|
121
|
+
overlayOpacity: 'medium',
|
|
174
122
|
padding: 'lg',
|
|
175
123
|
textScale: 'lg',
|
|
176
124
|
},
|
|
@@ -190,7 +138,7 @@ export const heroBannerData = {
|
|
|
190
138
|
{ id: 'cta-aurora', label: 'Ver chaqueta', target: { kind: 'product', id: 'aurora-jacket' }, tone: 'primary' },
|
|
191
139
|
],
|
|
192
140
|
},
|
|
193
|
-
media: { desktop:
|
|
141
|
+
media: { desktop: bannerImage('banner-aurora-deal') },
|
|
194
142
|
presentation: {
|
|
195
143
|
mode: 'overlay',
|
|
196
144
|
width: 'full',
|
|
@@ -202,7 +150,7 @@ export const heroBannerData = {
|
|
|
202
150
|
align: 'start',
|
|
203
151
|
radius: '2xl',
|
|
204
152
|
surface: 'card',
|
|
205
|
-
overlay: '
|
|
153
|
+
overlay: 'gradient',
|
|
206
154
|
overlayOpacity: 'medium',
|
|
207
155
|
padding: 'md',
|
|
208
156
|
textScale: 'sm',
|
|
@@ -226,7 +174,7 @@ export const heroBannerData = {
|
|
|
226
174
|
{ id: 'cta-novedades', label: 'Ver novedades', target: { kind: 'category', id: 'furniture' }, tone: 'secondary' },
|
|
227
175
|
],
|
|
228
176
|
},
|
|
229
|
-
media: { desktop:
|
|
177
|
+
media: { desktop: bannerImage('banner-nuevas-llegadas') },
|
|
230
178
|
presentation: {
|
|
231
179
|
mode: 'overlay',
|
|
232
180
|
width: 'full',
|
|
@@ -238,7 +186,7 @@ export const heroBannerData = {
|
|
|
238
186
|
align: 'start',
|
|
239
187
|
radius: '2xl',
|
|
240
188
|
surface: 'card',
|
|
241
|
-
overlay: '
|
|
189
|
+
overlay: 'gradient',
|
|
242
190
|
overlayOpacity: 'light',
|
|
243
191
|
padding: 'md',
|
|
244
192
|
textScale: 'sm',
|
|
@@ -262,7 +210,7 @@ export const heroBannerData = {
|
|
|
262
210
|
{ id: 'cta-regalos', label: 'Ver regalos', target: { kind: 'category', id: 'accessories' }, tone: 'primary' },
|
|
263
211
|
],
|
|
264
212
|
},
|
|
265
|
-
media: { desktop:
|
|
213
|
+
media: { desktop: bannerImage('banner-guia-regalo') },
|
|
266
214
|
presentation: {
|
|
267
215
|
mode: 'overlay',
|
|
268
216
|
width: 'full',
|
|
@@ -274,7 +222,7 @@ export const heroBannerData = {
|
|
|
274
222
|
align: 'start',
|
|
275
223
|
radius: '2xl',
|
|
276
224
|
surface: 'card',
|
|
277
|
-
overlay: '
|
|
225
|
+
overlay: 'gradient',
|
|
278
226
|
overlayOpacity: 'medium',
|
|
279
227
|
padding: 'md',
|
|
280
228
|
textScale: 'sm',
|
|
@@ -298,7 +246,7 @@ export const heroBannerData = {
|
|
|
298
246
|
{ id: 'cta-mesa', label: 'Ver decoración', target: { kind: 'category', id: 'home' }, tone: 'secondary' },
|
|
299
247
|
],
|
|
300
248
|
},
|
|
301
|
-
media: { desktop:
|
|
249
|
+
media: { desktop: bannerImage('banner-mesa-decor') },
|
|
302
250
|
presentation: {
|
|
303
251
|
mode: 'overlay',
|
|
304
252
|
width: 'full',
|
|
@@ -310,7 +258,7 @@ export const heroBannerData = {
|
|
|
310
258
|
align: 'start',
|
|
311
259
|
radius: '2xl',
|
|
312
260
|
surface: 'card',
|
|
313
|
-
overlay: '
|
|
261
|
+
overlay: 'gradient',
|
|
314
262
|
overlayOpacity: 'light',
|
|
315
263
|
padding: 'md',
|
|
316
264
|
textScale: 'sm',
|
|
@@ -414,10 +362,11 @@ export const bandBannerData = {
|
|
|
414
362
|
* the section's neutral default.
|
|
415
363
|
*/
|
|
416
364
|
export const sectionContent: Record<string, Record<string, unknown>> = {
|
|
417
|
-
// Marketplace
|
|
418
|
-
// the campaign band changes the tone, deals carry urgency,
|
|
419
|
-
// the returning visitor something new
|
|
420
|
-
//
|
|
365
|
+
// Marketplace shelf order, seeded by the home recipe: best sellers prove
|
|
366
|
+
// demand, the campaign band changes the tone, deals carry urgency, arrivals
|
|
367
|
+
// give the returning visitor something new, and the closing grid and showcase
|
|
368
|
+
// keep the shopper browsing products instead of prose. Every id is minted by
|
|
369
|
+
// the manifest and stable, so removing a section never rewrites this file.
|
|
421
370
|
'home-products-1': {
|
|
422
371
|
heading: 'Los más vendidos',
|
|
423
372
|
description: 'Lo que más se está llevando, con precio y descuento reales de catálogo.',
|
|
@@ -442,11 +391,16 @@ export const sectionContent: Record<string, Record<string, unknown>> = {
|
|
|
442
391
|
ctaLabel: 'Ver novedades',
|
|
443
392
|
ctaHref: '/categories',
|
|
444
393
|
},
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
394
|
+
// Plain product grid (`ProductGrid`): the grid presentation reads the heading
|
|
395
|
+
// and the resolved products only, so this instance carries no description or
|
|
396
|
+
// call to action the block would ignore.
|
|
397
|
+
'home-products-4': {
|
|
398
|
+
heading: 'Ideas para regalar',
|
|
399
|
+
},
|
|
400
|
+
// Combined grid-and-showcase (`ProductShowcase1`): same resolved products, a
|
|
401
|
+
// shelf that pages in place instead of scrolling sideways.
|
|
402
|
+
'home-products-5': {
|
|
403
|
+
heading: 'Favoritos del estudio',
|
|
404
|
+
description: 'Piezas elegidas por nuestro estudio, con stock y precio reales de catálogo.',
|
|
451
405
|
},
|
|
452
406
|
}
|
|
@@ -40,4 +40,16 @@ export const sectionSources: Record<string, unknown> = {
|
|
|
40
40
|
query: { collections: ['new-arrivals'], pageSize: 8 },
|
|
41
41
|
maxItems: 8,
|
|
42
42
|
},
|
|
43
|
+
// The closing shelves read two further canonical collections: the gift guide
|
|
44
|
+
// renders as a plain grid, the studio selection as the paged showcase.
|
|
45
|
+
'home-products-4': {
|
|
46
|
+
kind: 'products',
|
|
47
|
+
query: { collections: ['gift-guide'], pageSize: 8 },
|
|
48
|
+
maxItems: 8,
|
|
49
|
+
},
|
|
50
|
+
'home-products-5': {
|
|
51
|
+
kind: 'products',
|
|
52
|
+
query: { collections: ['studio-essentials'], pageSize: 8 },
|
|
53
|
+
maxItems: 8,
|
|
54
|
+
},
|
|
43
55
|
}
|
|
@@ -11,14 +11,12 @@ import type { StorefrontElement } from '../../spec/types'
|
|
|
11
11
|
import type { ViewModule } from '../types'
|
|
12
12
|
import { registry } from './registry'
|
|
13
13
|
import { sectionData } from './sections-data'
|
|
14
|
-
import { benefitsProps,
|
|
14
|
+
import { benefitsProps, heroProps } from './props'
|
|
15
15
|
import * as homeProps from './props'
|
|
16
16
|
import * as homeData from './data'
|
|
17
|
-
import {
|
|
17
|
+
import { toFeaturedProduct } from '../../mappers'
|
|
18
18
|
import { resolveSectionSources, resolveSectionViewStates } from '../../section-sources'
|
|
19
19
|
import {
|
|
20
|
-
categoryCardPropsSchema,
|
|
21
|
-
categoryGridPropsSchema,
|
|
22
20
|
featurePropsSchema,
|
|
23
21
|
storefrontHeroPropsSchema,
|
|
24
22
|
} from './schema'
|
|
@@ -31,11 +29,6 @@ const elements: Record<string, StorefrontElement> = {
|
|
|
31
29
|
type: 'UniversalBanner',
|
|
32
30
|
props: homeProps.heroBannerProps,
|
|
33
31
|
},
|
|
34
|
-
'home.categories': {
|
|
35
|
-
type: 'CategoryGrid',
|
|
36
|
-
props: categoriesProps,
|
|
37
|
-
on: { openCategory: { action: 'openCategory' } },
|
|
38
|
-
},
|
|
39
32
|
'home.benefits': {
|
|
40
33
|
type: 'Feature',
|
|
41
34
|
props: benefitsProps,
|
|
@@ -47,14 +40,6 @@ const catalog = {
|
|
|
47
40
|
props: homeSchemas.universalBannerPropsSchema,
|
|
48
41
|
description: 'Campaign banner collection (presentations: single, grid, carousel).',
|
|
49
42
|
},
|
|
50
|
-
CategoryGrid: {
|
|
51
|
-
props: categoryGridPropsSchema,
|
|
52
|
-
description: 'Category listing that renders category cells.',
|
|
53
|
-
},
|
|
54
|
-
CategoryCard: {
|
|
55
|
-
props: categoryCardPropsSchema,
|
|
56
|
-
description: 'One category cell, without listing section chrome.',
|
|
57
|
-
},
|
|
58
43
|
Feature: {
|
|
59
44
|
props: featurePropsSchema,
|
|
60
45
|
description: 'Benefit highlights.',
|
|
@@ -74,7 +59,7 @@ export const home: ViewModule = {
|
|
|
74
59
|
title: 'Inicio',
|
|
75
60
|
description: 'Descubre los productos de __SITE_NAME__.',
|
|
76
61
|
},
|
|
77
|
-
entry: pageRoot('home', ['home.hero', 'home.
|
|
62
|
+
entry: pageRoot('home', ['home.hero', 'home.benefits'], elements),
|
|
78
63
|
},
|
|
79
64
|
loader: {
|
|
80
65
|
home: async () => {
|
|
@@ -94,10 +79,9 @@ export const home: ViewModule = {
|
|
|
94
79
|
sections = {}
|
|
95
80
|
}
|
|
96
81
|
try {
|
|
97
|
-
const { products,
|
|
82
|
+
const { products, source } = await getCatalog()
|
|
98
83
|
return {
|
|
99
84
|
heroProducts: homeData.selectHeroProducts(products).map(toFeaturedProduct),
|
|
100
|
-
categories: categories.map(toCategoryCard),
|
|
101
85
|
dataSource: source,
|
|
102
86
|
dataError: null,
|
|
103
87
|
sections,
|
|
@@ -107,7 +91,6 @@ export const home: ViewModule = {
|
|
|
107
91
|
// data. Mock mode is labelled by `dataSource`.
|
|
108
92
|
return {
|
|
109
93
|
heroProducts: [],
|
|
110
|
-
categories: [],
|
|
111
94
|
dataSource: getDataSource(),
|
|
112
95
|
dataError:
|
|
113
96
|
error instanceof Error ? error.message : 'No se pudo cargar el catálogo.',
|
|
@@ -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,
|
|
7
|
+
import { benefitsContent, heroContent, heroBannerData, heroImage } from './content'
|
|
8
8
|
|
|
9
9
|
export const heroProps = {
|
|
10
10
|
...heroContent,
|
|
@@ -21,9 +21,3 @@ export const heroBannerProps = {
|
|
|
21
21
|
export const benefitsProps = {
|
|
22
22
|
...benefitsContent,
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
export const categoriesProps = {
|
|
26
|
-
...categoriesContent,
|
|
27
|
-
categories: { $state: '/categories' },
|
|
28
|
-
query: { $state: '/categoryQuery' },
|
|
29
|
-
}
|
|
@@ -10,9 +10,7 @@
|
|
|
10
10
|
// schema (./schema.ts) before binding, so a contract mismatch fails loudly at
|
|
11
11
|
// the boundary instead of rendering undefined fields or literal icon tags.
|
|
12
12
|
|
|
13
|
-
import { CategoryCard as CategoryCardBlock } from '@thorprovider/blocks/blocks/e-commerce/product-categories/category-card'
|
|
14
13
|
import { UniversalBanner as UniversalBannerBlock } from '@thorprovider/blocks'
|
|
15
|
-
import { CategoryGrid as CategoryGridBlock } from '@thorprovider/blocks/blocks/e-commerce/product-categories/product-category-grid'
|
|
16
14
|
import { Feature as FeatureBlock } from '@thorprovider/blocks/blocks/marketing/features/feature'
|
|
17
15
|
import { useEffect, useState } from 'react'
|
|
18
16
|
import { useStateStore } from '@json-render/react'
|
|
@@ -20,8 +18,6 @@ import { resolveIcon } from '../../icon-map'
|
|
|
20
18
|
import type { ViewRegistry } from '../types'
|
|
21
19
|
import * as featureSchemas from './schema'
|
|
22
20
|
import {
|
|
23
|
-
categoryCardPropsSchema,
|
|
24
|
-
categoryGridPropsSchema,
|
|
25
21
|
featurePropsSchema,
|
|
26
22
|
storefrontHeroPropsSchema,
|
|
27
23
|
} from './schema'
|
|
@@ -37,37 +33,6 @@ export const registry: ViewRegistry = {
|
|
|
37
33
|
}, [])
|
|
38
34
|
return <UniversalBannerBlock data={{ ...parsed.data, now }} />
|
|
39
35
|
},
|
|
40
|
-
CategoryCard: ({ props, emit }) => {
|
|
41
|
-
const { set } = useStateStore()
|
|
42
|
-
const card = categoryCardPropsSchema.parse(props)
|
|
43
|
-
return (
|
|
44
|
-
<CategoryCardBlock
|
|
45
|
-
{...card}
|
|
46
|
-
onBrowse={(category) => {
|
|
47
|
-
set('/lastCategory', category.handle ?? String(category.id))
|
|
48
|
-
emit('openCategory')
|
|
49
|
-
}}
|
|
50
|
-
/>
|
|
51
|
-
)
|
|
52
|
-
},
|
|
53
|
-
CategoryGrid: ({ props, emit }) => {
|
|
54
|
-
const { set } = useStateStore()
|
|
55
|
-
const grid = categoryGridPropsSchema.parse(props)
|
|
56
|
-
return (
|
|
57
|
-
<CategoryGridBlock
|
|
58
|
-
{...grid}
|
|
59
|
-
onBrowse={(category) => {
|
|
60
|
-
set('/lastCategory', category.handle ?? String(category.id))
|
|
61
|
-
emit('openCategory')
|
|
62
|
-
}}
|
|
63
|
-
onViewAll={() => {
|
|
64
|
-
set('/lastCategory', '/categories')
|
|
65
|
-
emit('openCategory')
|
|
66
|
-
}}
|
|
67
|
-
onQueryChange={(query) => set('/categoryQuery', query)}
|
|
68
|
-
/>
|
|
69
|
-
)
|
|
70
|
-
},
|
|
71
36
|
Feature: ({ props }) => {
|
|
72
37
|
const feature = featureSchemas.featureCardsSpecSchema.parse({
|
|
73
38
|
...props,
|
|
@@ -160,40 +160,6 @@ export const featureSplitSpecSchema = z.object({
|
|
|
160
160
|
|
|
161
161
|
export const featurePropsSchema = z.union([featureSplitSpecSchema, featureCardsSpecSchema])
|
|
162
162
|
|
|
163
|
-
export const categoryCardPropsSchema = z.object({
|
|
164
|
-
category: categoryCardSchema,
|
|
165
|
-
presentation: z.enum(['grid', 'icons', 'list']).optional(),
|
|
166
|
-
browseLabel: z.string().optional(),
|
|
167
|
-
itemsLabel: z.string().optional(),
|
|
168
|
-
trendingLabel: z.string().optional(),
|
|
169
|
-
featuredLabel: z.string().optional(),
|
|
170
|
-
imageFallback: z.string().optional(),
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
export const categoryGridPropsSchema = z.object({
|
|
174
|
-
title: z.string().optional(),
|
|
175
|
-
description: z.string().optional(),
|
|
176
|
-
badge: z.string().optional(),
|
|
177
|
-
presentation: z.enum(['grid', 'icons', 'list']).optional(),
|
|
178
|
-
categories: z.array(categoryCardSchema),
|
|
179
|
-
cta: ctaSchema.optional(),
|
|
180
|
-
query: z.string().optional(),
|
|
181
|
-
searchPlaceholder: z.string().optional(),
|
|
182
|
-
searchLabel: z.string().optional(),
|
|
183
|
-
emptyLabel: z.string().optional(),
|
|
184
|
-
noResultsLabel: z.string().optional(),
|
|
185
|
-
browseLabel: z.string().optional(),
|
|
186
|
-
viewAllLabel: z.string().optional(),
|
|
187
|
-
trendingLabel: z.string().optional(),
|
|
188
|
-
featuredLabel: z.string().optional(),
|
|
189
|
-
itemsLabel: z.string().optional(),
|
|
190
|
-
imageFallback: z.string().optional(),
|
|
191
|
-
className: z.string().optional(),
|
|
192
|
-
maxItems: z.number().int().positive().optional(),
|
|
193
|
-
loading: z.boolean().optional(),
|
|
194
|
-
skeletonCount: z.number().int().positive().optional(),
|
|
195
|
-
})
|
|
196
|
-
|
|
197
163
|
// Local mirror of the canonical UniversalBanner contract (delivery
|
|
198
164
|
// universal-banner, contract version 4.1.0) — the same shape the editorial
|
|
199
165
|
// section fragment mirrors. Kept local (not imported from the section module)
|
|
@@ -367,7 +333,5 @@ export type StorefrontHeroProps = z.infer<typeof storefrontHeroPropsSchema>
|
|
|
367
333
|
export type FeatureProps = z.infer<typeof featurePropsSchema>
|
|
368
334
|
export type FeatureCardsSpecProps = z.infer<typeof featureCardsSpecSchema>
|
|
369
335
|
export type FeatureSplitSpecProps = z.infer<typeof featureSplitSpecSchema>
|
|
370
|
-
export type CategoryCardProps = z.infer<typeof categoryCardPropsSchema>
|
|
371
|
-
export type CategoryGridProps = z.infer<typeof categoryGridPropsSchema>
|
|
372
336
|
export type UniversalBannerData = z.infer<typeof universalBannerDataSchema>
|
|
373
337
|
export type UniversalBannerProps = z.infer<typeof universalBannerPropsSchema>
|