storefront-layouts 1.0.3 → 1.0.4

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 (509) hide show
  1. package/dist/components/auth/LoginForm.js +2 -2
  2. package/dist/components/auth/LoginSheet.js +2 -2
  3. package/dist/components/auth/login-form-core.js +3 -3
  4. package/dist/components/auth/login-sheet-header.js +3 -3
  5. package/dist/components/auth/login-sheet-registry.js +2 -2
  6. package/dist/components/auth/login-sheet-themes/booking-agenda.theme.js +1 -1
  7. package/dist/components/auth/login-sheet-themes/booking.theme.js +1 -1
  8. package/dist/components/auth/login-sheet-themes/clothing-minimal.theme.js +1 -1
  9. package/dist/components/auth/login-sheet-themes/clothing.theme.js +1 -1
  10. package/dist/components/auth/login-sheet-themes/electronics-grid.theme.js +1 -1
  11. package/dist/components/auth/login-sheet-themes/electronics.theme.js +1 -1
  12. package/dist/components/auth/login-sheet-themes/food-modern.theme.js +1 -1
  13. package/dist/components/auth/login-sheet-themes/food.theme.js +1 -1
  14. package/dist/components/auth/login-sheet-themes/index.js +9 -9
  15. package/dist/components/auth/login-sheet-themes/motivational-speaker.theme.js +1 -1
  16. package/dist/components/auth/login-sheet-themes/theme-input-baselines.d.ts +2 -2
  17. package/dist/components/auth/login-sheet-themes/theme-input-baselines.d.ts.map +1 -1
  18. package/dist/components/auth/login-sheet-themes/theme-input-baselines.js +2 -2
  19. package/dist/components/auth/login-sheets/StoreLoginSheetShell.d.ts.map +1 -1
  20. package/dist/components/auth/login-sheets/StoreLoginSheetShell.js +6 -6
  21. package/dist/components/auth/use-login-submit.js +3 -3
  22. package/dist/components/cart/InventoryHoldCountdown.js +2 -2
  23. package/dist/components/categories/category-masonry-grid.js +3 -3
  24. package/dist/components/checkout/CheckoutFeeLines.js +1 -1
  25. package/dist/components/checkout/ShippingOptionsPanel.js +3 -3
  26. package/dist/components/learning/CertificateTemplates.js +2 -2
  27. package/dist/components/learning/CertificateViewer.js +3 -3
  28. package/dist/components/learning/MentorshipProgress.d.ts.map +1 -1
  29. package/dist/components/learning/MentorshipProgress.js +4 -4
  30. package/dist/components/product/ProductVariationSelectors.js +1 -1
  31. package/dist/components/rich-text/CategoryDescription.js +2 -2
  32. package/dist/components/rich-text/ProductDescription.js +2 -2
  33. package/dist/components/rich-text/RichTextExcerpt.js +1 -1
  34. package/dist/components/rich-text/SafeRichHtml.d.ts +8 -11
  35. package/dist/components/rich-text/SafeRichHtml.d.ts.map +1 -1
  36. package/dist/components/rich-text/SafeRichHtml.js +3 -5
  37. package/dist/components/shipping/ProductDeliveryInfoSection.d.ts.map +1 -1
  38. package/dist/components/shipping/ProductDeliveryInfoSection.js +7 -4
  39. package/dist/components/shipping/ShippingQuoteAddressForm.js +3 -3
  40. package/dist/components/ui/alert-modal.js +2 -2
  41. package/dist/components/ui/avatar-image.js +1 -1
  42. package/dist/components/ui/badge.js +1 -1
  43. package/dist/components/ui/breadcrumbs.js +1 -1
  44. package/dist/components/ui/button.d.ts +1 -1
  45. package/dist/components/ui/button.js +1 -1
  46. package/dist/components/ui/card.js +1 -1
  47. package/dist/components/ui/category-tree.js +2 -2
  48. package/dist/components/ui/checkout-button.d.ts.map +1 -1
  49. package/dist/components/ui/checkout-button.js +11 -283
  50. package/dist/components/ui/guest-checkout-modal.js +3 -3
  51. package/dist/components/ui/image-skeleton.js +2 -2
  52. package/dist/components/ui/image-with-fallback.d.ts +3 -1
  53. package/dist/components/ui/image-with-fallback.d.ts.map +1 -1
  54. package/dist/components/ui/image-with-fallback.js +55 -139
  55. package/dist/components/ui/input.js +1 -1
  56. package/dist/components/ui/limited-time-offer-badge.js +2 -2
  57. package/dist/components/ui/loading-skeleton-wrapper.js +1 -1
  58. package/dist/components/ui/modal.js +2 -2
  59. package/dist/components/ui/otp-input.js +1 -1
  60. package/dist/components/ui/out-of-stock-overlay.js +1 -1
  61. package/dist/components/ui/page-animate-wrapper.js +2 -2
  62. package/dist/components/ui/page-content-loader.js +2 -2
  63. package/dist/components/ui/page-loader.js +1 -1
  64. package/dist/components/ui/product-card.d.ts.map +1 -1
  65. package/dist/components/ui/product-card.js +17 -17
  66. package/dist/components/ui/product-rating.js +1 -1
  67. package/dist/components/ui/product-stock-badge.js +2 -2
  68. package/dist/components/ui/review-form.js +2 -2
  69. package/dist/components/ui/route-skeleton-loader.js +6 -6
  70. package/dist/components/ui/sheet.d.ts +2 -1
  71. package/dist/components/ui/sheet.d.ts.map +1 -1
  72. package/dist/components/ui/sheet.js +4 -4
  73. package/dist/components/ui/skeleton.js +1 -1
  74. package/dist/components/ui/skeletons/index.js +5 -5
  75. package/dist/components/ui/skeletons/product-grid-skeleton.js +1 -1
  76. package/dist/components/ui/store-logos.d.ts.map +1 -1
  77. package/dist/components/ui/store-logos.js +4 -4
  78. package/dist/components/ui/toast.js +1 -1
  79. package/dist/components/ui/video-player.js +2 -2
  80. package/dist/editor/alignment-schemas/booking.js +1 -1
  81. package/dist/editor/alignment-schemas/clothing-minimal.js +1 -1
  82. package/dist/editor/alignment-schemas/index.js +20 -20
  83. package/dist/editor/alignment-schemas/lazy-loader.js +1 -1
  84. package/dist/editor/alignment-schemas/metadata.js +1 -1
  85. package/dist/editor/alignment-schemas/resolve-canvas-inspector-leaf.js +3 -3
  86. package/dist/editor/blocks/index.js +3 -3
  87. package/dist/editor/blocks/migrate-clothing-minimal.js +3 -3
  88. package/dist/editor/blocks/nav-outline-utils.js +2 -2
  89. package/dist/editor/blocks/registry.js +1 -1
  90. package/dist/editor/document/adapter.js +4 -4
  91. package/dist/editor/document/block-tree.js +1 -1
  92. package/dist/editor/document/index.js +6 -6
  93. package/dist/editor/document/validate.js +1 -1
  94. package/dist/editor/index.js +12 -12
  95. package/dist/editor/layout-content-loader.js +3 -3
  96. package/dist/editor/payaza-form/ArrayItemManager.js +2 -2
  97. package/dist/editor/payaza-form/EditorCanvasPreview.js +5 -5
  98. package/dist/editor/payaza-form/FieldRenderer.js +17 -17
  99. package/dist/editor/payaza-form/IframePreviewMessageBridge.js +3 -3
  100. package/dist/editor/payaza-form/PayazaFormEditor.js +31 -31
  101. package/dist/editor/payaza-form/PayazaFormEditorFullPage.js +2 -2
  102. package/dist/editor/payaza-form/SliderArrayEditor.js +3 -3
  103. package/dist/editor/payaza-form/components/ArrayField.js +1 -1
  104. package/dist/editor/payaza-form/components/BlockStylesInspector.js +1 -1
  105. package/dist/editor/payaza-form/components/BlocksField.js +9 -9
  106. package/dist/editor/payaza-form/components/ButtonField.js +3 -3
  107. package/dist/editor/payaza-form/components/CanvasGranularInspector.js +11 -11
  108. package/dist/editor/payaza-form/components/IconField.js +2 -2
  109. package/dist/editor/payaza-form/components/ImageField.js +1 -1
  110. package/dist/editor/payaza-form/components/NumberField.js +1 -1
  111. package/dist/editor/payaza-form/components/RichTextField.js +2 -2
  112. package/dist/editor/payaza-form/components/SectionField.js +1 -1
  113. package/dist/editor/payaza-form/components/SectionSchemaInspector.js +3 -3
  114. package/dist/editor/payaza-form/components/StarRatingField.js +2 -2
  115. package/dist/editor/payaza-form/components/TextField.js +1 -1
  116. package/dist/editor/payaza-form/data-merger.js +6 -6
  117. package/dist/editor/payaza-form/data-transformer.js +3 -3
  118. package/dist/editor/payaza-form/engine.js +1 -1
  119. package/dist/editor/payaza-form/examples/custom-widgets.example.js +1 -1
  120. package/dist/editor/payaza-form/index.js +8 -8
  121. package/dist/editor/payaza-form/layout-loader.js +2 -2
  122. package/dist/editor/payaza-form/preview-message-handler.js +3 -3
  123. package/dist/editor/payaza-form/schema-bridge.js +3 -3
  124. package/dist/editor/payaza-form/widget-registry.js +1 -1
  125. package/dist/editor/shared/BlockOutlineTree.js +2 -2
  126. package/dist/editor/shared/EditorHeader.js +2 -2
  127. package/dist/editor/shared/EditorNavigator.js +2 -2
  128. package/dist/editor/shared/IframePreview.js +6 -6
  129. package/dist/editor/shared/InlineCanvasPreview.js +8 -8
  130. package/dist/editor/shared/LayoutRenderer.js +1 -1
  131. package/dist/editor/shared/ResizableSidebar.js +1 -1
  132. package/dist/editor/shared/index.js +7 -7
  133. package/dist/hooks/use-analytics.js +3 -3
  134. package/dist/hooks/use-api.js +1 -1
  135. package/dist/hooks/use-cart-api.d.ts.map +1 -1
  136. package/dist/hooks/use-cart-api.js +8 -3
  137. package/dist/hooks/use-catalog-loader.js +3 -3
  138. package/dist/hooks/use-catalog-price-range.d.ts +2 -5
  139. package/dist/hooks/use-catalog-price-range.d.ts.map +1 -1
  140. package/dist/hooks/use-catalog-price-range.js +20 -5
  141. package/dist/hooks/use-category-products.d.ts +8 -0
  142. package/dist/hooks/use-category-products.d.ts.map +1 -0
  143. package/dist/hooks/use-category-products.js +43 -0
  144. package/dist/hooks/use-checkout-fees.d.ts +3 -4
  145. package/dist/hooks/use-checkout-fees.d.ts.map +1 -1
  146. package/dist/hooks/use-checkout-fees.js +1 -1
  147. package/dist/hooks/use-content-ready.js +1 -1
  148. package/dist/hooks/use-featured-products.d.ts +3 -0
  149. package/dist/hooks/use-featured-products.d.ts.map +1 -0
  150. package/dist/hooks/use-featured-products.js +25 -0
  151. package/dist/hooks/use-multi-store-checkout-fees.d.ts +3 -4
  152. package/dist/hooks/use-multi-store-checkout-fees.d.ts.map +1 -1
  153. package/dist/hooks/use-multi-store-checkout-fees.js +1 -1
  154. package/dist/hooks/use-navigation-loading.js +1 -1
  155. package/dist/hooks/use-payaza-checkout.d.ts +1 -1
  156. package/dist/hooks/use-payaza-checkout.d.ts.map +1 -1
  157. package/dist/hooks/use-payaza-checkout.js +9 -3
  158. package/dist/hooks/use-product-brands.d.ts +5 -0
  159. package/dist/hooks/use-product-brands.d.ts.map +1 -0
  160. package/dist/hooks/use-product-brands.js +25 -0
  161. package/dist/hooks/use-product-by-slug.d.ts +7 -0
  162. package/dist/hooks/use-product-by-slug.d.ts.map +1 -0
  163. package/dist/hooks/use-product-by-slug.js +38 -0
  164. package/dist/hooks/use-product-reviews.d.ts +15 -0
  165. package/dist/hooks/use-product-reviews.d.ts.map +1 -0
  166. package/dist/hooks/use-product-reviews.js +75 -0
  167. package/dist/hooks/use-product-variation-selection.d.ts +2 -8
  168. package/dist/hooks/use-product-variation-selection.d.ts.map +1 -1
  169. package/dist/hooks/use-product-variation-selection.js +1 -1
  170. package/dist/hooks/use-products-api.js +3 -3
  171. package/dist/hooks/use-shipping-quote.js +2 -2
  172. package/dist/hooks/use-store-api.js +4 -4
  173. package/dist/hooks/usePreviewSlideSync.js +1 -1
  174. package/dist/index.d.ts +62 -74
  175. package/dist/index.d.ts.map +1 -1
  176. package/dist/index.js +141 -153
  177. package/dist/layouts/booking/components/BookingHomePage.d.ts.map +1 -1
  178. package/dist/layouts/booking/components/BookingHomePage.js +68 -74
  179. package/dist/layouts/booking/components/BookingMultilineHeading.js +1 -1
  180. package/dist/layouts/booking/components/BookingTestimonialCard.js +2 -2
  181. package/dist/layouts/booking/components/BookingTestimonialsEmptyState.js +1 -1
  182. package/dist/layouts/booking/components/booking-footer-defaults.js +2 -2
  183. package/dist/layouts/booking/index.js +8 -8
  184. package/dist/layouts/booking/pages/AboutPage.d.ts +1 -1
  185. package/dist/layouts/booking/pages/AboutPage.d.ts.map +1 -1
  186. package/dist/layouts/booking/pages/AboutPage.js +39 -60
  187. package/dist/layouts/booking/pages/BookPage.d.ts.map +1 -1
  188. package/dist/layouts/booking/pages/BookPage.js +16 -22
  189. package/dist/layouts/booking/pages/CategoriesPage.js +6 -6
  190. package/dist/layouts/booking/pages/CategoryPage.d.ts +1 -1
  191. package/dist/layouts/booking/pages/CategoryPage.d.ts.map +1 -1
  192. package/dist/layouts/booking/pages/CategoryPage.js +17 -26
  193. package/dist/layouts/booking/pages/ContactPage.d.ts +1 -1
  194. package/dist/layouts/booking/pages/ContactPage.d.ts.map +1 -1
  195. package/dist/layouts/booking/pages/ContactPage.js +5 -12
  196. package/dist/layouts/booking/pages/ProductDetailPage.d.ts +1 -1
  197. package/dist/layouts/booking/pages/ProductDetailPage.d.ts.map +1 -1
  198. package/dist/layouts/booking/pages/ProductDetailPage.js +203 -150
  199. package/dist/layouts/booking/pages/ServicesPage.d.ts +1 -1
  200. package/dist/layouts/booking/pages/ServicesPage.d.ts.map +1 -1
  201. package/dist/layouts/booking/pages/ServicesPage.js +11 -31
  202. package/dist/layouts/booking-agenda/components/BookingHomePageAgenda.d.ts.map +1 -1
  203. package/dist/layouts/booking-agenda/components/BookingHomePageAgenda.js +21 -30
  204. package/dist/layouts/booking-agenda/index.js +8 -8
  205. package/dist/layouts/booking-agenda/pages/AboutPage.d.ts +1 -1
  206. package/dist/layouts/booking-agenda/pages/AboutPage.d.ts.map +1 -1
  207. package/dist/layouts/booking-agenda/pages/AboutPage.js +11 -14
  208. package/dist/layouts/booking-agenda/pages/BookPage.d.ts.map +1 -1
  209. package/dist/layouts/booking-agenda/pages/BookPage.js +15 -21
  210. package/dist/layouts/booking-agenda/pages/CategoriesPage.js +5 -5
  211. package/dist/layouts/booking-agenda/pages/CategoryPage.d.ts +1 -1
  212. package/dist/layouts/booking-agenda/pages/CategoryPage.d.ts.map +1 -1
  213. package/dist/layouts/booking-agenda/pages/CategoryPage.js +12 -18
  214. package/dist/layouts/booking-agenda/pages/ContactPage.d.ts +1 -1
  215. package/dist/layouts/booking-agenda/pages/ContactPage.d.ts.map +1 -1
  216. package/dist/layouts/booking-agenda/pages/ContactPage.js +8 -13
  217. package/dist/layouts/booking-agenda/pages/ProductDetailPage.d.ts +1 -1
  218. package/dist/layouts/booking-agenda/pages/ProductDetailPage.d.ts.map +1 -1
  219. package/dist/layouts/booking-agenda/pages/ProductDetailPage.js +202 -149
  220. package/dist/layouts/booking-agenda/pages/ServicesPage.d.ts +1 -1
  221. package/dist/layouts/booking-agenda/pages/ServicesPage.d.ts.map +1 -1
  222. package/dist/layouts/booking-agenda/pages/ServicesPage.js +8 -23
  223. package/dist/layouts/clothing/components/ClothingHomePage.d.ts.map +1 -1
  224. package/dist/layouts/clothing/components/ClothingHomePage.js +199 -136
  225. package/dist/layouts/clothing/index.js +7 -7
  226. package/dist/layouts/clothing/pages/AboutPage.d.ts +1 -1
  227. package/dist/layouts/clothing/pages/AboutPage.d.ts.map +1 -1
  228. package/dist/layouts/clothing/pages/AboutPage.js +19 -33
  229. package/dist/layouts/clothing/pages/CategoriesPage.js +8 -8
  230. package/dist/layouts/clothing/pages/CategoryPage.d.ts +1 -1
  231. package/dist/layouts/clothing/pages/CategoryPage.d.ts.map +1 -1
  232. package/dist/layouts/clothing/pages/CategoryPage.js +15 -41
  233. package/dist/layouts/clothing/pages/ContactPage.d.ts +1 -1
  234. package/dist/layouts/clothing/pages/ContactPage.d.ts.map +1 -1
  235. package/dist/layouts/clothing/pages/ContactPage.js +5 -8
  236. package/dist/layouts/clothing/pages/ProductDetailPage.d.ts +1 -1
  237. package/dist/layouts/clothing/pages/ProductDetailPage.d.ts.map +1 -1
  238. package/dist/layouts/clothing/pages/ProductDetailPage.js +256 -167
  239. package/dist/layouts/clothing/pages/ProductsPage.d.ts +1 -1
  240. package/dist/layouts/clothing/pages/ProductsPage.d.ts.map +1 -1
  241. package/dist/layouts/clothing/pages/ProductsPage.js +125 -59
  242. package/dist/layouts/clothing/payaza-bindings.js +2 -2
  243. package/dist/layouts/clothing-minimal/components/ClothingHomePageMinimal.d.ts.map +1 -1
  244. package/dist/layouts/clothing-minimal/components/ClothingHomePageMinimal.js +32 -131
  245. package/dist/layouts/clothing-minimal/components/clothing-minimal-block-render.js +8 -8
  246. package/dist/layouts/clothing-minimal/index.js +7 -7
  247. package/dist/layouts/clothing-minimal/pages/AboutPage.d.ts +1 -1
  248. package/dist/layouts/clothing-minimal/pages/AboutPage.d.ts.map +1 -1
  249. package/dist/layouts/clothing-minimal/pages/AboutPage.js +37 -61
  250. package/dist/layouts/clothing-minimal/pages/CategoriesPage.js +7 -7
  251. package/dist/layouts/clothing-minimal/pages/CategoryPage.d.ts +1 -1
  252. package/dist/layouts/clothing-minimal/pages/CategoryPage.d.ts.map +1 -1
  253. package/dist/layouts/clothing-minimal/pages/CategoryPage.js +13 -18
  254. package/dist/layouts/clothing-minimal/pages/ContactPage.d.ts +1 -1
  255. package/dist/layouts/clothing-minimal/pages/ContactPage.d.ts.map +1 -1
  256. package/dist/layouts/clothing-minimal/pages/ContactPage.js +5 -8
  257. package/dist/layouts/clothing-minimal/pages/ProductDetailPage.d.ts +1 -1
  258. package/dist/layouts/clothing-minimal/pages/ProductDetailPage.d.ts.map +1 -1
  259. package/dist/layouts/clothing-minimal/pages/ProductDetailPage.js +202 -143
  260. package/dist/layouts/clothing-minimal/pages/ProductsPage.d.ts +1 -1
  261. package/dist/layouts/clothing-minimal/pages/ProductsPage.d.ts.map +1 -1
  262. package/dist/layouts/clothing-minimal/pages/ProductsPage.js +126 -57
  263. package/dist/layouts/electronics/components/ElectronicsCategoriesPage.js +7 -7
  264. package/dist/layouts/electronics/components/ElectronicsGridProductCard.js +10 -10
  265. package/dist/layouts/electronics/components/ElectronicsHomePage.d.ts.map +1 -1
  266. package/dist/layouts/electronics/components/ElectronicsHomePage.js +29 -31
  267. package/dist/layouts/electronics/components/ElectronicsPageWrapper.js +4 -4
  268. package/dist/layouts/electronics/components/ElectronicsProductsPage.d.ts.map +1 -1
  269. package/dist/layouts/electronics/components/ElectronicsProductsPage.js +81 -23
  270. package/dist/layouts/electronics/components/ElectronicsStoreFooter.js +2 -2
  271. package/dist/layouts/electronics/components/ElectronicsStoreHeader.js +6 -6
  272. package/dist/layouts/electronics/index.js +18 -18
  273. package/dist/layouts/electronics/pages/AboutPage.d.ts +1 -1
  274. package/dist/layouts/electronics/pages/AboutPage.d.ts.map +1 -1
  275. package/dist/layouts/electronics/pages/AboutPage.js +11 -14
  276. package/dist/layouts/electronics/pages/CategoriesPage.js +1 -1
  277. package/dist/layouts/electronics/pages/CategoryPage.d.ts +1 -1
  278. package/dist/layouts/electronics/pages/CategoryPage.d.ts.map +1 -1
  279. package/dist/layouts/electronics/pages/CategoryPage.js +14 -20
  280. package/dist/layouts/electronics/pages/ContactPage.d.ts +1 -1
  281. package/dist/layouts/electronics/pages/ContactPage.d.ts.map +1 -1
  282. package/dist/layouts/electronics/pages/ContactPage.js +8 -13
  283. package/dist/layouts/electronics/pages/HelpCenterPage.js +1 -1
  284. package/dist/layouts/electronics/pages/PrivacyPolicyPage.js +1 -1
  285. package/dist/layouts/electronics/pages/ProductDetailPage.d.ts +1 -1
  286. package/dist/layouts/electronics/pages/ProductDetailPage.d.ts.map +1 -1
  287. package/dist/layouts/electronics/pages/ProductDetailPage.js +201 -142
  288. package/dist/layouts/electronics/pages/ProductsPage.d.ts +1 -1
  289. package/dist/layouts/electronics/pages/ProductsPage.d.ts.map +1 -1
  290. package/dist/layouts/electronics/pages/ProductsPage.js +119 -49
  291. package/dist/layouts/electronics/pages/TermsPage.js +1 -1
  292. package/dist/layouts/electronics/pages/TrackOrderPage.js +4 -4
  293. package/dist/layouts/electronics-grid/components/ElectronicsGridProductCard.js +10 -10
  294. package/dist/layouts/electronics-grid/components/ElectronicsHomePageGrid.d.ts.map +1 -1
  295. package/dist/layouts/electronics-grid/components/ElectronicsHomePageGrid.js +75 -33
  296. package/dist/layouts/electronics-grid/index.js +14 -14
  297. package/dist/layouts/electronics-grid/pages/AboutPage.d.ts +1 -1
  298. package/dist/layouts/electronics-grid/pages/AboutPage.d.ts.map +1 -1
  299. package/dist/layouts/electronics-grid/pages/AboutPage.js +11 -14
  300. package/dist/layouts/electronics-grid/pages/CategoriesPage.js +1 -1
  301. package/dist/layouts/electronics-grid/pages/CategoryPage.d.ts +1 -1
  302. package/dist/layouts/electronics-grid/pages/CategoryPage.d.ts.map +1 -1
  303. package/dist/layouts/electronics-grid/pages/CategoryPage.js +14 -20
  304. package/dist/layouts/electronics-grid/pages/ContactPage.d.ts +1 -1
  305. package/dist/layouts/electronics-grid/pages/ContactPage.d.ts.map +1 -1
  306. package/dist/layouts/electronics-grid/pages/ContactPage.js +8 -13
  307. package/dist/layouts/electronics-grid/pages/ElectronicsGridCategoriesPage.js +6 -6
  308. package/dist/layouts/electronics-grid/pages/HelpCenterPage.js +1 -1
  309. package/dist/layouts/electronics-grid/pages/PrivacyPolicyPage.js +1 -1
  310. package/dist/layouts/electronics-grid/pages/ProductDetailPage.d.ts +1 -1
  311. package/dist/layouts/electronics-grid/pages/ProductDetailPage.d.ts.map +1 -1
  312. package/dist/layouts/electronics-grid/pages/ProductDetailPage.js +201 -142
  313. package/dist/layouts/electronics-grid/pages/ProductsPage.d.ts +1 -1
  314. package/dist/layouts/electronics-grid/pages/ProductsPage.d.ts.map +1 -1
  315. package/dist/layouts/electronics-grid/pages/ProductsPage.js +121 -52
  316. package/dist/layouts/electronics-grid/pages/TermsPage.js +1 -1
  317. package/dist/layouts/electronics-grid/pages/TrackOrderPage.js +4 -4
  318. package/dist/layouts/food/components/FoodHomePage.d.ts.map +1 -1
  319. package/dist/layouts/food/components/FoodHomePage.js +42 -41
  320. package/dist/layouts/food/index.js +8 -8
  321. package/dist/layouts/food/pages/AboutPage.d.ts +1 -1
  322. package/dist/layouts/food/pages/AboutPage.d.ts.map +1 -1
  323. package/dist/layouts/food/pages/AboutPage.js +44 -45
  324. package/dist/layouts/food/pages/CategoriesPage.js +6 -6
  325. package/dist/layouts/food/pages/CategoryPage.d.ts +1 -1
  326. package/dist/layouts/food/pages/CategoryPage.d.ts.map +1 -1
  327. package/dist/layouts/food/pages/CategoryPage.js +23 -21
  328. package/dist/layouts/food/pages/ContactPage.d.ts +1 -1
  329. package/dist/layouts/food/pages/ContactPage.d.ts.map +1 -1
  330. package/dist/layouts/food/pages/ContactPage.js +5 -7
  331. package/dist/layouts/food/pages/MenuPage.d.ts +1 -1
  332. package/dist/layouts/food/pages/MenuPage.d.ts.map +1 -1
  333. package/dist/layouts/food/pages/MenuPage.js +81 -42
  334. package/dist/layouts/food/pages/ProductDetailPage.d.ts +1 -1
  335. package/dist/layouts/food/pages/ProductDetailPage.d.ts.map +1 -1
  336. package/dist/layouts/food/pages/ProductDetailPage.js +209 -171
  337. package/dist/layouts/food/pages/ProductsPage.d.ts +1 -1
  338. package/dist/layouts/food/pages/ProductsPage.d.ts.map +1 -1
  339. package/dist/layouts/food/pages/ProductsPage.js +130 -45
  340. package/dist/layouts/food-modern/components/FoodHomePageModern.js +10 -10
  341. package/dist/layouts/food-modern/index.js +8 -8
  342. package/dist/layouts/food-modern/pages/AboutPage.d.ts +1 -1
  343. package/dist/layouts/food-modern/pages/AboutPage.d.ts.map +1 -1
  344. package/dist/layouts/food-modern/pages/AboutPage.js +11 -14
  345. package/dist/layouts/food-modern/pages/CategoriesPage.js +5 -5
  346. package/dist/layouts/food-modern/pages/CategoryPage.d.ts +1 -1
  347. package/dist/layouts/food-modern/pages/CategoryPage.d.ts.map +1 -1
  348. package/dist/layouts/food-modern/pages/CategoryPage.js +23 -20
  349. package/dist/layouts/food-modern/pages/ContactPage.d.ts +1 -1
  350. package/dist/layouts/food-modern/pages/ContactPage.d.ts.map +1 -1
  351. package/dist/layouts/food-modern/pages/ContactPage.js +5 -7
  352. package/dist/layouts/food-modern/pages/MenuPage.d.ts +1 -1
  353. package/dist/layouts/food-modern/pages/MenuPage.d.ts.map +1 -1
  354. package/dist/layouts/food-modern/pages/MenuPage.js +81 -46
  355. package/dist/layouts/food-modern/pages/ProductDetailPage.d.ts +1 -1
  356. package/dist/layouts/food-modern/pages/ProductDetailPage.d.ts.map +1 -1
  357. package/dist/layouts/food-modern/pages/ProductDetailPage.js +202 -143
  358. package/dist/layouts/food-modern/pages/ProductsPage.d.ts +1 -1
  359. package/dist/layouts/food-modern/pages/ProductsPage.d.ts.map +1 -1
  360. package/dist/layouts/food-modern/pages/ProductsPage.js +117 -33
  361. package/dist/layouts/motivational-speaker/components/MotivationalHomePage.d.ts.map +1 -1
  362. package/dist/layouts/motivational-speaker/components/MotivationalHomePage.js +32 -23
  363. package/dist/layouts/motivational-speaker/components/MotivationalSpeakerPageWrapper.js +1 -1
  364. package/dist/layouts/motivational-speaker/index.js +9 -9
  365. package/dist/layouts/motivational-speaker/pages/AboutPage.d.ts +1 -1
  366. package/dist/layouts/motivational-speaker/pages/AboutPage.d.ts.map +1 -1
  367. package/dist/layouts/motivational-speaker/pages/AboutPage.js +6 -9
  368. package/dist/layouts/motivational-speaker/pages/CategoryPage.d.ts +1 -1
  369. package/dist/layouts/motivational-speaker/pages/CategoryPage.d.ts.map +1 -1
  370. package/dist/layouts/motivational-speaker/pages/CategoryPage.js +18 -22
  371. package/dist/layouts/motivational-speaker/pages/ContactPage.d.ts +1 -1
  372. package/dist/layouts/motivational-speaker/pages/ContactPage.d.ts.map +1 -1
  373. package/dist/layouts/motivational-speaker/pages/ContactPage.js +9 -13
  374. package/dist/layouts/motivational-speaker/pages/ProductsPage.d.ts +1 -1
  375. package/dist/layouts/motivational-speaker/pages/ProductsPage.d.ts.map +1 -1
  376. package/dist/layouts/motivational-speaker/pages/ProductsPage.js +121 -52
  377. package/dist/layouts/motivational-speaker/pages/ServiceDetailPage.d.ts +1 -1
  378. package/dist/layouts/motivational-speaker/pages/ServiceDetailPage.d.ts.map +1 -1
  379. package/dist/layouts/motivational-speaker/pages/ServiceDetailPage.js +15 -24
  380. package/dist/layouts/motivational-speaker/pages/ServicesPage.d.ts +1 -1
  381. package/dist/layouts/motivational-speaker/pages/ServicesPage.d.ts.map +1 -1
  382. package/dist/layouts/motivational-speaker/pages/ServicesPage.js +8 -23
  383. package/dist/layouts/motivational-speaker/pages/SubscriptionPage.js +7 -7
  384. package/dist/layouts/shared/components/BaseStoreLayout.js +9 -9
  385. package/dist/layouts/shared/components/CartLineQuantityControl.js +1 -1
  386. package/dist/layouts/shared/components/GenericPageWrapper.js +3 -3
  387. package/dist/layouts/shared/components/ProductPriceFilterSection.js +4 -4
  388. package/dist/layouts/shared/components/PromoBanner.d.ts +1 -4
  389. package/dist/layouts/shared/components/PromoBanner.d.ts.map +1 -1
  390. package/dist/layouts/shared/components/PromoBanner.js +12 -8
  391. package/dist/layouts/shared/components/StoreFooter.js +10 -10
  392. package/dist/layouts/shared/components/StoreHeader.js +7 -7
  393. package/dist/layouts/shared/components/TestimonialCard.d.ts.map +1 -1
  394. package/dist/layouts/shared/components/TestimonialCard.js +2 -2
  395. package/dist/layouts/shared/components/headers/BookingAgendaSidebar.js +2 -2
  396. package/dist/layouts/shared/components/headers/ClothingMinimalHeader.js +11 -11
  397. package/dist/layouts/shared/components/headers/FoodModernHeader.js +7 -7
  398. package/dist/layouts/shared/index.js +22 -22
  399. package/dist/layouts/shared/pages/AccountPage.d.ts.map +1 -1
  400. package/dist/layouts/shared/pages/AccountPage.js +101 -27
  401. package/dist/layouts/shared/pages/CartPage.d.ts.map +1 -1
  402. package/dist/layouts/shared/pages/CartPage.js +39 -90
  403. package/dist/layouts/shared/pages/CheckoutPage.d.ts.map +1 -1
  404. package/dist/layouts/shared/pages/CheckoutPage.js +349 -868
  405. package/dist/layouts/shared/pages/CookiePolicyPage.js +1 -1
  406. package/dist/layouts/shared/pages/FeatureDisabledPage.js +1 -1
  407. package/dist/layouts/shared/pages/HelpCenterPage.js +1 -1
  408. package/dist/layouts/shared/pages/MaintenancePage.d.ts.map +1 -1
  409. package/dist/layouts/shared/pages/MaintenancePage.js +2 -3
  410. package/dist/layouts/shared/pages/PortfolioPage.d.ts.map +1 -1
  411. package/dist/layouts/shared/pages/PortfolioPage.js +2 -2
  412. package/dist/layouts/shared/pages/PrivacyPolicyPage.js +1 -1
  413. package/dist/layouts/shared/pages/SizeGuidePage.js +1 -1
  414. package/dist/layouts/shared/pages/StyleGuidePage.js +3 -3
  415. package/dist/layouts/shared/pages/TeamPage.d.ts.map +1 -1
  416. package/dist/layouts/shared/pages/TeamPage.js +1 -1
  417. package/dist/layouts/shared/pages/TermsPage.js +1 -1
  418. package/dist/layouts/shared/pages/TrackOrderPage.js +4 -4
  419. package/dist/layouts/shared/pages/WishlistPage.d.ts.map +1 -1
  420. package/dist/layouts/shared/pages/WishlistPage.js +44 -29
  421. package/dist/layouts/shared/wrappers/BookingAgendaLayout.d.ts.map +1 -1
  422. package/dist/layouts/shared/wrappers/BookingAgendaLayout.js +80 -35
  423. package/dist/layouts/shared/wrappers/ClothingLayout.js +8 -8
  424. package/dist/layouts/shared/wrappers/ClothingMinimalLayout.js +7 -7
  425. package/dist/layouts/shared/wrappers/ElectronicsLayout.js +5 -5
  426. package/dist/layouts/shared/wrappers/FoodModernLayout.js +6 -6
  427. package/dist/layouts/shared/wrappers/MotivationalLayout.js +9 -9
  428. package/dist/layouts/shared/wrappers/StandardLayout.js +8 -8
  429. package/dist/lib/api.d.ts +3 -4
  430. package/dist/lib/api.d.ts.map +1 -1
  431. package/dist/lib/api.js +69 -109
  432. package/dist/lib/auth-context.js +2 -2
  433. package/dist/lib/content-selectors.d.ts +1 -1
  434. package/dist/lib/content-selectors.d.ts.map +1 -1
  435. package/dist/lib/content-selectors.js +8 -0
  436. package/dist/lib/layout-config-hydration.js +2 -2
  437. package/dist/lib/loading-context.d.ts.map +1 -1
  438. package/dist/lib/loading-context.js +11 -21
  439. package/dist/lib/payaza-checkout.d.ts.map +1 -1
  440. package/dist/lib/payaza-checkout.js +2 -4
  441. package/dist/lib/payaza-public-key.d.ts +6 -0
  442. package/dist/lib/payaza-public-key.d.ts.map +1 -0
  443. package/dist/lib/payaza-public-key.js +10 -0
  444. package/dist/lib/rich-html.d.ts +31 -26
  445. package/dist/lib/rich-html.d.ts.map +1 -1
  446. package/dist/lib/rich-html.js +1 -0
  447. package/dist/lib/services/analytics.service.js +1 -1
  448. package/dist/lib/services/auth.service.js +1 -1
  449. package/dist/lib/services/booking.service.js +1 -1
  450. package/dist/lib/services/category.service.js +1 -1
  451. package/dist/lib/services/checkout.service.d.ts +3 -0
  452. package/dist/lib/services/checkout.service.d.ts.map +1 -1
  453. package/dist/lib/services/checkout.service.js +1 -1
  454. package/dist/lib/services/contact.service.js +1 -1
  455. package/dist/lib/services/customer.service.js +1 -1
  456. package/dist/lib/services/fees.service.d.ts +17 -63
  457. package/dist/lib/services/fees.service.d.ts.map +1 -1
  458. package/dist/lib/services/fees.service.js +4 -138
  459. package/dist/lib/services/index.js +13 -13
  460. package/dist/lib/services/location.service.js +1 -1
  461. package/dist/lib/services/order.service.js +1 -1
  462. package/dist/lib/services/payment.service.js +1 -1
  463. package/dist/lib/services/product.service.d.ts +7 -2
  464. package/dist/lib/services/product.service.d.ts.map +1 -1
  465. package/dist/lib/services/product.service.js +13 -1
  466. package/dist/lib/services/promo.service.js +1 -1
  467. package/dist/lib/services/review.service.js +1 -1
  468. package/dist/lib/services/service.service.js +1 -1
  469. package/dist/lib/services/shipping.service.js +1 -1
  470. package/dist/lib/services/store.service.js +1 -1
  471. package/dist/lib/store-config-utils.d.ts +1 -10
  472. package/dist/lib/store-config-utils.d.ts.map +1 -1
  473. package/dist/lib/store-config-utils.js +73 -261
  474. package/dist/lib/store-config.js +1 -1
  475. package/dist/lib/store-context.d.ts +1 -23
  476. package/dist/lib/store-context.d.ts.map +1 -1
  477. package/dist/lib/store-context.js +89 -111
  478. package/dist/lib/store-types.d.ts +9 -91
  479. package/dist/lib/store-types.d.ts.map +1 -1
  480. package/dist/lib/utils/asset-helpers.js +1 -1
  481. package/dist/lib/utils/catalog-price-bounds.d.ts +16 -6
  482. package/dist/lib/utils/catalog-price-bounds.d.ts.map +1 -1
  483. package/dist/lib/utils/catalog-price-bounds.js +58 -14
  484. package/dist/lib/utils/category-tree.d.ts +9 -0
  485. package/dist/lib/utils/category-tree.d.ts.map +1 -1
  486. package/dist/lib/utils/category-tree.js +26 -0
  487. package/dist/lib/utils/editor-preview.d.ts +5 -0
  488. package/dist/lib/utils/editor-preview.d.ts.map +1 -1
  489. package/dist/lib/utils/editor-preview.js +17 -3
  490. package/dist/lib/utils/fee-calculations.d.ts +5 -1
  491. package/dist/lib/utils/fee-calculations.d.ts.map +1 -1
  492. package/dist/lib/utils/fee-calculations.js +28 -31
  493. package/dist/lib/utils/index.d.ts +1 -1
  494. package/dist/lib/utils/index.d.ts.map +1 -1
  495. package/dist/lib/utils/index.js +4 -4
  496. package/dist/lib/utils/product-images.js +1 -1
  497. package/dist/lib/utils/product-share.js +1 -1
  498. package/dist/lib/utils/url-helpers.d.ts +6 -0
  499. package/dist/lib/utils/url-helpers.d.ts.map +1 -1
  500. package/dist/lib/utils/url-helpers.js +20 -4
  501. package/dist/preview/LayoutPreview.js +6 -6
  502. package/dist/preview/PreviewRouter.js +4 -4
  503. package/dist/preview/canvas/PreviewCanvasEnhancer.js +8 -8
  504. package/dist/preview/canvas/preview-flush-await.js +1 -1
  505. package/dist/preview/canvas/preview-isolation.js +1 -1
  506. package/dist/preview/canvas/preview-route.js +2 -2
  507. package/dist/preview/index.js +5 -5
  508. package/dist/styles/index.css +190 -149
  509. package/package.json +31 -43
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Slot } from "@radix-ui/react-slot";
3
3
  import { cva } from "class-variance-authority";
