@thorprovider/storefront 0.6.3 → 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 (161) 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 +1234 -75
  9. package/assets/templates/app/lib/__STOREFRONT__/addresses-port.ts +107 -0
  10. package/assets/templates/app/lib/__STOREFRONT__/checkout-shipping.core.ts +37 -0
  11. package/assets/templates/app/lib/__STOREFRONT__/commerce.ts +460 -35
  12. package/assets/templates/app/lib/__STOREFRONT__/confirmation.core.ts +240 -0
  13. package/assets/templates/app/lib/__STOREFRONT__/customer-profile-port.ts +103 -0
  14. package/assets/templates/app/lib/__STOREFRONT__/order-detail-port.ts +26 -0
  15. package/assets/templates/app/lib/__STOREFRONT__/orders-port.ts +30 -0
  16. package/assets/templates/app/lib/__STOREFRONT__/ports.ts +18 -0
  17. package/assets/templates/app/lib/__STOREFRONT__/projection-ownership.client.tsx +4 -4
  18. package/assets/templates/app/lib/__STOREFRONT__/session.ts +24 -6
  19. package/assets/templates/app/lib/__STOREFRONT__/state.core.ts +28 -1
  20. package/assets/templates/app/lib/__STOREFRONT__/views/sections/address-book-advanced.client.tsx +29 -0
  21. package/assets/templates/app/lib/__STOREFRONT__/views/sections/checkout-commerce-v1.client.tsx +19 -0
  22. package/assets/templates/app/lib/__STOREFRONT__/views/sections/checkout-commerce-v1.tsx +16 -0
  23. package/assets/templates/app/lib/__STOREFRONT__/views/sections/customer-profile.client.tsx +27 -0
  24. package/assets/templates/app/lib/__STOREFRONT__/views/sections/index.ts +5 -1
  25. package/assets/templates/app/lib/__STOREFRONT__/views/sections/marketplace-product-card.client.tsx +19 -0
  26. package/assets/templates/app/lib/__STOREFRONT__/views/sections/marketplace-product-card.tsx +16 -0
  27. package/assets/templates/app/lib/__STOREFRONT__/views/sections/mega-menu-universal.client.tsx +19 -0
  28. package/assets/templates/app/lib/__STOREFRONT__/views/sections/mega-menu-universal.tsx +16 -0
  29. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.address-book-advanced.ts +437 -0
  30. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.checkout-commerce-v1.ts +398 -0
  31. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.customer-profile.ts +138 -0
  32. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.marketplace-product-card.ts +67 -0
  33. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.mega-menu-universal.ts +76 -0
  34. package/assets/templates/app/lib/__STOREFRONT__/views/sections/schema.universal-banner.ts +217 -0
  35. package/assets/templates/app/lib/__STOREFRONT__/views/sections/universal-banner.client.tsx +24 -0
  36. package/assets/templates/app/lib/__STOREFRONT__/views/sections/universal-banner.tsx +16 -0
  37. package/assets/templates/features/checkout/handlers.ts +348 -33
  38. package/assets/templates/features/checkout/state.ts +79 -3
  39. package/assets/templates/features/customer-addresses/handlers.ts +11 -0
  40. package/assets/templates/features/customer-addresses/state.ts +33 -0
  41. package/assets/templates/features/customer-auth/state.ts +10 -0
  42. package/assets/templates/features/customer-profile/handlers.ts +11 -0
  43. package/assets/templates/features/customer-profile/state.ts +18 -0
  44. package/assets/templates/views/account/address-book-advanced.defaults.ts +534 -0
  45. package/assets/templates/views/account/assembly/assembly.json +41 -0
  46. package/assets/templates/views/account/assembly/index.skeleton.tsx +229 -0
  47. package/assets/templates/views/account/assembly/registry.skeleton.tsx +1116 -0
  48. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/binding.json +5 -0
  49. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/catalog.part +4 -0
  50. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/element.part +5 -0
  51. package/assets/templates/views/account/assembly/slots/addresses/AddressBookAdvanced/registry.part +1 -0
  52. package/assets/templates/views/account/assembly/slots/addresses/cards/catalog.part +5 -0
  53. package/assets/templates/views/account/assembly/slots/addresses/cards/element.part +10 -0
  54. package/assets/templates/views/account/assembly/slots/addresses/cards/registry.part +1 -0
  55. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/catalog.part +5 -0
  56. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/element.part +5 -0
  57. package/assets/templates/views/account/assembly/slots/boot/AccountBoot/registry.part +1 -0
  58. package/assets/templates/views/account/assembly/slots/login/card/catalog.part +4 -0
  59. package/assets/templates/views/account/assembly/slots/login/card/element.part +13 -0
  60. package/assets/templates/views/account/assembly/slots/login/card/registry.part +1 -0
  61. package/assets/templates/views/account/assembly/slots/orders/OrderHistory/catalog.part +5 -0
  62. package/assets/templates/views/account/assembly/slots/orders/OrderHistory/element.part +5 -0
  63. package/assets/templates/views/account/assembly/slots/orders/OrderHistory/registry.part +2 -0
  64. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/binding.json +5 -0
  65. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/catalog.part +5 -0
  66. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/element.part +5 -0
  67. package/assets/templates/views/account/assembly/slots/orders/OrderHistoryAdvanced/registry.part +1 -0
  68. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/binding.json +5 -0
  69. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/catalog.part +4 -0
  70. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/element.part +5 -0
  71. package/assets/templates/views/account/assembly/slots/profile/CustomerProfileAdvanced/registry.part +1 -0
  72. package/assets/templates/views/account/assembly/slots/profile/form/catalog.part +5 -0
  73. package/assets/templates/views/account/assembly/slots/profile/form/element.part +10 -0
  74. package/assets/templates/views/account/assembly/slots/profile/form/registry.part +1 -0
  75. package/assets/templates/views/account/assembly/slots/register/SignUpPage1/catalog.part +4 -0
  76. package/assets/templates/views/account/assembly/slots/register/SignUpPage1/element.part +13 -0
  77. package/assets/templates/views/account/assembly/slots/register/SignUpPage1/registry.part +1 -0
  78. package/assets/templates/views/account/assembly/slots/summary/stack/catalog.part +5 -0
  79. package/assets/templates/views/account/assembly/slots/summary/stack/element.part +5 -0
  80. package/assets/templates/views/account/assembly/slots/summary/stack/registry.part +1 -0
  81. package/assets/templates/views/account/assembly/slots/summary/tabs/catalog.part +5 -0
  82. package/assets/templates/views/account/assembly/slots/summary/tabs/element.part +5 -0
  83. package/assets/templates/views/account/assembly/slots/summary/tabs/registry.part +1 -0
  84. package/assets/templates/views/account/content.ts +326 -0
  85. package/assets/templates/views/account/customer-profile.defaults.ts +136 -0
  86. package/assets/templates/views/account/index.tsx +218 -35
  87. package/assets/templates/views/account/order-detail.client.tsx +35 -0
  88. package/assets/templates/views/account/order-detail.defaults.ts +457 -0
  89. package/assets/templates/views/account/orders-advanced.client.tsx +166 -0
  90. package/assets/templates/views/account/orders-advanced.defaults.ts +230 -0
  91. package/assets/templates/views/account/registry.tsx +944 -369
  92. package/assets/templates/views/account/schema.ts +50 -0
  93. package/assets/templates/views/account/sections-data.ts +2 -0
  94. package/assets/templates/views/cart/content.ts +1 -0
  95. package/assets/templates/views/category/assembly/index.skeleton.tsx +1 -0
  96. package/assets/templates/views/category/assembly/slots/filter/CategoryListing/element.part +1 -0
  97. package/assets/templates/views/category/content.ts +2 -0
  98. package/assets/templates/views/category/index.tsx +2 -0
  99. package/assets/templates/views/category/sections-data.ts +2 -0
  100. package/assets/templates/views/checkout/checkout-commerce-hosted.tsx +1089 -0
  101. package/assets/templates/views/checkout/content.ts +114 -2
  102. package/assets/templates/views/checkout/index.tsx +7 -1
  103. package/assets/templates/views/checkout/props.ts +70 -22
  104. package/assets/templates/views/checkout/registry.tsx +400 -71
  105. package/assets/templates/views/checkout/schema.ts +260 -9
  106. package/assets/templates/views/home/assembly/assembly.json +28 -0
  107. package/assets/templates/views/home/assembly/index.skeleton.tsx +1 -0
  108. package/assets/templates/views/home/content.ts +2 -0
  109. package/assets/templates/views/home/index.tsx +1 -0
  110. package/assets/templates/views/home/sections-data.ts +2 -0
  111. package/assets/templates/views/product/content.ts +1 -0
  112. package/assets/templates/views/static/content.ts +1 -0
  113. package/bin/storefront.js +343 -13
  114. package/package.json +2 -1
  115. package/recipes/adapter-surface.json +158 -0
  116. package/recipes/archetypes.json +38 -3
  117. package/recipes/catalog.json +138 -1
  118. package/recipes/feature.schema.json +9 -0
  119. package/recipes/features.json +72 -1
  120. package/recipes/manifest.schema.json +5 -0
  121. package/recipes/recipe.schema.json +14 -2
  122. package/recipes/recipes.json +35 -5
  123. package/recipes/section.schema.json +112 -0
  124. package/recipes/sections.json +289 -3
  125. package/recipes/validate.mjs +83 -1
  126. package/scripts/adapter-surface.mjs +41 -0
  127. package/scripts/agent-blocks.mjs +700 -0
  128. package/scripts/block-validator.mjs +45 -0
  129. package/scripts/candidate.mjs +5 -4
  130. package/scripts/composers.mjs +7 -2
  131. package/scripts/default-sections.mjs +78 -0
  132. package/scripts/file-classes.mjs +15 -0
  133. package/scripts/generate-adapter-surface.mjs +148 -0
  134. package/scripts/operations.mjs +100 -0
  135. package/scripts/reconcile.mjs +67 -39
  136. package/scripts/section-configure.mjs +316 -0
  137. package/scripts/sync-assets.mjs +1 -0
  138. package/scripts/view-assembly.mjs +101 -14
  139. package/skills/sf-feature/SKILL.md +19 -0
  140. package/skills/sf-view-gen/SKILL.md +79 -7
  141. package/skills/sf-view-gen/assets/recipes/archetypes.json +38 -3
  142. package/skills/sf-view-gen/assets/recipes/catalog.json +138 -1
  143. package/skills/sf-view-gen/assets/recipes/features.json +72 -1
  144. package/skills/sf-view-gen/assets/recipes/recipes.json +35 -5
  145. package/skills/sf-view-gen/assets/recipes/section.schema.json +112 -0
  146. package/skills/sf-view-gen/assets/recipes/sections.json +289 -3
  147. package/skills/sf-view-gen/assets/templates/views/sections/checkout-commerce-v1.client.tsx +19 -0
  148. package/skills/sf-view-gen/assets/templates/views/sections/checkout-commerce-v1.tsx +16 -0
  149. package/skills/sf-view-gen/assets/templates/views/sections/marketplace-product-card.client.tsx +19 -0
  150. package/skills/sf-view-gen/assets/templates/views/sections/marketplace-product-card.tsx +16 -0
  151. package/skills/sf-view-gen/assets/templates/views/sections/mega-menu-universal.client.tsx +19 -0
  152. package/skills/sf-view-gen/assets/templates/views/sections/mega-menu-universal.tsx +16 -0
  153. package/skills/sf-view-gen/assets/templates/views/sections/schema.checkout-commerce-v1.ts +398 -0
  154. package/skills/sf-view-gen/assets/templates/views/sections/schema.marketplace-product-card.ts +67 -0
  155. package/skills/sf-view-gen/assets/templates/views/sections/schema.mega-menu-universal.ts +76 -0
  156. package/skills/sf-view-gen/assets/templates/views/sections/schema.universal-banner.ts +217 -0
  157. package/skills/sf-view-gen/assets/templates/views/sections/universal-banner.client.tsx +24 -0
  158. package/skills/sf-view-gen/assets/templates/views/sections/universal-banner.tsx +16 -0
  159. package/skills/sf-view-gen/scripts/validate.mjs +83 -1
  160. package/skills/storefront-workflow/SKILL.md +5 -0
  161. package/skills/storefront-workflow/references/mobile-responsiveness.md +1 -1
