@fayz-ai/storefront 0.9.0 → 0.10.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 (368) hide show
  1. package/README.md +3 -3
  2. package/dist/app/createStorefrontApp.d.ts +65 -0
  3. package/dist/app/createStorefrontApp.d.ts.map +1 -0
  4. package/dist/{define.d.ts → app/define.d.ts} +3 -3
  5. package/dist/app/define.d.ts.map +1 -0
  6. package/dist/app/hydration.d.ts +37 -0
  7. package/dist/app/hydration.d.ts.map +1 -0
  8. package/dist/app/prerender.d.ts +57 -0
  9. package/dist/app/prerender.d.ts.map +1 -0
  10. package/dist/{router.d.ts → app/router.d.ts} +140 -113
  11. package/dist/app/router.d.ts.map +1 -0
  12. package/dist/{scaffold.d.ts → app/scaffold.d.ts} +2 -2
  13. package/dist/app/scaffold.d.ts.map +1 -0
  14. package/dist/app/serving.d.ts +70 -0
  15. package/dist/app/serving.d.ts.map +1 -0
  16. package/dist/app/static-render.d.ts +46 -0
  17. package/dist/app/static-render.d.ts.map +1 -0
  18. package/dist/blocks/block-at-path.d.ts +59 -0
  19. package/dist/blocks/block-at-path.d.ts.map +1 -0
  20. package/dist/blocks/page-blocks.d.ts +163 -0
  21. package/dist/blocks/page-blocks.d.ts.map +1 -0
  22. package/dist/blocks/page-data.d.ts +105 -0
  23. package/dist/blocks/page-data.d.ts.map +1 -0
  24. package/dist/{blocks.d.ts → blocks/registry.d.ts} +1 -1
  25. package/dist/blocks/registry.d.ts.map +1 -0
  26. package/dist/{sections.d.ts → blocks/sections.d.ts} +40 -2
  27. package/dist/blocks/sections.d.ts.map +1 -0
  28. package/dist/chunk-6B7H3IZ6.js +10232 -0
  29. package/dist/chunk-6B7H3IZ6.js.map +1 -0
  30. package/dist/chunk-6IXTENLB.js +162 -0
  31. package/dist/chunk-6IXTENLB.js.map +1 -0
  32. package/dist/components/PaymentTerms.d.ts +34 -0
  33. package/dist/components/PaymentTerms.d.ts.map +1 -0
  34. package/dist/components/SmoothImage.d.ts +1 -1
  35. package/dist/components/SmoothImage.d.ts.map +1 -1
  36. package/dist/components/account/CustomerAccountShell.d.ts.map +1 -0
  37. package/dist/components/account/SignInModal.d.ts.map +1 -0
  38. package/dist/components/cart/CartDrawer.d.ts.map +1 -0
  39. package/dist/components/cart/QuantityInput.d.ts.map +1 -0
  40. package/dist/components/checkout/DeliveryEstimator.d.ts.map +1 -0
  41. package/dist/components/collection/CategoryShowcase.d.ts +44 -0
  42. package/dist/components/collection/CategoryShowcase.d.ts.map +1 -0
  43. package/dist/components/collection/FiltersPanel.d.ts +19 -0
  44. package/dist/components/collection/FiltersPanel.d.ts.map +1 -0
  45. package/dist/components/collection/ProductGrid.d.ts.map +1 -0
  46. package/dist/components/layout/PageBodyBlocks.d.ts +40 -0
  47. package/dist/components/layout/PageBodyBlocks.d.ts.map +1 -0
  48. package/dist/components/layout/SearchOverlay.d.ts +13 -0
  49. package/dist/components/layout/SearchOverlay.d.ts.map +1 -0
  50. package/dist/components/layout/StorefrontErrorBoundary.d.ts.map +1 -0
  51. package/dist/components/layout/StorefrontFooter.d.ts.map +1 -0
  52. package/dist/components/layout/StorefrontHeader.d.ts.map +1 -0
  53. package/dist/components/layout/Toaster.d.ts.map +1 -0
  54. package/dist/components/marketing/CollectionSections.d.ts +463 -0
  55. package/dist/components/marketing/CollectionSections.d.ts.map +1 -0
  56. package/dist/components/marketing/ConversionSections.d.ts +221 -0
  57. package/dist/components/marketing/ConversionSections.d.ts.map +1 -0
  58. package/dist/components/marketing/EditorialSections.d.ts +248 -0
  59. package/dist/components/marketing/EditorialSections.d.ts.map +1 -0
  60. package/dist/components/marketing/EntityList.d.ts +97 -0
  61. package/dist/components/marketing/EntityList.d.ts.map +1 -0
  62. package/dist/components/marketing/FormBlock.d.ts +167 -0
  63. package/dist/components/marketing/FormBlock.d.ts.map +1 -0
  64. package/dist/components/marketing/HeroSection.d.ts +125 -0
  65. package/dist/components/marketing/HeroSection.d.ts.map +1 -0
  66. package/dist/components/marketing/MediaCarousel.d.ts +135 -0
  67. package/dist/components/marketing/MediaCarousel.d.ts.map +1 -0
  68. package/dist/components/marketing/MiscSections.d.ts +252 -0
  69. package/dist/components/marketing/MiscSections.d.ts.map +1 -0
  70. package/dist/components/order/OrderTrackingTimeline.d.ts.map +1 -0
  71. package/dist/components/product/ProductCard.d.ts +14 -0
  72. package/dist/components/product/ProductCard.d.ts.map +1 -0
  73. package/dist/components/product/ProductEnquiryForm.d.ts.map +1 -0
  74. package/dist/components/product/ProductGallery.d.ts +36 -0
  75. package/dist/components/product/ProductGallery.d.ts.map +1 -0
  76. package/dist/components/{ProductOptionSelector.d.ts → product/ProductOptionSelector.d.ts} +1 -1
  77. package/dist/components/product/ProductOptionSelector.d.ts.map +1 -0
  78. package/dist/components/product/ProductRail.d.ts +93 -0
  79. package/dist/components/product/ProductRail.d.ts.map +1 -0
  80. package/dist/components/product/ProductReviews.d.ts +39 -0
  81. package/dist/components/product/ProductReviews.d.ts.map +1 -0
  82. package/dist/components/product/ProductSlider.d.ts +169 -0
  83. package/dist/components/product/ProductSlider.d.ts.map +1 -0
  84. package/dist/components/product/ProductSpecs.d.ts.map +1 -0
  85. package/dist/components/product/RelatedProducts.d.ts.map +1 -0
  86. package/dist/{auth.d.ts → data/auth.d.ts} +9 -0
  87. package/dist/data/auth.d.ts.map +1 -0
  88. package/dist/data/facets.d.ts +39 -0
  89. package/dist/data/facets.d.ts.map +1 -0
  90. package/dist/data/loaders.d.ts +56 -0
  91. package/dist/data/loaders.d.ts.map +1 -0
  92. package/dist/data/order-status.d.ts.map +1 -0
  93. package/dist/data/product-options.d.ts +36 -0
  94. package/dist/data/product-options.d.ts.map +1 -0
  95. package/dist/diagnostics/seo-audit.d.ts +54 -0
  96. package/dist/diagnostics/seo-audit.d.ts.map +1 -0
  97. package/dist/diagnostics/seo-audit.js +3 -0
  98. package/dist/diagnostics/seo-audit.js.map +1 -0
  99. package/dist/document/change.d.ts +100 -0
  100. package/dist/document/change.d.ts.map +1 -0
  101. package/dist/{config.d.ts → document/config.d.ts} +126 -7
  102. package/dist/document/config.d.ts.map +1 -0
  103. package/dist/document/describe.d.ts +135 -0
  104. package/dist/document/describe.d.ts.map +1 -0
  105. package/dist/document/overlay.d.ts +58 -0
  106. package/dist/document/overlay.d.ts.map +1 -0
  107. package/dist/{presets.d.ts → document/presets.d.ts} +2 -2
  108. package/dist/document/presets.d.ts.map +1 -0
  109. package/dist/document/render.d.ts +171 -0
  110. package/dist/document/render.d.ts.map +1 -0
  111. package/dist/document/round-trip.d.ts +46 -0
  112. package/dist/document/round-trip.d.ts.map +1 -0
  113. package/dist/document/sections.d.ts +194 -0
  114. package/dist/document/sections.d.ts.map +1 -0
  115. package/dist/document/upgrade.d.ts +112 -0
  116. package/dist/document/upgrade.d.ts.map +1 -0
  117. package/dist/document/validate.d.ts +24 -0
  118. package/dist/document/validate.d.ts.map +1 -0
  119. package/dist/{component-contracts.d.ts → extend/component-contracts.d.ts} +74 -22
  120. package/dist/extend/component-contracts.d.ts.map +1 -0
  121. package/dist/extend/component-override.d.ts +38 -0
  122. package/dist/extend/component-override.d.ts.map +1 -0
  123. package/dist/extend/component-selectors.d.ts.map +1 -0
  124. package/dist/extend/editor-bridge.d.ts +59 -0
  125. package/dist/extend/editor-bridge.d.ts.map +1 -0
  126. package/dist/extend/extension-points.d.ts +103 -0
  127. package/dist/extend/extension-points.d.ts.map +1 -0
  128. package/dist/extend/slots.d.ts +216 -0
  129. package/dist/extend/slots.d.ts.map +1 -0
  130. package/dist/hooks/index.d.ts +25 -6
  131. package/dist/hooks/index.d.ts.map +1 -1
  132. package/dist/hooks/use-address.d.ts +26 -0
  133. package/dist/hooks/use-address.d.ts.map +1 -0
  134. package/dist/hooks/use-cart.d.ts +3 -0
  135. package/dist/hooks/use-cart.d.ts.map +1 -0
  136. package/dist/hooks/use-catalog.d.ts +24 -0
  137. package/dist/hooks/use-catalog.d.ts.map +1 -0
  138. package/dist/hooks/use-categories.d.ts +19 -0
  139. package/dist/hooks/use-categories.d.ts.map +1 -0
  140. package/dist/hooks/use-checkout.d.ts +41 -0
  141. package/dist/hooks/use-checkout.d.ts.map +1 -0
  142. package/dist/hooks/use-discount-validator.d.ts +20 -0
  143. package/dist/hooks/use-discount-validator.d.ts.map +1 -0
  144. package/dist/hooks/use-enquiry.d.ts +7 -0
  145. package/dist/hooks/use-enquiry.d.ts.map +1 -0
  146. package/dist/hooks/{useMyOrders.d.ts → use-my-orders.d.ts} +1 -1
  147. package/dist/hooks/use-my-orders.d.ts.map +1 -0
  148. package/dist/hooks/use-order.d.ts +17 -0
  149. package/dist/hooks/use-order.d.ts.map +1 -0
  150. package/dist/hooks/use-payment-methods.d.ts +19 -0
  151. package/dist/hooks/use-payment-methods.d.ts.map +1 -0
  152. package/dist/hooks/use-policies.d.ts +25 -0
  153. package/dist/hooks/use-policies.d.ts.map +1 -0
  154. package/dist/hooks/use-product.d.ts +15 -0
  155. package/dist/hooks/use-product.d.ts.map +1 -0
  156. package/dist/hooks/{useProducts.d.ts → use-products.d.ts} +1 -1
  157. package/dist/hooks/use-products.d.ts.map +1 -0
  158. package/dist/hooks/use-region.d.ts +15 -0
  159. package/dist/hooks/use-region.d.ts.map +1 -0
  160. package/dist/hooks/use-shipping.d.ts +29 -0
  161. package/dist/hooks/use-shipping.d.ts.map +1 -0
  162. package/dist/hooks/use-storefront-actions.d.ts +12 -0
  163. package/dist/hooks/use-storefront-actions.d.ts.map +1 -0
  164. package/dist/hooks/use-storefront-head.d.ts +19 -0
  165. package/dist/hooks/use-storefront-head.d.ts.map +1 -0
  166. package/dist/hooks/use-storefront.d.ts +3 -0
  167. package/dist/hooks/use-storefront.d.ts.map +1 -0
  168. package/dist/index.d.ts +123 -54
  169. package/dist/index.d.ts.map +1 -1
  170. package/dist/index.js +1311 -5012
  171. package/dist/index.js.map +1 -1
  172. package/dist/lib/format.d.ts.map +1 -0
  173. package/dist/lib/motion.d.ts.map +1 -0
  174. package/dist/lib/seo.d.ts +26 -0
  175. package/dist/lib/seo.d.ts.map +1 -0
  176. package/dist/{testids.d.ts → lib/testids.d.ts} +21 -0
  177. package/dist/lib/testids.d.ts.map +1 -0
  178. package/dist/{theme.d.ts → lib/theme.d.ts} +41 -3
  179. package/dist/lib/theme.d.ts.map +1 -0
  180. package/dist/render.d.ts +5 -0
  181. package/dist/render.d.ts.map +1 -0
  182. package/dist/render.js +359 -0
  183. package/dist/render.js.map +1 -0
  184. package/dist/stores/cart.store.d.ts +6 -2
  185. package/dist/stores/cart.store.d.ts.map +1 -1
  186. package/dist/stores/catalog.store.d.ts +11 -0
  187. package/dist/stores/catalog.store.d.ts.map +1 -1
  188. package/dist/views/CatalogPage.d.ts.map +1 -0
  189. package/dist/views/CheckoutPage.d.ts.map +1 -0
  190. package/dist/views/ContentPage.d.ts +11 -0
  191. package/dist/views/ContentPage.d.ts.map +1 -0
  192. package/dist/views/HomePage.d.ts +9 -0
  193. package/dist/views/HomePage.d.ts.map +1 -0
  194. package/dist/views/MyPurchasesPage.d.ts.map +1 -0
  195. package/dist/views/NotFoundPage.d.ts.map +1 -0
  196. package/dist/{pages → views}/OrderConfirmationPage.d.ts.map +1 -1
  197. package/dist/{pages → views}/PolicyPage.d.ts.map +1 -1
  198. package/dist/views/ProductDetailPage.d.ts.map +1 -0
  199. package/dist/views/StorefrontPage.d.ts +35 -0
  200. package/dist/views/StorefrontPage.d.ts.map +1 -0
  201. package/dist/workflows/checkout.d.ts +1 -1
  202. package/dist/workflows/checkout.d.ts.map +1 -1
  203. package/package.json +21 -14
  204. package/dist/auth.d.ts.map +0 -1
  205. package/dist/blocks.d.ts.map +0 -1
  206. package/dist/component-contracts.d.ts.map +0 -1
  207. package/dist/component-selectors.d.ts.map +0 -1
  208. package/dist/components/CartDrawer.d.ts.map +0 -1
  209. package/dist/components/CustomerAccountShell.d.ts.map +0 -1
  210. package/dist/components/DeliveryEstimator.d.ts.map +0 -1
  211. package/dist/components/FiltersPanel.d.ts +0 -3
  212. package/dist/components/FiltersPanel.d.ts.map +0 -1
  213. package/dist/components/OrderTrackingTimeline.d.ts.map +0 -1
  214. package/dist/components/ProductCard.d.ts +0 -4
  215. package/dist/components/ProductCard.d.ts.map +0 -1
  216. package/dist/components/ProductEnquiryForm.d.ts.map +0 -1
  217. package/dist/components/ProductGallery.d.ts +0 -22
  218. package/dist/components/ProductGallery.d.ts.map +0 -1
  219. package/dist/components/ProductGrid.d.ts.map +0 -1
  220. package/dist/components/ProductOptionSelector.d.ts.map +0 -1
  221. package/dist/components/ProductSpecs.d.ts.map +0 -1
  222. package/dist/components/QuantityInput.d.ts.map +0 -1
  223. package/dist/components/RelatedProducts.d.ts.map +0 -1
  224. package/dist/components/SignInModal.d.ts.map +0 -1
  225. package/dist/components/StorefrontErrorBoundary.d.ts.map +0 -1
  226. package/dist/components/StorefrontFooter.d.ts.map +0 -1
  227. package/dist/components/StorefrontHeader.d.ts.map +0 -1
  228. package/dist/components/Toaster.d.ts.map +0 -1
  229. package/dist/components/sections/CategoryShowcase.d.ts +0 -6
  230. package/dist/components/sections/CategoryShowcase.d.ts.map +0 -1
  231. package/dist/components/sections/HeroSection.d.ts +0 -9
  232. package/dist/components/sections/HeroSection.d.ts.map +0 -1
  233. package/dist/components/sections/MediaCarousel.d.ts +0 -11
  234. package/dist/components/sections/MediaCarousel.d.ts.map +0 -1
  235. package/dist/components/sections/MiscSections.d.ts +0 -33
  236. package/dist/components/sections/MiscSections.d.ts.map +0 -1
  237. package/dist/components/sections/ProductRail.d.ts +0 -9
  238. package/dist/components/sections/ProductRail.d.ts.map +0 -1
  239. package/dist/components/sections/ProductSlider.d.ts +0 -15
  240. package/dist/components/sections/ProductSlider.d.ts.map +0 -1
  241. package/dist/config.d.ts.map +0 -1
  242. package/dist/createStorefrontApp.d.ts +0 -28
  243. package/dist/createStorefrontApp.d.ts.map +0 -1
  244. package/dist/define.d.ts.map +0 -1
  245. package/dist/format.d.ts.map +0 -1
  246. package/dist/hooks/useCategories.d.ts +0 -6
  247. package/dist/hooks/useCategories.d.ts.map +0 -1
  248. package/dist/hooks/useDiscountValidator.d.ts +0 -14
  249. package/dist/hooks/useDiscountValidator.d.ts.map +0 -1
  250. package/dist/hooks/useMyOrders.d.ts.map +0 -1
  251. package/dist/hooks/useProduct.d.ts +0 -7
  252. package/dist/hooks/useProduct.d.ts.map +0 -1
  253. package/dist/hooks/useProducts.d.ts.map +0 -1
  254. package/dist/hooks/useStorefront.d.ts +0 -35
  255. package/dist/hooks/useStorefront.d.ts.map +0 -1
  256. package/dist/hooks/useStorefrontHead.d.ts +0 -11
  257. package/dist/hooks/useStorefrontHead.d.ts.map +0 -1
  258. package/dist/motion.d.ts.map +0 -1
  259. package/dist/order-status.d.ts.map +0 -1
  260. package/dist/pages/CatalogPage.d.ts.map +0 -1
  261. package/dist/pages/CheckoutPage.d.ts.map +0 -1
  262. package/dist/pages/HomePage.d.ts +0 -9
  263. package/dist/pages/HomePage.d.ts.map +0 -1
  264. package/dist/pages/MyPurchasesPage.d.ts.map +0 -1
  265. package/dist/pages/NotFoundPage.d.ts.map +0 -1
  266. package/dist/pages/ProductDetailPage.d.ts.map +0 -1
  267. package/dist/presets.d.ts.map +0 -1
  268. package/dist/product-options.d.ts +0 -12
  269. package/dist/product-options.d.ts.map +0 -1
  270. package/dist/router.d.ts.map +0 -1
  271. package/dist/scaffold.d.ts.map +0 -1
  272. package/dist/sections.d.ts.map +0 -1
  273. package/dist/testids.d.ts.map +0 -1
  274. package/dist/theme.d.ts.map +0 -1
  275. package/src/auth.ts +0 -227
  276. package/src/blocks.tsx +0 -51
  277. package/src/catalog.ts +0 -3
  278. package/src/component-contracts.ts +0 -154
  279. package/src/component-selectors.ts +0 -31
  280. package/src/components/CartDrawer.tsx +0 -279
  281. package/src/components/CustomerAccountShell.tsx +0 -102
  282. package/src/components/DeliveryEstimator.tsx +0 -157
  283. package/src/components/FiltersPanel.tsx +0 -109
  284. package/src/components/OrderTrackingTimeline.tsx +0 -135
  285. package/src/components/Price.tsx +0 -32
  286. package/src/components/ProductCard.tsx +0 -120
  287. package/src/components/ProductEnquiryForm.tsx +0 -175
  288. package/src/components/ProductGallery.tsx +0 -174
  289. package/src/components/ProductGrid.tsx +0 -43
  290. package/src/components/ProductOptionSelector.tsx +0 -50
  291. package/src/components/ProductSpecs.tsx +0 -75
  292. package/src/components/QuantityInput.tsx +0 -52
  293. package/src/components/RelatedProducts.tsx +0 -40
  294. package/src/components/SignInModal.tsx +0 -120
  295. package/src/components/SmoothImage.tsx +0 -59
  296. package/src/components/StorefrontErrorBoundary.tsx +0 -51
  297. package/src/components/StorefrontFooter.tsx +0 -110
  298. package/src/components/StorefrontHeader.tsx +0 -477
  299. package/src/components/Toaster.tsx +0 -60
  300. package/src/components/sections/CategoryShowcase.tsx +0 -80
  301. package/src/components/sections/HeroSection.tsx +0 -193
  302. package/src/components/sections/MediaCarousel.tsx +0 -141
  303. package/src/components/sections/MiscSections.tsx +0 -158
  304. package/src/components/sections/ProductRail.tsx +0 -81
  305. package/src/components/sections/ProductSlider.tsx +0 -119
  306. package/src/config.ts +0 -229
  307. package/src/createStorefrontApp.tsx +0 -247
  308. package/src/define.ts +0 -34
  309. package/src/format.ts +0 -7
  310. package/src/hooks/index.ts +0 -6
  311. package/src/hooks/useCategories.ts +0 -26
  312. package/src/hooks/useDiscountValidator.ts +0 -43
  313. package/src/hooks/useMyOrders.ts +0 -41
  314. package/src/hooks/useProduct.ts +0 -36
  315. package/src/hooks/useProducts.ts +0 -39
  316. package/src/hooks/useStorefront.ts +0 -58
  317. package/src/hooks/useStorefrontHead.ts +0 -25
  318. package/src/index.ts +0 -202
  319. package/src/motion.tsx +0 -94
  320. package/src/order-status.ts +0 -33
  321. package/src/pages/CatalogPage.tsx +0 -118
  322. package/src/pages/CheckoutPage.tsx +0 -689
  323. package/src/pages/HomePage.tsx +0 -16
  324. package/src/pages/MyPurchasesPage.tsx +0 -311
  325. package/src/pages/NotFoundPage.tsx +0 -25
  326. package/src/pages/OrderConfirmationPage.tsx +0 -190
  327. package/src/pages/PolicyPage.tsx +0 -47
  328. package/src/pages/ProductDetailPage.tsx +0 -264
  329. package/src/presets.ts +0 -324
  330. package/src/product-options.ts +0 -63
  331. package/src/router.ts +0 -49
  332. package/src/scaffold.tsx +0 -115
  333. package/src/sections.ts +0 -116
  334. package/src/shop.ts +0 -4
  335. package/src/stores/cart.store.ts +0 -185
  336. package/src/stores/catalog.store.ts +0 -39
  337. package/src/stores/delivery.store.ts +0 -152
  338. package/src/stores/session.store.ts +0 -28
  339. package/src/stores/toast.store.ts +0 -43
  340. package/src/testids.ts +0 -136
  341. package/src/theme.ts +0 -194
  342. package/src/ui.ts +0 -5
  343. package/src/workflows/checkout.ts +0 -119
  344. /package/dist/components/{CustomerAccountShell.d.ts → account/CustomerAccountShell.d.ts} +0 -0
  345. /package/dist/components/{SignInModal.d.ts → account/SignInModal.d.ts} +0 -0
  346. /package/dist/components/{CartDrawer.d.ts → cart/CartDrawer.d.ts} +0 -0
  347. /package/dist/components/{QuantityInput.d.ts → cart/QuantityInput.d.ts} +0 -0
  348. /package/dist/components/{DeliveryEstimator.d.ts → checkout/DeliveryEstimator.d.ts} +0 -0
  349. /package/dist/components/{ProductGrid.d.ts → collection/ProductGrid.d.ts} +0 -0
  350. /package/dist/components/{StorefrontErrorBoundary.d.ts → layout/StorefrontErrorBoundary.d.ts} +0 -0
  351. /package/dist/components/{StorefrontFooter.d.ts → layout/StorefrontFooter.d.ts} +0 -0
  352. /package/dist/components/{StorefrontHeader.d.ts → layout/StorefrontHeader.d.ts} +0 -0
  353. /package/dist/components/{Toaster.d.ts → layout/Toaster.d.ts} +0 -0
  354. /package/dist/components/{OrderTrackingTimeline.d.ts → order/OrderTrackingTimeline.d.ts} +0 -0
  355. /package/dist/components/{ProductEnquiryForm.d.ts → product/ProductEnquiryForm.d.ts} +0 -0
  356. /package/dist/components/{ProductSpecs.d.ts → product/ProductSpecs.d.ts} +0 -0
  357. /package/dist/components/{RelatedProducts.d.ts → product/RelatedProducts.d.ts} +0 -0
  358. /package/dist/{order-status.d.ts → data/order-status.d.ts} +0 -0
  359. /package/dist/{component-selectors.d.ts → extend/component-selectors.d.ts} +0 -0
  360. /package/dist/{format.d.ts → lib/format.d.ts} +0 -0
  361. /package/dist/{motion.d.ts → lib/motion.d.ts} +0 -0
  362. /package/dist/{pages → views}/CatalogPage.d.ts +0 -0
  363. /package/dist/{pages → views}/CheckoutPage.d.ts +0 -0
  364. /package/dist/{pages → views}/MyPurchasesPage.d.ts +0 -0
  365. /package/dist/{pages → views}/NotFoundPage.d.ts +0 -0
  366. /package/dist/{pages → views}/OrderConfirmationPage.d.ts +0 -0
  367. /package/dist/{pages → views}/PolicyPage.d.ts +0 -0
  368. /package/dist/{pages → views}/ProductDetailPage.d.ts +0 -0
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/stores/session.store.ts","../src/auth.ts","../src/sections.ts","../src/config.ts","../src/motion.tsx","../src/router.ts","../src/testids.ts","../src/components/SmoothImage.tsx","../src/components/sections/HeroSection.tsx","../src/hooks/useCategories.ts","../src/stores/catalog.store.ts","../src/components/sections/CategoryShowcase.tsx","../src/hooks/useProducts.ts","../src/format.ts","../src/stores/delivery.store.ts","../src/product-options.ts","../src/stores/cart.store.ts","../src/hooks/useStorefront.ts","../src/components/Price.tsx","../src/component-selectors.ts","../src/components/ProductCard.tsx","../src/components/sections/ProductRail.tsx","../src/components/sections/MediaCarousel.tsx","../src/components/sections/ProductSlider.tsx","../src/components/sections/MiscSections.tsx","../src/blocks.tsx","../src/theme.ts","../src/components/StorefrontHeader.tsx","../src/components/StorefrontFooter.tsx","../src/hooks/useDiscountValidator.ts","../src/stores/toast.store.ts","../src/components/QuantityInput.tsx","../src/components/DeliveryEstimator.tsx","../src/components/CartDrawer.tsx","../src/components/ProductGrid.tsx","../src/components/FiltersPanel.tsx","../src/hooks/useStorefrontHead.ts","../src/pages/CatalogPage.tsx","../src/pages/HomePage.tsx","../src/hooks/useProduct.ts","../src/components/ProductOptionSelector.tsx","../src/components/ProductSpecs.tsx","../src/components/RelatedProducts.tsx","../src/components/ProductEnquiryForm.tsx","../src/components/ProductGallery.tsx","../src/pages/ProductDetailPage.tsx","../src/workflows/checkout.ts","../src/components/SignInModal.tsx","../src/pages/CheckoutPage.tsx","../src/components/CustomerAccountShell.tsx","../src/order-status.ts","../src/components/OrderTrackingTimeline.tsx","../src/pages/OrderConfirmationPage.tsx","../src/hooks/useMyOrders.ts","../src/pages/MyPurchasesPage.tsx","../src/pages/NotFoundPage.tsx","../src/pages/PolicyPage.tsx","../src/components/StorefrontErrorBoundary.tsx","../src/components/Toaster.tsx","../src/createStorefrontApp.tsx","../src/define.ts","../src/scaffold.tsx","../src/presets.ts","../src/index.ts"],"names":["adapter","useState","useEffect","React","slug","jsx","useRef","getShopProvider","create","jsxs","persist","Fragment","ChevronLeft","ChevronRight","useMemo","initial","ShoppingBag","toast","X","formatPostalCode","Mail","current","Truck","Lock","Icon","validateDiscount","normalizePostalCode","lookupPostalCode","error","CreditCard","ShieldCheck","User","Package","MapPin","LogOut","PackageCheck","useCallback","Check","coreRenderApp"],"mappings":";;;;;;;;;;;;;;;AAeO,IAAM,kBAAkB,MAAA,EAAqB;AAAA,EAClD,OAAA;AAAA,IACE,CAAC,GAAA,MAAS;AAAA,MACR,UAAA,EAAY,IAAA;AAAA,MACZ,KAAA,EAAO,IAAA;AAAA,MACP,IAAA,EAAM,IAAA;AAAA,MACN,UAAA,EAAY,CAAC,EAAE,UAAA,EAAY,OAAO,IAAA,EAAK,KACrC,GAAA,CAAI,EAAE,UAAA,EAAY,KAAA,EAAO,IAAA,EAAM,IAAA,IAAQ,MAAM,CAAA;AAAA,MAC/C,OAAA,EAAS,MAAM,GAAA,CAAI,EAAE,UAAA,EAAY,MAAM,KAAA,EAAO,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM;AAAA,KAClE,CAAA;AAAA,IACA,EAAE,MAAM,4BAAA;AAA6B;AAEzC;;;ACAA,I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AAY;AAAA,UAClF,EAAE,KAAA,EAAO,sDAAA,EAAkD,MAAA,EAAQ,YAAA,EAAa;AAAA,UAChF,EAAE,KAAA,EAAO,8DAAA,EAAuD,MAAA,EAAQ,UAAA;AAAW;AACrF,OACF;AAAA,MACA,EAAE,IAAA,EAAM,YAAA,EAAc,KAAA,EAAO,uBAAA,EAAyB,UAAU,mEAAA;AAA2D;AAC7H,GACF;AACF;AAEO,IAAM,mBAAA,GAAsB;AAAA,EACjC,IAAA,EAAM,YAAA;AAAA,EACN,MAAA,EAAQ,cAAA;AAAA,EACR,IAAA,EAAM,YAAA;AAAA,EACN,OAAA,EAAS,eAAA;AAAA,EACT,IAAA,EAAM;AACR;AC9HO,IAAM,SAAA,GAAkC,IAAI,IAAA,KAAS;AAC1D,EAAA,0BAAA,EAA2B;AAC3B,EAAA,OAAOiC,WAAA,CAAc,GAAG,IAAI,CAAA;AAC9B","file":"index.js","sourcesContent":["import { create } from 'zustand'\nimport { persist } from 'zustand/middleware'\n\n// Customer session state. Identity is established through the shared\n// @fayz-ai/auth AuthAdapter (see ../auth.ts) — this store only mirrors the\n// linked ShopCustomer for synchronous UI access.\n\nexport interface SessionState {\n customerId: string | null\n email: string | null\n name: string | null\n setSession(session: { customerId: string; email: string; name?: string | null }): void\n signOut(): void\n}\n\nexport const useSessionStore = create<SessionState>()(\n persist(\n (set) => ({\n customerId: null,\n email: null,\n name: null,\n setSession: ({ customerId, email, name }) =>\n set({ customerId, email, name: name ?? null }),\n signOut: () => set({ customerId: null, email: null, name: null }),\n }),\n { name: 'fayz.storefront.session.v1' },\n ),\n)\n","import type { AuthAdapter, AuthUser } from '@fayz-ai/core'\nimport {\n createAuthRuntime,\n createMockAuthAdapter,\n type AuthPluginOptions,\n} from '@fayz-ai/plugin-auth'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport { setShopAccessTokenResolver } from '@fayz-ai/sdk/shop'\nimport { useSessionStore } from './stores/session.store'\n\n// ---------------------------------------------------------------------------\n// Customer auth — the SAME AuthAdapter contract createSaasApp uses, so the\n// mock and Supabase adapters from @fayz-ai/auth serve both the saas admin and\n// the storefront customer. The storefront adds one layer on top: linking the\n// auth identity to a ShopCustomer record (find-or-create by email) so orders\n// and purchase history attach to a customer.\n// ---------------------------------------------------------------------------\n\nexport type StorefrontAuthAdapter = AuthAdapter | 'mock' | 'supabase' | (string & {})\n\nexport interface StorefrontAuthConfig {\n adapter?: AuthPluginOptions['adapter']\n provider?: AuthPluginOptions['provider']\n routes?: AuthPluginOptions['routes']\n supabase?: AuthPluginOptions['supabase']\n}\n\nlet _adapter: AuthAdapter | null = null\n\nfunction isAuthAdapter(value: unknown): value is AuthAdapter {\n return Boolean(\n value &&\n typeof value === 'object' &&\n 'getSession' in value &&\n 'signIn' in value &&\n 'signOut' in value,\n )\n}\n\nfunction normalizeAuthConfig(\n configured: StorefrontAuthAdapter | StorefrontAuthConfig | undefined,\n): StorefrontAuthConfig {\n if (!configured) return {}\n if (typeof configured === 'string' || isAuthAdapter(configured)) return { adapter: configured }\n return configured\n}\n\nexport function resolveAuthAdapter(\n configured: StorefrontAuthAdapter | StorefrontAuthConfig | undefined,\n fallback?: { supabaseUrl?: string; supabaseAnonKey?: string },\n): AuthAdapter {\n const config = normalizeAuthConfig(configured)\n return createAuthRuntime({\n provider: config.provider ?? config.adapter ?? (fallback?.supabaseUrl ? 'supabase' : 'mock'),\n adapter: config.adapter,\n routes: config.routes,\n requireAuth: false,\n supabase: {\n url: config.supabase?.url ?? fallback?.supabaseUrl,\n anonKey: config.supabase?.anonKey ?? fallback?.supabaseAnonKey,\n client: config.supabase?.client,\n callbackUrl: config.supabase?.callbackUrl,\n resetPasswordUrl: config.supabase?.resetPasswordUrl,\n },\n }).adapter\n}\n\n// The shopper's current access token, handed to the shop REST client so its\n// requests reach PostgREST as the signed-in user instead of as `anon`. Held\n// here rather than in the session store because it is a credential: it must not\n// be persisted to localStorage alongside the customer id. The Supabase client\n// owns its own refresh; this is only a mirror of the live value.\nlet _accessToken: string | null = null\n\n/** Whether an authenticated identity was ever seen this session. Distinguishes\n * \"signed out\" from \"was never signed in\" — see the onAuthStateChange guard. */\nlet _hadAuthUser = false\n\n/** Refresh the mirrored token from the adapter. Safe to call on any event. */\nasync function syncAccessToken(adapter: AuthAdapter): Promise<void> {\n try {\n const existing = await adapter.getSession()\n _accessToken = existing?.session.accessToken ?? null\n } catch {\n _accessToken = null\n }\n}\n\n/** Called once by createStorefrontApp. Restores any persisted session. */\nexport function initCustomerAuth(adapter: AuthAdapter): void {\n _adapter = adapter\n\n // Registered before the first await so no request can slip out anonymously\n // while the session is still being restored.\n setShopAccessTokenResolver(() => _accessToken)\n\n adapter\n .getSession()\n .then((existing) => {\n _accessToken = existing?.session.accessToken ?? null\n if (!existing) return\n _hadAuthUser = true\n const store = useSessionStore.getState()\n // Re-link only when the persisted shop session doesn't match the auth user\n if (store.email !== existing.user.email) {\n void linkCustomer(existing.user)\n }\n })\n .catch(() => {})\n\n adapter.onAuthStateChange((user) => {\n if (!user) {\n _accessToken = null\n // Only tear down the shop session if there WAS an authenticated identity\n // to lose. The Supabase adapter fires this once on boot with a null user\n // (INITIAL_SESSION), and clearing unconditionally wiped the guest's local\n // session on every page load — a guest who checked out could no longer\n // find their order after a reload. The mock adapter never surfaced this\n // because it always restored a session.\n if (_hadAuthUser) {\n _hadAuthUser = false\n useSessionStore.getState().signOut()\n }\n return\n }\n _hadAuthUser = true\n // Covers token refresh too, not just sign-in: the callback carries the user\n // but not the token, and a stale token would 401 every read an hour in.\n void syncAccessToken(adapter)\n })\n}\n\nexport function getCustomerAuthAdapter(): AuthAdapter {\n if (!_adapter) _adapter = createMockAuthAdapter()\n return _adapter\n}\n\n/** Resolve (find-or-create + server-side auth link) the ShopCustomer for an email. */\nasync function resolveShopCustomer(email: string, name: string) {\n const provider = getShopProvider()\n // Preferred: provider.resolveCustomer find-or-creates AND links auth.uid\n // server-side (RLS-safe). Falls back to generic CRUD for legacy providers.\n if (provider.resolveCustomer) return provider.resolveCustomer({ email, name })\n const matches = await provider.listCustomers({ search: email, limit: 10 })\n const existing = matches.find((c) => (c.email ?? '').toLowerCase() === email)\n if (existing) return existing\n const parts = name.trim().split(/\\s+/).filter(Boolean)\n return provider.createCustomer({\n firstName: parts[0] ?? email.split('@')[0] ?? 'Cliente',\n lastName: parts.slice(1).join(' '),\n email,\n })\n}\n\n/** Find-or-create the ShopCustomer for an auth identity and persist the session. */\nasync function linkCustomer(user: AuthUser, fullName?: string): Promise<{ customerId: string }> {\n const email = (user.email ?? '').trim().toLowerCase()\n const name = fullName ?? user.fullName ?? ''\n const customer = await resolveShopCustomer(email, name)\n useSessionStore.getState().setSession({\n customerId: customer.id,\n email,\n name: name || `${customer.firstName} ${customer.lastName}`.trim(),\n })\n return { customerId: customer.id }\n}\n\nexport interface EstablishSessionOptions {\n /** Provided → adapter.signIn; omitted → passwordless customer identity via signUp (mock-friendly). */\n password?: string\n name?: string\n}\n\n/**\n * Sign a customer in through the auth adapter and link the ShopCustomer.\n * Used by the account page sign-in AND by checkout (so a buyer is signed in\n * for \"my purchases\" immediately after purchase) — one auth path, two doors.\n */\nexport async function establishCustomerSession(\n email: string,\n opts?: EstablishSessionOptions,\n): Promise<{ customerId: string }> {\n const normalized = email.trim().toLowerCase()\n if (opts?.password) {\n const adapter = getCustomerAuthAdapter()\n const session = await adapter.signIn(normalized, opts.password)\n // Before linkCustomer, not after: linkCustomer calls shop_resolve_customer,\n // which reads auth.uid() to fill auth_user_id. Sent with the old token that\n // link silently no-ops and the account stays unlinked forever.\n _accessToken = session.accessToken ?? null\n _hadAuthUser = true\n return linkCustomer(session.user.email ? session.user : { ...session.user, email: normalized }, opts.name)\n }\n // Guest / passwordless checkout: do NOT create an auth account (that made\n // returning guests fail with \"user already registered\" on Supabase). Just\n // resolve the ShopCustomer and persist the local session for order history.\n return linkCustomer({ id: '', email: normalized } as AuthUser, opts?.name)\n}\n\n/** Convenience wrapper — passwordless email sign-in (guest checkout path). */\nexport function signInByEmail(email: string, name?: string): Promise<{ customerId: string }> {\n return establishCustomerSession(email, { name })\n}\n\n/** Explicit account creation (account page \"Criar conta\" form). */\nexport async function signUpCustomer(\n email: string,\n password: string,\n name: string,\n): Promise<{ customerId: string }> {\n const adapter = getCustomerAuthAdapter()\n const normalized = email.trim().toLowerCase()\n const session = await adapter.signUp(normalized, password, name)\n _accessToken = session.accessToken ?? null\n _hadAuthUser = true\n return linkCustomer(session.user.email ? session.user : { ...session.user, email: normalized }, name)\n}\n\nexport async function signOutCustomer(): Promise<void> {\n try {\n await getCustomerAuthAdapter().signOut()\n } finally {\n _accessToken = null\n _hadAuthUser = false\n useSessionStore.getState().signOut()\n }\n}\n","import type { HeroVariant } from './theme'\nimport type React from 'react'\n\n// ---------------------------------------------------------------------------\n// Home-page section blueprint — the storefront's PageConfig equivalent.\n// A template (or the Fayz agent) declares the home as an ordered list of\n// typed sections; HomePage renders them. Every recurring block found in the\n// Nuvemshop research maps to one section type.\n// ---------------------------------------------------------------------------\n\nexport interface HeroSlide {\n title: string\n subtitle?: string\n cta?: string\n href?: string\n /** Image URL; omit for a gradient placeholder derived from `hue` */\n image?: string\n hue?: number\n /** Editorial boxed copy block (Uyuni) instead of free overlay */\n boxed?: boolean\n}\n\nexport interface MediaCarouselItem {\n title: string\n subtitle?: string\n eyebrow?: string\n cta?: string\n href?: string\n image: string\n imageAlt?: string\n align?: 'start' | 'center' | 'end'\n}\n\nexport type StorefrontSection =\n | { type: 'hero'; variant: HeroVariant; slides: HeroSlide[]; height?: 'tall' | 'medium' }\n | {\n type: 'mediaCarousel'\n items: MediaCarouselItem[]\n height?: 'medium' | 'tall' | 'screen'\n autoplayMs?: number\n overlay?: 'dark' | 'soft' | 'none'\n className?: string\n }\n | { type: 'categories'; style: 'bubbles' | 'tiles'; title?: string }\n | {\n type: 'products'\n title: string\n subtitle?: string\n /** Small-caps label above the title (e.g. 'curadoria') */\n eyebrow?: string\n /** 'sale' = compareAtPrice set; 'new' = newest first; 'all' = catalog order */\n filter?: 'sale' | 'new' | 'all'\n limit?: number\n }\n | {\n type: 'productSlider'\n title: string\n subtitle?: string\n eyebrow?: string\n filter?: 'sale' | 'new' | 'all'\n categoryName?: string\n collection?: string\n limit?: number\n cta?: string\n href?: string\n className?: string\n }\n | { type: 'benefits'; items: Array<{ icon: string; title: string; text?: string }> }\n | { type: 'banner'; title: string; subtitle?: string; eyebrow?: string; cta?: string; href?: string; image?: string; hue?: number }\n | { type: 'manifesto'; title?: string; text: string }\n | { type: 'testimonials'; title?: string; items: Array<{ quote: string; author: string }> }\n | { type: 'newsletter'; title?: string; subtitle?: string }\n\n/** @deprecated Use StorefrontSection. Kept for existing generated stores. */\nexport type HomeSection = StorefrontSection\n\nexport interface HomeConfig {\n sections: readonly StorefrontSection[]\n}\n\nexport interface NavLink {\n label: string\n to: string\n}\n\nexport interface FooterConfig {\n about?: string\n contact?: { phone?: string; email?: string; address?: string }\n social?: Array<{ label: string; href: string }>\n credit?: React.ReactNode\n labels?: {\n categories?: string\n navigation?: string\n contact?: string\n viewAll?: string\n purchases?: string\n privacy?: string\n terms?: string\n returns?: string\n }\n}\n\n/** Wide gradient SVG data-URI — deterministic hero/banner art, no network. */\nexport function bannerPlaceholder(label: string, hueA: number, hueB: number, w = 1600, h = 700): string {\n const svg =\n `<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"${w}\" height=\"${h}\">` +\n `<defs><linearGradient id=\"g\" x1=\"0\" y1=\"0\" x2=\"1\" y2=\"1\">` +\n `<stop offset=\"0\" stop-color=\"hsl(${hueA},40%,78%)\"/>` +\n `<stop offset=\"1\" stop-color=\"hsl(${hueB},45%,55%)\"/>` +\n `</linearGradient></defs>` +\n `<rect width=\"${w}\" height=\"${h}\" fill=\"url(#g)\"/>` +\n `<circle cx=\"${w * 0.8}\" cy=\"${h * 0.3}\" r=\"${h * 0.45}\" fill=\"hsla(${hueB},50%,90%,0.25)\"/>` +\n `<circle cx=\"${w * 0.15}\" cy=\"${h * 0.85}\" r=\"${h * 0.35}\" fill=\"hsla(${hueA},45%,30%,0.12)\"/>` +\n `</svg>`\n return `data:image/svg+xml;utf8,${encodeURIComponent(svg)}`\n}\n","import React, { createContext, useContext } from 'react'\nimport type { ShopProvider } from '@fayz-ai/shop/provider'\nimport type { MockShopSeed } from '@fayz-ai/shop/mock'\nimport type { PaymentMethodKind } from '@fayz-ai/shop/types'\nimport type { StorefrontTheme } from './theme'\nimport type { HomeConfig, NavLink, FooterConfig } from './sections'\nimport type { StorefrontAuthConfig } from './auth'\nimport type { StorefrontComponents } from './component-contracts'\n\nexport type StorefrontRouteKind =\n | 'home'\n | 'catalog'\n | 'product'\n | 'checkout'\n | 'account'\n | 'order'\n | 'custom'\n\nexport type StorefrontRouteParams = Record<string, string>\n\nexport interface StorefrontRouteComponentProps {\n path: string\n params: StorefrontRouteParams\n config: ResolvedStorefrontConfig\n}\n\nexport type StorefrontRouteChrome = 'default' | 'focused'\nexport type StorefrontCommerceMode = 'checkout' | 'catalog' | 'enquiry'\nexport type StorefrontImageLoadingMode = 'fade' | 'none'\n\nexport interface StorefrontImageLoadingConfig {\n mode?: StorefrontImageLoadingMode\n durationMs?: number\n easing?: string\n blur?: boolean\n}\n\nexport interface StorefrontRouteDefinition {\n /**\n * Stable identifier for generated-code diffs, QA reports, and route ownership.\n */\n id: string\n /**\n * Hash route pattern. Supports the same params as matchPath, e.g. '/checkout'\n * or '/collections/:slug'. Custom routes are matched before SDK defaults.\n */\n path: string\n /**\n * Intent label for agents and manifests. It does not change matching behavior.\n */\n kind?: StorefrontRouteKind\n /**\n * Shell chrome for the route. `focused` hides storefront nav/footer/cart\n * around high-intent flows such as checkout.\n */\n chrome?: StorefrontRouteChrome\n /**\n * App-owned screen/workflow that can still use storefront/shop primitives.\n */\n component: React.ComponentType<StorefrontRouteComponentProps>\n}\n\nexport interface StorefrontDiscountConfig {\n code: string\n percent: number\n title?: string\n}\n\nexport interface StorefrontEnquiryConfig {\n label?: string\n successMessage?: string\n subjectPrefix?: string\n email?: string\n whatsappUrl?: string\n requirePhone?: boolean\n}\n\nexport interface StorefrontConfig {\n /** Store display name (header, page title) */\n name: string\n /** Optional logo node; defaults to the store name */\n logo?: React.ReactNode\n /** ISO 4217 — default 'BRL' */\n currency?: string\n /** Intl locale for money/date formatting — default 'pt-BR' */\n locale?: string\n /** Visual identity: colors, fonts, radius, header/card personality */\n theme?: StorefrontTheme\n /** Checkout-first default, catalog-only browsing, or product enquiry flow. */\n commerceMode?: StorefrontCommerceMode\n /** Promo message above the header (e.g. 'FRETE GRÁTIS ACIMA DE R$ 300') */\n announcement?: string\n /** Home page blueprint. When set, `/` renders it and the catalog moves to /catalog. */\n home?: HomeConfig\n /** Header nav links — defaults derived from home/catalog routing */\n nav?: NavLink[]\n /** Footer content (about text, contact, social) */\n footer?: FooterConfig\n /** Preferred backend descriptor for manifest/scaffold metadata. */\n backend?: { provider?: 'mock' | 'fayz-api' | 'fayz-shop' | 'custom'; url?: string }\n /** @deprecated Use backend/provider adapters. Storefront no longer creates Supabase clients. */\n supabaseUrl?: string\n /** @deprecated Use backend/provider adapters. Storefront no longer creates Supabase clients. */\n supabaseAnonKey?: string\n /** Explicit provider override (tests, custom backends) */\n provider?: ShopProvider\n /** Per-store mock catalog (products/categories/discounts) for mock mode */\n catalog?: MockShopSeed\n /** Store-level discount codes available regardless of provider backend. */\n discounts?: StorefrontDiscountConfig[]\n /**\n * Institutional/legal page content (privacy, terms, returns). Plain text —\n * blank lines separate paragraphs. Unset pages render a placeholder so the\n * routes (and footer links) exist even before the store writes its policy.\n */\n legal?: { privacy?: string; terms?: string; returns?: string }\n /** Customer auth — same AuthAdapter contract as createSaasApp. Default: mock. */\n auth?: StorefrontAuthConfig\n /** Shipping pricing — default { flatRate: 0 } */\n shipping?: { flatRate?: number; freeAbove?: number }\n /**\n * Payment behavior. v1 default 'mock' instantly marks orders paid with NO\n * real charge (demo). M4 sets 'pix-mercadopago' so orders stay pending until\n * a real payment webhook confirms settlement.\n */\n payments?: {\n mode?: 'mock' | 'pix-mercadopago'\n /**\n * Which methods the checkout offers. Declaring them is what lets the order\n * record how the buyer intends to pay instead of assuming 'credit_card',\n * which is what it did while the card form was a simulation.\n */\n methods?: readonly PaymentMethodKind[]\n }\n /** Product enquiry behavior for catalog/enquiry stores. */\n enquiry?: StorefrontEnquiryConfig\n /** Feature toggles — defaults depend on commerceMode. */\n features?: { discounts?: boolean; accounts?: boolean; cart?: boolean; checkout?: boolean }\n /** Global storefront image reveal behavior. Default is a soft fade. */\n imageLoading?: StorefrontImageLoadingConfig\n /** Code-level component replacements. Kept out of serialized manifests. */\n components?: StorefrontComponents\n /** Code-level route overrides/custom routes. Kept out of serialized manifests. */\n routes?: readonly StorefrontRouteDefinition[]\n}\n\nexport interface ResolvedStorefrontConfig extends StorefrontConfig {\n currency: string\n locale: string\n shipping: { flatRate: number; freeAbove?: number }\n payments: { mode: 'mock' | 'pix-mercadopago'; methods: readonly PaymentMethodKind[] }\n commerceMode: StorefrontCommerceMode\n enquiry: Required<Pick<StorefrontEnquiryConfig, 'label' | 'successMessage' | 'subjectPrefix'>> &\n Omit<StorefrontEnquiryConfig, 'label' | 'successMessage' | 'subjectPrefix'>\n features: { discounts: boolean; accounts: boolean; cart: boolean; checkout: boolean }\n imageLoading: Required<StorefrontImageLoadingConfig>\n /** Where the full product list lives ('/' without a home page, '/catalog' with one) */\n catalogPath: string\n nav: NavLink[]\n}\n\nexport function resolveConfig(config: StorefrontConfig): ResolvedStorefrontConfig {\n const catalogPath = config.home ? '/catalog' : '/'\n const commerceMode = config.commerceMode ?? 'checkout'\n const checkoutEnabled = commerceMode === 'checkout'\n return {\n ...config,\n currency: config.currency ?? 'BRL',\n locale: config.locale ?? 'pt-BR',\n shipping: { flatRate: config.shipping?.flatRate ?? 0, freeAbove: config.shipping?.freeAbove },\n payments: {\n mode: config.payments?.mode ?? 'mock',\n methods: config.payments?.methods?.length ? config.payments.methods : ['pix', 'credit_card', 'cash'],\n },\n commerceMode,\n enquiry: {\n label: config.enquiry?.label ?? 'Contact me',\n successMessage: config.enquiry?.successMessage ?? 'Thanks. We received your enquiry.',\n subjectPrefix: config.enquiry?.subjectPrefix ?? 'Product enquiry',\n email: config.enquiry?.email,\n whatsappUrl: config.enquiry?.whatsappUrl,\n requirePhone: config.enquiry?.requirePhone,\n },\n features: {\n // Auto-enable the coupon UI when the store actually ships discount codes\n // (via config.discounts or a seeded catalog), unless explicitly overridden —\n // otherwise a store can advertise a coupon with no field to enter it.\n discounts:\n config.features?.discounts ??\n Boolean(config.discounts?.length || config.catalog?.discounts?.length),\n accounts: config.features?.accounts ?? checkoutEnabled,\n cart: config.features?.cart ?? checkoutEnabled,\n checkout: config.features?.checkout ?? checkoutEnabled,\n },\n imageLoading: {\n mode: config.imageLoading?.mode ?? 'fade',\n durationMs: config.imageLoading?.durationMs ?? 420,\n easing: config.imageLoading?.easing ?? 'cubic-bezier(0.22, 1, 0.36, 1)',\n blur: config.imageLoading?.blur ?? true,\n },\n catalogPath,\n nav:\n config.nav ??\n (config.home\n ? [\n { label: 'Início', to: '/' },\n { label: 'Loja', to: '/catalog' },\n ]\n : [{ label: 'Loja', to: '/' }]),\n }\n}\n\nconst StorefrontConfigContext = createContext<ResolvedStorefrontConfig | null>(null)\n\nexport const StorefrontConfigProvider = StorefrontConfigContext.Provider\n\nexport function useStorefrontConfig(): ResolvedStorefrontConfig {\n const ctx = useContext(StorefrontConfigContext)\n if (!ctx) throw new Error('useStorefrontConfig must be used inside createStorefrontApp')\n return ctx\n}\n\nexport function useStorefrontConfigOptional(): ResolvedStorefrontConfig | null {\n return useContext(StorefrontConfigContext)\n}\n\nexport function getStorefrontComponents(config: ResolvedStorefrontConfig): StorefrontComponents {\n return config.components ?? {}\n}\n","import React, { useEffect, useRef, useState } from 'react'\n\n// ---------------------------------------------------------------------------\n// Core motion primitives — every storefront inherits these; stores never\n// implement animation ad hoc. All effects respect prefers-reduced-motion.\n// ---------------------------------------------------------------------------\n\nexport function prefersReducedMotion(): boolean {\n if (typeof window === 'undefined' || !window.matchMedia) return false\n return window.matchMedia('(prefers-reduced-motion: reduce)').matches\n}\n\n/** True once the element has entered the viewport (one-shot). */\nexport function useInView<T extends HTMLElement>(margin = '0px 0px -8% 0px'): [React.RefObject<T>, boolean] {\n const ref = useRef<T>(null)\n const [inView, setInView] = useState(() => prefersReducedMotion())\n\n useEffect(() => {\n if (inView) return\n const el = ref.current\n if (!el || typeof IntersectionObserver === 'undefined') {\n setInView(true)\n return\n }\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((e) => e.isIntersecting)) {\n setInView(true)\n observer.disconnect()\n }\n },\n { rootMargin: margin },\n )\n observer.observe(el)\n return () => observer.disconnect()\n }, [inView, margin])\n\n return [ref, inView]\n}\n\nexport interface RevealProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Stagger delay in ms */\n delay?: number\n children: React.ReactNode\n}\n\n/** Plays a fade-up entrance when the element scrolls into view.\n * Content is VISIBLE by default — never pre-hidden — so screenshots,\n * crawlers and environments without IntersectionObserver always see it;\n * the animation's own from-state handles the fade. */\nexport function Reveal({ delay = 0, children, className, style, ...rest }: RevealProps) {\n const [ref, inView] = useInView<HTMLDivElement>()\n return (\n <div\n ref={ref}\n className={`${inView ? 'animate-fade-up' : ''} ${className ?? ''}`}\n style={{ ...style, animationDelay: delay ? `${delay}ms` : undefined }}\n {...rest}\n >\n {children}\n </div>\n )\n}\n\n/** True after the window has scrolled past the threshold (header treatments). */\nexport function useScrolled(threshold = 8): boolean {\n const [scrolled, setScrolled] = useState(false)\n useEffect(() => {\n const onScroll = () => setScrolled(window.scrollY > threshold)\n onScroll()\n window.addEventListener('scroll', onScroll, { passive: true })\n return () => window.removeEventListener('scroll', onScroll)\n }, [threshold])\n return scrolled\n}\n\n/** Re-triggers a CSS animation class whenever `value` changes (cart badge pop). */\nexport function usePopOnChange(value: number): boolean {\n const [pop, setPop] = useState(false)\n const prev = useRef(value)\n useEffect(() => {\n if (prev.current !== value && value > 0) {\n setPop(true)\n const t = setTimeout(() => setPop(false), 400)\n return () => clearTimeout(t)\n }\n prev.current = value\n return undefined\n }, [value])\n useEffect(() => {\n prev.current = value\n })\n return pop\n}\n","import React, { useEffect, useState } from 'react'\nimport { hashRouterAdapter } from '@fayz-ai/core'\n\n// Minimal hash router for the storefront. Deliberately not react-router:\n// an SDK package shipping a router dependency creates singleton hazards\n// under source-alias dev setups, and six routes don't justify one.\n\nconst adapter = hashRouterAdapter()\n\nexport function navigateTo(to: string): void {\n adapter.navigate(to)\n}\n\nexport function useHashPath(): string {\n const [path, setPath] = useState(() => adapter.getCurrentPath() || '/')\n useEffect(() => {\n const unsub = adapter.onPathChange((p) => {\n setPath(p || '/')\n window.scrollTo(0, 0)\n })\n return unsub\n }, [])\n return path\n}\n\n/** Match '/product/:slug' against '/product/leather-backpack' → { slug: 'leather-backpack' } */\nexport function matchPath(pattern: string, path: string): Record<string, string> | null {\n const cleanPath = (path.split('?')[0] ?? '').replace(/\\/+$/, '') || '/'\n const patternParts = pattern.split('/').filter(Boolean)\n const pathParts = cleanPath.split('/').filter(Boolean)\n if (patternParts.length !== pathParts.length) return null\n const params: Record<string, string> = {}\n for (let i = 0; i < patternParts.length; i++) {\n const pat = patternParts[i]!\n const part = pathParts[i]!\n if (pat.startsWith(':')) params[pat.slice(1)] = decodeURIComponent(part)\n else if (pat !== part) return null\n }\n return params\n}\n\nexport interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {\n to: string\n}\n\n/** Real anchor (#/path) — middle-click/cmd-click friendly, Playwright friendly. */\nexport function Link({ to, children, ...rest }: LinkProps) {\n return React.createElement('a', { href: `#${to}`, ...rest }, children)\n}\n","// Single source of truth for e2e selectors. Components import from here;\n// Playwright specs assert against the same constants — they cannot drift.\nexport const TID = {\n // header\n headerSearch: 'header-search',\n headerSearchToggle: 'header-search-toggle',\n cartButton: 'cart-button',\n cartCount: 'cart-count',\n accountLink: 'account-link',\n accountDropdown: 'account-dropdown',\n announcementBar: 'announcement-bar',\n navLink: (label: string) => `nav-${label.toLowerCase().replace(/\\s+/g, '-')}`,\n navCategory: (slug: string) => `nav-cat-${slug}`,\n accountName: 'account-name',\n // home sections\n hero: 'home-hero',\n heroPrev: 'hero-prev',\n heroNext: 'hero-next',\n mediaCarousel: 'media-carousel',\n mediaCarouselPrev: 'media-carousel-prev',\n mediaCarouselNext: 'media-carousel-next',\n productSlider: 'product-slider',\n productSliderViewport: 'product-slider-viewport',\n productSliderPrev: 'product-slider-prev',\n productSliderNext: 'product-slider-next',\n categoryShowcase: 'category-showcase',\n productRail: 'product-rail',\n benefits: 'benefits-row',\n promoBanner: 'promo-banner',\n manifesto: 'manifesto',\n testimonials: 'testimonials',\n newsletter: 'newsletter',\n newsletterEmail: 'newsletter-email',\n newsletterSubmit: 'newsletter-submit',\n newsletterDone: 'newsletter-done',\n // catalog\n productGrid: 'product-grid',\n productCard: 'product-card',\n productCardName: 'product-card-name',\n productCardPrice: 'product-card-price',\n productCardAdd: 'product-card-add',\n badgeSale: 'badge-sale',\n badgeSoldout: 'badge-soldout',\n // filters\n filterCategory: (slug: string) => `filter-category-${slug}`,\n filterPriceMin: 'filter-price-min',\n filterPriceMax: 'filter-price-max',\n filterInstock: 'filter-instock',\n sortSelect: 'sort-select',\n filtersClear: 'filters-clear',\n // product detail\n pdpName: 'pdp-name',\n pdpPrice: 'pdp-price',\n pdpComparePrice: 'pdp-compare-price',\n pdpDescription: 'pdp-description',\n productOptionGroup: (id: string) => `product-option-${id.toLowerCase().replace(/\\s+/g, '-')}`,\n productOptionValue: (id: string, value: string) => `product-option-${id.toLowerCase().replace(/\\s+/g, '-')}-${value.toLowerCase().replace(/\\s+/g, '-')}`,\n pdpQtyInput: 'pdp-qty-input',\n pdpAddToCart: 'pdp-add-to-cart',\n pdpRoot: 'pdp-root',\n pdpGallery: 'pdp-gallery',\n pdpGalleryImage: 'pdp-gallery-image',\n pdpGalleryThumbs: 'pdp-gallery-thumbs',\n pdpGalleryThumb: 'pdp-gallery-thumb',\n pdpActions: 'pdp-actions',\n pdpEnquiryButton: 'pdp-enquiry-button',\n enquiryForm: 'enquiry-form',\n enquiryName: 'enquiry-name',\n enquiryEmail: 'enquiry-email',\n enquiryPhone: 'enquiry-phone',\n enquirySubject: 'enquiry-subject',\n enquiryMessage: 'enquiry-message',\n enquirySubmit: 'enquiry-submit',\n enquirySuccess: 'enquiry-success',\n enquiryError: 'enquiry-error',\n // cart\n cartDrawer: 'cart-drawer',\n cartLine: 'cart-line',\n lineQty: 'line-qty',\n lineInc: 'line-inc',\n lineDec: 'line-dec',\n lineRemove: 'line-remove',\n cartSubtotal: 'cart-subtotal',\n discountInput: 'discount-input',\n discountApply: 'discount-apply',\n discountRow: 'discount-row',\n discountError: 'discount-error',\n cartShipping: 'cart-shipping',\n shippingProgress: 'shipping-progress',\n cartTotal: 'cart-total',\n goCheckout: 'go-checkout',\n cartEmpty: 'cart-empty',\n // delivery estimate (product page + cart)\n deliveryEstimator: 'delivery-estimator',\n deliveryCepInput: 'delivery-cep-input',\n deliveryCepSubmit: 'delivery-cep-submit',\n deliveryOption: 'delivery-option',\n deliveryUnserved: 'delivery-unserved',\n deliveryError: 'delivery-error',\n deliveryAddress: 'delivery-address',\n deliveryClear: 'delivery-clear',\n // checkout\n checkoutEmail: 'checkout-email',\n checkoutName: 'checkout-name',\n checkoutStreet: 'checkout-street',\n checkoutCity: 'checkout-city',\n checkoutZip: 'checkout-zip',\n checkoutCard: 'checkout-card',\n checkoutExpiry: 'checkout-expiry',\n checkoutCvc: 'checkout-cvc',\n placeOrder: 'place-order',\n checkoutError: 'checkout-error',\n checkoutProcessing: 'checkout-processing',\n // confirmation\n orderNumber: 'order-number',\n orderStatus: 'order-status',\n orderTracking: 'order-tracking',\n orderTrackingStep: (step: string) => `order-tracking-step-${step}`,\n orderTotal: 'order-total',\n viewPurchases: 'view-purchases',\n // account\n customerAccountShell: 'customer-account-shell',\n customerAccountMenu: 'customer-account-menu',\n orderDetail: 'order-detail',\n authTabSignin: 'auth-tab-signin',\n authTabSignup: 'auth-tab-signup',\n signinEmail: 'signin-email',\n signinPassword: 'signin-password',\n signinName: 'signin-name',\n signinSubmit: 'signin-submit',\n authError: 'auth-error',\n purchasesList: 'purchases-list',\n purchaseItem: 'purchase-item',\n purchasesEmpty: 'purchases-empty',\n signout: 'signout',\n} as const\n","import React from 'react'\nimport { useStorefrontConfigOptional, type StorefrontImageLoadingConfig } from '../config'\n\nexport interface SmoothImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {\n imageLoading?: StorefrontImageLoadingConfig\n}\n\nexport function SmoothImage({\n imageLoading,\n loading = 'lazy',\n decoding = 'async',\n onLoad,\n style,\n ...props\n}: SmoothImageProps) {\n const config = useStorefrontConfigOptional()\n const resolved = {\n ...config?.imageLoading,\n ...imageLoading,\n }\n const mode = resolved.mode ?? 'fade'\n const durationMs = resolved.durationMs ?? 420\n const easing = resolved.easing ?? 'cubic-bezier(0.22, 1, 0.36, 1)'\n const blur = resolved.blur ?? true\n const ref = React.useRef<HTMLImageElement | null>(null)\n const [loaded, setLoaded] = React.useState(mode === 'none')\n\n React.useEffect(() => {\n if (mode === 'none') {\n setLoaded(true)\n return\n }\n if (ref.current?.complete && ref.current.naturalWidth > 0) setLoaded(true)\n }, [mode, props.src])\n\n const revealStyle: React.CSSProperties =\n mode === 'none'\n ? {}\n : {\n opacity: loaded ? 1 : 0,\n filter: blur && !loaded ? 'blur(10px)' : 'blur(0px)',\n transition: `opacity ${durationMs}ms ${easing}, filter ${durationMs}ms ${easing}, transform ${durationMs}ms ${easing}`,\n }\n\n return (\n <img\n {...props}\n ref={ref}\n loading={loading}\n decoding={decoding}\n data-sf-image-loaded={loaded ? 'true' : 'false'}\n style={{ ...style, ...revealStyle }}\n onLoad={(event) => {\n setLoaded(true)\n onLoad?.(event)\n }}\n />\n )\n}\n","import React, { useEffect, useRef, useState } from 'react'\nimport { ChevronLeft, ChevronRight } from 'lucide-react'\nimport type { HeroSlide } from '../../sections'\nimport type { HeroVariant } from '../../theme'\nimport { bannerPlaceholder } from '../../sections'\nimport { useStorefrontConfig } from '../../config'\nimport { prefersReducedMotion } from '../../motion'\nimport { Link } from '../../router'\nimport { TID } from '../../testids'\nimport { SmoothImage } from '../SmoothImage'\n\nfunction slideImage(slide: HeroSlide, w = 1600, h = 700): string {\n return slide.image ?? bannerPlaceholder(slide.title, slide.hue ?? 200, (slide.hue ?? 200) + 40, w, h)\n}\n\nfunction SlideCopy({ slide, active }: { slide: HeroSlide; active: boolean }) {\n const stagger = (i: number) =>\n active ? { className: 'animate-fade-up', style: { animationDelay: `${i * 120}ms` } } : { className: 'opacity-0' }\n\n const inner = (\n <>\n <h2 className={`sf-heading text-3xl font-bold leading-tight tracking-tight sm:text-5xl ${stagger(0).className}`} style={stagger(0).style}>\n {slide.title}\n </h2>\n {slide.subtitle && (\n <p className={`mt-3 max-w-md text-base sm:text-lg ${stagger(1).className}`} style={stagger(1).style}>\n {slide.subtitle}\n </p>\n )}\n {slide.cta && (\n <div className={stagger(2).className} style={stagger(2).style}>\n <Link\n to={slide.href ?? '/catalog'}\n className=\"sf-cta mt-6 inline-block bg-primary px-8 py-3.5 font-semibold text-primary-foreground shadow-lg transition-all hover:-translate-y-0.5 hover:shadow-xl\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n {slide.cta}\n </Link>\n </div>\n )}\n </>\n )\n if (slide.boxed) {\n return (\n <div className=\"border border-foreground/30 bg-background/90 p-8 backdrop-blur-sm sm:p-10\">{inner}</div>\n )\n }\n return <div className=\"text-white\">{inner}</div>\n}\n\nexport function HeroSection({\n variant,\n slides,\n height = 'tall',\n}: {\n variant: HeroVariant\n slides: HeroSlide[]\n height?: 'tall' | 'medium'\n}) {\n const [index, setIndex] = useState(0)\n const [loadedSlides, setLoadedSlides] = useState<Record<number, boolean>>({})\n const config = useStorefrontConfig()\n const interacted = useRef(false)\n const hClass = height === 'tall' ? 'h-[72vh] min-h-[440px]' : 'h-[48vh] min-h-[340px]'\n const revealImages = config.imageLoading.mode !== 'none'\n const revealStyle = (loaded: boolean): React.CSSProperties | undefined =>\n revealImages\n ? {\n filter: config.imageLoading.blur && !loaded ? 'blur(10px)' : 'blur(0px)',\n transition: `opacity 700ms ease, filter ${config.imageLoading.durationMs}ms ${config.imageLoading.easing}`,\n }\n : undefined\n\n // Auto-advance until the visitor takes over; never under reduced motion.\n useEffect(() => {\n if (variant !== 'slider' || slides.length < 2 || prefersReducedMotion()) return\n const timer = setInterval(() => {\n if (!interacted.current) setIndex((i) => (i + 1) % slides.length)\n }, 7000)\n return () => clearInterval(timer)\n }, [variant, slides.length])\n\n const goTo = (i: number) => {\n interacted.current = true\n setIndex((i + slides.length) % slides.length)\n }\n\n if (slides.length === 0) return null\n\n if (variant === 'split') {\n return (\n <section data-testid={TID.hero} className=\"grid gap-px sm:grid-cols-2\">\n {slides.slice(0, 2).map((slide, i) => (\n <Link\n key={i}\n to={slide.href ?? '/catalog'}\n className=\"group relative block h-[42vh] min-h-[320px] overflow-hidden\"\n >\n <SmoothImage\n src={slideImage(slide, 900, 700)}\n alt={slide.title}\n className=\"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-105\"\n />\n <div className=\"absolute inset-0 flex flex-col items-center justify-center bg-gradient-to-t from-black/65 via-black/25 to-black/10 p-6 text-center text-white\">\n <h2\n className=\"sf-heading animate-fade-up text-3xl font-bold uppercase tracking-wide drop-shadow-md sm:text-4xl\"\n style={{ animationDelay: `${i * 150}ms` }}\n >\n {slide.title}\n </h2>\n {slide.subtitle && (\n <p className=\"animate-fade-up mt-2 max-w-sm drop-shadow\" style={{ animationDelay: `${i * 150 + 120}ms` }}>\n {slide.subtitle}\n </p>\n )}\n <span className=\"mt-4 inline-block border-b-2 border-white/0 pb-0.5 text-sm font-semibold uppercase tracking-wider opacity-0 transition-all duration-300 group-hover:border-white group-hover:opacity-100\">\n Explorar →\n </span>\n </div>\n </Link>\n ))}\n </section>\n )\n }\n\n const active = slides[Math.min(index, slides.length - 1)]!\n\n return (\n <section data-testid={TID.hero} className={`relative w-full overflow-hidden ${hClass}`}>\n {/* stacked slides, crossfade + Ken Burns on the active one */}\n {slides.map((slide, i) => (\n <img\n key={i}\n src={slideImage(slide)}\n alt={slide.title}\n aria-hidden={i !== index}\n loading={i === 0 ? 'eager' : 'lazy'}\n decoding=\"async\"\n onLoad={() => setLoadedSlides((current) => ({ ...current, [i]: true }))}\n style={revealStyle(Boolean(loadedSlides[i]))}\n className={`absolute inset-0 h-full w-full object-cover transition-opacity duration-700 ${\n i === index && (!revealImages || loadedSlides[i]) ? 'animate-kenburns opacity-100' : 'opacity-0'\n }`}\n />\n ))}\n <div\n className={`absolute inset-0 flex items-end p-6 sm:p-12 ${\n active.boxed ? '' : 'bg-gradient-to-t from-black/60 via-black/20 to-transparent'\n }`}\n >\n <div className=\"mx-auto w-full max-w-7xl\">\n <div className=\"max-w-xl\">\n <SlideCopy key={index} slide={active} active />\n </div>\n </div>\n </div>\n\n {variant === 'slider' && slides.length > 1 && (\n <>\n <button\n type=\"button\"\n aria-label=\"Slide anterior\"\n data-testid={TID.heroPrev}\n onClick={() => goTo(index - 1)}\n className=\"absolute left-4 top-1/2 -translate-y-1/2 rounded-full bg-white/85 p-2.5 shadow transition-transform hover:scale-110 hover:bg-white\"\n >\n <ChevronLeft className=\"h-5 w-5 text-gray-900\" />\n </button>\n <button\n type=\"button\"\n aria-label=\"Próximo slide\"\n data-testid={TID.heroNext}\n onClick={() => goTo(index + 1)}\n className=\"absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-white/85 p-2.5 shadow transition-transform hover:scale-110 hover:bg-white\"\n >\n <ChevronRight className=\"h-5 w-5 text-gray-900\" />\n </button>\n <div className=\"absolute bottom-4 left-1/2 flex -translate-x-1/2 gap-2\">\n {slides.map((_, i) => (\n <button\n key={i}\n type=\"button\"\n aria-label={`Ir para o slide ${i + 1}`}\n onClick={() => goTo(i)}\n className={`h-2 rounded-full transition-all duration-300 ${i === index ? 'w-7 bg-white' : 'w-2 bg-white/60 hover:bg-white/80'}`}\n />\n ))}\n </div>\n </>\n )}\n </section>\n )\n}\n","import { useEffect, useState } from 'react'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport type { Category } from '@fayz-ai/shop/types'\n\nexport function useCategories(): { categories: Category[]; loading: boolean } {\n const [categories, setCategories] = useState<Category[]>([])\n const [loading, setLoading] = useState(true)\n\n useEffect(() => {\n let cancelled = false\n getShopProvider()\n .listCategories()\n .then((data) => {\n if (!cancelled) setCategories(data)\n })\n .catch(() => {})\n .finally(() => {\n if (!cancelled) setLoading(false)\n })\n return () => {\n cancelled = true\n }\n }, [])\n\n return { categories, loading }\n}\n","import { create } from 'zustand'\n\nexport type CatalogSort = 'newest' | 'price-asc' | 'price-desc' | 'name'\n\nexport interface CatalogState {\n search: string\n categoryId: string | null\n priceMin: number | null\n priceMax: number | null\n inStockOnly: boolean\n sort: CatalogSort\n setSearch(search: string): void\n setCategoryId(categoryId: string | null): void\n setPriceMin(priceMin: number | null): void\n setPriceMax(priceMax: number | null): void\n setInStockOnly(inStockOnly: boolean): void\n setSort(sort: CatalogSort): void\n reset(): void\n}\n\nconst initial = {\n search: '',\n categoryId: null,\n priceMin: null,\n priceMax: null,\n inStockOnly: false,\n sort: 'newest' as CatalogSort,\n}\n\nexport const useCatalogStore = create<CatalogState>()((set) => ({\n ...initial,\n setSearch: (search) => set({ search }),\n setCategoryId: (categoryId) => set({ categoryId }),\n setPriceMin: (priceMin) => set({ priceMin }),\n setPriceMax: (priceMax) => set({ priceMax }),\n setInStockOnly: (inStockOnly) => set({ inStockOnly }),\n setSort: (sort) => set({ sort }),\n reset: () => set(initial),\n}))\n","import React from 'react'\nimport { useCategories } from '../../hooks/useCategories'\nimport { useCatalogStore } from '../../stores/catalog.store'\nimport { useStorefrontConfig } from '../../config'\nimport { bannerPlaceholder } from '../../sections'\nimport { Reveal } from '../../motion'\nimport { navigateTo } from '../../router'\nimport { TID } from '../../testids'\nimport { SmoothImage } from '../SmoothImage'\n\nexport function CategoryShowcase({ style, title }: { style: 'bubbles' | 'tiles'; title?: string }) {\n const { categories } = useCategories()\n const config = useStorefrontConfig()\n const setCategoryId = useCatalogStore((s) => s.setCategoryId)\n\n if (categories.length === 0) return null\n\n const go = (categoryId: string) => {\n useCatalogStore.getState().reset()\n setCategoryId(categoryId)\n navigateTo(config.catalogPath)\n }\n\n if (style === 'bubbles') {\n return (\n <section data-testid={TID.categoryShowcase} className=\"mx-auto max-w-7xl px-4 py-12 sm:px-6\">\n {title && (\n <Reveal>\n <h2 className=\"sf-heading mb-8 text-center text-3xl font-bold\">{title}</h2>\n </Reveal>\n )}\n <div className=\"flex flex-wrap items-start justify-center gap-8\">\n {categories.map((c, i) => (\n <Reveal key={c.id} delay={i * 80}>\n <button type=\"button\" onClick={() => go(c.id)} className=\"group flex w-28 flex-col items-center gap-3\">\n <span className=\"block h-24 w-24 overflow-hidden rounded-full border-2 border-transparent shadow-sm transition-all duration-300 group-hover:scale-105 group-hover:border-primary group-hover:shadow-md\">\n <SmoothImage\n src={c.imageUrl ?? bannerPlaceholder(c.name, 30 + i * 70, 70 + i * 70, 200, 200)}\n alt={c.name}\n className=\"h-full w-full object-cover\"\n />\n </span>\n <span className=\"text-center text-xs font-medium leading-tight\">{c.name}</span>\n </button>\n </Reveal>\n ))}\n </div>\n </section>\n )\n }\n\n return (\n <section data-testid={TID.categoryShowcase} className=\"mx-auto max-w-7xl px-4 py-12 sm:px-6\">\n {title && (\n <Reveal>\n <h2 className=\"sf-heading mb-8 text-center text-3xl font-bold\">{title}</h2>\n </Reveal>\n )}\n <div className=\"grid grid-cols-2 gap-4 lg:grid-cols-4\">\n {categories.map((c, i) => (\n <Reveal key={c.id} delay={i * 90}>\n <button type=\"button\" onClick={() => go(c.id)} className=\"group relative block aspect-[4/5] w-full overflow-hidden\" style={{ borderRadius: 'var(--sf-radius-card)' }}>\n <SmoothImage\n src={c.imageUrl ?? bannerPlaceholder(c.name, 30 + i * 70, 70 + i * 70, 480, 600)}\n alt={c.name}\n className=\"h-full w-full object-cover transition-transform duration-700 ease-out group-hover:scale-110\"\n />\n <span className=\"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 via-black/30 to-transparent p-5 pt-12 text-left\">\n <span className=\"sf-heading block text-lg font-semibold text-white\">{c.name}</span>\n <span className=\"mt-0.5 block text-xs text-white/80 opacity-0 transition-opacity duration-300 group-hover:opacity-100\">\n Explorar →\n </span>\n </span>\n </button>\n </Reveal>\n ))}\n </div>\n </section>\n )\n}\n","import { useEffect, useState } from 'react'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport type { Product, ListProductsOptions } from '@fayz-ai/shop/types'\n\nexport function useProducts(opts: ListProductsOptions): {\n products: Product[]\n loading: boolean\n error: string | null\n reload: () => void\n} {\n const [products, setProducts] = useState<Product[]>([])\n const [loading, setLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n const [nonce, setNonce] = useState(0)\n const key = JSON.stringify(opts)\n\n useEffect(() => {\n let cancelled = false\n setLoading(true)\n getShopProvider()\n .listProducts(JSON.parse(key) as ListProductsOptions)\n .then((data) => {\n if (cancelled) return\n setProducts(data)\n setError(null)\n })\n .catch((e: unknown) => {\n if (!cancelled) setError(e instanceof Error ? e.message : String(e))\n })\n .finally(() => {\n if (!cancelled) setLoading(false)\n })\n return () => {\n cancelled = true\n }\n }, [key, nonce])\n\n return { products, loading, error, reload: () => setNonce((n) => n + 1) }\n}\n","export function formatMoney(value: number, currency = 'BRL', locale = 'pt-BR'): string {\n return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(value)\n}\n\nexport function roundCents(value: number): number {\n return Math.round(value * 100) / 100\n}\n","import { create } from 'zustand'\nimport { persist } from 'zustand/middleware'\nimport { lookupPostalCode, normalizePostalCode, type PostalAddress } from '@fayz-ai/core'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport type { ShippingQuoteOption } from '@fayz-ai/shop/types'\n\n/**\n * Where the shopper wants it delivered, decided before the cart exists.\n *\n * Two different things live here and they are persisted differently on purpose:\n *\n * the ADDRESS is durable — a CEP maps to the same street for years, and\n * carrying it to checkout is the whole point (the buyer types the number and\n * nothing else);\n *\n * the QUOTE is not persisted at all. It is a price, and a price restored from\n * localStorage is a price the shopper can edit with devtools. It is re-asked\n * on demand, and resolved for the current cart through resolveOptionRate —\n * the same rule shop_shipping_for applies — so it can never go stale. The\n * order is charged from shop_place_order, which recomputes from the same\n * zones and ignores anything the client sends.\n */\n\nexport type DeliveryStatus = 'idle' | 'loading' | 'served' | 'unserved' | 'error'\n\nexport interface DeliveryState {\n postalCode: string\n address: PostalAddress | null\n options: ShippingQuoteOption[]\n selectedZoneId: string | null\n status: DeliveryStatus\n error: string | null\n\n /** Look the CEP up and quote it. `subtotal` decides free-above thresholds. */\n resolve: (postalCode: string, subtotal: number) => Promise<void>\n selectZone: (zoneId: string) => void\n clear: () => void\n}\n\nconst EMPTY = {\n postalCode: '',\n address: null,\n options: [] as ShippingQuoteOption[],\n selectedZoneId: null,\n status: 'idle' as DeliveryStatus,\n error: null,\n}\n\nexport const useDeliveryStore = create<DeliveryState>()(\n persist(\n (set, get) => ({\n ...EMPTY,\n\n async resolve(postalCode: string, subtotal: number) {\n const code = normalizePostalCode(postalCode)\n if (code.length !== 8) {\n set({ ...EMPTY, postalCode, status: 'error', error: 'Digite os 8 dígitos do CEP.' })\n return\n }\n\n set({ postalCode: code, status: 'loading', error: null })\n\n // The QUOTE comes first and is the answer that matters. Whether we\n // deliver to a postcode, and for how much, is decided entirely by our\n // own zones against eight digits — it does not need to know the street.\n //\n // Doing it the other way round made the delivery answer depend on a\n // third party: with ViaCEP slow or rate-limited, a perfectly serviceable\n // address reported an error instead of a price.\n let options: ShippingQuoteOption[] = []\n try {\n options = (await getShopProvider().quoteShipping?.(code, subtotal)) ?? []\n } catch {\n set({ ...EMPTY, postalCode: code, status: 'error',\n error: 'Não foi possível calcular o frete agora. Tente de novo.' })\n return\n }\n\n // The ADDRESS is the convenience layer: it saves the buyer typing, and\n // losing it costs typing, not the sale. Failures here never change the\n // delivery verdict already decided above.\n let address: PostalAddress | null = null\n let notFound = false\n try {\n address = await lookupPostalCode(code)\n notFound = address === null\n } catch {\n address = null\n }\n\n set({\n postalCode: code,\n address,\n options,\n selectedZoneId: options[0]?.zoneId ?? null,\n // A store with no zones configured quotes nothing, and that must NOT\n // read as \"we don't deliver here\" — it falls back to the store-wide\n // flat rate, which the cart already knows how to show.\n status: options.length > 0 ? 'served' : 'unserved',\n // Reported alongside the price, not instead of it: the CEP may be\n // mistyped even though its range is covered.\n error: notFound ? 'CEP não encontrado. Confira os números.' : null,\n })\n },\n\n selectZone(zoneId: string) {\n if (get().options.some((option) => option.zoneId === zoneId)) set({ selectedZoneId: zoneId })\n },\n\n clear() {\n set({ ...EMPTY })\n },\n }),\n {\n name: 'fayz.storefront.delivery.v1',\n // Deliberately NOT persisting `options`: a rehydrated\n // price would be shown as current without anything having quoted it. The\n // address survives, the money is asked for again.\n partialize: (state) => ({ postalCode: state.postalCode, address: state.address }),\n onRehydrateStorage: () => (state) => {\n if (state?.address) state.status = 'idle'\n },\n },\n ),\n)\n\n/**\n * The freight for the chosen zone at THIS subtotal, or null when there is no\n * zone in play (no CEP yet, or a store that configured none) and the caller\n * should use the store-wide rate. Null never means free.\n *\n * The free-above rule is applied here rather than trusting the `rate` the\n * server resolved, because that one was resolved for whatever the cart held at\n * quote time. Re-deriving from `baseRate`/`freeAbove` — the same CASE\n * shop_shipping_for runs — means adding an item can never leave a stale price\n * on screen. An earlier version fell back to the config flat rate when the\n * quote went stale, which showed R$ 8 (the flat rate) for an address in an\n * R$ 18 zone: shown one number, charged another.\n */\nexport function resolveOptionRate(option: ShippingQuoteOption, subtotal: number): number {\n if (option.freeAbove != null && subtotal >= option.freeAbove) return 0\n return option.baseRate\n}\n\nexport const selectQuotedShipping = (\n state: Pick<DeliveryState, 'options' | 'selectedZoneId' | 'status'>,\n subtotal: number,\n): number | null => {\n if (state.status !== 'served') return null\n const option = state.options.find((o) => o.zoneId === state.selectedZoneId) ?? state.options[0]\n return option ? resolveOptionRate(option, subtotal) : null\n}\n","import type { Product } from '@fayz-ai/shop/types'\n\nexport interface ProductOptionGroup {\n id: string\n label: string\n values: string[]\n}\n\nexport type ProductOptionSelection = Record<string, string>\n\nfunction cleanValues(value: unknown): string[] {\n if (!Array.isArray(value)) return []\n return Array.from(new Set(value.filter((item): item is string => typeof item === 'string' && item.trim().length > 0)))\n}\n\nfunction cleanOptionGroup(value: unknown): ProductOptionGroup | null {\n if (!value || typeof value !== 'object') return null\n const record = value as Record<string, unknown>\n const id = typeof record.id === 'string' ? record.id : typeof record.name === 'string' ? record.name : null\n const label = typeof record.label === 'string' ? record.label : typeof record.name === 'string' ? record.name : id\n const values = cleanValues(record.values)\n if (!id || !label || values.length === 0) return null\n return { id, label, values }\n}\n\nexport function getProductOptionGroups(product: Product): ProductOptionGroup[] {\n const options = product.metadata.options\n const explicit = Array.isArray(options)\n ? options.map(cleanOptionGroup).filter((group): group is ProductOptionGroup => Boolean(group))\n : []\n\n if (explicit.length > 0) return explicit\n\n const groups: ProductOptionGroup[] = []\n const sizes = cleanValues(product.metadata.sizes)\n const colors = cleanValues(product.metadata.colors)\n\n if (sizes.length > 0) groups.push({ id: 'Tamanho', label: 'Tamanho', values: sizes })\n if (colors.length > 0) groups.push({ id: 'Cor', label: 'Cor', values: colors })\n\n return groups\n}\n\nexport function normalizeProductOptionSelection(selection?: ProductOptionSelection | null): ProductOptionSelection {\n if (!selection) return {}\n return Object.fromEntries(\n Object.entries(selection)\n .filter((entry): entry is [string, string] => entry[0].trim().length > 0 && entry[1].trim().length > 0)\n .sort(([a], [b]) => a.localeCompare(b)),\n )\n}\n\nexport function formatProductOptionSelection(selection?: ProductOptionSelection | null): string {\n return Object.entries(normalizeProductOptionSelection(selection))\n .map(([label, value]) => `${label}: ${value}`)\n .join(' · ')\n}\n\nexport function productOptionSelectionKey(selection?: ProductOptionSelection | null): string {\n const normalized = normalizeProductOptionSelection(selection)\n const entries = Object.entries(normalized)\n return entries.length > 0 ? JSON.stringify(entries) : ''\n}\n","import { create } from 'zustand'\nimport { persist } from 'zustand/middleware'\nimport type { Product } from '@fayz-ai/shop/types'\nimport { roundCents } from '../format'\nimport type { ResolvedStorefrontConfig } from '../config'\nimport { useDeliveryStore, selectQuotedShipping } from './delivery.store'\nimport {\n formatProductOptionSelection,\n normalizeProductOptionSelection,\n productOptionSelectionKey,\n type ProductOptionSelection,\n} from '../product-options'\n\nexport interface CartLine {\n lineId: string\n productId: string\n slug: string\n name: string\n sku: string | null\n options: ProductOptionSelection\n optionsLabel: string\n unitPrice: number\n quantity: number\n imageUrl: string | null\n /** inventoryCount at add time — clamps quantity */\n maxQuantity: number\n}\n\nexport interface CartState {\n lines: CartLine[]\n discountCode: string | null\n discountPercent: number\n isOpen: boolean\n /** Line most recently added — lets the drawer briefly highlight it. */\n justAddedLineId: string | null\n addItem(product: Product, qty?: number, options?: ProductOptionSelection): void\n setQuantity(lineId: string, qty: number): void\n removeItem(lineId: string): void\n applyDiscount(code: string, percent: number): void\n clearDiscount(): void\n clear(): void\n openDrawer(): void\n closeDrawer(): void\n /** Drop persisted lines the active backend can no longer resolve (e.g. a cart\n * built in an earlier mock-mode session, whose ids don't exist live). The\n * resolver returns false only for a definitive \"not found\"; on error it must\n * return true so a transient failure never discards a legit line. */\n reconcile(resolve: (line: CartLine) => Promise<boolean>): Promise<void>\n}\n\nexport const useCartStore = create<CartState>()(\n persist(\n (set, get) => ({\n lines: [],\n discountCode: null,\n discountPercent: 0,\n isOpen: false,\n justAddedLineId: null,\n\n addItem: (product, qty = 1, options) =>\n set((state) => {\n const normalizedOptions = normalizeProductOptionSelection(options)\n const optionKey = productOptionSelectionKey(normalizedOptions)\n const lineId = optionKey ? `${product.id}:${optionKey}` : product.id\n const existing = state.lines.find((l) => (l.lineId ?? l.productId) === lineId)\n if (existing) {\n const nextQty = Math.min(existing.quantity + qty, existing.maxQuantity || Infinity)\n return {\n // Auto-open the cart on add — the standard premium \"slide-in cart\"\n // signal — and flag the line so the drawer can highlight it.\n isOpen: true,\n justAddedLineId: lineId,\n lines: state.lines.map((l) =>\n (l.lineId ?? l.productId) === lineId ? { ...l, lineId, quantity: nextQty } : l,\n ),\n }\n }\n const image = product.images.find((i) => i.isPrimary) ?? product.images[0]\n const line: CartLine = {\n lineId,\n productId: product.id,\n slug: product.slug,\n name: product.name,\n sku: product.sku,\n options: normalizedOptions,\n optionsLabel: formatProductOptionSelection(normalizedOptions),\n unitPrice: product.price,\n quantity: Math.min(qty, product.inventoryCount || Infinity),\n imageUrl: image?.url ?? null,\n maxQuantity: product.inventoryCount,\n }\n return { isOpen: true, justAddedLineId: lineId, lines: [...state.lines, line] }\n }),\n\n setQuantity: (lineId, qty) =>\n set((state) => {\n if (qty <= 0) return { lines: state.lines.filter((l) => (l.lineId ?? l.productId) !== lineId) }\n return {\n lines: state.lines.map((l) =>\n (l.lineId ?? l.productId) === lineId\n ? { ...l, quantity: Math.min(qty, l.maxQuantity || Infinity) }\n : l,\n ),\n }\n }),\n\n removeItem: (lineId) =>\n set((state) => ({ lines: state.lines.filter((l) => (l.lineId ?? l.productId) !== lineId) })),\n\n applyDiscount: (code, percent) => set({ discountCode: code, discountPercent: percent }),\n clearDiscount: () => set({ discountCode: null, discountPercent: 0 }),\n clear: () => set({ lines: [], discountCode: null, discountPercent: 0 }),\n openDrawer: () => set({ isOpen: true }),\n closeDrawer: () => set({ isOpen: false, justAddedLineId: null }),\n\n reconcile: async (resolve) => {\n const lines = get().lines\n if (lines.length === 0) return\n const keep = await Promise.all(\n lines.map((line) => resolve(line).catch(() => true)),\n )\n const kept = lines.filter((_, i) => keep[i])\n if (kept.length !== lines.length) set({ lines: kept })\n },\n }),\n {\n name: 'fayz.storefront.cart.v1',\n partialize: (state) => ({\n lines: state.lines,\n discountCode: state.discountCode,\n discountPercent: state.discountPercent,\n }),\n },\n ),\n)\n\n// ---------------------------------------------------------------------------\n// Money selectors — the single place cart math happens. Checkout passes these\n// exact values to createOrder so drawer totals always match order totals.\n// ---------------------------------------------------------------------------\n\nexport const selectCount = (s: Pick<CartState, 'lines'>): number =>\n s.lines.reduce((n, l) => n + l.quantity, 0)\n\nexport const selectSubtotal = (s: Pick<CartState, 'lines'>): number =>\n roundCents(s.lines.reduce((sum, l) => sum + l.unitPrice * l.quantity, 0))\n\nexport const selectDiscountTotal = (s: Pick<CartState, 'lines' | 'discountPercent'>): number =>\n roundCents(selectSubtotal(s) * (s.discountPercent / 100))\n\n/**\n * Freight to display.\n *\n * When the shopper has given a CEP and the store quoted it, that quote wins —\n * it came from the same shipping_zones rows shop_place_order will charge from.\n * Otherwise this falls back to the store-wide rate in config, which is what\n * every storefront did before zones existed.\n *\n * The subtotal is PRE-discount on both sides of this. That is 0017's rule, and\n * the quote is requested against the same number, so a coupon can never make\n * the cart and the order disagree.\n *\n * Read through getState() rather than a hook because this is a plain selector\n * called from several screens; components that render the value subscribe to\n * useDeliveryStore themselves so a fresh quote re-renders them.\n */\nexport const selectShipping = (\n s: Pick<CartState, 'lines'>,\n cfg: ResolvedStorefrontConfig,\n): number => {\n if (s.lines.length === 0) return 0\n const subtotal = selectSubtotal(s)\n\n const quoted = selectQuotedShipping(useDeliveryStore.getState(), subtotal)\n if (quoted != null) return quoted\n\n if (cfg.shipping.freeAbove != null && subtotal >= cfg.shipping.freeAbove) return 0\n return cfg.shipping.flatRate\n}\n\nexport const selectTotal = (\n s: Pick<CartState, 'lines' | 'discountPercent'>,\n cfg: ResolvedStorefrontConfig,\n): number =>\n roundCents(selectSubtotal(s) - selectDiscountTotal(s) + selectShipping(s, cfg))\n","import { getShopProvider } from '@fayz-ai/shop/runtime'\nimport type { CreateProductEnquiryInput } from '@fayz-ai/shop/types'\nimport { useStorefrontConfig } from '../config'\nimport { navigateTo } from '../router'\nimport { useCatalogStore } from '../stores/catalog.store'\nimport { useCartStore } from '../stores/cart.store'\nimport type { ProductOptionSelection } from '../product-options'\nimport type { Product } from '@fayz-ai/shop/types'\n\nexport function useStorefront() {\n return useStorefrontConfig()\n}\n\nexport function useCatalog() {\n const config = useStorefrontConfig()\n const catalog = useCatalogStore()\n return {\n ...catalog,\n catalogPath: config.catalogPath,\n config,\n }\n}\n\nexport function useCart() {\n return useCartStore()\n}\n\nexport function useEnquiry() {\n const config = useStorefrontConfig()\n const createProductEnquiry = async (input: CreateProductEnquiryInput) => {\n const provider = getShopProvider()\n if (!provider.createProductEnquiry) {\n throw new Error('The active shop provider does not support product enquiries.')\n }\n return provider.createProductEnquiry(input)\n }\n\n return {\n enquiry: config.enquiry,\n createProductEnquiry,\n }\n}\n\nexport function useStorefrontActions() {\n const addItem = useCartStore((state) => state.addItem)\n const openDrawer = useCartStore((state) => state.openDrawer)\n const closeDrawer = useCartStore((state) => state.closeDrawer)\n const { createProductEnquiry } = useEnquiry()\n\n return {\n navigateTo,\n addToCart: (product: Product, quantity?: number, options?: ProductOptionSelection) =>\n addItem(product, quantity, options),\n openCart: openDrawer,\n closeCart: closeDrawer,\n createProductEnquiry,\n }\n}\n","import React from 'react'\nimport { formatMoney } from '../format'\nimport { useStorefrontConfig } from '../config'\n\nexport interface PriceProps {\n value: number\n compareAt?: number | null\n testId?: string\n compareTestId?: string\n className?: string\n}\n\n/** Formatted money. Always carries data-price so tests assert raw numbers, never locale strings. */\nexport function Price({ value, compareAt, testId, compareTestId, className }: PriceProps) {\n const { currency, locale } = useStorefrontConfig()\n return (\n <span className={`inline-flex items-baseline gap-2 ${className ?? ''}`}>\n <span data-testid={testId} data-price={value.toFixed(2)} className=\"font-semibold\">\n {formatMoney(value, currency, locale)}\n </span>\n {compareAt != null && compareAt > value && (\n <span\n data-testid={compareTestId}\n data-price={compareAt.toFixed(2)}\n className=\"text-sm text-muted-foreground line-through\"\n >\n {formatMoney(compareAt, currency, locale)}\n </span>\n )}\n </span>\n )\n}\n","import { TID } from './testids'\n\n/**\n * Stable selectors that custom storefront components must preserve.\n *\n * Apps can fully customize the visual tree, but replacement components still\n * need these anchors so smoke tests, QA, and agents can operate stores.\n */\nexport const productCardComponentContract = {\n root: { 'data-testid': TID.productCard },\n name: { 'data-testid': TID.productCardName },\n priceTestId: TID.productCardPrice,\n addButton: { 'data-testid': TID.productCardAdd },\n} as const\n\nexport const storefrontComponentContracts = {\n productCard: productCardComponentContract,\n productDetail: {\n root: { 'data-testid': TID.pdpRoot },\n gallery: { 'data-testid': TID.pdpGallery },\n name: { 'data-testid': TID.pdpName },\n description: { 'data-testid': TID.pdpDescription },\n actions: { 'data-testid': TID.pdpActions },\n addButton: { 'data-testid': TID.pdpAddToCart },\n enquiryButton: { 'data-testid': TID.pdpEnquiryButton },\n enquiryForm: { 'data-testid': TID.enquiryForm },\n },\n} as const\n\nexport type ProductCardComponentContract = typeof productCardComponentContract\nexport type ProductDetailComponentContract = typeof storefrontComponentContracts.productDetail\n","import React from 'react'\nimport { ShoppingBag } from 'lucide-react'\nimport { useStorefrontConfig } from '../config'\nimport { Link, navigateTo } from '../router'\nimport { getProductOptionGroups } from '../product-options'\nimport { Price } from './Price'\nimport { TID } from '../testids'\nimport { productCardComponentContract } from '../component-selectors'\nimport { useStorefrontActions } from '../hooks/useStorefront'\nimport type { ProductCardProps } from '../component-contracts'\nimport { SmoothImage } from './SmoothImage'\n\nexport function ProductCard({ product, config: providedConfig, actions: providedActions }: ProductCardProps) {\n const runtimeConfig = useStorefrontConfig()\n const runtimeActions = useStorefrontActions()\n const config = providedConfig ?? runtimeConfig\n const actions = providedActions ?? runtimeActions\n const hasOptions = getProductOptionGroups(product).length > 0\n const soldOut = product.inventoryCount <= 0\n const onSale = product.compareAtPrice != null && product.compareAtPrice > product.price\n const image = product.images.find((i) => i.isPrimary) ?? product.images[0]\n const cardStyle = config.theme?.productCard?.style ?? 'card'\n const aspect = config.theme?.productCard?.imageAspect === 'portrait' ? 'aspect-[3/4]' : 'aspect-square'\n const purchaseMode = config.commerceMode === 'checkout'\n\n return (\n <div\n {...productCardComponentContract.root}\n data-slug={product.slug}\n className={`group flex flex-col overflow-hidden transition-all duration-300 ${\n cardStyle === 'editorial'\n ? 'hover:-translate-y-1'\n : 'border bg-card hover:-translate-y-1 hover:shadow-lg'\n }`}\n style={{ borderRadius: 'var(--sf-radius-card)' }}\n >\n <Link to={`/product/${product.slug}`} className={`relative block ${aspect} overflow-hidden bg-muted`} style={{ borderRadius: cardStyle === 'editorial' ? 'var(--sf-radius-card)' : undefined }}>\n {image && (\n <SmoothImage\n src={image.url}\n alt={image.altText ?? product.name}\n className=\"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105\"\n loading=\"lazy\"\n />\n )}\n <div className=\"absolute left-3 top-3 flex gap-2\">\n {onSale && !soldOut && (\n <span\n data-testid={TID.badgeSale}\n className=\"rounded-full bg-red-600 px-2.5 py-0.5 text-xs font-semibold text-white\"\n >\n Oferta\n </span>\n )}\n {soldOut && (\n <span\n data-testid={TID.badgeSoldout}\n className=\"rounded-full bg-gray-900/80 px-2.5 py-0.5 text-xs font-semibold text-white\"\n >\n Esgotado\n </span>\n )}\n </div>\n </Link>\n\n <div className={`flex flex-1 flex-col gap-1 ${cardStyle === 'editorial' ? 'px-1 py-3' : 'p-4'}`}>\n <span className=\"text-xs text-muted-foreground\">{product.categoryName}</span>\n <Link\n to={`/product/${product.slug}`}\n {...productCardComponentContract.name}\n className=\"font-medium leading-snug hover:underline\"\n >\n {product.name}\n </Link>\n <div className=\"mt-auto flex items-center justify-between gap-3 pt-2\">\n {purchaseMode ? (\n <Price\n value={product.price}\n compareAt={product.compareAtPrice}\n testId={productCardComponentContract.priceTestId}\n />\n ) : (\n <span data-testid={productCardComponentContract.priceTestId} className=\"text-sm text-muted-foreground\">\n {config.commerceMode === 'enquiry' ? config.enquiry.label : 'Ver detalhes'}\n </span>\n )}\n <button\n type=\"button\"\n {...productCardComponentContract.addButton}\n disabled={purchaseMode && soldOut}\n aria-label={\n purchaseMode\n ? hasOptions\n ? `Escolher opções de ${product.name}`\n : `Adicionar ${product.name} ao carrinho`\n : `${config.enquiry.label} ${product.name}`\n }\n onClick={() => {\n if (!purchaseMode) {\n navigateTo(`/product/${product.slug}`)\n return\n }\n // Products with variants (size/color) must pick an option on the PDP\n // — quick-adding would create an option-less line. Others add inline\n // (addItem auto-opens the cart drawer).\n if (hasOptions) {\n navigateTo(`/product/${product.slug}`)\n return\n }\n actions.addToCart(product)\n }}\n className=\"rounded-full border bg-background/90 p-2.5 text-foreground shadow-sm transition-all duration-200 hover:scale-110 hover:bg-primary hover:text-primary-foreground hover:shadow disabled:cursor-not-allowed disabled:opacity-40 lg:translate-y-1 lg:opacity-0 lg:group-hover:translate-y-0 lg:group-hover:opacity-100 lg:disabled:opacity-0 lg:group-hover:disabled:opacity-40\"\n >\n <ShoppingBag className=\"h-4 w-4\" />\n </button>\n </div>\n </div>\n </div>\n )\n}\n","import React, { useMemo } from 'react'\nimport { useProducts } from '../../hooks/useProducts'\nimport { getStorefrontComponents, useStorefrontConfig } from '../../config'\nimport { useStorefrontActions } from '../../hooks/useStorefront'\nimport { ProductCard } from '../ProductCard'\nimport { Reveal } from '../../motion'\nimport { Link } from '../../router'\nimport { TID } from '../../testids'\n\nexport function ProductRail({\n title,\n subtitle,\n eyebrow,\n filter = 'all',\n limit = 4,\n}: {\n title: string\n subtitle?: string\n eyebrow?: string\n filter?: 'sale' | 'new' | 'all'\n limit?: number\n}) {\n const config = useStorefrontConfig()\n const actions = useStorefrontActions()\n const components = getStorefrontComponents(config)\n const ProductCardComponent = components.ProductCard ?? ProductCard\n const { products, loading } = useProducts(\n filter === 'new'\n ? { status: 'active', orderBy: 'created_at', order: 'desc' }\n : { status: 'active' },\n )\n\n const visible = useMemo(() => {\n let list = products\n if (filter === 'sale') list = list.filter((p) => p.compareAtPrice != null && p.compareAtPrice > p.price)\n return list.slice(0, limit)\n }, [products, filter, limit])\n\n if (!loading && visible.length === 0) return null\n\n return (\n <section data-testid={TID.productRail} className=\"mx-auto max-w-7xl px-4 py-14 sm:px-6\">\n <Reveal className=\"mb-10 text-center\">\n {eyebrow && (\n <p className=\"mb-2 text-xs font-semibold uppercase tracking-[0.2em] text-primary\">{eyebrow}</p>\n )}\n <h2 className=\"sf-heading text-3xl font-bold tracking-tight\">{title}</h2>\n {subtitle && <p className=\"mt-2 text-muted-foreground\">{subtitle}</p>}\n </Reveal>\n {loading ? (\n <div className=\"grid grid-cols-2 gap-5 md:grid-cols-4\">\n {Array.from({ length: limit }, (_, i) => (\n <div key={i} className=\"aspect-[3/4] animate-pulse bg-muted\" style={{ borderRadius: 'var(--sf-radius-card)' }} />\n ))}\n </div>\n ) : (\n <div className=\"grid grid-cols-2 gap-5 md:grid-cols-4\">\n {visible.map((p, i) => (\n <Reveal key={p.id} delay={i * 90}>\n <ProductCardComponent\n product={p}\n config={config}\n commerceMode={config.commerceMode}\n actions={actions}\n />\n </Reveal>\n ))}\n </div>\n )}\n <Reveal className=\"mt-10 text-center\" delay={200}>\n <Link\n to={config.catalogPath}\n className=\"sf-cta inline-block border border-foreground/30 px-7 py-2.5 text-sm font-semibold transition-all hover:-translate-y-0.5 hover:bg-foreground hover:text-background hover:shadow\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n Ver tudo\n </Link>\n </Reveal>\n </section>\n )\n}\n","import React, { useEffect, useRef, useState } from 'react'\nimport { ChevronLeft, ChevronRight } from 'lucide-react'\nimport { Link } from '../../router'\nimport { TID } from '../../testids'\nimport { prefersReducedMotion } from '../../motion'\nimport type { MediaCarouselItem } from '../../sections'\nimport { useStorefrontConfig } from '../../config'\n\nexport interface MediaCarouselProps {\n items: MediaCarouselItem[]\n height?: 'medium' | 'tall' | 'screen'\n autoplayMs?: number\n overlay?: 'dark' | 'soft' | 'none'\n className?: string\n}\n\nconst heightClass = {\n medium: 'h-[58vh] min-h-[420px]',\n tall: 'h-[74vh] min-h-[520px]',\n screen: 'min-h-[calc(100vh-64px)]',\n}\n\nconst alignClass = {\n start: 'items-start text-left',\n center: 'items-center text-center',\n end: 'items-end text-right',\n}\n\nexport function MediaCarousel({\n items,\n height = 'tall',\n autoplayMs = 7000,\n overlay = 'dark',\n className = '',\n}: MediaCarouselProps) {\n const [index, setIndex] = useState(0)\n const [loadedItems, setLoadedItems] = useState<Record<number, boolean>>({})\n const config = useStorefrontConfig()\n const interacted = useRef(false)\n const revealImages = config.imageLoading.mode !== 'none'\n const revealStyle = (loaded: boolean): React.CSSProperties | undefined =>\n revealImages\n ? {\n filter: config.imageLoading.blur && !loaded ? 'blur(10px)' : 'blur(0px)',\n transition: `opacity 700ms ease, filter ${config.imageLoading.durationMs}ms ${config.imageLoading.easing}`,\n }\n : undefined\n\n useEffect(() => {\n if (items.length < 2 || autoplayMs <= 0 || prefersReducedMotion()) return\n const timer = setInterval(() => {\n if (!interacted.current) setIndex((i) => (i + 1) % items.length)\n }, autoplayMs)\n return () => clearInterval(timer)\n }, [autoplayMs, items.length])\n\n if (items.length === 0) return null\n\n const active = items[Math.min(index, items.length - 1)]!\n const goTo = (next: number) => {\n interacted.current = true\n setIndex((next + items.length) % items.length)\n }\n const overlayClass =\n overlay === 'dark'\n ? 'bg-gradient-to-r from-black/70 via-black/25 to-black/25'\n : overlay === 'soft'\n ? 'bg-gradient-to-t from-black/45 via-black/10 to-transparent'\n : ''\n\n return (\n <section data-testid={TID.mediaCarousel} className={`relative isolate overflow-hidden ${heightClass[height]} ${className}`}>\n {items.map((item, i) => (\n <img\n key={`${item.title}-${i}`}\n src={item.image}\n alt={item.imageAlt ?? item.title}\n aria-hidden={i !== index}\n loading={i === 0 ? 'eager' : 'lazy'}\n decoding=\"async\"\n onLoad={() => setLoadedItems((current) => ({ ...current, [i]: true }))}\n style={revealStyle(Boolean(loadedItems[i]))}\n className={`absolute inset-0 -z-10 h-full w-full object-cover transition-opacity duration-700 ${\n i === index && (!revealImages || loadedItems[i]) ? 'opacity-100' : 'opacity-0'\n }`}\n />\n ))}\n <div className={`absolute inset-0 -z-10 ${overlayClass}`} />\n <div className={`flex h-full px-5 py-16 sm:px-10 lg:px-16 ${alignClass[active.align ?? 'start']}`}>\n <div className=\"my-auto max-w-2xl text-white drop-shadow-md\">\n {active.eyebrow && (\n <p className=\"mb-4 text-xs font-semibold uppercase tracking-[0.24em] text-white/80\">{active.eyebrow}</p>\n )}\n <h1 className=\"sf-heading text-5xl font-normal leading-[0.95] sm:text-7xl lg:text-8xl\">{active.title}</h1>\n {active.subtitle && <p className=\"mt-5 max-w-xl text-base leading-8 text-white/88 sm:text-lg\">{active.subtitle}</p>}\n {active.cta && (\n <Link\n to={active.href ?? '/catalog'}\n className=\"mt-8 inline-flex border border-white/75 px-6 py-3 text-xs font-semibold uppercase tracking-[0.18em] text-white transition hover:bg-white hover:text-black\"\n >\n {active.cta}\n </Link>\n )}\n </div>\n </div>\n {items.length > 1 && (\n <>\n <button\n type=\"button\"\n aria-label=\"Previous slide\"\n data-testid={TID.mediaCarouselPrev}\n onClick={() => goTo(index - 1)}\n className=\"absolute left-4 top-1/2 inline-flex h-10 w-10 -translate-y-1/2 items-center justify-center border border-white/60 bg-black/20 text-white backdrop-blur transition hover:bg-white hover:text-black\"\n >\n <ChevronLeft className=\"h-5 w-5\" />\n </button>\n <button\n type=\"button\"\n aria-label=\"Next slide\"\n data-testid={TID.mediaCarouselNext}\n onClick={() => goTo(index + 1)}\n className=\"absolute right-4 top-1/2 inline-flex h-10 w-10 -translate-y-1/2 items-center justify-center border border-white/60 bg-black/20 text-white backdrop-blur transition hover:bg-white hover:text-black\"\n >\n <ChevronRight className=\"h-5 w-5\" />\n </button>\n <div className=\"absolute bottom-5 left-1/2 flex -translate-x-1/2 gap-2\">\n {items.map((item, i) => (\n <button\n key={`${item.title}-dot-${i}`}\n type=\"button\"\n aria-label={`Go to slide ${i + 1}`}\n onClick={() => goTo(i)}\n className={`h-2 rounded-full transition-all ${i === index ? 'w-8 bg-white' : 'w-2 bg-white/55 hover:bg-white'}`}\n />\n ))}\n </div>\n </>\n )}\n </section>\n )\n}\n","import React, { useMemo, useRef } from 'react'\nimport { ChevronLeft, ChevronRight } from 'lucide-react'\nimport { getStorefrontComponents, useStorefrontConfig } from '../../config'\nimport { useProducts } from '../../hooks/useProducts'\nimport { useStorefrontActions } from '../../hooks/useStorefront'\nimport { ProductCard } from '../ProductCard'\nimport { Link } from '../../router'\nimport { TID } from '../../testids'\n\nexport interface ProductSliderProps {\n title: string\n subtitle?: string\n eyebrow?: string\n filter?: 'sale' | 'new' | 'all'\n categoryName?: string\n collection?: string\n limit?: number\n cta?: string\n href?: string\n className?: string\n}\n\nexport function ProductSlider({\n title,\n subtitle,\n eyebrow,\n filter = 'all',\n categoryName,\n collection,\n limit = 10,\n cta = 'View all',\n href,\n className = '',\n}: ProductSliderProps) {\n const config = useStorefrontConfig()\n const actions = useStorefrontActions()\n const viewportRef = useRef<HTMLDivElement>(null)\n const components = getStorefrontComponents(config)\n const ProductCardComponent = components.ProductCard ?? ProductCard\n const { products, loading } = useProducts(\n filter === 'new'\n ? { status: 'active', orderBy: 'created_at', order: 'desc' }\n : { status: 'active' },\n )\n\n const visible = useMemo(() => {\n let list = products\n if (filter === 'sale') list = list.filter((p) => p.compareAtPrice != null && p.compareAtPrice > p.price)\n if (categoryName) list = list.filter((p) => p.categoryName === categoryName)\n if (collection) list = list.filter((p) => p.metadata?.collection === collection)\n return list.slice(0, limit)\n }, [categoryName, collection, filter, limit, products])\n\n const scroll = (direction: -1 | 1) => {\n viewportRef.current?.scrollBy({ left: direction * Math.max(320, viewportRef.current.clientWidth * 0.75), behavior: 'smooth' })\n }\n\n if (!loading && visible.length === 0) return null\n\n return (\n <section data-testid={TID.productSlider} className={`mx-auto max-w-7xl px-4 py-14 sm:px-6 ${className}`}>\n <div className=\"mb-8 flex flex-col gap-5 sm:flex-row sm:items-end sm:justify-between\">\n <div className=\"max-w-2xl\">\n {eyebrow && <p className=\"mb-2 text-xs font-semibold uppercase tracking-[0.2em] text-primary\">{eyebrow}</p>}\n <h2 className=\"sf-heading text-3xl font-normal leading-tight tracking-normal sm:text-5xl\">{title}</h2>\n {subtitle && <p className=\"mt-3 leading-7 text-muted-foreground\">{subtitle}</p>}\n </div>\n <div className=\"flex items-center gap-2\">\n <button\n type=\"button\"\n aria-label=\"Previous products\"\n data-testid={TID.productSliderPrev}\n onClick={() => scroll(-1)}\n className=\"inline-flex h-10 w-10 items-center justify-center border border-border bg-background transition hover:bg-foreground hover:text-background\"\n >\n <ChevronLeft className=\"h-5 w-5\" />\n </button>\n <button\n type=\"button\"\n aria-label=\"Next products\"\n data-testid={TID.productSliderNext}\n onClick={() => scroll(1)}\n className=\"inline-flex h-10 w-10 items-center justify-center border border-border bg-background transition hover:bg-foreground hover:text-background\"\n >\n <ChevronRight className=\"h-5 w-5\" />\n </button>\n </div>\n </div>\n <div\n ref={viewportRef}\n data-testid={TID.productSliderViewport}\n className=\"flex snap-x gap-5 overflow-x-auto pb-5 [scrollbar-width:thin]\"\n >\n {loading\n ? Array.from({ length: Math.min(limit, 6) }, (_, i) => (\n <div key={i} className=\"h-[360px] min-w-[260px] snap-start animate-pulse bg-muted\" />\n ))\n : visible.map((product) => (\n <div key={product.id} className=\"min-w-[260px] max-w-[300px] flex-[0_0_72vw] snap-start sm:flex-[0_0_300px]\">\n <ProductCardComponent\n product={product}\n config={config}\n commerceMode={config.commerceMode}\n actions={actions}\n />\n </div>\n ))}\n </div>\n {cta && (\n <Link\n to={href ?? config.catalogPath}\n className=\"mt-4 inline-flex border border-foreground/30 px-6 py-3 text-xs font-semibold uppercase tracking-[0.16em] transition hover:bg-foreground hover:text-background\"\n >\n {cta}\n </Link>\n )}\n </section>\n )\n}\n","import React, { useState } from 'react'\nimport { getLucideIcon } from '@fayz-ai/ui/icons'\nimport { bannerPlaceholder } from '../../sections'\nimport { Reveal } from '../../motion'\nimport { Link } from '../../router'\nimport { TID } from '../../testids'\nimport { SmoothImage } from '../SmoothImage'\n\nfunction Icon({ name, className }: { name: string; className?: string }) {\n const C = getLucideIcon(name)\n return C ? <C className={className} /> : null\n}\n\nexport function BenefitsRow({ items }: { items: Array<{ icon: string; title: string; text?: string }> }) {\n return (\n <section data-testid={TID.benefits} className=\"border-y bg-card\">\n <div className=\"mx-auto grid max-w-7xl grid-cols-1 gap-6 px-4 py-9 sm:grid-cols-3 sm:px-6\">\n {items.slice(0, 4).map((item, i) => (\n <Reveal key={i} delay={i * 120} className=\"flex items-center justify-center gap-3 text-center sm:text-left\">\n <span className=\"flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-primary/10\">\n <Icon name={item.icon} className=\"h-6 w-6 text-primary\" />\n </span>\n <div>\n <p className=\"font-semibold\">{item.title}</p>\n {item.text && <p className=\"text-sm text-muted-foreground\">{item.text}</p>}\n </div>\n </Reveal>\n ))}\n </div>\n </section>\n )\n}\n\nexport function PromoBanner({\n title,\n subtitle,\n eyebrow,\n cta,\n href,\n image,\n hue = 160,\n}: {\n title: string\n subtitle?: string\n eyebrow?: string\n cta?: string\n href?: string\n image?: string\n hue?: number\n}) {\n return (\n <section data-testid={TID.promoBanner} className=\"group relative my-12 overflow-hidden\">\n <SmoothImage\n src={image ?? bannerPlaceholder(title, hue, hue + 50, 1600, 420)}\n alt={title}\n className=\"h-80 w-full object-cover transition-transform duration-700 ease-out group-hover:scale-105\"\n />\n <div className=\"absolute inset-0 flex flex-col items-center justify-center bg-gradient-to-t from-black/65 via-black/35 to-black/20 p-6 text-center text-white\">\n <Reveal>\n {eyebrow && (\n <p className=\"mb-2 text-xs font-semibold uppercase tracking-[0.25em] text-white/80\">{eyebrow}</p>\n )}\n <h2 className=\"sf-heading text-3xl font-bold drop-shadow sm:text-5xl\">{title}</h2>\n {subtitle && <p className=\"mt-3 max-w-lg text-white/90\">{subtitle}</p>}\n {cta && (\n <Link\n to={href ?? '/catalog'}\n className=\"sf-cta mt-6 inline-block bg-white px-8 py-3 font-semibold text-gray-900 shadow-lg transition-all hover:-translate-y-0.5 hover:shadow-xl\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n {cta}\n </Link>\n )}\n </Reveal>\n </div>\n </section>\n )\n}\n\nexport function ManifestoBlock({ title, text }: { title?: string; text: string }) {\n return (\n <section data-testid={TID.manifesto} className=\"mx-auto max-w-3xl px-4 py-14 text-center sm:px-6\">\n {title && <h2 className=\"sf-heading mb-5 text-2xl font-bold\">{title}</h2>}\n <p className=\"sf-heading text-xl leading-relaxed text-muted-foreground sm:text-2xl\">{text}</p>\n </section>\n )\n}\n\nexport function Testimonials({ title, items }: { title?: string; items: Array<{ quote: string; author: string }> }) {\n return (\n <section data-testid={TID.testimonials} className=\"bg-muted/50 py-14\">\n <div className=\"mx-auto max-w-7xl px-4 sm:px-6\">\n {title && (\n <Reveal>\n <h2 className=\"sf-heading mb-10 text-center text-3xl font-bold\">{title}</h2>\n </Reveal>\n )}\n <div className=\"grid gap-6 md:grid-cols-3\">\n {items.slice(0, 3).map((t, i) => (\n <Reveal key={i} delay={i * 130}>\n <figure\n className=\"h-full bg-card p-7 shadow-sm transition-shadow hover:shadow-md\"\n style={{ borderRadius: 'var(--sf-radius-card)' }}\n >\n <div className=\"mb-3 text-primary\" aria-hidden>★★★★★</div>\n <blockquote className=\"leading-relaxed\">“{t.quote}”</blockquote>\n <figcaption className=\"mt-4 text-sm font-semibold text-muted-foreground\">— {t.author}</figcaption>\n </figure>\n </Reveal>\n ))}\n </div>\n </div>\n </section>\n )\n}\n\nexport function NewsletterBand({ title, subtitle }: { title?: string; subtitle?: string }) {\n const [email, setEmail] = useState('')\n const [done, setDone] = useState(false)\n return (\n <section data-testid={TID.newsletter} className=\"bg-primary py-16 text-primary-foreground\">\n <Reveal className=\"mx-auto max-w-xl px-4 text-center sm:px-6\">\n <h2 className=\"sf-heading text-3xl font-bold\">{title ?? 'Receba nossas novidades'}</h2>\n {subtitle && <p className=\"mt-2 opacity-90\">{subtitle}</p>}\n {done ? (\n <p data-testid={TID.newsletterDone} className=\"mt-6 font-medium\">Inscrição confirmada! 🎉</p>\n ) : (\n <form\n className=\"mt-6 flex gap-2\"\n onSubmit={(e) => {\n e.preventDefault()\n if (email.trim()) setDone(true)\n }}\n >\n <input\n data-testid={TID.newsletterEmail}\n type=\"email\"\n required\n placeholder=\"Seu e-mail\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n className=\"flex-1 border-0 bg-white/95 px-4 py-3 text-sm text-gray-900 outline-none\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n <button\n type=\"submit\"\n data-testid={TID.newsletterSubmit}\n className=\"sf-cta bg-foreground px-6 py-3 text-sm font-semibold text-background\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n Assinar\n </button>\n </form>\n )}\n </Reveal>\n </section>\n )\n}\n","import { registerBlock } from '@fayz-ai/core'\nimport type { BlockNode } from '@fayz-ai/core'\nimport type { StorefrontSection } from './sections'\nimport { HeroSection } from './components/sections/HeroSection'\nimport { CategoryShowcase } from './components/sections/CategoryShowcase'\nimport { ProductRail } from './components/sections/ProductRail'\nimport { MediaCarousel } from './components/sections/MediaCarousel'\nimport { ProductSlider } from './components/sections/ProductSlider'\nimport {\n BenefitsRow,\n PromoBanner,\n ManifestoBlock,\n Testimonials,\n NewsletterBand,\n} from './components/sections/MiscSections'\n\n// ---------------------------------------------------------------------------\n// Storefront blocks — the section components registered into the universal\n// block registry. This replaces HomePage's hardcoded switch: a home page is now\n// a block tree (`{ type, props }[]`) resolved through the registry, identical\n// to how admin pages will compose. Section prop shapes are unchanged, so the\n// components are registered directly.\n// ---------------------------------------------------------------------------\n\nlet registered = false\n\nexport function registerStorefrontBlocks(): void {\n if (registered) return\n registered = true\n registerBlock('hero', HeroSection, { source: 'sdk', label: 'Hero' })\n registerBlock('mediaCarousel', MediaCarousel, { source: 'sdk', label: 'Media carousel' })\n registerBlock('categories', CategoryShowcase, { source: 'sdk', label: 'Categories' })\n registerBlock('products', ProductRail, { source: 'sdk', label: 'Product rail' })\n registerBlock('productSlider', ProductSlider, { source: 'sdk', label: 'Product slider' })\n registerBlock('benefits', BenefitsRow, { source: 'sdk', label: 'Benefits row' })\n registerBlock('banner', PromoBanner, { source: 'sdk', label: 'Promo banner' })\n registerBlock('manifesto', ManifestoBlock, { source: 'sdk', label: 'Manifesto' })\n registerBlock('testimonials', Testimonials, { source: 'sdk', label: 'Testimonials' })\n registerBlock('newsletter', NewsletterBand, { source: 'sdk', label: 'Newsletter band' })\n}\n\n// Registration happens in initStorefrontRuntime (both the scaffold and\n// createStorefront call it) so importing this module stays side-effect-free.\n\n/** Convert the typed storefront section blueprint into a generic block tree. */\nexport function sectionsToBlocks(sections: readonly StorefrontSection[]): BlockNode[] {\n return sections.map((section, i) => {\n const { type, ...props } = section\n return { type, id: `${type}-${i}`, props: props as Record<string, unknown> }\n })\n}\n","import React, { useEffect } from 'react'\n\n// ---------------------------------------------------------------------------\n// StorefrontTheme — the storefront counterpart of SaasTheme.\n// Personalizes colors (HSL token triplets), typography (Google Fonts pairing),\n// radius and layout properties via CSS custom properties, so every @fayz-ai/ui\n// token class (bg-background, text-primary, ...) picks the brand up for free.\n//\n// Derived from the Nuvemshop template research (docs/storefront-templates-research.md):\n// the personalization axes are palette, font pairing, radius, header treatment,\n// hero style and product-card style.\n// ---------------------------------------------------------------------------\n\nexport type StorefrontRadius = 'none' | 'soft' | 'round' | 'pill'\nexport type HeaderVariant = 'classic' | 'centered' | 'search' | 'minimal'\nexport type HeroVariant = 'banner' | 'split' | 'slider'\nexport type CardStyle = 'card' | 'editorial'\n\nexport interface StorefrontThemeColors {\n /** HSL triplets, e.g. '40 20% 94%' — same convention as SaasTheme */\n background?: string\n foreground?: string\n primary?: string\n primaryForeground?: string\n card?: string\n cardForeground?: string\n muted?: string\n mutedForeground?: string\n border?: string\n /** Header treatment — dark headers (Brasília) set these */\n headerBackground?: string\n headerForeground?: string\n /** Announcement bar */\n announcementBackground?: string\n announcementForeground?: string\n /** Secondary brand accent (e.g. a gourmet gold beside the primary). Emitted\n * as `--sf-accent` / `--sf-accent-foreground` and the `accent` tailwind token. */\n accent?: string\n accentForeground?: string\n}\n\nexport interface StorefrontThemeFont {\n /** Display font for headings, e.g. 'Marcellus' */\n heading: string\n /** Body font, e.g. 'Rubik' */\n body: string\n /** Optional oversized display face for hero words (emitted as `--sf-font-display`). */\n display?: string\n /** Optional serif accent for quotes/editorial (emitted as `--sf-font-serif`). */\n serif?: string\n /** Google Fonts families to load (defaults to heading+body+display+serif) */\n googleFonts?: string[]\n /** Fallback stack — default sans-serif; use 'serif' for editorial themes */\n fallback?: 'sans-serif' | 'serif'\n}\n\nexport interface StorefrontTheme {\n name: string\n colors?: StorefrontThemeColors\n font?: StorefrontThemeFont\n radius?: StorefrontRadius\n /** Layout personality */\n header?: {\n variant?: HeaderVariant\n /** Uppercase nav links (premium retail tone) */\n uppercaseNav?: boolean\n /** Show category shortcuts after primary nav links. Default true. */\n showCategories?: boolean\n /** Show the storefront search in the header. Default true. */\n showSearch?: boolean\n /** Header search presentation: a full input ('full', default) or a compact\n * icon button that expands into an input on click ('icon'). */\n searchStyle?: 'full' | 'icon'\n }\n productCard?: {\n style?: CardStyle\n imageAspect?: 'square' | 'portrait'\n }\n /** Uppercase CTA buttons with letter-spacing (Uyuni/Flex tone) */\n uppercaseButtons?: boolean\n /** Brand-token passthrough. Each entry is emitted verbatim as a `--<key>` CSS\n * custom property, so a store can add gradients, glows, extra colors, or\n * letter-spacing the fixed schema doesn't enumerate — without editing the SDK.\n * e.g. { 'grad-ember': 'linear-gradient(...)', 'glow-ember': '0 0 0 1px ...' }. */\n tokens?: Record<string, string>\n}\n\nconst RADIUS_MAP: Record<StorefrontRadius, { button: string; card: string; input: string }> = {\n none: { button: '0px', card: '0px', input: '0px' },\n soft: { button: '6px', card: '10px', input: '6px' },\n round: { button: '10px', card: '16px', input: '10px' },\n pill: { button: '999px', card: '20px', input: '999px' },\n}\n\nconst COLOR_VAR_MAP: Record<keyof StorefrontThemeColors, string> = {\n background: '--background',\n foreground: '--foreground',\n primary: '--primary',\n primaryForeground: '--primary-foreground',\n card: '--card',\n cardForeground: '--card-foreground',\n muted: '--muted',\n mutedForeground: '--muted-foreground',\n border: '--border',\n headerBackground: '--sf-header-bg',\n headerForeground: '--sf-header-fg',\n announcementBackground: '--sf-announcement-bg',\n announcementForeground: '--sf-announcement-fg',\n accent: '--sf-accent',\n accentForeground: '--sf-accent-foreground',\n}\n\nexport function themeToCss(theme: StorefrontTheme): string {\n const lines: string[] = []\n\n for (const [key, cssVar] of Object.entries(COLOR_VAR_MAP) as [keyof StorefrontThemeColors, string][]) {\n const value = theme.colors?.[key]\n if (value) lines.push(`${cssVar}: ${value};`)\n }\n // Header defaults to the page background unless the theme sets one\n if (!theme.colors?.headerBackground && theme.colors?.background) {\n lines.push(`--sf-header-bg: ${theme.colors.background};`)\n }\n if (!theme.colors?.headerForeground && theme.colors?.foreground) {\n lines.push(`--sf-header-fg: ${theme.colors.foreground};`)\n }\n\n if (theme.font) {\n const fallback = theme.font.fallback ?? 'sans-serif'\n lines.push(`--font-family: '${theme.font.body}', ${fallback};`)\n lines.push(`--sf-font-heading: '${theme.font.heading}', ${fallback};`)\n if (theme.font.display) lines.push(`--sf-font-display: '${theme.font.display}', ${fallback};`)\n if (theme.font.serif) lines.push(`--sf-font-serif: '${theme.font.serif}', serif;`)\n }\n\n // Brand-token passthrough — emit each entry as a raw CSS custom property.\n for (const [key, value] of Object.entries(theme.tokens ?? {})) {\n const name = key.startsWith('--') ? key : `--${key}`\n lines.push(`${name}: ${value};`)\n }\n\n const radius = RADIUS_MAP[theme.radius ?? 'soft']\n lines.push(`--button-radius: ${radius.button};`)\n lines.push(`--card-radius: ${radius.card};`)\n lines.push(`--input-radius: ${radius.input};`)\n lines.push(`--sf-radius-button: ${radius.button};`)\n lines.push(`--sf-radius-card: ${radius.card};`)\n lines.push(`--sf-radius-input: ${radius.input};`)\n\n let css = `:root {\\n ${lines.join('\\n ')}\\n}\\n`\n css += `body { font-family: var(--font-family); }\\n`\n css += `h1, h2, h3, h4, .sf-heading { font-family: var(--sf-font-heading, var(--font-family)); }\\n`\n if (theme.uppercaseButtons) {\n css += `.sf-cta { text-transform: uppercase; letter-spacing: 0.08em; }\\n`\n }\n if (theme.header?.uppercaseNav) {\n css += `.sf-nav-link { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; }\\n`\n }\n return css\n}\n\nfunction googleFontsHref(theme: StorefrontTheme): string | null {\n if (!theme.font) return null\n const families =\n theme.font.googleFonts ??\n [theme.font.heading, theme.font.body, theme.font.display, theme.font.serif].filter(\n (f): f is string => Boolean(f),\n )\n const unique = [...new Set(families)]\n const params = unique\n .map((f) => `family=${encodeURIComponent(f).replace(/%20/g, '+')}:wght@300;400;500;600;700`)\n .join('&')\n return `https://fonts.googleapis.com/css2?${params}&display=swap`\n}\n\n/** Injects theme CSS variables + Google Fonts. Mount once inside the app root. */\nexport function StorefrontThemeStyle({ theme }: { theme: StorefrontTheme }) {\n const fontsHref = googleFontsHref(theme)\n\n useEffect(() => {\n if (!fontsHref) return\n const id = 'sf-theme-fonts'\n let link = document.getElementById(id) as HTMLLinkElement | null\n if (!link) {\n link = document.createElement('link')\n link.id = id\n link.rel = 'stylesheet'\n document.head.appendChild(link)\n }\n link.href = fontsHref\n }, [fontsHref])\n\n return React.createElement('style', { 'data-sf-theme': theme.name }, themeToCss(theme))\n}\n","import React, { useState } from 'react'\nimport { CreditCard, LogOut, Mail, Menu, Package, Phone, Search, ShoppingBag, User, UserCircle, X } from 'lucide-react'\nimport { signOutCustomer } from '../auth'\nimport { useCartStore, selectCount } from '../stores/cart.store'\nimport { useCatalogStore } from '../stores/catalog.store'\nimport { useSessionStore } from '../stores/session.store'\nimport { useCategories } from '../hooks/useCategories'\nimport { useStorefrontConfig } from '../config'\nimport { useScrolled, usePopOnChange } from '../motion'\nimport { Link, navigateTo, useHashPath } from '../router'\nimport { TID } from '../testids'\n\n// Header tokens come from the theme (--sf-header-bg/fg) so dark headers\n// (Brasília pattern) work without component changes. Dividers derive from the\n// header FOREGROUND (not the page --border token, which is light and shows as\n// white lines on dark headers).\nconst headerStyle: React.CSSProperties = {\n backgroundColor: 'hsl(var(--sf-header-bg, var(--background)))',\n color: 'hsl(var(--sf-header-fg, var(--foreground)))',\n borderColor: 'hsl(var(--sf-header-fg, var(--foreground)) / 0.14)',\n}\n\nconst headerDivider: React.CSSProperties = {\n borderColor: 'hsl(var(--sf-header-fg, var(--foreground)) / 0.14)',\n}\n\nconst ANNOUNCEMENT_KEY = 'fayz.storefront.announcement.dismissed'\n\nfunction AnnouncementBar() {\n const config = useStorefrontConfig()\n const [dismissed, setDismissed] = useState(() => {\n try {\n return localStorage.getItem(ANNOUNCEMENT_KEY) === config.announcement\n } catch {\n return false\n }\n })\n if (!config.announcement || dismissed) return null\n\n const dismiss = () => {\n setDismissed(true)\n try {\n localStorage.setItem(ANNOUNCEMENT_KEY, config.announcement ?? '')\n } catch {\n /* storage unavailable — dismiss for this session only */\n }\n }\n\n return (\n <div\n data-testid={TID.announcementBar}\n className=\"relative px-4 py-2 text-center text-xs font-semibold tracking-wide\"\n style={{\n backgroundColor: 'hsl(var(--sf-announcement-bg, var(--primary)))',\n color: 'hsl(var(--sf-announcement-fg, var(--primary-foreground)))',\n }}\n >\n {config.announcement}\n <button\n type=\"button\"\n aria-label=\"Fechar aviso\"\n onClick={dismiss}\n className=\"absolute right-2 top-1/2 -translate-y-1/2 rounded-full p-1 opacity-70 transition-opacity hover:opacity-100\"\n >\n <X className=\"h-3.5 w-3.5\" />\n </button>\n </div>\n )\n}\n\n/** Slim utility strip (Flex pattern): contact on the left, social on the right. */\nfunction UtilityBar() {\n const config = useStorefrontConfig()\n const contact = config.footer?.contact\n const social = config.footer?.social\n if (!contact?.phone && !contact?.email && !social?.length) return null\n return (\n <div className=\"hidden border-b text-xs opacity-80 md:block\" style={headerDivider}>\n <div className=\"mx-auto flex h-8 max-w-7xl items-center gap-5 px-4 sm:px-6\">\n {contact?.phone && (\n <span className=\"inline-flex items-center gap-1.5\">\n <Phone className=\"h-3 w-3\" /> {contact.phone}\n </span>\n )}\n {contact?.email && (\n <span className=\"inline-flex items-center gap-1.5\">\n <Mail className=\"h-3 w-3\" /> {contact.email}\n </span>\n )}\n <span className=\"ml-auto flex items-center gap-4\">\n {social?.map((s) => (\n <a key={s.href} href={s.href} target=\"_blank\" rel=\"noreferrer\" className=\"hover:underline\">\n {s.label}\n </a>\n ))}\n </span>\n </div>\n </div>\n )\n}\n\nfunction SearchInput({ className, iconOnly = false }: { className?: string; iconOnly?: boolean }) {\n const config = useStorefrontConfig()\n const search = useCatalogStore((s) => s.search)\n const setSearch = useCatalogStore((s) => s.setSearch)\n const path = useHashPath()\n const [open, setOpen] = useState(false)\n\n // Icon-only: a compact search button that expands into the input on click and\n // collapses again on Escape / blur-when-empty.\n if (iconOnly && !open) {\n return (\n <button\n type=\"button\"\n aria-label=\"Buscar produtos\"\n data-testid={TID.headerSearchToggle}\n onClick={() => setOpen(true)}\n className=\"rounded-full p-2.5 transition-opacity hover:opacity-70\"\n >\n <Search className=\"h-5 w-5\" />\n </button>\n )\n }\n\n return (\n <div className={`relative ${iconOnly ? 'w-full max-w-xs' : (className ?? '')}`}>\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 opacity-60\" />\n <input\n data-testid={TID.headerSearch}\n type=\"search\"\n placeholder=\"Buscar produtos...\"\n value={search}\n autoFocus={iconOnly}\n onChange={(e) => {\n setSearch(e.target.value)\n if (path !== config.catalogPath) navigateTo(config.catalogPath)\n }}\n onKeyDown={(e) => {\n if (e.key === 'Escape' && iconOnly) setOpen(false)\n }}\n onBlur={() => {\n if (iconOnly && !search) setOpen(false)\n }}\n className=\"w-full border bg-white/10 py-2 pl-9 pr-4 text-sm outline-none transition-colors placeholder:opacity-60 focus:border-primary focus:bg-white focus:text-gray-900\"\n style={{\n borderRadius: 'var(--sf-radius-input)',\n borderColor: 'hsl(var(--sf-header-fg, var(--foreground)) / 0.25)',\n }}\n />\n </div>\n )\n}\n\nfunction HeaderActions({ onMenuClick }: { onMenuClick?: () => void }) {\n const config = useStorefrontConfig()\n const count = useCartStore(selectCount)\n const openDrawer = useCartStore((s) => s.openDrawer)\n const session = useSessionStore()\n const [accountOpen, setAccountOpen] = useState(false)\n const pop = usePopOnChange(count)\n const firstName = session.name?.split(/\\s+/)[0]\n const initial = (firstName ?? session.email ?? 'C').slice(0, 1).toUpperCase()\n return (\n <nav className=\"flex items-center gap-1\">\n {config.features.accounts && (\n <div className=\"relative\">\n {session.email ? (\n <button\n type=\"button\"\n data-testid={TID.accountLink}\n aria-label=\"Abrir menu da conta\"\n aria-expanded={accountOpen}\n onClick={() => setAccountOpen((open) => !open)}\n className=\"flex items-center gap-1.5 rounded-full p-1.5 transition-opacity hover:opacity-80\"\n >\n <span className=\"flex h-8 w-8 items-center justify-center rounded-full bg-primary text-sm font-bold text-primary-foreground\">\n {initial}\n </span>\n {firstName && (\n <span data-testid={TID.accountName} className=\"hidden max-w-24 truncate text-sm font-medium lg:inline\">\n {firstName}\n </span>\n )}\n </button>\n ) : (\n <Link\n to=\"/account\"\n data-testid={TID.accountLink}\n aria-label=\"Minhas compras\"\n className=\"flex items-center gap-1.5 rounded-full p-2.5 transition-opacity hover:opacity-70\"\n >\n <User className=\"h-5 w-5\" />\n </Link>\n )}\n {accountOpen && session.email && (\n <div\n data-testid={TID.accountDropdown}\n className=\"absolute right-0 top-full z-50 mt-3 w-72 overflow-hidden rounded-xl border bg-background text-foreground shadow-xl\"\n >\n <div className=\"border-b p-4\">\n <p className=\"font-semibold\">{session.name || firstName || 'Cliente'}</p>\n <p className=\"truncate text-sm text-muted-foreground\">{session.email}</p>\n </div>\n <div className=\"p-2\">\n <Link to=\"/account\" className=\"flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-semibold hover:bg-muted\">\n <UserCircle className=\"h-4 w-4\" />\n Perfil\n </Link>\n <Link to=\"/account\" className=\"flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-semibold hover:bg-muted\">\n <Package className=\"h-4 w-4\" />\n Meus pedidos\n </Link>\n <Link to=\"/account\" className=\"flex items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-semibold hover:bg-muted\">\n <CreditCard className=\"h-4 w-4\" />\n Pagamentos\n </Link>\n <button\n type=\"button\"\n onClick={() => {\n setAccountOpen(false)\n void signOutCustomer()\n }}\n className=\"flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-sm font-semibold hover:bg-muted\"\n >\n <LogOut className=\"h-4 w-4\" />\n Sair\n </button>\n </div>\n </div>\n )}\n </div>\n )}\n {config.features.cart && (\n <button\n type=\"button\"\n data-testid={TID.cartButton}\n aria-label=\"Carrinho\"\n onClick={openDrawer}\n className=\"relative rounded-full p-2.5 transition-opacity hover:opacity-70\"\n >\n <ShoppingBag className=\"h-5 w-5\" />\n {count > 0 && (\n <span\n data-testid={TID.cartCount}\n className={`absolute -right-0.5 -top-0.5 flex h-5 min-w-5 items-center justify-center rounded-full bg-primary px-1 text-xs font-semibold text-primary-foreground ${\n pop ? 'animate-badge-pop' : ''\n }`}\n >\n {count}\n </span>\n )}\n </button>\n )}\n {onMenuClick && (\n <button\n type=\"button\"\n aria-label=\"Abrir menu\"\n onClick={onMenuClick}\n className=\"relative rounded-full p-2.5 transition-opacity hover:opacity-70 md:hidden\"\n >\n <Menu className=\"h-5 w-5\" />\n </button>\n )}\n </nav>\n )\n}\n\nfunction NavLinks({ className }: { className?: string }) {\n const config = useStorefrontConfig()\n const { categories } = useCategories()\n const setCategoryId = useCatalogStore((s) => s.setCategoryId)\n const showCategories = config.theme?.header?.showCategories !== false\n\n const goCategory = (categoryId: string) => {\n useCatalogStore.getState().reset()\n setCategoryId(categoryId)\n navigateTo(config.catalogPath)\n }\n\n return (\n <nav className={`flex min-w-max items-center gap-6 ${className ?? ''}`}>\n {config.nav.map((link) => (\n <Link\n key={link.to}\n to={link.to}\n data-testid={TID.navLink(link.label)}\n className=\"sf-nav-link text-sm font-medium transition-opacity hover:opacity-70\"\n >\n {link.label}\n </Link>\n ))}\n {showCategories &&\n categories.slice(0, 6).map((c) => (\n <button\n key={c.id}\n type=\"button\"\n data-testid={TID.navCategory(c.slug)}\n onClick={() => goCategory(c.id)}\n className=\"sf-nav-link group relative hidden text-sm font-medium transition-opacity hover:opacity-80 lg:inline\"\n >\n {c.name}\n <span className=\"absolute -bottom-1 left-0 h-0.5 w-0 bg-primary transition-all duration-300 group-hover:w-full\" />\n </button>\n ))}\n </nav>\n )\n}\n\nfunction MobileMenuDrawer({ open, onClose }: { open: boolean; onClose: () => void }) {\n const config = useStorefrontConfig()\n const { categories } = useCategories()\n const setCategoryId = useCatalogStore((s) => s.setCategoryId)\n const showCategories = config.theme?.header?.showCategories !== false\n\n const goCategory = (categoryId: string) => {\n useCatalogStore.getState().reset()\n setCategoryId(categoryId)\n navigateTo(config.catalogPath)\n onClose()\n }\n\n // a11y: close on Escape\n React.useEffect(() => {\n if (!open) return\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') onClose()\n }\n document.addEventListener('keydown', onKey)\n return () => document.removeEventListener('keydown', onKey)\n }, [open, onClose])\n\n if (!open) return null\n\n return (\n <div className=\"fixed inset-0 z-50 md:hidden\">\n <div\n className=\"absolute inset-0 animate-fade-in bg-black/40\"\n aria-hidden\n onClick={onClose}\n />\n <div\n data-testid=\"mobile-menu-drawer\"\n role=\"dialog\"\n aria-label=\"Menu Principal\"\n className=\"absolute right-0 top-0 flex h-full w-full max-w-[280px] animate-slide-in-from-right flex-col bg-background shadow-2xl\"\n >\n <div className=\"flex items-center justify-between border-b px-5 py-4\">\n <h2 className=\"text-lg font-semibold\">Menu</h2>\n <button\n type=\"button\"\n aria-label=\"Fechar menu\"\n onClick={onClose}\n className=\"rounded-full p-1.5 hover:bg-muted\"\n >\n <X className=\"h-5 w-5\" />\n </button>\n </div>\n <div className=\"flex-1 overflow-y-auto p-5\">\n <nav className=\"flex flex-col gap-4\">\n {config.nav.map((link) => (\n <Link\n key={link.to}\n to={link.to}\n onClick={onClose}\n className=\"text-base font-semibold transition-opacity hover:opacity-70\"\n >\n {link.label}\n </Link>\n ))}\n {showCategories && categories.length > 0 && (\n <>\n <div className=\"my-2 border-t\" />\n <div className=\"mb-2 text-xs font-bold uppercase tracking-wider text-muted-foreground\">\n Categorias\n </div>\n {categories.map((c) => (\n <button\n key={c.id}\n type=\"button\"\n onClick={() => goCategory(c.id)}\n className=\"text-left text-sm font-medium transition-opacity hover:opacity-80\"\n >\n {c.name}\n </button>\n ))}\n </>\n )}\n </nav>\n </div>\n </div>\n </div>\n )\n}\n\nexport function StorefrontHeader() {\n const config = useStorefrontConfig()\n const variant = config.theme?.header?.variant ?? 'classic'\n const scrolled = useScrolled()\n const showSearch = config.theme?.header?.showSearch !== false\n const iconSearch = config.theme?.header?.searchStyle === 'icon'\n const [mobileMenuOpen, setMobileMenuOpen] = useState(false)\n const logo = (\n <Link to=\"/\" className=\"sf-heading shrink-0 text-xl font-bold tracking-tight\">\n {config.logo ?? config.name}\n </Link>\n )\n\n return (\n <header\n className={`sticky top-0 z-40 border-b transition-shadow duration-300 ${scrolled ? 'shadow-md' : ''}`}\n style={headerStyle}\n >\n <AnnouncementBar />\n <UtilityBar />\n\n {variant === 'centered' ? (\n // Rio/Flex pattern: centered logo row, nav row below\n <>\n <div className=\"mx-auto grid h-16 max-w-7xl grid-cols-[1fr_auto_1fr] items-center px-4 sm:px-6\">\n {showSearch ? <SearchInput iconOnly={iconSearch} className=\"hidden w-full max-w-xs sm:block\" /> : <div />}\n <div className=\"text-center\">{logo}</div>\n <div className=\"justify-self-end\">\n <HeaderActions />\n </div>\n </div>\n <div className=\"flex overflow-x-auto border-t py-2.5 sm:justify-center\" style={headerDivider}>\n <NavLinks />\n </div>\n </>\n ) : variant === 'search' ? (\n // Brasília pattern: prominent search left, logo center, actions right; nav row below\n <>\n <div className=\"mx-auto grid h-16 max-w-7xl grid-cols-[1fr_auto_1fr] items-center gap-6 px-4 sm:px-6\">\n {showSearch ? <SearchInput iconOnly={iconSearch} className=\"hidden w-full max-w-sm sm:block\" /> : <div />}\n <div className=\"text-center\">{logo}</div>\n <div className=\"justify-self-end\">\n <HeaderActions />\n </div>\n </div>\n <div className=\"overflow-x-auto border-t\" style={headerDivider}>\n <div className=\"mx-auto max-w-7xl px-4 py-2.5 sm:px-6\">\n <NavLinks />\n </div>\n </div>\n </>\n ) : variant === 'minimal' ? (\n // Uyuni pattern: nav left, centered logo, actions right — single compact row\n <div className=\"mx-auto grid h-16 max-w-7xl grid-cols-[1fr_auto_1fr] items-center px-4 sm:px-6\">\n <div className=\"flex items-center gap-5\">\n <NavLinks className=\"hidden sm:flex\" />\n </div>\n <div className=\"text-center\">{logo}</div>\n <div className=\"flex items-center justify-end gap-3\">\n {showSearch && <SearchInput iconOnly={iconSearch} className=\"hidden w-44 lg:block\" />}\n <HeaderActions />\n </div>\n </div>\n ) : (\n // classic: logo left, nav, then a right-aligned search + actions cluster.\n // NavLinks is hidden below md in the primary row (no room for it there) —\n // below md a hamburger opens MobileMenuDrawer instead, otherwise mobile\n // has no way to reach nav/category links at all.\n <>\n <div className=\"mx-auto flex h-16 max-w-7xl items-center gap-6 px-4 sm:px-6\">\n {logo}\n <NavLinks className=\"hidden md:flex\" />\n <div className=\"ml-auto flex items-center gap-2 sm:gap-3\">\n {showSearch && <SearchInput iconOnly={iconSearch} className={iconSearch ? '' : 'hidden w-full max-w-sm sm:block'} />}\n <HeaderActions onMenuClick={() => setMobileMenuOpen(true)} />\n </div>\n </div>\n <MobileMenuDrawer open={mobileMenuOpen} onClose={() => setMobileMenuOpen(false)} />\n </>\n )}\n </header>\n )\n}\n","import React from 'react'\nimport { useStorefrontConfig } from '../config'\nimport { useCategories } from '../hooks/useCategories'\nimport { useCatalogStore } from '../stores/catalog.store'\nimport { Link, navigateTo } from '../router'\n\nexport function StorefrontFooter() {\n const config = useStorefrontConfig()\n const { categories } = useCategories()\n const visibleCategories = categories.slice(0, 8)\n const hiddenCategoryCount = Math.max(categories.length - visibleCategories.length, 0)\n const labels = {\n categories: 'Departamentos',\n navigation: 'Navegação',\n contact: 'Contato',\n viewAll: 'Ver todos',\n purchases: 'Minhas compras',\n privacy: 'Privacidade',\n terms: 'Termos',\n returns: 'Trocas e devoluções',\n ...config.footer?.labels,\n }\n\n const goCategory = (categoryId: string) => {\n useCatalogStore.getState().reset()\n useCatalogStore.getState().setCategoryId(categoryId)\n navigateTo(config.catalogPath)\n }\n\n return (\n <footer className=\"mt-16 border-t bg-card\">\n <div className=\"mx-auto grid max-w-7xl gap-10 px-4 py-12 sm:grid-cols-2 sm:px-6 lg:grid-cols-4\">\n <div>\n <p className=\"sf-heading text-lg font-bold\">{config.name}</p>\n {config.footer?.about && (\n <p className=\"mt-3 text-sm leading-relaxed text-muted-foreground\">{config.footer.about}</p>\n )}\n </div>\n\n <div>\n <h3 className=\"mb-3 text-sm font-semibold uppercase tracking-wide text-muted-foreground\">{labels.categories}</h3>\n <ul className=\"space-y-2 text-sm\">\n {visibleCategories.map((c) => (\n <li key={c.id}>\n <button\n type=\"button\"\n onClick={() => goCategory(c.id)}\n className=\"max-w-full truncate text-left transition-opacity hover:opacity-70\"\n >\n {c.name}\n </button>\n </li>\n ))}\n {hiddenCategoryCount > 0 && (\n <li>\n <Link to={config.catalogPath} className=\"font-medium underline-offset-2 transition-opacity hover:underline\">\n {labels.viewAll} ({categories.length})\n </Link>\n </li>\n )}\n </ul>\n </div>\n\n <div>\n <h3 className=\"mb-3 text-sm font-semibold uppercase tracking-wide text-muted-foreground\">{labels.navigation}</h3>\n <ul className=\"space-y-2 text-sm\">\n {config.nav.map((link) => (\n <li key={link.to}>\n <Link to={link.to} className=\"transition-opacity hover:opacity-70\">{link.label}</Link>\n </li>\n ))}\n {config.features.accounts && (\n <li>\n <Link to=\"/account\" className=\"transition-opacity hover:opacity-70\">{labels.purchases}</Link>\n </li>\n )}\n </ul>\n </div>\n\n <div>\n <h3 className=\"mb-3 text-sm font-semibold uppercase tracking-wide text-muted-foreground\">{labels.contact}</h3>\n <ul className=\"space-y-2 text-sm text-muted-foreground\">\n {config.footer?.contact?.phone && <li>{config.footer.contact.phone}</li>}\n {config.footer?.contact?.email && <li>{config.footer.contact.email}</li>}\n {config.footer?.contact?.address && <li>{config.footer.contact.address}</li>}\n {config.footer?.social?.map((s) => (\n <li key={s.href}>\n <a href={s.href} target=\"_blank\" rel=\"noreferrer\" className=\"transition-opacity hover:opacity-70\">\n {s.label}\n </a>\n </li>\n ))}\n </ul>\n </div>\n </div>\n <div className=\"border-t\">\n <div className=\"mx-auto flex max-w-7xl flex-col items-center gap-3 px-4 py-5 text-xs text-muted-foreground sm:flex-row sm:justify-between sm:px-6\">\n <nav className=\"flex flex-wrap items-center justify-center gap-x-5 gap-y-2\">\n <Link to=\"/privacy\" className=\"transition-colors hover:text-foreground\">{labels.privacy}</Link>\n <Link to=\"/terms\" className=\"transition-colors hover:text-foreground\">{labels.terms}</Link>\n <Link to=\"/refunds\" className=\"transition-colors hover:text-foreground\">{labels.returns}</Link>\n </nav>\n <p className=\"text-center\">\n {config.footer?.credit ?? <>© {config.name} — powered by Fayz</>}\n </p>\n </div>\n </div>\n </footer>\n )\n}\n","import { useCallback } from 'react'\nimport { validateDiscount } from '@fayz-ai/shop'\nimport { useStorefrontConfig } from '../config'\n\nexport interface DiscountValidation {\n valid: boolean\n percent: number\n message?: string\n}\n\nconst REASON_MESSAGE: Record<string, string> = {\n expired: 'Cupom expirado.',\n not_started: 'Cupom ainda não está ativo.',\n usage_limit: 'Cupom esgotado.',\n not_found: 'Cupom inválido ou expirado.',\n}\n\n/**\n * Storefront coupon validator. The store's own config.discounts (simple percent\n * codes) are trusted directly; everything else goes through the provider-backed\n * validateDiscount primitive, which enforces status/date-window/usage-limit.\n * The storefront cart models discounts as a percentage, so non-percentage codes\n * are rejected for client-side preview (the server still honors them at checkout).\n */\nexport function useDiscountValidator(): (code: string) => Promise<DiscountValidation> {\n const config = useStorefrontConfig()\n return useCallback(async (code: string) => {\n const normalized = code.trim().toUpperCase()\n if (!normalized) return { valid: false, percent: 0, message: 'Informe um cupom.' }\n\n const configDiscount = config.discounts?.find((d) => d.code.trim().toUpperCase() === normalized)\n if (configDiscount) return { valid: true, percent: configDiscount.percent }\n\n const validation = await validateDiscount({ code: normalized })\n if (!validation.valid) {\n return { valid: false, percent: 0, message: REASON_MESSAGE[validation.reason ?? 'not_found'] ?? 'Cupom inválido ou expirado.' }\n }\n if (validation.type !== 'percentage') {\n return { valid: false, percent: 0, message: 'Este cupom não é suportado na loja.' }\n }\n return { valid: true, percent: validation.value }\n }, [config.discounts])\n}\n","import { create } from 'zustand'\n\nexport type ToastVariant = 'success' | 'error' | 'info'\n\nexport interface Toast {\n id: string\n title: string\n description?: string\n variant: ToastVariant\n durationMs: number\n}\n\ninterface ToastState {\n toasts: Toast[]\n push(input: { title: string; description?: string; variant?: ToastVariant; durationMs?: number }): string\n dismiss(id: string): void\n}\n\nlet seq = 0\n\nexport const useToastStore = create<ToastState>((set) => ({\n toasts: [],\n push: (input) => {\n const id = `toast-${++seq}-${Date.now()}`\n const toast: Toast = {\n id,\n title: input.title,\n description: input.description,\n variant: input.variant ?? 'info',\n durationMs: input.durationMs ?? 3400,\n }\n set((s) => ({ toasts: [...s.toasts, toast] }))\n return id\n },\n dismiss: (id) => set((s) => ({ toasts: s.toasts.filter((t) => t.id !== id) })),\n}))\n\n/** Imperative toast API — callable from components, store actions, or workflows. */\nexport const toast = {\n success: (title: string, description?: string) => useToastStore.getState().push({ title, description, variant: 'success' }),\n error: (title: string, description?: string) => useToastStore.getState().push({ title, description, variant: 'error' }),\n info: (title: string, description?: string) => useToastStore.getState().push({ title, description, variant: 'info' }),\n}\n","import React from 'react'\nimport { Minus, Plus } from 'lucide-react'\n\nexport interface QuantityInputProps {\n value: number\n onChange(next: number): void\n min?: number\n max?: number\n testId?: string\n incTestId?: string\n decTestId?: string\n}\n\nexport function QuantityInput({ value, onChange, min = 1, max, testId, incTestId, decTestId }: QuantityInputProps) {\n const clamp = (n: number) => Math.max(min, max != null ? Math.min(n, max) : n)\n return (\n <div className=\"inline-flex items-center rounded-lg border\">\n <button\n type=\"button\"\n data-testid={decTestId}\n aria-label=\"Diminuir quantidade\"\n onClick={() => onChange(clamp(value - 1))}\n className=\"px-2.5 py-1.5 text-muted-foreground hover:text-foreground disabled:opacity-40\"\n disabled={value <= min}\n >\n <Minus className=\"h-3.5 w-3.5\" />\n </button>\n <input\n data-testid={testId}\n type=\"number\"\n value={value}\n min={min}\n max={max}\n onChange={(e) => {\n const n = parseInt(e.target.value, 10)\n if (!isNaN(n)) onChange(clamp(n))\n }}\n className=\"w-12 border-x bg-transparent py-1.5 text-center text-sm [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none\"\n />\n <button\n type=\"button\"\n data-testid={incTestId}\n aria-label=\"Aumentar quantidade\"\n onClick={() => onChange(clamp(value + 1))}\n className=\"px-2.5 py-1.5 text-muted-foreground hover:text-foreground disabled:opacity-40\"\n disabled={max != null && value >= max}\n >\n <Plus className=\"h-3.5 w-3.5\" />\n </button>\n </div>\n )\n}\n","import React, { useState } from 'react'\nimport { MapPin, Truck } from 'lucide-react'\nimport { formatPostalCode } from '@fayz-ai/core'\nimport { useDeliveryStore, resolveOptionRate } from '../stores/delivery.store'\nimport { useCartStore, selectSubtotal } from '../stores/cart.store'\nimport { useStorefrontConfig } from '../config'\nimport { formatMoney } from '../format'\nimport { TID } from '../testids'\n\n/**\n * \"Do you deliver to me, for how much, and when\" — asked on the product page,\n * before the shopper has invested anything in a cart.\n *\n * The CEP is kept in the delivery store, so the answer follows them to the cart\n * and lands at checkout with street/district/city/UF already filled. That is\n * the actual payoff: the buyer types a house number instead of an address.\n *\n * `subtotal` is the PRE-discount cart subtotal, the same number shop_place_order\n * uses to resolve free-above thresholds. Quoting against anything else is how\n * the cart and the order end up disagreeing (see migration 0017).\n */\nexport function DeliveryEstimator({ compact = false }: { compact?: boolean }) {\n const config = useStorefrontConfig()\n const cart = useCartStore()\n const delivery = useDeliveryStore()\n const [draft, setDraft] = useState(() => formatPostalCode(delivery.postalCode))\n\n const subtotal = selectSubtotal(cart)\n const money = (value: number) => formatMoney(value, config.currency, config.locale)\n const loading = delivery.status === 'loading'\n\n async function submit(event: React.FormEvent) {\n event.preventDefault()\n await delivery.resolve(draft, subtotal)\n }\n\n function eta(option: { etaMinDays?: number; etaMaxDays?: number }): string | null {\n const { etaMinDays: min, etaMaxDays: max } = option\n if (min == null && max == null) return null\n if (min === 0 && (max === 0 || max === 1)) return 'hoje ou amanhã'\n if (min != null && max != null && min !== max) return `${min} a ${max} dias úteis`\n return `${max ?? min} dia(s) útil(eis)`\n }\n\n return (\n <section\n data-testid={TID.deliveryEstimator}\n className={compact ? 'rounded-lg border p-3' : 'mt-6 rounded-lg border p-4'}\n >\n <div className=\"flex items-center gap-2 text-sm font-semibold\">\n <Truck className=\"h-4 w-4 text-primary\" />\n Calcular entrega\n </div>\n\n <form onSubmit={submit} className=\"mt-3 flex gap-2\">\n <input\n data-testid={TID.deliveryCepInput}\n aria-label=\"CEP\"\n inputMode=\"numeric\"\n autoComplete=\"postal-code\"\n placeholder=\"00000-000\"\n value={draft}\n onChange={(event) => setDraft(formatPostalCode(event.target.value))}\n className=\"min-w-0 flex-1 rounded-lg border bg-background px-3 py-2 text-sm outline-none transition focus:border-primary focus:ring-2 focus:ring-primary/10\"\n />\n <button\n type=\"submit\"\n data-testid={TID.deliveryCepSubmit}\n disabled={loading}\n className=\"shrink-0 rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground transition hover:opacity-90 disabled:opacity-50\"\n >\n {loading ? '...' : 'Calcular'}\n </button>\n </form>\n\n {/* Shown whenever there is one, including alongside a price: the range\n may be covered even though the CEP itself was mistyped. */}\n {delivery.error && (\n <p data-testid={TID.deliveryError} className=\"mt-3 text-sm text-destructive\">\n {delivery.error}\n </p>\n )}\n\n {delivery.address && (\n <p data-testid={TID.deliveryAddress} className=\"mt-3 flex items-start gap-1.5 text-xs text-muted-foreground\">\n <MapPin className=\"mt-0.5 h-3.5 w-3.5 shrink-0\" />\n <span>\n {[delivery.address.street, delivery.address.district].filter(Boolean).join(', ')}\n {delivery.address.street || delivery.address.district ? ' — ' : ''}\n {delivery.address.city}/{delivery.address.state}\n </span>\n </p>\n )}\n\n {delivery.status === 'served' && (\n <ul className=\"mt-3 space-y-2\">\n {delivery.options.map((option) => {\n const selected = delivery.selectedZoneId === option.zoneId\n const label = eta(option)\n // Resolved for the cart as it stands right now, not for whatever it\n // held when the CEP was typed — the same rule the server applies.\n const rate = resolveOptionRate(option, subtotal)\n return (\n <li key={option.zoneId}>\n <button\n type=\"button\"\n data-testid={TID.deliveryOption}\n data-zone={option.zoneId}\n data-rate={rate.toFixed(2)}\n aria-pressed={selected}\n onClick={() => delivery.selectZone(option.zoneId)}\n className={`flex w-full items-center justify-between gap-3 rounded-lg border px-3 py-2 text-left text-sm transition ${\n selected ? 'border-primary bg-primary/5' : 'border-border hover:bg-muted/40'\n }`}\n >\n <span className=\"min-w-0\">\n <span className=\"block truncate font-medium\">\n {option.carrier ? `${option.carrier} · ${option.name}` : option.name}\n </span>\n {label && <span className=\"block text-xs text-muted-foreground\">{label}</span>}\n </span>\n <span className=\"shrink-0 font-semibold\">\n {rate === 0 ? 'Grátis' : money(rate)}\n </span>\n </button>\n </li>\n )\n })}\n </ul>\n )}\n\n {/*\n No options for a valid address. For a store that configured zones this\n means \"outside our delivery area\" and checkout will refuse the order, so\n it is said plainly here rather than at the end of the funnel. A store\n with no zones at all never reaches this state — it quotes nothing and\n keeps its flat rate.\n */}\n {delivery.status === 'unserved' && (\n <p data-testid={TID.deliveryUnserved} className=\"mt-3 text-sm text-destructive\">\n Ainda não entregamos nesse CEP.\n </p>\n )}\n\n {delivery.postalCode && (\n <button\n type=\"button\"\n data-testid={TID.deliveryClear}\n onClick={() => { delivery.clear(); setDraft('') }}\n className=\"mt-3 text-xs text-muted-foreground underline-offset-2 hover:underline\"\n >\n Trocar CEP\n </button>\n )}\n </section>\n )\n}\n","import React, { useEffect, useState } from 'react'\nimport { X, Trash2 } from 'lucide-react'\nimport {\n useCartStore,\n selectSubtotal,\n selectDiscountTotal,\n selectShipping,\n selectTotal,\n} from '../stores/cart.store'\nimport { useDiscountValidator } from '../hooks/useDiscountValidator'\nimport { toast } from '../stores/toast.store'\nimport { getStorefrontComponents, useStorefrontConfig } from '../config'\nimport { navigateTo } from '../router'\nimport { formatMoney } from '../format'\nimport { QuantityInput } from './QuantityInput'\nimport { formatPostalCode } from '@fayz-ai/core'\nimport { useDeliveryStore } from '../stores/delivery.store'\nimport { DeliveryEstimator } from './DeliveryEstimator'\nimport { TID } from '../testids'\nimport { SmoothImage } from './SmoothImage'\n\nexport function CartDrawer() {\n const config = useStorefrontConfig()\n const cart = useCartStore()\n const components = getStorefrontComponents(config)\n const FooterExtra = components.CartDrawerFooterExtra\n const validate = useDiscountValidator()\n const [code, setCode] = useState('')\n const [discountError, setDiscountError] = useState<string | null>(null)\n const [applying, setApplying] = useState(false)\n\n // a11y: close on Escape while the drawer is open.\n useEffect(() => {\n if (!cart.isOpen) return\n const onKey = (e: KeyboardEvent) => {\n if (e.key === 'Escape') cart.closeDrawer()\n }\n document.addEventListener('keydown', onKey)\n return () => document.removeEventListener('keydown', onKey)\n }, [cart.isOpen, cart.closeDrawer])\n\n // Subscribed, not just read: selectShipping consults this store through\n // getState(), which does not subscribe, so without this hook a fresh quote\n // would change the price and leave the drawer showing the old one.\n const delivery = useDeliveryStore()\n\n const subtotal = selectSubtotal(cart)\n const discountTotal = selectDiscountTotal(cart)\n const shipping = selectShipping(cart, config)\n\n const total = selectTotal(cart, config)\n const money = (v: number) => formatMoney(v, config.currency, config.locale)\n\n async function applyCode() {\n setApplying(true)\n setDiscountError(null)\n try {\n const result = await validate(code)\n if (result.valid) {\n const applied = code.trim().toUpperCase()\n cart.applyDiscount(applied, result.percent)\n setCode('')\n toast.success('Cupom aplicado!', `${applied} • ${result.percent}% de desconto`)\n } else {\n setDiscountError(result.message ?? 'Cupom inválido.')\n toast.error('Cupom inválido', result.message ?? 'Verifique o código e tente novamente.')\n }\n } finally {\n setApplying(false)\n }\n }\n\n if (!cart.isOpen) return null\n\n // Free-shipping nudge: how far from the threshold this cart is\n const freeAbove = config.shipping.freeAbove\n const missingForFree = freeAbove != null && subtotal < freeAbove ? freeAbove - subtotal : 0\n const progress = freeAbove != null ? Math.min(100, (subtotal / freeAbove) * 100) : 0\n\n return (\n <div className=\"fixed inset-0 z-50\">\n <div\n className=\"absolute inset-0 animate-fade-in bg-black/40\"\n aria-hidden\n onClick={cart.closeDrawer}\n />\n <div\n data-testid={TID.cartDrawer}\n role=\"dialog\"\n aria-label=\"Carrinho\"\n className=\"absolute right-0 top-0 flex h-full w-full max-w-md animate-slide-in-from-right flex-col bg-background shadow-2xl\"\n >\n <div className=\"flex items-center justify-between border-b px-5 py-4\">\n <h2 className=\"text-lg font-semibold\">Carrinho</h2>\n <button\n type=\"button\"\n aria-label=\"Fechar carrinho\"\n onClick={cart.closeDrawer}\n className=\"rounded-full p-1.5 hover:bg-muted\"\n >\n <X className=\"h-5 w-5\" />\n </button>\n </div>\n\n {cart.lines.length === 0 ? (\n <div data-testid={TID.cartEmpty} className=\"flex flex-1 items-center justify-center p-8 text-center text-muted-foreground\">\n Seu carrinho está vazio.\n </div>\n ) : (\n <>\n {freeAbove != null && (\n <div data-testid={TID.shippingProgress} className=\"border-b bg-muted/40 px-5 py-3\">\n <p className=\"text-xs font-medium\">\n {missingForFree > 0 ? (\n <>Faltam <strong>{money(missingForFree)}</strong> para frete grátis 🚚</>\n ) : (\n <>🎉 Você ganhou <strong>frete grátis</strong>!</>\n )}\n </p>\n <div className=\"mt-2 h-1.5 overflow-hidden rounded-full bg-border\">\n <div\n className=\"h-full rounded-full bg-primary transition-all duration-500 ease-out\"\n style={{ width: `${progress}%` }}\n />\n </div>\n </div>\n )}\n <div className=\"flex-1 space-y-4 overflow-y-auto px-5 py-4\">\n {cart.lines.map((line) => (\n <div\n key={line.lineId ?? line.productId}\n data-testid={TID.cartLine}\n data-product-id={line.productId}\n data-line-id={line.lineId ?? line.productId}\n className={`flex animate-fade-up gap-3 rounded-lg p-1.5 transition-all hover:bg-muted/40 ${\n (line.lineId ?? line.productId) === cart.justAddedLineId\n ? 'bg-primary/5 ring-1 ring-primary/30'\n : ''\n }`}\n >\n {line.imageUrl && (\n <SmoothImage src={line.imageUrl} alt={line.name} className=\"h-20 w-20 shrink-0 rounded-lg border object-cover\" />\n )}\n <div className=\"flex flex-1 flex-col\">\n <div className=\"flex items-start justify-between gap-2\">\n <span className=\"text-sm font-medium leading-snug\">{line.name}</span>\n <button\n type=\"button\"\n data-testid={TID.lineRemove}\n aria-label={`Remover ${line.name}`}\n onClick={() => cart.removeItem(line.lineId ?? line.productId)}\n className=\"text-muted-foreground hover:text-destructive\"\n >\n <Trash2 className=\"h-4 w-4\" />\n </button>\n </div>\n <span className=\"text-xs text-muted-foreground\">{line.sku}</span>\n {line.optionsLabel && (\n <span className=\"text-xs text-muted-foreground\">{line.optionsLabel}</span>\n )}\n <div className=\"mt-auto flex items-center justify-between pt-2\">\n <QuantityInput\n value={line.quantity}\n max={line.maxQuantity || undefined}\n onChange={(n) => cart.setQuantity(line.lineId ?? line.productId, n)}\n testId={TID.lineQty}\n incTestId={TID.lineInc}\n decTestId={TID.lineDec}\n />\n <span\n className=\"text-sm font-semibold\"\n data-price={(line.unitPrice * line.quantity).toFixed(2)}\n >\n {money(line.unitPrice * line.quantity)}\n </span>\n </div>\n </div>\n </div>\n ))}\n </div>\n\n <div className=\"space-y-3 border-t px-5 py-4\">\n {config.features.discounts && (\n <div className=\"space-y-1\">\n <div className=\"flex gap-2\">\n <input\n data-testid={TID.discountInput}\n type=\"text\"\n placeholder=\"Cupom de desconto\"\n value={code}\n onChange={(e) => setCode(e.target.value)}\n className=\"flex-1 rounded-lg border bg-background px-3 py-2 text-sm uppercase\"\n />\n <button\n type=\"button\"\n data-testid={TID.discountApply}\n onClick={applyCode}\n disabled={applying || !code.trim()}\n className=\"rounded-lg border px-3 py-2 text-sm font-medium hover:bg-muted disabled:opacity-50\"\n >\n Aplicar\n </button>\n </div>\n {discountError && (\n <p data-testid={TID.discountError} className=\"text-xs text-destructive\">\n {discountError}\n </p>\n )}\n </div>\n )}\n\n {/* Second chance to give a CEP for anyone who added to cart from\n the catalogue and never opened a product page. */}\n <div className=\"mb-3\">\n <DeliveryEstimator compact />\n </div>\n\n <dl className=\"space-y-1.5 text-sm\">\n <div className=\"flex justify-between\">\n <dt className=\"text-muted-foreground\">Subtotal</dt>\n <dd data-testid={TID.cartSubtotal} data-price={subtotal.toFixed(2)}>{money(subtotal)}</dd>\n </div>\n {discountTotal > 0 && (\n <div className=\"flex justify-between text-emerald-700\" data-testid={TID.discountRow}>\n <dt>\n Desconto{' '}\n <button\n type=\"button\"\n onClick={cart.clearDiscount}\n className=\"text-xs text-muted-foreground underline\"\n >\n ({cart.discountCode} ✕)\n </button>\n </dt>\n <dd data-price={discountTotal.toFixed(2)}>−{money(discountTotal)}</dd>\n </div>\n )}\n <div className=\"flex justify-between\">\n <dt className=\"text-muted-foreground\">\n Frete\n {delivery.status === 'served' && delivery.postalCode && (\n <span className=\"ml-1 text-xs\">\n · {formatPostalCode(delivery.postalCode)}\n </span>\n )}\n </dt>\n <dd data-testid={TID.cartShipping} data-price={shipping.toFixed(2)}>\n {shipping === 0 ? 'Grátis' : money(shipping)}\n </dd>\n </div>\n <div className=\"flex justify-between border-t pt-2 text-base font-semibold\">\n <dt>Total</dt>\n <dd data-testid={TID.cartTotal} data-price={total.toFixed(2)}>{money(total)}</dd>\n </div>\n </dl>\n\n <button\n type=\"button\"\n data-testid={TID.goCheckout}\n onClick={() => {\n cart.closeDrawer()\n navigateTo('/checkout')\n }}\n className=\"sf-cta w-full bg-primary py-3.5 font-semibold text-primary-foreground shadow-md transition-all hover:-translate-y-0.5 hover:shadow-lg\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n Finalizar compra\n </button>\n\n {FooterExtra && (\n <FooterExtra cart={cart} config={config} commerceMode={config.commerceMode} />\n )}\n </div>\n </>\n )}\n </div>\n </div>\n )\n}\n","import React from 'react'\nimport type { Product } from '@fayz-ai/shop/types'\nimport { ProductCard } from './ProductCard'\nimport { getStorefrontComponents, useStorefrontConfig } from '../config'\nimport { useStorefrontActions } from '../hooks/useStorefront'\nimport { TID } from '../testids'\n\nexport function ProductGrid({ products, loading }: { products: Product[]; loading: boolean }) {\n const config = useStorefrontConfig()\n const actions = useStorefrontActions()\n const components = getStorefrontComponents(config)\n const ProductCardComponent = components.ProductCard ?? ProductCard\n\n if (loading) {\n return (\n <div data-testid={TID.productGrid} className=\"grid grid-cols-2 gap-5 md:grid-cols-3 xl:grid-cols-4\">\n {Array.from({ length: 8 }, (_, i) => (\n <div key={i} className=\"aspect-[3/4] animate-pulse rounded-xl bg-muted\" />\n ))}\n </div>\n )\n }\n if (products.length === 0) {\n return (\n <div data-testid={TID.productGrid} className=\"py-20 text-center text-muted-foreground\">\n Nenhum produto encontrado.\n </div>\n )\n }\n return (\n <div data-testid={TID.productGrid} className=\"grid grid-cols-2 gap-5 md:grid-cols-3 xl:grid-cols-4\">\n {products.map((p) => (\n <ProductCardComponent\n key={p.id}\n product={p}\n config={config}\n commerceMode={config.commerceMode}\n actions={actions}\n />\n ))}\n </div>\n )\n}\n","import React from 'react'\nimport { useCatalogStore } from '../stores/catalog.store'\nimport type { CatalogSort } from '../stores/catalog.store'\nimport { useCategories } from '../hooks/useCategories'\nimport { TID } from '../testids'\n\nexport function FiltersPanel() {\n const { categories } = useCategories()\n const catalog = useCatalogStore()\n\n return (\n <aside className=\"w-full shrink-0 space-y-6 lg:w-56\">\n {/* Sort */}\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold\">Ordenar por</h3>\n <select\n data-testid={TID.sortSelect}\n value={catalog.sort}\n onChange={(e) => catalog.setSort(e.target.value as CatalogSort)}\n className=\"w-full rounded-lg border bg-background px-3 py-2 text-sm\"\n >\n <option value=\"newest\">Mais recentes</option>\n <option value=\"price-asc\">Menor preço</option>\n <option value=\"price-desc\">Maior preço</option>\n <option value=\"name\">Nome (A–Z)</option>\n </select>\n </div>\n\n {/* Categories */}\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold\">Categorias</h3>\n <ul className=\"space-y-1\">\n <li>\n <button\n type=\"button\"\n onClick={() => catalog.setCategoryId(null)}\n className={`w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors ${\n catalog.categoryId === null ? 'bg-primary/10 font-medium text-primary' : 'hover:bg-muted'\n }`}\n >\n Todas\n </button>\n </li>\n {categories.map((c) => (\n <li key={c.id}>\n <button\n type=\"button\"\n data-testid={TID.filterCategory(c.slug)}\n onClick={() => catalog.setCategoryId(catalog.categoryId === c.id ? null : c.id)}\n className={`w-full rounded-md px-2 py-1.5 text-left text-sm transition-colors ${\n catalog.categoryId === c.id ? 'bg-primary/10 font-medium text-primary' : 'hover:bg-muted'\n }`}\n >\n {c.name}\n </button>\n </li>\n ))}\n </ul>\n </div>\n\n {/* Price range */}\n <div className=\"space-y-2\">\n <h3 className=\"text-sm font-semibold\">Preço</h3>\n <div className=\"flex items-center gap-2\">\n <input\n data-testid={TID.filterPriceMin}\n type=\"number\"\n placeholder=\"Mín\"\n min={0}\n value={catalog.priceMin ?? ''}\n onChange={(e) => catalog.setPriceMin(e.target.value === '' ? null : Number(e.target.value))}\n className=\"w-full rounded-lg border bg-background px-2.5 py-1.5 text-sm\"\n />\n <span className=\"text-muted-foreground\">–</span>\n <input\n data-testid={TID.filterPriceMax}\n type=\"number\"\n placeholder=\"Máx\"\n min={0}\n value={catalog.priceMax ?? ''}\n onChange={(e) => catalog.setPriceMax(e.target.value === '' ? null : Number(e.target.value))}\n className=\"w-full rounded-lg border bg-background px-2.5 py-1.5 text-sm\"\n />\n </div>\n </div>\n\n {/* Availability */}\n <label className=\"flex cursor-pointer items-center gap-2 text-sm\">\n <input\n data-testid={TID.filterInstock}\n type=\"checkbox\"\n checked={catalog.inStockOnly}\n onChange={(e) => catalog.setInStockOnly(e.target.checked)}\n className=\"h-4 w-4 rounded border\"\n />\n Somente em estoque\n </label>\n\n <button\n type=\"button\"\n data-testid={TID.filtersClear}\n onClick={() => catalog.reset()}\n className=\"text-sm text-muted-foreground underline-offset-2 hover:text-foreground hover:underline\"\n >\n Limpar filtros\n </button>\n </aside>\n )\n}\n","import { useEffect } from 'react'\n\n/**\n * Minimal per-route head manager: sets document.title and meta description so\n * each storefront page (product, catalog, account, checkout) has its own title\n * and shareable description instead of one static SPA title. A real SSR/prerender\n * pass (M12) layers OG/canonical on top; this covers the client-rendered baseline.\n */\nexport function useStorefrontHead(input: { title?: string; description?: string | null }): void {\n const { title, description } = input\n useEffect(() => {\n if (title) document.title = title\n }, [title])\n\n useEffect(() => {\n if (!description) return\n let tag = document.head.querySelector<HTMLMetaElement>('meta[name=\"description\"]')\n if (!tag) {\n tag = document.createElement('meta')\n tag.setAttribute('name', 'description')\n document.head.appendChild(tag)\n }\n tag.setAttribute('content', description.slice(0, 160))\n }, [description])\n}\n","import React, { useEffect, useMemo, useRef } from 'react'\nimport { useCatalogStore, type CatalogSort } from '../stores/catalog.store'\nimport { useProducts } from '../hooks/useProducts'\nimport { ProductGrid } from '../components/ProductGrid'\nimport { FiltersPanel } from '../components/FiltersPanel'\nimport { useStorefrontConfig } from '../config'\nimport { useStorefrontHead } from '../hooks/useStorefrontHead'\nimport type { ListProductsOptions } from '@fayz-ai/shop/types'\n\nconst SORT_MAP: Record<string, Pick<ListProductsOptions, 'orderBy' | 'order'>> = {\n newest: { orderBy: 'created_at', order: 'desc' },\n 'price-asc': { orderBy: 'price', order: 'asc' },\n 'price-desc': { orderBy: 'price', order: 'desc' },\n name: { orderBy: 'name', order: 'asc' },\n}\n\nconst SORTS: CatalogSort[] = ['newest', 'price-asc', 'price-desc', 'name']\n\n/**\n * Two-way sync between catalog filters and the URL hash query, so a filtered/\n * searched catalog is shareable, bookmarkable, and survives a refresh. Uses\n * history.replaceState (no navigation / no scroll jump).\n */\nfunction useCatalogUrlSync() {\n const hydrated = useRef(false)\n const catalog = useCatalogStore()\n\n useEffect(() => {\n if (hydrated.current) return\n hydrated.current = true\n const q = window.location.hash.split('?')[1]\n if (!q) return\n const p = new URLSearchParams(q)\n const s = useCatalogStore.getState()\n if (p.has('search')) s.setSearch(p.get('search') ?? '')\n if (p.get('category')) s.setCategoryId(p.get('category'))\n const sort = p.get('sort')\n if (sort && (SORTS as string[]).includes(sort)) s.setSort(sort as CatalogSort)\n if (p.get('stock') === '1') s.setInStockOnly(true)\n if (p.has('min')) s.setPriceMin(Number(p.get('min')) || null)\n if (p.has('max')) s.setPriceMax(Number(p.get('max')) || null)\n }, [])\n\n useEffect(() => {\n const p = new URLSearchParams()\n if (catalog.search) p.set('search', catalog.search)\n if (catalog.categoryId) p.set('category', catalog.categoryId)\n if (catalog.sort !== 'newest') p.set('sort', catalog.sort)\n if (catalog.inStockOnly) p.set('stock', '1')\n if (catalog.priceMin != null) p.set('min', String(catalog.priceMin))\n if (catalog.priceMax != null) p.set('max', String(catalog.priceMax))\n const base = window.location.hash.split('?')[0] || '#/catalog'\n const qs = p.toString()\n const next = qs ? `${base}?${qs}` : base\n if (next !== window.location.hash) window.history.replaceState(null, '', next)\n }, [catalog.search, catalog.categoryId, catalog.sort, catalog.inStockOnly, catalog.priceMin, catalog.priceMax])\n}\n\nexport function CatalogPage() {\n const config = useStorefrontConfig()\n const catalog = useCatalogStore()\n useCatalogUrlSync()\n useStorefrontHead({\n title: catalog.search ? `“${catalog.search}” — ${config.name}` : `${config.name} — Loja`,\n })\n\n const providerOpts: ListProductsOptions = {\n status: 'active',\n categoryId: catalog.categoryId ?? undefined,\n search: catalog.search || undefined,\n ...SORT_MAP[catalog.sort],\n }\n const { products, loading, error, reload } = useProducts(providerOpts)\n\n // Price range + availability are client-side refinements over the fetched set\n const filtered = useMemo(\n () =>\n products.filter((p) => {\n if (catalog.priceMin != null && p.price < catalog.priceMin) return false\n if (catalog.priceMax != null && p.price > catalog.priceMax) return false\n if (catalog.inStockOnly && p.inventoryCount <= 0) return false\n return true\n }),\n [products, catalog.priceMin, catalog.priceMax, catalog.inStockOnly],\n )\n\n return (\n <main className=\"mx-auto max-w-7xl px-4 py-8 sm:px-6\">\n <div className=\"mb-8\">\n <h1 className=\"text-2xl font-bold tracking-tight\">{config.name}</h1>\n <p className=\"mt-1 text-muted-foreground\">\n {catalog.search\n ? `Resultados para “${catalog.search}”`\n : 'Produtos selecionados com qualidade e entrega rápida.'}\n </p>\n </div>\n <div className=\"flex flex-col gap-8 lg:flex-row\">\n <FiltersPanel />\n <div className=\"flex-1\">\n {error ? (\n <div className=\"rounded-2xl border bg-card py-16 text-center\">\n <p className=\"text-muted-foreground\">Não foi possível carregar os produtos.</p>\n <button\n type=\"button\"\n onClick={reload}\n className=\"mt-4 rounded-lg border px-4 py-2 text-sm font-semibold transition hover:bg-muted\"\n >\n Tentar novamente\n </button>\n </div>\n ) : (\n <ProductGrid products={filtered} loading={loading} />\n )}\n </div>\n </div>\n </main>\n )\n}\n","import React from 'react'\nimport { renderBlocks } from '@fayz-ai/core'\nimport type { StorefrontSection } from '../sections'\nimport { sectionsToBlocks } from '../blocks'\n\n// The home page is now a block tree resolved through the universal block\n// registry (see ../blocks). Section components and their props are unchanged;\n// only the dispatch mechanism moved from a switch to the registry, so the same\n// composition works from a pure-data AppManifest.\nexport function StorefrontSections({ sections }: { sections: readonly StorefrontSection[] }) {\n return <main>{renderBlocks(sectionsToBlocks(sections))}</main>\n}\n\nexport function HomePage({ sections }: { sections: readonly StorefrontSection[] }) {\n return <StorefrontSections sections={sections} />\n}\n","import { useEffect, useState } from 'react'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport type { Product } from '@fayz-ai/shop/types'\n\nexport function useProduct(slug: string): {\n product: Product | null\n loading: boolean\n error: string | null\n} {\n const [product, setProduct] = useState<Product | null>(null)\n const [loading, setLoading] = useState(true)\n const [error, setError] = useState<string | null>(null)\n\n useEffect(() => {\n let cancelled = false\n setLoading(true)\n getShopProvider()\n .listProducts({ slug, status: 'active', limit: 1 })\n .then((data) => {\n if (cancelled) return\n setProduct(data[0] ?? null)\n setError(null)\n })\n .catch((e: unknown) => {\n if (!cancelled) setError(e instanceof Error ? e.message : String(e))\n })\n .finally(() => {\n if (!cancelled) setLoading(false)\n })\n return () => {\n cancelled = true\n }\n }, [slug])\n\n return { product, loading, error }\n}\n","import React from 'react'\nimport type { ProductOptionGroup, ProductOptionSelection } from '../product-options'\nimport { TID } from '../testids'\n\nexport interface ProductOptionSelectorProps {\n groups: ProductOptionGroup[]\n value: ProductOptionSelection\n onChange: (value: ProductOptionSelection) => void\n}\n\nexport function ProductOptionSelector({ groups, value, onChange }: ProductOptionSelectorProps) {\n if (groups.length === 0) return null\n\n return (\n <div className=\"mt-6 space-y-4\">\n {groups.map((group) => (\n <div key={group.id} data-testid={TID.productOptionGroup(group.id)}>\n <div className=\"mb-2 flex items-center justify-between gap-3\">\n <p className=\"text-sm font-medium\">{group.label}</p>\n {value[group.label] && (\n <p className=\"truncate text-xs text-muted-foreground\">{value[group.label]}</p>\n )}\n </div>\n <div className=\"flex flex-wrap gap-2\">\n {group.values.map((option) => {\n const selected = value[group.label] === option\n return (\n <button\n key={option}\n type=\"button\"\n data-testid={TID.productOptionValue(group.id, option)}\n aria-pressed={selected}\n onClick={() => onChange({ ...value, [group.label]: option })}\n className={[\n 'min-h-10 rounded-full border px-4 text-sm font-medium transition-colors',\n selected\n ? 'border-primary bg-primary text-primary-foreground'\n : 'border-border bg-background text-foreground hover:border-primary/60',\n ].join(' ')}\n >\n {option}\n </button>\n )\n })}\n </div>\n </div>\n ))}\n </div>\n )\n}\n","import React from 'react'\nimport type { Product } from '@fayz-ai/shop/types'\n\n// Metadata keys that drive the option selector (size/color) are excluded here so\n// specs don't duplicate the picker; the rest are internal SDK/seed/overlay keys\n// that aren't customer-facing specs.\nconst EXCLUDED_KEYS = new Set([\n 'options', 'sizes', 'colors',\n 'fayzStoreCategory', 'source', 'storeKey', 'storeName', 'tenantId', 'slug',\n])\n\n// Internal namespaced keys (fayz*, _*) are never shown as specs.\nfunction isInternalKey(key: string): boolean {\n return EXCLUDED_KEYS.has(key) || key.startsWith('_') || key.startsWith('fayz')\n}\n\n// Friendly PT-BR labels for common metadata keys; unknown keys are humanized.\nconst LABELS: Record<string, string> = {\n colorway: 'Cor',\n color: 'Cor',\n fit: 'Caimento',\n material: 'Material',\n vintage: 'Safra',\n region: 'Região',\n grape: 'Uva',\n pairing: 'Harmonização',\n abv: 'Teor alcoólico',\n volume: 'Volume',\n brand: 'Marca',\n origin: 'Origem',\n warranty: 'Garantia',\n dimensions: 'Dimensões',\n}\n\nfunction humanize(key: string): string {\n if (LABELS[key]) return LABELS[key]\n const spaced = key.replace(/([a-z0-9])([A-Z])/g, '$1 $2').replace(/[_-]+/g, ' ').trim()\n return spaced.charAt(0).toUpperCase() + spaced.slice(1)\n}\n\nfunction scalarToString(value: unknown): string | null {\n if (typeof value === 'string') return value.trim() || null\n if (typeof value === 'number') return String(value)\n if (typeof value === 'boolean') return value ? 'Sim' : 'Não'\n return null\n}\n\n/** Real product specs from standard fields + scalar metadata. Renders nothing\n * when there's nothing to show. No invented data. */\nexport function ProductSpecs({ product }: { product: Product }) {\n const rows: Array<[string, string]> = []\n if (product.sku) rows.push(['SKU', product.sku])\n if (product.categoryName) rows.push(['Categoria', product.categoryName])\n if (product.weight != null) rows.push(['Peso', `${product.weight} ${product.weightUnit}`])\n for (const [key, value] of Object.entries(product.metadata ?? {})) {\n if (isInternalKey(key)) continue\n const str = scalarToString(value)\n if (str) rows.push([humanize(key), str])\n }\n if (rows.length === 0) return null\n\n return (\n <section className=\"mt-14\">\n <h2 className=\"sf-heading text-xl font-semibold tracking-tight\">Especificações</h2>\n <dl className=\"mt-5 grid gap-x-12 sm:grid-cols-2\">\n {rows.map(([label, value]) => (\n <div key={label} className=\"flex items-center justify-between gap-4 border-b py-3 text-sm\">\n <dt className=\"text-muted-foreground\">{label}</dt>\n <dd className=\"text-right font-medium\">{value}</dd>\n </div>\n ))}\n </dl>\n </section>\n )\n}\n","import React from 'react'\nimport type { ListProductsOptions, Product } from '@fayz-ai/shop/types'\nimport { useProducts } from '../hooks/useProducts'\nimport { getStorefrontComponents, useStorefrontConfig } from '../config'\nimport { useStorefrontActions } from '../hooks/useStorefront'\nimport { ProductCard } from './ProductCard'\n\n/** \"Você também pode gostar\" — products from the same category, excluding the\n * current one. Renders through the store's configured card component for visual\n * consistency with the catalog. Hidden when there's nothing relevant. */\nexport function RelatedProducts({ product }: { product: Product }) {\n const config = useStorefrontConfig()\n const actions = useStorefrontActions()\n const components = getStorefrontComponents(config)\n const Card = components.ProductCard ?? ProductCard\n const opts: ListProductsOptions = product.categoryId\n ? { categoryId: product.categoryId, status: 'active', limit: 5 }\n : { status: 'active', limit: 5 }\n const { products, loading } = useProducts(opts)\n const related = products.filter((p) => p.id !== product.id).slice(0, 4)\n\n if (loading || related.length === 0) return null\n\n return (\n <section className=\"mt-16\">\n <h2 className=\"sf-heading text-xl font-semibold tracking-tight\">Você também pode gostar</h2>\n <div className=\"mt-6 grid grid-cols-2 gap-5 md:grid-cols-4\">\n {related.map((p) => (\n <Card\n key={p.id}\n product={p}\n config={config}\n commerceMode={config.commerceMode}\n actions={actions}\n />\n ))}\n </div>\n </section>\n )\n}\n","import React, { useState } from 'react'\nimport { Mail, MessageCircle, Send } from 'lucide-react'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport type { Product } from '@fayz-ai/shop/types'\nimport { useStorefrontConfig } from '../config'\nimport { storefrontComponentContracts } from '../component-selectors'\nimport { TID } from '../testids'\n\nexport interface ProductEnquiryFormProps {\n product: Product\n onSuccess?: () => void\n}\n\nfunction defaultSubject(prefix: string, product: Product): string {\n return `${prefix}: ${product.name}`\n}\n\nfunction buildWhatsAppHref(url: string, product: Product): string {\n const text = encodeURIComponent(`Hello, I would like more information about ${product.name}.`)\n const sep = url.includes('?') ? '&' : '?'\n return `${url}${sep}text=${text}`\n}\n\nexport function ProductEnquiryForm({ product, onSuccess }: ProductEnquiryFormProps) {\n const config = useStorefrontConfig()\n const [customerName, setCustomerName] = useState('')\n const [customerEmail, setCustomerEmail] = useState('')\n const [customerPhone, setCustomerPhone] = useState('')\n const [subject, setSubject] = useState(defaultSubject(config.enquiry.subjectPrefix, product))\n const [message, setMessage] = useState(`I would like more information about ${product.name}.`)\n const [status, setStatus] = useState<'idle' | 'submitting' | 'success' | 'error'>('idle')\n const [error, setError] = useState<string | null>(null)\n\n const submit = async (event: React.FormEvent) => {\n event.preventDefault()\n setStatus('submitting')\n setError(null)\n try {\n const provider = getShopProvider()\n if (provider.createProductEnquiry) {\n await provider.createProductEnquiry({\n productId: product.id,\n productName: product.name,\n productSlug: product.slug,\n customerName,\n customerEmail,\n customerPhone: customerPhone || undefined,\n subject,\n message,\n sourceUrl: typeof window === 'undefined' ? undefined : window.location.href,\n metadata: { sku: product.sku, categoryName: product.categoryName },\n })\n } else if (config.enquiry.email) {\n window.location.href = `mailto:${config.enquiry.email}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(message)}`\n }\n setStatus('success')\n onSuccess?.()\n } catch (e) {\n setStatus('error')\n setError(e instanceof Error ? e.message : String(e))\n }\n }\n\n return (\n <form\n {...storefrontComponentContracts.productDetail.enquiryForm}\n onSubmit={submit}\n className=\"space-y-4\"\n >\n <div className=\"grid gap-4 sm:grid-cols-2\">\n <label className=\"space-y-1.5 text-sm font-medium\">\n <span>Your name</span>\n <input\n data-testid={TID.enquiryName}\n required\n value={customerName}\n onChange={(e) => setCustomerName(e.target.value)}\n className=\"w-full border bg-background px-3 py-2 outline-none focus:border-primary\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n </label>\n <label className=\"space-y-1.5 text-sm font-medium\">\n <span>Your email</span>\n <input\n data-testid={TID.enquiryEmail}\n required\n type=\"email\"\n value={customerEmail}\n onChange={(e) => setCustomerEmail(e.target.value)}\n className=\"w-full border bg-background px-3 py-2 outline-none focus:border-primary\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n </label>\n </div>\n <label className=\"block space-y-1.5 text-sm font-medium\">\n <span>Phone{config.enquiry.requirePhone ? '' : ' (optional)'}</span>\n <input\n data-testid={TID.enquiryPhone}\n required={config.enquiry.requirePhone}\n value={customerPhone}\n onChange={(e) => setCustomerPhone(e.target.value)}\n className=\"w-full border bg-background px-3 py-2 outline-none focus:border-primary\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n </label>\n <label className=\"block space-y-1.5 text-sm font-medium\">\n <span>Subject</span>\n <input\n data-testid={TID.enquirySubject}\n required\n value={subject}\n onChange={(e) => setSubject(e.target.value)}\n className=\"w-full border bg-background px-3 py-2 outline-none focus:border-primary\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n </label>\n <label className=\"block space-y-1.5 text-sm font-medium\">\n <span>Message</span>\n <textarea\n data-testid={TID.enquiryMessage}\n required\n rows={5}\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n className=\"w-full resize-none border bg-background px-3 py-2 outline-none focus:border-primary\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n </label>\n <div className=\"flex flex-wrap items-center gap-3\">\n <button\n data-testid={TID.enquirySubmit}\n type=\"submit\"\n disabled={status === 'submitting'}\n className=\"sf-cta inline-flex items-center gap-2 bg-primary px-5 py-3 font-semibold text-primary-foreground disabled:cursor-wait disabled:opacity-60\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n <Send className=\"h-4 w-4\" />\n {status === 'submitting' ? 'Sending...' : 'Send enquiry'}\n </button>\n {config.enquiry.whatsappUrl && (\n <a\n href={buildWhatsAppHref(config.enquiry.whatsappUrl, product)}\n target=\"_blank\"\n rel=\"noreferrer\"\n className=\"inline-flex items-center gap-2 border px-5 py-3 text-sm font-semibold transition-colors hover:bg-muted\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n <MessageCircle className=\"h-4 w-4\" />\n WhatsApp\n </a>\n )}\n {config.enquiry.email && (\n <a\n href={`mailto:${config.enquiry.email}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(message)}`}\n className=\"inline-flex items-center gap-2 border px-5 py-3 text-sm font-semibold transition-colors hover:bg-muted\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n <Mail className=\"h-4 w-4\" />\n Email\n </a>\n )}\n </div>\n {status === 'success' && (\n <p data-testid={TID.enquirySuccess} className=\"text-sm font-medium text-emerald-600\">\n {config.enquiry.successMessage}\n </p>\n )}\n {error && (\n <p data-testid={TID.enquiryError} className=\"text-sm font-medium text-red-600\">\n {error}\n </p>\n )}\n </form>\n )\n}\n","import React, { useEffect, useRef, useState } from 'react'\nimport type { ProductImage } from '@fayz-ai/shop/types'\nimport type { ProductGalleryProps } from '../component-contracts'\nimport { SmoothImage } from './SmoothImage'\nimport { TID } from '../testids'\nimport { storefrontComponentContracts } from '../component-selectors'\n\n/**\n * Product gallery: one framed image, hover-to-zoom, and a thumbnail strip when\n * the product has more than one photo.\n *\n * It replaces a bare <img> that rendered only the primary image. Three things\n * were wrong with that:\n *\n * · the frame was a grid child with the default `stretch`, so it grew to the\n * height of the (much taller) details column and left a slab of empty dark\n * box under a square photo;\n * · `plg_shop_product_images` has always been a collection with sort_order and\n * is_primary, and every extra photo a merchant uploaded was invisible;\n * · zooming is table stakes for anything sold by its looks — food especially.\n *\n * Zoom is pointer-driven: the transform origin follows the cursor, so the part\n * under the pointer is the part magnified. Disabled on coarse pointers, where\n * there is no hover and a stuck 2× would just be a broken image.\n */\nexport function ProductGallery({ product, images, primaryImage }: ProductGalleryProps) {\n const ordered = orderImages(images, primaryImage)\n const [index, setIndex] = useState(0)\n const [zoom, setZoom] = useState<{ x: number; y: number } | null>(null)\n const frameRef = useRef<HTMLDivElement>(null)\n const canHover = useCanHover()\n\n // A different product (client-side navigation) must not keep the previous\n // product's selected slide.\n useEffect(() => { setIndex(0); setZoom(null) }, [product.id])\n\n const current = ordered[Math.min(index, ordered.length - 1)]\n\n function trackPointer(event: React.MouseEvent<HTMLDivElement>) {\n if (!canHover) return\n const frame = frameRef.current\n if (!frame) return\n const rect = frame.getBoundingClientRect()\n setZoom({\n x: ((event.clientX - rect.left) / rect.width) * 100,\n y: ((event.clientY - rect.top) / rect.height) * 100,\n })\n }\n\n function step(delta: number) {\n if (ordered.length < 2) return\n setIndex((current) => (current + delta + ordered.length) % ordered.length)\n setZoom(null)\n }\n\n return (\n <div className=\"flex flex-col gap-3 self-start\">\n <div\n {...storefrontComponentContracts.productDetail.gallery}\n ref={frameRef}\n // `self-start` above and a fixed aspect here: the frame is sized by the\n // image, never by whatever the column beside it happens to contain.\n className=\"group relative aspect-square w-full overflow-hidden border bg-muted\"\n style={{ borderRadius: 'var(--sf-radius-card)' }}\n onMouseMove={trackPointer}\n onMouseLeave={() => setZoom(null)}\n onKeyDown={(event) => {\n if (event.key === 'ArrowRight') step(1)\n if (event.key === 'ArrowLeft') step(-1)\n }}\n tabIndex={ordered.length > 1 ? 0 : -1}\n role={ordered.length > 1 ? 'group' : undefined}\n aria-label={ordered.length > 1 ? `Imagens de ${product.name}` : undefined}\n >\n {/*\n The transform lives on a wrapper, not on the image: SmoothImage writes\n its own inline `transition` for the load fade (SmoothImage.tsx:52,\n spread AFTER any style passed in), which would have stretched the zoom\n to 420ms and left it visibly lagging the cursor.\n */}\n {current && (\n <div\n className=\"h-full w-full transition-transform duration-150 ease-out\"\n style={zoom\n ? { transform: 'scale(2)', transformOrigin: `${zoom.x}% ${zoom.y}%` }\n : { transform: 'scale(1)' }}\n >\n <SmoothImage\n key={current.id}\n src={current.url}\n alt={current.altText ?? product.name}\n data-testid={TID.pdpGalleryImage}\n className=\"h-full w-full object-cover\"\n />\n </div>\n )}\n\n {ordered.length > 1 && (\n <>\n <GalleryArrow side=\"left\" onClick={() => step(-1)} />\n <GalleryArrow side=\"right\" onClick={() => step(1)} />\n <span className=\"pointer-events-none absolute bottom-3 right-3 rounded-full bg-black/60 px-2 py-0.5 text-[11px] font-medium text-white\">\n {index + 1}/{ordered.length}\n </span>\n </>\n )}\n </div>\n\n {ordered.length > 1 && (\n <ul data-testid={TID.pdpGalleryThumbs} className=\"flex gap-2 overflow-x-auto pb-1\">\n {ordered.map((image, position) => (\n <li key={image.id}>\n <button\n type=\"button\"\n data-testid={TID.pdpGalleryThumb}\n data-index={position}\n aria-label={`Imagem ${position + 1} de ${ordered.length}`}\n aria-current={position === index}\n onClick={() => { setIndex(position); setZoom(null) }}\n className={`h-16 w-16 shrink-0 overflow-hidden rounded-lg border transition ${\n position === index ? 'border-primary ring-2 ring-primary/20' : 'border-border opacity-70 hover:opacity-100'\n }`}\n >\n <img src={image.url} alt=\"\" className=\"h-full w-full object-cover\" loading=\"lazy\" />\n </button>\n </li>\n ))}\n </ul>\n )}\n </div>\n )\n}\n\n/** Primary first, then sort_order — the order the merchant set in the admin. */\nfunction orderImages(images: ProductImage[], primary?: ProductImage): ProductImage[] {\n const all = images.length > 0 ? images : primary ? [primary] : []\n return [...all].sort((a, b) => {\n if (a.isPrimary !== b.isPrimary) return a.isPrimary ? -1 : 1\n return (a.sortOrder ?? 0) - (b.sortOrder ?? 0)\n })\n}\n\n/**\n * Whether the device actually has a hover-capable pointer. On a phone every\n * element is permanently \"hovered\" by some emulations, which would leave the\n * photo stuck at 2× with no way back.\n */\nfunction useCanHover(): boolean {\n const [canHover, setCanHover] = useState(false)\n useEffect(() => {\n const query = window.matchMedia?.('(hover: hover) and (pointer: fine)')\n if (!query) return\n setCanHover(query.matches)\n const onChange = (event: MediaQueryListEvent) => setCanHover(event.matches)\n query.addEventListener?.('change', onChange)\n return () => query.removeEventListener?.('change', onChange)\n }, [])\n return canHover\n}\n\nfunction GalleryArrow({ side, onClick }: { side: 'left' | 'right'; onClick: () => void }) {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n aria-label={side === 'left' ? 'Imagem anterior' : 'Próxima imagem'}\n className={`absolute top-1/2 z-10 flex h-9 w-9 -translate-y-1/2 items-center justify-center rounded-full bg-background/80 opacity-0 shadow-md backdrop-blur transition hover:bg-background focus:opacity-100 group-hover:opacity-100 ${\n side === 'left' ? 'left-3' : 'right-3'\n }`}\n >\n <span aria-hidden className=\"text-lg leading-none\">{side === 'left' ? '‹' : '›'}</span>\n </button>\n )\n}\n","import React, { useEffect, useState } from 'react'\nimport { ChevronLeft, RefreshCcw, ShieldCheck, Truck } from 'lucide-react'\nimport { useProduct } from '../hooks/useProduct'\nimport { useCartStore } from '../stores/cart.store'\nimport { getStorefrontComponents, useStorefrontConfig } from '../config'\nimport { useStorefrontHead } from '../hooks/useStorefrontHead'\nimport { useStorefrontActions } from '../hooks/useStorefront'\nimport { Link } from '../router'\nimport { Price } from '../components/Price'\nimport { QuantityInput } from '../components/QuantityInput'\nimport { ProductOptionSelector } from '../components/ProductOptionSelector'\nimport { ProductSpecs } from '../components/ProductSpecs'\nimport { RelatedProducts } from '../components/RelatedProducts'\nimport { ProductEnquiryForm } from '../components/ProductEnquiryForm'\nimport { SmoothImage } from '../components/SmoothImage'\nimport { ProductGallery } from '../components/ProductGallery'\nimport { DeliveryEstimator } from '../components/DeliveryEstimator'\nimport { getProductOptionGroups, type ProductOptionSelection } from '../product-options'\nimport { storefrontComponentContracts } from '../component-selectors'\nimport { TID } from '../testids'\n\nexport function ProductDetailPage({ slug }: { slug: string }) {\n const config = useStorefrontConfig()\n const actions = useStorefrontActions()\n const { product, loading } = useProduct(slug)\n const addItem = useCartStore((s) => s.addItem)\n const [qty, setQty] = useState(1)\n const [selectedOptions, setSelectedOptions] = useState<ProductOptionSelection>({})\n\n const optionGroups = product ? getProductOptionGroups(product) : []\n useStorefrontHead({\n title: product ? `${product.name} — ${config.name}` : config.name,\n description: product?.description,\n })\n\n useEffect(() => {\n if (!product) return\n const defaults = Object.fromEntries(\n getProductOptionGroups(product).map((group) => [group.label, group.values[0] ?? '']),\n )\n setSelectedOptions(defaults)\n }, [product?.id])\n\n if (loading) {\n return (\n <main className=\"mx-auto max-w-5xl px-4 py-8 sm:px-6\">\n <div className=\"grid animate-pulse gap-10 md:grid-cols-2\">\n <div className=\"aspect-square rounded-2xl bg-muted\" />\n <div className=\"space-y-4 py-4\">\n <div className=\"h-8 w-3/4 rounded bg-muted\" />\n <div className=\"h-6 w-1/3 rounded bg-muted\" />\n <div className=\"h-24 rounded bg-muted\" />\n </div>\n </div>\n </main>\n )\n }\n\n if (!product) {\n return (\n <main className=\"mx-auto max-w-5xl px-4 py-20 text-center sm:px-6\">\n <p className=\"text-lg text-muted-foreground\">Produto não encontrado.</p>\n <Link to=\"/\" className=\"mt-4 inline-block text-primary underline\">Voltar à loja</Link>\n </main>\n )\n }\n\n const soldOut = product.inventoryCount <= 0\n const lowStock = !soldOut && product.inventoryCount <= 5\n const image = product.images.find((i) => i.isPrimary) ?? product.images[0]\n const components = getStorefrontComponents(config)\n const ProductDetailComponent = components.ProductDetail\n // Honours the ProductGallery override contract, which has existed in\n // component-contracts.ts since before any component implemented it.\n const GalleryComponent = components.ProductGallery ?? ProductGallery\n const addToCart = () => addItem(product, qty, selectedOptions)\n const openEnquiry = () => {\n document.getElementById('storefront-product-enquiry')?.scrollIntoView({ behavior: 'smooth', block: 'start' })\n }\n const discountPct =\n product.compareAtPrice && product.compareAtPrice > product.price\n ? Math.round((1 - product.price / product.compareAtPrice) * 100)\n : 0\n\n if (ProductDetailComponent) {\n return (\n <ProductDetailComponent\n product={product}\n config={config}\n commerceMode={config.commerceMode}\n primaryImage={image}\n optionGroups={optionGroups}\n selectedOptions={selectedOptions}\n setSelectedOptions={setSelectedOptions}\n quantity={qty}\n setQuantity={setQty}\n soldOut={soldOut}\n lowStock={lowStock}\n actions={actions}\n addToCart={addToCart}\n openEnquiry={openEnquiry}\n />\n )\n }\n\n return (\n <main {...storefrontComponentContracts.productDetail.root} className=\"mx-auto max-w-5xl px-4 py-8 sm:px-6\">\n <Link to=\"/\" className=\"mb-6 inline-flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground\">\n <ChevronLeft className=\"h-4 w-4\" /> Continuar comprando\n </Link>\n\n <div className=\"grid animate-fade-up grid-cols-1 gap-10 md:grid-cols-2\">\n <GalleryComponent\n product={product}\n images={product.images}\n primaryImage={image}\n config={config}\n commerceMode={config.commerceMode}\n />\n\n <div className=\"flex flex-col py-2 lg:sticky lg:top-24 lg:self-start\">\n <nav className=\"mb-3 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground\">\n <Link to=\"/\" className=\"transition-colors hover:text-foreground\">Início</Link>\n {product.categoryName && (\n <>\n <span aria-hidden>/</span>\n <span>{product.categoryName}</span>\n </>\n )}\n <span aria-hidden>/</span>\n <span className=\"text-foreground\">{product.name}</span>\n </nav>\n\n <h1 data-testid={TID.pdpName} className=\"sf-heading text-3xl font-bold tracking-tight\">\n {product.name}\n </h1>\n\n {config.commerceMode === 'checkout' && (\n <div className=\"mt-3 flex items-center gap-3\">\n <div className=\"text-xl\">\n <Price\n value={product.price}\n compareAt={product.compareAtPrice}\n testId={TID.pdpPrice}\n compareTestId={TID.pdpComparePrice}\n />\n </div>\n {discountPct > 0 && (\n <span className=\"rounded-full bg-primary/10 px-2.5 py-1 text-xs font-bold text-primary\">\n −{discountPct}%\n </span>\n )}\n </div>\n )}\n\n <p data-testid={TID.pdpDescription} className=\"mt-5 leading-relaxed text-muted-foreground\">\n {product.description}\n </p>\n\n {config.commerceMode === 'checkout' && (\n <div className=\"mt-4 flex flex-wrap items-center gap-x-3 gap-y-1 text-sm\">\n {soldOut ? (\n <span className=\"inline-flex items-center gap-2 font-medium text-muted-foreground\">\n <span className=\"h-2 w-2 rounded-full bg-muted-foreground\" /> Sem estoque\n </span>\n ) : lowStock ? (\n <span className=\"inline-flex items-center gap-2 font-semibold text-amber-600\">\n <span className=\"h-2 w-2 animate-pulse rounded-full bg-amber-500\" />\n Últimas unidades — só {product.inventoryCount} restantes\n </span>\n ) : (\n <span className=\"inline-flex items-center gap-2 font-medium text-emerald-600\">\n <span className=\"h-2 w-2 rounded-full bg-emerald-500\" /> Em estoque\n </span>\n )}\n {product.sku && <span className=\"text-muted-foreground\">SKU: {product.sku}</span>}\n </div>\n )}\n\n <ProductOptionSelector\n groups={optionGroups}\n value={selectedOptions}\n onChange={setSelectedOptions}\n />\n\n <div {...storefrontComponentContracts.productDetail.actions} className=\"mt-8\">\n {config.commerceMode === 'checkout' ? (\n <div className=\"flex items-center gap-4\">\n <QuantityInput\n value={qty}\n onChange={setQty}\n max={soldOut ? 1 : product.inventoryCount}\n testId={TID.pdpQtyInput}\n />\n <button\n type=\"button\"\n data-testid={TID.pdpAddToCart}\n disabled={soldOut}\n onClick={addToCart}\n className=\"sf-cta flex-1 bg-primary py-3.5 font-semibold text-primary-foreground shadow-md transition-all hover:-translate-y-0.5 hover:shadow-lg disabled:cursor-not-allowed disabled:opacity-40 disabled:shadow-none disabled:hover:translate-y-0\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n {soldOut ? 'Esgotado' : 'Adicionar ao carrinho'}\n </button>\n </div>\n ) : config.commerceMode === 'enquiry' ? (\n <button\n type=\"button\"\n {...storefrontComponentContracts.productDetail.enquiryButton}\n onClick={openEnquiry}\n className=\"sf-cta w-full bg-primary py-3.5 font-semibold text-primary-foreground shadow-md transition-all hover:-translate-y-0.5 hover:shadow-lg\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n {config.enquiry.label}\n </button>\n ) : (\n <Link\n to={config.catalogPath}\n className=\"inline-flex border px-5 py-3 text-sm font-semibold transition-colors hover:bg-muted\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n Voltar ao catálogo\n </Link>\n )}\n </div>\n\n {/* Asked here, before the cart exists: \"do you deliver to me and for\n how much\" is the question that decides whether this page converts,\n and it used to be answerable only at the end of checkout. */}\n {config.commerceMode === 'checkout' && <DeliveryEstimator />}\n\n {config.commerceMode === 'checkout' && (\n <div className=\"mt-6 grid grid-cols-3 gap-3 border-t pt-6 text-center\">\n <div className=\"flex flex-col items-center gap-1.5 text-[11px] font-medium text-muted-foreground\">\n <Truck className=\"h-5 w-5 text-primary\" /> Envio rápido\n </div>\n <div className=\"flex flex-col items-center gap-1.5 text-[11px] font-medium text-muted-foreground\">\n <RefreshCcw className=\"h-5 w-5 text-primary\" /> Troca fácil\n </div>\n <div className=\"flex flex-col items-center gap-1.5 text-[11px] font-medium text-muted-foreground\">\n <ShieldCheck className=\"h-5 w-5 text-primary\" /> Pagamento seguro\n </div>\n </div>\n )}\n </div>\n </div>\n\n {config.commerceMode === 'enquiry' && (\n <section id=\"storefront-product-enquiry\" className=\"mt-12 border-t pt-10\">\n <div className=\"mx-auto max-w-3xl\">\n <h2 className=\"sf-heading text-2xl font-semibold\">Need more information?</h2>\n <p className=\"mt-2 text-muted-foreground\">Send an enquiry about this product.</p>\n <div className=\"mt-6\">\n <ProductEnquiryForm product={product} />\n </div>\n </div>\n </section>\n )}\n\n <ProductSpecs product={product} />\n <RelatedProducts product={product} />\n </main>\n )\n}\n","import { getShopProvider } from '@fayz-ai/shop/runtime'\nimport type { Order, ShippingAddressInput, PaymentMethodKind } from '@fayz-ai/shop/types'\nimport { establishCustomerSession } from '../auth'\nimport type { ResolvedStorefrontConfig } from '../config'\nimport type { CartState } from '../stores/cart.store'\nimport { selectShipping } from '../stores/cart.store'\nimport type { SessionState } from '../stores/session.store'\n\nexport interface StorefrontCheckoutCustomer {\n email: string\n name: string\n}\n\nexport interface StorefrontCheckoutAddress {\n street?: string\n city?: string\n zip?: string\n notes?: string\n}\n\nexport interface PlaceStorefrontOrderInput {\n config: ResolvedStorefrontConfig\n cart: Pick<CartState, 'lines' | 'discountCode' | 'discountPercent'>\n session?: Pick<SessionState, 'customerId' | 'email'>\n customer: StorefrontCheckoutCustomer\n address?: StorefrontCheckoutAddress\n /** Structured address; without it the order keeps only the free-text note. */\n shippingAddress?: ShippingAddressInput\n paymentMethod?: PaymentMethodKind\n markPaid?: boolean\n}\n\nexport interface PlaceStorefrontOrderResult {\n order: Order\n customerId: string\n}\n\n/**\n * `notes` is the buyer's free-text message to the store — nothing else.\n *\n * It used to double as the delivery address, from back when the order had\n * nowhere structured to put one. Now that the address is a real snapshot plus a\n * row in the address book, repeating it here only creates a second copy that\n * can disagree with the first (it did: it dropped number and district). When a\n * structured address is present, notes carries only what the customer wrote.\n */\nfunction formatDeliveryNotes(\n address: StorefrontCheckoutAddress | undefined,\n shippingAddress?: ShippingAddressInput,\n): string | undefined {\n if (address?.notes?.trim()) return address.notes.trim()\n\n // Structured address present → the order already knows where to deliver.\n if (shippingAddress) return undefined\n\n if (!address) return undefined\n const parts = [address.street, address.city, address.zip]\n .map((part) => part?.trim())\n .filter(Boolean)\n\n return parts.length > 0 ? `Entrega: ${parts.join(', ')}` : undefined\n}\n\n/**\n * Storefront checkout primitive for custom/generated checkout screens.\n * It owns the order payload math and customer-session handshake so app-owned\n * routes can customize UX without copying provider/business logic.\n */\nexport async function placeStorefrontOrder({\n config,\n cart,\n session,\n customer,\n address,\n shippingAddress,\n paymentMethod,\n markPaid = false,\n}: PlaceStorefrontOrderInput): Promise<PlaceStorefrontOrderResult> {\n const email = customer.email.trim().toLowerCase()\n const name = customer.name.trim()\n const provider = getShopProvider()\n\n let customerId = session?.customerId ?? null\n if (!customerId || session?.email !== email) {\n const established = await establishCustomerSession(email, { name })\n customerId = established.customerId\n }\n\n // Trusted placement: send only product ids + quantities. The provider\n // (shop_place_order RPC on Supabase, in-memory provider in mock) re-reads\n // prices, validates the discount, and decrements inventory server-side.\n const order = await provider.placeOrder({\n customerId: customerId ?? undefined,\n customer: { name, email },\n currency: config.currency,\n notes: formatDeliveryNotes(address, shippingAddress),\n discountCode: cart.discountCode ?? undefined,\n shippingTotal: selectShipping(cart, config),\n // Structured address + method are what populate public.addresses and the\n // transactions ledger. `notes` stays for backwards compatibility with\n // checkouts that have not been updated yet.\n shippingAddress,\n paymentMethod,\n items: cart.lines.map((line) => ({\n productId: line.productId,\n quantity: line.quantity,\n optionsLabel: line.optionsLabel || undefined,\n })),\n })\n\n if (markPaid) {\n // Prefer the RPC seam — anon storefronts have no UPDATE grant on the\n // orders table, so a direct updateOrder 401s on pool backends.\n if (provider.confirmPayment) await provider.confirmPayment(order.id)\n else await provider.updateOrder(order.id, { financialStatus: 'paid' })\n }\n\n return { order, customerId: customerId ?? order.customerId ?? '' }\n}\n","import React, { useEffect, useState } from 'react'\nimport { Lock, X } from 'lucide-react'\nimport { establishCustomerSession } from '../auth'\nimport { useSessionStore } from '../stores/session.store'\nimport { Link } from '../router'\n\ninterface SignInModalProps {\n /** Prefill the email field (e.g. from a checkout contact field). */\n defaultEmail?: string\n onClose: () => void\n /** Called after a successful sign-in, with the resolved session. */\n onSignedIn?: (session: { email: string | null; name: string | null }) => void\n}\n\n/**\n * Customer sign-in as a focused modal dialog. Used from checkout (\"Já tem\n * conta? Entrar\") so a returning buyer can authenticate without leaving the\n * page. Auth goes through the shared establishCustomerSession path.\n */\nexport function SignInModal({ defaultEmail = '', onClose, onSignedIn }: SignInModalProps) {\n const [email, setEmail] = useState(defaultEmail)\n const [password, setPassword] = useState('')\n const [busy, setBusy] = useState(false)\n const [error, setError] = useState<string | null>(null)\n\n useEffect(() => {\n const onKey = (event: KeyboardEvent) => { if (event.key === 'Escape') onClose() }\n document.addEventListener('keydown', onKey)\n return () => document.removeEventListener('keydown', onKey)\n }, [onClose])\n\n async function submit(event: React.FormEvent) {\n event.preventDefault()\n if (!email.trim() || !password) return\n setBusy(true)\n setError(null)\n try {\n await establishCustomerSession(email, { password })\n const session = useSessionStore.getState()\n onSignedIn?.({ email: session.email, name: session.name })\n onClose()\n } catch {\n setError('Não foi possível entrar. Verifique seu e-mail e senha.')\n } finally {\n setBusy(false)\n }\n }\n\n return (\n <div\n className=\"fixed inset-0 z-[60] flex items-center justify-center p-4\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Entrar na sua conta\"\n >\n <div className=\"absolute inset-0 animate-fade-in bg-foreground/40 backdrop-blur-sm\" onClick={onClose} />\n <div\n className=\"relative z-10 w-full max-w-sm animate-fade-up border bg-card p-6 shadow-2xl\"\n style={{ borderRadius: 'var(--sf-radius-card)' }}\n >\n <button\n type=\"button\"\n onClick={onClose}\n aria-label=\"Fechar\"\n className=\"absolute right-4 top-4 rounded-full p-1 text-muted-foreground transition hover:bg-muted hover:text-foreground\"\n >\n <X className=\"h-5 w-5\" />\n </button>\n\n <div className=\"flex items-center gap-2\">\n <span className=\"flex h-9 w-9 items-center justify-center rounded-full bg-primary/10 text-primary\">\n <Lock className=\"h-4 w-4\" />\n </span>\n <div>\n <h2 className=\"sf-heading text-lg font-semibold leading-tight\">Entrar na sua conta</h2>\n <p className=\"text-xs text-muted-foreground\">Use seus dados salvos e acompanhe pedidos.</p>\n </div>\n </div>\n\n <form onSubmit={submit} className=\"mt-5 space-y-3\">\n <input\n type=\"email\"\n required\n autoFocus\n placeholder=\"voce@exemplo.com\"\n value={email}\n onChange={(event) => setEmail(event.target.value)}\n className=\"w-full border bg-background px-3 py-2.5 text-sm outline-none transition focus:border-primary focus:ring-2 focus:ring-primary/10\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n <input\n type=\"password\"\n required\n placeholder=\"Senha\"\n value={password}\n onChange={(event) => setPassword(event.target.value)}\n className=\"w-full border bg-background px-3 py-2.5 text-sm outline-none transition focus:border-primary focus:ring-2 focus:ring-primary/10\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n {error && <p className=\"text-sm text-destructive\">{error}</p>}\n <button\n type=\"submit\"\n disabled={busy}\n className=\"sf-cta w-full bg-primary py-3 font-semibold text-primary-foreground shadow-md transition-all hover:-translate-y-0.5 hover:shadow-lg disabled:opacity-60\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n {busy ? 'Entrando…' : 'Entrar'}\n </button>\n </form>\n\n <p className=\"mt-4 text-center text-sm text-muted-foreground\">\n Não tem conta?{' '}\n <Link to=\"/account\" onClick={onClose} className=\"font-semibold text-primary hover:underline\">\n Criar conta\n </Link>\n </p>\n </div>\n </div>\n )\n}\n","import React, { useEffect, useState } from 'react'\nimport { CreditCard, Lock, PackageCheck, ShieldCheck } from 'lucide-react'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport { formatPostalCode, normalizePostalCode, lookupPostalCode } from '@fayz-ai/core'\nimport type { CustomerAddress, PaymentMethodKind } from '@fayz-ai/shop/types'\nimport { prefersReducedMotion } from '../motion'\nimport {\n useCartStore,\n selectSubtotal,\n selectDiscountTotal,\n selectShipping,\n selectTotal,\n} from '../stores/cart.store'\nimport { useSessionStore } from '../stores/session.store'\nimport { useDeliveryStore } from '../stores/delivery.store'\nimport { useStorefrontConfig } from '../config'\nimport { Link, navigateTo } from '../router'\nimport { formatMoney } from '../format'\nimport { TID } from '../testids'\nimport { placeStorefrontOrder } from '../workflows/checkout'\nimport { useDiscountValidator } from '../hooks/useDiscountValidator'\nimport { toast } from '../stores/toast.store'\nimport { useStorefrontHead } from '../hooks/useStorefrontHead'\nimport { SignInModal } from '../components/SignInModal'\nimport { SmoothImage } from '../components/SmoothImage'\n\ninterface CheckoutForm {\n email: string\n name: string\n street: string\n city: string\n zip: string\n number: string\n complement: string\n district: string\n state: string\n}\n\ntype AddressMode = 'saved' | 'new'\n\n/**\n * There is no payment service provider connected, so the checkout does not ask\n * for a card number. It used to, prefilled with 4242 4242 4242 4242, and the\n * digits were validated and then thrown away — a PAN typed into React state\n * that reaches no processor is a liability with no upside. The buyer states how\n * they intend to pay; the order stays `pending` until the merchant confirms the\n * money arrived (shop_confirm_payment, which since 0019 only they can call).\n */\nconst PAYMENT_LABELS: Record<PaymentMethodKind, { label: string; hint: string }> = {\n pix: { label: 'Pix', hint: 'Você recebe a chave para pagar após confirmar o pedido' },\n credit_card: { label: 'Cartão de crédito', hint: 'Maquininha na entrega' },\n debit_card: { label: 'Cartão de débito', hint: 'Maquininha na entrega' },\n boleto: { label: 'Boleto', hint: 'Enviado por e-mail após a confirmação' },\n cash: { label: 'Dinheiro', hint: 'Pagamento na entrega' },\n other: { label: 'Combinar com a loja', hint: 'A loja entra em contato para acertar o pagamento' },\n}\n\nconst PROCESSING_STEPS = [\n { icon: Lock, label: 'Validando seus dados...' },\n { icon: PackageCheck, label: 'Registrando seu pedido...' },\n]\n\nconst sleep = (ms: number) => new Promise<void>((resolve) => setTimeout(resolve, ms))\n\nfunction ProcessingOverlay({ step }: { step: number }) {\n const current = PROCESSING_STEPS[Math.min(step, PROCESSING_STEPS.length - 1)]!\n const Icon = current.icon\n return (\n <div\n data-testid={TID.checkoutProcessing}\n className=\"fixed inset-0 z-50 flex animate-fade-in flex-col items-center justify-center bg-background/95 backdrop-blur-sm\"\n role=\"status\"\n aria-live=\"polite\"\n >\n <div className=\"relative flex h-24 w-24 items-center justify-center\">\n <span className=\"absolute inset-0 animate-spin rounded-full border-[3px] border-muted border-t-primary\" style={{ animationDuration: '1.1s' }} />\n <Icon key={step} className=\"h-9 w-9 animate-pop-in text-primary\" />\n </div>\n <p key={`label-${step}`} className=\"mt-6 animate-fade-up font-medium\">{current.label}</p>\n <p className=\"mt-8 text-xs text-muted-foreground\">Pagamento seguro - não feche esta janela</p>\n </div>\n )\n}\n\nfunction field(\n label: string,\n testId: string,\n value: string,\n onChange: (value: string) => void,\n props?: React.InputHTMLAttributes<HTMLInputElement>,\n) {\n return (\n <label className=\"block\">\n <span className=\"sr-only\">{label}</span>\n <input\n data-testid={testId}\n aria-label={label}\n value={value}\n onChange={(event) => onChange(event.target.value)}\n className=\"w-full rounded-lg border bg-background px-3.5 py-3 text-sm outline-none transition focus:border-primary focus:ring-2 focus:ring-primary/10\"\n {...props}\n />\n </label>\n )\n}\n\nexport function CheckoutPage() {\n const config = useStorefrontConfig()\n const cart = useCartStore()\n const session = useSessionStore()\n const delivery = useDeliveryStore()\n const validateDiscount = useDiscountValidator()\n useStorefrontHead({ title: `Checkout — ${config.name}` })\n\n const paymentMethods = config.payments.methods\n const [selectedAddressId, setSelectedAddressId] = useState('new')\n const [savedAddresses, setSavedAddresses] = useState<CustomerAddress[]>([])\n // 'new' until the address book actually loads: an empty book must show an\n // empty form, never a placeholder address belonging to nobody.\n const [addressMode, setAddressMode] = useState<AddressMode>('new')\n const [paymentMethod, setPaymentMethod] = useState<PaymentMethodKind>(paymentMethods[0] ?? 'pix')\n const [form, setForm] = useState<CheckoutForm>({\n email: session.email ?? '',\n name: session.name ?? '',\n street: '',\n city: '',\n zip: '',\n number: '',\n complement: '',\n district: '',\n state: '',\n })\n const [error, setError] = useState<string | null>(null)\n const [discountCode, setDiscountCode] = useState('')\n const [discountError, setDiscountError] = useState<string | null>(null)\n const [discountSuccess, setDiscountSuccess] = useState<string | null>(null)\n const [applyingDiscount, setApplyingDiscount] = useState(false)\n const [placing, setPlacing] = useState(false)\n const [processingStep, setProcessingStep] = useState(0)\n const [showSignin, setShowSignin] = useState(false)\n const [zipLookup, setZipLookup] = useState<'idle' | 'loading' | 'found' | 'not-found'>('idle')\n\n const subtotal = selectSubtotal(cart)\n const discountTotal = selectDiscountTotal(cart)\n const shipping = selectShipping(cart, config)\n const total = selectTotal(cart, config)\n const money = (value: number) => formatMoney(value, config.currency, config.locale)\n\n useEffect(() => {\n if (cart.lines.length === 0 && !placing) navigateTo(config.catalogPath)\n }, [cart.lines.length, config.catalogPath, placing])\n\n\n const set = (key: keyof CheckoutForm) => (value: string) => setForm((current) => ({ ...current, [key]: value }))\n\n /**\n * Editing the CEP re-fetches the address and refills what the postal service\n * knows, leaving number and complement alone — those are the buyer's and must\n * survive a correction to the postcode.\n *\n * Only what the lookup can supply is overwritten. Silently keeping a stale\n * street from a previous CEP is worse than an empty one: the parcel goes to\n * the wrong place and everything on screen looks filled in.\n */\n async function setZip(value: string) {\n const masked = formatPostalCode(value)\n setForm((current) => ({ ...current, zip: masked }))\n if (normalizePostalCode(masked).length !== 8) {\n setZipLookup('idle')\n return\n }\n setZipLookup('loading')\n try {\n const found = await lookupPostalCode(masked)\n if (!found) {\n setZipLookup('not-found')\n return\n }\n setZipLookup('found')\n setForm((current) => ({\n ...current,\n street: found.street || current.street,\n district: found.district || current.district,\n city: found.city,\n state: found.state,\n }))\n } catch {\n // Offline or the provider is down — the buyer can still type it out.\n setZipLookup('idle')\n }\n }\n\n async function applyDiscountCode() {\n setApplyingDiscount(true)\n setDiscountError(null)\n setDiscountSuccess(null)\n try {\n const appliedCode = discountCode.trim().toUpperCase()\n const result = await validateDiscount(discountCode)\n if (result.valid) {\n cart.applyDiscount(appliedCode, result.percent)\n setDiscountCode(appliedCode)\n setDiscountSuccess(`${appliedCode} aplicado: ${result.percent}% de desconto.`)\n toast.success('Cupom aplicado!', `${appliedCode} • ${result.percent}% de desconto`)\n } else {\n setDiscountError(result.message ?? 'Cupom inválido.')\n toast.error('Cupom inválido', result.message ?? 'Verifique o código e tente novamente.')\n }\n } finally {\n setApplyingDiscount(false)\n }\n }\n\n function clearDiscountCode() {\n cart.clearDiscount()\n setDiscountCode('')\n setDiscountSuccess(null)\n setDiscountError(null)\n }\n\n // The signed-in shopper's real address book. RLS scopes it to them, so a\n // guest (or a customer whose account was never linked to an auth identity)\n // simply gets nothing back and types their address.\n useEffect(() => {\n const customerId = session.customerId\n if (!customerId) {\n setSavedAddresses([])\n setAddressMode('new')\n return\n }\n let cancelled = false\n const provider = getShopProvider()\n void provider\n .listCustomerAddresses?.(customerId)\n .then((addresses) => {\n if (cancelled || addresses.length === 0) return\n setSavedAddresses(addresses)\n applySavedAddress(addresses[0]!)\n })\n .catch(() => {})\n return () => {\n cancelled = true\n }\n }, [session.customerId])\n\n /**\n * The CEP given back on the product page lands here.\n *\n * This is the payoff of the whole delivery flow: street, district, city and\n * UF arrive filled and the buyer types a house number. It only fires when no\n * saved address was selected — a signed-in shopper's own address book still\n * wins over a postcode lookup, because it also knows their number and\n * complement, which no postal service can supply.\n */\n useEffect(() => {\n if (addressMode !== 'new') return\n const looked = delivery.address\n if (!looked) return\n setForm((current) => {\n if (current.zip.trim() || current.street.trim()) return current\n return {\n ...current,\n zip: formatPostalCode(looked.postalCode),\n street: looked.street,\n district: looked.district,\n city: looked.city,\n state: looked.state,\n }\n })\n }, [delivery.address, addressMode])\n\n function applySavedAddress(address: CustomerAddress) {\n setAddressMode('saved')\n setSelectedAddressId(address.id)\n setForm((current) => ({\n ...current,\n street: address.street,\n city: address.city,\n zip: address.postalCode,\n number: address.number ?? '',\n complement: address.complement ?? '',\n district: address.district ?? '',\n state: address.state,\n }))\n }\n\n function selectAddress(addressId: string) {\n const address = savedAddresses.find((item) => item.id === addressId)\n if (address) applySavedAddress(address)\n }\n\n function addNewAddress() {\n setAddressMode('new')\n setSelectedAddressId('new')\n setForm((current) => ({ ...current, street: '', city: '', zip: '', number: '', complement: '', district: '', state: '' }))\n }\n\n function validate(): boolean {\n setError(null)\n if (!form.email.trim() || !/.+@.+\\..+/.test(form.email)) {\n setError('Informe um e-mail válido.')\n return false\n }\n if (!form.name.trim()) {\n setError('Informe seu nome completo.')\n return false\n }\n // Number and district are required because a courier cannot deliver without\n // them; the old form collected only street/city/CEP and logistics had to guess.\n if (!form.street.trim() || !form.city.trim() || !form.zip.trim() || !form.district.trim()) {\n setError('Preencha ou selecione o endereço de entrega.')\n return false\n }\n // Called out on its own: with the CEP filling everything else, the number is\n // usually the only thing missing, and \"preencha o endereço\" sent people\n // hunting through fields that were already correct.\n if (!form.number.trim()) {\n setError('Falta o número do endereço.')\n return false\n }\n // UF is required now: 117 of the 266 addresses already in the pool have no\n // state, and a carrier cannot quote or ship without one.\n if (form.state.trim().length !== 2) {\n setError('Informe a UF com duas letras (ex.: RJ).')\n return false\n }\n // Coverage. shop_place_order refuses an unserved postal code anyway (0021),\n // so this only turns a raw SQL error into a sentence the buyer can act on —\n // the rule itself lives on the server, not here.\n if (delivery.status === 'unserved' && delivery.postalCode === normalizePostalCode(form.zip)) {\n setError('Ainda não entregamos nesse CEP. Tente outro endereço.')\n return false\n }\n return true\n }\n\n async function placeOrder() {\n if (!validate()) return\n\n setPlacing(true)\n setProcessingStep(0)\n const stepMs = prefersReducedMotion() ? 120 : 600\n const stepTimers = [\n setTimeout(() => setProcessingStep(1), stepMs),\n setTimeout(() => setProcessingStep(2), stepMs * 2),\n ]\n const minDuration = sleep(stepMs * 2)\n try {\n const { order, customerId } = await placeStorefrontOrder({\n config,\n cart,\n session,\n customer: { email: form.email, name: form.name },\n address: { street: form.street, city: form.city, zip: form.zip },\n shippingAddress: {\n postalCode: form.zip.trim(),\n street: form.street.trim(),\n number: form.number.trim() || undefined,\n complement: form.complement.trim() || undefined,\n district: form.district.trim() || undefined,\n city: form.city.trim(),\n state: form.state.trim().toUpperCase(),\n },\n // The method the buyer actually chose, which opens the ledger row in\n // public.transactions with the right kind.\n paymentMethod,\n // Never marked paid from the browser. It used to be, through an RPC that\n // was granted to anon — so any buyer holding their own order id could\n // declare it settled. The order is now born `pending` and only the\n // merchant (or a PSP webhook) can confirm the money arrived.\n })\n // placeStorefrontOrder resolves/creates the customer record but doesn't persist\n // it — without this, \"My purchases\" right after checkout queries by email, which\n // anon can't read under RLS, and silently comes back empty.\n if (customerId) session.setSession({ customerId, email: form.email, name: form.name })\n\n await minDuration\n cart.clear()\n navigateTo(`/order/${order.id}`)\n } catch (error) {\n setError(error instanceof Error ? error.message : 'Não foi possível concluir o pedido.')\n setPlacing(false)\n } finally {\n stepTimers.forEach(clearTimeout)\n }\n }\n\n const primaryCta = placing ? 'Processando...' : `Comprar agora - ${money(total)}`\n\n return (\n <main className=\"min-h-screen bg-background\">\n {placing && <ProcessingOverlay step={processingStep} />}\n {showSignin && !session.email && (\n <SignInModal\n defaultEmail={form.email}\n onClose={() => setShowSignin(false)}\n onSignedIn={(signed) =>\n setForm((current) => ({ ...current, email: signed.email ?? current.email, name: signed.name || current.name }))\n }\n />\n )}\n <header className=\"border-b bg-background\">\n <div className=\"mx-auto flex max-w-6xl items-center justify-between gap-4 px-4 py-6 sm:px-6\">\n <Link to={config.catalogPath} className=\"text-sm text-muted-foreground hover:text-foreground\">\n Voltar à loja\n </Link>\n <div className=\"text-center\">\n <div className=\"sf-heading text-2xl font-bold tracking-tight\">{config.logo ?? config.name}</div>\n <div className=\"mt-2 flex items-center justify-center gap-2 text-xs text-muted-foreground\">\n <Lock className=\"h-3.5 w-3.5\" />\n Checkout seguro\n </div>\n </div>\n <a href=\"mailto:suporte@example.com\" className=\"text-sm text-muted-foreground hover:text-foreground\">\n Ajuda\n </a>\n </div>\n </header>\n\n <div className=\"mx-auto grid max-w-6xl grid-cols-1 gap-8 px-4 py-8 sm:px-6 lg:grid-cols-5 lg:px-6\">\n <section className=\"lg:col-span-3 lg:pr-10\">\n <nav className=\"mb-8 flex flex-wrap items-center gap-2 text-sm text-muted-foreground\" aria-label=\"Checkout steps\">\n <span className=\"font-medium text-foreground\">Informações</span>\n <span>/</span>\n <span>Entrega</span>\n <span>/</span>\n <span>Pagamento</span>\n </nav>\n\n <div className=\"space-y-8\">\n <section>\n <div className=\"mb-3 flex items-center justify-between gap-4\">\n <h1 className=\"text-xl font-semibold tracking-tight\">Informações de contato</h1>\n {session.email ? (\n <span className=\"text-sm text-muted-foreground\">Conectado como {session.email}</span>\n ) : (\n <button\n type=\"button\"\n onClick={() => setShowSignin((value) => !value)}\n className=\"text-sm font-medium text-primary hover:underline\"\n >\n Já tem conta? Entrar\n </button>\n )}\n </div>\n <div className=\"grid gap-3 sm:grid-cols-2\">\n {field('E-mail', TID.checkoutEmail, form.email, set('email'), {\n type: 'email',\n placeholder: 'E-mail ou telefone',\n })}\n {field('Nome completo', TID.checkoutName, form.name, set('name'), {\n placeholder: 'Nome completo',\n })}\n </div>\n </section>\n\n <section>\n <h2 className=\"mb-3 text-xl font-semibold tracking-tight\">Endereço de entrega</h2>\n <div className=\"mb-3 grid gap-3\">\n {savedAddresses.map((address) => (\n <div\n key={address.id}\n className={`group relative rounded-lg border p-3 pr-11 text-left text-sm transition hover:bg-muted/40 ${\n selectedAddressId === address.id ? 'border-primary bg-primary/5' : 'border-border bg-background'\n }`}\n >\n <button type=\"button\" onClick={() => selectAddress(address.id)} className=\"block w-full text-left\">\n <span className=\"flex items-center justify-between gap-3 font-semibold\">\n {address.label}\n {addressMode === 'saved' && selectedAddressId === address.id && (\n <span className=\"rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-bold text-primary\">Selecionado</span>\n )}\n </span>\n <span className=\"mt-1 block text-muted-foreground\">\n {[address.street, address.number].filter(Boolean).join(', ')}\n {address.complement ? ` — ${address.complement}` : ''}\n </span>\n <span className=\"block text-muted-foreground\">\n {[address.district, address.city, address.state].filter(Boolean).join(' · ')} — {address.postalCode}\n </span>\n </button>\n </div>\n ))}\n <button\n type=\"button\"\n onClick={addNewAddress}\n className={`rounded-lg border border-dashed p-3 text-left text-sm transition hover:bg-muted/40 ${\n addressMode === 'new' ? 'border-primary bg-primary/5' : 'border-border bg-muted/20'\n }`}\n >\n <span className=\"block font-semibold text-primary\">\n {savedAddresses.length > 0 ? '+ Adicionar novo endereço' : 'Informe o endereço de entrega'}\n </span>\n <span className=\"mt-1 block text-muted-foreground\">Preencher outro endereço para esta compra</span>\n </button>\n </div>\n {addressMode === 'new' && (\n <div className=\"grid gap-3\">\n {/* CEP first, because it FILLS the fields below it. With it at\n the bottom the buyer typed street, district, city and UF by\n hand and only then reached the one field that would have\n supplied all four — and editing it later has to refill\n them, which reads as the form rewriting itself. */}\n <div className=\"grid gap-1 sm:grid-cols-[200px_1fr] sm:items-center\">\n {field('CEP', TID.checkoutZip, form.zip, setZip, {\n placeholder: 'CEP',\n inputMode: 'numeric',\n autoComplete: 'postal-code',\n })}\n <p className=\"px-1 text-xs text-muted-foreground\">\n {zipLookup === 'loading' ? 'Buscando endereço…'\n : zipLookup === 'not-found' ? 'CEP não encontrado — preencha o endereço à mão.'\n : 'Preenchemos o endereço para você.'}\n </p>\n </div>\n {field('Endereço', TID.checkoutStreet, form.street, set('street'), { placeholder: 'Rua, avenida…' })}\n <div className=\"grid grid-cols-2 gap-3\">\n {field('Número', 'checkout-number', form.number, set('number'), { placeholder: 'Número' })}\n {field('Complemento', 'checkout-complement', form.complement, set('complement'), { placeholder: 'Apto, bloco (opcional)' })}\n </div>\n <div className=\"grid grid-cols-2 gap-3\">\n {field('Bairro', 'checkout-district', form.district, set('district'), { placeholder: 'Bairro' })}\n {field('UF', 'checkout-state', form.state, set('state'), { placeholder: 'UF' })}\n </div>\n {field('Cidade', TID.checkoutCity, form.city, set('city'), { placeholder: 'Cidade' })}\n </div>\n )}\n </section>\n\n <section>\n <h2 className=\"mb-3 text-xl font-semibold tracking-tight\">Pagamento</h2>\n <div className=\"mb-3 grid gap-3\" role=\"radiogroup\" aria-label=\"Forma de pagamento\">\n {paymentMethods.map((method) => {\n const copy = PAYMENT_LABELS[method]\n const selected = paymentMethod === method\n return (\n <button\n key={method}\n type=\"button\"\n role=\"radio\"\n aria-checked={selected}\n data-testid={`checkout-payment-${method}`}\n onClick={() => setPaymentMethod(method)}\n className={`rounded-lg border p-3 text-left text-sm transition hover:bg-muted/40 ${\n selected ? 'border-primary bg-primary/5' : 'border-border bg-background'\n }`}\n >\n <span className=\"flex items-center justify-between gap-3 font-semibold\">\n <span className=\"flex items-center gap-2\"><CreditCard className=\"h-4 w-4\" />{copy.label}</span>\n {selected && (\n <span className=\"rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-bold text-primary\">Selecionado</span>\n )}\n </span>\n <span className=\"mt-1 block text-muted-foreground\">{copy.hint}</span>\n </button>\n )\n })}\n </div>\n <p className=\"mt-2 text-xs text-muted-foreground\">\n Nenhuma cobrança é feita agora. Seu pedido é registrado e a loja confirma o pagamento.\n </p>\n </section>\n\n {error && (\n <p data-testid={TID.checkoutError} className=\"rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive\">\n {error}\n </p>\n )}\n\n </div>\n\n <footer className=\"mt-10 flex flex-wrap gap-4 border-t pt-5 text-xs text-muted-foreground\">\n <a href=\"#/privacy\" className=\"hover:text-foreground\">Privacidade</a>\n <a href=\"#/terms\" className=\"hover:text-foreground\">Termos</a>\n <a href=\"#/refunds\" className=\"hover:text-foreground\">Trocas e devoluções</a>\n </footer>\n </section>\n\n <aside className=\"rounded-xl border bg-muted/20 p-5 lg:sticky lg:top-6 lg:col-span-2 lg:self-start\">\n <h2 className=\"sr-only\">Resumo do pedido</h2>\n <ul className=\"space-y-4\">\n {cart.lines.map((line) => (\n <li key={line.lineId ?? line.productId} className=\"flex gap-3 text-sm\">\n <div className=\"relative h-16 w-16 flex-none overflow-hidden rounded-lg border bg-background\">\n {line.imageUrl && <SmoothImage src={line.imageUrl} alt={line.name} className=\"h-full w-full object-cover\" />}\n <span className=\"absolute -right-1 -top-1 flex h-5 min-w-5 items-center justify-center rounded-full bg-muted-foreground px-1.5 text-[10px] font-bold text-background\">\n {line.quantity}\n </span>\n </div>\n <div className=\"min-w-0 flex-1\">\n <p className=\"truncate font-medium\">{line.name}</p>\n {line.sku && <p className=\"text-xs text-muted-foreground\">{line.sku}</p>}\n {line.optionsLabel && <p className=\"text-xs text-muted-foreground\">{line.optionsLabel}</p>}\n </div>\n <span data-price={(line.unitPrice * line.quantity).toFixed(2)}>\n {money(line.unitPrice * line.quantity)}\n </span>\n </li>\n ))}\n </ul>\n {config.features.discounts && (\n <div className=\"mt-5 space-y-2 border-t pt-5\">\n <div className=\"flex gap-2\">\n <input\n data-testid={TID.discountInput}\n type=\"text\"\n placeholder=\"Cupom de desconto\"\n value={discountCode}\n onChange={(event) => {\n setDiscountCode(event.target.value)\n setDiscountSuccess(null)\n setDiscountError(null)\n }}\n className=\"min-w-0 flex-1 rounded-lg border bg-background px-3 py-2 text-sm uppercase\"\n />\n <button\n type=\"button\"\n data-testid={TID.discountApply}\n onClick={applyDiscountCode}\n disabled={applyingDiscount || !discountCode.trim()}\n className=\"rounded-lg border px-3 py-2 text-sm font-semibold hover:bg-muted disabled:opacity-50\"\n >\n Aplicar\n </button>\n </div>\n {discountError && (\n <p data-testid={TID.discountError} className=\"text-xs text-destructive\">\n {discountError}\n </p>\n )}\n {discountSuccess && (\n <p className=\"text-xs font-semibold text-emerald-700\">\n {discountSuccess}\n </p>\n )}\n </div>\n )}\n <dl className=\"mt-8 space-y-3 border-t pt-6 text-sm\">\n <div className=\"flex justify-between\">\n <dt className=\"text-muted-foreground\">Subtotal</dt>\n <dd data-price={subtotal.toFixed(2)}>{money(subtotal)}</dd>\n </div>\n {discountTotal > 0 && (\n <div className=\"flex justify-between text-emerald-700\" data-testid={TID.discountRow}>\n <dt>\n Desconto{' '}\n <button\n type=\"button\"\n onClick={clearDiscountCode}\n className=\"text-xs text-muted-foreground underline\"\n >\n ({cart.discountCode} ×)\n </button>\n </dt>\n <dd data-price={discountTotal.toFixed(2)}>-{money(discountTotal)}</dd>\n </div>\n )}\n <div className=\"flex justify-between\">\n <dt className=\"text-muted-foreground\">Entrega</dt>\n <dd data-price={shipping.toFixed(2)}>{shipping === 0 ? 'Grátis' : money(shipping)}</dd>\n </div>\n <div className=\"flex justify-between border-t pt-5 text-lg font-bold\">\n <dt>Total</dt>\n <dd data-price={total.toFixed(2)}>{money(total)}</dd>\n </div>\n </dl>\n <div className=\"mt-6 flex items-center gap-2 text-xs text-muted-foreground\">\n <ShieldCheck className=\"h-4 w-4 text-primary\" />\n Compra protegida e dados criptografados.\n </div>\n <div className=\"mt-6 grid gap-3 border-t pt-5\">\n <button\n type=\"button\"\n data-testid={TID.placeOrder}\n onClick={placeOrder}\n disabled={placing}\n className=\"rounded-lg bg-primary px-6 py-4 text-sm font-bold text-primary-foreground transition hover:opacity-90 disabled:opacity-60\"\n >\n {primaryCta}\n </button>\n <Link to={config.catalogPath} className=\"text-center text-sm text-muted-foreground hover:text-foreground\">\n Voltar ao carrinho\n </Link>\n </div>\n </aside>\n </div>\n </main>\n )\n}\n","import React from 'react'\nimport { CreditCard, LogOut, MapPin, Package, ShieldCheck, User } from 'lucide-react'\nimport { signOutCustomer } from '../auth'\nimport { useStorefrontConfig } from '../config'\nimport { Link } from '../router'\nimport { useSessionStore } from '../stores/session.store'\nimport { TID } from '../testids'\n\nexport type AccountSection = 'profile' | 'orders' | 'addresses' | 'payments'\n\ninterface CustomerAccountShellProps {\n title: string\n subtitle?: string\n active: AccountSection\n /** Switch the active section in-place. */\n onSelect?: (section: AccountSection) => void\n children: React.ReactNode\n}\n\nconst menuItems = [\n { id: 'profile', label: 'Perfil', icon: User },\n { id: 'orders', label: 'Meus pedidos', icon: Package },\n { id: 'addresses', label: 'Endereços', icon: MapPin },\n { id: 'payments', label: 'Pagamentos', icon: CreditCard },\n] as const\n\nexport function CustomerAccountShell({ title, subtitle, active, onSelect, children }: CustomerAccountShellProps) {\n const config = useStorefrontConfig()\n const session = useSessionStore()\n const displayName = session.name || session.email?.split('@')[0] || 'Cliente'\n const displayEmail = session.email || 'Conta criada no checkout'\n\n return (\n <main data-testid={TID.customerAccountShell} className=\"mx-auto max-w-6xl px-4 py-8 sm:px-6\">\n <div className=\"mb-6 flex flex-wrap items-center justify-between gap-4\">\n <div>\n <p className=\"text-sm font-medium text-muted-foreground\">{config.name}</p>\n <h1 className=\"sf-heading text-3xl font-bold tracking-tight\">{title}</h1>\n {subtitle && <p className=\"mt-1 text-sm text-muted-foreground\">{subtitle}</p>}\n </div>\n <Link to={config.catalogPath} className=\"rounded-lg border px-4 py-2 text-sm font-semibold hover:bg-muted\">\n Voltar à loja\n </Link>\n </div>\n\n <div className=\"grid gap-6 lg:grid-cols-[260px_minmax(0,1fr)]\">\n <aside className=\"h-fit rounded-xl border bg-card p-4\">\n <div className=\"flex items-center gap-3 border-b pb-4\">\n <div className=\"flex h-11 w-11 items-center justify-center rounded-full bg-primary/10 font-bold text-primary\">\n {displayName.slice(0, 1).toUpperCase()}\n </div>\n <div className=\"min-w-0\">\n <p className=\"truncate font-semibold\">{displayName}</p>\n <p className=\"truncate text-xs text-muted-foreground\">{displayEmail}</p>\n </div>\n </div>\n\n <nav data-testid={TID.customerAccountMenu} className=\"mt-4 space-y-1\" aria-label=\"Área do cliente\">\n {menuItems.map((item) => {\n const Icon = item.icon\n const selected = item.id === active\n return (\n <button\n key={item.id}\n type=\"button\"\n aria-current={selected ? 'page' : undefined}\n onClick={() => onSelect?.(item.id)}\n className={`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left text-sm font-semibold transition ${\n selected ? 'bg-primary/10 text-primary' : 'text-muted-foreground hover:bg-muted hover:text-foreground'\n }`}\n >\n <Icon className=\"h-4 w-4\" />\n {item.label}\n </button>\n )\n })}\n </nav>\n\n <div className=\"mt-4 rounded-lg bg-muted/40 p-3 text-xs text-muted-foreground\">\n <div className=\"flex items-center gap-2 font-semibold text-foreground\">\n <ShieldCheck className=\"h-4 w-4 text-primary\" />\n Conta protegida\n </div>\n <p className=\"mt-1\">Pedidos, pagamentos e endereços ficam organizados para próximas compras.</p>\n </div>\n\n <button\n type=\"button\"\n data-testid={TID.signout}\n onClick={() => void signOutCustomer()}\n className=\"mt-4 flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-sm font-semibold text-muted-foreground transition hover:bg-muted hover:text-foreground\"\n >\n <LogOut className=\"h-4 w-4\" />\n Sair\n </button>\n </aside>\n\n <section className=\"min-w-0\">{children}</section>\n </div>\n </main>\n )\n}\n","import type { FinancialStatus } from '@fayz-ai/shop/types'\n\ntype Tone = 'positive' | 'pending' | 'negative'\n\nconst FINANCIAL: Record<FinancialStatus, { label: string; tone: Tone }> = {\n pending: { label: 'Pendente', tone: 'pending' },\n paid: { label: 'Pago', tone: 'positive' },\n partially_paid: { label: 'Parcialmente pago', tone: 'pending' },\n partially_refunded: { label: 'Parcialmente reembolsado', tone: 'negative' },\n refunded: { label: 'Reembolsado', tone: 'negative' },\n voided: { label: 'Cancelado', tone: 'negative' },\n}\n\nconst TONE_CLASS: Record<Tone, string> = {\n positive: 'bg-emerald-100 text-emerald-800',\n pending: 'bg-amber-100 text-amber-800',\n negative: 'bg-rose-100 text-rose-800',\n}\n\n/** One source of truth for a financial-status pill — label + color by status,\n * so a pending or refunded order never renders inside a green \"success\" pill. */\nexport function financialStatusBadge(status: FinancialStatus): { label: string; className: string } {\n const entry = FINANCIAL[status] ?? { label: status, tone: 'pending' as Tone }\n return { label: entry.label, className: TONE_CLASS[entry.tone] }\n}\n\nexport function isPaid(status: FinancialStatus): boolean {\n return status === 'paid' || status === 'partially_paid'\n}\n\nexport function isRefunded(status: FinancialStatus): boolean {\n return status === 'refunded' || status === 'partially_refunded'\n}\n","import React from 'react'\nimport { Check, Clock, PackageCheck, RotateCcw, Truck, XCircle } from 'lucide-react'\nimport type { Order } from '@fayz-ai/shop/types'\nimport { isPaid, isRefunded } from '../order-status'\nimport { TID } from '../testids'\n\ntype TrackingState = 'complete' | 'current' | 'pending' | 'cancelled'\n\ninterface TrackingStep {\n id: string\n label: string\n description: string\n state: TrackingState\n icon: React.ComponentType<{ className?: string }>\n}\n\nfunction orderTrackingSteps(order: Order): TrackingStep[] {\n const received: TrackingStep = {\n id: 'received',\n label: 'Pedido recebido',\n description: `#${order.orderNumber}`,\n state: 'complete',\n icon: Check,\n }\n\n // Terminal states short-circuit the happy path.\n if (order.status === 'cancelled' || order.financialStatus === 'voided') {\n return [\n received,\n { id: 'payment', label: 'Pedido cancelado', description: 'Este pedido foi cancelado', state: 'cancelled', icon: XCircle },\n ]\n }\n if (isRefunded(order.financialStatus)) {\n return [\n received,\n { id: 'payment', label: 'Pagamento aprovado', description: 'Compra confirmada', state: 'complete', icon: Check },\n {\n id: 'refund',\n label: order.financialStatus === 'refunded' ? 'Reembolsado' : 'Reembolso parcial',\n description: 'Valor devolvido ao cliente',\n state: 'cancelled',\n icon: RotateCcw,\n },\n ]\n }\n\n const paid = isPaid(order.financialStatus)\n const partiallyFulfilled = order.fulfillmentStatus === 'partially_fulfilled'\n const fulfilled = order.fulfillmentStatus === 'fulfilled'\n\n return [\n received,\n {\n id: 'payment',\n label: paid ? 'Pagamento aprovado' : 'Aguardando pagamento',\n description: paid ? 'Compra confirmada' : 'Processando',\n state: paid ? 'complete' : 'current',\n icon: Check,\n },\n {\n id: 'preparing',\n label: 'Preparando envio',\n description: paid ? 'Separando produtos' : 'Começa após o pagamento',\n state: fulfilled || partiallyFulfilled ? 'complete' : paid ? 'current' : 'pending',\n icon: PackageCheck,\n },\n {\n id: 'delivery',\n label: fulfilled ? 'Pedido enviado' : partiallyFulfilled ? 'Envio parcial' : 'Entrega',\n description: fulfilled ? 'A caminho do cliente' : partiallyFulfilled ? 'Parte do pedido saiu' : 'Próxima etapa',\n state: fulfilled ? 'complete' : partiallyFulfilled ? 'current' : 'pending',\n icon: fulfilled || partiallyFulfilled ? Truck : Clock,\n },\n ]\n}\n\nconst GRID_COLS: Record<number, string> = {\n 2: 'sm:grid-cols-2',\n 3: 'sm:grid-cols-3',\n 4: 'sm:grid-cols-4',\n}\n\nexport function OrderTrackingTimeline({ order, compact = false }: { order: Order; compact?: boolean }) {\n const steps = orderTrackingSteps(order)\n\n return (\n <ol\n data-testid={TID.orderTracking}\n className={`grid ${compact ? 'gap-2' : 'gap-3'} ${GRID_COLS[steps.length] ?? 'sm:grid-cols-4'}`}\n aria-label=\"Acompanhamento do pedido\"\n >\n {steps.map((step) => {\n const Icon = step.icon\n const cancelled = step.state === 'cancelled'\n const active = step.state !== 'pending'\n return (\n <li\n key={step.id}\n data-testid={TID.orderTrackingStep(step.id)}\n data-state={step.state}\n className={[\n 'relative min-w-0 rounded-xl border p-3',\n cancelled\n ? 'border-rose-200 bg-rose-50 text-rose-700'\n : active\n ? 'border-primary/35 bg-primary/5'\n : 'bg-muted/20 text-muted-foreground',\n compact ? 'text-xs' : 'text-sm',\n ].join(' ')}\n >\n <div className=\"flex items-start gap-2\">\n <span\n className={[\n 'grid h-7 w-7 shrink-0 place-items-center rounded-full border',\n cancelled\n ? 'border-rose-300 bg-rose-500 text-white'\n : active\n ? 'border-primary bg-primary text-primary-foreground'\n : 'border-muted-foreground/30 bg-background',\n ].join(' ')}\n aria-hidden\n >\n <Icon className=\"h-3.5 w-3.5\" />\n </span>\n <span className=\"min-w-0\">\n <span className=\"block truncate font-semibold text-foreground\">{step.label}</span>\n <span className=\"mt-0.5 block truncate text-muted-foreground\">{step.description}</span>\n </span>\n </div>\n </li>\n )\n })}\n </ol>\n )\n}\n","import React, { useEffect, useState } from 'react'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport { prefersReducedMotion } from '../motion'\nimport type { Order } from '@fayz-ai/shop/types'\nimport { useStorefrontConfig } from '../config'\nimport { Link } from '../router'\nimport { formatMoney } from '../format'\nimport { TID } from '../testids'\nimport { CustomerAccountShell } from '../components/CustomerAccountShell'\nimport { OrderTrackingTimeline } from '../components/OrderTrackingTimeline'\nimport { financialStatusBadge } from '../order-status'\nimport { useStorefrontHead } from '../hooks/useStorefrontHead'\nimport { SmoothImage } from '../components/SmoothImage'\n\nconst CONFETTI_COLORS = ['hsl(var(--primary))', '#f59e0b', '#10b981', '#3b82f6', '#ec4899']\n\n/** One-shot celebration: circle pops in, check draws itself, confetti rains. */\nfunction SuccessMark() {\n const reduced = prefersReducedMotion()\n return (\n <div className=\"relative mx-auto h-24 w-24\">\n {!reduced &&\n Array.from({ length: 14 }, (_, i) => (\n <span\n key={i}\n aria-hidden\n className=\"absolute h-2 w-2 animate-confetti-fall rounded-sm\"\n style={{\n left: `${(i * 7.3) % 100}%`,\n top: '-4px',\n backgroundColor: CONFETTI_COLORS[i % CONFETTI_COLORS.length],\n animationDelay: `${200 + (i % 7) * 90}ms`,\n }}\n />\n ))}\n <span className={`absolute inset-0 rounded-full bg-emerald-100 ${reduced ? '' : 'animate-pop-in'}`} />\n <svg viewBox=\"0 0 48 48\" className=\"absolute inset-0 h-full w-full p-6\" aria-hidden>\n <path\n d=\"M10 25 L20 35 L38 14\"\n fill=\"none\"\n stroke=\"rgb(5 150 105)\"\n strokeWidth=\"5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n strokeDasharray=\"48\"\n className={reduced ? '' : 'animate-draw-check'}\n />\n </svg>\n </div>\n )\n}\n\nexport function OrderConfirmationPage({ orderId }: { orderId: string }) {\n const config = useStorefrontConfig()\n const [order, setOrder] = useState<Order | null>(null)\n const [loading, setLoading] = useState(true)\n const money = (v: number) => formatMoney(v, config.currency, config.locale)\n useStorefrontHead({ title: order ? `Pedido #${order.orderNumber} — ${config.name}` : config.name })\n\n useEffect(() => {\n let cancelled = false\n getShopProvider()\n .getOrder(orderId)\n .then((o) => {\n if (!cancelled) setOrder(o)\n })\n .finally(() => {\n if (!cancelled) setLoading(false)\n })\n return () => {\n cancelled = true\n }\n }, [orderId])\n\n if (loading) {\n return <main className=\"mx-auto max-w-2xl px-4 py-20 text-center text-muted-foreground\">Carregando…</main>\n }\n if (!order) {\n return (\n <main className=\"mx-auto max-w-2xl px-4 py-20 text-center\">\n <p className=\"text-muted-foreground\">Pedido não encontrado.</p>\n <Link to=\"/\" className=\"mt-4 inline-block text-primary underline\">Voltar à loja</Link>\n </main>\n )\n }\n\n return (\n <CustomerAccountShell\n title=\"Detalhe do pedido\"\n subtitle=\"Compra confirmada e vinculada à sua conta.\"\n active=\"orders\"\n >\n <article data-testid={TID.orderDetail} className=\"animate-fade-up rounded-xl border bg-card p-6 sm:p-8\">\n <div className=\"grid gap-6 border-b pb-6 sm:grid-cols-[120px_minmax(0,1fr)]\">\n <SuccessMark />\n <div className=\"text-center sm:text-left\">\n <h2 className=\"sf-heading text-3xl font-bold tracking-tight\">\n Pedido confirmado!\n </h2>\n <p className=\"mt-1 text-muted-foreground\">\n Obrigado pela compra, {order.customerName ?? 'cliente'}. Enviamos a confirmação para {order.customerEmail}.\n </p>\n <p className=\"mt-4 text-lg\">\n Pedido <span data-testid={TID.orderNumber} className=\"font-semibold\">#{order.orderNumber}</span>{' '}\n <span\n data-testid={TID.orderStatus}\n className={`ml-2 inline-flex rounded-full px-2.5 py-0.5 text-sm font-medium ${financialStatusBadge(order.financialStatus).className}`}\n >\n {financialStatusBadge(order.financialStatus).label}\n </span>\n </p>\n </div>\n </div>\n\n <div className=\"mt-6 grid gap-4 rounded-xl border bg-muted/20 p-4 text-sm sm:grid-cols-3\">\n <div>\n <p className=\"text-muted-foreground\">Cliente</p>\n <p className=\"mt-1 font-semibold\">{order.customerName ?? 'Cliente'}</p>\n <p className=\"text-muted-foreground\">{order.customerEmail}</p>\n </div>\n <div>\n <p className=\"text-muted-foreground\">Entrega</p>\n <p className=\"mt-1 font-semibold\">{order.fulfillmentStatus === 'fulfilled' ? 'Enviado' : 'Preparando envio'}</p>\n <p className=\"text-muted-foreground\">{order.notes ?? 'Endereço salvo no pedido'}</p>\n </div>\n <div>\n <p className=\"text-muted-foreground\">Pagamento</p>\n <p className=\"mt-1 font-semibold\">{financialStatusBadge(order.financialStatus).label}</p>\n <p className=\"text-muted-foreground\">Processado no checkout</p>\n </div>\n </div>\n\n <div className=\"mt-6\">\n <h3 className=\"mb-3 text-sm font-semibold uppercase text-muted-foreground\">\n Acompanhamento\n </h3>\n <OrderTrackingTimeline order={order} />\n </div>\n\n <ul className=\"mt-8 space-y-3 text-left\">\n {order.items.map((item) => (\n <li key={item.id} className=\"flex items-center gap-3 text-sm\">\n {item.imageUrl && <SmoothImage src={item.imageUrl} alt={item.name} className=\"h-12 w-12 rounded-lg border object-cover\" />}\n <span className=\"flex-1\">\n {item.name} <span className=\"text-muted-foreground\">× {item.quantity}</span>\n </span>\n <span data-price={item.total.toFixed(2)}>{money(item.total)}</span>\n </li>\n ))}\n </ul>\n\n <dl className=\"mt-4 space-y-1.5 border-t pt-4 text-left text-sm\">\n <div className=\"flex justify-between\">\n <dt className=\"text-muted-foreground\">Subtotal</dt>\n <dd data-price={order.subtotal.toFixed(2)}>{money(order.subtotal)}</dd>\n </div>\n {order.discountTotal > 0 && (\n <div className=\"flex justify-between text-emerald-700\">\n <dt>Desconto {order.discountCode ? `(${order.discountCode})` : ''}</dt>\n <dd data-price={order.discountTotal.toFixed(2)}>−{money(order.discountTotal)}</dd>\n </div>\n )}\n <div className=\"flex justify-between\">\n <dt className=\"text-muted-foreground\">Frete</dt>\n <dd data-price={order.shippingTotal.toFixed(2)}>\n {order.shippingTotal === 0 ? 'Grátis' : money(order.shippingTotal)}\n </dd>\n </div>\n <div className=\"flex justify-between border-t pt-2 text-base font-semibold\">\n <dt>Total</dt>\n <dd data-testid={TID.orderTotal} data-price={order.total.toFixed(2)}>{money(order.total)}</dd>\n </div>\n </dl>\n\n <div className=\"mt-8 flex flex-wrap gap-3\">\n <Link\n to=\"/account\"\n data-testid={TID.viewPurchases}\n className=\"rounded-xl bg-primary px-5 py-2.5 font-semibold text-primary-foreground hover:opacity-90\"\n >\n Minhas compras\n </Link>\n <Link to=\"/\" className=\"rounded-xl border px-5 py-2.5 font-semibold hover:bg-muted\">\n Continuar comprando\n </Link>\n </div>\n </article>\n </CustomerAccountShell>\n )\n}\n","import { useCallback, useEffect, useState } from 'react'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport type { Order } from '@fayz-ai/shop/types'\nimport { useSessionStore } from '../stores/session.store'\n\nexport function useMyOrders(): { orders: Order[]; loading: boolean; refresh: () => void } {\n const customerId = useSessionStore((s) => s.customerId)\n const email = useSessionStore((s) => s.email)\n const [orders, setOrders] = useState<Order[]>([])\n const [loading, setLoading] = useState(true)\n const [tick, setTick] = useState(0)\n\n const refresh = useCallback(() => setTick((t) => t + 1), [])\n\n useEffect(() => {\n let cancelled = false\n if (!customerId && !email) {\n setOrders([])\n setLoading(false)\n return\n }\n setLoading(true)\n // Scope by customerId (RLS-enforced to the owner on Supabase) when available;\n // fall back to email only for legacy sessions without a linked customer.\n const query = customerId ? { customerId, limit: 50 } : { customerEmail: email!, limit: 50 }\n getShopProvider()\n .listOrders(query)\n .then((data) => {\n if (!cancelled) setOrders(data)\n })\n .catch(() => {})\n .finally(() => {\n if (!cancelled) setLoading(false)\n })\n return () => {\n cancelled = true\n }\n }, [customerId, email, tick])\n\n return { orders, loading, refresh }\n}\n","import React, { useState } from 'react'\nimport { CreditCard, MapPin, Package, QrCode } from 'lucide-react'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport { useSessionStore } from '../stores/session.store'\nimport { establishCustomerSession, signUpCustomer } from '../auth'\nimport { useMyOrders } from '../hooks/useMyOrders'\nimport { useStorefrontConfig } from '../config'\nimport { Link } from '../router'\nimport { formatMoney } from '../format'\nimport { TID } from '../testids'\nimport { CustomerAccountShell, type AccountSection } from '../components/CustomerAccountShell'\nimport { OrderTrackingTimeline } from '../components/OrderTrackingTimeline'\nimport { financialStatusBadge } from '../order-status'\nimport { useStorefrontHead } from '../hooks/useStorefrontHead'\nimport { SmoothImage } from '../components/SmoothImage'\n\nfunction AuthForm() {\n const [mode, setMode] = useState<'signin' | 'signup'>('signin')\n const [email, setEmail] = useState('')\n const [password, setPassword] = useState('')\n const [name, setName] = useState('')\n const [busy, setBusy] = useState(false)\n const [error, setError] = useState<string | null>(null)\n\n async function submit(e: React.FormEvent) {\n e.preventDefault()\n setError(null)\n if (!email.trim() || !password) return\n if (mode === 'signup' && !name.trim()) {\n setError('Informe seu nome.')\n return\n }\n setBusy(true)\n try {\n if (mode === 'signup') await signUpCustomer(email, password, name.trim())\n else await establishCustomerSession(email, { password })\n } catch (err) {\n setError(err instanceof Error ? err.message : 'Não foi possível entrar. Verifique seus dados.')\n } finally {\n setBusy(false)\n }\n }\n\n const tab = (id: 'signin' | 'signup', label: string, testId: string) => (\n <button\n type=\"button\"\n data-testid={testId}\n onClick={() => {\n setMode(id)\n setError(null)\n }}\n className={`flex-1 border-b-2 pb-2.5 text-sm font-semibold transition-colors ${\n mode === id ? 'border-primary text-primary' : 'border-transparent text-muted-foreground hover:text-foreground'\n }`}\n >\n {label}\n </button>\n )\n\n return (\n <div className=\"mx-auto max-w-sm animate-fade-up border bg-card p-7\" style={{ borderRadius: 'var(--sf-radius-card)' }}>\n <h2 className=\"sf-heading text-xl font-semibold\">Minha conta</h2>\n <p className=\"mt-1 text-sm text-muted-foreground\">\n Acompanhe pedidos e acelere seus próximos checkouts.\n </p>\n <div className=\"mt-5 flex gap-2\">\n {tab('signin', 'Entrar', TID.authTabSignin)}\n {tab('signup', 'Criar conta', TID.authTabSignup)}\n </div>\n <form className=\"mt-5 space-y-3\" onSubmit={submit}>\n {mode === 'signup' && (\n <input\n data-testid={TID.signinName}\n type=\"text\"\n required\n placeholder=\"Nome completo\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n className=\"w-full border bg-background px-3 py-2.5 text-sm\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n )}\n <input\n data-testid={TID.signinEmail}\n type=\"email\"\n required\n placeholder=\"voce@exemplo.com\"\n value={email}\n onChange={(e) => setEmail(e.target.value)}\n className=\"w-full border bg-background px-3 py-2.5 text-sm\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n <input\n data-testid={TID.signinPassword}\n type=\"password\"\n required\n placeholder=\"Senha\"\n value={password}\n onChange={(e) => setPassword(e.target.value)}\n className=\"w-full border bg-background px-3 py-2.5 text-sm\"\n style={{ borderRadius: 'var(--sf-radius-input)' }}\n />\n {error && (\n <p data-testid={TID.authError} className=\"text-sm text-destructive\">{error}</p>\n )}\n <button\n type=\"submit\"\n data-testid={TID.signinSubmit}\n disabled={busy}\n className=\"sf-cta w-full bg-primary py-3 font-semibold text-primary-foreground shadow-md transition-all hover:-translate-y-0.5 hover:shadow-lg disabled:opacity-60\"\n style={{ borderRadius: 'var(--sf-radius-button)' }}\n >\n {busy ? 'Entrando…' : mode === 'signup' ? 'Criar conta' : 'Entrar'}\n </button>\n </form>\n </div>\n )\n}\n\nfunction OrdersPanel() {\n const config = useStorefrontConfig()\n const { orders, loading } = useMyOrders()\n const money = (v: number) => formatMoney(v, config.currency, config.locale)\n\n if (loading) return <div className=\"py-16 text-center text-muted-foreground\">Carregando…</div>\n if (orders.length === 0) {\n return (\n <div data-testid={TID.purchasesEmpty} className=\"rounded-2xl border bg-card py-16 text-center\">\n <Package className=\"mx-auto h-10 w-10 text-muted-foreground\" />\n <p className=\"mt-3 text-muted-foreground\">Você ainda não tem pedidos.</p>\n <Link to=\"/\" className=\"mt-4 inline-block text-primary underline\">Explorar a loja</Link>\n </div>\n )\n }\n return (\n <ul data-testid={TID.purchasesList} className=\"space-y-4\">\n {orders.map((order) => (\n <li\n key={order.id}\n data-testid={TID.purchaseItem}\n data-order-number={order.orderNumber}\n className=\"rounded-2xl border bg-card p-5\"\n >\n <div className=\"flex items-center justify-between\">\n <span className=\"font-semibold\">Pedido #{order.orderNumber}</span>\n <span className={`inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium ${financialStatusBadge(order.financialStatus).className}`}>\n {financialStatusBadge(order.financialStatus).label}\n </span>\n </div>\n <p className=\"mt-0.5 text-xs text-muted-foreground\">\n {new Date(order.createdAt).toLocaleDateString(config.locale)}\n </p>\n <div className=\"mt-4\">\n <OrderTrackingTimeline order={order} compact />\n </div>\n <ul className=\"mt-3 flex flex-wrap gap-2\">\n {order.items.map((item) => (\n <li key={item.id} className=\"flex items-center gap-2 rounded-lg border px-2 py-1 text-xs\">\n {item.imageUrl && <SmoothImage src={item.imageUrl} alt={item.name} className=\"h-6 w-6 rounded object-cover\" />}\n {item.name} × {item.quantity}\n </li>\n ))}\n </ul>\n <div className=\"mt-3 flex items-center justify-between border-t pt-3 text-sm\">\n <Link to={`/order/${order.id}`} className=\"font-medium text-primary hover:underline\">\n Ver detalhes\n </Link>\n <span>\n <span className=\"mr-2 text-muted-foreground\">Total</span>\n <span className=\"font-semibold\" data-price={order.total.toFixed(2)}>{money(order.total)}</span>\n </span>\n </div>\n </li>\n ))}\n </ul>\n )\n}\n\nfunction ProfilePanel() {\n const session = useSessionStore()\n const [name, setName] = useState(session.name ?? '')\n const [saving, setSaving] = useState(false)\n const [saved, setSaved] = useState(false)\n\n async function save(e: React.FormEvent) {\n e.preventDefault()\n const trimmed = name.trim()\n if (!trimmed) return\n setSaving(true)\n setSaved(false)\n try {\n if (session.customerId) {\n const parts = trimmed.split(/\\s+/).filter(Boolean)\n await getShopProvider().updateCustomer(session.customerId, {\n firstName: parts[0] ?? trimmed,\n lastName: parts.slice(1).join(' '),\n })\n }\n useSessionStore.setState({ name: trimmed })\n setSaved(true)\n } finally {\n setSaving(false)\n }\n }\n\n return (\n <form onSubmit={save} className=\"max-w-md rounded-2xl border bg-card p-6\">\n <h2 className=\"sf-heading text-lg font-semibold\">Perfil</h2>\n <p className=\"mt-1 text-sm text-muted-foreground\">Seus dados para os próximos checkouts.</p>\n <label className=\"mt-5 block text-sm font-medium\">\n Nome completo\n <input\n value={name}\n onChange={(e) => { setName(e.target.value); setSaved(false) }}\n className=\"mt-1 w-full rounded-lg border bg-background px-3 py-2.5 text-sm\"\n placeholder=\"Seu nome\"\n />\n </label>\n <label className=\"mt-4 block text-sm font-medium\">\n E-mail\n <input\n value={session.email ?? ''}\n readOnly\n className=\"mt-1 w-full cursor-not-allowed rounded-lg border bg-muted/40 px-3 py-2.5 text-sm text-muted-foreground\"\n />\n </label>\n <div className=\"mt-5 flex items-center gap-3\">\n <button\n type=\"submit\"\n disabled={saving}\n className=\"sf-cta rounded-lg bg-primary px-5 py-2.5 text-sm font-semibold text-primary-foreground disabled:opacity-60\"\n >\n {saving ? 'Salvando…' : 'Salvar'}\n </button>\n {saved && <span className=\"text-sm font-medium text-emerald-700\">Salvo</span>}\n </div>\n </form>\n )\n}\n\nfunction AddressesPanel() {\n return (\n <div className=\"rounded-2xl border bg-card p-6\">\n <div className=\"flex items-center gap-2\">\n <MapPin className=\"h-5 w-5 text-primary\" />\n <h2 className=\"sf-heading text-lg font-semibold\">Endereços</h2>\n </div>\n <p className=\"mt-2 text-sm text-muted-foreground\">\n Você informa o endereço de entrega no checkout. Em breve será possível salvar endereços para reutilizar\n nas próximas compras.\n </p>\n <Link to=\"/\" className=\"mt-4 inline-block text-sm font-semibold text-primary underline\">\n Continuar comprando\n </Link>\n </div>\n )\n}\n\nfunction PaymentsPanel() {\n return (\n <div className=\"rounded-2xl border bg-card p-6\">\n <div className=\"flex items-center gap-2\">\n <CreditCard className=\"h-5 w-5 text-primary\" />\n <h2 className=\"sf-heading text-lg font-semibold\">Pagamentos</h2>\n </div>\n <p className=\"mt-2 text-sm text-muted-foreground\">\n Os pagamentos são processados com segurança no checkout — nenhum dado de pagamento fica salvo nesta conta.\n </p>\n <div className=\"mt-4 flex items-center gap-2 rounded-lg bg-muted/40 px-3 py-2.5 text-sm\">\n <QrCode className=\"h-4 w-4 text-primary\" />\n <span>Pix e cartão via Mercado Pago no momento da compra.</span>\n </div>\n </div>\n )\n}\n\nconst SECTION_SUBTITLE: Record<AccountSection, string> = {\n profile: 'Seus dados de contato.',\n orders: 'Acompanhe seus pedidos e entregas.',\n addresses: 'Endereços de entrega.',\n payments: 'Como você paga na loja.',\n}\n\nexport function MyPurchasesPage() {\n const config = useStorefrontConfig()\n const session = useSessionStore()\n const [section, setSection] = useState<AccountSection>('orders')\n useStorefrontHead({ title: `Minha conta — ${config.name}` })\n\n if (!session.email) {\n return (\n <main className=\"mx-auto max-w-3xl px-4 py-12 sm:px-6\">\n <AuthForm />\n </main>\n )\n }\n\n return (\n <CustomerAccountShell\n title=\"Minha conta\"\n subtitle={SECTION_SUBTITLE[section]}\n active={section}\n onSelect={setSection}\n >\n {section === 'profile' && <ProfilePanel />}\n {section === 'orders' && <OrdersPanel />}\n {section === 'addresses' && <AddressesPanel />}\n {section === 'payments' && <PaymentsPanel />}\n </CustomerAccountShell>\n )\n}\n","import React from 'react'\nimport { Link } from '../router'\nimport { useStorefrontConfig } from '../config'\nimport { useStorefrontHead } from '../hooks/useStorefrontHead'\n\n/** Fallback for unknown routes. Previously these silently rendered the home/catalog page with a 200. */\nexport function NotFoundPage() {\n const config = useStorefrontConfig()\n useStorefrontHead({ title: `Página não encontrada — ${config.name}` })\n return (\n <main className=\"mx-auto flex min-h-[60vh] max-w-2xl flex-col items-center justify-center px-4 py-16 text-center\">\n <p className=\"sf-heading text-5xl font-bold tracking-tight text-primary\">404</p>\n <h1 className=\"mt-3 text-xl font-semibold\">Página não encontrada</h1>\n <p className=\"mt-2 text-sm text-muted-foreground\">\n O endereço que você tentou acessar não existe ou foi movido.\n </p>\n <Link\n to={config.catalogPath}\n className=\"mt-6 rounded-lg bg-primary px-5 py-2.5 text-sm font-semibold text-primary-foreground transition hover:opacity-90\"\n >\n Ir para a loja\n </Link>\n </main>\n )\n}\n","import React from 'react'\nimport { Link } from '../router'\nimport { useStorefrontConfig } from '../config'\nimport { useStorefrontHead } from '../hooks/useStorefrontHead'\n\nconst TITLES = {\n privacy: 'Política de Privacidade',\n terms: 'Termos de Uso',\n returns: 'Trocas e Devoluções',\n} as const\n\nexport type PolicyKind = keyof typeof TITLES\n\n/** Institutional/legal pages. Content comes from config.legal; absent pages show\n * a placeholder so the routes + footer links exist (no 404) before the store\n * publishes its policy — a payment-processor / go-live requirement. */\nexport function PolicyPage({ kind }: { kind: PolicyKind }) {\n const config = useStorefrontConfig()\n const title = TITLES[kind]\n const content = config.legal?.[kind]\n const email = config.footer?.contact?.email\n useStorefrontHead({ title: `${title} — ${config.name}` })\n\n return (\n <main className=\"mx-auto max-w-3xl px-4 py-12 sm:px-6\">\n <Link to={config.catalogPath} className=\"text-sm text-muted-foreground transition-colors hover:text-foreground\">\n ← Voltar à loja\n </Link>\n <h1 className=\"sf-heading mt-4 text-3xl font-bold tracking-tight\">{title}</h1>\n <div className=\"mt-6 space-y-4 leading-relaxed text-muted-foreground\">\n {content ? (\n content.split('\\n').filter((line) => line.trim()).map((paragraph, i) => <p key={i}>{paragraph}</p>)\n ) : (\n <>\n <p>O conteúdo desta política ainda será publicado pela loja.</p>\n {email && (\n <p>\n Em caso de dúvidas, fale com a gente em{' '}\n <a href={`mailto:${email}`} className=\"text-primary underline\">{email}</a>.\n </p>\n )}\n </>\n )}\n </div>\n </main>\n )\n}\n","import React from 'react'\n\ninterface Props {\n children: React.ReactNode\n}\n\ninterface State {\n error: Error | null\n}\n\n/**\n * Catches render/runtime errors in the storefront tree so a single thrown\n * error (e.g. a provider failure) shows a recoverable fallback instead of a\n * blank white screen. Key it by route to auto-clear on navigation.\n */\nexport class StorefrontErrorBoundary extends React.Component<Props, State> {\n state: State = { error: null }\n\n static getDerivedStateFromError(error: Error): State {\n return { error }\n }\n\n componentDidCatch(error: Error, info: React.ErrorInfo): void {\n // eslint-disable-next-line no-console\n console.error('[storefront] render error:', error, info.componentStack)\n }\n\n render(): React.ReactNode {\n if (!this.state.error) return this.props.children\n return (\n <div className=\"flex min-h-[60vh] flex-col items-center justify-center gap-4 px-4 py-16 text-center\">\n <h1 className=\"sf-heading text-xl font-semibold\">Algo deu errado</h1>\n <p className=\"max-w-md text-sm text-muted-foreground\">\n Ocorreu um erro ao carregar esta parte da loja. Tente recarregar a página.\n </p>\n <div className=\"flex flex-wrap justify-center gap-3\">\n <button\n type=\"button\"\n onClick={() => window.location.reload()}\n className=\"rounded-lg bg-primary px-5 py-2.5 text-sm font-semibold text-primary-foreground transition hover:opacity-90\"\n >\n Recarregar\n </button>\n <a href=\"#/\" className=\"rounded-lg border px-5 py-2.5 text-sm font-semibold transition hover:bg-muted\">\n Voltar ao início\n </a>\n </div>\n </div>\n )\n }\n}\n","import React, { useEffect } from 'react'\nimport { AlertCircle, Check, Info, X } from 'lucide-react'\nimport { useToastStore, type Toast } from '../stores/toast.store'\n\nconst ICON: Record<Toast['variant'], React.ComponentType<{ className?: string }>> = {\n success: Check,\n error: AlertCircle,\n info: Info,\n}\n\nconst ACCENT: Record<Toast['variant'], string> = {\n success: 'bg-emerald-500/10 text-emerald-600',\n error: 'bg-destructive/10 text-destructive',\n info: 'bg-primary/10 text-primary',\n}\n\nfunction ToastCard({ toast }: { toast: Toast }) {\n const dismiss = useToastStore((s) => s.dismiss)\n const Icon = ICON[toast.variant]\n\n useEffect(() => {\n const timer = window.setTimeout(() => dismiss(toast.id), toast.durationMs)\n return () => window.clearTimeout(timer)\n }, [toast.id, toast.durationMs, dismiss])\n\n return (\n <div\n role=\"status\"\n className=\"pointer-events-auto flex w-80 max-w-[calc(100vw-2rem)] animate-slide-in-from-right items-start gap-3 rounded-xl border bg-card p-3.5 shadow-lg\"\n >\n <span className={`grid h-8 w-8 shrink-0 place-items-center rounded-full ${ACCENT[toast.variant]}`}>\n <Icon className=\"h-4 w-4\" />\n </span>\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold leading-tight\">{toast.title}</p>\n {toast.description && <p className=\"mt-0.5 text-xs text-muted-foreground\">{toast.description}</p>}\n </div>\n <button\n type=\"button\"\n aria-label=\"Fechar\"\n onClick={() => dismiss(toast.id)}\n className=\"text-muted-foreground transition-colors hover:text-foreground\"\n >\n <X className=\"h-4 w-4\" />\n </button>\n </div>\n )\n}\n\nexport function Toaster() {\n const toasts = useToastStore((s) => s.toasts)\n if (toasts.length === 0) return null\n return (\n <div className=\"pointer-events-none fixed bottom-4 right-4 z-[70] flex flex-col gap-2\">\n {toasts.map((t) => (\n <ToastCard key={t.id} toast={t} />\n ))}\n </div>\n )\n}\n","import React from 'react'\nimport { setShopProvider, getShopProvider } from '@fayz-ai/shop/runtime'\nimport { createMockShopProvider } from '@fayz-ai/shop/mock'\nimport type { MockShopSeed } from '@fayz-ai/shop/mock'\nimport type { Discount } from '@fayz-ai/shop/types'\nimport type { ShopProvider } from '@fayz-ai/shop/provider'\nimport { initCustomerAuth, resolveAuthAdapter } from './auth'\nimport { registerStorefrontBlocks } from './blocks'\nimport { getStorefrontComponents, StorefrontConfigProvider, resolveConfig, useStorefrontConfig } from './config'\nimport type { StorefrontConfig, StorefrontDiscountConfig } from './config'\nimport type { StorefrontComponents } from './component-contracts'\nimport type { StorefrontSection } from './sections'\nimport { useHashPath, matchPath } from './router'\nimport { useCartStore } from './stores/cart.store'\nimport { StorefrontThemeStyle } from './theme'\nimport { StorefrontHeader } from './components/StorefrontHeader'\nimport { StorefrontFooter } from './components/StorefrontFooter'\nimport { CartDrawer } from './components/CartDrawer'\nimport { CatalogPage } from './pages/CatalogPage'\nimport { HomePage } from './pages/HomePage'\nimport { ProductDetailPage } from './pages/ProductDetailPage'\nimport { CheckoutPage } from './pages/CheckoutPage'\nimport { OrderConfirmationPage } from './pages/OrderConfirmationPage'\nimport { MyPurchasesPage } from './pages/MyPurchasesPage'\nimport { NotFoundPage } from './pages/NotFoundPage'\nimport { PolicyPage } from './pages/PolicyPage'\nimport { StorefrontErrorBoundary } from './components/StorefrontErrorBoundary'\nimport { Toaster } from './components/Toaster'\n\nfunction getCustomRouteMatch(config: ReturnType<typeof useStorefrontConfig>, path: string) {\n for (const route of config.routes ?? []) {\n const params = matchPath(route.path, path)\n if (params) return { route, params }\n }\n return null\n}\n\nfunction isFocusedRoute(config: ReturnType<typeof useStorefrontConfig>, path: string): boolean {\n const custom = getCustomRouteMatch(config, path)\n if (custom) return custom.route.chrome === 'focused' || custom.route.kind === 'checkout'\n return Boolean(matchPath('/checkout', path))\n}\n\nfunction RouteSwitch({ path }: { path: string }) {\n const config = useStorefrontConfig()\n\n const custom = getCustomRouteMatch(config, path)\n if (custom) {\n const CustomRoute = custom.route.component\n return <CustomRoute path={path} params={custom.params} config={config} />\n }\n\n const product = matchPath('/product/:slug', path)\n if (product?.slug) return <ProductDetailPage slug={product.slug} />\n\n const order = matchPath('/order/:id', path)\n if (order?.id) return <OrderConfirmationPage orderId={order.id} />\n\n if (matchPath('/checkout', path) && config.features.checkout) return <CheckoutPage />\n if (matchPath('/account', path) && config.features.accounts) return <MyPurchasesPage />\n if (matchPath('/catalog', path)) return <CatalogPage />\n if (matchPath('/privacy', path)) return <PolicyPage kind=\"privacy\" />\n if (matchPath('/terms', path)) return <PolicyPage kind=\"terms\" />\n if (matchPath('/refunds', path)) return <PolicyPage kind=\"returns\" />\n\n // Root renders home (or catalog when there's no home). Any other unmatched\n // path is a genuine 404 — don't silently fall back to the storefront.\n if (path === '/' || path === '') {\n return config.home ? <HomePage sections={config.home.sections} /> : <CatalogPage />\n }\n return <NotFoundPage />\n}\n\n/**\n * Side-effect runtime init shared by the factory and the manifest scaffold:\n * wires customer auth and the shop provider. Idempotent and safe to call once\n * before first render. Provider resolution: explicit > catalog mock > empty mock.\n */\n/**\n * config.discounts are simple {code, percent} entries the UI validator trusts\n * (useDiscountValidator). They must ALSO be seeded into the provider, or\n * placeOrder won't find the code server-side and will charge full price — the\n * shopper sees a discounted total but is billed the undiscounted one.\n */\nfunction storefrontDiscountToSeed(discount: StorefrontDiscountConfig): Discount {\n const ts = new Date().toISOString()\n return {\n id: `cfg-discount-${discount.code.trim().toLowerCase()}`,\n tenantId: 'mock',\n title: discount.title ?? `${discount.percent}% off`,\n code: discount.code.trim().toUpperCase(),\n type: 'percentage',\n method: 'code',\n value: discount.percent,\n usageLimit: null,\n oncePerCustomer: false,\n minSubtotal: null,\n appliesTo: 'all',\n productIds: [],\n categoryIds: [],\n startsAt: ts,\n endsAt: null,\n status: 'active',\n timesUsed: 0,\n createdAt: ts,\n updatedAt: ts,\n }\n}\n\nfunction buildMockSeed(config: StorefrontConfig): MockShopSeed | undefined {\n const configDiscounts = (config.discounts ?? []).map(storefrontDiscountToSeed)\n if (!config.catalog && configDiscounts.length === 0) return undefined\n // Config-level codes win over catalog seeds sharing the same code.\n const catalogDiscounts = (config.catalog?.discounts ?? []).filter(\n (cd) => !configDiscounts.some((cfg) => (cd.code ?? '').toUpperCase() === cfg.code),\n )\n return {\n ...config.catalog,\n discounts: [...catalogDiscounts, ...configDiscounts],\n }\n}\n\nexport function initStorefrontRuntime(config: StorefrontConfig): void {\n registerStorefrontBlocks()\n if (resolveConfig(config).features.accounts) {\n initCustomerAuth(resolveAuthAdapter(config.auth, {\n supabaseUrl: config.supabaseUrl,\n supabaseAnonKey: config.supabaseAnonKey,\n }))\n }\n\n if (config.provider) {\n setShopProvider(config.provider)\n } else {\n setShopProvider(createMockShopProvider(buildMockSeed(config)))\n }\n\n // Drop any persisted cart line the active backend can't resolve (e.g. a cart\n // built in an earlier mock-mode session, whose ids don't exist live) so stale\n // ids never reach checkout and 400 the order. Keeps a line on any error so a\n // transient failure never discards a valid item. Runs AFTER the persisted cart\n // has hydrated — zustand/persist rehydrates asynchronously, so reconciling at\n // init would see an empty cart and no-op.\n const reconcileCart = () => {\n const provider = getShopProvider()\n void useCartStore.getState().reconcile(async (line) => {\n const product = await provider.getProduct(line.productId)\n return product != null\n })\n }\n if (useCartStore.persist.hasHydrated()) reconcileCart()\n else useCartStore.persist.onFinishHydration(reconcileCart)\n\n if (config.supabaseUrl || config.supabaseAnonKey) {\n console.warn(\n '@fayz-ai/shop: supabaseUrl/supabaseAnonKey are legacy fields. Pass an explicit provider/adapter or use the Fayz SDK broker path.',\n )\n }\n}\n\n/** The inner storefront UI. Reads everything from the config context, so it is\n * shared by createStorefrontApp and the manifest-driven StorefrontScaffold. */\nexport function StorefrontShell() {\n const config = useStorefrontConfig()\n const path = useHashPath()\n const focused = isFocusedRoute(config, path)\n const components = getStorefrontComponents(config)\n const chromeProps = { config, commerceMode: config.commerceMode }\n const body = (\n <>\n {config.theme && <StorefrontThemeStyle theme={config.theme} />}\n {!focused &&\n (components.Header ? <components.Header {...chromeProps} /> : <StorefrontHeader />)}\n <StorefrontErrorBoundary key={path}>\n <RouteSwitch path={path} />\n </StorefrontErrorBoundary>\n {!focused && config.features.cart && <CartDrawer />}\n {!focused &&\n (components.Footer ? <components.Footer {...chromeProps} /> : <StorefrontFooter />)}\n <Toaster />\n </>\n )\n\n if (components.Shell) {\n return (\n <components.Shell {...chromeProps}>\n {body}\n </components.Shell>\n )\n }\n\n return (\n <div className=\"min-h-screen bg-background text-foreground\">\n {body}\n </div>\n )\n}\n\n/**\n * Declarative storefront factory — the customer-facing counterpart of\n * createSaasApp. Sugar over the manifest path: it is equivalent to\n * renderApp(defineStorefront(config)), sharing initStorefrontRuntime +\n * StorefrontShell with the scaffold.\n *\n * const App = createStorefrontApp({ name: 'Aurora Goods', currency: 'BRL' })\n */\nexport function createStorefrontApp(config: StorefrontConfig): React.ComponentType {\n const resolved = resolveConfig(config)\n initStorefrontRuntime(config)\n\n function StorefrontApp() {\n return (\n <StorefrontConfigProvider value={resolved}>\n <StorefrontShell />\n </StorefrontConfigProvider>\n )\n }\n StorefrontApp.displayName = 'StorefrontApp'\n return StorefrontApp\n}\n\nexport interface CreateStorefrontOptions {\n config: StorefrontConfig\n provider?: ShopProvider\n components?: StorefrontComponents\n routes?: StorefrontConfig['routes']\n pages?: StorefrontConfig['routes']\n sections?: readonly StorefrontSection[]\n}\n\nexport function createStorefront(options: CreateStorefrontOptions): React.ComponentType {\n const routes = [...(options.pages ?? []), ...(options.routes ?? [])]\n const config: StorefrontConfig = {\n ...options.config,\n provider: options.provider ?? options.config.provider,\n components: {\n ...options.config.components,\n ...options.components,\n },\n routes: routes.length > 0 ? routes : options.config.routes,\n home: options.sections\n ? { ...(options.config.home ?? { sections: [] }), sections: options.sections }\n : options.config.home,\n }\n\n return createStorefrontApp(config)\n}\n","import type {\n StorefrontConfig,\n StorefrontRouteDefinition,\n} from './config'\nimport type { StorefrontComponents } from './component-contracts'\nimport type { StorefrontSection } from './sections'\nimport type { CreateStorefrontOptions } from './createStorefrontApp'\n\n/**\n * Identity helpers for generated/custom storefronts.\n *\n * They do not add runtime behavior; they make the intended client-app shape\n * explicit and keep TypeScript inference tight across config, components, routes,\n * sections and app creation options.\n */\nexport function defineStorefrontConfig<const T extends StorefrontConfig>(config: T): T {\n return config\n}\n\nexport function defineStorefrontComponents<const T extends StorefrontComponents>(components: T): T {\n return components\n}\n\nexport function defineStorefrontRoutes<const T extends readonly StorefrontRouteDefinition[]>(routes: T): T {\n return routes\n}\n\nexport function defineStorefrontSections<const T extends readonly StorefrontSection[]>(sections: T): T {\n return sections\n}\n\nexport function defineStorefrontApp<const T extends CreateStorefrontOptions>(options: T): T {\n return options\n}\n","import React from 'react'\nimport { registerScaffold, defineApp } from '@fayz-ai/core'\nimport type { AppManifest, BackendProvider } from '@fayz-ai/core'\nimport { StorefrontConfigProvider, resolveConfig } from './config'\nimport type { StorefrontConfig } from './config'\nimport type { StorefrontTheme } from './theme'\nimport type { HomeConfig, NavLink, FooterConfig } from './sections'\nimport { initStorefrontRuntime, StorefrontShell } from './createStorefrontApp'\nimport './blocks' // ensure section blocks are registered\n\ntype StorefrontBackendProvider = NonNullable<StorefrontConfig['backend']>['provider']\nconst runtimeConfigRegistry = new Map<string, StorefrontConfig>()\n\n// ---------------------------------------------------------------------------\n// Storefront scaffold — renders a store from a pure-data AppManifest. The\n// storefront surface keeps its declarative config under surface.options, so the\n// mapping is loss-free for the serializable fields (the code escape hatches —\n// custom provider/adapter/logo — arrive via the registries instead).\n// ---------------------------------------------------------------------------\n\nfunction slug(name: string): string {\n return name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '') || 'app'\n}\n\n/** StorefrontConfig → AppManifest (the sugar-to-data direction). */\nexport function defineStorefront(config: StorefrontConfig): AppManifest {\n const id = slug(config.name)\n runtimeConfigRegistry.set(id, config)\n const backendProvider = (config.backend?.provider ?? (config.provider ? 'custom' : 'mock')) as BackendProvider\n\n return defineApp({\n id,\n name: config.name,\n backend: {\n provider: backendProvider,\n url: config.backend?.url,\n },\n locale: {\n default: config.locale ?? 'pt-BR',\n supported: [config.locale ?? 'pt-BR'],\n currency: config.currency ?? 'BRL',\n },\n theme: config.theme as Record<string, unknown> | undefined,\n surfaces: {\n storefront: {\n scaffold: 'storefront',\n options: {\n announcement: config.announcement,\n home: config.home,\n nav: config.nav,\n footer: config.footer,\n shipping: config.shipping,\n features: config.features,\n catalog: config.catalog,\n },\n },\n },\n })\n}\n\n/** AppManifest → StorefrontConfig (the data-to-render direction). */\nfunction manifestToStorefrontConfig(manifest: AppManifest, surfaceName: string): StorefrontConfig {\n const runtimeConfig = runtimeConfigRegistry.get(manifest.id)\n const surface = manifest.surfaces[surfaceName]\n const o = (surface?.options ?? {}) as Record<string, unknown>\n return {\n ...runtimeConfig,\n name: manifest.name,\n currency: (manifest.locale as { currency?: string } | undefined)?.currency,\n locale: (manifest.locale as { default?: string } | undefined)?.default,\n theme: manifest.theme as StorefrontTheme | undefined,\n announcement: o.announcement as string | undefined,\n home: o.home as HomeConfig | undefined,\n nav: o.nav as NavLink[] | undefined,\n footer: o.footer as FooterConfig | undefined,\n shipping: o.shipping as StorefrontConfig['shipping'],\n features: o.features as StorefrontConfig['features'],\n catalog: o.catalog as StorefrontConfig['catalog'],\n backend: {\n provider: manifest.backend?.provider as StorefrontBackendProvider,\n url: manifest.backend?.url,\n },\n components: runtimeConfig?.components,\n routes: runtimeConfig?.routes,\n provider: runtimeConfig?.provider,\n auth: runtimeConfig?.auth,\n logo: runtimeConfig?.logo,\n }\n}\n\nexport function StorefrontScaffold({ manifest, surface }: { manifest: AppManifest; surface: string }) {\n const config = React.useMemo(() => manifestToStorefrontConfig(manifest, surface), [manifest, surface])\n const resolved = React.useMemo(() => resolveConfig(config), [config])\n const inited = React.useRef(false)\n if (!inited.current) {\n initStorefrontRuntime(config)\n inited.current = true\n }\n return (\n <StorefrontConfigProvider value={resolved}>\n <StorefrontShell />\n </StorefrontConfigProvider>\n )\n}\nStorefrontScaffold.displayName = 'StorefrontScaffold'\n\n// Registration is lazy (called from the storefront renderApp wrapper and\n// createStorefront*) so that importing the @fayz-ai/storefront barrel stays\n// side-effect-free and tree-shakable.\nlet storefrontScaffoldRegistered = false\nexport function registerStorefrontScaffold(): void {\n if (storefrontScaffoldRegistered) return\n storefrontScaffoldRegistered = true\n registerScaffold('storefront', StorefrontScaffold, { source: 'sdk', label: 'Storefront' })\n}\n","import type { StorefrontTheme } from './theme'\nimport type { HomeConfig } from './sections'\n\n// ---------------------------------------------------------------------------\n// Template presets — recreations of the four Nuvemshop patterns selected in\n// docs/storefront-templates-research.md. Each is { theme, home() } so an app\n// (or the Fayz agent) starts from a complete professional store and overrides\n// copy, colors, hero images and sections — the saas-core theming workflow.\n// ---------------------------------------------------------------------------\n\n/** Real imagery for a template home — resolved at build time (e.g. via\n * scripts/fetch-unsplash.mjs); falls back to gradient placeholders when omitted. */\nexport interface TemplateImages {\n hero?: Array<string | undefined>\n banners?: Array<string | undefined>\n}\n\nexport interface StorefrontTemplate {\n id: string\n /** The Nuvemshop pattern this recreates */\n inspiration: string\n theme: StorefrontTheme\n /** Default home blueprint — pass the store name for copy interpolation */\n home: (storeName: string, images?: TemplateImages) => HomeConfig\n announcement?: string\n}\n\n/** maré — elegant fashion (Rio): airy warm paper, olive ink, sand CTA, centered logo. */\nexport const mareTemplate: StorefrontTemplate = {\n id: 'mare',\n inspiration: 'Nuvemshop Rio',\n announcement: 'FRETE GRÁTIS EM COMPRAS ACIMA DE R$ 300',\n theme: {\n name: 'mare',\n colors: {\n background: '40 14% 93%',\n foreground: '90 8% 38%',\n primary: '42 32% 61%',\n primaryForeground: '40 30% 12%',\n card: '40 20% 97%',\n cardForeground: '90 10% 25%',\n muted: '40 12% 88%',\n mutedForeground: '90 6% 50%',\n border: '40 10% 82%',\n announcementBackground: '90 10% 30%',\n announcementForeground: '40 20% 95%',\n },\n font: { heading: 'Plus Jakarta Sans', body: 'Plus Jakarta Sans' },\n radius: 'soft',\n header: { variant: 'centered' },\n productCard: { style: 'editorial', imageAspect: 'portrait' },\n },\n home: (storeName, images) => ({\n sections: [\n {\n type: 'hero',\n variant: 'banner',\n height: 'tall',\n slides: [\n { title: 'Feito para durar', subtitle: `A nova coleção ${storeName} chegou — peças atemporais em materiais honestos.`, cta: 'Ver coleção', hue: 75, image: images?.hero?.[0] },\n ],\n },\n { type: 'categories', style: 'bubbles' },\n { type: 'products', title: 'Destaques', filter: 'all', limit: 4 },\n { type: 'banner', title: 'Até 30% off', eyebrow: 'por tempo limitado', subtitle: 'Peças selecionadas da estação', cta: 'Aproveitar', hue: 40, image: images?.banners?.[0] },\n { type: 'products', title: 'Promoções', filter: 'sale', limit: 4 },\n { type: 'products', title: 'Lançamentos', filter: 'new', limit: 4 },\n { type: 'newsletter', title: 'Assine nossa newsletter', subtitle: 'Novidades e ofertas exclusivas, sem spam.' },\n ],\n }),\n}\n\n/** sertão — editorial organic (Uyuni): cream paper, coffee serif ink, boxed hero, manifesto. */\nexport const sertaoTemplate: StorefrontTemplate = {\n id: 'sertao',\n inspiration: 'Nuvemshop Uyuni',\n theme: {\n name: 'sertao',\n colors: {\n background: '30 100% 98%',\n foreground: '28 42% 32%',\n primary: '28 42% 32%',\n primaryForeground: '30 100% 97%',\n card: '32 60% 96%',\n cardForeground: '28 40% 26%',\n muted: '32 40% 92%',\n mutedForeground: '28 22% 48%',\n border: '28 30% 80%',\n },\n font: { heading: 'Marcellus', body: 'Marcellus', fallback: 'serif' },\n radius: 'none',\n header: { variant: 'minimal', uppercaseNav: true },\n productCard: { style: 'editorial', imageAspect: 'portrait' },\n uppercaseButtons: true,\n },\n home: (storeName, images) => ({\n sections: [\n {\n type: 'hero',\n variant: 'banner',\n height: 'tall',\n slides: [\n { title: 'Essenciais naturais', subtitle: 'Conheça nossa coleção', cta: 'Ver mais', hue: 28, boxed: true, image: images?.hero?.[0] },\n ],\n },\n {\n type: 'manifesto',\n text: `Num mundo de pressa e excesso, ${storeName} escolhe o caminho lento: ingredientes honestos, produção pequena e cuidado em cada detalhe.`,\n },\n { type: 'categories', style: 'tiles' },\n { type: 'products', title: 'ESSENCIAIS', filter: 'all', limit: 4 },\n {\n type: 'testimonials',\n title: 'Nossos clientes',\n items: [\n { quote: 'Qualidade impecável e um cheiro que abraça.', author: 'Helena M.' },\n { quote: 'Compro há dois anos e nunca me decepcionou.', author: 'Rafael T.' },\n { quote: 'Entrega rápida e embalagem linda, dá gosto de presentear.', author: 'Cláudia P.' },\n ],\n },\n { type: 'products', title: 'NOVIDADES', filter: 'new', limit: 4 },\n {\n type: 'benefits',\n items: [\n { icon: 'Truck', title: 'Frete para todo o Brasil', text: 'Envio em até 48h' },\n { icon: 'Leaf', title: '100% vegano', text: 'Sem testes em animais' },\n { icon: 'RotateCcw', title: 'Troca fácil', text: '30 dias para trocar' },\n ],\n },\n { type: 'newsletter', title: 'NEWSLETTER', subtitle: 'Histórias, lançamentos e cuidado — direto no seu e-mail.' },\n ],\n }),\n}\n\n/** volt — bold tech (Brasília): white canvas, near-black ink, vivid CTA, dark search-first header, split hero. */\nexport const voltTemplate: StorefrontTemplate = {\n id: 'volt',\n inspiration: 'Nuvemshop Brasília',\n announcement: 'CUPOM BEMVINDO10 — 10% DE DESCONTO NA PRIMEIRA COMPRA',\n theme: {\n name: 'volt',\n colors: {\n background: '0 0% 100%',\n foreground: '0 0% 7%',\n primary: '341 100% 45%',\n primaryForeground: '0 0% 100%',\n card: '0 0% 98%',\n cardForeground: '0 0% 10%',\n muted: '0 0% 94%',\n mutedForeground: '0 0% 40%',\n border: '0 0% 88%',\n headerBackground: '0 0% 6%',\n headerForeground: '0 0% 98%',\n announcementBackground: '341 100% 45%',\n announcementForeground: '0 0% 100%',\n },\n font: { heading: 'Chakra Petch', body: 'Rubik' },\n radius: 'soft',\n header: { variant: 'search', uppercaseNav: true },\n productCard: { style: 'card', imageAspect: 'square' },\n },\n home: (storeName, images) => ({\n sections: [\n {\n type: 'hero',\n variant: 'split',\n slides: [\n { title: 'Tecnologia', subtitle: 'O melhor do hardware e dos acessórios', hue: 250, image: images?.hero?.[0] },\n { title: 'Ofertas', subtitle: `Descontos semanais ${storeName}`, hue: 341, href: '/catalog', image: images?.hero?.[1] },\n ],\n },\n {\n type: 'benefits',\n items: [\n { icon: 'CreditCard', title: '3x sem juros', text: 'Em todo o site' },\n { icon: 'Truck', title: 'Envio em 24h', text: 'Para todo o Brasil' },\n { icon: 'ShieldCheck', title: 'Compra segura', text: 'Seus dados protegidos' },\n ],\n },\n { type: 'products', title: 'NOVIDADES', filter: 'new', limit: 4 },\n { type: 'banner', title: 'DESCONTOS SEMANAIS', eyebrow: 'toda sexta', subtitle: 'Ofertas novas, estoque limitado', cta: 'Conferir', hue: 341, image: images?.banners?.[0] },\n { type: 'products', title: 'PROMOÇÕES', filter: 'sale', limit: 4 },\n { type: 'newsletter', title: 'Entre para o clube', subtitle: 'Cupons e lançamentos antes de todo mundo.' },\n ],\n }),\n}\n\n/** atelier — classic premium retail (Flex): white, near-black, gold accent, slider hero, trust badges. */\nexport const atelierTemplate: StorefrontTemplate = {\n id: 'atelier',\n inspiration: 'Nuvemshop Flex',\n theme: {\n name: 'atelier',\n colors: {\n background: '0 0% 100%',\n foreground: '0 0% 9%',\n primary: '40 45% 48%',\n primaryForeground: '0 0% 100%',\n card: '0 0% 99%',\n cardForeground: '0 0% 9%',\n muted: '40 10% 95%',\n mutedForeground: '0 0% 42%',\n border: '0 0% 88%',\n announcementBackground: '0 0% 9%',\n announcementForeground: '0 0% 98%',\n },\n font: { heading: 'Outfit', body: 'Outfit' },\n radius: 'none',\n header: { variant: 'centered', uppercaseNav: true },\n productCard: { style: 'card', imageAspect: 'square' },\n uppercaseButtons: true,\n },\n announcement: 'PARCELE EM ATÉ 10X · 5% OFF NO PIX',\n home: (storeName, images) => ({\n sections: [\n {\n type: 'hero',\n variant: 'slider',\n height: 'medium',\n slides: [\n { title: 'Feito para quem valoriza detalhes', subtitle: `Coleção exclusiva ${storeName}`, cta: 'APROVEITE', hue: 40, image: images?.hero?.[0] },\n { title: 'Clássicos que não saem de moda', subtitle: 'Peças autorais, produção limitada', cta: 'VER COLEÇÃO', hue: 210, image: images?.hero?.[1] },\n ],\n },\n {\n type: 'benefits',\n items: [\n { icon: 'CreditCard', title: 'Parcele em até 10x', text: 'Ou 5% off no PIX' },\n { icon: 'Lock', title: 'Site 100% seguro', text: 'Seus dados protegidos' },\n { icon: 'Award', title: 'Peças exclusivas', text: 'Produtos 100% autorais' },\n ],\n },\n { type: 'categories', style: 'tiles' },\n { type: 'products', title: 'Novidades', filter: 'new', limit: 4 },\n { type: 'banner', title: 'Promoções', eyebrow: 'seleção especial', subtitle: 'Selecionados com até 25% off', cta: 'Ver ofertas', hue: 40, image: images?.banners?.[0] },\n { type: 'products', title: 'Promoções', filter: 'sale', limit: 4 },\n {\n type: 'testimonials',\n title: 'O que dizem sobre nós',\n items: [\n { quote: 'Acabamento perfeito, superou a expectativa.', author: 'Mariana C.' },\n { quote: 'Atendimento impecável do pedido à entrega.', author: 'Jorge L.' },\n { quote: 'Virou minha loja favorita para presentes.', author: 'Paula R.' },\n ],\n },\n { type: 'newsletter' },\n ],\n }),\n}\n\n/** food — warm appetizing delivery (steakhouse / burger / comfort food): dark inviting\n * header, ember CTA, cream canvas, rounded cards, menu-first home with \"mais pedidos\"\n * rail and social proof. Built for restaurant/food stores — override to go fully dark. */\nexport const foodTemplate: StorefrontTemplate = {\n id: 'food',\n inspiration: 'Delivery / restaurant storefront',\n announcement: 'ENTREGA GRÁTIS ACIMA DE R$ 150 · PEÇA JÁ',\n theme: {\n name: 'food',\n colors: {\n background: '30 33% 97%',\n foreground: '20 14% 15%',\n primary: '14 84% 50%',\n primaryForeground: '0 0% 100%',\n card: '30 33% 99%',\n cardForeground: '20 14% 15%',\n muted: '28 20% 92%',\n mutedForeground: '22 10% 42%',\n border: '28 18% 85%',\n headerBackground: '20 14% 11%',\n headerForeground: '30 24% 96%',\n announcementBackground: '14 84% 50%',\n announcementForeground: '0 0% 100%',\n },\n font: { heading: 'Poppins', body: 'Inter' },\n radius: 'round',\n header: { variant: 'classic' },\n productCard: { style: 'card', imageAspect: 'square' },\n },\n home: (storeName, images) => ({\n sections: [\n {\n type: 'hero',\n variant: 'banner',\n height: 'tall',\n slides: [\n { title: 'Sabor de verdade, na sua porta', subtitle: `${storeName} — feito na hora, do jeito que você ama.`, cta: 'Ver cardápio', href: '/catalog', hue: 20, image: images?.hero?.[0] },\n ],\n },\n {\n type: 'benefits',\n items: [\n { icon: 'Flame', title: 'Feito na hora', text: 'Preparado com capricho' },\n { icon: 'Truck', title: 'Entrega rápida', text: 'Frete grátis acima de R$ 150' },\n { icon: 'CreditCard', title: 'Pagamento fácil', text: 'Pix, cartão e mais' },\n ],\n },\n { type: 'categories', style: 'tiles', title: 'Nosso cardápio' },\n { type: 'products', title: 'Mais pedidos', eyebrow: 'favoritos da casa', filter: 'all', limit: 8 },\n { type: 'banner', title: 'Combo do dia', eyebrow: 'oferta', subtitle: 'Seleção especial com desconto', cta: 'Aproveitar', hue: 14, image: images?.banners?.[0] },\n { type: 'products', title: 'Novidades no cardápio', filter: 'new', limit: 4 },\n {\n type: 'testimonials',\n title: 'O que dizem por aí',\n items: [\n { quote: 'Chegou quentinho e absurdo de bom. Virei cliente!', author: 'Rafael M.' },\n { quote: 'Sabor de restaurante em casa, sem complicação.', author: 'Beatriz L.' },\n { quote: 'Entrega rápida e porção generosa. Recomendo demais.', author: 'Diego S.' },\n ],\n },\n { type: 'newsletter', title: 'Receba nossas ofertas', subtitle: 'Promoções e novidades do cardápio, direto no seu e-mail.' },\n ],\n }),\n}\n\nexport const storefrontTemplates = {\n mare: mareTemplate,\n sertao: sertaoTemplate,\n volt: voltTemplate,\n atelier: atelierTemplate,\n food: foodTemplate,\n} as const\n\nexport type StorefrontTemplateId = keyof typeof storefrontTemplates\n","// Factory\nexport { createStorefront, createStorefrontApp, initStorefrontRuntime, StorefrontShell } from './createStorefrontApp'\nexport type { CreateStorefrontOptions } from './createStorefrontApp'\nexport {\n defineStorefrontConfig,\n defineStorefrontComponents,\n defineStorefrontRoutes,\n defineStorefrontSections,\n defineStorefrontApp,\n} from './define'\nexport type {\n StorefrontConfig,\n ResolvedStorefrontConfig,\n StorefrontRouteComponentProps,\n StorefrontRouteChrome,\n StorefrontCommerceMode,\n StorefrontImageLoadingConfig,\n StorefrontImageLoadingMode,\n StorefrontRouteDefinition,\n StorefrontRouteKind,\n StorefrontRouteParams,\n StorefrontEnquiryConfig,\n} from './config'\nexport type {\n StorefrontActions,\n StorefrontComponents,\n ProductCardProps,\n ProductDetailProps,\n ProductGalleryProps,\n ProductPriceProps,\n ProductActionsProps,\n ProductEnquiryFormContractProps,\n CategoryCardProps,\n CollectionSectionProps,\n HeroSectionContractProps,\n MediaCarouselProps as MediaCarouselContractProps,\n ProductSliderProps as ProductSliderContractProps,\n StorefrontChromeProps,\n StorefrontStateProps,\n} from './component-contracts'\nexport { useStorefrontConfig, useStorefrontConfigOptional } from './config'\n\n// Manifest path (renderApp(defineStorefront(config)) / storefront scaffold)\nexport { defineStorefront, StorefrontScaffold } from './scaffold'\n\n// Block system (storefront sections as registry blocks)\nexport { registerStorefrontBlocks, sectionsToBlocks } from './blocks'\n\n// Routing\nexport { Link, navigateTo, useHashPath, matchPath } from './router'\nexport type { LinkProps } from './router'\n\n// Stores\nexport {\n useCartStore,\n selectCount,\n selectSubtotal,\n selectDiscountTotal,\n selectShipping,\n selectTotal,\n} from './stores/cart.store'\nexport type { CartLine, CartState } from './stores/cart.store'\nexport { useSessionStore } from './stores/session.store'\nexport type { SessionState } from './stores/session.store'\nexport {\n signInByEmail,\n signUpCustomer,\n establishCustomerSession,\n signOutCustomer,\n getCustomerAuthAdapter,\n resolveAuthAdapter,\n} from './auth'\nexport type { StorefrontAuthAdapter, StorefrontAuthConfig, EstablishSessionOptions } from './auth'\nexport { useCatalogStore } from './stores/catalog.store'\nexport type { CatalogState, CatalogSort } from './stores/catalog.store'\n\n// Hooks\nexport {\n useProducts,\n useProduct,\n useCategories,\n useStorefront,\n useCatalog,\n useCart,\n useEnquiry,\n useStorefrontActions,\n useMyOrders,\n useDiscountValidator,\n} from './hooks'\n\n// Components (for custom layouts)\nexport { StorefrontHeader } from './components/StorefrontHeader'\nexport { SmoothImage } from './components/SmoothImage'\nexport type { SmoothImageProps } from './components/SmoothImage'\nexport { ProductCard } from './components/ProductCard'\nexport { ProductEnquiryForm } from './components/ProductEnquiryForm'\nexport type { ProductEnquiryFormProps } from './components/ProductEnquiryForm'\nexport { OrderTrackingTimeline } from './components/OrderTrackingTimeline'\nexport { ProductGrid } from './components/ProductGrid'\nexport { FiltersPanel } from './components/FiltersPanel'\nexport { CartDrawer } from './components/CartDrawer'\nexport { Price } from './components/Price'\nexport { QuantityInput } from './components/QuantityInput'\nexport { ProductOptionSelector } from './components/ProductOptionSelector'\nexport type { ProductOptionSelectorProps } from './components/ProductOptionSelector'\nexport {\n getProductOptionGroups,\n normalizeProductOptionSelection,\n formatProductOptionSelection,\n productOptionSelectionKey,\n} from './product-options'\nexport type { ProductOptionGroup, ProductOptionSelection } from './product-options'\n\n// Pages (for custom routing)\nexport { CatalogPage } from './pages/CatalogPage'\nexport { ProductDetailPage } from './pages/ProductDetailPage'\nexport { CheckoutPage } from './pages/CheckoutPage'\nexport { OrderConfirmationPage } from './pages/OrderConfirmationPage'\nexport { MyPurchasesPage } from './pages/MyPurchasesPage'\nexport { placeStorefrontOrder } from './workflows/checkout'\nexport type {\n PlaceStorefrontOrderInput,\n PlaceStorefrontOrderResult,\n StorefrontCheckoutAddress,\n StorefrontCheckoutCustomer,\n} from './workflows/checkout'\n\n// Theming + templates\nexport { StorefrontThemeStyle, themeToCss } from './theme'\nexport type {\n StorefrontTheme,\n StorefrontThemeColors,\n StorefrontThemeFont,\n StorefrontRadius,\n HeaderVariant,\n HeroVariant,\n CardStyle,\n} from './theme'\nexport type { StorefrontSection, HomeSection, HomeConfig, HeroSlide, MediaCarouselItem, NavLink, FooterConfig } from './sections'\nexport { bannerPlaceholder } from './sections'\nexport {\n storefrontTemplates,\n mareTemplate,\n sertaoTemplate,\n voltTemplate,\n atelierTemplate,\n foodTemplate,\n} from './presets'\nexport type { StorefrontTemplate, StorefrontTemplateId } from './presets'\n\n// Home sections (for custom compositions)\nexport { HomePage, StorefrontSections } from './pages/HomePage'\nexport { HeroSection } from './components/sections/HeroSection'\nexport { MediaCarousel } from './components/sections/MediaCarousel'\nexport type { MediaCarouselProps } from './components/sections/MediaCarousel'\nexport { CategoryShowcase } from './components/sections/CategoryShowcase'\nexport { ProductRail } from './components/sections/ProductRail'\nexport { ProductSlider } from './components/sections/ProductSlider'\nexport type { ProductSliderProps } from './components/sections/ProductSlider'\nexport {\n BenefitsRow,\n PromoBanner,\n ManifestoBlock,\n Testimonials,\n NewsletterBand,\n} from './components/sections/MiscSections'\nexport { StorefrontFooter } from './components/StorefrontFooter'\n\n// Motion (core animation primitives)\nexport { Reveal, useInView, useScrolled, usePopOnChange, prefersReducedMotion } from './motion'\nexport type { RevealProps } from './motion'\n\n// Utilities\nexport { formatMoney, roundCents } from './format'\nexport { TID } from './testids'\nexport {\n productCardComponentContract,\n storefrontComponentContracts,\n} from './component-selectors'\nexport type {\n ProductCardComponentContract,\n ProductDetailComponentContract,\n} from './component-selectors'\n\n// ---------------------------------------------------------------------------\n// Front-door re-exports: storefront apps depend on @fayz-ai/storefront alone.\n// Runtime helpers come from @fayz-ai/core; UI / shop catalog / shop provider\n// live on their own subpaths (./ui, ./catalog, ./shop) to keep module graphs\n// separate. Mirrors the @fayz-ai/saas front door.\n// ---------------------------------------------------------------------------\n// renderApp is wrapped (not re-exported) so the 'storefront' scaffold registers\n// on first render instead of at import time — keeps the barrel side-effect-free.\nimport { renderApp as coreRenderApp } from '@fayz-ai/core'\nimport { registerStorefrontScaffold } from './scaffold'\n\nexport const renderApp: typeof coreRenderApp = (...args) => {\n registerStorefrontScaffold()\n return coreRenderApp(...args)\n}\n\nexport { getSupabaseClientOptional } from '@fayz-ai/core'\nexport { registerStorefrontScaffold } from './scaffold'\n"]}
1
+ {"version":3,"sources":["../src/app/define.ts","../src/app/scaffold.tsx","../src/document/upgrade.ts","../src/document/change.ts","../src/document/describe.ts","../src/hooks/use-catalog.ts","../src/hooks/use-storefront.ts","../src/hooks/use-region.ts","../src/hooks/use-policies.ts","../src/hooks/use-cart.ts","../src/hooks/use-checkout.ts","../src/hooks/use-payment-methods.ts","../src/hooks/use-shipping.ts","../src/hooks/use-address.ts","../src/hooks/use-order.ts","../src/extend/editor-bridge.ts","../src/blocks/block-at-path.ts","../src/document/overlay.ts","../src/document/presets.ts","../src/views/HomePage.tsx","../src/index.ts"],"names":["React","here","position","clone","sectionOf","before","to","listDeprecations","isRecord","describeBlocks","result","jsx","coreRenderApp"],"mappings":";;;;;;;;;;;;AAeO,SAAS,uBAAyD,MAAA,EAAc;AACrF,EAAA,OAAO,MAAA;AACT;AAEO,SAAS,2BAAiE,UAAA,EAAkB;AACjG,EAAA,OAAO,UAAA;AACT;AAEO,SAAS,uBAA6E,MAAA,EAAc;AACzG,EAAA,OAAO,MAAA;AACT;AAEO,SAAS,yBAAuE,QAAA,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S,EAAG,CAAA;AACjE;AAEO,SAAS,QAAA,CAAS,EAAE,QAAA,EAAS,EAAiD;AACnF,EAAA,uBAAOA,GAAAA,CAAC,kBAAA,EAAA,EAAmB,QAAA,EAAoB,CAAA;AACjD;ACudO,IAAM,SAAA,GAAkC,IAAI,IAAA,KAAS;AAC1D,EAAA,0BAAA,EAA2B;AAC3B,EAAA,OAAOC,WAAA,CAAc,GAAG,IAAI,CAAA;AAC9B","file":"index.js","sourcesContent":["import type {\n StorefrontConfig,\n StorefrontRouteDefinition,\n} from '../document/config'\nimport type { StorefrontComponents } from '../extend/component-contracts'\nimport type { StorefrontSection } from '../blocks/sections'\nimport type { CreateStorefrontOptions } from './createStorefrontApp'\n\n/**\n * Identity helpers for generated/custom storefronts.\n *\n * They do not add runtime behavior; they make the intended client-app shape\n * explicit and keep TypeScript inference tight across config, components, routes,\n * sections and app creation options.\n */\nexport function defineStorefrontConfig<const T extends StorefrontConfig>(config: T): T {\n return config\n}\n\nexport function defineStorefrontComponents<const T extends StorefrontComponents>(components: T): T {\n return components\n}\n\nexport function defineStorefrontRoutes<const T extends readonly StorefrontRouteDefinition[]>(routes: T): T {\n return routes\n}\n\nexport function defineStorefrontSections<const T extends readonly StorefrontSection[]>(sections: T): T {\n return sections\n}\n\nexport function defineStorefrontApp<const T extends CreateStorefrontOptions>(options: T): T {\n return options\n}\n","import React from 'react'\nimport { registerScaffold, defineApp } from '@fayz-ai/core'\nimport type { AppManifest, BackendProvider } from '@fayz-ai/core'\nimport { StorefrontConfigProvider, resolveConfig } from '../document/config'\nimport type { StorefrontConfig } from '../document/config'\nimport type { StorefrontTheme } from '../lib/theme'\nimport type { HomeConfig, NavLink, FooterConfig } from '../blocks/sections'\nimport { initStorefrontRuntime, StorefrontShell } from './createStorefrontApp'\nimport { exportStore, hydrateStoreDocument, slugifyStoreName } from '../document/round-trip'\nimport '../blocks/registry' // ensure section blocks are registered\n\ntype StorefrontBackendProvider = NonNullable<StorefrontConfig['backend']>['provider']\n\n// ---------------------------------------------------------------------------\n// Storefront scaffold — renders a store from a pure-data AppManifest.\n//\n// The storefront surface carries its full declarative form as a Store Document\n// (surface.options.document, see store-document.ts): every serializable config\n// field lives in a document section, and code-valued fields (components,\n// routes, provider, adapters, JSX) are referenced by registered handle NAME.\n// The in-memory config Map this file used to keep is gone — a document plus\n// the handle registry reconstitutes the store in any session, which is what\n// makes export/diff/edit by an agent possible at all (spine §3 L0).\n// ---------------------------------------------------------------------------\n\n/** StorefrontConfig → AppManifest (the sugar-to-data direction). */\nexport function defineStorefront(config: StorefrontConfig): AppManifest {\n const id = slugifyStoreName(config.name)\n // Serialize the whole config into the document, auto-registering handles\n // (`<id>.<path>`) for code values the app did not name itself. Explicitly\n // registered handles win the reverse lookup, so a store that calls\n // registerHandle keeps its own names in the document.\n const document = exportStore(config, { appId: id, registerMissingHandles: true })\n const backendProvider = (config.backend?.provider ?? (config.provider ? 'custom' : 'mock')) as BackendProvider\n\n return defineApp({\n id,\n name: config.name,\n backend: {\n provider: backendProvider,\n url: config.backend?.url,\n },\n locale: {\n default: config.locale ?? 'pt-BR',\n supported: [config.locale ?? 'pt-BR'],\n currency: config.currency ?? 'BRL',\n },\n theme: config.theme as Record<string, unknown> | undefined,\n surfaces: {\n storefront: {\n scaffold: 'storefront',\n options: { document: document as unknown as Record<string, unknown> },\n },\n },\n })\n}\n\n/**\n * AppManifest → StorefrontConfig (the data-to-render direction).\n *\n * New manifests carry a Store Document; hydration resolves code by handle\n * name. `onError: 'report'` deliberately: this is the shopper path, and a\n * stale document must degrade loudly in the console rather than white-screen\n * the store (I7). The authoring loop gets the hard errors from\n * validateStore / `fayz validate` instead.\n *\n * Legacy manifests (committed before the document existed) carry flat surface\n * options; they map best-effort, without the code-valued fields — which is\n * exactly what they carried across sessions before, since the old in-memory\n * Map only worked inside the session that authored it.\n */\nfunction manifestToStorefrontConfig(manifest: AppManifest, surfaceName: string): StorefrontConfig {\n const surface = manifest.surfaces[surfaceName]\n const o = (surface?.options ?? {}) as Record<string, unknown>\n\n if (o.document && typeof o.document === 'object') {\n return hydrateStoreDocument(o.document as Record<string, unknown>, { onError: 'report' })\n }\n\n return {\n name: manifest.name,\n currency: (manifest.locale as { currency?: string } | undefined)?.currency,\n locale: (manifest.locale as { default?: string } | undefined)?.default,\n theme: manifest.theme as StorefrontTheme | undefined,\n announcement: o.announcement as string | undefined,\n home: o.home as HomeConfig | undefined,\n pages: o.pages as StorefrontConfig['pages'],\n nav: o.nav as NavLink[] | undefined,\n footer: o.footer as FooterConfig | undefined,\n shipping: o.shipping as StorefrontConfig['shipping'],\n features: o.features as StorefrontConfig['features'],\n catalog: o.catalog as StorefrontConfig['catalog'],\n backend: {\n provider: manifest.backend?.provider as StorefrontBackendProvider,\n url: manifest.backend?.url,\n },\n }\n}\n\nexport function StorefrontScaffold({ manifest, surface }: { manifest: AppManifest; surface: string }) {\n const config = React.useMemo(() => manifestToStorefrontConfig(manifest, surface), [manifest, surface])\n const resolved = React.useMemo(() => resolveConfig(config), [config])\n const inited = React.useRef(false)\n if (!inited.current) {\n initStorefrontRuntime(config)\n inited.current = true\n }\n return (\n <StorefrontConfigProvider value={resolved}>\n <StorefrontShell />\n </StorefrontConfigProvider>\n )\n}\nStorefrontScaffold.displayName = 'StorefrontScaffold'\n\n// Registration is lazy (called from the storefront renderApp wrapper and\n// createStorefront*) so that importing the @fayz-ai/storefront barrel stays\n// side-effect-free and tree-shakable.\nlet storefrontScaffoldRegistered = false\nexport function registerStorefrontScaffold(): void {\n if (storefrontScaffoldRegistered) return\n storefrontScaffoldRegistered = true\n registerScaffold('storefront', StorefrontScaffold, { source: 'sdk', label: 'Storefront' })\n}\n","import { getDeprecation, listDeprecations } from '@fayz-ai/sdk/deprecations'\nimport type { FayzDeprecation } from '@fayz-ai/sdk/deprecations'\nimport { storefrontDiscountToPromotion } from '@fayz-ai/shop/rules'\nimport type { Promotion } from '@fayz-ai/shop/rules'\nimport { STORE_SECTIONS, isRecord } from './sections'\nimport type { StoreDocument, StoreSectionName } from './sections'\nimport { validateStore } from './validate'\nimport type { StoreValidationReport } from './validate'\n\n// ---------------------------------------------------------------------------\n// `fayz upgrade` — codemods keyed to document version (spine M10).\n//\n// The store document already carries a per-SECTION version, following\n// WooCommerce Blueprint's `get_schema(int $version)`. M10 makes that number\n// mean something operational: a codemod declares the section and the exact\n// version it moves FROM and TO, so \"has this store been migrated\" is a lookup\n// rather than a judgement, and one SDK serves a migrated and an unmigrated\n// fleet at the same time. A deprecated field is accepted below the version\n// that retires it and is a hard validation error at or above it — the shim and\n// the removal are the same declaration, read from two sides.\n//\n// THE REFUSAL RULE, which is the whole reason this is trustworthy: a codemod\n// that cannot be safe does not do its best. It refuses, names the decision a\n// human must make, and leaves the document byte-identical. Guessing here would\n// be worse than not having the command, because the failure lands in a store's\n// checkout and nobody would know which run caused it.\n//\n// Every function in this module is PURE. Reading and writing files is the\n// CLI's job; this half has to stay testable and has to be callable from the\n// author loop next to describeStore / validateStore / applyChange.\n// ---------------------------------------------------------------------------\n\n/** One deprecated thing found in one store. */\nexport interface StoreDeprecationFinding {\n /** Registry row id. */\n id: string\n /** Dotted document path, when the deprecation is on the document surface. */\n path?: string\n /** What exactly was found, in the author's words. */\n detail: string\n deprecatedIn: string\n removeIn: string\n /** I2 — always present, always the thing to write instead. */\n replacement: string\n /** The codemod that answers it. */\n codemod: string\n /** False when only a human can retire it (pool state, code outside the document). */\n automatable: boolean\n}\n\n/** Why a codemod would not run, and what a human has to decide instead. */\nexport interface StoreCodemodRefusal {\n reason: string\n /** The decisions, one per line. Never a suggestion the codemod could have\n * taken itself — if it could, it would have. */\n decide: string[]\n}\n\nexport type StoreCodemodStatus =\n /** The document changed (possibly only its section version). */\n | 'applied'\n /** Nothing here to migrate: the section is absent, or already past this version. */\n | 'not-applicable'\n /** Something is here, and moving it safely needs a human. */\n | 'refused'\n\n/** A section version move — the key the codemod is filed under. */\nexport interface StoreCodemodVersionKey {\n section: StoreSectionName\n from: number\n to: number\n}\n\nexport interface StoreCodemodResult {\n codemod: string\n status: StoreCodemodStatus\n /** Registry ids this codemod retires. */\n deprecations: string[]\n /** The version move, or null for a deprecation that is not on the document\n * surface at all — which is itself why such a codemod always refuses. */\n version: StoreCodemodVersionKey | null\n /** One line per document change, in the applyChange path vocabulary. */\n changes: string[]\n note: string\n refusal?: StoreCodemodRefusal\n}\n\nexport interface StoreUpgradeOptions {\n /** Restrict the run to these codemod ids. Unknown ids are a hard error\n * naming the valid set (I2). */\n only?: readonly string[]\n}\n\nexport interface StoreUpgradeResult {\n /** False when a codemod refused or the result would not validate. */\n ok: boolean\n /** The upgraded document. Deep-equal to the input when `changed` is false. */\n doc: StoreDocument\n changed: boolean\n deprecations: StoreDeprecationFinding[]\n codemods: StoreCodemodResult[]\n /** The result validated. A codemod that would break the document is a bug\n * in the codemod, and this is where it surfaces. */\n validation: StoreValidationReport\n}\n\n// --- Detection ----------------------------------------------------------------\n\nfunction sectionOf(doc: Record<string, unknown>, name: string): Record<string, unknown> | null {\n const value = doc[name]\n return isRecord(value) ? value : null\n}\n\nfunction sectionVersion(doc: Record<string, unknown>, name: StoreSectionName): number | null {\n const section = sectionOf(doc, name)\n if (!section) return null\n return typeof section.version === 'number' ? section.version : null\n}\n\nfunction finding(row: FayzDeprecation, detail: string, path: string | undefined, automatable: boolean): StoreDeprecationFinding {\n return {\n id: row.id,\n path,\n detail,\n deprecatedIn: row.deprecatedIn,\n removeIn: row.removeIn,\n replacement: row.replacement,\n codemod: row.codemod,\n automatable,\n }\n}\n\n/**\n * What in THIS document is deprecated — the machine-readable answer to the\n * question I10 exists to make askable.\n *\n * Only the document surface is visible from here. A deprecation living in the\n * store's own code (the productMetadata overlay) or in a pool (the two SQL\n * ones) is reported by its row as un-automatable rather than omitted: an\n * enumerable deprecation that quietly drops the ones you cannot see from a\n * JSON file would be the silent-failure mode the whole spine is against.\n */\nexport function scanStoreDeprecations(input: StoreDocument | Record<string, unknown>): StoreDeprecationFinding[] {\n const doc = input as Record<string, unknown>\n const found: StoreDeprecationFinding[] = []\n\n for (const row of listDeprecations()) {\n if (row.surface !== 'document-field') continue\n\n if (row.id === 'storefront.commerce.discounts') {\n const commerce = sectionOf(doc, 'commerce')\n const discounts = commerce?.discounts\n if (Array.isArray(discounts) && discounts.length > 0) {\n const codes = discounts\n .map((entry) => (isRecord(entry) && typeof entry.code === 'string' ? entry.code : '?'))\n .join(', ')\n found.push(\n finding(row, `${discounts.length} legacy coupon code(s): ${codes}`, 'commerce.discounts', true),\n )\n }\n continue\n }\n\n if (row.id === 'storefront.backend.supabaseUrl' || row.id === 'storefront.backend.supabaseAnonKey') {\n const field = row.id === 'storefront.backend.supabaseUrl' ? 'supabaseUrl' : 'supabaseAnonKey'\n const backend = sectionOf(doc, 'backend')\n if (backend && typeof backend[field] === 'string') {\n found.push(finding(row, `legacy backend.${field} is set`, `backend.${field}`, true))\n }\n continue\n }\n }\n\n return found\n}\n\n/**\n * The deprecations no document can answer for, with the reason.\n *\n * The CLI merges these into its report so `fayz upgrade` never implies a store\n * is clean when the only reason it looks clean is that the evidence is not in\n * the repo.\n */\nexport function unobservableDeprecations(): StoreDeprecationFinding[] {\n return listDeprecations()\n .filter((row) => row.surface !== 'document-field')\n .map((row) => finding(row, row.detect, undefined, false))\n}\n\n// --- The codemods -------------------------------------------------------------\n\ninterface Codemod {\n id: string\n title: string\n version: StoreCodemodVersionKey | null\n run(doc: Record<string, unknown>): StoreCodemodResult\n}\n\nfunction result(\n mod: Pick<Codemod, 'id' | 'version'>,\n status: StoreCodemodStatus,\n note: string,\n extra: Partial<StoreCodemodResult> = {},\n): StoreCodemodResult {\n return {\n codemod: mod.id,\n status,\n deprecations: listDeprecations().filter((row) => row.codemod === mod.id).map((row) => row.id),\n version: mod.version,\n changes: [],\n note,\n ...extra,\n }\n}\n\n/** Deep clone through JSON — the document is JSON by construction (exportStore\n * refuses anything else), so this cannot lose a value. */\nfunction clone<T>(value: T): T {\n return JSON.parse(JSON.stringify(value)) as T\n}\n\nconst PERCENT_CODE_KEYS = new Set(['code', 'percent', 'title'])\n\n/**\n * commerce.discounts → promotions.promotions (commerce v1 → v2).\n *\n * Safe because the translation is not invented here: it is\n * `storefrontDiscountToPromotion`, the SAME function the runtime shim already\n * routes every legacy code through. The money after the codemod is the money\n * before it, by construction rather than by review.\n */\nconst discountsToPromotions: Codemod = {\n id: 'commerce.discounts-to-promotions',\n title: 'Legacy percent coupon codes become rule-engine promotions',\n version: { section: 'commerce', from: 1, to: 2 },\n run(doc) {\n const mod = discountsToPromotions\n const version = sectionVersion(doc, 'commerce')\n if (version === null) return result(mod, 'not-applicable', 'no commerce section')\n if (version !== 1) return result(mod, 'not-applicable', `commerce is already at version ${version}`)\n\n const commerce = sectionOf(doc, 'commerce')!\n const raw = commerce.discounts\n const entries = Array.isArray(raw) ? raw : []\n\n // --- refuse before touching anything -------------------------------------\n const decide: string[] = []\n\n for (const [index, entry] of entries.entries()) {\n const at = `commerce.discounts[${index}]`\n if (!isRecord(entry)) {\n decide.push(`${at} is not an object — rewrite it as {code, percent, title?} or delete it.`)\n continue\n }\n const unknown = Object.keys(entry).filter((key) => !PERCENT_CODE_KEYS.has(key))\n if (unknown.length > 0) {\n decide.push(\n `${at} carries ${unknown.join(', ')}, which {code, percent, title?} has no meaning for — ` +\n 'say what those should become as promotion rules, or delete them.',\n )\n }\n if (typeof entry.code !== 'string' || entry.code.trim() === '') {\n decide.push(`${at}.code is missing — a coupon with no code cannot become a code-gated promotion.`)\n }\n if (typeof entry.percent !== 'number' || !Number.isFinite(entry.percent) || entry.percent <= 0 || entry.percent > 100) {\n decide.push(\n `${at}.percent is ${JSON.stringify(entry.percent)} — outside (0, 100], so the intended discount is not derivable.`,\n )\n }\n }\n\n const codeOf = (entry: unknown): string | null =>\n isRecord(entry) && typeof entry.code === 'string' ? entry.code.trim().toUpperCase() : null\n\n // Already a promotion under the same code: two live definitions of one\n // coupon, and only a human knows which is the real one.\n const promotionsSection = sectionOf(doc, 'promotions')\n const existing = Array.isArray(promotionsSection?.promotions) ? (promotionsSection!.promotions as unknown[]) : []\n for (const entry of entries) {\n const code = codeOf(entry)\n if (!code) continue\n const clash = existing.find((promo) => isRecord(promo) && typeof promo.code === 'string' && promo.code.trim().toUpperCase() === code)\n if (clash) {\n decide.push(\n `${code} is already declared in promotions.promotions (${isRecord(clash) ? String(clash.id ?? 'no id') : '?'}) ` +\n 'as well as in commerce.discounts — delete whichever of the two is not the live offer.',\n )\n }\n }\n\n // The catalog seed carries the same code. Today buildMockSeed SUPPRESSES\n // the seed row because the config code wins; migrating the config code out\n // of `discounts` removes that suppression and the seed row comes back as a\n // second promotion with the same code. Found by reading buildMockSeed, not\n // by reasoning about it.\n const catalog = sectionOf(doc, 'catalog')\n const seeded = Array.isArray(catalog?.discounts) ? (catalog!.discounts as unknown[]) : []\n for (const entry of entries) {\n const code = codeOf(entry)\n if (!code) continue\n if (seeded.some((seed) => codeOf(seed) === code)) {\n decide.push(\n `${code} is declared in BOTH commerce.discounts and catalog.discounts. The config copy currently ` +\n 'suppresses the catalog seed; once it becomes a promotion that suppression stops and the code ' +\n 'would apply twice. Delete whichever of the two is not the real offer, then re-run.',\n )\n }\n }\n\n if (decide.length > 0) {\n return result(mod, 'refused', `${entries.length} legacy code(s) present`, {\n refusal: {\n reason: 'the legacy codes cannot be translated without a decision this command must not make',\n decide,\n },\n })\n }\n\n // --- apply ---------------------------------------------------------------\n const changes: string[] = []\n if (entries.length > 0) {\n const migrated: Promotion[] = entries.map((entry) => {\n const record = entry as { code: string; percent: number; title?: string }\n return storefrontDiscountToPromotion(record)\n })\n const target = sectionOf(doc, 'promotions') ?? { version: STORE_SECTIONS.promotions.versions[0]! }\n const list = Array.isArray(target.promotions) ? [...(target.promotions as unknown[])] : []\n for (const promotion of migrated) {\n list.push(promotion as unknown as Record<string, unknown>)\n changes.push(`insert promotions.promotions[] ${promotion.code} (${promotion.applicationMethod.value}% off order)`)\n }\n target.promotions = list\n doc.promotions = target\n delete commerce.discounts\n changes.push(`remove commerce.discounts (${entries.length} entr${entries.length === 1 ? 'y' : 'ies'})`)\n }\n commerce.version = 2\n changes.push('set commerce.version 1 → 2')\n\n return result(\n mod,\n 'applied',\n entries.length === 0\n ? 'no legacy codes; version bump only, which records that this document is past the migration'\n : `${entries.length} legacy code(s) migrated onto the rule engine`,\n { changes },\n )\n },\n}\n\n/**\n * backend.supabaseUrl / backend.supabaseAnonKey → auth.supabase (backend v1 → v2).\n *\n * Not a pure relocation, and this is the interesting part. `resolveAuthAdapter`\n * reads `config.provider ?? config.adapter ?? (fallback?.supabaseUrl ? 'supabase' : 'mock')`\n * — so today the legacy field is ALSO what selects the supabase auth provider.\n * Move the credentials without saying anything about the provider and a store\n * with `auth` silent flips to mock auth: it would still build, still render,\n * and simply stop signing anybody in. So when the provider is not declared,\n * this refuses.\n */\nconst supabaseToAuth: Codemod = {\n id: 'backend.supabase-to-auth',\n title: 'Legacy supabase connection fields move under auth.supabase',\n version: { section: 'backend', from: 1, to: 2 },\n run(doc) {\n const mod = supabaseToAuth\n const version = sectionVersion(doc, 'backend')\n if (version === null) return result(mod, 'not-applicable', 'no backend section')\n if (version !== 1) return result(mod, 'not-applicable', `backend is already at version ${version}`)\n\n const backend = sectionOf(doc, 'backend')!\n const url = typeof backend.supabaseUrl === 'string' ? backend.supabaseUrl : undefined\n const anonKey = typeof backend.supabaseAnonKey === 'string' ? backend.supabaseAnonKey : undefined\n\n const auth = sectionOf(doc, 'auth')\n const authSupabase = auth && isRecord(auth.supabase) ? auth.supabase : null\n\n if (url !== undefined || anonKey !== undefined) {\n const decide: string[] = []\n const declaresProvider = Boolean(auth && (typeof auth.provider === 'string' || typeof auth.adapter === 'string'))\n if (!declaresProvider) {\n decide.push(\n \"declare auth.provider explicitly — 'supabase' to keep today's behaviour (the legacy field is what \" +\n \"currently selects it, via resolveAuthAdapter's `fallback?.supabaseUrl ? 'supabase' : 'mock'`), \" +\n \"or 'mock' if these credentials were vestigial. Moving them silently would flip the store to mock auth.\",\n )\n }\n if (authSupabase && typeof authSupabase.url === 'string' && url !== undefined && authSupabase.url !== url) {\n decide.push(`auth.supabase.url and backend.supabaseUrl disagree — say which project the store talks to.`)\n }\n if (\n authSupabase &&\n typeof authSupabase.anonKey === 'string' &&\n anonKey !== undefined &&\n authSupabase.anonKey !== anonKey\n ) {\n decide.push('auth.supabase.anonKey and backend.supabaseAnonKey disagree — say which key is current.')\n }\n if (decide.length > 0) {\n return result(mod, 'refused', 'legacy supabase fields are set', {\n refusal: { reason: 'moving the credentials would change who the store authenticates as', decide },\n })\n }\n }\n\n const changes: string[] = []\n if (url !== undefined || anonKey !== undefined) {\n const target = sectionOf(doc, 'auth') ?? { version: STORE_SECTIONS.auth.versions[0]! }\n const supabase = isRecord(target.supabase) ? { ...target.supabase } : {}\n if (url !== undefined) {\n supabase.url = url\n delete backend.supabaseUrl\n changes.push('move backend.supabaseUrl → auth.supabase.url')\n }\n if (anonKey !== undefined) {\n supabase.anonKey = anonKey\n delete backend.supabaseAnonKey\n changes.push('move backend.supabaseAnonKey → auth.supabase.anonKey')\n }\n target.supabase = supabase\n doc.auth = target\n }\n backend.version = 2\n changes.push('set backend.version 1 → 2')\n\n return result(\n mod,\n 'applied',\n changes.length === 1 ? 'no legacy supabase fields; version bump only' : 'legacy supabase connection moved under auth',\n { changes },\n )\n },\n}\n\n/**\n * A codemod for a deprecation that is NOT on the document surface.\n *\n * It exists, it runs, and it always refuses — which is the honest shape. The\n * registry gives every deprecation a codemod id precisely so that `fayz\n * upgrade` can never answer \"nothing to do\" about a thing it simply cannot\n * see. What it produces instead is the worklist.\n */\nfunction offDocumentCodemod(id: string, deprecationId: string, decide: string[]): Codemod {\n return {\n id,\n title: getDeprecation(deprecationId).title,\n version: null,\n run() {\n const row = getDeprecation(deprecationId)\n return result({ id, version: null }, 'refused', row.detect, {\n refusal: {\n reason:\n `${row.id} does not live in the store document, so no document transform can retire it. ` +\n `It lives in: ${row.where.join(', ')}.`,\n decide,\n },\n })\n },\n }\n}\n\nconst productMetadataOverlay = offDocumentCodemod(\n 'shop.product-metadata-overlay',\n 'shop.provider.productMetadata',\n [\n 'Confirm, per product, that every option axis the overlay declares (sizes / colors / options) exists as a real variant in admin > product > variants. Only the database knows this; the repo does not.',\n 'For an axis that has NO variants: decide whether the product is genuinely single-variant (delete the axis from the overlay) or whether variants must be created first (do that, then delete it).',\n 'For metadata that is display-only and has no variant equivalent (badges, care text): decide where it goes — the product\\'s own metadata column, or a block prop.',\n 'Then delete the `productMetadata` option from createFayzShopProvider (usually src/config/shop.ts) and the local catalog rows that feed it.',\n ],\n)\n\nconst inventoryCountWrite = offDocumentCodemod(\n 'shop.inventory-count-write',\n 'shop.inventory.directCountWrite',\n [\n 'Apply 0036 (and 0037) to every pool, so a direct write is translated instead of lost.',\n \"Then find the callers: SELECT count(*) FROM plg_shop_stock_movements WHERE reason_code = 'legacy_write' is the backlog, and it names the variants.\",\n 'For each caller, decide what the write MEANT — a receipt, a loss, a stock count, a correction. The shim records all of them as `adjustment` because it is told a number changed and never why; only the person who wrote the caller can say which it was.',\n 'Rewrite each caller to insert the right movement kind. The column keeps working until then.',\n ],\n)\n\nconst placeOrderVariantless = offDocumentCodemod(\n 'shop.place-order-variantless',\n 'shop.placeOrder.variantless',\n [\n 'Apply 0037_default_variant.sql to every pool. Its exit condition is stated in 0039\\'s header: the count of products with no variant must read 0 on every pool.',\n 'Verify it per pool — a repo has no way to observe pool state, and removing the leg while one pool still has variantless products would stop those sales dead.',\n 'Only once every pool reads 0 may the deprecated leg be deleted from shop_place_order.',\n ],\n)\n\nconst saasPackageRename = offDocumentCodemod(\n 'admin.saas-package-rename',\n 'admin.package.saas',\n [\n \"Rewrite the imports: every `from '@fayz-ai/saas'` (and its /ui, /db, /org, /billing, /permissions subpaths) becomes the same path under '@fayz-ai/admin'. The exported API is identical, so this is a find-and-replace, not a decision.\",\n 'Swap the dependency in package.json: remove @fayz-ai/saas, add @fayz-ai/admin at the same range.',\n 'If the app has a LOCAL plugin or a tsconfig path that names @fayz-ai/saas, update those too — a stale alias resolves to the shim and keeps the warning alive after the imports are clean.',\n ],\n)\n\nconst CODEMODS: readonly Codemod[] = [\n discountsToPromotions,\n supabaseToAuth,\n productMetadataOverlay,\n inventoryCountWrite,\n placeOrderVariantless,\n saasPackageRename,\n]\n\n/** Every codemod id, in run order. */\nexport const STORE_CODEMOD_IDS: readonly string[] = CODEMODS.map((mod) => mod.id)\n\n/** What each codemod is, as data — describeStore publishes this. */\nexport interface StoreCodemodDescriptor {\n id: string\n title: string\n /** Registry ids it retires. */\n deprecations: string[]\n /** The section version it is keyed to, or null when the deprecation is not\n * on the document surface (such a codemod always refuses). */\n version: StoreCodemodVersionKey | null\n /** Can it ever apply without a human? */\n automatable: boolean\n}\n\nexport function describeCodemods(): StoreCodemodDescriptor[] {\n return CODEMODS.map((mod) => ({\n id: mod.id,\n title: mod.title,\n deprecations: listDeprecations().filter((row) => row.codemod === mod.id).map((row) => row.id),\n version: mod.version,\n automatable: mod.version !== null,\n }))\n}\n\n/**\n * Run the codemods against a document and report exactly what would change.\n *\n * PURE: the input document is never mutated, and a refused codemod contributes\n * nothing to the output — a refusal must leave the document byte-identical or\n * the refusal was not a refusal.\n */\nexport function upgradeStore(\n input: StoreDocument | Record<string, unknown>,\n options: StoreUpgradeOptions = {},\n): StoreUpgradeResult {\n let selected = CODEMODS\n if (options.only) {\n for (const id of options.only) {\n if (!STORE_CODEMOD_IDS.includes(id)) {\n throw new Error(`Unknown codemod \"${id}\". Valid: ${STORE_CODEMOD_IDS.join(', ')}`)\n }\n }\n selected = CODEMODS.filter((mod) => options.only!.includes(mod.id))\n }\n\n const doc = clone(input) as Record<string, unknown>\n const codemods: StoreCodemodResult[] = []\n let changed = false\n\n for (const mod of selected) {\n // Each codemod runs against a scratch copy so a refusal — or a throw —\n // cannot leave a half-applied document behind. Only an `applied` result\n // is promoted.\n const scratch = clone(doc)\n const outcome = mod.run(scratch)\n codemods.push(outcome)\n if (outcome.status === 'applied') {\n for (const key of Object.keys(doc)) delete doc[key]\n Object.assign(doc, scratch)\n if (outcome.changes.length > 0) changed = true\n }\n }\n\n return {\n ok: codemods.every((outcome) => outcome.status !== 'refused'),\n doc: doc as unknown as StoreDocument,\n changed,\n deprecations: scanStoreDeprecations(input),\n codemods,\n validation: validateStore(doc),\n }\n}\n","import { blockInstanceId } from '../blocks/page-blocks'\nimport { STORE_SECTION_NAMES, isRecord, isJsonValue } from './sections'\nimport type { StoreDocument, StoreSectionName } from './sections'\nimport { validateStore } from './validate'\nimport type { StoreValidationError, StoreValidationReport } from './validate'\n\n// ---------------------------------------------------------------------------\n// applyChange — the fourth ability (spine §3 L5).\n//\n// describeStore says what a store CAN be, validateStore says whether it IS\n// valid, renderStore says what it LOOKS like. applyChange is the only one that\n// writes, and it exists so that an agent's edit is a small typed operation\n// against a path rather than \"emit the whole document again\": a regenerated\n// document loses everything the agent did not think to repeat, and a diff of\n// one is unreadable.\n//\n// Three properties, each of which is the reason a benchmark's edit surface is\n// not usable by a generator:\n//\n// 1. It addresses the SAME paths validateStore reports\n// ('presentation.pages.home.blocks[2].props.title'), plus a block-id form\n// ('blocks[#hero]') because two product rails on one page are otherwise\n// indistinguishable — the problem `StorefrontBlockRef.id` exists for.\n// An agent therefore corrects at exactly the address it was given.\n//\n// 2. It is TRANSACTIONAL and gated by validateStore. A batch that would\n// leave the document invalid is refused whole, with the reasons, and the\n// input document is returned untouched. There is no half-applied state to\n// reason about and no way to author a store the renderer will choke on.\n//\n// 3. Every failure names the valid set (I2): an unknown block id lists the\n// ids present, a locked section lists the writable ones. Silent\n// no-op-on-unknown is what makes generated configuration uncorrectable.\n//\n// It is deliberately five operations. WooCommerce's answer to \"let extensions\n// change things\" was 3,657 hooks; the lesson §4 draws is that a surface an\n// agent cannot enumerate is a surface it cannot use.\n// ---------------------------------------------------------------------------\n\n/** JSON values a change may write. */\nexport type StoreChangeValue = unknown\n\nexport const STORE_CHANGE_OPS = ['set', 'remove', 'insert', 'move'] as const\nexport type StoreChangeOp = (typeof STORE_CHANGE_OPS)[number]\n\nexport interface StoreChange {\n /**\n * `set` — write `value` at `path` (creating missing intermediate objects).\n * `remove` — delete the key, or splice the array element, at `path`.\n * `insert` — splice `value` into the array at `path`, at `index` (default: append).\n * `move` — relocate the array element at `path` to `index`.\n */\n op: StoreChangeOp\n /**\n * Dotted document path, the same shape `validateStore` reports:\n * `presentation.pages.home.blocks[2].props.title`. An array step may address\n * a block by id instead of by position — `blocks[#hero]` — which is the only\n * form that stays correct across a reorder.\n */\n path: string\n /** `set` / `insert`: the JSON value to write. */\n value?: StoreChangeValue\n /** `insert` / `move`: destination index. `insert` defaults to append. */\n index?: number\n}\n\nexport interface AppliedStoreChange {\n op: StoreChangeOp\n path: string\n /** The path with every `[#id]` step resolved to the position it hit — what\n * actually moved, which is what a diff or an undo needs. */\n resolvedPath: string\n /** The value that was there before, when there was one. */\n before?: StoreChangeValue\n /** The value that is there now, when the op leaves one. */\n after?: StoreChangeValue\n}\n\nexport interface ApplyChangeOptions {\n /**\n * Sections this caller may write. Defaults to every section EXCEPT `code`:\n * a code entry is a handle name resolved out of the handle registry, so an\n * agent inventing one produces a document that hydrates to a missing\n * component. Pass it explicitly to move a route or drop an override.\n */\n sections?: readonly StoreSectionName[]\n /**\n * 'reject' (default) — a batch whose RESULT fails validation is discarded\n * whole and `doc` is the untouched input. 'allow' returns the changed\n * document with the report anyway, for a caller that is mid-way through a\n * multi-step edit and will validate at the end.\n */\n onInvalid?: 'reject' | 'allow'\n}\n\nexport interface StoreChangeResult {\n /** True only when every change applied AND the result validates. */\n ok: boolean\n /** The resulting document — the input, unchanged, when a rejected batch failed. */\n doc: StoreDocument\n /** One entry per change, in order, for the changes that were applied. */\n applied: AppliedStoreChange[]\n /** Path/permission failures AND the resulting document's validation errors,\n * in one list, in the shape `validateStore` returns — so a caller has one\n * error vocabulary to correct on rather than two. */\n errors: StoreValidationError[]\n /** Validation of the resulting document. */\n validation: StoreValidationReport\n}\n\n/** Sections a change may write unless the caller says otherwise. */\nexport const DEFAULT_WRITABLE_SECTIONS: readonly StoreSectionName[] = STORE_SECTION_NAMES.filter(\n (name) => name !== 'code',\n)\n\n// --- Paths --------------------------------------------------------------------\n\ntype PathStep =\n | { kind: 'key'; key: string }\n | { kind: 'index'; index: number }\n | { kind: 'id'; id: string }\n\n/** Render a step the way it is written, for error paths and `resolvedPath`. */\nfunction stepText(step: PathStep): string {\n if (step.kind === 'key') return step.key\n if (step.kind === 'index') return `[${step.index}]`\n return `[#${step.id}]`\n}\n\nfunction pathText(steps: readonly PathStep[]): string {\n return steps.reduce((acc, step) => {\n if (step.kind === 'key') return acc ? `${acc}.${step.key}` : step.key\n return acc + stepText(step)\n }, '')\n}\n\n/**\n * Parse `presentation.pages.home.blocks[#hero].props.title` into steps.\n * Returns null for anything malformed — an unparseable path is a hard error,\n * never a silently ignored change.\n */\nexport function parseStorePath(path: string): PathStep[] | null {\n if (typeof path !== 'string' || path.trim() === '') return null\n const steps: PathStep[] = []\n let i = 0\n const source = path.trim()\n let expectKey = true\n\n while (i < source.length) {\n if (source[i] === '.') {\n if (expectKey) return null // '..' or a leading dot\n i++\n expectKey = true\n continue\n }\n if (source[i] === '[') {\n const close = source.indexOf(']', i)\n if (close === -1) return null\n const inner = source.slice(i + 1, close)\n if (inner.startsWith('#')) {\n const id = inner.slice(1)\n if (!id) return null\n steps.push({ kind: 'id', id })\n } else {\n if (!/^\\d+$/.test(inner)) return null\n steps.push({ kind: 'index', index: Number(inner) })\n }\n i = close + 1\n expectKey = false\n continue\n }\n if (!expectKey) return null // 'a[0]b' — a key glued to a bracket\n const next = source.slice(i).search(/[.[]/)\n const key = next === -1 ? source.slice(i) : source.slice(i, i + next)\n if (!key) return null\n steps.push({ kind: 'key', key })\n i += key.length\n expectKey = false\n }\n\n return expectKey || steps.length === 0 ? null : steps\n}\n\n/**\n * Position of the entry addressed by `[#id]`, or -1.\n *\n * Matches the authored `id` first, then the id the RENDERER gives an\n * unidentified block (`blockInstanceId` — `<type>-<index>`). Most documents in\n * the fleet author no ids at all, so without the second form every id\n * `renderStore` hands back would be unaddressable by the ability whose job is\n * to act on it.\n */\nfunction findById(list: readonly unknown[], id: string): number {\n const authored = list.findIndex((entry) => isRecord(entry) && entry.id === id)\n if (authored !== -1) return authored\n return list.findIndex((entry, index) => isRecord(entry) && blockInstanceId(entry, index) === id)\n}\n\n/** The ids present in a list, as an agent would see them (I2's valid set). */\nfunction blockIdsIn(list: readonly unknown[]): string[] {\n return list.flatMap((entry, index) =>\n isRecord(entry) && (typeof entry.id === 'string' || typeof entry.type === 'string')\n ? [blockInstanceId(entry, index)]\n : [],\n )\n}\n\n// --- Navigation ---------------------------------------------------------------\n\ninterface Cursor {\n container: Record<string, unknown> | unknown[]\n /** Where inside the container the final step points. */\n step: PathStep\n /** Array position, when the container is an array. */\n position: number\n /** Steps walked, for `resolvedPath`. */\n walked: PathStep[]\n}\n\ntype NavResult = { ok: true; cursor: Cursor } | { ok: false; error: StoreValidationError }\n\nfunction navError(path: string, code: string, message: string, valid?: string[]): NavResult {\n return { ok: false, error: valid ? { path, code, message, valid } : { path, code, message } }\n}\n\n/**\n * Walk to the CONTAINER of the last step.\n *\n * `create` makes missing intermediate objects along a pure-key path — an agent\n * adding the store's first editorial page should not have to `set\n * presentation.pages` and `set presentation.pages.content` first. It never\n * creates array slots: a position that does not exist is a mistake, not an\n * intent, and it is reported with the length that does exist.\n */\nfunction navigate(root: Record<string, unknown>, steps: PathStep[], create: boolean): NavResult {\n let node: unknown = root\n const walked: PathStep[] = []\n\n for (let i = 0; i < steps.length - 1; i++) {\n const step = steps[i]!\n const here = pathText(walked)\n if (step.kind === 'key') {\n if (!isRecord(node)) {\n return navError(here || '(document)', 'not-an-object', `${here || 'the document'} is not an object, so \".${step.key}\" cannot be followed`)\n }\n if (!(step.key in node) || node[step.key] === undefined) {\n if (!create) {\n return navError(\n pathText([...walked, step]),\n 'unknown-path',\n `${pathText([...walked, step])} does not exist`,\n Object.keys(node).sort(),\n )\n }\n node[step.key] = {}\n }\n node = node[step.key]\n walked.push(step)\n continue\n }\n\n if (!Array.isArray(node)) {\n return navError(here || '(document)', 'not-an-array', `${here || 'the document'} is not an array, so \"${stepText(step)}\" cannot be followed`)\n }\n const position = step.kind === 'index' ? step.index : findById(node, step.id)\n if (position < 0 || position >= node.length) {\n return step.kind === 'id'\n ? navError(pathText([...walked, step]), 'unknown-block-id', `no entry in ${here} has the id \"${step.id}\"`, blockIdsIn(node))\n : navError(pathText([...walked, step]), 'index-out-of-range', `${here} has ${node.length} entr${node.length === 1 ? 'y' : 'ies'}, so index ${step.index} is out of range`)\n }\n node = node[position]\n walked.push({ kind: 'index', index: position })\n }\n\n const last = steps[steps.length - 1]!\n const here = pathText(walked)\n if (last.kind === 'key') {\n if (!isRecord(node)) {\n return navError(here || '(document)', 'not-an-object', `${here || 'the document'} is not an object, so \".${last.key}\" cannot be written`)\n }\n return { ok: true, cursor: { container: node, step: last, position: -1, walked } }\n }\n if (!Array.isArray(node)) {\n return navError(here || '(document)', 'not-an-array', `${here || 'the document'} is not an array, so \"${stepText(last)}\" cannot be written`)\n }\n const position = last.kind === 'index' ? last.index : findById(node, last.id)\n if (last.kind === 'id' && position < 0) {\n return navError(pathText([...walked, last]), 'unknown-block-id', `no entry in ${here} has the id \"${last.id}\"`, blockIdsIn(node))\n }\n return { ok: true, cursor: { container: node, step: last, position, walked } }\n}\n\n// --- Apply --------------------------------------------------------------------\n\nfunction clone<T>(value: T): T {\n return JSON.parse(JSON.stringify(value)) as T\n}\n\nfunction sectionOf(steps: PathStep[]): string | null {\n const first = steps[0]\n return first && first.kind === 'key' ? first.key : null\n}\n\n/**\n * Apply an ordered batch of changes to a Store Document.\n *\n * Transactional: the batch either applies whole and validates, or the input\n * document comes back untouched with every reason listed.\n *\n * applyChange(doc, { op: 'set', path: 'theme.colors.primary', value: '41 54% 55%' })\n * applyChange(doc, [\n * { op: 'insert', path: 'presentation.home.sections', index: 0, value: { type: 'seals' } },\n * { op: 'move', path: 'presentation.home.sections[#hero]', index: 1 },\n * ])\n */\nexport function applyChange(\n input: StoreDocument | Record<string, unknown>,\n changes: StoreChange | readonly StoreChange[],\n options: ApplyChangeOptions = {},\n): StoreChangeResult {\n const batch = Array.isArray(changes) ? changes : [changes as StoreChange]\n const writable = options.sections ?? DEFAULT_WRITABLE_SECTIONS\n const onInvalid = options.onInvalid ?? 'reject'\n\n const original = input as Record<string, unknown>\n const errors: StoreValidationError[] = []\n const applied: AppliedStoreChange[] = []\n\n if (!isRecord(original)) {\n const error: StoreValidationError = {\n path: '',\n code: 'invalid-document',\n message: 'a Store Document is an object',\n }\n return {\n ok: false,\n doc: input as StoreDocument,\n applied,\n errors: [error],\n validation: { ok: false, errors: [error] },\n }\n }\n\n const draft = clone(original)\n\n for (let index = 0; index < batch.length; index++) {\n const change = batch[index]!\n const at = `changes[${index}]`\n\n if (!STORE_CHANGE_OPS.includes(change?.op)) {\n errors.push({\n path: `${at}.op`,\n code: 'unknown-change-op',\n message: `\"${String(change?.op)}\" is not a change operation`,\n valid: [...STORE_CHANGE_OPS],\n })\n continue\n }\n\n const steps = parseStorePath(change.path)\n if (!steps) {\n errors.push({\n path: `${at}.path`,\n code: 'invalid-path',\n message: `\"${String(change.path)}\" is not a document path — dotted keys with [0] or [#block-id] steps`,\n })\n continue\n }\n\n const section = sectionOf(steps)\n if (section === null || !STORE_SECTION_NAMES.includes(section as StoreSectionName)) {\n errors.push({\n path: `${at}.path`,\n code: 'unknown-section',\n message: `\"${String(section ?? change.path)}\" is not a document section`,\n valid: [...STORE_SECTION_NAMES],\n })\n continue\n }\n if (!writable.includes(section as StoreSectionName)) {\n errors.push({\n path: `${at}.path`,\n code: 'section-not-writable',\n message:\n section === 'code'\n ? 'the code section holds handle NAMES resolved from the handle registry — an invented one hydrates to a missing component. Pass { sections: [..., \\'code\\'] } to write it deliberately.'\n : `the \"${section}\" section is not writable by this caller`,\n valid: [...writable],\n })\n continue\n }\n if ((change.op === 'set' || change.op === 'insert') && !isJsonValue(change.value)) {\n errors.push({\n path: `${at}.value`,\n code: 'invalid-value',\n message: 'a change writes JSON — code belongs in a registered handle referenced from the code section',\n })\n continue\n }\n\n // A section the document has not opened yet gets opened at v1, so adding\n // the first promotion or the first editorial page is one change, not three.\n if (draft[section] === undefined && (change.op === 'set' || change.op === 'insert')) {\n draft[section] = { version: 1 }\n }\n\n const nav = navigate(draft, steps, change.op === 'set')\n if (!nav.ok) {\n errors.push({ ...nav.error, path: nav.error.path })\n continue\n }\n const { container, step, position, walked } = nav.cursor\n const resolvedSteps = [...walked, step.kind === 'id' ? { kind: 'index' as const, index: position } : step]\n const resolvedPath = pathText(resolvedSteps)\n\n if (Array.isArray(container)) {\n const before = position >= 0 && position < container.length ? clone(container[position]) : undefined\n if (change.op === 'set') {\n if (position < 0 || position >= container.length) {\n errors.push({\n path: change.path,\n code: 'index-out-of-range',\n message: `${pathText(walked)} has ${container.length} entries — use insert to add one`,\n })\n continue\n }\n container[position] = clone(change.value)\n applied.push({ op: 'set', path: change.path, resolvedPath, before, after: clone(change.value) })\n continue\n }\n if (change.op === 'remove') {\n if (position < 0 || position >= container.length) {\n errors.push({\n path: change.path,\n code: 'index-out-of-range',\n message: `${pathText(walked)} has ${container.length} entries, so ${stepText(step)} cannot be removed`,\n })\n continue\n }\n container.splice(position, 1)\n applied.push({ op: 'remove', path: change.path, resolvedPath, before })\n continue\n }\n if (change.op === 'move') {\n if (position < 0 || position >= container.length) {\n errors.push({\n path: change.path,\n code: 'index-out-of-range',\n message: `${pathText(walked)} has ${container.length} entries, so ${stepText(step)} cannot be moved`,\n })\n continue\n }\n const to = change.index ?? 0\n if (!Number.isInteger(to) || to < 0 || to >= container.length) {\n errors.push({\n path: `${at}.index`,\n code: 'index-out-of-range',\n message: `move destination must be 0..${container.length - 1}, got ${String(change.index)}`,\n })\n continue\n }\n const [entry] = container.splice(position, 1)\n container.splice(to, 0, entry)\n applied.push({ op: 'move', path: change.path, resolvedPath, before, after: clone(entry) })\n continue\n }\n // insert INTO an array addressed by an element step is ambiguous; the\n // array itself is the target ('...sections', not '...sections[2]').\n errors.push({\n path: `${at}.path`,\n code: 'invalid-path',\n message: `insert targets the array itself — use \"${pathText(walked)}\" with { index: ${Math.max(position, 0)} }`,\n })\n continue\n }\n\n // Object container.\n const key = (step as { key: string }).key\n const before = key in container ? clone(container[key]) : undefined\n\n if (change.op === 'set') {\n container[key] = clone(change.value)\n applied.push({ op: 'set', path: change.path, resolvedPath, before, after: clone(change.value) })\n continue\n }\n if (change.op === 'remove') {\n if (!(key in container)) {\n errors.push({\n path: change.path,\n code: 'unknown-path',\n message: `${resolvedPath} does not exist`,\n valid: Object.keys(container).sort(),\n })\n continue\n }\n delete container[key]\n applied.push({ op: 'remove', path: change.path, resolvedPath, before })\n continue\n }\n // insert / move target arrays.\n const target = container[key]\n if (!Array.isArray(target)) {\n errors.push({\n path: change.path,\n code: 'not-an-array',\n message: `${resolvedPath} is ${target === undefined ? 'not present' : `a ${typeof target}`}, and ${change.op} targets an array`,\n })\n continue\n }\n if (change.op === 'move') {\n errors.push({\n path: `${at}.path`,\n code: 'invalid-path',\n message: `move targets an element — address it as \"${resolvedPath}[0]\" or \"${resolvedPath}[#id]\"`,\n })\n continue\n }\n const to = change.index ?? target.length\n if (!Number.isInteger(to) || to < 0 || to > target.length) {\n errors.push({\n path: `${at}.index`,\n code: 'index-out-of-range',\n message: `insert index must be 0..${target.length}, got ${String(change.index)}`,\n })\n continue\n }\n target.splice(to, 0, clone(change.value))\n applied.push({\n op: 'insert',\n path: change.path,\n resolvedPath: `${resolvedPath}[${to}]`,\n after: clone(change.value),\n })\n }\n\n const validation = validateStore(draft)\n const failed = errors.length > 0 || !validation.ok\n const rejected = failed && onInvalid === 'reject'\n\n return {\n ok: !failed,\n doc: (rejected ? original : draft) as unknown as StoreDocument,\n applied: rejected ? [] : applied,\n errors: [...errors, ...validation.errors],\n validation,\n }\n}\n","import {\n BLOCK_SETTING_TYPES,\n ENTITY_FIELD_TYPES,\n describeBlocks,\n describeEntities,\n describeExtensionPoints,\n describeLoaders,\n handleRegistry,\n} from '@fayz-ai/core'\nimport type {\n BlockDescriptor,\n EntityDescriptor,\n ExtensionPointDescriptor,\n JsonSchema,\n LoaderDescriptor,\n RegistryEntryDescriptor,\n} from '@fayz-ai/core'\nimport { RULE_OPERATORS, listRuleAttributes } from '@fayz-ai/shop/rules'\nimport type { RuleAttribute } from '@fayz-ai/shop/rules'\nimport { fayzDeprecationPolicy, listDeprecations } from '@fayz-ai/sdk/deprecations'\nimport type { FayzDeprecation, FayzDeprecationPolicy } from '@fayz-ai/sdk/deprecations'\nimport { describeCodemods, scanStoreDeprecations } from './upgrade'\nimport type { StoreCodemodDescriptor, StoreDeprecationFinding } from './upgrade'\nimport { registerStorefrontBlocks } from '../blocks/registry'\nimport { registerStorefrontExtensionPoints } from '../extend/extension-points'\nimport { STOREFRONT_COMPONENT_KEYS } from '../extend/component-contracts'\nimport { STOREFRONT_SLOTS } from '../extend/slots'\nimport type { SlotDescriptor } from '../extend/slots'\nimport { DEFAULT_WRITABLE_SECTIONS, STORE_CHANGE_OPS } from './change'\nimport { STORE_SECTIONS, STORE_SECTION_NAMES, sectionToJsonSchema, isRecord } from './sections'\nimport type { StoreDocument, StoreSectionName } from './sections'\nimport { validateStore, STOREFRONT_PAGE_KINDS } from './validate'\nimport type { StoreValidationReport } from './validate'\n\n// ---------------------------------------------------------------------------\n// describeStore — what a store IS and what it CAN be, as one machine-readable\n// value. This is the catalog an agent reads before generating or editing a\n// document: the registries with their schemas, the section schemas, the page\n// kinds, the slot inventory, the registered handles, the setting vocabulary.\n// Serializable on purpose — it has to survive a prompt and a wire.\n// ---------------------------------------------------------------------------\n\n/**\n * What this store's backend can do.\n *\n * Designed to become backend-aware: today every store is Fayz-backed, so the\n * values are constants. When a second backend lands (spine I11 — e.g. a\n * Shopify-backed store whose catalog is mirrored into canonical tables), this\n * shape is derived from the backend provider instead: a Shopify-backed store\n * keeps `catalogMirror` but cannot run our rule engine, so `ruleEngine`\n * flips false while the document stays identical. Consumers must branch on\n * these flags, never on the provider name.\n */\nexport interface StoreCapabilities {\n /** Backend family serving the store. */\n backend: string\n /** Commerce modes the storefront shell can run. */\n commerceModes: readonly string[]\n /** Reads come from the canonical Fayz catalog (mirrored for ERP-backed stores). */\n catalogMirror: boolean\n /** Cart + checkout run against the Fayz order path. */\n checkout: boolean\n /** Declared data loaders resolved once per page (spine M3). */\n loaders: boolean\n /** Rule engine (spine M6): promotions as data, evaluated by the reference\n * evaluator (mock) or shop_compute_promotion_actions (Supabase). True for\n * Fayz-backed stores; a backend that cannot run our rules (e.g. a\n * Shopify-mirrored store) flips this false and consumers must branch on\n * the flag, never the provider name. */\n ruleEngine: boolean\n /** Custom entity declarations (spine M4): defineEntity + entity.* loaders +\n * generic storage. True for Fayz-backed stores (both providers implement\n * the entity surface); a future backend without it flips this false and\n * consumers must branch on the flag, never the provider name. */\n customEntities: boolean\n /** Extension point registry (spine M7): declared seams with enforced\n * input+output schemas, many dependency-ordered handlers, and exactly one\n * nullable beforePlaceOrder escape valve. */\n extensionPoints: boolean\n}\n\nexport interface StoreSectionDescription {\n description: string\n /** Section versions this SDK understands, ascending. */\n versions: readonly number[]\n /** JSON Schema for the section, compiled from the same spec the validator runs. */\n schema: JsonSchema\n}\n\n/** Summary of one concrete document, when one is passed in. */\n/** The I10 contract, as data the agent reads before authoring (spine M10):\n * the policy, every deprecation, and the codemod that answers each one. */\nexport interface StoreContractDescription {\n policy: FayzDeprecationPolicy\n deprecations: FayzDeprecation[]\n codemods: StoreCodemodDescriptor[]\n}\n\nexport interface StoreDocumentSummary {\n name?: string\n /** Sections present in the document. */\n sections: string[]\n /** Block types the document places (pages, home, slots), sorted, deduped. */\n blocksUsed: string[]\n /** Loader ids the document's data declarations reference, sorted, deduped.\n * Meta-level needs of placed blocks are not repeated here — they are the\n * block's own contract, readable from the blocks registry. */\n loadersUsed: string[]\n /** Handle names the document references, sorted, deduped. */\n handlesUsed: string[]\n /** What in THIS store is deprecated, and what replaces it (I10 + I2). */\n deprecations: StoreDeprecationFinding[]\n validation: StoreValidationReport\n}\n\n/**\n * One of the author-facing abilities (spine §3 L5).\n *\n * Enumerating them is the point. WooCommerce's own conclusion about agent\n * surfaces — quoted in the spine — is that the surface must be \"purpose-built\n * domain abilities … instead of automatically projecting every REST-shaped\n * operation\", and an ability an agent cannot discover is an ability it will not\n * use. There are four, they are listed here with their input schemas, and the\n * list is derived from nothing: if a fifth is added it must be added here.\n */\nexport interface StoreAbilityDescriptor {\n name: 'describeStore' | 'validateStore' | 'renderStore' | 'applyChange'\n /** Where it is imported from. */\n module: string\n /** Does it change the document? */\n writes: boolean\n description: string\n /** JSON Schema of the options/arguments beyond the document itself. */\n input: JsonSchema\n /** What the caller gets back, in prose — the shapes are exported types. */\n output: string\n}\n\nexport interface StoreDescription {\n version: 1\n capabilities: StoreCapabilities\n /** The four abilities, with their input schemas (spine L5). */\n abilities: readonly StoreAbilityDescriptor[]\n sections: Record<StoreSectionName, StoreSectionDescription>\n /** The deprecation contract (spine M10, I10). Enumerable on purpose: an\n * agent that cannot read what is going away will keep generating it. */\n contract: StoreContractDescription\n registries: {\n blocks: BlockDescriptor[]\n loaders: LoaderDescriptor[]\n entities: EntityDescriptor[]\n handles: RegistryEntryDescriptor[]\n /** The rule attribute vocabulary AS ROWS (I9) — the same rows the admin\n * promotion form renders from and validateStore checks against. */\n ruleAttributes: RuleAttribute[]\n /** Every extension point with its input/output schemas AND registered\n * handlers (spine M7) — the enumerable behaviour surface. */\n extensionPoints: ExtensionPointDescriptor[]\n }\n /** The closed operator set rules may use. */\n ruleOperators: readonly string[]\n pageKinds: readonly string[]\n slots: readonly SlotDescriptor[]\n componentSlots: readonly string[]\n settingTypes: readonly string[]\n /** The field-type vocabulary defineEntity accepts (spine M4). */\n entityFieldTypes: readonly string[]\n document?: StoreDocumentSummary\n}\n\n/** The four abilities (spine L5), as data the agent can read before calling. */\nconst STORE_ABILITIES: readonly StoreAbilityDescriptor[] = [\n {\n name: 'describeStore',\n module: '@fayz-ai/storefront',\n writes: false,\n description:\n 'What a store IS and what it CAN be: section schemas, every registry with its JSON Schema, page kinds, slots, handles, the rule vocabulary, the extension points — plus a summary of a document when one is passed. Read this before authoring.',\n input: {\n type: 'object',\n properties: { document: { type: 'object', description: 'Optional Store Document to summarize against the surface.' } },\n additionalProperties: false,\n },\n output: 'StoreDescription',\n },\n {\n name: 'validateStore',\n module: '@fayz-ai/storefront',\n writes: false,\n description:\n 'The gate. Every unknown id — section, field, page kind, block type, block setting, slot, handle, loader, rule attribute — is a hard error that names the valid set (I2). Correct on `errors[].valid`, not on the prose.',\n input: { type: 'object', properties: {}, additionalProperties: false },\n output: 'StoreValidationReport { ok, errors: [{ path, code, message, valid? }] }',\n },\n {\n name: 'renderStore',\n module: '@fayz-ai/storefront/render',\n writes: false,\n description:\n 'Render one route of the document to HTML, headless, and report what came out: title, visible text, heading outline, every block that rendered, every loader that ran and what it returned, and every diagnostic the page logged. This is how an author sees what it authored.',\n input: {\n type: 'object',\n properties: {\n path: { type: 'string', description: \"Route to render ('/', '/catalog', '/product/:slug' resolved, '/biography').\" },\n provider: {\n type: 'string',\n enum: ['config', 'document'],\n description:\n \"'config' uses the provider the store implies; 'document' uses a mock seeded from the document's catalog section — deterministic and network-free.\",\n },\n onError: { type: 'string', enum: ['throw', 'report'] },\n html: { type: 'string', enum: ['document', 'fragment'] },\n maxPasses: { type: 'number' },\n stylesheets: { type: 'array', items: { type: 'string' } },\n lang: { type: 'string' },\n },\n additionalProperties: false,\n },\n output: 'StoreRenderResult { ok, title, found, html, text, outline, blocks, links, data, diagnostics, validation }',\n },\n {\n name: 'applyChange',\n module: '@fayz-ai/storefront',\n writes: true,\n description:\n 'The only write. An ordered batch of typed operations against document paths — the same paths validateStore reports, plus a `blocks[#id]` form. Transactional: a batch whose result would not validate is refused whole, with the reasons.',\n input: {\n type: 'object',\n properties: {\n changes: {\n type: 'array',\n items: {\n type: 'object',\n properties: {\n op: { type: 'string', enum: [...STORE_CHANGE_OPS] },\n path: {\n type: 'string',\n description: \"Dotted document path, e.g. 'presentation.pages.home.blocks[#hero].props.title'.\",\n },\n value: { description: 'set / insert: the JSON value to write.' },\n index: { type: 'number', description: 'insert / move: destination index.' },\n },\n required: ['op', 'path'],\n additionalProperties: false,\n },\n },\n sections: {\n type: 'array',\n items: { type: 'string', enum: [...STORE_SECTION_NAMES] },\n description: `Sections this caller may write. Default: ${DEFAULT_WRITABLE_SECTIONS.join(', ')}.`,\n },\n onInvalid: { type: 'string', enum: ['reject', 'allow'] },\n },\n required: ['changes'],\n additionalProperties: false,\n },\n output: 'StoreChangeResult { ok, doc, applied, errors, validation }',\n },\n]\n\nfunction collectBlockTypes(out: Set<string>, loaders: Set<string>, blocks: unknown): void {\n if (!Array.isArray(blocks)) return\n for (const entry of blocks) {\n if (!isRecord(entry)) continue\n if (typeof entry.type === 'string') out.add(entry.type)\n if (isRecord(entry.data)) {\n for (const need of Object.values(entry.data)) {\n if (isRecord(need) && typeof need.loader === 'string') loaders.add(need.loader)\n }\n }\n if (Array.isArray(entry.children)) collectBlockTypes(out, loaders, entry.children)\n }\n}\n\nfunction summarizeDocument(doc: StoreDocument | Record<string, unknown>): StoreDocumentSummary {\n const record = doc as Record<string, unknown>\n const store = isRecord(record.store) ? record.store : undefined\n const presentation = isRecord(record.presentation) ? record.presentation : undefined\n const code = isRecord(record.code) ? record.code : undefined\n\n const blocks = new Set<string>()\n const loaders = new Set<string>()\n if (isRecord(presentation?.home)) collectBlockTypes(blocks, loaders, presentation.home.sections)\n if (isRecord(presentation?.pages)) {\n for (const [kind, page] of Object.entries(presentation.pages)) {\n if (!isRecord(page)) continue\n // pages.content is a MAP of editorial pages, one level deeper.\n if (kind === 'content') {\n for (const contentPage of Object.values(page)) {\n if (isRecord(contentPage)) collectBlockTypes(blocks, loaders, contentPage.blocks)\n }\n continue\n }\n collectBlockTypes(blocks, loaders, page.blocks)\n }\n }\n if (isRecord(presentation?.slots)) {\n for (const area of Object.values(presentation.slots)) {\n if (!isRecord(area)) continue\n for (const slotBlocks of Object.values(area)) collectBlockTypes(blocks, loaders, slotBlocks)\n }\n }\n\n const handles = new Set<string>()\n if (code) {\n for (const field of ['logo', 'provider', 'auth', 'footerCredit']) {\n if (typeof code[field] === 'string') handles.add(code[field] as string)\n }\n if (isRecord(code.components)) {\n for (const handle of Object.values(code.components)) {\n if (typeof handle === 'string') handles.add(handle)\n }\n }\n if (Array.isArray(code.routes)) {\n for (const route of code.routes) {\n if (isRecord(route) && typeof route.component === 'string') handles.add(route.component)\n }\n }\n }\n\n return {\n name: typeof store?.name === 'string' ? store.name : undefined,\n sections: Object.keys(record).filter((key) => key !== '$kind'),\n blocksUsed: [...blocks].sort(),\n loadersUsed: [...loaders].sort(),\n handlesUsed: [...handles].sort(),\n deprecations: scanStoreDeprecations(doc),\n validation: validateStore(doc),\n }\n}\n\n/**\n * The machine-readable description of the storefront authoring surface, plus —\n * when a document is passed — a summary of that document against it.\n */\nexport function describeStore(doc?: StoreDocument | Record<string, unknown>): StoreDescription {\n registerStorefrontBlocks()\n registerStorefrontExtensionPoints()\n\n const sections = {} as Record<StoreSectionName, StoreSectionDescription>\n for (const name of STORE_SECTION_NAMES) {\n sections[name] = {\n description: STORE_SECTIONS[name].description,\n versions: [...STORE_SECTIONS[name].versions],\n schema: sectionToJsonSchema(name),\n }\n }\n\n const description: StoreDescription = {\n version: 1,\n capabilities: {\n backend: 'fayz',\n commerceModes: ['checkout', 'catalog', 'enquiry'],\n catalogMirror: true,\n checkout: true,\n loaders: true,\n ruleEngine: true,\n customEntities: true,\n extensionPoints: true,\n },\n abilities: STORE_ABILITIES,\n sections,\n contract: {\n policy: fayzDeprecationPolicy,\n deprecations: listDeprecations(),\n codemods: describeCodemods(),\n },\n registries: {\n blocks: describeBlocks({ includeExperimental: true }),\n loaders: describeLoaders(),\n entities: describeEntities(),\n handles: handleRegistry.describe(),\n ruleAttributes: listRuleAttributes(),\n extensionPoints: describeExtensionPoints(),\n },\n ruleOperators: RULE_OPERATORS,\n pageKinds: [...STOREFRONT_PAGE_KINDS],\n slots: STOREFRONT_SLOTS,\n componentSlots: STOREFRONT_COMPONENT_KEYS,\n settingTypes: BLOCK_SETTING_TYPES,\n entityFieldTypes: ENTITY_FIELD_TYPES,\n }\n\n if (doc !== undefined) description.document = summarizeDocument(doc)\n return description\n}\n","import { useStorefrontConfig } from '../document/config'\nimport { useCatalogStore } from '../stores/catalog.store'\n\n/** The catalog store, plus the config a listing page needs to render a link. */\nexport function useCatalog() {\n const config = useStorefrontConfig()\n const catalog = useCatalogStore()\n return { ...catalog, catalogPath: config.catalogPath, config }\n}\n","import { useStorefrontConfig } from '../document/config'\n\n/** The resolved storefront config — defaults applied, every field present. */\nexport function useStorefront() {\n return useStorefrontConfig()\n}\n","import { useStorefrontConfig } from '../document/config'\nimport { formatMoney } from '../lib/format'\n\nexport interface StorefrontRegion {\n currency: string\n locale: string\n /** Money formatted for this store, so a caller never re-derives the pair. */\n format: (value: number) => string\n}\n\n/**\n * Currency and locale, with the formatter already bound to them.\n *\n * Returning the bound formatter is the point: `formatMoney` defaults to BRL and\n * pt-BR, so every call site that passes only a number silently formats a\n * non-Brazilian store's prices as reais.\n */\nexport function useRegion(): StorefrontRegion {\n const { currency, locale } = useStorefrontConfig()\n return { currency, locale, format: (value: number) => formatMoney(value, currency, locale) }\n}\n","import { useStorefrontConfig } from '../document/config'\n\nexport type PolicyKind = 'privacy' | 'terms' | 'returns'\n\nexport interface StorefrontPolicy {\n kind: PolicyKind\n title: string\n path: string\n /** The store's own text, or null when it has not published this one yet. */\n content: string | null\n published: boolean\n}\n\nconst POLICIES: ReadonlyArray<{ kind: PolicyKind; title: string; path: string }> = [\n { kind: 'privacy', title: 'Política de Privacidade', path: '/privacy' },\n { kind: 'terms', title: 'Termos de Uso', path: '/terms' },\n { kind: 'returns', title: 'Trocas e Devoluções', path: '/refunds' },\n]\n\nexport interface UsePolicies {\n policies: StorefrontPolicy[]\n /** True when every policy has text — what a payment processor asks for at go-live. */\n complete: boolean\n contactEmail?: string\n}\n\n/**\n * The institutional pages, as data.\n *\n * All three are always listed, published or not: the routes and footer links\n * have to exist before the store writes its policies, because a 404 where a\n * processor expects a returns policy blocks go-live. `published` is what a\n * checklist reads; the page itself renders a placeholder.\n */\nexport function usePolicies(): UsePolicies {\n const config = useStorefrontConfig()\n const policies = POLICIES.map((policy) => {\n const content = config.legal?.[policy.kind]?.trim() || null\n return { ...policy, content, published: content !== null }\n })\n return {\n policies,\n complete: policies.every((policy) => policy.published),\n contactEmail: config.footer?.contact?.email,\n }\n}\n","import { useCartStore } from '../stores/cart.store'\n\n/** The cart: lines, totals and the drawer. */\nexport function useCart() {\n return useCartStore()\n}\n","import React from 'react'\nimport type { PaymentMethodKind, ShippingAddressInput } from '@fayz-ai/shop/types'\nimport { useStorefrontConfig } from '../document/config'\nimport {\n useCartStore,\n selectCount,\n selectSubtotal,\n selectDiscountTotal,\n selectShipping,\n selectTotal,\n} from '../stores/cart.store'\nimport { useSessionStore } from '../stores/session.store'\nimport { placeStorefrontOrder } from '../workflows/checkout'\nimport type {\n PlaceStorefrontOrderResult,\n StorefrontCheckoutAddress,\n StorefrontCheckoutCustomer,\n} from '../workflows/checkout'\n\nexport interface CheckoutTotals {\n count: number\n subtotal: number\n discountTotal: number\n shipping: number\n total: number\n}\n\nexport interface CheckoutSubmission {\n customer: StorefrontCheckoutCustomer\n address?: StorefrontCheckoutAddress\n shippingAddress?: ShippingAddressInput\n paymentMethod?: PaymentMethodKind\n markPaid?: boolean\n}\n\nexport interface UseCheckout {\n /** False when the store sells by catalog or enquiry — there is no checkout to render. */\n enabled: boolean\n /** True when the cart has nothing in it: the reason an enabled checkout still cannot proceed. */\n empty: boolean\n totals: CheckoutTotals\n placing: boolean\n error: string | null\n placeOrder: (input: CheckoutSubmission) => Promise<PlaceStorefrontOrderResult | null>\n}\n\n/**\n * The checkout, with the cart, session and config already bound.\n *\n * `placeOrder` takes only what the shopper typed. Everything the server needs\n * to be told about — lines, discount, totals, the customer session — is read\n * here from the stores, because a caller assembling that payload is a caller\n * that can assemble it wrongly, and the prices in it are exactly the numbers a\n * client must not be trusted with. `shop_place_order` recomputes from the\n * catalog regardless; this keeps the two from disagreeing on screen.\n *\n * `placing` is guarded rather than advisory: a double-submitted checkout is two\n * orders and two charges, and the button being disabled is not a guarantee.\n */\nexport function useCheckout(): UseCheckout {\n const config = useStorefrontConfig()\n const cart = useCartStore()\n const session = useSessionStore()\n const [placing, setPlacing] = React.useState(false)\n const [error, setError] = React.useState<string | null>(null)\n const inflight = React.useRef(false)\n\n const lines = cart.lines\n const totals: CheckoutTotals = {\n count: selectCount({ lines }),\n subtotal: selectSubtotal({ lines }),\n discountTotal: selectDiscountTotal({ lines, discountPercent: cart.discountPercent }),\n shipping: selectShipping({ lines }, config),\n total: selectTotal({ lines, discountPercent: cart.discountPercent }, config),\n }\n\n const placeOrder = React.useCallback(\n async (input: CheckoutSubmission) => {\n if (inflight.current) return null\n inflight.current = true\n setPlacing(true)\n setError(null)\n try {\n return await placeStorefrontOrder({\n config,\n cart: {\n lines: useCartStore.getState().lines,\n discountCode: useCartStore.getState().discountCode,\n discountPercent: useCartStore.getState().discountPercent,\n },\n session: { customerId: session.customerId, email: session.email },\n ...input,\n })\n } catch (err: unknown) {\n setError(err instanceof Error ? err.message : String(err))\n return null\n } finally {\n inflight.current = false\n setPlacing(false)\n }\n },\n [config, session.customerId, session.email],\n )\n\n return {\n enabled: config.features.checkout,\n empty: lines.length === 0,\n totals,\n placing,\n error,\n placeOrder,\n }\n}\n","import type { PaymentMethodKind } from '@fayz-ai/shop/types'\nimport { useStorefrontConfig } from '../document/config'\n\nexport interface UsePaymentMethods {\n /** The kinds this store offers, in the order it declared them. */\n methods: readonly PaymentMethodKind[]\n /** The default selection: the first declared method, or null when none are. */\n preferred: PaymentMethodKind | null\n supports: (method: PaymentMethodKind) => boolean\n}\n\n/**\n * Which payment methods the store offers.\n *\n * Deliberately provider-agnostic. A method is a declared KIND (`pix`,\n * `credit_card`, `cash`) — never a Stripe or Mercado Pago object — because the\n * canonical rule is that no storefront code imports a provider client. Which\n * gateway settles a `pix` is the backend's business, and swapping it must not\n * change a line here.\n */\nexport function usePaymentMethods(): UsePaymentMethods {\n const { payments } = useStorefrontConfig()\n const methods = payments.methods\n return {\n methods,\n preferred: methods[0] ?? null,\n supports: (method: PaymentMethodKind) => methods.includes(method),\n }\n}\n","import type { ShippingQuoteOption } from '@fayz-ai/shop/types'\nimport { useStorefrontConfig } from '../document/config'\nimport { useCartStore, selectSubtotal, selectShipping } from '../stores/cart.store'\nimport { useDeliveryStore } from '../stores/delivery.store'\nimport type { DeliveryStatus } from '../stores/delivery.store'\n\nexport interface UseShipping {\n postalCode: string\n status: DeliveryStatus\n error: string | null\n options: ShippingQuoteOption[]\n selectedZoneId: string | null\n /** What the current cart would be charged, quote or flat rate. */\n rate: number\n /** True when the flat-rate free-above threshold is already met. */\n free: boolean\n /** How much more the shopper must add to ship free, or null when there is no threshold. */\n amountToFreeShipping: number | null\n quote: (postalCode: string) => Promise<void>\n selectZone: (zoneId: string) => void\n clear: () => void\n}\n\n/**\n * What delivery costs for the cart as it stands.\n *\n * The quote is asked for against the CURRENT subtotal and is never persisted —\n * a price restored from localStorage is a price the shopper can edit with\n * devtools. The order is charged from `shop_place_order`, which recomputes from\n * the same zones and ignores anything the client sends; this hook exists to\n * show a number, not to decide one.\n */\nexport function useShipping(): UseShipping {\n const config = useStorefrontConfig()\n const lines = useCartStore((state) => state.lines)\n const delivery = useDeliveryStore()\n\n const subtotal = selectSubtotal({ lines })\n const rate = selectShipping({ lines }, config)\n const threshold = config.shipping.freeAbove ?? null\n\n return {\n postalCode: delivery.postalCode,\n status: delivery.status,\n error: delivery.error,\n options: delivery.options,\n selectedZoneId: delivery.selectedZoneId,\n rate,\n free: rate === 0 && lines.length > 0,\n amountToFreeShipping:\n threshold === null || subtotal >= threshold ? null : Math.max(0, threshold - subtotal),\n quote: (postalCode: string) => delivery.resolve(postalCode, subtotal),\n selectZone: delivery.selectZone,\n clear: delivery.clear,\n }\n}\n","import React from 'react'\nimport { formatPostalCode, lookupPostalCode, normalizePostalCode } from '@fayz-ai/core'\nimport type { PostalAddress } from '@fayz-ai/core'\n\nexport type AddressLookupStatus = 'idle' | 'loading' | 'found' | 'not-found' | 'error'\n\nexport interface UseAddress {\n postalCode: string\n /** The same code formatted for display (`01311-000`). */\n display: string\n address: PostalAddress | null\n status: AddressLookupStatus\n error: string | null\n /** Set the code and look it up once it is complete. Partial input never calls out. */\n setPostalCode: (value: string) => void\n clear: () => void\n}\n\nconst COMPLETE = 8\n\n/**\n * A postal code, and the address it resolves to.\n *\n * The lookup fires on the code being COMPLETE rather than on every keystroke —\n * a debounce would still send `0`, `01`, `013`… and each is a request that can\n * only fail. The last completed lookup wins: a shopper who corrects a typo mid\n * flight must not have the stale response overwrite the new one.\n *\n * This is the address half of checkout, separated from `useShipping` on purpose:\n * a store that does not ship still asks for a billing address.\n */\nexport function useAddress(initial = ''): UseAddress {\n const [postalCode, setValue] = React.useState(normalizePostalCode(initial))\n const [address, setAddress] = React.useState<PostalAddress | null>(null)\n const [status, setStatus] = React.useState<AddressLookupStatus>('idle')\n const [error, setError] = React.useState<string | null>(null)\n const inflight = React.useRef(0)\n\n const setPostalCode = React.useCallback((value: string) => {\n const normalized = normalizePostalCode(value)\n setValue(normalized)\n\n if (normalized.length < COMPLETE) {\n setAddress(null)\n setStatus('idle')\n setError(null)\n return\n }\n\n const ticket = ++inflight.current\n setStatus('loading')\n setError(null)\n void lookupPostalCode(normalized)\n .then((found) => {\n if (ticket !== inflight.current) return\n setAddress(found)\n setStatus(found ? 'found' : 'not-found')\n })\n .catch((err: unknown) => {\n if (ticket !== inflight.current) return\n setAddress(null)\n setStatus('error')\n setError(err instanceof Error ? err.message : String(err))\n })\n }, [])\n\n const clear = React.useCallback(() => {\n inflight.current++\n setValue('')\n setAddress(null)\n setStatus('idle')\n setError(null)\n }, [])\n\n return {\n postalCode,\n display: formatPostalCode(postalCode),\n address,\n status,\n error,\n setPostalCode,\n clear,\n }\n}\n","import React from 'react'\nimport { getShopProvider } from '@fayz-ai/shop/runtime'\nimport type { Order } from '@fayz-ai/shop/types'\n\nexport interface UseOrder {\n order: Order | null\n loading: boolean\n error: string | null\n reload: () => void\n}\n\n/**\n * One order by id — the confirmation page, and the link a shopper is emailed.\n *\n * A null id is a legitimate state (the route matched before the id resolved),\n * not an error: it settles to `loading: false` with no order rather than\n * reporting a failure the shopper cannot act on. The last request wins, so a\n * fast reload cannot leave the previous order on screen.\n */\nexport function useOrder(orderId: string | null | undefined): UseOrder {\n const [order, setOrder] = React.useState<Order | null>(null)\n const [loading, setLoading] = React.useState(Boolean(orderId))\n const [error, setError] = React.useState<string | null>(null)\n const [nonce, setNonce] = React.useState(0)\n\n React.useEffect(() => {\n if (!orderId) {\n setOrder(null)\n setLoading(false)\n setError(null)\n return\n }\n\n let current = true\n setLoading(true)\n setError(null)\n\n void getShopProvider()\n .getOrder(orderId)\n .then((found) => {\n if (!current) return\n setOrder(found ?? null)\n setLoading(false)\n })\n .catch((err: unknown) => {\n if (!current) return\n setOrder(null)\n setError(err instanceof Error ? err.message : String(err))\n setLoading(false)\n })\n\n return () => {\n current = false\n }\n }, [orderId, nonce])\n\n return { order, loading, error, reload: () => setNonce((n) => n + 1) }\n}\n","import { BLOCK_PATH_ATTRIBUTE, BLOCK_TYPE_ATTRIBUTE, setBlockEditorMode } from '@fayz-ai/core'\n\n// The editor bridge — a storefront running inside an editor's iframe.\n// ACTIVATE/DEACTIVATE in; READY/PICKED/CANCELLED/NAVIGATION_CHANGE out.\n//\n// A pick answers with `{ path, type }` rather than a CSS selector: the page was\n// rendered from a document, so the path is simply true, and the parent hands it\n// straight to describeStore for the settings schema and to applyChange to save.\n//\n// Allowed origins are declared by the CALLER, never announced by the sender —\n// an iframe's parent is chosen by whoever embeds the page, so trusting the\n// announcement hands an element picker to any hostile embedder. Outbound\n// messages go to the activating origin, never '*', and nothing is posted before\n// one has activated.\n\nexport interface EditorBridgeOptions {\n /**\n * Origins allowed to drive the picker. An activation from anywhere else is\n * ignored. Required: there is no safe default, because the parent of an\n * iframe is chosen by whoever embedded it.\n */\n allowedOrigins: readonly string[]\n /** Test seam. Defaults to the ambient window. */\n target?: Window\n}\n\nexport interface PickedBlock {\n /** Dotted document path — what applyChange accepts and validateStore reports. */\n path: string\n /** The block's registered type, so the parent can look up its schema. */\n type: string\n /** Bounding rect of the block's first painted child, for the parent's overlay. */\n rect?: { top: number; left: number; width: number; height: number }\n}\n\nexport const EDITOR_MESSAGES = {\n activate: 'ACTIVATE_ELEMENT_PICKER',\n deactivate: 'DEACTIVATE_ELEMENT_PICKER',\n ready: 'ELEMENT_PICKER_READY',\n picked: 'ELEMENT_PICKED',\n cancelled: 'ELEMENT_PICKER_CANCELLED',\n navigation: 'NAVIGATION_CHANGE',\n} as const\n\n/**\n * The nearest ancestor that is a block, and the element that actually paints.\n *\n * The stamp lives on a `display: contents` wrapper, which has no box of its\n * own — `getBoundingClientRect()` on it returns zeros. So the rect comes from\n * its first element child, which is the block's real root.\n */\nexport function blockAt(element: Element | null): { path: string; type: string; node: Element } | null {\n let current: Element | null = element\n while (current) {\n const path = current.getAttribute?.(BLOCK_PATH_ATTRIBUTE)\n if (path) {\n const painted = current.firstElementChild ?? current\n return { path, type: current.getAttribute(BLOCK_TYPE_ATTRIBUTE) ?? '', node: painted }\n }\n current = current.parentElement\n }\n return null\n}\n\nfunction rectOf(element: Element): PickedBlock['rect'] {\n const r = element.getBoundingClientRect?.()\n if (!r) return undefined\n return { top: r.top, left: r.left, width: r.width, height: r.height }\n}\n\n/**\n * Wire the storefront to an editor parent. Returns a teardown.\n *\n * Inert when the page is not framed: a storefront served to a shopper has\n * `window.parent === window`, nothing is registered, and editor mode stays off.\n */\nexport function connectEditorBridge(options: EditorBridgeOptions): () => void {\n const win = options.target ?? (typeof window === 'undefined' ? undefined : window)\n if (!win || win.parent === win) return () => {}\n\n const allowed = new Set(options.allowedOrigins)\n let parentOrigin: string | null = null\n let active = false\n let hovered: { path: string; type: string; node: Element } | null = null\n\n const post = (message: Record<string, unknown>) => {\n if (!parentOrigin) return\n win.parent.postMessage(message, parentOrigin)\n }\n\n const onMove = (event: MouseEvent) => {\n if (!active) return\n hovered = blockAt(event.target as Element)\n }\n\n const onClick = (event: MouseEvent) => {\n if (!active) return\n // A picker click must never also follow the link it landed on.\n event.preventDefault()\n event.stopPropagation()\n const hit = hovered ?? blockAt(event.target as Element)\n if (!hit) return\n const picked: PickedBlock = { path: hit.path, type: hit.type, rect: rectOf(hit.node) }\n post({ type: EDITOR_MESSAGES.picked, data: picked })\n stop()\n }\n\n const onKeyDown = (event: KeyboardEvent) => {\n if (!active || event.key !== 'Escape') return\n event.preventDefault()\n post({ type: EDITOR_MESSAGES.cancelled })\n stop()\n }\n\n function start() {\n if (active) return\n active = true\n setBlockEditorMode(true)\n win!.document.addEventListener('mousemove', onMove, true)\n win!.document.addEventListener('click', onClick, true)\n win!.document.addEventListener('keydown', onKeyDown, true)\n win!.document.body.style.cursor = 'crosshair'\n post({ type: EDITOR_MESSAGES.ready })\n }\n\n function stop() {\n if (!active) return\n active = false\n hovered = null\n win!.document.removeEventListener('mousemove', onMove, true)\n win!.document.removeEventListener('click', onClick, true)\n win!.document.removeEventListener('keydown', onKeyDown, true)\n win!.document.body.style.cursor = ''\n }\n\n const onMessage = (event: MessageEvent) => {\n if (event.source !== win.parent) return\n // The origin must be declared by US, not announced by the sender — an\n // attacker embedding the store controls both `event.data.parentOrigin` and\n // the frame, so trusting the announcement trusts the attacker.\n if (!allowed.has(event.origin)) return\n parentOrigin = event.origin\n\n const kind = (event.data as { type?: string } | null)?.type\n if (kind === EDITOR_MESSAGES.activate) start()\n else if (kind === EDITOR_MESSAGES.deactivate) stop()\n }\n\n win.addEventListener('message', onMessage)\n return () => {\n stop()\n setBlockEditorMode(false)\n win.removeEventListener('message', onMessage)\n }\n}\n\n/**\n * Tell the parent the route changed, so its URL bar follows the iframe.\n *\n * Silent until an allowed parent has activated the bridge — the path is not\n * sensitive, but broadcasting to '*' from every storefront is a habit worth\n * not forming.\n */\nexport function reportNavigation(path: string, parentOrigin: string | null, target?: Window): void {\n const win = target ?? (typeof window === 'undefined' ? undefined : window)\n if (!win || win.parent === win || !parentOrigin) return\n win.parent.postMessage({ type: EDITOR_MESSAGES.navigation, path }, parentOrigin)\n}\n","import { describeBlocks } from '@fayz-ai/core'\nimport type { BlockDescriptor } from '@fayz-ai/core'\nimport { parseStorePath } from '../document/change'\nimport { registerStorefrontBlocks } from './registry'\nimport { BLOCK_STRUCTURAL_KEYS, isNestedBlockRef } from './page-blocks'\nimport type { StoreDocument } from '../document/sections'\n\n// From a picked document path to everything a form generator needs: which block\n// it is, what it currently says, and the SETTINGS SCHEMA it declared. A form\n// built from that schema cannot offer a setting the block does not have and\n// updates itself when the block does.\n//\n// Deliberately NOT a renderer — returning data keeps the SDK out of any one\n// editor's design system.\n\nexport interface BlockAtPath {\n /** The path as given, echoed so a caller can key state by it. */\n path: string\n /** The block's registered type. */\n type: string\n /**\n * Where this block's settings live: `<path>.props` for the nested form,\n * `<path>` itself for the flat one. Both forms MIX inside one array, so a\n * caller appending `.props` by hand is right about some blocks and silently\n * wrong about the rest. Pass this to `settingChange` and it cannot happen.\n */\n settingsPath: string\n /** Current values, whichever form they took — the form's initial state. */\n props: Record<string, unknown>\n /** Empty when the block declares no settings, which is itself the answer. */\n settings: BlockDescriptor['settings']\n /** For a caller that wants labels, help text or presets. */\n descriptor: BlockDescriptor | null\n}\n\nexport type BlockAtPathError =\n | { code: 'unparseable-path'; message: string }\n | { code: 'no-block-at-path'; message: string }\n | { code: 'unknown-block'; message: string; valid: string[] }\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/** Walk a parsed path, resolving `[#id]` steps against `id` fields. */\nfunction walk(document: StoreDocument | Record<string, unknown>, path: string): unknown {\n const steps = parseStorePath(path)\n if (!steps) return undefined\n let cursor: unknown = document\n for (const step of steps) {\n if (step.kind === 'key') {\n if (!isRecord(cursor)) return undefined\n cursor = cursor[step.key]\n } else if (step.kind === 'index') {\n if (!Array.isArray(cursor)) return undefined\n cursor = cursor[step.index]\n } else {\n if (!Array.isArray(cursor)) return undefined\n cursor = cursor.find((item) => isRecord(item) && item.id === step.id)\n }\n }\n return cursor\n}\n\n/**\n * Resolve a picked path against a Store Document.\n *\n * Every failure names what went wrong and, for an unknown block, the valid set\n * (I2) — an editor that silently renders an empty panel teaches a merchant that\n * the editor is broken.\n */\nexport function blockAtPath(\n document: StoreDocument | Record<string, unknown>,\n path: string,\n): { ok: true; block: BlockAtPath } | { ok: false; error: BlockAtPathError } {\n if (!parseStorePath(path)) {\n return { ok: false, error: { code: 'unparseable-path', message: `\"${path}\" is not a document path` } }\n }\n\n const node = walk(document, path)\n if (!isRecord(node) || typeof node.type !== 'string') {\n return {\n ok: false,\n error: { code: 'no-block-at-path', message: `nothing at \"${path}\" is a block (a block is an object with a \"type\")` },\n }\n }\n\n // The registry is the source of the schema, so it must be populated — the\n // same requirement `validateStore` has, for the same reason.\n registerStorefrontBlocks()\n const descriptors = describeBlocks()\n const descriptor = descriptors.find((d) => d.id === node.type) ?? null\n\n if (!descriptor) {\n return {\n ok: false,\n error: {\n code: 'unknown-block',\n message: `block \"${node.type}\" is not registered`,\n valid: descriptors.map((d) => d.id).sort(),\n },\n }\n }\n\n // `isNestedBlockRef` is the renderer's own rule, imported rather than\n // restated: the renderer and the editor disagreeing about where a block's\n // settings live is exactly the bug that makes an edit vanish on save.\n const nested = isNestedBlockRef(node)\n const props = nested\n ? isRecord(node.props)\n ? node.props\n : {}\n : Object.fromEntries(Object.entries(node).filter(([key]) => !BLOCK_STRUCTURAL_KEYS.has(key)))\n\n return {\n ok: true,\n block: {\n path,\n type: node.type,\n settingsPath: nested ? `${path}.props` : path,\n props,\n settings: descriptor.settings ?? [],\n descriptor,\n },\n }\n}\n\n/**\n * The change that saves one edited setting.\n *\n * Takes `settingsPath`, not the block's path: only `blockAtPath` has seen the\n * node and knows which form it took. Hardcoding `.props.` here wrote an ignored\n * key on every flat block — a save that reported success and changed nothing.\n */\nexport function settingChange(settingsPath: string, settingId: string, value: unknown): {\n op: 'set' | 'remove'\n path: string\n value?: unknown\n} {\n const path = `${settingsPath}.${settingId}`\n // Clearing a field means the setting is absent, not present-and-empty — an\n // empty string would render as an empty heading where the default belongs.\n if (value === undefined || value === '') return { op: 'remove', path }\n return { op: 'set', path, value }\n}\n","import { applyChange, parseStorePath } from './change'\nimport type { StoreChange } from './change'\nimport type { StoreDocument } from './sections'\nimport { BLOCK_STRUCTURAL_KEYS, isNestedBlockRef } from '../blocks/page-blocks'\nimport { validateStore } from './validate'\nimport type { StoreValidationReport } from './validate'\n\n// The settings overlay, shaped like Shopify's `settings_data.json`: the\n// committed `fayz.store.json` holds the structure, the overlay holds what the\n// merchant chose, and the two merge at render.\n//\n// THE RULE, and why this is not a generic deep merge: an overlay may only\n// change SETTINGS. It may not add, remove, reorder or retype a block, and it\n// may not touch catalog, commerce, backend, auth or code. Without it, the first\n// overlay that inserts a block makes the committed document a lie. A refused\n// path is therefore the mechanism, not a failure mode to route around — an\n// editor that needs to add a block is asking for a commit.\n\n/** Sparse map of document path -> value. Absent means \"use the document's\". */\nexport type StoreOverlay = Record<string, unknown>\n\nexport interface OverlayRejection {\n path: string\n code: 'unparseable-path' | 'not-a-setting' | 'section-not-overlayable' | 'no-block-at-path'\n message: string\n}\n\nexport interface ApplyOverlayResult {\n /** The document a shopper is served: base with the accepted settings applied. */\n document: Record<string, unknown>\n /** Paths that were applied, in the order they were. */\n applied: string[]\n /** Paths the rule refused, each saying why. */\n rejected: OverlayRejection[]\n /** Validation of the MERGED document — the only one that matters. */\n validation: StoreValidationReport\n}\n\n/**\n * Sections an overlay may reach into at all. Everything else is mirrored from\n * the backend (catalog), money (commerce), infrastructure (backend, auth) or\n * code — none of which is a settings-panel change.\n */\nexport const OVERLAYABLE_SECTIONS = ['presentation', 'theme'] as const\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/**\n * Is this path a setting? Needs the document, and cannot work without it —\n * a path-only rule (\"settings live under `props`\") failed the fleet twice:\n *\n * - the two block forms MIX inside one array (artorious's home page is 3\n * nested and 5 flat), so requiring `props` made the flat ones uneditable;\n * - a setting VALUE can look exactly like a block — a form field is\n * `{id, label, type, required}` — so keying on `type` would refuse a\n * legitimate edit.\n *\n * The walk resolves against the real document and asks the renderer's own\n * `isNestedBlockRef` which form each block took. It stops the moment it enters\n * a setting, which is what makes the form-field case need no exception.\n *\n * `theme` is settings throughout — it is nothing but tokens.\n */\nexport function isSettingPath(\n document: StoreDocument | Record<string, unknown>,\n path: string,\n): OverlayRejection | null {\n const steps = parseStorePath(path)\n if (!steps || steps.length === 0) {\n return { path, code: 'unparseable-path', message: `\"${path}\" is not a document path` }\n }\n\n const head = steps[0]\n if (head?.kind !== 'key' || !OVERLAYABLE_SECTIONS.includes(head.key as (typeof OVERLAYABLE_SECTIONS)[number])) {\n return {\n path,\n code: 'section-not-overlayable',\n message:\n `an overlay may only change ${OVERLAYABLE_SECTIONS.join(' and ')} — ` +\n `\"${path}\" targets something else. Catalog mirrors the backend, commerce is money, ` +\n `code is code: none of those is a settings-panel change.`,\n }\n }\n\n if (head.key === 'theme') return null\n\n const structural = (): OverlayRejection => ({\n path,\n code: 'not-a-setting',\n message:\n `\"${path}\" is not a setting. An overlay changes what a block SAYS, never which ` +\n `blocks exist or in what order — adding, removing, reordering or retyping a block ` +\n `is a change to the committed document, and belongs in a commit.`,\n })\n\n let cursor: unknown = document\n // True when `cursor` is a block: we reached it by indexing an array while\n // still walking structure, and every array reached that way is a block\n // container (the walk returns the moment it enters settings, so a list\n // setting's array is never indexed here).\n let atBlock = false\n\n for (let i = 0; i < steps.length; i++) {\n const step = steps[i]!\n\n if (atBlock) {\n if (!isRecord(cursor)) {\n return {\n path,\n code: 'no-block-at-path',\n message:\n `nothing in the document sits at the block \"${path}\" names — most likely a setting ` +\n `left behind by a block deleted in a later commit. pruneOverlay drops these.`,\n }\n }\n if (step.kind !== 'key') return structural()\n\n if (isNestedBlockRef(cursor)) {\n // `children` is another block array, not a setting: keep walking\n // structure so a nested block's own settings still resolve.\n if (step.key === 'children') {\n cursor = cursor.children\n atBlock = false\n continue\n }\n // Anything but `props` is identity (type, id, data) or a stray key the\n // renderer ignores in this form.\n if (step.key !== 'props') return structural()\n // The props object itself: replacing it wholesale is a rewrite.\n if (i === steps.length - 1) return structural()\n return null\n }\n\n // Flat form: everything that is not identity is a setting, which is the\n // same line `toBlockNode` draws when it reads this block.\n if (BLOCK_STRUCTURAL_KEYS.has(step.key)) return structural()\n return null\n }\n\n if (step.kind === 'key') {\n if (!isRecord(cursor)) return structural()\n cursor = cursor[step.key]\n continue\n }\n if (!Array.isArray(cursor)) return structural()\n cursor = step.kind === 'index' ? cursor[step.index] : cursor.find((item) => isRecord(item) && item.id === step.id)\n atBlock = true\n }\n\n // The steps ran out while still walking structure: the path names a whole\n // block, a block array, or a page — all of which are the repo's to say.\n return structural()\n}\n\n/**\n * Merge an overlay onto a document. Never mutates the input. Rejections are\n * reported rather than thrown: an overlay with one bad entry must still deliver\n * the other forty, or a store stops updating and nobody knows why.\n */\nexport function applyOverlay(\n document: StoreDocument | Record<string, unknown>,\n overlay: StoreOverlay,\n): ApplyOverlayResult {\n const rejected: OverlayRejection[] = []\n const changes: StoreChange[] = []\n\n // Sorted so the result is deterministic regardless of key insertion order —\n // two servers merging the same overlay must serve the same page.\n for (const path of Object.keys(overlay).sort()) {\n const rejection = isSettingPath(document, path)\n if (rejection) {\n rejected.push(rejection)\n continue\n }\n const value = overlay[path]\n changes.push(\n value === undefined\n ? { op: 'remove', path }\n : { op: 'set', path, value: value as StoreChange['value'] },\n )\n }\n\n // `onInvalid: 'reject'` discards an invalid merge whole and serves the BASE:\n // degrading to what the repo says is safe, half-merging is a page nobody has\n // validated. The save path validates before persisting; this is the belt.\n const result = applyChange(document, changes, {\n sections: [...OVERLAYABLE_SECTIONS],\n onInvalid: 'reject',\n })\n\n // `applyChange.errors` mixes its own refusals with the merged document's\n // validation errors. Only errors on a submitted path count as rejections —\n // blaming an overlay entry for a pre-existing error at `commerce.mode` would\n // have pruneOverlay delete healthy settings.\n //\n // Blame matches BOTH directions along a branch. Downward: `set` creates\n // missing intermediates, so an entry can materialise a block with no `type`\n // and the error lands beneath it. Upward: the array refuses the index and the\n // error lands at `blocks[9]`, a PREFIX of what was submitted — which is what\n // an orphan actually produces, so matching only downward let every orphan\n // through silently. A bare section path is excluded, or one document-level\n // error would condemn the whole overlay.\n const applied = new Set(result.applied.map((a) => a.path))\n const beneath = (ancestor: string, descendant: string): boolean =>\n descendant === ancestor || descendant.startsWith(`${ancestor}.`) || descendant.startsWith(`${ancestor}[`)\n\n for (const failure of result.errors) {\n if (!failure.path || !failure.path.includes('.')) continue\n const owner = changes.find(\n (c) => !applied.has(c.path) && (beneath(c.path, failure.path) || beneath(failure.path, c.path)),\n )\n if (!owner || rejected.some((r) => r.path === owner.path)) continue\n rejected.push({ path: owner.path, code: 'not-a-setting', message: failure.message })\n }\n\n return {\n document: result.doc as unknown as Record<string, unknown>,\n applied: result.applied.map((a) => a.resolvedPath),\n rejected,\n validation: result.validation,\n }\n}\n\n/**\n * Drop overlay entries the document can no longer accept. Orphans are harmless\n * on their own — applyOverlay refuses them — but they accumulate, and an\n * overlay nobody prunes hides a real mistake among a hundred dead ones.\n */\nexport function pruneOverlay(\n document: StoreDocument | Record<string, unknown>,\n overlay: StoreOverlay,\n): { overlay: StoreOverlay; dropped: string[] } {\n const result = applyOverlay(document, overlay)\n const dead = new Set(result.rejected.map((r) => r.path))\n const kept: StoreOverlay = {}\n for (const [path, value] of Object.entries(overlay)) {\n if (!dead.has(path)) kept[path] = value\n }\n return { overlay: kept, dropped: [...dead].sort() }\n}\n","import type { StorefrontTheme } from '../lib/theme'\nimport type { HomeConfig } from '../blocks/sections'\n\n// ---------------------------------------------------------------------------\n// Template presets — recreations of the four Nuvemshop patterns selected in\n// docs/archive/storefront-templates-research.md. Each is { theme, home() } so an app\n// (or the Fayz agent) starts from a complete professional store and overrides\n// copy, colors, hero images and sections — the saas-core theming workflow.\n// ---------------------------------------------------------------------------\n\n/** Real imagery for a template home — resolved at build time (e.g. via\n * scripts/fetch-unsplash.mjs); falls back to gradient placeholders when omitted. */\nexport interface TemplateImages {\n hero?: Array<string | undefined>\n banners?: Array<string | undefined>\n}\n\nexport interface StorefrontTemplate {\n id: string\n /** The Nuvemshop pattern this recreates */\n inspiration: string\n theme: StorefrontTheme\n /** Default home blueprint — pass the store name for copy interpolation */\n home: (storeName: string, images?: TemplateImages) => HomeConfig\n announcement?: string\n}\n\n/** maré — elegant fashion (Rio): airy warm paper, olive ink, sand CTA, centered logo. */\nexport const mareTemplate: StorefrontTemplate = {\n id: 'mare',\n inspiration: 'Nuvemshop Rio',\n announcement: 'FRETE GRÁTIS EM COMPRAS ACIMA DE R$ 300',\n theme: {\n name: 'mare',\n colors: {\n background: '40 14% 93%',\n foreground: '90 8% 38%',\n primary: '42 32% 61%',\n primaryForeground: '40 30% 12%',\n card: '40 20% 97%',\n cardForeground: '90 10% 25%',\n muted: '40 12% 88%',\n mutedForeground: '90 6% 50%',\n border: '40 10% 82%',\n announcementBackground: '90 10% 30%',\n announcementForeground: '40 20% 95%',\n },\n font: { heading: 'Plus Jakarta Sans', body: 'Plus Jakarta Sans' },\n radius: 'soft',\n header: { variant: 'centered' },\n productCard: { style: 'editorial', imageAspect: 'portrait' },\n },\n home: (storeName, images) => ({\n sections: [\n {\n type: 'hero',\n variant: 'banner',\n height: 'tall',\n slides: [\n { title: 'Feito para durar', subtitle: `A nova coleção ${storeName} chegou — peças atemporais em materiais honestos.`, cta: 'Ver coleção', hue: 75, image: images?.hero?.[0] },\n ],\n },\n { type: 'categories', style: 'bubbles' },\n { type: 'products', title: 'Destaques', filter: 'all', limit: 4 },\n { type: 'banner', title: 'Até 30% off', eyebrow: 'por tempo limitado', subtitle: 'Peças selecionadas da estação', cta: 'Aproveitar', hue: 40, image: images?.banners?.[0] },\n { type: 'products', title: 'Promoções', filter: 'sale', limit: 4 },\n { type: 'products', title: 'Lançamentos', filter: 'new', limit: 4 },\n { type: 'newsletter', title: 'Assine nossa newsletter', subtitle: 'Novidades e ofertas exclusivas, sem spam.' },\n ],\n }),\n}\n\n/** sertão — editorial organic (Uyuni): cream paper, coffee serif ink, boxed hero, manifesto. */\nexport const sertaoTemplate: StorefrontTemplate = {\n id: 'sertao',\n inspiration: 'Nuvemshop Uyuni',\n theme: {\n name: 'sertao',\n colors: {\n background: '30 100% 98%',\n foreground: '28 42% 32%',\n primary: '28 42% 32%',\n primaryForeground: '30 100% 97%',\n card: '32 60% 96%',\n cardForeground: '28 40% 26%',\n muted: '32 40% 92%',\n mutedForeground: '28 22% 48%',\n border: '28 30% 80%',\n },\n font: { heading: 'Marcellus', body: 'Marcellus', fallback: 'serif' },\n radius: 'none',\n header: { variant: 'minimal', uppercaseNav: true },\n productCard: { style: 'editorial', imageAspect: 'portrait' },\n uppercaseButtons: true,\n },\n home: (storeName, images) => ({\n sections: [\n {\n type: 'hero',\n variant: 'banner',\n height: 'tall',\n slides: [\n { title: 'Essenciais naturais', subtitle: 'Conheça nossa coleção', cta: 'Ver mais', hue: 28, boxed: true, image: images?.hero?.[0] },\n ],\n },\n {\n type: 'manifesto',\n text: `Num mundo de pressa e excesso, ${storeName} escolhe o caminho lento: ingredientes honestos, produção pequena e cuidado em cada detalhe.`,\n },\n { type: 'categories', style: 'tiles' },\n { type: 'products', title: 'ESSENCIAIS', filter: 'all', limit: 4 },\n {\n type: 'testimonials',\n title: 'Nossos clientes',\n items: [\n { quote: 'Qualidade impecável e um cheiro que abraça.', author: 'Helena M.' },\n { quote: 'Compro há dois anos e nunca me decepcionou.', author: 'Rafael T.' },\n { quote: 'Entrega rápida e embalagem linda, dá gosto de presentear.', author: 'Cláudia P.' },\n ],\n },\n { type: 'products', title: 'NOVIDADES', filter: 'new', limit: 4 },\n {\n type: 'benefits',\n items: [\n { icon: 'Truck', title: 'Frete para todo o Brasil', text: 'Envio em até 48h' },\n { icon: 'Leaf', title: '100% vegano', text: 'Sem testes em animais' },\n { icon: 'RotateCcw', title: 'Troca fácil', text: '30 dias para trocar' },\n ],\n },\n { type: 'newsletter', title: 'NEWSLETTER', subtitle: 'Histórias, lançamentos e cuidado — direto no seu e-mail.' },\n ],\n }),\n}\n\n/** volt — bold tech (Brasília): white canvas, near-black ink, vivid CTA, dark search-first header, split hero. */\nexport const voltTemplate: StorefrontTemplate = {\n id: 'volt',\n inspiration: 'Nuvemshop Brasília',\n announcement: 'CUPOM BEMVINDO10 — 10% DE DESCONTO NA PRIMEIRA COMPRA',\n theme: {\n name: 'volt',\n colors: {\n background: '0 0% 100%',\n foreground: '0 0% 7%',\n primary: '341 100% 45%',\n primaryForeground: '0 0% 100%',\n card: '0 0% 98%',\n cardForeground: '0 0% 10%',\n muted: '0 0% 94%',\n mutedForeground: '0 0% 40%',\n border: '0 0% 88%',\n headerBackground: '0 0% 6%',\n headerForeground: '0 0% 98%',\n announcementBackground: '341 100% 45%',\n announcementForeground: '0 0% 100%',\n },\n font: { heading: 'Chakra Petch', body: 'Rubik' },\n radius: 'soft',\n header: { variant: 'search', uppercaseNav: true },\n productCard: { style: 'card', imageAspect: 'square' },\n },\n home: (storeName, images) => ({\n sections: [\n {\n type: 'hero',\n variant: 'split',\n slides: [\n { title: 'Tecnologia', subtitle: 'O melhor do hardware e dos acessórios', hue: 250, image: images?.hero?.[0] },\n { title: 'Ofertas', subtitle: `Descontos semanais ${storeName}`, hue: 341, href: '/catalog', image: images?.hero?.[1] },\n ],\n },\n {\n type: 'benefits',\n items: [\n { icon: 'CreditCard', title: '3x sem juros', text: 'Em todo o site' },\n { icon: 'Truck', title: 'Envio em 24h', text: 'Para todo o Brasil' },\n { icon: 'ShieldCheck', title: 'Compra segura', text: 'Seus dados protegidos' },\n ],\n },\n { type: 'products', title: 'NOVIDADES', filter: 'new', limit: 4 },\n { type: 'banner', title: 'DESCONTOS SEMANAIS', eyebrow: 'toda sexta', subtitle: 'Ofertas novas, estoque limitado', cta: 'Conferir', hue: 341, image: images?.banners?.[0] },\n { type: 'products', title: 'PROMOÇÕES', filter: 'sale', limit: 4 },\n { type: 'newsletter', title: 'Entre para o clube', subtitle: 'Cupons e lançamentos antes de todo mundo.' },\n ],\n }),\n}\n\n/** atelier — classic premium retail (Flex): white, near-black, gold accent, slider hero, trust badges. */\nexport const atelierTemplate: StorefrontTemplate = {\n id: 'atelier',\n inspiration: 'Nuvemshop Flex',\n theme: {\n name: 'atelier',\n colors: {\n background: '0 0% 100%',\n foreground: '0 0% 9%',\n primary: '40 45% 48%',\n primaryForeground: '0 0% 100%',\n card: '0 0% 99%',\n cardForeground: '0 0% 9%',\n muted: '40 10% 95%',\n mutedForeground: '0 0% 42%',\n border: '0 0% 88%',\n announcementBackground: '0 0% 9%',\n announcementForeground: '0 0% 98%',\n },\n font: { heading: 'Outfit', body: 'Outfit' },\n radius: 'none',\n header: { variant: 'centered', uppercaseNav: true },\n productCard: { style: 'card', imageAspect: 'square' },\n uppercaseButtons: true,\n },\n announcement: 'PARCELE EM ATÉ 10X · 5% OFF NO PIX',\n home: (storeName, images) => ({\n sections: [\n {\n type: 'hero',\n variant: 'slider',\n height: 'medium',\n slides: [\n { title: 'Feito para quem valoriza detalhes', subtitle: `Coleção exclusiva ${storeName}`, cta: 'APROVEITE', hue: 40, image: images?.hero?.[0] },\n { title: 'Clássicos que não saem de moda', subtitle: 'Peças autorais, produção limitada', cta: 'VER COLEÇÃO', hue: 210, image: images?.hero?.[1] },\n ],\n },\n {\n type: 'benefits',\n items: [\n { icon: 'CreditCard', title: 'Parcele em até 10x', text: 'Ou 5% off no PIX' },\n { icon: 'Lock', title: 'Site 100% seguro', text: 'Seus dados protegidos' },\n { icon: 'Award', title: 'Peças exclusivas', text: 'Produtos 100% autorais' },\n ],\n },\n { type: 'categories', style: 'tiles' },\n { type: 'products', title: 'Novidades', filter: 'new', limit: 4 },\n { type: 'banner', title: 'Promoções', eyebrow: 'seleção especial', subtitle: 'Selecionados com até 25% off', cta: 'Ver ofertas', hue: 40, image: images?.banners?.[0] },\n { type: 'products', title: 'Promoções', filter: 'sale', limit: 4 },\n {\n type: 'testimonials',\n title: 'O que dizem sobre nós',\n items: [\n { quote: 'Acabamento perfeito, superou a expectativa.', author: 'Mariana C.' },\n { quote: 'Atendimento impecável do pedido à entrega.', author: 'Jorge L.' },\n { quote: 'Virou minha loja favorita para presentes.', author: 'Paula R.' },\n ],\n },\n { type: 'newsletter' },\n ],\n }),\n}\n\n/** food — warm appetizing delivery (steakhouse / burger / comfort food): dark inviting\n * header, ember CTA, cream canvas, rounded cards, menu-first home with \"mais pedidos\"\n * rail and social proof. Built for restaurant/food stores — override to go fully dark. */\nexport const foodTemplate: StorefrontTemplate = {\n id: 'food',\n inspiration: 'Delivery / restaurant storefront',\n announcement: 'ENTREGA GRÁTIS ACIMA DE R$ 150 · PEÇA JÁ',\n theme: {\n name: 'food',\n colors: {\n background: '30 33% 97%',\n foreground: '20 14% 15%',\n primary: '14 84% 50%',\n primaryForeground: '0 0% 100%',\n card: '30 33% 99%',\n cardForeground: '20 14% 15%',\n muted: '28 20% 92%',\n mutedForeground: '22 10% 42%',\n border: '28 18% 85%',\n headerBackground: '20 14% 11%',\n headerForeground: '30 24% 96%',\n announcementBackground: '14 84% 50%',\n announcementForeground: '0 0% 100%',\n },\n font: { heading: 'Poppins', body: 'Inter' },\n radius: 'round',\n header: { variant: 'classic' },\n productCard: { style: 'card', imageAspect: 'square' },\n },\n home: (storeName, images) => ({\n sections: [\n {\n type: 'hero',\n variant: 'banner',\n height: 'tall',\n slides: [\n { title: 'Sabor de verdade, na sua porta', subtitle: `${storeName} — feito na hora, do jeito que você ama.`, cta: 'Ver cardápio', href: '/catalog', hue: 20, image: images?.hero?.[0] },\n ],\n },\n {\n type: 'benefits',\n items: [\n { icon: 'Flame', title: 'Feito na hora', text: 'Preparado com capricho' },\n { icon: 'Truck', title: 'Entrega rápida', text: 'Frete grátis acima de R$ 150' },\n { icon: 'CreditCard', title: 'Pagamento fácil', text: 'Pix, cartão e mais' },\n ],\n },\n { type: 'categories', style: 'tiles', title: 'Nosso cardápio' },\n { type: 'products', title: 'Mais pedidos', eyebrow: 'favoritos da casa', filter: 'all', limit: 8 },\n { type: 'banner', title: 'Combo do dia', eyebrow: 'oferta', subtitle: 'Seleção especial com desconto', cta: 'Aproveitar', hue: 14, image: images?.banners?.[0] },\n { type: 'products', title: 'Novidades no cardápio', filter: 'new', limit: 4 },\n {\n type: 'testimonials',\n title: 'O que dizem por aí',\n items: [\n { quote: 'Chegou quentinho e absurdo de bom. Virei cliente!', author: 'Rafael M.' },\n { quote: 'Sabor de restaurante em casa, sem complicação.', author: 'Beatriz L.' },\n { quote: 'Entrega rápida e porção generosa. Recomendo demais.', author: 'Diego S.' },\n ],\n },\n { type: 'newsletter', title: 'Receba nossas ofertas', subtitle: 'Promoções e novidades do cardápio, direto no seu e-mail.' },\n ],\n }),\n}\n\nexport const storefrontTemplates = {\n mare: mareTemplate,\n sertao: sertaoTemplate,\n volt: voltTemplate,\n atelier: atelierTemplate,\n food: foodTemplate,\n} as const\n\nexport type StorefrontTemplateId = keyof typeof storefrontTemplates\n","import React from 'react'\nimport type { StorefrontBlockLike } from '../blocks/page-blocks'\nimport { StorefrontPage } from './StorefrontPage'\n\n// Kept as the public shorthand for \"render this list of sections as a page\".\n// Several stores import it directly for their own routes, so it stays — but it\n// now delegates to StorefrontPage rather than rendering a tree of its own.\n// Two page renderers would drift, and the one that drifted would be this one:\n// it would silently miss page context, the diagnostics and (from Fase 3) slots.\nexport function StorefrontSections({ sections }: { sections: readonly StorefrontBlockLike[] }) {\n return <StorefrontPage kind=\"home\" page={{ blocks: sections }} />\n}\n\nexport function HomePage({ sections }: { sections: readonly StorefrontBlockLike[] }) {\n return <StorefrontSections sections={sections} />\n}\n","// Factory\nexport {\n createStorefront,\n createStorefrontApp,\n initStorefrontRuntime,\n registerStorefrontEntities,\n resolveStorefrontProvider,\n StorefrontShell,\n} from './app/createStorefrontApp'\nexport type { CreateStorefrontOptions, StorefrontShellProps } from './app/createStorefrontApp'\nexport {\n defineStorefrontConfig,\n defineStorefrontComponents,\n defineStorefrontRoutes,\n defineStorefrontSections,\n defineStorefrontApp,\n} from './app/define'\nexport type {\n StorefrontConfig,\n ResolvedStorefrontConfig,\n StorefrontRouteComponentProps,\n StorefrontRouteChrome,\n StorefrontCommerceMode,\n StorefrontImageLoadingConfig,\n StorefrontImageLoadingMode,\n StorefrontRouteDefinition,\n StorefrontRouteKind,\n StorefrontRouteParams,\n StorefrontEnquiryConfig,\n StorefrontSearchConfig,\n} from './document/config'\nexport type {\n StorefrontActions,\n StorefrontComponents,\n ProductCardProps,\n ProductCardImageOrder,\n ProductDetailProps,\n ProductGalleryProps,\n ProductGalleryOrder,\n ProductPriceProps,\n ProductActionsProps,\n ProductEnquiryFormContractProps,\n CategoryCardProps,\n CollectionSectionProps,\n HeroSectionContractProps,\n MediaCarouselProps as MediaCarouselContractProps,\n ProductSliderProps as ProductSliderContractProps,\n StorefrontChromeProps,\n StorefrontStateProps,\n} from './extend/component-contracts'\nexport { useStorefrontConfig, useStorefrontConfigOptional } from './document/config'\n// The config seam. `createStorefront` wires these internally; exporting them is\n// what lets a page or a block be rendered outside it — by a store with fully\n// custom routing, by the visual editor's preview, and by a test. Its absence is\n// the reason this package had no tests.\nexport { resolveConfig, StorefrontConfigProvider } from './document/config'\n\n// Manifest path (renderApp(defineStorefront(config)) / storefront scaffold)\nexport { defineStorefront, StorefrontScaffold } from './app/scaffold'\n\n// Store Document v1 (spine M1): serialize / validate / describe / hydrate.\n// The handle registry itself lives in @fayz-ai/core (registerHandle et al) and\n// is re-exported here so storefront apps depend on one package.\nexport {\n exportStore,\n hydrateStoreDocument,\n slugifyStoreName,\n STORE_DOCUMENT_KIND,\n} from './document/round-trip'\nexport type { ExportStoreOptions, HydrateStoreOptions } from './document/round-trip'\nexport {\n STORE_SECTIONS,\n STORE_SECTION_NAMES,\n sectionToJsonSchema,\n STORE_COMMERCE_MODES,\n STORE_PAYMENT_MODES,\n STORE_PAYMENT_METHOD_KINDS,\n STORE_BACKEND_PROVIDERS,\n STORE_ROUTE_KINDS,\n STORE_ROUTE_CHROMES,\n} from './document/sections'\nexport type {\n StoreDocument,\n StoreSectionName,\n StoreIdentitySection,\n StoreThemeSection,\n StoreCommerceSection,\n StorePresentationSection,\n StoreContentSection,\n StoreCatalogSection,\n StoreBackendSection,\n StoreAuthSection,\n StoreCodeSection,\n StoreCodeRouteRef,\n StoreFieldSpec,\n StoreFieldDeprecation,\n StoreSectionSpec,\n} from './document/sections'\nexport { validateStore, STOREFRONT_PAGE_KINDS } from './document/validate'\nexport type { StoreValidationReport, StoreValidationError } from './document/validate'\nexport { describeStore } from './document/describe'\nexport type {\n StoreDescription,\n StoreAbilityDescriptor,\n StoreCapabilities,\n StoreSectionDescription,\n StoreDocumentSummary,\n StoreContractDescription,\n} from './document/describe'\n// The M10 contract: what is deprecated in this store, and the codemods keyed\n// to document version that retire it. `fayz upgrade` drives these.\nexport {\n upgradeStore,\n scanStoreDeprecations,\n unobservableDeprecations,\n describeCodemods,\n STORE_CODEMOD_IDS,\n} from './document/upgrade'\nexport type {\n StoreUpgradeResult,\n StoreUpgradeOptions,\n StoreCodemodResult,\n StoreCodemodStatus,\n StoreCodemodRefusal,\n StoreCodemodDescriptor,\n StoreCodemodVersionKey,\n StoreDeprecationFinding,\n} from './document/upgrade'\n// applyChange — the fourth ability (spine M8). `renderStore` is the third and\n// lives on the ./render subpath, because it imports react-dom/server.\nexport {\n applyChange,\n parseStorePath,\n STORE_CHANGE_OPS,\n DEFAULT_WRITABLE_SECTIONS,\n} from './document/change'\nexport type {\n StoreChange,\n StoreChangeOp,\n StoreChangeResult,\n AppliedStoreChange,\n ApplyChangeOptions,\n} from './document/change'\nexport { STOREFRONT_COMPONENT_KEYS } from './extend/component-contracts'\nexport {\n registerHandle,\n resolveHandle,\n getHandle,\n hasHandle,\n listHandles,\n handleNameFor,\n} from '@fayz-ai/core'\n\n// Block system (storefront sections as registry blocks)\nexport { registerStorefrontBlocks, sectionsToBlocks } from './blocks/registry'\n\n// Loaders — declared reads through the ShopProvider port (M3, I11)\nexport { registerStorefrontLoaders } from './data/loaders'\nexport type {\n StorefrontLoaderContext,\n ProductsListParams,\n ProductBySlugParams,\n ProductsSort,\n EntityListParams,\n EntityBySlugParams,\n EntityFieldsParams,\n} from './data/loaders'\n\n// Page data — needs collected from the block tree, resolved once per page\nexport {\n PageDataScope,\n useLoader,\n useBlockData,\n BlockDataError,\n collectDataNeeds,\n resolveDataParams,\n resolvePageData,\n resolvePageDataNeed,\n} from './blocks/page-data'\nexport type {\n PageDataEntry,\n PageDataNeed,\n PageDataStatus,\n PageDataScopeProps,\n UseLoaderResult,\n} from './blocks/page-data'\n\n// The static-render seam renderStore drives the live components through (M8).\nexport { currentStaticRenderPass, withStaticRenderPass } from './app/static-render'\nexport type { StaticRenderPass, StaticHeadInput } from './app/static-render'\n\n// Pages as block trees (compose any route, not just the home)\nexport {\n toBlockNodes,\n defaultPageBlocks,\n checkPageBlocks,\n matchContentPage,\n contentPagePath,\n routePathParams,\n mergePageTheme,\n pageThemeSelector,\n CATALOG_BODY_BLOCK,\n PRODUCT_BODY_BLOCK,\n} from './blocks/page-blocks'\nexport type {\n StorefrontBlockRef,\n StorefrontBlockLike,\n StorefrontPageConfig,\n StorefrontContentPageConfig,\n ContentPageMatch,\n StorefrontPagesConfig,\n StorefrontPageKind,\n PageBlockDiagnostic,\n} from './blocks/page-blocks'\nexport {\n StorefrontPage,\n useStorefrontPage,\n useStorefrontPageOptional,\n resetPageDiagnostics,\n} from './views/StorefrontPage'\nexport type { StorefrontPageProps, StorefrontPageContextValue } from './views/StorefrontPage'\n\n// Partial overrides (adjust a component's props without adopting the component)\nexport { resolveOverride, overrideComponent, overrideProps } from './extend/component-override'\nexport type { ComponentOverride, ResolvedOverride } from './extend/component-override'\n\n// Named slots (graft blocks into an SDK page without owning the page)\nexport { Slot, useSlotContext, listSlots, usedSlots, STOREFRONT_SLOTS } from './extend/slots'\nexport type {\n StorefrontSlots,\n StorefrontSlotArea,\n StorefrontSlotContextMap,\n SlotDescriptor,\n SlotProps,\n ListSlotsOptions,\n} from './extend/slots'\n\n// Routing\nexport { Link, navigateTo, useHashPath, matchPath } from './app/router'\nexport type { LinkProps } from './app/router'\n\n// Stores\nexport {\n useCartStore,\n selectCount,\n selectSubtotal,\n selectDiscountTotal,\n selectShipping,\n selectTotal,\n} from './stores/cart.store'\nexport type { CartLine, CartState } from './stores/cart.store'\nexport { useSessionStore } from './stores/session.store'\nexport type { SessionState } from './stores/session.store'\nexport {\n signInByEmail,\n signUpCustomer,\n establishCustomerSession,\n signOutCustomer,\n getCustomerAuthAdapter,\n resolveAuthAdapter,\n EmailConfirmationRequiredError,\n} from './data/auth'\nexport type { StorefrontAuthAdapter, StorefrontAuthConfig, EstablishSessionOptions } from './data/auth'\nexport { useCatalogStore } from './stores/catalog.store'\nexport type { CatalogState, CatalogSort } from './stores/catalog.store'\n// Metadata refinements — one matcher, shared by the catalogue page, the rails\n// and the server-side loader.\nexport { matchesFacets, withFacet, mergeCollectionFacet, toFacetMap } from './data/facets'\nexport type { CatalogFacets, CatalogFacetEntry } from './data/facets'\n\n// Hooks\nexport {\n useProducts,\n useProduct,\n useCategories,\n useCatalog,\n useStorefront,\n useStorefrontActions,\n useStorefrontHead,\n useRegion,\n usePolicies,\n useCart,\n useCheckout,\n useDiscountValidator,\n usePaymentMethods,\n useShipping,\n useAddress,\n useOrder,\n useMyOrders,\n useEnquiry,\n} from './hooks'\nexport type {\n StorefrontRegion,\n PolicyKind,\n StorefrontPolicy,\n UsePolicies,\n CheckoutTotals,\n CheckoutSubmission,\n UseCheckout,\n UsePaymentMethods,\n UseShipping,\n AddressLookupStatus,\n UseAddress,\n UseOrder,\n} from './hooks'\n\n// Components (for custom layouts)\nexport { StorefrontHeader } from './components/layout/StorefrontHeader'\nexport { SearchOverlay } from './components/layout/SearchOverlay'\nexport { SmoothImage } from './components/SmoothImage'\nexport type { SmoothImageProps } from './components/SmoothImage'\nexport { ProductCard, pickProductCardImage } from './components/product/ProductCard'\n// Exported precisely because it was NOT, and the one store that needed a\n// different image order had nothing to wrap — so it cloned all 158 lines.\nexport { ProductGallery, orderGalleryImages } from './components/product/ProductGallery'\nexport { ProductEnquiryForm } from './components/product/ProductEnquiryForm'\nexport type { ProductEnquiryFormProps } from './components/product/ProductEnquiryForm'\nexport { OrderTrackingTimeline } from './components/order/OrderTrackingTimeline'\nexport { ProductGrid } from './components/collection/ProductGrid'\nexport { FiltersPanel } from './components/collection/FiltersPanel'\nexport type { CatalogFacetConfig } from './components/collection/FiltersPanel'\nexport { CartDrawer } from './components/cart/CartDrawer'\nexport { Price } from './components/Price'\nexport { PaymentTerms, resolvePaymentTerms } from './components/PaymentTerms'\nexport type { PaymentTermsProps, ResolvedPaymentTerms } from './components/PaymentTerms'\nexport { ProductSpecs } from './components/product/ProductSpecs'\nexport { ProductReviews } from './components/product/ProductReviews'\nexport type { ProductReview, StorefrontReviewsConfig } from './components/product/ProductReviews'\nexport { QuantityInput } from './components/cart/QuantityInput'\nexport { ProductOptionSelector } from './components/product/ProductOptionSelector'\nexport type { ProductOptionSelectorProps } from './components/product/ProductOptionSelector'\nexport {\n getProductOptionGroups,\n normalizeProductOptionSelection,\n formatProductOptionSelection,\n productOptionSelectionKey,\n resolveVariantForSelection,\n selectionPrice,\n resetProductOptionsDeprecationWarnings,\n} from './data/product-options'\nexport type { ProductOptionGroup, ProductOptionSelection } from './data/product-options'\n\n// Extension points (spine M7) — the storefront's declared behaviour seams.\nexport {\n CART_LINE_ANNOTATION_POINT,\n ORDER_METADATA_POINT,\n PRODUCT_CARD_BADGE_POINT,\n CHECKOUT_FIELD_POINT,\n BEFORE_PLACE_ORDER_VALVE,\n registerStorefrontExtensionPoints,\n resetStorefrontExtensionPoints,\n getCartLineAnnotations,\n getProductCardBadges,\n getCheckoutFieldContributions,\n collectOrderMetadata,\n runBeforePlaceOrderValve,\n} from './extend/extension-points'\nexport type {\n CartLineAnnotationInput,\n CartLineAnnotation,\n OrderMetadataInput,\n ProductCardBadgeInput,\n ProductCardBadge,\n CheckoutFieldInput,\n CheckoutFieldContribution,\n BeforePlaceOrderContext,\n} from './extend/extension-points'\n\n// Pages (for custom routing)\nexport { ContentPage } from './views/ContentPage'\nexport type { ContentPageProps } from './views/ContentPage'\nexport { CatalogPage } from './views/CatalogPage'\nexport { ProductDetailPage } from './views/ProductDetailPage'\nexport { CheckoutPage } from './views/CheckoutPage'\nexport { OrderConfirmationPage } from './views/OrderConfirmationPage'\nexport { MyPurchasesPage } from './views/MyPurchasesPage'\nexport { placeStorefrontOrder } from './workflows/checkout'\nexport type {\n PlaceStorefrontOrderInput,\n PlaceStorefrontOrderResult,\n StorefrontCheckoutAddress,\n StorefrontCheckoutCustomer,\n} from './workflows/checkout'\n\n// Theming + templates\nexport { StorefrontThemeStyle, themeToCss, THEME_SCALE_FIELDS, THEME_SCALE_VAR_PREFIX } from './lib/theme'\nexport type {\n ThemeScaleField,\n StorefrontTheme,\n StorefrontThemeColors,\n StorefrontThemeFont,\n StorefrontRadius,\n HeaderVariant,\n HeroVariant,\n CardStyle,\n ThemeCssOptions,\n} from './lib/theme'\nexport {\n CollectionHero,\n ProductSpotlight,\n MotifStrip,\n CollectionCta,\n} from './components/marketing/CollectionSections'\nexport type {\n CollectionHeroProps,\n ProductSpotlightProps,\n MotifStripProps,\n CollectionCtaProps,\n} from './components/marketing/CollectionSections'\nexport type { StorefrontSection, HomeSection, HomeConfig, HeroSlide, MediaCarouselItem, NavLink, FooterConfig } from './blocks/sections'\nexport { bannerPlaceholder, productPlaceholder, PLACEHOLDER_ASPECTS } from './blocks/sections'\n// The editor seam: a storefront in an editor's iframe reports which DOCUMENT\n// NODE was clicked, not which DOM element.\nexport { connectEditorBridge, reportNavigation, blockAt, EDITOR_MESSAGES } from './extend/editor-bridge'\nexport type { EditorBridgeOptions, PickedBlock } from './extend/editor-bridge'\n// From a picked path to the settings schema that draws its form — the first\n// consumer of the block schemas I1 has been emitting since M1.\nexport { blockAtPath, settingChange } from './blocks/block-at-path'\n// The settings overlay: a merchant edit reaches a live store without a build,\n// and the repo keeps authority over what the store IS (G2 — hybrid).\nexport { applyOverlay, pruneOverlay, isSettingPath, OVERLAYABLE_SECTIONS } from './document/overlay'\nexport type { StoreOverlay, ApplyOverlayResult, OverlayRejection } from './document/overlay'\nexport type { BlockAtPath, BlockAtPathError } from './blocks/block-at-path'\nexport {\n storefrontTemplates,\n mareTemplate,\n sertaoTemplate,\n voltTemplate,\n atelierTemplate,\n foodTemplate,\n} from './document/presets'\nexport type { StorefrontTemplate, StorefrontTemplateId } from './document/presets'\n\n// Home sections (for custom compositions)\nexport { HomePage, StorefrontSections } from './views/HomePage'\nexport { HeroSection } from './components/marketing/HeroSection'\nexport { MediaCarousel } from './components/marketing/MediaCarousel'\nexport type { MediaCarouselProps } from './components/marketing/MediaCarousel'\nexport { CategoryShowcase } from './components/collection/CategoryShowcase'\nexport { ProductRail } from './components/product/ProductRail'\nexport { ProductSlider } from './components/product/ProductSlider'\nexport type { ProductSliderProps } from './components/product/ProductSlider'\nexport {\n BenefitsRow,\n PromoBanner,\n ManifestoBlock,\n Testimonials,\n NewsletterBand,\n} from './components/marketing/MiscSections'\nexport { FormBlock, buildEnquiryFromForm } from './components/marketing/FormBlock'\nexport type { FormBlockProps, FormBlockField, FormBlockFieldType } from './components/marketing/FormBlock'\nexport { EntityListBlock, entityListBlockMeta } from './components/marketing/EntityList'\nexport { SealsBand, StoryQuote, ImageTiles, FaqSection } from './components/marketing/EditorialSections'\nexport type { SealItem, StoryQuoteProps, ImageTile, ImageTilesProps, FaqItem } from './components/marketing/EditorialSections'\nexport { StepsSection, CountdownBand, TierCards, nextMilestone } from './components/marketing/ConversionSections'\nexport type { StepItem, CountdownMilestone, TierItem } from './components/marketing/ConversionSections'\nexport type { BenefitItem } from './components/marketing/MiscSections'\nexport { StorefrontFooter } from './components/layout/StorefrontFooter'\n\n// Motion (core animation primitives)\nexport { Reveal, useInView, useScrolled, usePopOnChange, prefersReducedMotion } from './lib/motion'\nexport type { RevealProps } from './lib/motion'\n\n// Utilities\nexport { formatMoney, roundCents } from './lib/format'\nexport { TID } from './lib/testids'\nexport {\n productCardComponentContract,\n storefrontComponentContracts,\n} from './extend/component-selectors'\nexport type {\n ProductCardComponentContract,\n ProductDetailComponentContract,\n} from './extend/component-selectors'\n\n// ---------------------------------------------------------------------------\n// Front-door re-exports: storefront apps depend on @fayz-ai/storefront alone.\n// Runtime helpers come from @fayz-ai/core; UI / shop catalog / shop provider\n// live on their own subpaths (./ui, ./catalog, ./shop) to keep module graphs\n// separate. Mirrors the @fayz-ai/admin front door.\n// ---------------------------------------------------------------------------\n// renderApp is wrapped (not re-exported) so the 'storefront' scaffold registers\n// on first render instead of at import time — keeps the barrel side-effect-free.\nimport { renderApp as coreRenderApp } from '@fayz-ai/core'\nimport { registerStorefrontScaffold } from './app/scaffold'\n\nexport const renderApp: typeof coreRenderApp = (...args) => {\n registerStorefrontScaffold()\n return coreRenderApp(...args)\n}\n\nexport { getSupabaseClientOptional } from '@fayz-ai/core'\nexport { registerStorefrontScaffold } from './app/scaffold'\n\n// SSR hydration: the wire that carries server-resolved data into the browser.\nexport { serializePageData, readHydratedPageData, hydratedEntriesFor, PAGE_DATA_SCRIPT_ID } from './app/hydration'\nexport type { HydrationPayload } from './app/hydration'\n\n// Serving: which paths exist, and which of them a shared cache may hold.\nexport { isPublicPath, isKnownPath, resolveStorefrontRoute, storefrontPaths } from './app/serving'\nexport type { StorefrontRouteMatch } from './app/serving'\n\n// SEO descriptors — what a route tells a crawler about itself.\nexport { productSeo, pageSeo, productJsonLd, primaryImageUrl } from './lib/seo'\nexport type { StorefrontSeoContext } from './lib/seo'\n\n// Diagnostics: one rule set for a dev toolbar, a CI check and a prerender\n// validator, so a page cannot be graded three different ways.\nexport { auditStorefrontSeo, collectSeoAuditInput } from './diagnostics/seo-audit'\nexport type { SeoAuditInput, SeoAuditResult, SeoFinding, SeoFindingStatus } from './diagnostics/seo-audit'\n\n// Routing — the addressing scheme is injected, not assumed. See ./app/router.\nexport {\n useRoutePath,\n useNavigate,\n useRouterAdapter,\n useScrollToTopOnNavigate,\n shellRouterAdapter,\n StorefrontRouterProvider,\n} from './app/router'\n"]}