@thorprovider/storefront 0.7.0 → 0.9.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 (151) hide show
  1. package/README.md +22 -2
  2. package/assets/templates/AGENTS.md +14 -2
  3. package/assets/templates/app/app/[[...slug]]/page.tsx +9 -2
  4. package/assets/templates/app/lib/__STOREFRONT__/account-address.ts +129 -0
  5. package/assets/templates/app/lib/__STOREFRONT__/account-lifecycle.client.tsx +2 -2
  6. package/assets/templates/app/lib/__STOREFRONT__/account-private.core.ts +143 -0
  7. package/assets/templates/app/lib/__STOREFRONT__/account-profile.ts +220 -0
  8. package/assets/templates/app/lib/__STOREFRONT__/actions.ts +621 -80
  9. package/assets/templates/app/lib/__STOREFRONT__/addresses-port.ts +107 -0
  10. package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +346 -38
  11. package/assets/templates/app/lib/__STOREFRONT__/confirmation.core.ts +240 -0
  12. package/assets/templates/app/lib/__STOREFRONT__/customer-profile-port.ts +103 -0
  13. package/assets/templates/app/lib/__STOREFRONT__/order-detail-port.ts +26 -0
  14. package/assets/templates/app/lib/__STOREFRONT__/orders-port.ts +30 -0
  15. package/assets/templates/app/lib/__STOREFRONT__/ports.ts +18 -0
  16. package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.client.tsx +4 -4
  17. package/assets/templates/app/lib/__STOREFRONT__/session.ts +24 -6
  18. package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +21 -0
  19. package/assets/templates/app/lib/__STOREFRONT__/views/sections/address-book-advanced.client.tsx +29 -0
  20. package/assets/templates/app/lib/__STOREFRONT__/views/sections/checkout-commerce-v1.client.tsx +19 -0
  21. package/assets/templates/app/lib/__STOREFRONT__/views/sections/checkout-commerce-v1.tsx +16 -0
  22. package/assets/templates/app/lib/__STOREFRONT__/views/sections/customer-profile.client.tsx +27 -0
  23. package/assets/templates/app/lib/__STOREFRONT__/views/sections/index.ts +4 -1
  24. package/assets/templates/app/lib/__STOREFRONT__/views/sections/mega-menu-universal.client.tsx +19 -0
  25. package/assets/templates/app/lib/__STOREFRONT__/views/sections/mega-menu-universal.tsx +16 -0
  26. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.address-book-advanced.ts +437 -0
  27. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.checkout-commerce-v1.ts +398 -0
  28. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.customer-profile.ts +138 -0
  29. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.mega-menu-universal.ts +76 -0
  30. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.universal-banner.ts +217 -0
  31. package/assets/templates/app/lib/__STOREFRONT__/views/sections/universal-banner.client.tsx +24 -0
  32. package/assets/templates/app/lib/__STOREFRONT__/views/sections/universal-banner.tsx +16 -0
  33. package/assets/templates/features/checkout/handlers.ts +24 -4
  34. package/assets/templates/features/customer-addresses/handlers.ts +11 -0
  35. package/assets/templates/features/customer-addresses/state.ts +33 -0
  36. package/assets/templates/features/customer-auth/state.ts +10 -0
  37. package/assets/templates/features/customer-profile/handlers.ts +11 -0
  38. package/assets/templates/features/customer-profile/state.ts +18 -0
  39. package/assets/templates/views/account/address-book-advanced.defaults.ts +534 -0
  40. package/assets/templates/views/account/assembly/assembly.json +41 -0
  41. package/assets/templates/views/account/assembly/index.skeleton.tsx +229 -0
  42. package/assets/templates/views/account/assembly/registry.skeleton.tsx +1116 -0
  43. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/binding.json +5 -0
  44. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/catalog.part +4 -0
  45. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/element.part +5 -0
  46. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/registry.part +1 -0
  47. package/assets/templates/views/account/assembly/slots/addresses/cards/catalog.part +5 -0
  48. package/assets/templates/views/account/assembly/slots/addresses/cards/element.part +10 -0
  49. package/assets/templates/views/account/assembly/slots/addresses/cards/registry.part +1 -0
  50. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/catalog.part +5 -0
  51. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/element.part +5 -0
  52. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/registry.part +1 -0
  53. package/assets/templates/views/account/assembly/slots/login/card/catalog.part +4 -0
  54. package/assets/templates/views/account/assembly/slots/login/card/element.part +13 -0
  55. package/assets/templates/views/account/assembly/slots/login/card/registry.part +1 -0
  56. package/assets/templates/views/account/assembly/slots/orders/OrderHistory/catalog.part +5 -0
  57. package/assets/templates/views/account/assembly/slots/orders/OrderHistory/element.part +5 -0
  58. package/assets/templates/views/account/assembly/slots/orders/OrderHistory/registry.part +2 -0
  59. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/binding.json +5 -0
  60. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/catalog.part +5 -0
  61. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/element.part +5 -0
  62. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/registry.part +1 -0
  63. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/binding.json +5 -0
  64. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/catalog.part +4 -0
  65. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/element.part +5 -0
  66. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/registry.part +1 -0
  67. package/assets/templates/views/account/assembly/slots/profile/form/catalog.part +5 -0
  68. package/assets/templates/views/account/assembly/slots/profile/form/element.part +10 -0
  69. package/assets/templates/views/account/assembly/slots/profile/form/registry.part +1 -0
  70. package/assets/templates/views/account/assembly/slots/register/SignUpPage1/catalog.part +4 -0
  71. package/assets/templates/views/account/assembly/slots/register/SignUpPage1/element.part +13 -0
  72. package/assets/templates/views/account/assembly/slots/register/SignUpPage1/registry.part +1 -0
  73. package/assets/templates/views/account/assembly/slots/summary/stack/catalog.part +5 -0
  74. package/assets/templates/views/account/assembly/slots/summary/stack/element.part +5 -0
  75. package/assets/templates/views/account/assembly/slots/summary/stack/registry.part +1 -0
  76. package/assets/templates/views/account/assembly/slots/summary/tabs/catalog.part +5 -0
  77. package/assets/templates/views/account/assembly/slots/summary/tabs/element.part +5 -0
  78. package/assets/templates/views/account/assembly/slots/summary/tabs/registry.part +1 -0
  79. package/assets/templates/views/account/content.ts +326 -0
  80. package/assets/templates/views/account/customer-profile.defaults.ts +136 -0
  81. package/assets/templates/views/account/index.tsx +218 -35
  82. package/assets/templates/views/account/order-detail.client.tsx +35 -0
  83. package/assets/templates/views/account/order-detail.defaults.ts +457 -0
  84. package/assets/templates/views/account/orders-advanced.client.tsx +166 -0
  85. package/assets/templates/views/account/orders-advanced.defaults.ts +230 -0
  86. package/assets/templates/views/account/registry.tsx +944 -369
  87. package/assets/templates/views/account/schema.ts +50 -0
  88. package/assets/templates/views/account/sections-data.ts +2 -0
  89. package/assets/templates/views/cart/content.ts +1 -0
  90. package/assets/templates/views/category/assembly/index.skeleton.tsx +1 -0
  91. package/assets/templates/views/category/assembly/slots/filter/CategoryListing/element.part +1 -0
  92. package/assets/templates/views/category/content.ts +2 -0
  93. package/assets/templates/views/category/index.tsx +2 -0
  94. package/assets/templates/views/category/sections-data.ts +2 -0
  95. package/assets/templates/views/checkout/checkout-commerce-hosted.tsx +1089 -0
  96. package/assets/templates/views/checkout/content.ts +51 -0
  97. package/assets/templates/views/checkout/index.tsx +1 -1
  98. package/assets/templates/views/checkout/props.ts +10 -2
  99. package/assets/templates/views/checkout/registry.tsx +104 -42
  100. package/assets/templates/views/checkout/schema.ts +76 -1
  101. package/assets/templates/views/home/assembly/assembly.json +22 -1
  102. package/assets/templates/views/home/assembly/index.skeleton.tsx +1 -0
  103. package/assets/templates/views/home/content.ts +2 -0
  104. package/assets/templates/views/home/index.tsx +1 -0
  105. package/assets/templates/views/home/sections-data.ts +2 -0
  106. package/assets/templates/views/product/content.ts +1 -0
  107. package/assets/templates/views/static/content.ts +1 -0
  108. package/bin/storefront.js +343 -13
  109. package/package.json +2 -1
  110. package/recipes/adapter-surface.json +158 -0
  111. package/recipes/archetypes.json +38 -3
  112. package/recipes/catalog.json +138 -1
  113. package/recipes/feature.schema.json +9 -0
  114. package/recipes/features.json +72 -1
  115. package/recipes/manifest.schema.json +5 -0
  116. package/recipes/recipe.schema.json +13 -1
  117. package/recipes/recipes.json +34 -5
  118. package/recipes/section.schema.json +112 -0
  119. package/recipes/sections.json +281 -4
  120. package/recipes/validate.mjs +83 -1
  121. package/scripts/adapter-surface.mjs +41 -0
  122. package/scripts/agent-blocks.mjs +700 -0
  123. package/scripts/block-validator.mjs +45 -0
  124. package/scripts/candidate.mjs +5 -4
  125. package/scripts/composers.mjs +7 -2
  126. package/scripts/default-sections.mjs +78 -0
  127. package/scripts/file-classes.mjs +14 -0
  128. package/scripts/generate-adapter-surface.mjs +148 -0
  129. package/scripts/operations.mjs +100 -0
  130. package/scripts/reconcile.mjs +67 -39
  131. package/scripts/section-configure.mjs +316 -0
  132. package/scripts/sync-assets.mjs +1 -0
  133. package/scripts/view-assembly.mjs +101 -14
  134. package/skills/sf-feature/SKILL.md +19 -0
  135. package/skills/sf-view-gen/SKILL.md +73 -7
  136. package/skills/sf-view-gen/assets/recipes/archetypes.json +38 -3
  137. package/skills/sf-view-gen/assets/recipes/catalog.json +138 -1
  138. package/skills/sf-view-gen/assets/recipes/features.json +72 -1
  139. package/skills/sf-view-gen/assets/recipes/recipes.json +34 -5
  140. package/skills/sf-view-gen/assets/recipes/section.schema.json +112 -0
  141. package/skills/sf-view-gen/assets/recipes/sections.json +281 -4
  142. package/skills/sf-view-gen/assets/templates/views/sections/checkout-commerce-v1.client.tsx +19 -0
  143. package/skills/sf-view-gen/assets/templates/views/sections/checkout-commerce-v1.tsx +16 -0
  144. package/skills/sf-view-gen/assets/templates/views/sections/mega-menu-universal.client.tsx +19 -0
  145. package/skills/sf-view-gen/assets/templates/views/sections/mega-menu-universal.tsx +16 -0
  146. package/skills/sf-view-gen/assets/templates/views/sections/schema.checkout-commerce-v1.ts +398 -0
  147. package/skills/sf-view-gen/assets/templates/views/sections/schema.mega-menu-universal.ts +76 -0
  148. package/skills/sf-view-gen/assets/templates/views/sections/schema.universal-banner.ts +217 -0
  149. package/skills/sf-view-gen/assets/templates/views/sections/universal-banner.client.tsx +24 -0
  150. package/skills/sf-view-gen/assets/templates/views/sections/universal-banner.tsx +16 -0
  151. package/skills/sf-view-gen/scripts/validate.mjs +83 -1