4
- import { cn } from "../../lib/utils/index.js";
4
+ import { cn } from "../../lib/utils";
5
5
  const buttonVariants = cva("inline-flex cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive", {
6
6
  variants: {
7
7
  variant: {
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { cn } from "../../lib/utils/index.js";
2
+ import { cn } from "../../lib/utils";
3
3
  function Card({ className, ...props }) {
4
4
  return (_jsx("div", { "data-slot": "card", className: cn("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm", className), ...props }));
5
5
  }
@@ -2,9 +2,9 @@
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState, useMemo } from 'react';
4
4
  import Link from 'next/link';
5
- import { buildCategoryTree } from '../../lib/utils/category-tree.js';
5
+ import { buildCategoryTree } from '../../lib/utils/category-tree';
6
6
  import { ChevronDown, ChevronRight, Check } from 'lucide-react';
7
- import { cn, formatDisplayLabel } from '../../lib/utils/index.js';
7
+ import { cn, formatDisplayLabel } from '../../lib/utils';
8
8
  function CategoryItem({ category, level, selectedCategoryIds, onCategoryToggle, mode, onCategorySelect, expandedCategories, onToggleExpand, storeSlug, linkBasePath, }) {
9
9
  const hasChildren = category.children && category.children.length > 0;
10
10
  const isExpanded = expandedCategories.has(category.id);
@@ -1 +1 @@
1
- {"version":3,"file":"checkout-button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/checkout-button.tsx"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAahD,UAAU,mBAAmB;IAC3B,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAC1C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACrD;AAED,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,SAAS,EACT,QAAqB,EACrB,OAAmB,EACnB,IAAW,GACZ,EAAE,mBAAmB,2CAsXrB"}
1
+ {"version":3,"file":"checkout-button.d.ts","sourceRoot":"","sources":["../../../src/components/ui/checkout-button.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,UAAU,mBAAmB;IAC3B,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;IAC1C,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;CACrD;AAED,wBAAgB,cAAc,CAAC,EAC7B,WAAW,EACX,SAAS,EACT,QAAqB,EACrB,OAAmB,EACnB,IAAW,GACZ,EAAE,mBAAmB,2CAqCrB"}
@@ -1,258 +1,18 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { Button } from '../../components/ui/button.js';
4
- import { usePayazaCheckout } from '../../hooks/use-payaza-checkout.js';
5
- import { generateCheckoutConfig } from '../../lib/payaza-checkout.js';
6
- import { useStore } from '../../lib/store-context.js';
7
- import { useToast } from '../../components/ui/toast.js';
8
- import { useState, useRef } from 'react';
9
- import { GuestCheckoutModal } from './guest-checkout-modal.js';
10
- import { getGuestUserInfo, saveGuestUserInfo, hasCompleteGuestInfo } from '../../lib/guest-user.js';
3
+ import { Button } from '../../components/ui/button';
4
+ import { useStore } from '../../lib/store-context';
5
+ import { useToast } from '../../components/ui/toast';
11
6
  import { useRouter } from 'next/navigation';
12
- import { checkoutService } from '../../lib/services/checkout.service.js';
13
- import { normalizePrice } from '../../lib/utils/index.js';
14
- import { paymentService, isPaymentConfirmed } from '../../lib/services/payment.service.js';
15
- import { useAuth } from '../../lib/auth-context.js';
16
- import { setOrderSuccessJustCompleted } from '../../lib/order-success-cart.js';
17
- import { getOrCreateIdempotencyKey } from '../../lib/utils/idempotency-key.js';
18
- import { CHECKOUT_UNAVAILABLE_MESSAGE } from '../../lib/checkout-availability.js';
7
+ import { CHECKOUT_UNAVAILABLE_MESSAGE } from '../../lib/checkout-availability';
19
8
  export function CheckoutButton({ storeConfig, className, children = 'Checkout', variant = 'default', size = 'lg', }) {
20
- const { cart, cartTotal, removeOrderItemsFromCart } = useStore();
9
+ const { cart } = useStore();
21
10
  const { addToast } = useToast();
22
- const { user, isAuthenticated } = useAuth();
23
- const [isProcessing, setIsProcessing] = useState(false);
24
- const [showGuestModal, setShowGuestModal] = useState(false);
25
- const [pendingCheckout, setPendingCheckout] = useState(null);
26
11
  const router = useRouter();
27
- const lastCustomerEmailRef = useRef('');
28
- const checkoutIdempotencyKeyRef = useRef(null);
29
- const redirectToOrderSuccess = (orderId, transactionRef, orderNumber, customerEmail) => {
30
- setOrderSuccessJustCompleted(orderId);
31
- const search = new URLSearchParams({ orderId, ref: transactionRef });
32
- if (orderNumber)
33
- search.set('orderNumber', orderNumber);
34
- if (customerEmail)
35
- search.set('email', customerEmail);
36
- router.push(`/${storeConfig.slug}/order/success?${search.toString()}`);
37
- };
38
- const { checkout: initiateCheckout, isLoading } = usePayazaCheckout({
39
- onSuccess: async (response) => {
40
- try {
41
- setIsProcessing(true);
42
- const transactionRef = response.transactionRef || response.callbackData?.data?.transaction_reference;
43
- const customerEmail = lastCustomerEmailRef.current || getGuestUserInfo()?.email || '';
44
- if (!transactionRef) {
45
- addToast('Payment successful but no transaction reference. Please contact support.', 'info');
46
- setIsProcessing(false);
47
- return;
48
- }
49
- addToast('Verifying payment...', 'info');
50
- try {
51
- const immediateVerification = await paymentService.verifyPayment(transactionRef, storeConfig.id);
52
- if (immediateVerification.verified && isPaymentConfirmed(immediateVerification.paymentStatus)) {
53
- try {
54
- if (removeOrderItemsFromCart) {
55
- await removeOrderItemsFromCart(cart.map((item) => ({
56
- productId: item.productId,
57
- variantId: item.variantId,
58
- quantity: item.quantity,
59
- })));
60
- }
61
- }
62
- catch (cartError) {
63
- console.error('[CheckoutButton] Failed to clear cart after order:', cartError);
64
- }
65
- redirectToOrderSuccess(immediateVerification.orderId || transactionRef, transactionRef, immediateVerification.orderNumber, customerEmail);
66
- return;
67
- }
68
- }
69
- catch {
70
- // Continue with confirmation flow
71
- }
72
- if (response.callbackData) {
73
- const MAX_RETRIES = 3;
74
- const RETRY_DELAY = 1000;
75
- let confirmation;
76
- for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
77
- try {
78
- confirmation = await paymentService.confirmPaymentFromCallback(response.callbackData);
79
- break;
80
- }
81
- catch (error) {
82
- console.error(`[CheckoutButton] Payment confirmation attempt ${attempt} failed:`, error);
83
- if (attempt < MAX_RETRIES) {
84
- await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY * attempt));
85
- }
86
- }
87
- }
88
- if (!confirmation) {
89
- const polledVerification = await paymentService.pollPaymentStatus(transactionRef, storeConfig.id, { maxAttempts: 3, intervalMs: 1000 });
90
- if (polledVerification?.verified && isPaymentConfirmed(polledVerification.paymentStatus)) {
91
- redirectToOrderSuccess(polledVerification.orderId || transactionRef, transactionRef, polledVerification.orderNumber, customerEmail);
92
- return;
93
- }
94
- addToast('Payment successful. Verifying transaction...', 'info');
95
- router.push(`/${storeConfig.slug}/payment/callback?reference=${transactionRef}&storeId=${storeConfig.id}`);
96
- return;
97
- }
98
- try {
99
- if (removeOrderItemsFromCart) {
100
- await removeOrderItemsFromCart(cart.map((item) => ({
101
- productId: item.productId,
102
- variantId: item.variantId,
103
- quantity: item.quantity,
104
- })));
105
- }
106
- }
107
- catch (cartError) {
108
- console.error('[CheckoutButton] Failed to clear cart after order:', cartError);
109
- }
110
- redirectToOrderSuccess(confirmation.orderId, transactionRef, confirmation.orderNumber, customerEmail);
111
- return;
112
- }
113
- router.push(`/${storeConfig.slug}/payment/callback?reference=${transactionRef}&storeId=${storeConfig.id}`);
114
- }
115
- catch (error) {
116
- console.error('[CheckoutButton] Error processing payment callback:', error);
117
- const transactionRef = response.transactionRef || response.callbackData?.data?.transaction_reference;
118
- if (transactionRef) {
119
- addToast('Payment successful. Verifying transaction...', 'info');
120
- router.push(`/${storeConfig.slug}/payment/callback?reference=${transactionRef}&storeId=${storeConfig.id}`);
121
- }
122
- else {
123
- addToast('Payment successful but verification failed. Please contact support.', 'error');
124
- setIsProcessing(false);
125
- }
126
- }
127
- },
128
- onError: (error) => {
129
- addToast(`Checkout error: ${error}`, 'error');
130
- setIsProcessing(false);
131
- },
132
- onClose: () => {
133
- // onClose is only called when payment was not successful (user canceled)
134
- // This is now handled correctly by payaza-checkout.ts tracking payment success state
135
- addToast('Payment canceled', 'info');
136
- setIsProcessing(false);
137
- },
138
- });
139
- const payazaPublicKey = storeConfig.payment?.payazaPublicKey || process.env.NEXT_PUBLIC_PAYAZA_PUBLIC_KEY || '';
140
- const proceedWithCheckout = async (userInfo) => {
141
- if (storeConfig.checkoutEnabled === false) {
142
- addToast(CHECKOUT_UNAVAILABLE_MESSAGE, 'error');
143
- return;
144
- }
145
- if (cart.length === 0) {
146
- addToast('Your cart is empty', 'error');
147
- return;
148
- }
149
- setIsProcessing(true);
150
- // DEMO MODE BYPASS
151
- if (storeConfig.slug.startsWith('demo/')) {
152
- setTimeout(() => {
153
- router.push(`/${storeConfig.slug}/payment/callback?status=success&reference=DEMO-${Date.now()}`);
154
- }, 1500);
155
- return;
156
- }
157
- try {
158
- // Use authenticated user info if available, otherwise use guest info
159
- const customerEmail = isAuthenticated && user ? user.email : (userInfo?.email || '');
160
- const customerFirstName = isAuthenticated && user ? user.firstName : (userInfo?.firstName || '');
161
- const customerLastName = isAuthenticated && user ? user.lastName : (userInfo?.lastName || '');
162
- const customerPhone = isAuthenticated && user ? (user.phone || '') : (userInfo?.phone || '');
163
- lastCustomerEmailRef.current = customerEmail;
164
- // Step 1: Create order via API before payment
165
- const checkoutResponse = await checkoutService.processCheckout({
166
- storeId: storeConfig.id,
167
- items: cart.map(item => ({
168
- productId: item.productId,
169
- quantity: Number(item.quantity) || 1,
170
- price: normalizePrice(item.price),
171
- variationId: item.variantId && item.variantId.match(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i)
172
- ? item.variantId
173
- : undefined,
174
- variantId: item.variantId ?? undefined,
175
- })),
176
- customerInfo: {
177
- email: customerEmail,
178
- firstName: customerFirstName,
179
- lastName: customerLastName,
180
- phone: customerPhone,
181
- },
182
- shippingAddress: {
183
- firstName: customerFirstName,
184
- lastName: customerLastName,
185
- address1: isAuthenticated && user?.address ? user.address : 'Address to be provided',
186
- city: isAuthenticated && user?.city ? user.city : 'City',
187
- state: isAuthenticated && user?.state ? user.state : 'State',
188
- zipCode: isAuthenticated && user?.zipCode ? user.zipCode : '00000',
189
- country: isAuthenticated && user?.country ? user.country : 'Country',
190
- phone: customerPhone,
191
- },
192
- paymentMethod: 'payaza',
193
- customerId: isAuthenticated && user ? user.id : undefined, // Pass customerId for authenticated users
194
- }, {
195
- idempotencyKey: getOrCreateIdempotencyKey(checkoutIdempotencyKeyRef),
196
- });
197
- // Backend currency-resolved key first, then store config / env fallback (same as CheckoutPage).
198
- const resolvedPayazaKey = checkoutResponse.payazaPublicKey || payazaPublicKey;
199
- if (!resolvedPayazaKey) {
200
- addToast('Payment gateway not configured for this currency. Please contact support.', 'error');
201
- setIsProcessing(false);
202
- return;
203
- }
204
- // Step 2: Convert cart items to checkout format for Payaza (preserve currency so Payaza uses same currency as displayed)
205
- const storeCurrency = storeConfig.settings?.currency;
206
- const checkoutItems = cart.map(item => ({
207
- product: {
208
- name: item.product.name,
209
- price: item.price,
210
- currency: item.product.currency || item.currency || storeCurrency,
211
- },
212
- quantity: item.quantity,
213
- price: item.price,
214
- }));
215
- // Prefer cart/store currency over API response so checkout does not switch to USD
216
- const displayCurrency = (cart[0]?.currency ?? cart[0]?.product?.currency) || storeCurrency || checkoutResponse.currency;
217
- // Step 3: Generate Payaza checkout config with order details
218
- const checkoutConfig = generateCheckoutConfig(checkoutItems, customerEmail, resolvedPayazaKey, {
219
- firstName: customerFirstName,
220
- lastName: customerLastName,
221
- phone: customerPhone,
222
- callbackUrl: `${typeof window !== 'undefined' ? window.location.origin : ''}/${storeConfig.slug}/payment/callback?storeId=${storeConfig.id}`,
223
- currency: displayCurrency,
224
- storeId: storeConfig.id,
225
- orderId: checkoutResponse.orderId,
226
- orderNumber: checkoutResponse.orderNumber,
227
- merchantReference: checkoutResponse.merchantReference || checkoutResponse.orderNumber,
228
- totalAmount: checkoutResponse.totalAmount,
229
- connectionMode: checkoutResponse.payazaConnectionMode,
230
- shippingAddress: {
231
- firstName: customerFirstName,
232
- lastName: customerLastName,
233
- address: isAuthenticated && user?.address ? user.address : 'Address to be provided',
234
- city: isAuthenticated && user?.city ? user.city : 'City',
235
- state: isAuthenticated && user?.state ? user.state : 'State',
236
- country: isAuthenticated && user?.country ? user.country : 'Country',
237
- zipCode: isAuthenticated && user?.zipCode ? user.zipCode : '00000',
238
- },
239
- });
240
- // Step 4: Use transaction reference from order
241
- checkoutConfig.reference = checkoutResponse.transactionReference;
242
- await initiateCheckout(checkoutConfig);
243
- }
244
- catch (error) {
245
- const err = error;
246
- const isCollectionsDisabled = err?.response?.status === 403 &&
247
- (err?.response?.data?.code === 'COLLECTIONS_DISABLED' ||
248
- err?.response?.data?.message?.toLowerCase().includes('not accepting payments'));
249
- addToast(isCollectionsDisabled ? CHECKOUT_UNAVAILABLE_MESSAGE : 'Failed to initiate checkout. Please try again.', 'error');
250
- console.error('Checkout error:', error);
251
- setIsProcessing(false);
252
- }
253
- };
254
- const handleCheckout = async () => {
255
- if (storeConfig.checkoutEnabled === false) {
12
+ const checkoutDisabled = storeConfig.checkoutEnabled === false;
13
+ const isDisabled = cart.length === 0 || checkoutDisabled;
14
+ const handleCheckout = () => {
15
+ if (checkoutDisabled) {
256
16
  addToast(CHECKOUT_UNAVAILABLE_MESSAGE, 'error');
257
17
  return;
258
18
  }
@@ -260,39 +20,7 @@ export function CheckoutButton({ storeConfig, className, children = 'Checkout',
260
20
  addToast('Your cart is empty', 'error');
261
21
  return;
262
22
  }
263
- // If user is authenticated, proceed directly with their info
264
- if (isAuthenticated && user) {
265
- await proceedWithCheckout();
266
- return;
267
- }
268
- // For guest users, check if we have complete guest user info
269
- const guestInfo = getGuestUserInfo();
270
- if (hasCompleteGuestInfo() && guestInfo) {
271
- // Proceed directly with guest info
272
- await proceedWithCheckout(guestInfo);
273
- }
274
- else {
275
- // Show modal to collect guest info
276
- setShowGuestModal(true);
277
- setPendingCheckout(() => () => {
278
- const info = getGuestUserInfo();
279
- if (info) {
280
- proceedWithCheckout(info);
281
- }
282
- });
283
- }
23
+ router.push(`/${storeConfig.slug}/checkout`);
284
24
  };
285
- const handleGuestInfoSubmit = (userInfo) => {
286
- // Save guest info to localStorage
287
- saveGuestUserInfo(userInfo);
288
- setShowGuestModal(false);
289
- // Proceed with checkout
290
- proceedWithCheckout(userInfo);
291
- };
292
- const checkoutDisabled = storeConfig.checkoutEnabled === false;
293
- const isDisabled = isLoading || isProcessing || cart.length === 0 || checkoutDisabled;
294
- return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: handleCheckout, disabled: isDisabled, variant: variant, size: size, className: className, title: checkoutDisabled ? CHECKOUT_UNAVAILABLE_MESSAGE : undefined, children: isLoading || isProcessing ? 'Processing...' : checkoutDisabled ? 'Checkout unavailable' : children }), checkoutDisabled && (_jsx("p", { className: "mt-2 text-sm text-muted-foreground text-center", children: CHECKOUT_UNAVAILABLE_MESSAGE })), _jsx(GuestCheckoutModal, { isOpen: showGuestModal, onClose: () => {
295
- setShowGuestModal(false);
296
- setPendingCheckout(null);
297
- }, onSubmit: handleGuestInfoSubmit, initialData: getGuestUserInfo() || undefined })] }));
25
+ return (_jsxs(_Fragment, { children: [_jsx(Button, { onClick: handleCheckout, disabled: isDisabled, variant: variant, size: size, className: className, title: checkoutDisabled ? CHECKOUT_UNAVAILABLE_MESSAGE : undefined, children: checkoutDisabled ? 'Checkout unavailable' : children }), checkoutDisabled && (_jsx("p", { className: "mt-2 text-sm text-muted-foreground text-center", children: CHECKOUT_UNAVAILABLE_MESSAGE }))] }));
298
26
  }
