@thorprovider/storefront 0.4.0 → 0.6.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 (55) hide show
  1. package/README.md +3 -1
  2. package/assets/templates/app/app/[[...slug]]/page.tsx +19 -1
  3. package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +20 -30
  4. package/assets/templates/app/lib/__STOREFRONT__/composition.ts +1 -1
  5. package/assets/templates/app/lib/__STOREFRONT__/registry.tsx +15 -13
  6. package/assets/templates/app/lib/__STOREFRONT__/schema.ts +34 -4
  7. package/assets/templates/app/lib/__STOREFRONT__/shell/props.ts +1 -1
  8. package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +14 -15
  9. package/assets/templates/app/lib/__STOREFRONT__/views/sections/testimonials.tsx +26 -19
  10. package/assets/templates/features/checkout/state.ts +0 -5
  11. package/assets/templates/views/account/content.ts +14 -3
  12. package/assets/templates/views/account/index.tsx +1 -1
  13. package/assets/templates/views/account/registry.tsx +135 -104
  14. package/assets/templates/views/account/schema.ts +26 -6
  15. package/assets/templates/views/category/assembly/assembly.json +1 -1
  16. package/assets/templates/views/category/assembly/index.skeleton.tsx +11 -7
  17. package/assets/templates/views/category/assembly/registry.skeleton.tsx +8 -8
  18. package/assets/templates/views/category/assembly/slots/filter/CategoryListing/catalog.part +5 -0
  19. package/assets/templates/views/category/assembly/slots/filter/{CategoryFilter2 → CategoryListing}/element.part +5 -3
  20. package/assets/templates/views/category/assembly/slots/filter/{CategoryFilter2 → CategoryListing}/registry.part +9 -5
  21. package/assets/templates/views/category/content.ts +2 -1
  22. package/assets/templates/views/category/index.tsx +19 -13
  23. package/assets/templates/views/category/props.ts +1 -1
  24. package/assets/templates/views/category/registry.tsx +17 -13
  25. package/assets/templates/views/category/schema.ts +48 -21
  26. package/assets/templates/views/checkout/content.ts +60 -0
  27. package/assets/templates/views/checkout/props.ts +4 -5
  28. package/assets/templates/views/checkout/registry.tsx +10 -6
  29. package/assets/templates/views/checkout/schema.ts +10 -16
  30. package/assets/templates/views/home/assembly/index.skeleton.tsx +0 -2
  31. package/assets/templates/views/home/index.tsx +0 -2
  32. package/assets/templates/views/product/registry.tsx +112 -14
  33. package/assets/templates/views/product/schema.ts +42 -7
  34. package/bin/storefront.js +21 -0
  35. package/examples/merchandising/category-led.json +1 -1
  36. package/examples/merchandising/collection-led.json +1 -1
  37. package/package.json +2 -1
  38. package/recipes/archetypes.json +27 -27
  39. package/recipes/catalog.json +43 -105
  40. package/recipes/features.json +2 -2
  41. package/recipes/recipes.json +10 -16
  42. package/recipes/sections.json +2 -2
  43. package/scripts/candidate.mjs +263 -6
  44. package/scripts/composers.mjs +2 -2
  45. package/scripts/logical-controls.mjs +4 -4
  46. package/scripts/operation-registry.mjs +1 -1
  47. package/scripts/view-assembly.mjs +2 -2
  48. package/skills/sf-view-gen/assets/recipes/archetypes.json +27 -27
  49. package/skills/sf-view-gen/assets/recipes/catalog.json +43 -105
  50. package/skills/sf-view-gen/assets/recipes/features.json +2 -2
  51. package/skills/sf-view-gen/assets/recipes/recipes.json +10 -16
  52. package/skills/sf-view-gen/assets/recipes/sections.json +2 -2
  53. package/skills/sf-view-gen/assets/templates/views/sections/schema.testimonials.ts +21 -11
  54. package/skills/sf-view-gen/assets/templates/views/sections/testimonials.client.tsx +2 -8
  55. package/assets/templates/views/category/assembly/slots/filter/CategoryFilter2/catalog.part +0 -5
@@ -4,10 +4,10 @@
4
4
  // module imports them as data so the RSC graph never evaluates @json-render/react
5
5
  // on the server. Registered by importing it in ../index.ts. Recipe: recipes.json -> "category".