@@ -0,0 +1,136 @@
1
+ // Generated by design:integrate for the account view. Do not edit.
2
+ export const customerProfileDefaults = {
3
+ "labels": {
4
+ "heading": "Mi perfil",
5
+ "description": "Administra tu información personal y tus preferencias.",
6
+ "accountTypeIndividual": "Cuenta personal",
7
+ "accountTypeBusiness": "Cuenta de empresa",
8
+ "edit": "Editar",
9
+ "save": "Guardar",
10
+ "saving": "Guardando…",
11
+ "cancel": "Cancelar",
12
+ "saved": "Cambios guardados.",
13
+ "incomplete": "Tu perfil está incompleto: aún faltan datos opcionales.",
14
+ "readOnly": "Solo lectura. Tu tienda no permite editar estos datos desde aquí.",
15
+ "optional": "opcional",
16
+ "emptyValue": "—",
17
+ "yes": "Sí",
18
+ "no": "No",
19
+ "loading": "Cargando tu perfil…",
20
+ "sections": {
21
+ "personal": {
22
+ "title": "Información personal",
23
+ "description": "Tu nombre y cómo prefieres que te llamemos."
24
+ },
25
+ "contact": {
26
+ "title": "Información de contacto",
27
+ "description": "Cómo te localizamos para pedidos y avisos."
28
+ },
29
+ "preferences": {
30
+ "title": "Preferencias",
31
+ "description": "Idioma, moneda y comunicaciones de tu cuenta."
32
+ },
33
+ "professional": {
34
+ "title": "Información profesional",
35
+ "description": "Tu puesto de trabajo y las organizaciones asociadas."
36
+ },
37
+ "custom": {
38
+ "title": "Datos adicionales",
39
+ "description": "Campos que configura tu tienda."
40
+ }
41
+ },
42
+ "fields": {
43
+ "firstName": "Nombre",
44
+ "lastName": "Apellidos",
45
+ "middleName": "Segundo nombre",
46
+ "preferredName": "Nombre preferido",
47
+ "birthDate": "Fecha de nacimiento",
48
+ "email": "Correo electrónico",
49
+ "phone": "Teléfono",
50
+ "phoneCountry": "Código de país",
51
+ "language": "Idioma",
52
+ "currency": "Moneda",
53
+ "timezone": "Zona horaria",
54
+ "marketingEmail": "Correos promocionales",
55
+ "marketingSms": "SMS promocionales",
56
+ "commercial": "Notificaciones comerciales",
57
+ "jobTitle": "Cargo",
58
+ "department": "Departamento",
59
+ "workPhone": "Teléfono laboral"
60
+ },
61
+ "verification": {
62
+ "verified": "Verificado",
63
+ "unverified": "Sin verificar",
64
+ "pending": "Verificación pendiente",
65
+ "failed": "No se pudo verificar",
66
+ "verifyEmail": "Verificar correo",
67
+ "verifyPhone": "Verificar teléfono",
68
+ "changePending": "Cambio solicitado a {value} · pendiente de confirmación",
69
+ "phoneChangePending": "Cambio solicitado a {value} · pendiente de confirmación",
70
+ "transactional": "Los avisos operativos (pedidos, entregas y pagos) se envían siempre y no se desactivan aquí.",
71
+ "consentSource": "Origen del consentimiento: {source}"
72
+ },
73
+ "organizations": {
74
+ "title": "Organizaciones",
75
+ "empty": "No perteneces a ninguna organización.",
76
+ "manage": "Gestionar empresa",
77
+ "active": "Activa",
78
+ "role": "Rol",
79
+ "status": {
80
+ "active": "Miembro activo",
81
+ "invited": "Invitación pendiente",
82
+ "suspended": "Acceso suspendido"
83
+ }
84
+ },
85
+ "custom": {
86
+ "empty": "La tienda no ha configurado campos adicionales.",
87
+ "readOnlyField": "Solo lectura"
88
+ },
89
+ "validation": {
90
+ "required": "Este campo es obligatorio.",
91
+ "nameTooLong": "El nombre es demasiado largo.",
92
+ "emailInvalid": "Escribe un correo válido, por ejemplo nombre@dominio.com.",
93
+ "phoneInvalid": "El número no coincide con el país seleccionado.",
94
+ "phoneCountryInvalid": "Elige un código de país.",
95
+ "valueTooLong": "El texto supera la longitud máxima.",
96
+ "dateInvalid": "Escribe una fecha válida.",
97
+ "dateFuture": "La fecha no puede estar en el futuro.",
98
+ "optionUnavailable": "Elige una de las opciones disponibles en la tienda.",
99
+ "numberInvalid": "Escribe un número.",
100
+ "numberRange": "El valor está fuera del rango permitido.",
101
+ "selectInvalid": "Elige una de las opciones disponibles.",
102
+ "fieldRequired": "Este campo es obligatorio.",
103
+ "booleanInvalid": "Marca o desmarca la casilla."
104
+ },
105
+ "validationSummary": "Revisa los campos marcados antes de guardar.",
106
+ "errors": {
107
+ "load": "No pudimos cargar tu perfil.",
108
+ "forbidden": "No tienes permiso para ver este perfil.",
109
+ "save": "No pudimos guardar los cambios. Inténtalo de nuevo.",
110
+ "retry": "Reintentar",
111
+ "dismiss": "Cerrar"
112
+ },
113
+ "discard": {
114
+ "title": "Hay cambios sin guardar",
115
+ "body": "Si abres otra sección ahora, perderás lo que has escrito.",
116
+ "confirm": "Descartar cambios",
117
+ "cancel": "Seguir editando"
118
+ },
119
+ "empty": {
120
+ "title": "Tu perfil no está disponible",
121
+ "body": "La tienda no ha habilitado datos de perfil para tu cuenta."
122
+ }
123
+ },
124
+ "capabilities": {
125
+ "emailVerification": false,
126
+ "phoneVerification": false
127
+ },
128
+ "permissions": {
129
+ "editPersonal": true,
130
+ "editContact": true,
131
+ "editPreferences": true,
132
+ "editProfessional": true,
133
+ "editCustom": true
134
+ },
135
+ "lang": "es"
136
+ }
@@ -6,30 +6,59 @@
6
6
  //