@@ -64,10 +64,60 @@ export const accountOrdersPropsSchema = z.object({
64
64
  emptyLabel: z.string().optional(),
65
65
  })
66
66
 
67
+ // The advanced order-history variant keeps its full label/capability contract in
68
+ // the user-owned content file; the view only validates the host envelope, then
69
+ // the block receives the typed labels and capabilities.
70
+ export const accountOrdersAdvancedPropsSchema = z.object({
71
+ mode: z.enum(['b2c', 'b2b']).optional(),
72
+ locale: z.string().optional(),
73
+ pageSize: z.number().int().positive().optional(),
74
+ closeLabel: z.string().optional(),
75
+ paymentLabel: z.string().optional(),
76
+ fulfilmentLabel: z.string().optional(),
77
+ capabilities: z.record(z.string(), z.boolean()).optional(),
78
+ labels: z.record(z.string(), z.unknown()),
79
+ })
80
+
67
81
  // The headless bootstrap and the signed-in panel read their data from the
68
82
  // feature state, not from element props; declared so the catalog is complete.
69
83
  export const accountEmptyPropsSchema = z.object({})
70
84
 
85
+ // The account frame's serializable props. Identity and modules are supplied by
86
+ // the registry from stored data; the element carries only the shape and labels.
87
+ export const accountFramePropsSchema = z.object({
88
+ presentation: z.enum(['stack', 'tabs']).optional(),
89
+ labels: z.record(z.string(), z.string()).optional(),
90
+ })
91
+
92
+ // The profile and address modules read their data from feature state; the
93
+ // element carries only the host-owned labels.
94
+ export const accountProfilePropsSchema = z.object({
95
+ labels: z.record(z.string(), z.string()).optional(),
96
+ })
97
+
98
+ export const accountAddressPropsSchema = z.object({
99
+ labels: z.record(z.string(), z.string()).optional(),
100
+ })
101
+
71
102
  export type AccountLoginProps = z.infer<typeof accountLoginPropsSchema>