6
6
  //
7
- // E2 task 6.1: the category listing is ONE controlled `CategoryFilter2` — the
7
+ // E2 task 6.1: the category listing is ONE controlled `CategoryListing` — the
8
8
  // base listing slot `category.filter`, always present. The optional
9
9
  // `catalog-search` / `category-filters` features are control contributions to
10
- // that single block (logical mounts `category.search` / `category.filters`),
10
+ // that single block (logical mounts `category.search` / `category-listing`),
11
11
  // never a second listing/controller. Their visibility and config are read from
12
12
  // the installed manifest (`mountedFeatures` / `mountedFeatureConfigs`) that
13
13
  // `sync` derives from `storefront.config.json`; no loader is hand-edited to add
@@ -21,7 +21,7 @@ import {
21
21
  getCollectionOptions,
22
22
  loadCategoryListing,
23
23
  mapCatalogOutcomeToStatus,
24
- mapCatalogResultsToFilterProps,
24
+ mapCatalogResultsToCategoryListing,
25
25
  } from '@thorprovider/runtime/commerce'
26
26
  import { getDataSource, getStoreContext, isRealMode } from '../../store-context'
27
27
  import { mountedFeatureConfigs, mountedFeatureNames, mountedFeatures } from '../../composition'
@@ -29,10 +29,10 @@ import { pageRoot } from '../../spec/page-root'
29
29
  import type { StorefrontElement } from '../../spec/types'
30
30
  import type { ViewModule } from '../types'
31
31
  import { registry } from './registry'
32
- import { categoryBreadcrumbProps, categoryFilterProps } from './props'
33
- import { breadcrumbPropsSchema, categoryFilterPropsSchema } from './schema'
32
+ import { categoryBreadcrumbProps, categoryListingProps } from './props'
33
+ import { breadcrumbPropsSchema, categoryListingPropsSchema } from './schema'
34
34
 
35
- // The single controlled `CategoryFilter2` base listing. The search/filter
35
+ // The single controlled `CategoryListing` base listing. The search/filter
36
36
  // controls are shown only when the matching feature is installed; the base
37
37
  // listing always owns the route scope, `sort`, `page`, `pageSize`, the products,
38
38
  // and pagination.
@@ -65,11 +65,11 @@ const elements: Record<string, StorefrontElement> = {
65
65
  },
66
66
  },
67
67
  'category.filter': {
68
- type: 'CategoryFilter2',
68
+ type: 'CategoryListing',
69
69
  props: {
70
70
  // User-owned copy first, so a customization can be overridden by the
71
71
  // feature config (search placeholder) and the derived state bindings.
72
- ...categoryFilterProps,
72
+ ...categoryListingProps,
73
73
  showSearch: hasSearch,
74
74
  showFilters: hasFilters,
75
75
  showSort: true,
@@ -79,7 +79,7 @@ const elements: Record<string, StorefrontElement> = {
79
79
  : {}),
80
80
  // Composition context for generated navigation (task 4.11): the client
81
81
  // registry drops a removed feature's owned orphan parameters on a UI
82
- // action. Read separately from the block props; never a `CategoryFilter2`
82
+ // action. Read separately from the block props; never a `CategoryListing`
83
83
  // prop and never bound to state.
84
84
  mountedFeatures,
85
85
  products: { $state: '/categoryFilterProducts' },
@@ -96,6 +96,8 @@ const elements: Record<string, StorefrontElement> = {
96
96
  categories: { $state: '/categoryFilterCategories' },
97
97
  collections: { $state: '/categoryFilterCollections' },
98
98
  priceRange: { $state: '/categoryFilterPriceRange' },
99
+ selectedFacets: { $state: '/categoryFilterSelectedFacets' },
100
+ facets: { $state: '/categoryFilterFacets' },
99
101
  },
100
102
  },
101
103
  }
@@ -105,10 +107,10 @@ const catalog = {
105
107
  props: breadcrumbPropsSchema,
106
108
  description: 'Migas de pan derivadas de la jerarquía real de categorías.',
107
109
  },
108
- CategoryFilter2: {
109
- props: categoryFilterPropsSchema,
110
+ CategoryListing: {
111
+ props: categoryListingPropsSchema,
110
112
  description:
111
- 'Listado de categoría: una sola presentación controlada CategoryFilter2 con productos, paginación, búsqueda y filtros opcionales.',
113
+ 'Listado de categoría: una sola presentación controlada CategoryListing con productos, paginación, búsqueda y filtros opcionales.',
112
114
  },
113
115
  }