7
7
  // The initial render does NOT read the auth cookie here (this module is part of
8
8
  // the client catalog graph). The catch-all page seeds the account identity for
9
- // every route (tasks 2.1/2.2) and the globally mounted shared account lifecycle
10
- // (feature customer-auth handlers) owns identity; the headless `AccountBoot`
11
- // boundary is passive and only surfaces the retryable unavailable status, so no
12
- // route-level identity fetch happens here.
9
+ // every route and the globally mounted shared account lifecycle owns identity;
10
+ // the headless `AccountBoot` boundary is passive and only surfaces the retryable
11
+ // unavailable status, so no route-level identity fetch happens here.
12
+ //
13
+ // The element tree is assembled from the registered slots (boot, login,
14
+ // register, summary, orders, profile, addresses). Module slots render only when
15
+ // their feature is installed and the shopper is authenticated; the account frame
16
+ // owns the shape (stack/tabs) and the module navigation.
13
17
 
18
+ import { notFound } from 'next/navigation'
14
19
  import { getDataSource } from '../../store-context'
15
20
  import { pageRoot } from '../../spec/page-root'
16
21
  import type { StorefrontElement } from '../../spec/types'
17
22
  import type { ViewModule } from '../types'
18
23
  import { registry } from './registry'
24
+ import { sectionData } from './sections-data'
19
25
  import { accountContent } from './content'