72
103
  export type AccountRegisterProps = z.infer<typeof accountRegisterPropsSchema>
73
104
  export type AccountOrdersProps = z.infer<typeof accountOrdersPropsSchema>
105
+ export type AccountOrdersAdvancedProps = z.infer<typeof accountOrdersAdvancedPropsSchema>
106
+ export type AccountFrameProps = z.infer<typeof accountFramePropsSchema>
107
+ export type AccountProfileProps = z.infer<typeof accountProfilePropsSchema>
108
+ export type AccountAddressProps = z.infer<typeof accountAddressPropsSchema>
109
+
110
+ // Route-only order-detail props. The label tree, settings and presentation are
111
+ // host-authored from the delivery copy; the route is not agent-editable, so the
112
+ // nested label shape stays opaque here instead of duplicating the block schema.
113
+ export const accountOrderDetailPropsSchema = z.object({
114
+ orderId: z.string().min(1),
115
+ locale: z.string().optional(),
116
+ labels: z.record(z.string(), z.unknown()),
117
+ settings: z.record(z.string(), z.boolean()).optional(),
118
+ presentation: z.record(z.string(), z.unknown()).optional(),
119
+ openSections: z.array(z.string()).optional(),
120
+ access: z.enum(['allowed', 'forbidden']).optional(),
121
+ })
122
+
123
+ export type AccountOrderDetailProps = z.infer<typeof accountOrderDetailPropsSchema>
@@ -0,0 +1,2 @@
1
+ // Generated by @thorprovider/storefront. Do not edit directly.
2
+ export const sectionData: Record<string, Record<string, unknown>> = {}
@@ -1,6 +1,7 @@
1
1
  // Thor Commerce view content: cart (user-owned)