114
116
 
@@ -127,6 +129,8 @@ const emptyFilterState = () => ({
127
129
  categoryFilterCategories: [],
128
130
  categoryFilterCollections: [],
129
131
  categoryFilterPriceRange: undefined,
132
+ categoryFilterSelectedFacets: {} as Record<string, string[]>,
133
+ categoryFilterFacets: [],
130
134
  breadcrumbItems: [] as { label: string; href?: string }[],
131
135
  })
132
136
 
@@ -245,7 +249,7 @@ export const category: ViewModule = {
245
249
  }))
246
250
  : []
247
251
  const collections = allCollections.length > 0 ? allCollections : undefined
248
- const presentation = mapCatalogResultsToFilterProps({
252
+ const presentation = mapCatalogResultsToCategoryListing({
249
253
  query: listing.query,
250
254
  results: listing.results,
251
255
  // A scoped listing (`/categories/<handle>`) must not offer the
@@ -284,6 +288,8 @@ export const category: ViewModule = {
284
288
  categoryFilterCategories: presentation.categories ?? [],
285
289
  categoryFilterCollections: presentation.collections ?? [],
286
290
  categoryFilterPriceRange: presentation.priceRange,
291
+ categoryFilterSelectedFacets: presentation.selectedFacets ?? {},
292
+ categoryFilterFacets: presentation.facets ?? [],
287
293
  }
288
294
  } catch (error) {
289
295
  return {
@@ -11,7 +11,7 @@
11
11
 
12
12
  import { filterContent } from './content'
13
13
 
14
- export const categoryFilterProps = {
14
+ export const categoryListingProps = {
15
15
  ...filterContent,
16
16
  }
17
17
 
@@ -1,7 +1,7 @@
1
1
  'use client'
2
2
 
3
3
  // Thor Commerce view registry fragment: category
4
- // The category view's single client boundary: one controlled `CategoryFilter2`
4
+ // The category view's single client boundary: one controlled `CategoryListing`
5
5
  // (the base listing slot `category.filter`). Search/filters/sort/pagination are
6
6
  // URL-backed: the block emits a change, this registry rewrites the URL through
7
7
  // the pure `buildCategoryQueryHref` seam, and the server loader re-seeds the
@@ -9,12 +9,12 @@
9
9
  // the client. The search and filter controls are only present because the
10
10
  // installed manifest enabled them; the block never adds a second listing.
11
11
 
12
- import CategoryFilter2Block from '@thorprovider/blocks/blocks/e-commerce/category-filters/category-filter-2'
12
+ import CategoryListingBlock from '@thorprovider/blocks/blocks/e-commerce/category-filters/category-listing'
13
13
  import type {
14
- CategoryFilter2ActiveFilter,
15
- CategoryFilter2Filters,
16
- CategoryFilter2Props,
17
- } from '@thorprovider/blocks/blocks/e-commerce/category-filters/category-filter-2'
14
+ CategoryListingActiveFilter,
15
+ CategoryListingFilters,
16
+ CategoryListingProps,
17
+ } from '@thorprovider/blocks/blocks/e-commerce/category-filters/category-listing'
18
18
  import { Breadcrumb as BreadcrumbBlock } from '@thorprovider/blocks/blocks/e-commerce/navigation/breadcrumb'
19
19
  import { buildCategoryQueryHref, catalogHistoryMode, type CategoryQueryChange } from '@thorprovider/runtime/commerce'
20
20
  import type { CatalogFeatureName } from '@thorprovider/runtime/contracts'
@@ -23,9 +23,9 @@ import { usePathname, useRouter } from 'next/navigation'
23
23
  import type { ViewRegistry } from '../types'
24
24
 
25
25
  // The generated view module injects the installed-feature context as an element
26
- // prop (task 4.11); it is composition context, not a `CategoryFilter2` prop, so
26
+ // prop (task 4.11); it is composition context, not a `CategoryListing` prop, so
27
27
  // it is read separately from the block props.
28
- type CategoryFilter2RegistryProps = CategoryFilter2Props & {
28
+ type CategoryListingRegistryProps = CategoryListingProps & {
29
29
  mountedFeatures?: readonly CatalogFeatureName[]
30
30
  }
31
31
 
@@ -48,11 +48,11 @@ export const registry: ViewRegistry = {
48
48
  />
49
49
  )
50
50
  },
51
- CategoryFilter2: ({ props, emit }) => {
51
+ CategoryListing: ({ props, emit }) => {
52
52
  const router = useRouter()
53
53
  const pathname = usePathname()
54
54
  const { set } = useStateStore()
55
- const p = props as unknown as CategoryFilter2RegistryProps
55
+ const p = props as unknown as CategoryListingRegistryProps
56
56
 
57
57
  // Minimal `updateURL` seam (task 6.1; task 5.2 verified the criterion and is
58
58
  // complete): apply one change to the current browser URL and let the server
@@ -74,7 +74,8 @@ export const registry: ViewRegistry = {
74
74
  }
75
75
 
76
76
  return (
77
- <CategoryFilter2Block
77
+ <CategoryListingBlock
78
+ presentation={p.presentation}
78
79
  products={p.products}
79
80
  categories={p.categories}
80
81
  collections={p.collections}
@@ -92,6 +93,9 @@ export const registry: ViewRegistry = {
92
93
  selectedPage={p.selectedPage}
93
94
  selectedPageSize={p.selectedPageSize}
94
95
  selectedPriceRange={p.selectedPriceRange}
96
+ selectedFacets={p.selectedFacets}
97
+ facets={p.facets}
98
+ viewOptions={p.viewOptions}
95
99
  status={p.status}
96
100
  activeFilters={p.activeFilters}
97
101
  filtersTitle={p.filtersTitle}
@@ -103,13 +107,13 @@ export const registry: ViewRegistry = {
103
107
  onSortChange={(sort) => apply({ kind: 'sort', sort })}
104
108
  onPageChange={(page) => apply({ kind: 'page', page })}
105
109
  onPageSizeChange={(size) => apply({ kind: 'pageSize', pageSize: size })}
106
- onFilterChange={(filters: CategoryFilter2Filters) =>
110
+ onFilterChange={(filters: CategoryListingFilters) =>
107
111
  apply({ kind: 'filters', categories: filters.categories, collections: filters.collections ?? [] })
108
112
  }
109
113
  onClearFilters={() => apply({ kind: 'clearFilters' })}
110
114
  onRepair={(remove) => apply({ kind: 'repair', remove })}
111
115
  onRetry={() => router.refresh()}
112
- onRemoveFilter={(filter: CategoryFilter2ActiveFilter) =>
116
+ onRemoveFilter={(filter: CategoryListingActiveFilter) =>
113
117
  apply({ kind: 'removeFilter', filter })
114
118
  }
115
119
  onProductClick={(product) => {
@@ -1,5 +1,5 @@
1
1
  // Thor Commerce view schema fragment: category
2
- // Zod mirror of the single controlled `CategoryFilter2` prop contract for this
2
+ // Zod mirror of the single controlled `CategoryListing` prop contract for this
3
3
  // view — the source for the catalog entry and the client-side registry parsing
4
4
  // (json-render does not validate props against the catalog itself, so the
5
5
  // registry parses here). Kept free of React and server imports so the Server
@@ -10,27 +10,38 @@
10
10
 
11
11
  import { z } from 'zod'
12
12
 
13
- export const filterProductSchema = z.object({
14
- id: z.string(),
15
- name: z.string(),
16
- price: z.string(),
13
+ /** Canonical `Money`: a decimal major-unit string plus its currency code. */
14
+ export const moneySchema = z.object({
15
+ amount: z.string(),
16
+ currencyCode: z.string(),
17
+ })
18
+
19
+ /** The canonical product projection the listing renders through `ProductCard`. */
20
+ export const productPresentationSchema = z.object({
21
+ id: z.union([z.string(), z.number()]),
22
+ title: z.string(),
17
23
  image: z.string().optional(),
24
+ imageAlt: z.string().optional(),
18
25
  // Product-detail link supplied by the presentation layer; when absent the
19
- // block falls back to its onClick path.
26
+ // canonical card falls back to the host's click handler.
20
27
  href: z.string().optional(),
28
+ price: moneySchema,
29
+ compareAtPrice: moneySchema.optional(),
30
+ rating: z.number().optional(),
31
+ badge: z.string().optional(),
21
32
  })
22
33
 
23
- export const categoryFilterSortOptionSchema = z.object({
34
+ export const categoryListingSortOptionSchema = z.object({
24
35
  value: z.string(),
25
36
  label: z.string(),
26
37
  })
27
38
 
28
- export const categoryFilterOptionSchema = z.object({
39
+ export const categoryListingOptionSchema = z.object({
29
40
  id: z.string(),
30
41
  label: z.string(),
31
42
  })
32
43
 
33
- export const categoryFilterActiveFilterSchema = z.object({
44
+ export const categoryListingActiveFilterSchema = z.object({
34
45
  id: z.string(),
35
46
  kind: z.string(),
36
47
  label: z.string(),
@@ -38,31 +49,47 @@ export const categoryFilterActiveFilterSchema = z.object({
38
49
  value: z.string().optional(),
39
50
  })
40
51
 
41
- export const categoryFilterPriceRangeSchema = z.object({
52
+ export const categoryListingPriceRangeSchema = z.object({
42
53
  min: z.number(),
43
54
  max: z.number(),
44
55
  step: z.number(),
45
56
  })
46
57
 
47
- export const categoryFilterStatusSchema = z.object({ state: z.string() }).catchall(z.unknown())
58
+ export const categoryListingFacetOptionSchema = z.object({
59
+ value: z.string(),
60
+ label: z.string(),
61
+ count: z.number().optional(),
62
+ })
63
+
64
+ export const categoryListingFacetGroupSchema = z.object({
65
+ id: z.string(),
66
+ label: z.string(),
67
+ options: z.array(categoryListingFacetOptionSchema),
68
+ })
69
+
70
+ export const categoryListingStatusSchema = z.object({ state: z.string() }).catchall(z.unknown())
48
71
 
49
- export const categoryFilterPropsSchema = z
72
+ export const categoryListingPropsSchema = z
50
73
  .object({
51
- products: z.array(filterProductSchema),
74
+ presentation: z.enum(['sidebar', 'toolbar']).optional(),
75
+ products: z.array(productPresentationSchema),
52
76
  pagination: z.array(z.union([z.number(), z.string()])),
53
- status: categoryFilterStatusSchema,
54
- activeFilters: z.array(categoryFilterActiveFilterSchema),
77
+ status: categoryListingStatusSchema,
78
+ activeFilters: z.array(categoryListingActiveFilterSchema),
55
79
  searchValue: z.string(),
56
80
  selectedCategories: z.array(z.string()),
57
81
  selectedCollections: z.array(z.string()),
58
82
  selectedSort: z.string(),
59
83
  selectedPage: z.union([z.number(), z.string()]),
60
84
  selectedPageSize: z.union([z.number(), z.string()]),
61
- selectedPriceRange: z.array(z.number()).optional(),
62
- sortOptions: z.array(categoryFilterSortOptionSchema),
63
- categories: z.array(categoryFilterOptionSchema),
64
- collections: z.array(categoryFilterOptionSchema),
65
- priceRange: categoryFilterPriceRangeSchema.optional(),
85
+ selectedPriceRange: z.tuple([z.number(), z.number()]).optional(),
86
+ selectedFacets: z.record(z.string(), z.array(z.string())).optional(),
87
+ sortOptions: z.array(categoryListingSortOptionSchema),
88
+ categories: z.array(categoryListingOptionSchema),
89
+ collections: z.array(categoryListingOptionSchema),
90
+ priceRange: categoryListingPriceRangeSchema.optional(),
91
+ facets: z.array(categoryListingFacetGroupSchema).optional(),
92
+ viewOptions: z.array(z.union([z.number(), z.string()])).optional(),
66
93
  showSearch: z.boolean(),
67
94
  showFilters: z.boolean(),
68
95
  showSort: z.boolean(),
@@ -88,4 +115,4 @@ export const breadcrumbPropsSchema = z.object({
88
115
  className: z.string().optional(),
89
116
  })
90
117
 
91
- export type CategoryFilterProps = z.infer<typeof categoryFilterPropsSchema>
118
+ export type CategoryListingProps = z.infer<typeof categoryListingPropsSchema>
@@ -9,6 +9,66 @@
9
9
  export const checkoutContent = {
10
10
  title: 'Finalizar compra',
11
11
  description: 'Completa tus datos para recibir tu pedido.',
12
+ // Copy for the canonical Checkout block. Every string is user-owned content:
13
+ // edit it here to change the store's checkout wording. `title`/`description`
14
+ // above are forwarded as the same labels by the view registry.
15
+ labels: {
16
+ orderSummaryTitle: 'Resumen del pedido',
17
+ stepProgressLabel: 'Progreso del checkout',
18
+ contactStepName: 'Contacto',
19
+ shippingStepName: 'Envío',
20
+ paymentStepName: 'Pago',
21
+ reviewStepName: 'Revisión',
22
+ contactHeading: 'Información de contacto',
23
+ contactDescription: 'La usaremos para enviarte novedades de tu pedido.',
24
+ shippingHeading: 'Dirección de envío',
25
+ shippingDescription: 'Enviaremos tu pedido a esta dirección.',
26
+ paymentHeading: 'Datos de pago',
27
+ paymentDescription: 'Pago seguro para tu pedido.',
28
+ reviewHeading: 'Revisa tu pedido',
29
+ reviewDescription: 'Verifica los datos antes de confirmar el pedido.',
30
+ emailLabel: 'Email',
31
+ firstNameLabel: 'Nombre',
32
+ lastNameLabel: 'Apellidos',
33
+ phoneLabel: 'Teléfono (opcional)',
34
+ addressLabel: 'Dirección',
35
+ cityLabel: 'Ciudad',
36
+ stateLabel: 'Estado / Provincia',
37
+ zipCodeLabel: 'Código postal',
38
+ countryLabel: 'País',
39
+ countryPlaceholder: 'Selecciona un país',
40
+ shippingMethodLegend: 'Método de envío',
41
+ paymentMethodLegend: 'Método de pago',
42
+ noPaymentMethodsLabel: 'No hay métodos de pago disponibles para esta región.',
43
+ unavailableMethodLabel: 'No disponible',
44
+ requiresSetupLabel: 'Requiere configuración adicional',
45
+ saveInfoLabel: 'Guardar esta información para la próxima vez',
46
+ newsletterLabel: 'Recibir novedades y ofertas por correo',
47
+ promoCodeLabel: 'Código promocional',
48
+ promoPlaceholder: 'Ingresa el código',
49
+ promoApplyLabel: 'Aplicar',
50
+ subtotalLabel: 'Subtotal',
51
+ discountLabel: 'Descuento',
52
+ taxLabel: 'Impuestos',
53
+ shippingLabel: 'Envío',
54
+ totalLabel: 'Total',
55
+ eachLabel: 'c/u',
56
+ totalsPendingLabel: 'Actualizando totales…',
57
+ totalsErrorLabel: 'No se pudieron actualizar los totales.',
58
+ totalsUnavailableLabel: 'Totales no disponibles.',
59
+ amountUnavailableLabel: '—',
60
+ retryLabel: 'Reintentar',
61
+ reviewContactLabel: 'Contacto',
62
+ reviewShipToLabel: 'Enviar a',
63
+ reviewPaymentLabel: 'Pago',
64
+ reviewShippingLabel: 'Método de envío',
65
+ reviewEmptyLabel: 'Aún no hay datos para revisar.',
66
+ backLabel: 'Atrás',
67
+ continueLabel: 'Continuar',
68
+ completeOrderLabel: 'Completar pedido',
69
+ processingLabel: 'Procesando pedido…',
70
+ submitErrorActionLabel: 'Reintentar',
71
+ },
12
72
  validation: {
13
73
  email: {
14
74
  validateOn: 'blur',
@@ -9,6 +9,10 @@ import { checkoutContent, confirmationContent } from './content'
9
9
 
10
10
  export const checkoutViewProps = {
11
11
  ...checkoutContent,
12
+ // Bounded structural presentation: the proven step-by-step flow. Change it
13
+ // here to 'single-page' if this store wants every section visible at once.
14
+ presentation: 'stepper' as const,
15
+ showReviewStep: false,
12
16
  // Backend-authoritative summary: line totals and cart totals come from the
13
17
  // backend cart state, never computed here.
14
18
  orderSummary: {
@@ -31,12 +35,7 @@ export const checkoutViewProps = {
31
35
  zipCode: { $state: '/checkout/zipCode' },
32
36
  country: { $state: '/checkout/country' },
33
37
  paymentMethod: { $state: '/checkout/paymentMethod' },
34
- cardNumber: { $state: '/checkout/cardNumber' },
35
- expiryDate: { $state: '/checkout/expiryDate' },
36
- cvv: { $state: '/checkout/cvv' },
37
- cardName: { $state: '/checkout/cardName' },
38
38
  saveInfo: { $state: '/checkout/saveInfo' },
39
- sameAsBilling: { $state: '/checkout/sameAsBilling' },
40
39
  newsletter: { $state: '/checkout/newsletter' },
41
40
  promoCode: { $state: '/checkout/promoCode' },
42
41
  },
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { useEffect, useRef } from 'react'
10
10
  import { Button } from '@thorprovider/blocks/ui/button'
11
- import CheckoutBlock from '@thorprovider/blocks/blocks/e-commerce/checkout-forms/checkout-form-1'
11
+ import CheckoutBlock from '@thorprovider/blocks/blocks/e-commerce/checkout-forms/checkout'
12
12
  import CheckoutConfirmationBlock from '@thorprovider/blocks/blocks/e-commerce/checkout-forms/checkout-confirmation'
13
13
  import { useStateStore } from '@json-render/react'
14
14
  import { loadCheckoutAction, reconcileReceiptAction } from '../../actions'
@@ -128,11 +128,17 @@ export const registry: ViewRegistry = {
128
128
  const checkoutError = typeof state.checkoutError === 'string' ? state.checkoutError : undefined
129
129
  return (
130
130
  <CheckoutBlock
131
- title={parsed.title}
132
- description={parsed.description}
131
+ presentation={parsed.presentation ?? 'stepper'}
132
+ showReviewStep={parsed.showReviewStep}
133
+ labels={{
134
+ ...parsed.labels,
135
+ ...(parsed.title ? { title: parsed.title } : {}),
136
+ ...(parsed.description ? { description: parsed.description } : {}),
137
+ ...(cartError ? { totalsErrorLabel: cartError } : {}),
138
+ submitErrorActionLabel: unresolved ? 'Reconciliar' : 'Reintentar',
139
+ }}
133
140
  orderSummary={parsed.orderSummary}
134
141
  totalsState={state.cartPending ? 'pending' : cartError ? 'error' : 'idle'}
135
- totalsErrorLabel={cartError}
136
142
  onRetryTotals={() => emit('syncCheckoutAddress')}
137
143
  countries={parsed.countries}
138
144
  shippingOptions={parsed.shippingOptions}
@@ -145,7 +151,6 @@ export const registry: ViewRegistry = {
145
151
  values={parsed.values}
146
152
  fieldErrors={parsed.fieldErrors}
147
153
  fieldDescriptions={parsed.fieldDescriptions}
148
- collectCardFields={false}
149
154
  onChange={(field, value) => {
150
155
  set(`/checkout/${field}`, value)
151
156
  if (ADDRESS_FIELDS.has(field)) emit('syncCheckoutAddress')
@@ -156,7 +161,6 @@ export const registry: ViewRegistry = {
156
161
  // An ambiguous completion offers RECONCILE only; a definite failure
157
162
  // (cart-with-error or pre-completion error) offers a controlled retry.
158
163
  onRetrySubmit={unresolved ? () => emit('reconcileOrder') : () => emit('placeOrder')}
159
- submitErrorActionLabel={unresolved ? 'Reconciliar' : 'Reintentar'}
160
164
  />
161
165
  )
162
166
  },
@@ -15,8 +15,8 @@ const moneySchema = z.object({
15
15
  currencyCode: z.string(),
16
16
  })
17
17
 
18
- // Mirrors the CheckoutForm1FormData block contract. Card fields stay in the
19
- // shape (the block requires every key) but are never collected at launch.
18
+ // Mirrors the canonical Checkout values contract. There are no card fields:
19
+ // card collection belongs to the host payment-provider surface.
20
20
  export const checkoutFormDataSchema = z.object({
21
21
  email: z.string(),
22
22
  firstName: z.string(),
@@ -28,29 +28,24 @@ export const checkoutFormDataSchema = z.object({
28
28
  zipCode: z.string(),
29
29
  country: z.string(),
30
30
  paymentMethod: z.string(),
31
- cardNumber: z.string(),
32
- expiryDate: z.string(),
33
- cvv: z.string(),
34
- cardName: z.string(),
35
31
  saveInfo: z.boolean(),
36
- sameAsBilling: z.boolean(),
37
32
  newsletter: z.boolean(),
38
33
  promoCode: z.string(),
39
34
  })
40
35
 
41
- // Mirrors CheckoutForm1OrderSummaryItem: backend line total preferred, legacy
42
- // numeric price accepted only as a fallback; optional image omitted when absent.
36
+ // Mirrors the canonical Checkout order line: backend identity, optional canonical
37
+ // Money amounts, and an optional image omitted when absent.
43
38
  export const orderSummaryItemSchema = z.object({
44
39
  id: z.union([z.string(), z.number()]),
45
40
  name: z.string(),
46
41
  variant: z.string().optional(),
47
42
  quantity: z.number(),
48
43
  lineTotal: moneySchema.optional(),
49
- price: z.number().optional(),
44
+ unitPrice: moneySchema.optional(),
50
45
  image: z.string().optional(),
51
46
  })
52
47
 
53
- // Mirrors CheckoutForm1Totals (backend-authoritative).
48
+ // Mirrors the canonical Checkout totals (backend-authoritative).
54
49
  export const checkoutTotalsSchema = z.object({
55
50
  subtotal: moneySchema,
56
51
  discount: moneySchema.optional(),
@@ -62,10 +57,6 @@ export const checkoutTotalsSchema = z.object({
62
57
  export const orderSummarySchema = z.object({
63
58
  items: z.array(orderSummaryItemSchema),
64
59
  totals: checkoutTotalsSchema.optional(),
65
- shipping: z.number().optional(),
66
- tax: z.number().optional(),
67
- discount: z.number().optional(),
68
- promoDiscount: z.number().optional(),
69
60
  })
70
61
 
71
62
  export const countryOptionSchema = z.object({
@@ -73,7 +64,7 @@ export const countryOptionSchema = z.object({
73
64
  label: z.string(),
74
65
  })
75
66
 
76
- // Mirrors CheckoutForm1ShippingOption (backend shipping method id).
67
+ // Mirrors the canonical Checkout shipping option (backend shipping method id).
77
68
  export const shippingOptionSchema = z.object({
78
69
  id: z.string(),
79
70
  name: z.string(),
@@ -117,6 +108,9 @@ export const paymentMethodSchema = z.object({
117
108
  export const checkoutPropsSchema = z.object({
118
109
  title: z.string().optional(),
119
110
  description: z.string().optional(),
111
+ presentation: z.enum(['single-page', 'stepper']).optional(),
112
+ showReviewStep: z.boolean().optional(),
113
+ labels: z.record(z.string(), z.string()).optional(),
120
114
  orderSummary: orderSummarySchema.optional(),
121
115
  countries: z.array(countryOptionSchema).optional(),
122
116
  shippingOptions: z.array(shippingOptionSchema).optional(),
@@ -68,7 +68,6 @@ export const home: ViewModule = {
68
68
  return {
69
69
  heroProducts: homeData.selectHeroProducts(products).map(toFeaturedProduct),
70
70
  categories: categories.map(toCategoryCard),
71
- navCategories: homeData.toNavCategories(categories),
72
71
  dataSource: source,
73
72
  dataError: null,
74
73
  sections,
@@ -79,7 +78,6 @@ export const home: ViewModule = {
79
78
  return {
80
79
  heroProducts: [],
81
80
  categories: [],
82
- navCategories: [],
83
81
  dataSource: getDataSource(),
84
82
  dataError:
85
83
  error instanceof Error ? error.message : 'No se pudo cargar el catálogo.',
@@ -96,7 +96,6 @@ export const home: ViewModule = {
96
96
  return {
97
97
  heroProducts: homeData.selectHeroProducts(products).map(toFeaturedProduct),
98
98
  categories: categories.map(toCategoryCard),
99
- navCategories: homeData.toNavCategories(categories),
100
99
  dataSource: source,
101
100
  dataError: null,
102
101
  sections,
@@ -107,7 +106,6 @@ export const home: ViewModule = {
107
106
  return {
108
107
  heroProducts: [],
109
108
  categories: [],
110
- navCategories: [],
111
109
  dataSource: getDataSource(),
112
110
  dataError:
113
111
  error instanceof Error ? error.message : 'No se pudo cargar el catálogo.',