26
+ import { orderDetailDefaults } from './order-detail.defaults'
27
+ import { accountOrdersAdvancedDefaults } from './orders-advanced.defaults'
20
28
  import {
29
+ accountAddressPropsSchema,
21
30
  accountEmptyPropsSchema,
31
+ accountFramePropsSchema,
22
32
  accountLoginPropsSchema,
33
+ accountOrderDetailPropsSchema,
34
+ accountOrdersAdvancedPropsSchema,
23
35
  accountOrdersPropsSchema,
36
+ accountProfilePropsSchema,
24
37
  accountRegisterPropsSchema,
25
38
  } from './schema'
39
+ import { customerProfileDefaults } from './customer-profile.defaults'
40
+ import { customerProfilePropsSchema } from '../sections/schema.customer-profile'
41
+ import { addressBookAdvancedDefaults } from './address-book-advanced.defaults'
42
+ import { addressBookAdvancedPropsSchema } from '../sections/schema.address-book-advanced'
43
+
44
+ // Existing stores keep a user-owned content.ts that may predate the advanced
45
+ // orders variant; the derived defaults keep the element type-safe and renderable
46
+ // until the store opts into its own copy.
47
+ const ordersAdvancedContent =
48
+ (accountContent as { ordersAdvanced?: typeof accountOrdersAdvancedDefaults }).ordersAdvanced ??
49
+ accountOrdersAdvancedDefaults
26
50
 