2
2
  // Merchant-editable copy for the standalone cart review page. Seeded once by the
3
3
  // scaffolder and never overwritten on sync.
4
+ // A configured `sections/<id>.json` sidecar wins over this map for that instance.
4
5
 
5
6
  export const cartContent = {
6
7
  titleLabel: 'Tu carrito',
@@ -29,6 +29,7 @@ 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 { sectionData } from './sections-data'
32
33
  import { categoryBreadcrumbProps, categoryListingProps } from './props'
33
34
  import { breadcrumbPropsSchema, categoryListingPropsSchema } from './schema'@@SECTION_IMPORTS@@
34
35
 
@@ -1,5 +1,6 @@
1
1
  'category.filter': {
2
2
  type: 'CategoryListing',
3
+ on: { openProduct: { action: 'openProduct' } },
3
4
  props: {
4
5
  // User-owned copy first, so a customization can be overridden by the
5
6
  // feature config (search placeholder) and the derived state bindings.
@@ -4,6 +4,7 @@
4
4
  // derived view module (./index.tsx) imports it and wires it into the element
5
5
  // tree, so your edits here survive `storefront sync` and unit removal. Plain
6
6
  // data only: no React and no server imports.
7
+ // A configured `sections/<id>.json` sidecar wins over this map for that instance.
7
8
  //
8
9
  // The sort OPTIONS are not listed here: they come from the adapter-advertised
9
10
  // set (`getCatalogSortKeys`), never from assumed global price sorts.
@@ -27,5 +28,6 @@ export const filterContent = {
27
28
  * section never rewrites this file and your copy survives `storefront sync`.
28
29
  * Plain data only, matching the section fragment's props; an unset id renders
29
30
  * the section's neutral default.
31
+ * A configured `sections/<id>.json` sidecar wins over this map for that instance.
30
32
  */
31
33
  export const sectionContent: Record<string, Record<string, unknown>> = {}
@@ -29,6 +29,7 @@ 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 { sectionData } from './sections-data'
32
33
  import { categoryBreadcrumbProps, categoryListingProps } from './props'
33
34
  import { breadcrumbPropsSchema, categoryListingPropsSchema } from './schema'
34
35
 
@@ -66,6 +67,7 @@ const elements: Record<string, StorefrontElement> = {
66
67
  },
67
68
  'category.filter': {
68
69
  type: 'CategoryListing',
70
+ on: { openProduct: { action: 'openProduct' } },
69
71
  props: {
70
72
  // User-owned copy first, so a customization can be overridden by the
71
73
  // feature config (search placeholder) and the derived state bindings.
@@ -0,0 +1,2 @@
1
+ // Generated by @thorprovider/storefront. Do not edit directly.
2
+ export const sectionData: Record<string, Record<string, unknown>> = {}