@@ -1,10 +1,10 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import * as React from 'react';
4
- import { Modal } from './modal.js';
5
- import { Button } from './button.js';
4
+ import { Modal } from './modal';
5
+ import { Button } from './button';
6
6
  import { User, Mail, Phone, ShoppingBag, ShieldCheck, ArrowRight } from 'lucide-react';
7
- import { cn } from '../../lib/utils/index.js';
7
+ import { cn } from '../../lib/utils';
8
8
  export function GuestCheckoutModal({ isOpen, onClose, onSubmit, initialData, }) {
9
9
  const [formData, setFormData] = React.useState({
10
10
  firstName: initialData?.firstName || '',
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { cn } from '../../lib/utils/index.js';
4
- import { Skeleton } from './skeleton.js';
3
+ import { cn } from '../../lib/utils';
4
+ import { Skeleton } from './skeleton';
5
5
  export function ImageSkeleton({ className, aspectRatio = 'square' }) {
6
6
  const aspectRatioClasses = {
7
7
  square: 'aspect-square',
@@ -4,7 +4,9 @@ interface ImageWithFallbackProps extends React.ImgHTMLAttributes<HTMLImageElemen
4
4
  skeletonAspectRatio?: 'square' | '3/4' | '4/3' | '4/5' | '16/9' | 'auto';
5
5
  showSkeletonOnError?: boolean;
6
6
  lazy?: boolean;
7
+ /** Mark LCP / above-the-fold images so the browser prioritizes them. */
8
+ priority?: boolean;
7
9
  }
8
- export declare function ImageWithFallback({ src, alt, className, fallbackSrc, fallbackText, skeletonAspectRatio, showSkeletonOnError, lazy, ...props }: ImageWithFallbackProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function ImageWithFallback({ src, alt, className, fallbackSrc, fallbackText, skeletonAspectRatio, showSkeletonOnError, lazy, priority, ...props }: ImageWithFallbackProps): import("react/jsx-runtime").JSX.Element;
9
11
  export {};
10
12
  //# sourceMappingURL=image-with-fallback.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"image-with-fallback.d.ts","sourceRoot":"","sources":["../../../src/components/ui/image-with-fallback.tsx"],"names":[],"mappings":"AAMA,UAAU,sBAAuB,SAAQ,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IACzE,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAqCD,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,GAAG,EACH,SAAS,EACT,WAAW,EACX,YAAY,EACZ,mBAA8B,EAC9B,mBAA0B,EAC1B,IAAY,EACZ,GAAG,KAAK,EACT,EAAE,sBAAsB,2CAsNxB"}
1
+ {"version":3,"file":"image-with-fallback.d.ts","sourceRoot":"","sources":["../../../src/components/ui/image-with-fallback.tsx"],"names":[],"mappings":"AAMA,UAAU,sBAAuB,SAAQ,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mBAAmB,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IACzE,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,wEAAwE;IACxE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAKD,wBAAgB,iBAAiB,CAAC,EAChC,GAAG,EACH,GAAG,EACH,SAAS,EACT,WAAW,EACX,YAAY,EACZ,mBAA8B,EAC9B,mBAA0B,EAC1B,IAAY,EACZ,QAAgB,EAChB,GAAG,KAAK,EACT,EAAE,sBAAsB,2CA+GxB"}
@@ -1,165 +1,81 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState, useEffect, useRef } from 'react';
4
- import { cn } from '../../lib/utils/index.js';
5
- import { ImageSkeleton } from './image-skeleton.js';
6
- function extractSrcUrl(input) {
7
- if (!input)
8
- return undefined;
9
- if (typeof input === 'string') {
10
- const trimmed = input.trim();
11
- return trimmed.length > 0 ? trimmed : undefined;
12
- }
13
- if (typeof input === 'object' && input !== null) {
14
- const obj = input;
15
- for (const key of ['url', 'src', 'image', 'imageUrl']) {
16
- const value = obj[key];
17
- if (typeof value === 'string' && value.trim())
18
- return value.trim();
19
- }
20
- }
21
- if (Array.isArray(input) && input.length > 0) {
22
- return extractSrcUrl(input[0]);
23
- }
24
- return undefined;
25
- }
26
- /** Keeps `[data-payaza-*]` on the clickable wrapper so skeletons/overlays still resolve image targets */
27
- function partitionDataAttrs(props) {
28
- const dataAttrs = {};
29
- const imgProps = {};
30
- for (const [key, val] of Object.entries(props)) {
31
- if (key.startsWith('data-') && val != null && val !== '') {
32
- dataAttrs[key] = typeof val === 'string' ? val : String(val);
33
- }
34
- else if (val !== undefined) {
35
- imgProps[key] = val;
36
- }
37
- }
38
- return { dataAttrs, imgProps };
39
- }
40
- export function ImageWithFallback({ src, alt, className, fallbackSrc, fallbackText, skeletonAspectRatio = 'square', showSkeletonOnError = true, lazy = false, ...props }) {
41
- const { dataAttrs, imgProps } = partitionDataAttrs(props);
42
- const initialSrc = extractSrcUrl(src) || extractSrcUrl(fallbackSrc);
43
- const [isLoading, setIsLoading] = useState(!!initialSrc && !lazy);
4
+ import { cn } from '../../lib/utils';
5
+ import { ImageSkeleton } from './image-skeleton';
6
+ const MAX_RETRIES = 2;
7
+ const RETRY_DELAY_MS = 400;
8
+ export function ImageWithFallback({ src, alt, className, fallbackSrc, fallbackText, skeletonAspectRatio = 'square', showSkeletonOnError = true, lazy = false, priority = false, ...props }) {
9
+ const initialSrc = typeof src === 'string' && src.trim() ? src : undefined;
44
10
  const [error, setError] = useState(false);
45
- const [currentSrc, setCurrentSrc] = useState(lazy ? undefined : initialSrc);
46
- const [isInView, setIsInView] = useState(!lazy);
11
+ const [currentSrc, setCurrentSrc] = useState(initialSrc);
12
+ const [reloadKey, setReloadKey] = useState(0);
47
13
  const prevSrcRef = useRef(src);
48
14
  const prevFallbackRef = useRef(fallbackSrc);
49
15
  const hasTriedFallback = useRef(false);
50
- const imageRef = useRef(null);
51
- const containerRef = useRef(null);
16
+ const retriesRef = useRef(0);
17
+ const retryTimerRef = useRef(null);
52
18
  const mountedRef = useRef(false);
53
19
  useEffect(() => {
54
20
  mountedRef.current = true;
55
21
  return () => {
56
22
  mountedRef.current = false;
23
+ if (retryTimerRef.current)
24
+ clearTimeout(retryTimerRef.current);
57
25
  };
58
26
  }, []);
59
27
  useEffect(() => {
60
- if (!lazy || !containerRef.current || isInView)
28
+ const currentSrcValue = typeof src === 'string' && src.trim() ? src : undefined;
29
+ const hasChanged = currentSrcValue !== prevSrcRef.current || fallbackSrc !== prevFallbackRef.current;
30
+ if (!hasChanged)
61
31
  return;
62
- const observer = new IntersectionObserver((entries) => {
63
- entries.forEach((entry) => {
64
- if (entry.isIntersecting) {
65
- setIsInView(true);
66
- const srcUrl = extractSrcUrl(src) || extractSrcUrl(fallbackSrc);
67
- if (srcUrl) {
68
- setCurrentSrc(srcUrl);
69
- setIsLoading(true);
70
- }
71
- observer.disconnect();
72
- }
73
- });
74
- }, { rootMargin: '100px', threshold: 0.01 });
75
- observer.observe(containerRef.current);
76
- return () => observer.disconnect();
77
- }, [lazy, isInView, src, fallbackSrc]);
78
- useEffect(() => {
79
- const currentSrcValue = extractSrcUrl(src);
80
- const extractedFallback = extractSrcUrl(fallbackSrc);
81
- const hasChanged = currentSrcValue !== extractSrcUrl(prevSrcRef.current) ||
82
- extractedFallback !== extractSrcUrl(prevFallbackRef.current);
83
- if (hasChanged) {
84
- const newSrc = currentSrcValue || extractedFallback;
85
- setIsLoading(!!newSrc && !lazy);
86
- setCurrentSrc(lazy && !isInView ? undefined : newSrc);
87
- setError(false);
88
- hasTriedFallback.current = false;
89
- prevSrcRef.current = src;
90
- prevFallbackRef.current = fallbackSrc;
91
- if (imageRef.current) {
92
- imageRef.current.src = '';
93
- }
94
- }
95
- }, [src, fallbackSrc, lazy, isInView]);
96
- const checkAndUpdateImageState = (img, forceCheck = false) => {
97
- if (!mountedRef.current || !img)
98
- return false;
99
- if (img.complete && img.naturalHeight !== 0) {
100
- if (forceCheck || isLoading) {
101
- setIsLoading(false);
102
- setError(false);
103
- return true;
104
- }
105
- }
106
- return false;
107
- };
108
- useEffect(() => {
109
- if (!mountedRef.current || !currentSrc || !isLoading)
110
- return;
111
- const syncLoadedState = () => {
112
- if (imageRef.current) {
113
- checkAndUpdateImageState(imageRef.current, true);
114
- }
115
- };
116
- syncLoadedState();
117
- const rafId = requestAnimationFrame(syncLoadedState);
118
- const timeoutId = window.setTimeout(syncLoadedState, 100);
119
- return () => {
120
- cancelAnimationFrame(rafId);
121
- window.clearTimeout(timeoutId);
122
- };
123
- }, [currentSrc, isLoading]);
124
- const handleLoad = () => {
125
- if (mountedRef.current) {
126
- setIsLoading(false);
127
- setError(false);
128
- }
129
- };
32
+ if (retryTimerRef.current)
33
+ clearTimeout(retryTimerRef.current);
34
+ const newSrc = currentSrcValue || (fallbackSrc && fallbackSrc.trim() ? fallbackSrc : undefined);
35
+ setCurrentSrc(newSrc);
36
+ setError(false);
37
+ setReloadKey(0);
38
+ hasTriedFallback.current = false;
39
+ retriesRef.current = 0;
40
+ prevSrcRef.current = currentSrcValue;
41
+ prevFallbackRef.current = fallbackSrc;
42
+ }, [src, fallbackSrc]);
130
43
  const handleError = () => {
131
- const extractedFallback = extractSrcUrl(fallbackSrc);
132
- if (extractedFallback && !hasTriedFallback.current && currentSrc !== extractedFallback) {
44
+ if (!mountedRef.current)
45
+ return;
46
+ if (fallbackSrc && fallbackSrc.trim() && !hasTriedFallback.current && currentSrc !== fallbackSrc) {
133
47
  hasTriedFallback.current = true;
134
- setCurrentSrc(extractedFallback);
48
+ retriesRef.current = 0;
49
+ setCurrentSrc(fallbackSrc);
135
50
  setError(false);
136
- setIsLoading(true);
137
51
  return;
138
52
  }
53
+ if (retriesRef.current < MAX_RETRIES && currentSrc) {
54
+ retriesRef.current += 1;
55
+ if (retryTimerRef.current)
56
+ clearTimeout(retryTimerRef.current);
57
+ retryTimerRef.current = setTimeout(() => {
58
+ if (!mountedRef.current)
59
+ return;
60
+ setReloadKey((k) => k + 1);
61
+ setError(false);
62
+ }, RETRY_DELAY_MS * retriesRef.current);
63
+ return;
64
+ }
65
+ console.warn('[ImageWithFallback] Image failed to load:', {
66
+ currentSrc,
67
+ originalSrc: src,
68
+ fallbackSrc,
69
+ alt,
70
+ });
139
71
  setError(true);
140
- setIsLoading(false);
141
72
  };
142
- if (!currentSrc || (lazy && !isInView)) {
143
- return (_jsx("div", { ref: containerRef, className: cn('relative w-full h-full min-h-[100px]', className), ...dataAttrs, children: _jsx(ImageSkeleton, { className: "absolute inset-0 h-full w-full", aspectRatio: skeletonAspectRatio }) }));
144
- }
145
- if (isLoading && currentSrc) {
146
- return (_jsxs("div", { ref: containerRef, className: cn('relative w-full h-full', className), ...dataAttrs, children: [_jsx("img", { ref: (node) => {
147
- imageRef.current = node;
148
- if (node) {
149
- checkAndUpdateImageState(node, true);
150
- }
151
- }, src: currentSrc, alt: alt || 'Product image', className: "absolute inset-0 h-full w-full opacity-0", onLoad: handleLoad, onError: handleError, loading: "eager", decoding: "async", ...imgProps }), _jsx(ImageSkeleton, { className: "absolute inset-0 h-full w-full", aspectRatio: skeletonAspectRatio })] }));
73
+ if (!currentSrc) {
74
+ return _jsx(ImageSkeleton, { className: className, aspectRatio: skeletonAspectRatio });
152
75
  }
153
- if (error) {
154
- if (showSkeletonOnError && !fallbackText) {
155
- return (_jsx("div", { ref: containerRef, className: cn('relative w-full h-full min-h-[100px]', className), ...dataAttrs, children: _jsx(ImageSkeleton, { className: "absolute inset-0 h-full w-full", aspectRatio: skeletonAspectRatio }) }));
156
- }
157
- return (_jsxs("div", { ref: containerRef, className: cn('flex flex-col items-center justify-center bg-gray-100 text-gray-400 border border-gray-200', className), style: { minHeight: '100px' }, ...dataAttrs, children: [_jsx("svg", { className: "w-1/4 h-1/4 max-w-[48px] max-h-[48px] opacity-20", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }), fallbackText && (_jsx("span", { className: "text-[10px] uppercase tracking-widest font-bold mt-2 opacity-40", children: fallbackText }))] }));
76
+ const showErrorPlaceholder = error && (!showSkeletonOnError || !!fallbackText);
77
+ if (error && showSkeletonOnError && !fallbackText) {
78
+ return _jsx(ImageSkeleton, { className: className, aspectRatio: skeletonAspectRatio });
158
79
  }
159
- return (_jsx("div", { ref: containerRef, className: "relative w-full h-full", ...dataAttrs, children: _jsx("img", { ref: (node) => {
160
- imageRef.current = node;
161
- if (node) {
162
- checkAndUpdateImageState(node, true);
163
- }
164
- }, src: currentSrc, alt: alt || 'Product image', className: cn('h-full w-full object-cover', className), onLoad: handleLoad, onError: handleError, loading: lazy ? 'lazy' : 'eager', decoding: "async", ...imgProps }) }));
80
+ return (_jsxs("div", { className: cn('relative', className), children: [!error && (_jsx("img", { src: currentSrc, alt: alt || 'Product image', className: cn('absolute inset-0 h-full w-full', className), onError: handleError, loading: lazy && !priority ? 'lazy' : 'eager', decoding: priority ? 'sync' : 'async', fetchPriority: priority ? 'high' : lazy ? 'low' : 'auto', ...props }, `${currentSrc}-${reloadKey}`)), showErrorPlaceholder && (_jsxs("div", { className: cn('flex flex-col items-center justify-center bg-gray-100 text-gray-400 border border-gray-200', className), style: { minHeight: '100px' }, children: [_jsx("svg", { className: "w-1/4 h-1/4 max-w-[48px] max-h-[48px] opacity-20", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }), fallbackText && (_jsx("span", { className: "text-[10px] uppercase tracking-widest font-bold mt-2 opacity-40", children: fallbackText }))] }))] }));
165
81
  }
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
- import { cn } from "../../lib/utils/index.js";
3
+ import { cn } from "../../lib/utils";
4
4
  const Input = React.forwardRef(({ className, type, ...props }, ref) => {
5
5
  return (_jsx("input", { type: type, className: cn("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50", className), ref: ref, ...props }));
6
6
  });
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { cn } from '../../lib/utils/index.js';
4
- import { formatLimitedOfferEndsAt, isActiveLimitedTimeOffer, } from '../../lib/limited-time-offer.js';
3
+ import { cn } from '../../lib/utils';
4
+ import { formatLimitedOfferEndsAt, isActiveLimitedTimeOffer, } from '../../lib/limited-time-offer';
5
5
  export function LimitedTimeOfferBadge({ product, className, compact = false, }) {
6
6
  if (!isActiveLimitedTimeOffer(product))
7
7
  return null;