27
- // Surfaces: a passive boundary (headless unavailable/retry), sign-in,
28
- // registration, and the signed-in panel. Sign-in and registration are toggled
29
- // by `/accountMode` and hidden while the session is `unavailable`, so an outage
30
- // shows the retryable boundary rather than a false signed-out form; the panel
31
- // shows only when `/accountAuthenticated` is true.
32
51
  const elements: Record<string, StorefrontElement> = {
52
+ // Route-only detail element: it belongs to /account/orders/[id], never to the
53
+ // account page root. The loader supplies the id and the port is injected by
54
+ // the client binding.
55
+ 'account.orderDetail': {
56
+ type: 'AccountOrderDetail',
57
+ props: {
58
+ orderId: { $state: '/orderDetailId' },
59
+ ...orderDetailDefaults,
60
+ },
61
+ },
33
62
  'account.boot': {
34
63
  type: 'AccountBoot',
35
64
  props: {},
@@ -42,8 +71,6 @@ const elements: Record<string, StorefrontElement> = {
42
71
  { $state: '/accountAuthenticated', not: true },
43
72
  { $state: '/accountResolution', neq: 'unavailable' },
44
73
  { $state: '/accountMode', eq: 'login' },
45
- // While a reconciliation is in flight the sign-in form must not appear
46
- // (that would fake a signed-out state before the server confirms it).
47
74
  { $state: '/accountReconciling', not: true },
48
75
  ],
49
76
  },
@@ -63,20 +90,77 @@ const elements: Record<string, StorefrontElement> = {
63
90
  props: accountContent.register,
64
91
  on: { showLogin: { action: 'showLogin' } },
65
92
  },
66
- 'account.panel': {
67
- type: 'AccountPanel',
93
+ 'account.summary': {
94
+ type: 'AccountFrame',
68
95
  visible: { $state: '/accountAuthenticated' },
69
- props: {},
70
- on: { logout: { action: 'logout' } },
96
+ props: { ...accountContent.frame, presentation: 'stack' },
71
97
  },
72
98
  'account.orders': {
73
- type: 'AccountOrders',
99
+ type: 'AccountOrdersAdvanced',
100
+ visible: { $state: '/accountAuthenticated' },
101
+ props: ordersAdvancedContent,
102
+ },
103
+ 'account.profile': {
104
+ type: 'CustomerProfile',
105
+ visible: {"$and":[{"$state":"/accountAuthenticated"},{"$state":"/accountProfileAvailable","eq":true}]},
106
+ props: customerProfileDefaults,
107
+ },
108
+ 'account.addresses': {
109
+ type: 'AddressBookAdvanced',
110
+ visible: {"$and":[{"$state":"/accountAuthenticated"},{"$state":"/accountAddressesAvailable","eq":true}]},
111
+ props: addressBookAdvancedDefaults,
112
+ },
113
+ // Route-specific shell roots. The same shell component receives the active
114
+ // module as children; the route, not a client tab, decides which module is
115
+ // current.
116
+ 'account.shell.overview': {
117
+ type: 'AccountShell',
118
+ visible: { $state: '/accountAuthenticated' },
119
+ props: {},
120
+ children: ['account.overview'],
121
+ },
122
+ 'account.shell.orders': {
123
+ type: 'AccountShell',
124
+ visible: { $state: '/accountAuthenticated' },
125
+ props: {},
126
+ children: ['account.orders'],
127
+ },
128
+ 'account.shell.profile': {
129
+ type: 'AccountShell',
130
+ visible: { $state: '/accountAuthenticated' },
131
+ props: {},
132
+ children: ['account.profile'],
133
+ },
134
+ 'account.shell.addresses': {
135
+ type: 'AccountShell',
136
+ visible: { $state: '/accountAuthenticated' },
137
+ props: {},
138
+ children: ['account.addresses'],
139
+ },
140
+ 'account.shell.favorites': {
141
+ type: 'AccountShell',
142
+ visible: { $state: '/accountAuthenticated' },
143
+ props: {},
144
+ children: ['account.favorites'],
145
+ },
146
+ 'account.overview': {
147
+ type: 'AccountOverview',
74
148
  visible: { $state: '/accountAuthenticated' },
75
- props: accountContent.orders,
149
+ props: {},
150
+ },
151
+ 'account.favorites': {
152
+ type: 'AccountModulePlaceholder',
153
+ visible: { $state: '/accountAuthenticated' },
154
+ props: {},
76
155
  },
77
156
  }
78
157
 
79
158
  const catalog = {
159
+ AccountOrderDetail: {
160
+ props: accountOrderDetailPropsSchema,
161
+ description:
162
+ 'Route-only order detail surface for one authenticated customer order; the host port supplies the data and the block owns its states.',
163
+ },
80
164
  AccountBoot: {
81
165
  props: accountEmptyPropsSchema,
82
166
  description:
@@ -90,14 +174,38 @@ const catalog = {
90
174
  props: accountRegisterPropsSchema,
91
175
  description: 'Registration page with name, email, and password and a link to sign in.',
92
176
  },
93
- AccountPanel: {
177
+ AccountFrame: {
178
+ props: accountFramePropsSchema,
179
+ description:
180
+ 'Signed-in account frame: identity summary plus module navigation (presentations: stack, tabs).',
181
+ },
182
+ AccountOrdersAdvanced: {
183
+ props: accountOrdersAdvancedPropsSchema,
184
+ description:
185
+ "Signed-in customer's order history rendered by the default `OrderHistoryAdvanced` port block: search, quick filters, sort, counts and cards from the host `OrdersPort`. The canonical `OrderHistory` variant remains selectable as the minimal fallback.",
186
+ },
187
+ CustomerProfile: {
188
+ props: customerProfilePropsSchema,
189
+ description: "Designer customer profile surface: identity, contact, preferences, professional data and store-defined fields, supplied by the customerProfile host port.",
190
+ },
191
+ AddressBookAdvanced: {
192
+ props: addressBookAdvancedPropsSchema,
193
+ description: "Designer address book: saved personal addresses with search, filters, default shipping/billing and a full create/edit form, supplied by the addresses host port.",
194
+ },
195
+ AccountShell: {
94
196
  props: accountEmptyPropsSchema,
95
- description: 'Minimal signed-in state with the customer name and a logout control.',
197
+ description:
198
+ 'Signed-in designer account shell: identity header, module context bar and the active module as children. The host supplies the customer, capabilities and labels; the shell chooses no panel.',
199
+ },
200
+ AccountOverview: {
201
+ props: accountEmptyPropsSchema,
202
+ description:
203
+ 'Signed-in account overview: a capability-gated card dashboard that links to the account modules. No summaries or counters are invented.',
96
204
  },
97
- AccountOrders: {
98
- props: accountOrdersPropsSchema,
205
+ AccountModulePlaceholder: {
206
+ props: accountEmptyPropsSchema,
99
207
  description:
100
- "Signed-in customer's order history rendered by the canonical `OrderHistory` block (cards) with canonical Money amounts: the block owns the empty state, the host owns loading/error and an inline order detail.",
208
+ 'Documented planned-module panel for the account shell. It describes what the module will hold and exposes no fake data or mutation.',
101
209
  },
102
210
  }
103
211
 
@@ -106,21 +214,96 @@ export const account: ViewModule = {
106
214
  elements,
107
215
  catalog,
108
216
  registry,
109
- route: {
110
- path: '/account',
111
- loaderName: 'account',
112
- layout: 'default',
113
- metadata: {
114
- title: 'Mi cuenta',
115
- description: 'Inicia sesión o crea una cuenta para gestionar tu cuenta.',
217
+ route: [
218
+ {
219
+ path: '/account',
220
+ loaderName: 'account',
221
+ layout: 'default',
222
+ metadata: {
223
+ title: 'Mi cuenta',
224
+ description: 'Inicia sesión o crea una cuenta para gestionar tu cuenta.',
225
+ },
226
+ entry: pageRoot('account', ['account.boot', 'account.login', 'account.register', 'account.shell.overview'], elements),
116
227
  },
117
- entry: pageRoot(
118
- 'account',
119
- ['account.boot', 'account.login', 'account.register', 'account.panel', 'account.orders'],
120
- elements,
121
- ),
122
- },
228
+ {
229
+ path: '/account/orders',
230
+ loaderName: 'account',
231
+ layout: 'default',
232
+ metadata: {
233
+ title: 'Mis pedidos',
234
+ description: 'Consulta tus pedidos y su estado.',
235
+ },
236
+ entry: pageRoot(
237
+ 'accountOrders',
238
+ ['account.boot', 'account.login', 'account.register', 'account.shell.orders'],
239
+ elements,
240
+ ),
241
+ },
242
+ {
243
+ path: '/account/profile',
244
+ loaderName: 'account',
245
+ layout: 'default',
246
+ metadata: {
247
+ title: 'Mi perfil',
248
+ description: 'Actualiza tus datos personales y de contacto.',
249
+ },
250
+ entry: pageRoot(
251
+ 'accountProfile',
252
+ ['account.boot', 'account.login', 'account.register', 'account.shell.profile'],
253
+ elements,
254
+ ),
255
+ },
256
+ {
257
+ path: '/account/addresses',
258
+ loaderName: 'account',
259
+ layout: 'default',
260
+ metadata: {
261
+ title: 'Direcciones',
262
+ description: 'Gestiona tus direcciones de envío y facturación.',
263
+ },
264
+ entry: pageRoot(
265
+ 'accountAddresses',
266
+ ['account.boot', 'account.login', 'account.register', 'account.shell.addresses'],
267
+ elements,
268
+ ),
269
+ },
270
+ {
271
+ path: '/account/favorites',
272
+ loaderName: 'account',
273
+ layout: 'default',
274
+ metadata: {
275
+ title: 'Listas de compras',
276
+ description: 'Guarda productos para comprarlos más adelante.',
277
+ },
278
+ entry: pageRoot(
279
+ 'accountFavorites',
280
+ ['account.boot', 'account.login', 'account.register', 'account.shell.favorites'],
281
+ elements,
282
+ ),
283
+ },
284
+ {
285
+ // The order detail is a second route of the account view: it inherits the
286
+ // account feature gating and session lifecycle without a new view or
287
+ // feature. The loader only binds the dynamic segment; the loader-free port
288
+ // owns the data read and its typed states.
289
+ path: '/account/orders/[id]',
290
+ loaderName: 'orderDetail',
291
+ layout: 'default',
292
+ metadata: {
293
+ title: 'Pedido',
294
+ description: 'Detalle de tu pedido.',
295
+ },
296
+ entry: pageRoot('accountOrderDetail', ['account.orderDetail'], {
297
+ 'account.orderDetail': elements['account.orderDetail'],
298
+ }),
299
+ },
300
+ ],
123
301
  loader: {
124
302
  account: async () => ({ dataSource: getDataSource(), dataError: null }),
303
+ orderDetail: async (params) => {
304
+ const orderId = Array.isArray(params.id) ? params.id[0] : params.id
305
+ if (!orderId) notFound()
306
+ return { orderDetailId: orderId }
307
+ },
125
308
  },
126
309
  }
@@ -0,0 +1,35 @@
1
+ 'use client'
2
+
3
+ import { OrderDetail as OrderDetailSurface } from '@thorprovider/blocks'
4
+ import type { OrderDetailProps } from '@thorprovider/blocks'
5
+
6
+ import { ports } from '../../ports'
7
+ import { accountOrderDetailPropsSchema } from './schema'
8
+
9
+ type PanelProps = {
10
+ props: Record<string, unknown>
11
+ }
12
+
13
+ /**
14
+ * Host panel for the /account/orders/[id] route. It parses the element props,
15
+ * injects the fail-closed `orderDetail` port and renders the landed surface with
16
+ * its own loading, error, not-found and forbidden states.
17
+ */
18
+ export function AccountOrderDetailPanel({ props }: PanelProps) {
19
+ const parsed = accountOrderDetailPropsSchema.parse(props)
20
+
21
+ return (
22
+ <div className="mx-auto w-full max-w-7xl px-4 py-8 sm:px-6 lg:px-8">
23
+ <OrderDetailSurface
24
+ orderId={parsed.orderId}
25
+ labels={parsed.labels as OrderDetailProps['labels']}
26
+ settings={parsed.settings as OrderDetailProps['settings']}
27
+ locale={parsed.locale}
28
+ presentation={parsed.presentation as OrderDetailProps['presentation']}
29
+ openSections={parsed.openSections as OrderDetailProps['openSections']}
30
+ access={parsed.access}
31
+ port={ports.orderDetail}
32
+ />
33
+ </div>
34
+ )
35
+ }