@salla.sa/twilight-theme-engine 1.0.144 → 1.0.146

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 (259) hide show
  1. package/dist/{AddToCartForm-LWT2QINY.js → AddToCartForm-ZZMT3ZRO.js} +3 -3
  2. package/dist/{AddToCartForm-LWT2QINY.js.map → AddToCartForm-ZZMT3ZRO.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-52C2OHXW.js → BlogAuthorPage-LVRGWFOC.js} +27 -27
  4. package/dist/{BlogAuthorPage-52C2OHXW.js.map → BlogAuthorPage-LVRGWFOC.js.map} +1 -1
  5. package/dist/{BlogCategoryPage-LBLIAN6Q.js → BlogCategoryPage-CONL6QSN.js} +27 -27
  6. package/dist/{BlogCategoryPage-LBLIAN6Q.js.map → BlogCategoryPage-CONL6QSN.js.map} +1 -1
  7. package/dist/{BlogPage-U56CLHI4.js → BlogPage-6ZA474IU.js} +25 -25
  8. package/dist/{BlogPage-U56CLHI4.js.map → BlogPage-6ZA474IU.js.map} +1 -1
  9. package/dist/{BlogSinglePage-NQJDYUFB.js → BlogSinglePage-W7WYKP7W.js} +25 -25
  10. package/dist/{BlogSinglePage-NQJDYUFB.js.map → BlogSinglePage-W7WYKP7W.js.map} +1 -1
  11. package/dist/{BlogTagPage-XP3XGVCO.js → BlogTagPage-G5JX7FSN.js} +27 -27
  12. package/dist/{BlogTagPage-XP3XGVCO.js.map → BlogTagPage-G5JX7FSN.js.map} +1 -1
  13. package/dist/{BrandsPage-22AET7DW.js → BrandsPage-TB5NDSGL.js} +26 -26
  14. package/dist/{BrandsPage-22AET7DW.js.map → BrandsPage-TB5NDSGL.js.map} +1 -1
  15. package/dist/{Breadcrumb-YTYXSTKO.js → Breadcrumb-EVZDJG7H.js} +25 -25
  16. package/dist/{Breadcrumb-YTYXSTKO.js.map → Breadcrumb-EVZDJG7H.js.map} +1 -1
  17. package/dist/{CartItem-UTU4GLDN.js → CartItem-D2LJIFGL.js} +25 -25
  18. package/dist/{CartItem-UTU4GLDN.js.map → CartItem-D2LJIFGL.js.map} +1 -1
  19. package/dist/{CartSummary-4UGWZ3B3.js → CartSummary-V4HYUEPB.js} +25 -25
  20. package/dist/{CartSummary-4UGWZ3B3.js.map → CartSummary-V4HYUEPB.js.map} +1 -1
  21. package/dist/{Copyright-B2GYPZBZ.js → Copyright-JLIFLENS.js} +3 -3
  22. package/dist/{Copyright-B2GYPZBZ.js.map → Copyright-JLIFLENS.js.map} +1 -1
  23. package/dist/{CustomerLayout-I4XFBCOH.js → CustomerLayout-JSIYPWY4.js} +25 -25
  24. package/dist/{CustomerLayout-I4XFBCOH.js.map → CustomerLayout-JSIYPWY4.js.map} +1 -1
  25. package/dist/{Footer-OWOF2AGC.js → Footer-BNIVXKRM.js} +4 -4
  26. package/dist/{Footer-OWOF2AGC.js.map → Footer-BNIVXKRM.js.map} +1 -1
  27. package/dist/{Header-KDJL4YRP.js → Header-DI3OK5TC.js} +11 -11
  28. package/dist/{Header-KDJL4YRP.js.map → Header-DI3OK5TC.js.map} +1 -1
  29. package/dist/{LatestProducts-YBFHXG5V.js → LatestProducts-PEIN355E.js} +27 -27
  30. package/dist/{LatestProducts-YBFHXG5V.js.map → LatestProducts-PEIN355E.js.map} +1 -1
  31. package/dist/{LoyaltyPage-GFWTFQA7.js → LoyaltyPage-GV6WMYVE.js} +25 -25
  32. package/dist/{LoyaltyPage-GFWTFQA7.js.map → LoyaltyPage-GV6WMYVE.js.map} +1 -1
  33. package/dist/{LoyaltyPointsPage-WJDZL6G4.js → LoyaltyPointsPage-QNOVSCKB.js} +8 -8
  34. package/dist/{LoyaltyPointsPage-WJDZL6G4.js.map → LoyaltyPointsPage-QNOVSCKB.js.map} +1 -1
  35. package/dist/{MainMenu-AWSLHAEE.js → MainMenu-IN5HUX3U.js} +7 -7
  36. package/dist/{MainMenu-AWSLHAEE.js.map → MainMenu-IN5HUX3U.js.map} +1 -1
  37. package/dist/{MasterLayout-ZMHHLGYL.js → MasterLayout-GHAXKYOR.js} +25 -25
  38. package/dist/{MasterLayout-ZMHHLGYL.js.map → MasterLayout-GHAXKYOR.js.map} +1 -1
  39. package/dist/{MobileMenu-56MF2EAS.js → MobileMenu-XU45EZMG.js} +26 -26
  40. package/dist/{MobileMenu-56MF2EAS.js.map → MobileMenu-XU45EZMG.js.map} +1 -1
  41. package/dist/{NotificationsPage-7QC66446.js → NotificationsPage-AMY7TARF.js} +25 -25
  42. package/dist/{NotificationsPage-7QC66446.js.map → NotificationsPage-AMY7TARF.js.map} +1 -1
  43. package/dist/{OrderSinglePage-WXJHUJ6C.js → OrderSinglePage-L2E6YH3Z.js} +26 -26
  44. package/dist/{OrderSinglePage-WXJHUJ6C.js.map → OrderSinglePage-L2E6YH3Z.js.map} +1 -1
  45. package/dist/{OrdersPage-ZNM4YGXR.js → OrdersPage-76ORWMJY.js} +25 -25
  46. package/dist/{OrdersPage-ZNM4YGXR.js.map → OrdersPage-76ORWMJY.js.map} +1 -1
  47. package/dist/{PageSingle-NQZM6O5A.js → PageSingle-D7I6EHBF.js} +6 -6
  48. package/dist/{PageSingle-NQZM6O5A.js.map → PageSingle-D7I6EHBF.js.map} +1 -1
  49. package/dist/{ProductDetails-N4KYBKBG.js → ProductDetails-BZVRXSCD.js} +7 -7
  50. package/dist/{ProductDetails-N4KYBKBG.js.map → ProductDetails-BZVRXSCD.js.map} +1 -1
  51. package/dist/{ProfilePage-XOGVATHX.js → ProfilePage-65NYRBON.js} +25 -25
  52. package/dist/{ProfilePage-XOGVATHX.js.map → ProfilePage-65NYRBON.js.map} +1 -1
  53. package/dist/{ReviewsPage-WOLLCLAY.js → ReviewsPage-C7NSCMBE.js} +3 -3
  54. package/dist/{ReviewsPage-WOLLCLAY.js.map → ReviewsPage-C7NSCMBE.js.map} +1 -1
  55. package/dist/{SeoCartWidget-EVJOTXPO.js → SeoCartWidget-GK3KC2M3.js} +25 -25
  56. package/dist/{SeoCartWidget-EVJOTXPO.js.map → SeoCartWidget-GK3KC2M3.js.map} +1 -1
  57. package/dist/{SettingsPage-LYDZFUF3.js → SettingsPage-7VGJBA5K.js} +25 -25
  58. package/dist/{SettingsPage-LYDZFUF3.js.map → SettingsPage-7VGJBA5K.js.map} +1 -1
  59. package/dist/{StoreClosedNotification-62SFSGRH.js → StoreClosedNotification-44JN2FZV.js} +26 -26
  60. package/dist/{StoreClosedNotification-62SFSGRH.js.map → StoreClosedNotification-44JN2FZV.js.map} +1 -1
  61. package/dist/{TestimonialsPage-WPZBQQO2.js → TestimonialsPage-KGCGTUJQ.js} +6 -6
  62. package/dist/{TestimonialsPage-WPZBQQO2.js.map → TestimonialsPage-KGCGTUJQ.js.map} +1 -1
  63. package/dist/{ThankYouPage-44VMBXGI.js → ThankYouPage-XWB4X236.js} +25 -25
  64. package/dist/{ThankYouPage-44VMBXGI.js.map → ThankYouPage-XWB4X236.js.map} +1 -1
  65. package/dist/{WalletPage-YVSIECSM.js → WalletPage-J3CX6MLS.js} +26 -26
  66. package/dist/{WalletPage-YVSIECSM.js.map → WalletPage-J3CX6MLS.js.map} +1 -1
  67. package/dist/{WebMcpTools-VA2A62E3.js → WebMcpTools-3MV53OMT.js} +9 -9
  68. package/dist/{WebMcpTools-VA2A62E3.js.map → WebMcpTools-3MV53OMT.js.map} +1 -1
  69. package/dist/{WishlistPage-IGWDG4HC.js → WishlistPage-HHX3OVOF.js} +27 -27
  70. package/dist/{WishlistPage-IGWDG4HC.js.map → WishlistPage-HHX3OVOF.js.map} +1 -1
  71. package/dist/api/advertisement.js +4 -4
  72. package/dist/api/apps.js +4 -4
  73. package/dist/api/blog.js +6 -6
  74. package/dist/api/brands.js +6 -6
  75. package/dist/api/cart.js +6 -6
  76. package/dist/api/category.js +6 -6
  77. package/dist/api/client.js +3 -3
  78. package/dist/api/home.js +4 -4
  79. package/dist/api/loyalty.js +6 -6
  80. package/dist/api/menu.js +4 -4
  81. package/dist/api/notification.js +4 -4
  82. package/dist/api/order.js +6 -6
  83. package/dist/api/page.js +6 -6
  84. package/dist/api/product.js +6 -6
  85. package/dist/api/profile.js +3 -3
  86. package/dist/api/store.js +5 -5
  87. package/dist/api/translations.js +4 -4
  88. package/dist/api/user.js +4 -4
  89. package/dist/api/wallet.js +4 -4
  90. package/dist/api/wishlist.js +7 -7
  91. package/dist/{chunk-G3NCSKQ3.js → chunk-2DUN6DZK.js} +5 -5
  92. package/dist/{chunk-G3NCSKQ3.js.map → chunk-2DUN6DZK.js.map} +1 -1
  93. package/dist/{chunk-S4KV6QGP.js → chunk-3G4YCXOR.js} +27 -20
  94. package/dist/chunk-3G4YCXOR.js.map +1 -0
  95. package/dist/{chunk-IVZNTLAA.js → chunk-3O6BB7SI.js} +3 -3
  96. package/dist/{chunk-IVZNTLAA.js.map → chunk-3O6BB7SI.js.map} +1 -1
  97. package/dist/{chunk-5XWGYFZ2.js → chunk-3QOALQQJ.js} +4 -4
  98. package/dist/{chunk-5XWGYFZ2.js.map → chunk-3QOALQQJ.js.map} +1 -1
  99. package/dist/{chunk-7IQFONJR.js → chunk-5EN3XZ32.js} +3 -3
  100. package/dist/{chunk-7IQFONJR.js.map → chunk-5EN3XZ32.js.map} +1 -1
  101. package/dist/{chunk-N6ZE6HUX.js → chunk-5V4W3GBI.js} +5 -5
  102. package/dist/{chunk-N6ZE6HUX.js.map → chunk-5V4W3GBI.js.map} +1 -1
  103. package/dist/{chunk-3E3ABCPC.js → chunk-6TFM3UTF.js} +3 -3
  104. package/dist/{chunk-3E3ABCPC.js.map → chunk-6TFM3UTF.js.map} +1 -1
  105. package/dist/{chunk-WATFGHFK.js → chunk-7PPNAVBF.js} +4 -4
  106. package/dist/{chunk-WATFGHFK.js.map → chunk-7PPNAVBF.js.map} +1 -1
  107. package/dist/{chunk-GCXFTIHV.js → chunk-7ZTSYUCJ.js} +4 -4
  108. package/dist/{chunk-GCXFTIHV.js.map → chunk-7ZTSYUCJ.js.map} +1 -1
  109. package/dist/{chunk-BBQATCYN.js → chunk-A4Y5BVJN.js} +3 -3
  110. package/dist/{chunk-BBQATCYN.js.map → chunk-A4Y5BVJN.js.map} +1 -1
  111. package/dist/{chunk-IAM44RPN.js → chunk-AECYX56P.js} +4 -4
  112. package/dist/{chunk-IAM44RPN.js.map → chunk-AECYX56P.js.map} +1 -1
  113. package/dist/{chunk-AT6YLLT4.js → chunk-B36NISD2.js} +4 -4
  114. package/dist/{chunk-AT6YLLT4.js.map → chunk-B36NISD2.js.map} +1 -1
  115. package/dist/{chunk-BXMU3ARO.js → chunk-BEYWTFOR.js} +4 -4
  116. package/dist/{chunk-BXMU3ARO.js.map → chunk-BEYWTFOR.js.map} +1 -1
  117. package/dist/{chunk-AXTVBTO4.js → chunk-BKSVKSAW.js} +22 -22
  118. package/dist/{chunk-AXTVBTO4.js.map → chunk-BKSVKSAW.js.map} +1 -1
  119. package/dist/{chunk-KVBWIXXG.js → chunk-C5P2C2NR.js} +3 -3
  120. package/dist/{chunk-KVBWIXXG.js.map → chunk-C5P2C2NR.js.map} +1 -1
  121. package/dist/{chunk-PYUTATUY.js → chunk-C6PNF2OT.js} +3 -3
  122. package/dist/{chunk-PYUTATUY.js.map → chunk-C6PNF2OT.js.map} +1 -1
  123. package/dist/{chunk-VNEMV6IC.js → chunk-CFG6PGUZ.js} +4 -4
  124. package/dist/{chunk-VNEMV6IC.js.map → chunk-CFG6PGUZ.js.map} +1 -1
  125. package/dist/{chunk-GN7V2QHO.js → chunk-DHKZCR6U.js} +6 -6
  126. package/dist/{chunk-GN7V2QHO.js.map → chunk-DHKZCR6U.js.map} +1 -1
  127. package/dist/{chunk-WU5Z4JGX.js → chunk-DMGSEY7F.js} +3 -3
  128. package/dist/{chunk-WU5Z4JGX.js.map → chunk-DMGSEY7F.js.map} +1 -1
  129. package/dist/{chunk-VV7MDVGS.js → chunk-EF3PLLLA.js} +8 -8
  130. package/dist/{chunk-VV7MDVGS.js.map → chunk-EF3PLLLA.js.map} +1 -1
  131. package/dist/{chunk-WQPG22DY.js → chunk-EGI7F57E.js} +3 -3
  132. package/dist/{chunk-WQPG22DY.js.map → chunk-EGI7F57E.js.map} +1 -1
  133. package/dist/{chunk-W6KPVZZR.js → chunk-F7S2QA3D.js} +7 -7
  134. package/dist/{chunk-W6KPVZZR.js.map → chunk-F7S2QA3D.js.map} +1 -1
  135. package/dist/{chunk-P3WHN7JA.js → chunk-FTH3XLIN.js} +3 -3
  136. package/dist/{chunk-P3WHN7JA.js.map → chunk-FTH3XLIN.js.map} +1 -1
  137. package/dist/{chunk-CRO7DXS3.js → chunk-FXW6H6J3.js} +3 -3
  138. package/dist/{chunk-CRO7DXS3.js.map → chunk-FXW6H6J3.js.map} +1 -1
  139. package/dist/{chunk-TF6HFXTW.js → chunk-H7LRGY7U.js} +3 -3
  140. package/dist/{chunk-TF6HFXTW.js.map → chunk-H7LRGY7U.js.map} +1 -1
  141. package/dist/{chunk-RWAOBMAK.js → chunk-HZWTDQVJ.js} +6 -6
  142. package/dist/{chunk-RWAOBMAK.js.map → chunk-HZWTDQVJ.js.map} +1 -1
  143. package/dist/{chunk-HOJ5E2PG.js → chunk-IHOUADLX.js} +3 -3
  144. package/dist/{chunk-HOJ5E2PG.js.map → chunk-IHOUADLX.js.map} +1 -1
  145. package/dist/{chunk-GUODUINX.js → chunk-JOHFXU4C.js} +5 -5
  146. package/dist/{chunk-GUODUINX.js.map → chunk-JOHFXU4C.js.map} +1 -1
  147. package/dist/{chunk-MZ4LTJQD.js → chunk-K4YRFOFA.js} +7 -7
  148. package/dist/{chunk-MZ4LTJQD.js.map → chunk-K4YRFOFA.js.map} +1 -1
  149. package/dist/{chunk-LFHYQ6AN.js → chunk-M5WTY3EH.js} +3 -3
  150. package/dist/{chunk-LFHYQ6AN.js.map → chunk-M5WTY3EH.js.map} +1 -1
  151. package/dist/{chunk-RYGEIQWO.js → chunk-MGG4XAJ5.js} +3 -3
  152. package/dist/{chunk-RYGEIQWO.js.map → chunk-MGG4XAJ5.js.map} +1 -1
  153. package/dist/{chunk-O7OFWC34.js → chunk-O6RZ6AWT.js} +4 -4
  154. package/dist/{chunk-O7OFWC34.js.map → chunk-O6RZ6AWT.js.map} +1 -1
  155. package/dist/{chunk-LVUH4FOB.js → chunk-PBT52UWY.js} +5 -5
  156. package/dist/{chunk-LVUH4FOB.js.map → chunk-PBT52UWY.js.map} +1 -1
  157. package/dist/{chunk-C6WYORKW.js → chunk-PCYZMJUC.js} +3 -3
  158. package/dist/{chunk-C6WYORKW.js.map → chunk-PCYZMJUC.js.map} +1 -1
  159. package/dist/{chunk-ODP2N7CD.js → chunk-QBVXQHVJ.js} +4 -4
  160. package/dist/{chunk-ODP2N7CD.js.map → chunk-QBVXQHVJ.js.map} +1 -1
  161. package/dist/{chunk-MWYKP7CI.js → chunk-QMWP2ZP6.js} +3 -3
  162. package/dist/{chunk-MWYKP7CI.js.map → chunk-QMWP2ZP6.js.map} +1 -1
  163. package/dist/{chunk-LNTLWEYI.js → chunk-QXWCIK6D.js} +4 -4
  164. package/dist/{chunk-LNTLWEYI.js.map → chunk-QXWCIK6D.js.map} +1 -1
  165. package/dist/{chunk-5UWRPWK2.js → chunk-R7VWIXFX.js} +3 -3
  166. package/dist/{chunk-5UWRPWK2.js.map → chunk-R7VWIXFX.js.map} +1 -1
  167. package/dist/{chunk-Q7E4TNN7.js → chunk-SLBO4SEE.js} +3 -3
  168. package/dist/{chunk-Q7E4TNN7.js.map → chunk-SLBO4SEE.js.map} +1 -1
  169. package/dist/{chunk-FXVII733.js → chunk-T2752RH7.js} +27 -3
  170. package/dist/chunk-T2752RH7.js.map +1 -0
  171. package/dist/{chunk-4L5RHZHJ.js → chunk-T2O2IQJQ.js} +4 -4
  172. package/dist/{chunk-4L5RHZHJ.js.map → chunk-T2O2IQJQ.js.map} +1 -1
  173. package/dist/{chunk-YVQXIZY7.js → chunk-TQQN5AE2.js} +6 -6
  174. package/dist/{chunk-YVQXIZY7.js.map → chunk-TQQN5AE2.js.map} +1 -1
  175. package/dist/{chunk-3KTDODC5.js → chunk-VDY3VY7S.js} +3 -3
  176. package/dist/{chunk-3KTDODC5.js.map → chunk-VDY3VY7S.js.map} +1 -1
  177. package/dist/{chunk-2ZR562TA.js → chunk-VEVFVWF3.js} +5 -5
  178. package/dist/{chunk-2ZR562TA.js.map → chunk-VEVFVWF3.js.map} +1 -1
  179. package/dist/{chunk-W5LVGFHX.js → chunk-VNHYMLGK.js} +6 -6
  180. package/dist/{chunk-W5LVGFHX.js.map → chunk-VNHYMLGK.js.map} +1 -1
  181. package/dist/{chunk-MDU7ERR3.js → chunk-VQO4TTPE.js} +4 -4
  182. package/dist/{chunk-MDU7ERR3.js.map → chunk-VQO4TTPE.js.map} +1 -1
  183. package/dist/{chunk-JYPIPQ3V.js → chunk-X6WDFQYL.js} +3 -3
  184. package/dist/{chunk-JYPIPQ3V.js.map → chunk-X6WDFQYL.js.map} +1 -1
  185. package/dist/{chunk-NHA4SBKG.js → chunk-XMRNYUQY.js} +3 -3
  186. package/dist/{chunk-NHA4SBKG.js.map → chunk-XMRNYUQY.js.map} +1 -1
  187. package/dist/{chunk-6JH4QYKT.js → chunk-YDRURQ2W.js} +4 -4
  188. package/dist/{chunk-6JH4QYKT.js.map → chunk-YDRURQ2W.js.map} +1 -1
  189. package/dist/{chunk-AD4QPYNG.js → chunk-YEBA44IV.js} +4 -4
  190. package/dist/{chunk-AD4QPYNG.js.map → chunk-YEBA44IV.js.map} +1 -1
  191. package/dist/{chunk-V46O3Z7J.js → chunk-Z4EQHB26.js} +5 -5
  192. package/dist/{chunk-V46O3Z7J.js.map → chunk-Z4EQHB26.js.map} +1 -1
  193. package/dist/{chunk-TAVF4E7T.js → chunk-ZSEECSDV.js} +8 -8
  194. package/dist/{chunk-TAVF4E7T.js.map → chunk-ZSEECSDV.js.map} +1 -1
  195. package/dist/components/cart/index.js +1 -1
  196. package/dist/components/common/index.js +1 -1
  197. package/dist/components/drawer/index.js +23 -23
  198. package/dist/components/home/index.js +28 -28
  199. package/dist/components/layout/index.js +6 -6
  200. package/dist/components/product/index.js +25 -25
  201. package/dist/components/store/index.js +24 -24
  202. package/dist/components/toast/index.js +4 -4
  203. package/dist/dev/editor/index.js +2 -2
  204. package/dist/dev/index.js +2 -2
  205. package/dist/document-class-SWL4NCC6.js +32 -0
  206. package/dist/{document-class-TRLFCQHJ.js.map → document-class-SWL4NCC6.js.map} +1 -1
  207. package/dist/hooks/index.js +23 -23
  208. package/dist/hooks/useComments.js +3 -3
  209. package/dist/hooks/useGtm.js +23 -23
  210. package/dist/hooks/useMoney.js +23 -23
  211. package/dist/hooks/useProduct.js +3 -3
  212. package/dist/hooks/useStore.js +23 -23
  213. package/dist/hooks/useUser.js +5 -5
  214. package/dist/hooks/useWishlist.js +3 -3
  215. package/dist/index.js +23 -23
  216. package/dist/native-app/index.js +3 -3
  217. package/dist/{navigation-HWFEKUG6.js → navigation-7V4CSVG5.js} +8 -8
  218. package/dist/{navigation-HWFEKUG6.js.map → navigation-7V4CSVG5.js.map} +1 -1
  219. package/dist/{navigation-E75N4EU3.js → navigation-VMR4V27L.js} +7 -7
  220. package/dist/{navigation-E75N4EU3.js.map → navigation-VMR4V27L.js.map} +1 -1
  221. package/dist/{not-found-7SZU5K7G.js → not-found-S33EUV2Q.js} +26 -26
  222. package/dist/{not-found-7SZU5K7G.js.map → not-found-S33EUV2Q.js.map} +1 -1
  223. package/dist/providers/index.js +23 -23
  224. package/dist/routes/account/orders.js +8 -8
  225. package/dist/routes/account.js +17 -17
  226. package/dist/routes/blog/loader.d.ts.map +1 -1
  227. package/dist/routes/blog.js +27 -19
  228. package/dist/routes/blog.js.map +1 -1
  229. package/dist/routes/brands.js +8 -8
  230. package/dist/routes/cart.js +32 -32
  231. package/dist/routes/home.js +29 -29
  232. package/dist/routes/index.js +6 -6
  233. package/dist/routes/loyalty.js +9 -9
  234. package/dist/routes/page.js +8 -8
  235. package/dist/routes/product-listing.js +30 -30
  236. package/dist/routes/product.js +28 -28
  237. package/dist/routes/root/beforeLoad.d.ts.map +1 -1
  238. package/dist/routes/seo-redirects.js +6 -6
  239. package/dist/routes/testimonials.js +4 -4
  240. package/dist/routes/thank-you.js +8 -8
  241. package/dist/skeleton.js +29 -29
  242. package/dist/{store-lookup-LGYGZ4PU.js → store-lookup-D5C2LNXK.js} +11 -11
  243. package/dist/{store-lookup-LGYGZ4PU.js.map → store-lookup-D5C2LNXK.js.map} +1 -1
  244. package/dist/tanstack.js +19 -19
  245. package/dist/types/index.d.ts +5 -1
  246. package/dist/types/index.d.ts.map +1 -1
  247. package/dist/utils/baseHead.js +2 -2
  248. package/dist/utils/index.js +6 -6
  249. package/dist/utils/store-base.d.ts +30 -0
  250. package/dist/utils/store-base.d.ts.map +1 -1
  251. package/dist/utils/store-identity.d.ts +8 -0
  252. package/dist/utils/store-identity.d.ts.map +1 -1
  253. package/dist/vite/index.js +3 -3
  254. package/package.json +1 -1
  255. package/tailwind/routes/blog/loader.ts.txt +26 -8
  256. package/tailwind/routes/root/beforeLoad.ts.txt +27 -9
  257. package/dist/chunk-FXVII733.js.map +0 -1
  258. package/dist/chunk-S4KV6QGP.js.map +0 -1
  259. package/dist/document-class-TRLFCQHJ.js +0 -32
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/common/lazy.ts","../src/components/common/Image.tsx","../src/components/common/DeferredData.tsx"],"names":["Image","memo","DeferredRenderer","jsx"],"mappings":";;;;;;;AASO,IAAM,cAAA,GAAiB,aAAA;AAAA,EAAc,MAC1C,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW,CAAE;AAChE;AAEO,IAAM,aAAA,GAAgB,aAAA;AAAA,EAAc,MACzC,OAAO,yBAAa,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,SAAA,EAAU,CAAE;AAC9D;AAEO,IAAM,qBAAA,GAAwB,aAAA;AAAA,EAAc,MACjD,OAAO,iCAAqB,CAAA,CAAE,IAAA,CAAK,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,YAAA,CAAa,IAAI,OAAO,CAAA;AAExE,EAAA,MAAM,QAAA,GAAW,MAAM,OAAO,CAAA;AAC9B,EAAA,MAAM,KAAA,GAAQ,SAAS,YAAY,CAAA;AAEnC,EAAA,IAAI,KAAA,EAAO,WAAW,SAAA,EAAW;AAC/B,IAAA,OAAO,QAAA,CAAS,MAAM,KAAM,CAAA;AAAA,EAC9B;AAEA,EAAA,IAAI,KAAA,EAAO,WAAW,OAAA,EAAS;AAC7B,IAAA,MAAM,KAAA,CAAM,KAAA;AAAA,EACd;AAEA,EAAA,uBACEA,GAAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,0BACEA,GAAAA,CAAC,oBAAiB,OAAA,EAAS,QAAA,EAAU,UAClC,QAAA,EACH,CAAA;AAAA,MAGF,QAAA,kBAAAA,GAAAA,CAAC,gBAAA,EAAA,EAAiB,OAAA,EAAS,UAAW,QAAA,EAAS;AAAA;AAAA,GACjD;AAEJ","file":"chunk-P3WHN7JA.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\n/**\n * Lazy-loaded common components\n * Use these for code-splitting non-critical components\n *\n * NOTE: Skeleton components are sourced from @salla.sa/twilight-components-react\n * because they must render instantly during route transitions.\n */\nexport const LazyBreadcrumb = lazyComponent(() =>\n import('./Breadcrumb').then((m) => ({ default: m.Breadcrumb }))\n);\n\nexport const LazyNoContent = lazyComponent(() =>\n import('./NoContent').then((m) => ({ default: m.NoContent }))\n);\n\nexport const LazyRenderWhenVisible = lazyComponent(() =>\n import('./RenderWhenVisible').then((m) => ({ default: m.RenderWhenVisible }))\n);\n\nexport const LazyCurrencySymbol = lazyComponent(() =>\n import('./CurrencySymbol').then((m) => ({ default: m.CurrencySymbol }))\n);\n\nexport const LazyErrorPage = lazyComponent(() =>\n import('./ErrorPage').then((m) => ({ default: m.ErrorPage }))\n);\n","import { memo } from 'react';\nimport { getCdnImageSrcSet, getCdnImageUrl } from '../../utils/cdn-image';\n\nexport interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {\n /** Image source URL */\n src?: string;\n /** Alt text for accessibility */\n alt: string;\n /** Whether this image is above the fold / LCP candidate */\n priority?: boolean;\n /** Aspect ratio for CLS prevention (e.g. \"16/9\", \"1/1\", \"4/3\") */\n aspectRatio?: string;\n /** Object fit mode */\n objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';\n /** Mobile image source for <picture> element */\n mobileSrc?: string;\n /** Mobile breakpoint for <source> media query (default: 768px) */\n mobileBreakpoint?: number;\n /** Skip the wrapper div */\n noWrapper?: boolean;\n /**\n * CDN widths for a density `srcset`. Pass `sizes` so the browser picks a\n * candidate close to the displayed CSS size.\n */\n srcSetWidths?: readonly number[];\n}\n\n/**\n * Optimized Image component with native browser lazy loading.\n *\n * - Uses `loading=\"lazy\"` + `decoding=\"async\"` by default for below-the-fold images.\n * - Uses `loading=\"eager\"` + `fetchPriority=\"high\"` for priority (above-the-fold / LCP) images.\n * - Supports responsive `<picture>` with mobile source.\n * - Provides `aspectRatio` for CLS prevention.\n * - When `srcSetWidths` + `sizes` are set, emits a sized CDN `srcset`.\n */\nexport const Image = memo(function Image({\n src,\n alt,\n priority = false,\n aspectRatio,\n objectFit = 'cover',\n mobileSrc,\n mobileBreakpoint = 768,\n noWrapper = false,\n className = '',\n style,\n width,\n height,\n sizes,\n srcSet: srcSetProp,\n srcSetWidths,\n ...rest\n}: ImageProps) {\n if (!src) return null;\n\n const generatedSrcSet =\n srcSetProp || (srcSetWidths?.length ? getCdnImageSrcSet(src, srcSetWidths) : undefined);\n const generatedMobileSrcSet =\n srcSetWidths?.length && mobileSrc ? getCdnImageSrcSet(mobileSrc, srcSetWidths) : undefined;\n const cdnWidth = srcSetWidths?.length\n ? width != null && srcSetWidths.includes(Number(width))\n ? Number(width)\n : srcSetWidths[0]\n : width;\n // Width-only CDN URLs so `src` matches a srcset candidate for preload.\n const cdnOptions = generatedSrcSet ? { width: cdnWidth } : { width: cdnWidth, height };\n\n const optimizedSrc = getCdnImageUrl(src, cdnOptions);\n const optimizedMobileSrc = getCdnImageUrl(mobileSrc, cdnOptions);\n\n const objectFitClass = `object-${objectFit}`;\n const imgClasses = [className, objectFitClass].filter(Boolean).join(' ');\n\n const loadingProps: React.ImgHTMLAttributes<HTMLImageElement> = priority\n ? { loading: 'eager' as const, fetchPriority: 'high' as const, decoding: 'sync' as const }\n : { loading: 'lazy' as const, decoding: 'async' as const };\n\n const hasWrapper = !noWrapper && !!aspectRatio;\n\n const img = (\n <img\n src={optimizedSrc}\n alt={alt}\n className={imgClasses}\n width={width}\n height={height}\n sizes={sizes}\n srcSet={generatedSrcSet}\n // With a wrapper, `style` goes to the wrapper; otherwise it must land on the <img>.\n style={hasWrapper ? undefined : style}\n {...loadingProps}\n {...rest}\n />\n );\n\n const imgElement = optimizedMobileSrc ? (\n <picture>\n <source\n media={`(max-width: ${mobileBreakpoint}px)`}\n srcSet={generatedMobileSrcSet || optimizedMobileSrc}\n sizes={generatedMobileSrcSet ? sizes : undefined}\n />\n {img}\n </picture>\n ) : (\n img\n );\n\n if (!hasWrapper) {\n return imgElement;\n }\n\n return (\n <div className=\"relative overflow-hidden\" style={{ aspectRatio, ...style }}>\n {imgElement}\n </div>\n );\n});\n","import { Suspense, memo, use, type ReactNode } from 'react';\n\nexport interface DeferredDataProps<T> {\n promise: Promise<T> | T;\n fallback: ReactNode;\n children: (data: T) => ReactNode;\n}\n\nconst DEFERRED_KEY = Symbol.for('twilight.deferred');\n\ninterface DeferredState<T> {\n status: 'pending' | 'success' | 'error';\n value?: T;\n error?: unknown;\n}\n\nexport interface DeferredPromise<T> extends Promise<T> {\n [DEFERRED_KEY]?: DeferredState<T>;\n}\n\nconst seenPromises = typeof WeakSet !== 'undefined' ? new WeakSet() : null;\n\nfunction defer<T>(promise: Promise<T>): DeferredPromise<T> {\n const existing = (promise as DeferredPromise<T>)[DEFERRED_KEY];\n if (existing) return promise as DeferredPromise<T>;\n\n const state: DeferredState<T> = { status: 'pending' };\n\n const deferred = promise as DeferredPromise<T>;\n deferred[DEFERRED_KEY] = state;\n\n promise.then(\n (value) => {\n state.status = 'success';\n state.value = value;\n },\n (error) => {\n state.status = 'error';\n state.error = error;\n }\n );\n\n return deferred;\n}\n\nconst DeferredRenderer = memo(function DeferredRenderer<T>({\n promise,\n children,\n}: {\n promise: DeferredPromise<T>;\n children: (data: T) => ReactNode;\n}) {\n const state = promise[DEFERRED_KEY];\n\n if (state?.status === 'success') {\n return children(state.value!);\n }\n\n if (state?.status === 'error') {\n throw state.error;\n }\n\n const data = use(promise);\n return children(data);\n}) as <T>(props: { promise: DeferredPromise<T>; children: (data: T) => ReactNode }) => ReactNode;\n\nfunction DeferredFallback<T>({\n promise,\n fallback,\n children,\n}: {\n promise: DeferredPromise<T>;\n fallback: ReactNode;\n children: (data: T) => ReactNode;\n}) {\n const state = promise[DEFERRED_KEY];\n if (state?.status === 'success') {\n return children(state.value!);\n }\n return <>{fallback}</>;\n}\n\nexport function resolveDeferred<T>(\n promiseOrValue: Promise<T> | T | undefined\n): T | Promise<T> | undefined {\n if (promiseOrValue == null || !(promiseOrValue instanceof Promise)) return promiseOrValue;\n const deferred = defer(promiseOrValue);\n const state = deferred[DEFERRED_KEY];\n if (state?.status === 'success') return state.value as T;\n return promiseOrValue;\n}\n\nexport function DeferredData<T>({ promise, fallback, children }: DeferredDataProps<T>) {\n if (!(promise instanceof Promise)) {\n return children(promise);\n }\n\n if (seenPromises && promise instanceof Promise) seenPromises.add(promise);\n\n const deferred = defer(promise);\n const state = deferred[DEFERRED_KEY];\n\n if (state?.status === 'success') {\n return children(state.value!);\n }\n\n if (state?.status === 'error') {\n throw state.error;\n }\n\n return (\n <Suspense\n fallback={\n <DeferredFallback promise={deferred} fallback={fallback}>\n {children}\n </DeferredFallback>\n }\n >\n <DeferredRenderer promise={deferred}>{children}</DeferredRenderer>\n </Suspense>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/components/common/lazy.ts","../src/components/common/Image.tsx","../src/components/common/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AE,cAAA,YAA0B,UAAU,OAAO,cAAA;AAC3E,EAAA,MAAM,QAAA,GAAW,MAAM,cAAc,CAAA;AACrC,EAAA,MAAM,KAAA,GAAQ,SAAS,YAAY,CAAA;AACnC,EAAA,IAAI,KAAA,EAAO,MAAA,KAAW,SAAA,EAAW,OAAO,KAAA,CAAM,KAAA;AAC9C,EAAA,OAAO,cAAA;AACT;AAEO,SAAS,YAAA,CAAgB,EAAE,OAAA,EAAS,QAAA,EAAU,UAAS,EAAyB;AACrF,EAAA,IAAI,EAAE,mBAAmB,OAAA,CAAA,EAAU;AACjC,IAAA,OAAO,SAAS,OAAO,CAAA;AAAA,EACzB;AAEA,EAAA,IAAI,YAAA,IAAgB,OAAA,YAAmB,OAAA,EAAS,YAAA,CAAa,IAAI,OAAO,CAAA;AAExE,EAAA,MAAM,QAAA,GAAW,MAAM,OAAO,CAAA;AAC9B,EAAA,MAAM,KAAA,GAAQ,SAAS,YAAY,CAAA;AAEnC,EAAA,IAAI,KAAA,EAAO,WAAW,SAAA,EAAW;AAC/B,IAAA,OAAO,QAAA,CAAS,MAAM,KAAM,CAAA;AAAA,EAC9B;AAEA,EAAA,IAAI,KAAA,EAAO,WAAW,OAAA,EAAS;AAC7B,IAAA,MAAM,KAAA,CAAM,KAAA;AAAA,EACd;AAEA,EAAA,uBACEA,GAAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,0BACEA,GAAAA,CAAC,oBAAiB,OAAA,EAAS,QAAA,EAAU,UAClC,QAAA,EACH,CAAA;AAAA,MAGF,QAAA,kBAAAA,GAAAA,CAAC,gBAAA,EAAA,EAAiB,OAAA,EAAS,UAAW,QAAA,EAAS;AAAA;AAAA,GACjD;AAEJ","file":"chunk-FTH3XLIN.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\n/**\n * Lazy-loaded common components\n * Use these for code-splitting non-critical components\n *\n * NOTE: Skeleton components are sourced from @salla.sa/twilight-components-react\n * because they must render instantly during route transitions.\n */\nexport const LazyBreadcrumb = lazyComponent(() =>\n import('./Breadcrumb').then((m) => ({ default: m.Breadcrumb }))\n);\n\nexport const LazyNoContent = lazyComponent(() =>\n import('./NoContent').then((m) => ({ default: m.NoContent }))\n);\n\nexport const LazyRenderWhenVisible = lazyComponent(() =>\n import('./RenderWhenVisible').then((m) => ({ default: m.RenderWhenVisible }))\n);\n\nexport const LazyCurrencySymbol = lazyComponent(() =>\n import('./CurrencySymbol').then((m) => ({ default: m.CurrencySymbol }))\n);\n\nexport const LazyErrorPage = lazyComponent(() =>\n import('./ErrorPage').then((m) => ({ default: m.ErrorPage }))\n);\n","import { memo } from 'react';\nimport { getCdnImageSrcSet, getCdnImageUrl } from '../../utils/cdn-image';\n\nexport interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement> {\n /** Image source URL */\n src?: string;\n /** Alt text for accessibility */\n alt: string;\n /** Whether this image is above the fold / LCP candidate */\n priority?: boolean;\n /** Aspect ratio for CLS prevention (e.g. \"16/9\", \"1/1\", \"4/3\") */\n aspectRatio?: string;\n /** Object fit mode */\n objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down';\n /** Mobile image source for <picture> element */\n mobileSrc?: string;\n /** Mobile breakpoint for <source> media query (default: 768px) */\n mobileBreakpoint?: number;\n /** Skip the wrapper div */\n noWrapper?: boolean;\n /**\n * CDN widths for a density `srcset`. Pass `sizes` so the browser picks a\n * candidate close to the displayed CSS size.\n */\n srcSetWidths?: readonly number[];\n}\n\n/**\n * Optimized Image component with native browser lazy loading.\n *\n * - Uses `loading=\"lazy\"` + `decoding=\"async\"` by default for below-the-fold images.\n * - Uses `loading=\"eager\"` + `fetchPriority=\"high\"` for priority (above-the-fold / LCP) images.\n * - Supports responsive `<picture>` with mobile source.\n * - Provides `aspectRatio` for CLS prevention.\n * - When `srcSetWidths` + `sizes` are set, emits a sized CDN `srcset`.\n */\nexport const Image = memo(function Image({\n src,\n alt,\n priority = false,\n aspectRatio,\n objectFit = 'cover',\n mobileSrc,\n mobileBreakpoint = 768,\n noWrapper = false,\n className = '',\n style,\n width,\n height,\n sizes,\n srcSet: srcSetProp,\n srcSetWidths,\n ...rest\n}: ImageProps) {\n if (!src) return null;\n\n const generatedSrcSet =\n srcSetProp || (srcSetWidths?.length ? getCdnImageSrcSet(src, srcSetWidths) : undefined);\n const generatedMobileSrcSet =\n srcSetWidths?.length && mobileSrc ? getCdnImageSrcSet(mobileSrc, srcSetWidths) : undefined;\n const cdnWidth = srcSetWidths?.length\n ? width != null && srcSetWidths.includes(Number(width))\n ? Number(width)\n : srcSetWidths[0]\n : width;\n // Width-only CDN URLs so `src` matches a srcset candidate for preload.\n const cdnOptions = generatedSrcSet ? { width: cdnWidth } : { width: cdnWidth, height };\n\n const optimizedSrc = getCdnImageUrl(src, cdnOptions);\n const optimizedMobileSrc = getCdnImageUrl(mobileSrc, cdnOptions);\n\n const objectFitClass = `object-${objectFit}`;\n const imgClasses = [className, objectFitClass].filter(Boolean).join(' ');\n\n const loadingProps: React.ImgHTMLAttributes<HTMLImageElement> = priority\n ? { loading: 'eager' as const, fetchPriority: 'high' as const, decoding: 'sync' as const }\n : { loading: 'lazy' as const, decoding: 'async' as const };\n\n const hasWrapper = !noWrapper && !!aspectRatio;\n\n const img = (\n <img\n src={optimizedSrc}\n alt={alt}\n className={imgClasses}\n width={width}\n height={height}\n sizes={sizes}\n srcSet={generatedSrcSet}\n // With a wrapper, `style` goes to the wrapper; otherwise it must land on the <img>.\n style={hasWrapper ? undefined : style}\n {...loadingProps}\n {...rest}\n />\n );\n\n const imgElement = optimizedMobileSrc ? (\n <picture>\n <source\n media={`(max-width: ${mobileBreakpoint}px)`}\n srcSet={generatedMobileSrcSet || optimizedMobileSrc}\n sizes={generatedMobileSrcSet ? sizes : undefined}\n />\n {img}\n </picture>\n ) : (\n img\n );\n\n if (!hasWrapper) {\n return imgElement;\n }\n\n return (\n <div className=\"relative overflow-hidden\" style={{ aspectRatio, ...style }}>\n {imgElement}\n </div>\n );\n});\n","import { Suspense, memo, use, type ReactNode } from 'react';\n\nexport interface DeferredDataProps<T> {\n promise: Promise<T> | T;\n fallback: ReactNode;\n children: (data: T) => ReactNode;\n}\n\nconst DEFERRED_KEY = Symbol.for('twilight.deferred');\n\ninterface DeferredState<T> {\n status: 'pending' | 'success' | 'error';\n value?: T;\n error?: unknown;\n}\n\nexport interface DeferredPromise<T> extends Promise<T> {\n [DEFERRED_KEY]?: DeferredState<T>;\n}\n\nconst seenPromises = typeof WeakSet !== 'undefined' ? new WeakSet() : null;\n\nfunction defer<T>(promise: Promise<T>): DeferredPromise<T> {\n const existing = (promise as DeferredPromise<T>)[DEFERRED_KEY];\n if (existing) return promise as DeferredPromise<T>;\n\n const state: DeferredState<T> = { status: 'pending' };\n\n const deferred = promise as DeferredPromise<T>;\n deferred[DEFERRED_KEY] = state;\n\n promise.then(\n (value) => {\n state.status = 'success';\n state.value = value;\n },\n (error) => {\n state.status = 'error';\n state.error = error;\n }\n );\n\n return deferred;\n}\n\nconst DeferredRenderer = memo(function DeferredRenderer<T>({\n promise,\n children,\n}: {\n promise: DeferredPromise<T>;\n children: (data: T) => ReactNode;\n}) {\n const state = promise[DEFERRED_KEY];\n\n if (state?.status === 'success') {\n return children(state.value!);\n }\n\n if (state?.status === 'error') {\n throw state.error;\n }\n\n const data = use(promise);\n return children(data);\n}) as <T>(props: { promise: DeferredPromise<T>; children: (data: T) => ReactNode }) => ReactNode;\n\nfunction DeferredFallback<T>({\n promise,\n fallback,\n children,\n}: {\n promise: DeferredPromise<T>;\n fallback: ReactNode;\n children: (data: T) => ReactNode;\n}) {\n const state = promise[DEFERRED_KEY];\n if (state?.status === 'success') {\n return children(state.value!);\n }\n return <>{fallback}</>;\n}\n\nexport function resolveDeferred<T>(\n promiseOrValue: Promise<T> | T | undefined\n): T | Promise<T> | undefined {\n if (promiseOrValue == null || !(promiseOrValue instanceof Promise)) return promiseOrValue;\n const deferred = defer(promiseOrValue);\n const state = deferred[DEFERRED_KEY];\n if (state?.status === 'success') return state.value as T;\n return promiseOrValue;\n}\n\nexport function DeferredData<T>({ promise, fallback, children }: DeferredDataProps<T>) {\n if (!(promise instanceof Promise)) {\n return children(promise);\n }\n\n if (seenPromises && promise instanceof Promise) seenPromises.add(promise);\n\n const deferred = defer(promise);\n const state = deferred[DEFERRED_KEY];\n\n if (state?.status === 'success') {\n return children(state.value!);\n }\n\n if (state?.status === 'error') {\n throw state.error;\n }\n\n return (\n <Suspense\n fallback={\n <DeferredFallback promise={deferred} fallback={fallback}>\n {children}\n </DeferredFallback>\n }\n >\n <DeferredRenderer promise={deferred}>{children}</DeferredRenderer>\n </Suspense>\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { getActiveScope, api } from './chunk-G3NCSKQ3.js';
1
+ import { getActiveScope, api } from './chunk-2DUN6DZK.js';
2
2
  import { queryOptions } from '@tanstack/react-query';
3
3
 
4
4
  async function list(params) {
@@ -45,5 +45,5 @@ var home = {
45
45
  };
46
46
 
47
47
  export { home };
48
- //# sourceMappingURL=chunk-CRO7DXS3.js.map
49
- //# sourceMappingURL=chunk-CRO7DXS3.js.map
48
+ //# sourceMappingURL=chunk-FXW6H6J3.js.map
49
+ //# sourceMappingURL=chunk-FXW6H6J3.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/home.ts"],"names":[],"mappings":";;;AAQA,eAAe,KAAK,MAAA,EAA+D;AACjF,EAAA,MAAM,KAAA,GAAQ,SAAS,CAAA,CAAA,EAAI,IAAI,gBAAgB,MAAM,CAAA,CAAE,QAAA,EAAU,CAAA,CAAA,GAAK,EAAA;AACtE,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,cAAA,EAAiB,KAAK,CAAA,CAAE,CAAA,CAAE,IAAA,EAAoC;AAC7F,EAAA,OAAO,QAAQ,EAAC;AAClB;AAGA,SAAS,OAAA,CAAQ,QAA6B,QAAA,EAAoD;AAChG,EAAA,IAAI,CAAC,QAAA,CAAS,MAAA,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,IAAA,EAAM,GAAG,aAAa,CAAA;AACzD,IAAA,OAAO,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,MAAW,EAAE,GAAG,KAAA,EAAO,IAAA,EAAM,KAAA,CAAM,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAS,EAAE,GAAE,CAAE,CAAA;AAAA,EACpF,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,UAAA,EAAY,MACV,YAAA,CAAa;AAAA;AAAA,MAEX,QAAA,EAAU,CAAC,MAAA,EAAQ,YAAA,EAAc,EAAE,KAAA,EAAO,cAAA,IAAkB,CAAA;AAAA,MAC5D,OAAA,EAAS,MAAM,IAAA,CAAK,UAAA;AAAW,KAChC,CAAA;AAAA,IAEH,MAAA,EAAQ,CAAC,IAAA,EAAc,KAAA,KACrB,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,QAAA,EAAU,MAAM,KAAK,CAAA;AAAA,MACxC,OAAA,EAAS,MAAM,IAAA,CAAK,MAAA,CAAO,MAAM,KAAK;AAAA,KACvC;AAAA;AAEP","file":"chunk-CRO7DXS3.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport type { HomeComponentData } from '../types';\n\n/** The page a hook's blocks render on; blocks can target specific products, categories or pages. */\nexport type BlockScope =\n { product_id: number | string } | { category_id: number | string } | { page_id: number | string };\n\nasync function list(params?: Record<string, string>): Promise<HomeComponentData[]> {\n const query = params ? `?${new URLSearchParams(params).toString()}` : '';\n const { data } = await api.get(`component/list${query}`).json<{ data: HomeComponentData[] }>();\n return data ?? [];\n}\n\n/** `blocks` minus each of `excluded`, matched by content: the API sends no id or order to match on. */\nfunction without(blocks: HomeComponentData[], excluded: HomeComponentData[]): HomeComponentData[] {\n if (!excluded.length) return blocks;\n const paths = new Set(excluded.map((block) => block.path));\n const left = excluded.map((block) => JSON.stringify(block));\n return blocks.filter((block) => {\n if (!paths.has(block.path)) return true;\n const index = left.indexOf(JSON.stringify(block));\n if (index === -1) return true;\n left.splice(index, 1);\n return false;\n });\n}\n\nexport const home = {\n components: async (): Promise<HomeComponentData[]> => {\n // The unfiltered list also has the product, category and page blocks, which the home leaves out.\n const [blocks, pageBlocks] = await Promise.all([list(), list({ show_in: 'pages' })]);\n return without(blocks, pageBlocks);\n },\n\n /** The blocks the merchant placed at `hook` on a product, category or page. */\n blocks: async (hook: string, scope: BlockScope): Promise<HomeComponentData[]> => {\n const scopeParams = Object.fromEntries(\n Object.entries(scope).map(([key, id]) => [key, String(id)])\n );\n const blocks = await list({ hooks: hook, ...scopeParams });\n return blocks.map((block) => ({ ...block, path: block.path.replace('home.', '') }));\n },\n\n queries: {\n components: () =>\n queryOptions({\n // Each market (scope) has its own theme version, and its own home page with it.\n queryKey: ['home', 'components', { scope: getActiveScope() }],\n queryFn: () => home.components(),\n }),\n\n blocks: (hook: string, scope: BlockScope) =>\n queryOptions({\n queryKey: ['home', 'blocks', hook, scope],\n queryFn: () => home.blocks(hook, scope),\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/home.ts"],"names":[],"mappings":";;;AAQA,eAAe,KAAK,MAAA,EAA+D;AACjF,EAAA,MAAM,KAAA,GAAQ,SAAS,CAAA,CAAA,EAAI,IAAI,gBAAgB,MAAM,CAAA,CAAE,QAAA,EAAU,CAAA,CAAA,GAAK,EAAA;AACtE,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,cAAA,EAAiB,KAAK,CAAA,CAAE,CAAA,CAAE,IAAA,EAAoC;AAC7F,EAAA,OAAO,QAAQ,EAAC;AAClB;AAGA,SAAS,OAAA,CAAQ,QAA6B,QAAA,EAAoD;AAChG,EAAA,IAAI,CAAC,QAAA,CAAS,MAAA,EAAQ,OAAO,MAAA;AAC7B,EAAA,MAAM,KAAA,GAAQ,IAAI,GAAA,CAAI,QAAA,CAAS,IAAI,CAAC,KAAA,KAAU,KAAA,CAAM,IAAI,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AM,KAAA,CAAM,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAS,EAAE,GAAE,CAAE,CAAA;AAAA,EACpF,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,UAAA,EAAY,MACV,YAAA,CAAa;AAAA;AAAA,MAEX,QAAA,EAAU,CAAC,MAAA,EAAQ,YAAA,EAAc,EAAE,KAAA,EAAO,cAAA,IAAkB,CAAA;AAAA,MAC5D,OAAA,EAAS,MAAM,IAAA,CAAK,UAAA;AAAW,KAChC,CAAA;AAAA,IAEH,MAAA,EAAQ,CAAC,IAAA,EAAc,KAAA,KACrB,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,QAAA,EAAU,MAAM,KAAK,CAAA;AAAA,MACxC,OAAA,EAAS,MAAM,IAAA,CAAK,MAAA,CAAO,MAAM,KAAK;AAAA,KACvC;AAAA;AAEP","file":"chunk-FXW6H6J3.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport type { HomeComponentData } from '../types';\n\n/** The page a hook's blocks render on; blocks can target specific products, categories or pages. */\nexport type BlockScope =\n { product_id: number | string } | { category_id: number | string } | { page_id: number | string };\n\nasync function list(params?: Record<string, string>): Promise<HomeComponentData[]> {\n const query = params ? `?${new URLSearchParams(params).toString()}` : '';\n const { data } = await api.get(`component/list${query}`).json<{ data: HomeComponentData[] }>();\n return data ?? [];\n}\n\n/** `blocks` minus each of `excluded`, matched by content: the API sends no id or order to match on. */\nfunction without(blocks: HomeComponentData[], excluded: HomeComponentData[]): HomeComponentData[] {\n if (!excluded.length) return blocks;\n const paths = new Set(excluded.map((block) => block.path));\n const left = excluded.map((block) => JSON.stringify(block));\n return blocks.filter((block) => {\n if (!paths.has(block.path)) return true;\n const index = left.indexOf(JSON.stringify(block));\n if (index === -1) return true;\n left.splice(index, 1);\n return false;\n });\n}\n\nexport const home = {\n components: async (): Promise<HomeComponentData[]> => {\n // The unfiltered list also has the product, category and page blocks, which the home leaves out.\n const [blocks, pageBlocks] = await Promise.all([list(), list({ show_in: 'pages' })]);\n return without(blocks, pageBlocks);\n },\n\n /** The blocks the merchant placed at `hook` on a product, category or page. */\n blocks: async (hook: string, scope: BlockScope): Promise<HomeComponentData[]> => {\n const scopeParams = Object.fromEntries(\n Object.entries(scope).map(([key, id]) => [key, String(id)])\n );\n const blocks = await list({ hooks: hook, ...scopeParams });\n return blocks.map((block) => ({ ...block, path: block.path.replace('home.', '') }));\n },\n\n queries: {\n components: () =>\n queryOptions({\n // Each market (scope) has its own theme version, and its own home page with it.\n queryKey: ['home', 'components', { scope: getActiveScope() }],\n queryFn: () => home.components(),\n }),\n\n blocks: (hook: string, scope: BlockScope) =>\n queryOptions({\n queryKey: ['home', 'blocks', hook, scope],\n queryFn: () => home.blocks(hook, scope),\n }),\n },\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { onSallaEvent } from './chunk-NHA4SBKG.js';
1
+ import { onSallaEvent } from './chunk-XMRNYUQY.js';
2
2
  import { useState, useRef, useEffect, useCallback } from 'react';
3
3
 
4
4
  function useProduct(initialProduct, options) {
@@ -61,5 +61,5 @@ function useProduct(initialProduct, options) {
61
61
  }
62
62
 
63
63
  export { useProduct };
64
- //# sourceMappingURL=chunk-TF6HFXTW.js.map
65
- //# sourceMappingURL=chunk-TF6HFXTW.js.map
64
+ //# sourceMappingURL=chunk-H7LRGY7U.js.map
65
+ //# sourceMappingURL=chunk-H7LRGY7U.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks/useProduct.ts"],"names":[],"mappings":";;;AA4DO,SAAS,UAAA,CAAW,gBAAyB,OAAA,EAA+C;AACjG,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAkB,cAAc,CAAA;AAI9D,EAAA,MAAM,iBAAA,GAAoB,OAAgB,cAAc,CAAA;AACxD,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,iBAAA,CAAkB,OAAA,GAAU,cAAA;AAAA,E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,CAAK,cAAc,KAAK,YAAA,GAAe,KAAA;AAChE,QAAA,OAAO;AAAA,UACL,GAAG,IAAA;AAAA,UACH,KAAA;AAAA,UACA,UAAA,EAAY,QAAA,GAAW,KAAA,GAAQ,IAAA,CAAK,UAAA;AAAA,UACpC,aAAA,EAAe,YAAA;AAAA,UACf,UAAA,EAAY,QAAA;AAAA,UACZ,cAAA,EAAgB,IAAA;AAAA,UAChB,MAAA,EAAS,KAAK,MAAA,IAAqB,EAAA;AAAA;AAAA,UAEnC,KAAK,IAAA,CAAK,GAAA,KAAQ,SAAY,IAAA,CAAK,GAAA,GAAO,KAAK,GAAA,IAAkB,EAAA;AAAA,UACjE,SAAS,IAAA,CAAK,OAAA,KAAY,SAAY,IAAA,CAAK,OAAA,GAAW,KAAK,OAAA,IAAsB,EAAA;AAAA,UACjF,eAAA,EAAiB;AAAA,SACnB;AAAA,MACF,CAAC,CAAA;AAAA,IACH,CAAA;AAEA,IAAA,MAAM,QAAA,GAAW,kBAAA;AAGjB,IAAA,OAAO,YAAA,CAAa,0BAA0B,QAAQ,CAAA;AAAA,EACxD,CAAA,EAAG,EAAE,CAAA;AAGL,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,oBAAoB,MAAM;AAC9B,MAAA,UAAA,CAAW,CAAC,IAAA,MAAU,EAAE,GAAG,IAAA,EAAM,eAAA,EAAiB,MAAK,CAAE,CAAA;AAAA,IAC3D,CAAA;AAEA,IAAA,OAAO,YAAA,CAAa,iCAAiC,iBAAiB,CAAA;AAAA,EACxE,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,EAAE,SAAS,MAAA,EAAO;AAC3B","file":"chunk-TF6HFXTW.js","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport type { Product } from '../types';\nimport { onSallaEvent } from '../utils/sdk-helpers';\n\n/**\n * UseProductResult - Return type for useProduct hook\n */\nexport interface UseProductResult {\n /** Current product state (updates on option changes) */\n product: Product;\n /** Reload product data from API */\n reload: () => Promise<void>;\n}\n\nexport interface UseProductOptions {\n /**\n * True while `initialProduct` is a list-card stand-in. When it flips to false\n * (details arrived), state re-seeds. Do not infer this from `options`/`images`\n * — list payloads may include those fields.\n */\n isPreview?: boolean;\n}\n\n/**\n * useProduct - Hook for managing product state with live updates\n *\n * Provides reactive product data with automatic updates for price, stock,\n * and variant changes. Handles manual reloads (e.g., after add-to-cart)\n * and subscribes to Salla SDK events for real-time price updates.\n *\n * Stock status is reflected in `product.is_out_of_stock` which updates\n * when price calculations succeed or fail (e.g., unavailable option combinations).\n *\n * @param initialProduct - The initial product object (typically from loader/SSR).\n * @param options.isPreview - Pass true for a list-card placeholder so the hook\n * re-seeds when details for the same id arrive (`isPreview` goes false).\n *\n * @returns Object with product and reload function\n *\n * @example\n * ```tsx\n * function ProductDetails({ product }) {\n * const { product: updatedProduct, reload } = useProduct(product);\n *\n * const handleAddToCart = async () => {\n * await addToCart(updatedProduct.id);\n * await reload(); // Refresh product state after cart update\n * };\n *\n * return (\n * <div>\n * <h1>{updatedProduct.name}</h1>\n * <p>Price: {formatMoney(updatedProduct.price)}</p>\n * {updatedProduct.is_out_of_stock && <p>Currently out of stock</p>}\n * <button onClick={handleAddToCart}>Add to Cart</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useProduct(initialProduct: Product, options?: UseProductOptions): UseProductResult {\n const [product, setProduct] = useState<Product>(initialProduct);\n\n // Always keep a ref to the latest initialProduct so the re-seed effect below\n // can read it without adding the full object to the dependency array.\n const initialProductRef = useRef<Product>(initialProduct);\n useEffect(() => {\n initialProductRef.current = initialProduct;\n });\n\n const reload = useCallback(async () => {\n const salla = window.salla;\n if (!salla?.api?.product?.getDetails) return;\n try {\n const response = await salla.api.product.getDetails(String(product.id), [\n 'images',\n 'category',\n ]);\n if (response?.success && response.data) {\n setProduct(response.data as Product);\n }\n } catch {\n // silently ignore network errors during reload\n }\n }, [product.id]);\n\n // Re-seed when the loader navigates to a different product, or when a\n // list-card placeholder (`isPreview`) is replaced by details for the same id.\n // Object identity is not a dependency — that would reset live option/price state.\n useEffect(() => {\n setProduct(initialProductRef.current);\n }, [initialProduct.id, options?.isPreview]);\n\n // Subscribe to Salla option-change events so price/stock stays in sync\n useEffect(() => onSallaEvent('product:options.updated', reload), [reload]);\n\n // Subscribe to price update events (matches product.js registerEvents)\n useEffect(() => {\n const handlePriceUpdated = (res: { data?: Record<string, unknown> }) => {\n const data = res.data;\n if (!data) return;\n\n setProduct((prev) => {\n const price = (data.price as number) ?? prev.price;\n const regularPrice = (data.regular_price as number) ?? prev.regular_price;\n // The payload has no sale_price: like product.js, `price` is the payable (sale) figure.\n const isOnSale = Boolean(data.has_sale_price) && regularPrice > price;\n return {\n ...prev,\n price,\n sale_price: isOnSale ? price : prev.sale_price,\n regular_price: regularPrice,\n is_on_sale: isOnSale,\n starting_price: null,\n weight: (data.weight as string) || '',\n // An empty variant SKU/barcode blanks it; a payload without the field keeps it (product.js).\n sku: data.sku === undefined ? prev.sku : (data.sku as string) || '',\n barcode: data.barcode === undefined ? prev.barcode : (data.barcode as string) || '',\n is_out_of_stock: false,\n };\n });\n };\n\n const listener = handlePriceUpdated as (...args: unknown[]) => void;\n\n // Root on/off: onPriceUpdated registers a wrapper that salla.event.off can't match.\n return onSallaEvent('product::price.updated', listener);\n }, []);\n\n // Subscribe to price update failed events (matches product.js)\n useEffect(() => {\n const handlePriceFailed = () => {\n setProduct((prev) => ({ ...prev, is_out_of_stock: true }));\n };\n\n return onSallaEvent('product::price.updated.failed', handlePriceFailed);\n }, []);\n\n return { product, reload };\n}\n"]}
1
+ {"version":3,"sources":["../src/hooks/useProduct.ts"],"names":[],"mappings":";;;AA4DO,SAAS,UAAA,CAAW,gBAAyB,OAAA,EAA+C;AACjG,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAkB,cAAc,CAAA;AAI9D,EAAA,MAAM,iBAAA,GAAoB,OAAgB,cAAc,CAAA;AACxD,EAAA,SAAA,CAAU,MAAM;A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AAE5D,QAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,IAAA,CAAK,cAAc,KAAK,YAAA,GAAe,KAAA;AAChE,QAAA,OAAO;AAAA,UACL,GAAG,IAAA;AAAA,UACH,KAAA;AAAA,UACA,UAAA,EAAY,QAAA,GAAW,KAAA,GAAQ,IAAA,CAAK,UAAA;AAAA,UACpC,aAAA,EAAe,YAAA;AAAA,UACf,UAAA,EAAY,QAAA;AAAA,UACZ,cAAA,EAAgB,IAAA;AAAA,UAChB,MAAA,EAAS,KAAK,MAAA,IAAqB,EAAA;AAAA;AAAA,UAEnC,KAAK,IAAA,CAAK,GAAA,KAAQ,SAAY,IAAA,CAAK,GAAA,GAAO,KAAK,GAAA,IAAkB,EAAA;AAAA,UACjE,SAAS,IAAA,CAAK,OAAA,KAAY,SAAY,IAAA,CAAK,OAAA,GAAW,KAAK,OAAA,IAAsB,EAAA;AAAA,UACjF,eAAA,EAAiB;AAAA,SACnB;AAAA,MACF,CAAC,CAAA;AAAA,IACH,CAAA;AAEA,IAAA,MAAM,QAAA,GAAW,kBAAA;AAGjB,IAAA,OAAO,YAAA,CAAa,0BAA0B,QAAQ,CAAA;AAAA,EACxD,CAAA,EAAG,EAAE,CAAA;AAGL,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,oBAAoB,MAAM;AAC9B,MAAA,UAAA,CAAW,CAAC,IAAA,MAAU,EAAE,GAAG,IAAA,EAAM,eAAA,EAAiB,MAAK,CAAE,CAAA;AAAA,IAC3D,CAAA;AAEA,IAAA,OAAO,YAAA,CAAa,iCAAiC,iBAAiB,CAAA;AAAA,EACxE,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,EAAE,SAAS,MAAA,EAAO;AAC3B","file":"chunk-H7LRGY7U.js","sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\nimport type { Product } from '../types';\nimport { onSallaEvent } from '../utils/sdk-helpers';\n\n/**\n * UseProductResult - Return type for useProduct hook\n */\nexport interface UseProductResult {\n /** Current product state (updates on option changes) */\n product: Product;\n /** Reload product data from API */\n reload: () => Promise<void>;\n}\n\nexport interface UseProductOptions {\n /**\n * True while `initialProduct` is a list-card stand-in. When it flips to false\n * (details arrived), state re-seeds. Do not infer this from `options`/`images`\n * — list payloads may include those fields.\n */\n isPreview?: boolean;\n}\n\n/**\n * useProduct - Hook for managing product state with live updates\n *\n * Provides reactive product data with automatic updates for price, stock,\n * and variant changes. Handles manual reloads (e.g., after add-to-cart)\n * and subscribes to Salla SDK events for real-time price updates.\n *\n * Stock status is reflected in `product.is_out_of_stock` which updates\n * when price calculations succeed or fail (e.g., unavailable option combinations).\n *\n * @param initialProduct - The initial product object (typically from loader/SSR).\n * @param options.isPreview - Pass true for a list-card placeholder so the hook\n * re-seeds when details for the same id arrive (`isPreview` goes false).\n *\n * @returns Object with product and reload function\n *\n * @example\n * ```tsx\n * function ProductDetails({ product }) {\n * const { product: updatedProduct, reload } = useProduct(product);\n *\n * const handleAddToCart = async () => {\n * await addToCart(updatedProduct.id);\n * await reload(); // Refresh product state after cart update\n * };\n *\n * return (\n * <div>\n * <h1>{updatedProduct.name}</h1>\n * <p>Price: {formatMoney(updatedProduct.price)}</p>\n * {updatedProduct.is_out_of_stock && <p>Currently out of stock</p>}\n * <button onClick={handleAddToCart}>Add to Cart</button>\n * </div>\n * );\n * }\n * ```\n */\nexport function useProduct(initialProduct: Product, options?: UseProductOptions): UseProductResult {\n const [product, setProduct] = useState<Product>(initialProduct);\n\n // Always keep a ref to the latest initialProduct so the re-seed effect below\n // can read it without adding the full object to the dependency array.\n const initialProductRef = useRef<Product>(initialProduct);\n useEffect(() => {\n initialProductRef.current = initialProduct;\n });\n\n const reload = useCallback(async () => {\n const salla = window.salla;\n if (!salla?.api?.product?.getDetails) return;\n try {\n const response = await salla.api.product.getDetails(String(product.id), [\n 'images',\n 'category',\n ]);\n if (response?.success && response.data) {\n setProduct(response.data as Product);\n }\n } catch {\n // silently ignore network errors during reload\n }\n }, [product.id]);\n\n // Re-seed when the loader navigates to a different product, or when a\n // list-card placeholder (`isPreview`) is replaced by details for the same id.\n // Object identity is not a dependency — that would reset live option/price state.\n useEffect(() => {\n setProduct(initialProductRef.current);\n }, [initialProduct.id, options?.isPreview]);\n\n // Subscribe to Salla option-change events so price/stock stays in sync\n useEffect(() => onSallaEvent('product:options.updated', reload), [reload]);\n\n // Subscribe to price update events (matches product.js registerEvents)\n useEffect(() => {\n const handlePriceUpdated = (res: { data?: Record<string, unknown> }) => {\n const data = res.data;\n if (!data) return;\n\n setProduct((prev) => {\n const price = (data.price as number) ?? prev.price;\n const regularPrice = (data.regular_price as number) ?? prev.regular_price;\n // The payload has no sale_price: like product.js, `price` is the payable (sale) figure.\n const isOnSale = Boolean(data.has_sale_price) && regularPrice > price;\n return {\n ...prev,\n price,\n sale_price: isOnSale ? price : prev.sale_price,\n regular_price: regularPrice,\n is_on_sale: isOnSale,\n starting_price: null,\n weight: (data.weight as string) || '',\n // An empty variant SKU/barcode blanks it; a payload without the field keeps it (product.js).\n sku: data.sku === undefined ? prev.sku : (data.sku as string) || '',\n barcode: data.barcode === undefined ? prev.barcode : (data.barcode as string) || '',\n is_out_of_stock: false,\n };\n });\n };\n\n const listener = handlePriceUpdated as (...args: unknown[]) => void;\n\n // Root on/off: onPriceUpdated registers a wrapper that salla.event.off can't match.\n return onSallaEvent('product::price.updated', listener);\n }, []);\n\n // Subscribe to price update failed events (matches product.js)\n useEffect(() => {\n const handlePriceFailed = () => {\n setProduct((prev) => ({ ...prev, is_out_of_stock: true }));\n };\n\n return onSallaEvent('product::price.updated.failed', handlePriceFailed);\n }, []);\n\n return { product, reload };\n}\n"]}
@@ -1,8 +1,8 @@
1
1
  import { reorder, useLiveBlockMoves } from './chunk-IXHM24Z4.js';
2
- import { HomeComponentRenderer, ReorderProducts } from './chunk-TAVF4E7T.js';
3
- import { home } from './chunk-CRO7DXS3.js';
4
- import { useDevHomeBlocks } from './chunk-AD4QPYNG.js';
5
- import { storePageUrl, buildHreflangAlternates } from './chunk-RYGEIQWO.js';
2
+ import { HomeComponentRenderer, ReorderProducts } from './chunk-ZSEECSDV.js';
3
+ import { home } from './chunk-FXW6H6J3.js';
4
+ import { useDevHomeBlocks } from './chunk-YEBA44IV.js';
5
+ import { storePageUrl, buildHreflangAlternates } from './chunk-MGG4XAJ5.js';
6
6
  import { RouteId } from './chunk-OUW6WESU.js';
7
7
  import { HookSlot } from './chunk-5XDPAKF5.js';
8
8
  import { getTwilightContext } from './chunk-6K34BCUP.js';
@@ -104,5 +104,5 @@ function head(ctx) {
104
104
  var Home = { id: RouteId.INDEX, loader, head, Component: HomePage };
105
105
 
106
106
  export { Home, HomeSkeleton, homeLoader };
107
- //# sourceMappingURL=chunk-RWAOBMAK.js.map
108
- //# sourceMappingURL=chunk-RWAOBMAK.js.map
107
+ //# sourceMappingURL=chunk-HZWTDQVJ.js.map
108
+ //# sourceMappingURL=chunk-HZWTDQVJ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/routes/home/loader.ts","../src/routes/home/HomePage.tsx","../src/routes/home/index.tsx"],"names":["HomeSkeleton","HomePage"],"mappings":";;;;;;;;;;;;;AAWA,eAAsB,WAAW,GAAA,EAAoD;AACnF,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,kBAAA,EAAmB;AAC3C,EAAA,MAAM,aAAa,MAAM,WAAA,CAAY,gBAAgB,IAAA,CAAK,OAAA,CAAQ,YAAY,CAAA;AAC9E,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,MAAA,EAAQ,KAAK,MAAA,IAAU,IAAA;AAAA,IACvB,UAAA,EAAY,UAAA,CAAW,GAAA,CAAI,CAAC,IAAA,MAAU;AAAA,MACpC,GAAG,IAAA;AAAA,MACH,MAAM,IAAA,CAAK,IAAA,EAAM,QAAQ,OAAA,EAAS,EAAE,KAAK,IAAA,CAAK;AAAA,KAChD,CAAE,CAAA;AAAA,IACF,IAAA,EAAM,EAAE,IAAA,EAAM,OAAA,CAAQ,KAAA;AA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AA,CAAM;AAAA,KAChB;AAAA,IACA,oBAAoB,uBAAA,CAAwB,GAAA,CAAI,QAAA,EAAU,GAAA,CAAI,SAAS,QAAQ;AAAA,GACjF;AACF;AAEO,IAAM,IAAA,GAAO,EAAE,EAAA,EAAI,OAAA,CAAQ,OAAO,MAAA,EAAQ,IAAA,EAAM,WAAW,QAAA","file":"chunk-RWAOBMAK.js","sourcesContent":["import { getTwilightContext } from '../../twilight/context';\nimport { home } from '../../api/home';\nimport type { HomeComponentData } from '../../types';\nimport { RouteId } from '../../router/route-ids';\n\nexport interface HomeLoaderData {\n locale: string;\n components: HomeComponentData[];\n page: { slug: string };\n}\n\nexport async function homeLoader(ctx?: { locale?: string }): Promise<HomeLoaderData> {\n const { queryClient } = getTwilightContext();\n const components = await queryClient.ensureQueryData(home.queries.components());\n const result = {\n locale: ctx?.locale || 'ar',\n components: components.map((comp) => ({\n ...comp,\n path: comp.path?.replace('home.', '') || comp.path,\n })),\n page: { slug: RouteId.INDEX },\n };\n return result;\n}\n","import { memo, useCallback, useState } from 'react';\nimport { useDevHomeBlocks } from '../../dev/dev-settings-store';\nimport { HookSlot } from '../../hooks';\nimport { HomeComponentRenderer, ReorderProducts } from '../../components/home';\nimport { reorder, useLiveBlockMoves } from '../../components/live-editor/moves';\nimport type { HomePageProps } from './types';\nimport type { HomeComponentData } from '../../types';\nimport { Pulse } from '@salla.sa/twilight-components-react';\n\nexport const HomeSkeleton = memo(function HomeSkeleton() {\n return (\n <>\n <div className=\"s-block container skeleton-block-hero\">\n <Pulse className=\"h-64 sm:h-80 rounded-md\" />\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n </>\n );\n});\n\n/** As on Twig, a home page with no blocks lists the store's latest products instead. */\nconst LATEST_PRODUCTS: HomeComponentData = { path: 'latest-products' };\n\n/** The blocks' places in the store's order: 0, 1, 2… */\nconst storeOrder = (blocks: readonly unknown[]) => Array.from(blocks, (_, at) => at);\n\nexport const HomePage = memo(function HomePage({ components = [] }: HomePageProps) {\n // Dev-mode only: the dev editor's layout replaces the store's blocks while it\n // is on. No-op passthrough in production builds.\n const renderedComponents = useDevHomeBlocks(components);\n // The theme editor's preview moves blocks in place while the editor saves the\n // order; blocks from the server (a new page, a reload) start over from theirs.\n const [moved, setMoved] = useState<{ source: HomeComponentData[]; order: number[] } | null>(null);\n const order = moved?.source === renderedComponents ? moved.order : null;\n const onMove = useCallback(\n (from: number, to: number) =>\n setMoved((prev) => ({\n source: renderedComponents,\n order: reorder(\n prev?.source === renderedComponents ? prev.order : storeOrder(renderedComponents),\n from,\n to\n ),\n })),\n [renderedComponents]\n );\n useLiveBlockMoves(onMove);\n const placed = order ?? storeOrder(renderedComponents);\n\n return (\n <>\n <HookSlot name=\"home:start\" />\n <HookSlot name=\"home:content\" />\n {placed.map((at, index) => {\n const data = renderedComponents[at];\n // `data.key` is the twilight.json catalog id, shared by every placement\n // of that block. Platform blocks send null. The block's place in the\n // store's order is unique and stays with it when the preview moves it, so\n // a move keeps its state; a dev layout block keeps its own id.\n return <HomeComponentRenderer key={data.__dev_id ?? at} data={data} index={index} />;\n })}\n {!renderedComponents.length && (\n <HomeComponentRenderer data={LATEST_PRODUCTS} index={0} editable={false} />\n )}\n <HookSlot name=\"home:end\" />\n <ReorderProducts />\n </>\n );\n});\n\nexport { HomePage as default };\n","import type { HeadDescriptor } from '../../utils/head';\nimport { buildHreflangAlternates, storePageUrl } from '../../utils/baseHead';\nimport type { HomeLoaderData } from './loader';\nimport { homeLoader } from './loader';\nimport type { TwilightContext } from '../../twilight/context';\nimport { HomePage } from './HomePage';\nimport { RouteId } from '../../router/route-ids';\n\nexport { HomeSkeleton } from './HomePage';\nexport { registerHomeComponents, DefaultHomeComponents } from '../../components/home/register';\nexport { registerHomeComponentConfig } from '../../components/home';\nexport type { HomePageProps } from './types';\nexport type { HomeLoaderData } from './loader';\nexport type {\n HomeComponentsProps,\n AnyHomeComponent,\n HomeComponentConfig,\n} from '../../components/home';\n\nfunction loader(_ctx?: { locale?: string }): Promise<HomeLoaderData> {\n return homeLoader({ locale: _ctx?.locale });\n}\n\nfunction head(ctx: TwilightContext): HeadDescriptor {\n const store = ctx.settings?.store;\n if (!store) return {};\n\n const title = store.meta?.title ?? store.name;\n const description = store.meta?.description ?? store.description;\n const keywords = store.meta?.keywords;\n // `/ar`, like Twig, where store.url reads `/ar/`.\n const url = storePageUrl(ctx.settings, ctx.location.pathname) ?? store.url;\n\n return {\n title,\n description,\n keywords,\n canonical: url,\n openGraph: {\n type: 'website',\n title,\n description,\n images: store.logo,\n url,\n },\n twitter: {\n card: 'summary_large_image',\n title,\n description,\n images: store.logo,\n },\n alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),\n };\n}\n\nexport const Home = { id: RouteId.INDEX, loader, head, Component: HomePage } as const;\n\nexport { homeLoader };\n"]}
1
+ {"version":3,"sources":["../src/routes/home/loader.ts","../src/routes/home/HomePage.tsx","../src/routes/home/index.tsx"],"names":["HomeSkeleton","HomePage"],"mappings":";;;;;;;;;;;;;AAWA,eAAsB,WAAW,GAAA,EAAoD;AACnF,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,kBAAA,EAAmB;AAC3C,EAAA,MAAM,aAAa,MAAM,WAAA,CAAY,gBAAgB,IAAA,CAAK,OAAA,CAAQ,YAAY,CAAA;AAC9E,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,MAAA,EAAQ,KAAK,MAAA,IAAU,IAAA;AAAA,IACvB,UAAA,EAAY,UAAA,CAAW,G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A,MACT,IAAA,EAAM,SAAA;AAAA,MACN,KAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAQ,KAAA,CAAM,IAAA;AAAA,MACd;AAAA,KACF;AAAA,IACA,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,qBAAA;AAAA,MACN,KAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAQ,KAAA,CAAM;AAAA,KAChB;AAAA,IACA,oBAAoB,uBAAA,CAAwB,GAAA,CAAI,QAAA,EAAU,GAAA,CAAI,SAAS,QAAQ;AAAA,GACjF;AACF;AAEO,IAAM,IAAA,GAAO,EAAE,EAAA,EAAI,OAAA,CAAQ,OAAO,MAAA,EAAQ,IAAA,EAAM,WAAW,QAAA","file":"chunk-HZWTDQVJ.js","sourcesContent":["import { getTwilightContext } from '../../twilight/context';\nimport { home } from '../../api/home';\nimport type { HomeComponentData } from '../../types';\nimport { RouteId } from '../../router/route-ids';\n\nexport interface HomeLoaderData {\n locale: string;\n components: HomeComponentData[];\n page: { slug: string };\n}\n\nexport async function homeLoader(ctx?: { locale?: string }): Promise<HomeLoaderData> {\n const { queryClient } = getTwilightContext();\n const components = await queryClient.ensureQueryData(home.queries.components());\n const result = {\n locale: ctx?.locale || 'ar',\n components: components.map((comp) => ({\n ...comp,\n path: comp.path?.replace('home.', '') || comp.path,\n })),\n page: { slug: RouteId.INDEX },\n };\n return result;\n}\n","import { memo, useCallback, useState } from 'react';\nimport { useDevHomeBlocks } from '../../dev/dev-settings-store';\nimport { HookSlot } from '../../hooks';\nimport { HomeComponentRenderer, ReorderProducts } from '../../components/home';\nimport { reorder, useLiveBlockMoves } from '../../components/live-editor/moves';\nimport type { HomePageProps } from './types';\nimport type { HomeComponentData } from '../../types';\nimport { Pulse } from '@salla.sa/twilight-components-react';\n\nexport const HomeSkeleton = memo(function HomeSkeleton() {\n return (\n <>\n <div className=\"s-block container skeleton-block-hero\">\n <Pulse className=\"h-64 sm:h-80 rounded-md\" />\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n </>\n );\n});\n\n/** As on Twig, a home page with no blocks lists the store's latest products instead. */\nconst LATEST_PRODUCTS: HomeComponentData = { path: 'latest-products' };\n\n/** The blocks' places in the store's order: 0, 1, 2… */\nconst storeOrder = (blocks: readonly unknown[]) => Array.from(blocks, (_, at) => at);\n\nexport const HomePage = memo(function HomePage({ components = [] }: HomePageProps) {\n // Dev-mode only: the dev editor's layout replaces the store's blocks while it\n // is on. No-op passthrough in production builds.\n const renderedComponents = useDevHomeBlocks(components);\n // The theme editor's preview moves blocks in place while the editor saves the\n // order; blocks from the server (a new page, a reload) start over from theirs.\n const [moved, setMoved] = useState<{ source: HomeComponentData[]; order: number[] } | null>(null);\n const order = moved?.source === renderedComponents ? moved.order : null;\n const onMove = useCallback(\n (from: number, to: number) =>\n setMoved((prev) => ({\n source: renderedComponents,\n order: reorder(\n prev?.source === renderedComponents ? prev.order : storeOrder(renderedComponents),\n from,\n to\n ),\n })),\n [renderedComponents]\n );\n useLiveBlockMoves(onMove);\n const placed = order ?? storeOrder(renderedComponents);\n\n return (\n <>\n <HookSlot name=\"home:start\" />\n <HookSlot name=\"home:content\" />\n {placed.map((at, index) => {\n const data = renderedComponents[at];\n // `data.key` is the twilight.json catalog id, shared by every placement\n // of that block. Platform blocks send null. The block's place in the\n // store's order is unique and stays with it when the preview moves it, so\n // a move keeps its state; a dev layout block keeps its own id.\n return <HomeComponentRenderer key={data.__dev_id ?? at} data={data} index={index} />;\n })}\n {!renderedComponents.length && (\n <HomeComponentRenderer data={LATEST_PRODUCTS} index={0} editable={false} />\n )}\n <HookSlot name=\"home:end\" />\n <ReorderProducts />\n </>\n );\n});\n\nexport { HomePage as default };\n","import type { HeadDescriptor } from '../../utils/head';\nimport { buildHreflangAlternates, storePageUrl } from '../../utils/baseHead';\nimport type { HomeLoaderData } from './loader';\nimport { homeLoader } from './loader';\nimport type { TwilightContext } from '../../twilight/context';\nimport { HomePage } from './HomePage';\nimport { RouteId } from '../../router/route-ids';\n\nexport { HomeSkeleton } from './HomePage';\nexport { registerHomeComponents, DefaultHomeComponents } from '../../components/home/register';\nexport { registerHomeComponentConfig } from '../../components/home';\nexport type { HomePageProps } from './types';\nexport type { HomeLoaderData } from './loader';\nexport type {\n HomeComponentsProps,\n AnyHomeComponent,\n HomeComponentConfig,\n} from '../../components/home';\n\nfunction loader(_ctx?: { locale?: string }): Promise<HomeLoaderData> {\n return homeLoader({ locale: _ctx?.locale });\n}\n\nfunction head(ctx: TwilightContext): HeadDescriptor {\n const store = ctx.settings?.store;\n if (!store) return {};\n\n const title = store.meta?.title ?? store.name;\n const description = store.meta?.description ?? store.description;\n const keywords = store.meta?.keywords;\n // `/ar`, like Twig, where store.url reads `/ar/`.\n const url = storePageUrl(ctx.settings, ctx.location.pathname) ?? store.url;\n\n return {\n title,\n description,\n keywords,\n canonical: url,\n openGraph: {\n type: 'website',\n title,\n description,\n images: store.logo,\n url,\n },\n twitter: {\n card: 'summary_large_image',\n title,\n description,\n images: store.logo,\n },\n alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),\n };\n}\n\nexport const Home = { id: RouteId.INDEX, loader, head, Component: HomePage } as const;\n\nexport { homeLoader };\n"]}
@@ -1,4 +1,4 @@
1
- import { onSallaEvent } from './chunk-NHA4SBKG.js';
1
+ import { onSallaEvent } from './chunk-XMRNYUQY.js';
2
2
  import { useState, useCallback, useEffect } from 'react';
3
3
 
4
4
  function useComments() {
@@ -16,5 +16,5 @@ function useComments() {
16
16
  }
17
17
 
18
18
  export { useComments };
19
- //# sourceMappingURL=chunk-HOJ5E2PG.js.map
20
- //# sourceMappingURL=chunk-HOJ5E2PG.js.map
19
+ //# sourceMappingURL=chunk-IHOUADLX.js.map
20
+ //# sourceMappingURL=chunk-IHOUADLX.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks/useComments.ts"],"names":[],"mappings":";;;AAuCO,SAAS,WAAA,GAAiC;AAC/C,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,CAAC,CAAA;AAEhD,EAAA,MAAM,OAAA,GAAU,YAAY,MAAM;AAChC,IAAA,cAAA,CAAe,CAAC,IAAA,KAAS,IAAA,GAAO,CAAC,CAAA;AAAA,EACnC,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,qBAAqB,MAAM;AAC/B,MAAA,cAAA,CAAe,CAAC,IAAA,KAAS,IAAA,GAAO,CAAC,CAAA;AAAA,IACnC,CAAA;AAEA,IAAA,OAAO,YAAA,CAAa,kBAAkB,kBAAkB,CAAA;AAAA,EAC1D,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,EAAE,aAAa,OAAA,EAAQ;AAChC","file":"chunk-HOJ5E2PG.js","sourcesContent":["import { useState, useEffect, useCallback } from 'react';\nimport { onSallaEvent } from '../utils/sdk-helpers';\n\n/**\n * UseCommentsResult - Return type for useComments hook\n *\n * @property commentsKey - Key to pass to salla-comments component for re-render\n * @property refresh - Function to manually trigger a comments refresh\n */\nexport interface UseCommentsResult {\n commentsKey: number;\n refresh: () => void;\n}\n\n/**\n * useComments - Hook for managing salla-comments web component re-renders\n *\n * Listens to the Salla SDK's comment added events and automatically\n * increments a re-render key for the salla-comments component. This\n * eliminates the need for full page reloads when comments are added.\n *\n * @returns Object with comments key for component re-rendering and manual refresh function\n *\n * @example\n * ```tsx\n * function ProductPage({ product }) {\n * const { commentsKey } = useComments();\n *\n * return (\n * <salla-comments\n * key={commentsKey}\n * item-id={product.id}\n * type=\"product\"\n * />\n * );\n * }\n * ```\n */\n\nexport function useComments(): UseCommentsResult {\n const [commentsKey, setCommentsKey] = useState(0);\n\n const refresh = useCallback(() => {\n setCommentsKey((prev) => prev + 1);\n }, []);\n\n useEffect(() => {\n const handleCommentAdded = () => {\n setCommentsKey((prev) => prev + 1);\n };\n\n return onSallaEvent('comment::added', handleCommentAdded);\n }, []);\n\n return { commentsKey, refresh };\n}\n"]}
1
+ {"version":3,"sources":["../src/hooks/useComments.ts"],"names":[],"mappings":";;;AAuCO,SAAS,WAAA,GAAiC;AAC/C,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,CAAC,CAAA;AAEhD,EAAA,MAAM,OAAA,GAAU,YAAY,MAAM;AAChC,IAAA,cAAA,CAAe,CAAC,IAAA,KAAS,IAAA,GAAO,CAAC,CAAA;AAAA,EACnC,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,qBAAqB,MAAM;AAC/B,MAAA,cAAA,CAAe,CAAC,IAAA,KAAS,IAAA,GAAO,CAAC,CAAA;AAAA,IACnC,CAAA;AAEA,IAAA,OAAO,YAAA,CAAa,kBAAkB,kBAAkB,CAAA;AAAA,EAC1D,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,EAAE,aAAa,OAAA,EAAQ;AAChC","file":"chunk-IHOUADLX.js","sourcesContent":["import { useState, useEffect, useCallback } from 'react';\nimport { onSallaEvent } from '../utils/sdk-helpers';\n\n/**\n * UseCommentsResult - Return type for useComments hook\n *\n * @property commentsKey - Key to pass to salla-comments component for re-render\n * @property refresh - Function to manually trigger a comments refresh\n */\nexport interface UseCommentsResult {\n commentsKey: number;\n refresh: () => void;\n}\n\n/**\n * useComments - Hook for managing salla-comments web component re-renders\n *\n * Listens to the Salla SDK's comment added events and automatically\n * increments a re-render key for the salla-comments component. This\n * eliminates the need for full page reloads when comments are added.\n *\n * @returns Object with comments key for component re-rendering and manual refresh function\n *\n * @example\n * ```tsx\n * function ProductPage({ product }) {\n * const { commentsKey } = useComments();\n *\n * return (\n * <salla-comments\n * key={commentsKey}\n * item-id={product.id}\n * type=\"product\"\n * />\n * );\n * }\n * ```\n */\n\nexport function useComments(): UseCommentsResult {\n const [commentsKey, setCommentsKey] = useState(0);\n\n const refresh = useCallback(() => {\n setCommentsKey((prev) => prev + 1);\n }, []);\n\n useEffect(() => {\n const handleCommentAdded = () => {\n setCommentsKey((prev) => prev + 1);\n };\n\n return onSallaEvent('comment::added', handleCommentAdded);\n }, []);\n\n return { commentsKey, refresh };\n}\n"]}
@@ -1,9 +1,9 @@
1
1
  import { registry } from './chunk-Y32RHCOH.js';
2
- import { useMoney, useNumber } from './chunk-AXTVBTO4.js';
2
+ import { useMoney, useNumber } from './chunk-BKSVKSAW.js';
3
3
  import { useAsset } from './chunk-Z653O7MX.js';
4
- import { useWishlist } from './chunk-LFHYQ6AN.js';
4
+ import { useWishlist } from './chunk-M5WTY3EH.js';
5
5
  import { useTranslation } from './chunk-TYNZ5B2B.js';
6
- import { Image } from './chunk-P3WHN7JA.js';
6
+ import { Image } from './chunk-FTH3XLIN.js';
7
7
  import { useTwilight } from './chunk-DF6FBKDN.js';
8
8
  import { memo, useCallback, useMemo } from 'react';
9
9
  import { SallaAddProductButton } from '@salla.sa/twilight-components-react/add-product-button';
@@ -228,5 +228,5 @@ var ProductCard = memo(function ProductCard2(props) {
228
228
  });
229
229
 
230
230
  export { ProductCard };
231
- //# sourceMappingURL=chunk-GUODUINX.js.map
232
- //# sourceMappingURL=chunk-GUODUINX.js.map
231
+ //# sourceMappingURL=chunk-JOHFXU4C.js.map
232
+ //# sourceMappingURL=chunk-JOHFXU4C.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/product/ProductCard.tsx"],"names":["ProductCardContent","ProductCard"],"mappings":";;;;;;;;;;;;;AAcA,IAAM,gBAAA,GAAmB,cAAA;AAEzB,IA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OAAA;AAAA,gBACN,SAAA,EAAW,CAAA,CAAE,uBAAA,EAAyB,2BAA2B,CAAA;AAAA,gBACjE,SAAA,EAAW,CAAA,qCAAA,EAAwC,iBAAA,GAAoB,2CAAA,GAA8C,wBAAwB,CAAA,CAAA;AAAA,gBAC7I,OAAA,EAAS,oBAAA;AAAA,gBACT,WAAS,OAAA,CAAQ,EAAA;AAAA,gBAEjB,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,aAAA,EAAc;AAAA;AAAA;AAC7B,WAAA,EAEJ;AAAA,SAAA,EAEJ;AAAA;AAAA;AAAA,GACF;AAEJ,CAAC,CAAA;AAEM,IAAM,WAAA,GAAc,IAAA,CAAK,SAASC,YAAAA,CAAY,KAAA,EAAyB;AAC5E,EAAA,MAAM,SAAA,GAAY,QAAQ,MAAM;AAC9B,IAAA,MAAM,WAAA,GAAc,QAAA,CAAS,WAAA,CAA8B,gBAAgB,CAAA,KAAM,IAAA;AACjF,IAAA,IAAI,WAAA,EAAa;AACf,MAAA,OAAO,QAAA,CAAS,QAA0B,gBAAgB,CAAA;AAAA,IAC5D;AACA,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,uBAAO,GAAA,CAAC,SAAA,EAAA,EAAW,GAAG,KAAA,EAAO,CAAA;AAAA,EAC/B;AAEA,EAAA,uBAAO,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA;AACxC,CAAC","file":"chunk-GUODUINX.js","sourcesContent":["import { memo, useCallback, useMemo } from 'react';\nimport { SallaAddProductButton } from '@salla.sa/twilight-components-react/add-product-button';\nimport { SallaButton } from '@salla.sa/twilight-components-react/button';\nimport { useHostAttributes } from '@salla.sa/twilight-theme-engine/hooks/useHostAttributes';\nimport { useMoney } from '../../hooks/useMoney';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useWishlist } from '../../hooks/useWishlist';\nimport { useAsset } from '../../hooks/useAsset';\nimport { useNumber } from '../../hooks/useNumber';\nimport { registry } from '../ComponentRegistry';\nimport { Image } from '../common';\nimport type { Product } from '../../types';\n\nconst PRODUCT_CARD_KEY = 'product:card';\n\nconst PRODUCT_IMAGE_SRCSET_WIDTHS = [150, 300, 450, 600] as const;\n/** Matches `.s-products-list-vertical-cards`: 2-col below 768px, 4-col above. */\nconst PRODUCT_IMAGE_SIZES = '(min-width: 768px) 25vw, 50vw';\n/** fullImage / minimal slots in FeaturedProductsStyle3 (`lg:grid-cols-2`). */\nconst PRODUCT_WIDE_IMAGE_SIZES = '(min-width: 1024px) 50vw, 100vw';\n\n/** Product card layout variants - mutually exclusive */\nexport type ProductCardLayout = 'vertical' | 'horizontal' | 'fullImage' | 'minimal' | 'special';\n\nexport interface ProductCardProps {\n product: Product;\n layout?: ProductCardLayout;\n className?: string;\n withShadow?: boolean;\n withQuantity?: boolean;\n withoutAddButton?: boolean;\n index?: number;\n imagePriority?: boolean;\n /** Overrides the layout-based image `sizes` hint. */\n sizes?: string;\n}\n\n/**\n * ProductCard - Displays a product in various layouts\n *\n * Layouts:\n * - vertical: Default card with image top, content bottom\n * - horizontal: Side-by-side image and content\n * - fullImage: Full bleed image with overlay content\n * - minimal: Compact version with reduced info\n * - special: Featured card with quantity pie chart\n *\n * Features:\n * - Native lazy loading for images\n * - Product badges (promotion, preorder, quantity, out of stock)\n * - Wishlist toggle button\n * - Price display (sale, starting, regular)\n * - Rating display\n * - Add to cart button via SallaAddProductButton (handles labels internally)\n */\nconst ProductCardContent = memo(function ProductCardContent({\n product,\n layout = 'vertical',\n className = '',\n withShadow = false,\n withQuantity = false,\n withoutAddButton = false,\n index = 0,\n imagePriority = false,\n sizes,\n}: ProductCardProps) {\n const { format } = useMoney();\n const { t } = useTranslation();\n const { store, theme } = useTwilight();\n const wishlist = useWishlist();\n const { isPlaceholder } = useAsset();\n const { format: formatNumber } = useNumber();\n\n // Out-of-stock cards offer \"notify me when available\" instead of a dead button, unless\n // the merchant switched `notify_when_available_in_card` off (Twig theme-raed parity).\n const notifyInCard = theme?.settings?.notify_when_available_in_card !== false;\n const addButtonStatus =\n notifyInCard &&\n product.is_out_of_stock &&\n product.type !== 'donating' &&\n product.type !== 'financial_support'\n ? 'out-and-notify'\n : product.status;\n\n const addButtonRef = useHostAttributes({ fill: 'outline', width: 'wide' });\n\n // Layout flags\n const isVertical = layout === 'vertical';\n const isHorizontal = layout === 'horizontal';\n const isFullImage = layout === 'fullImage';\n const isMinimal = layout === 'minimal';\n const isSpecial = layout === 'special';\n\n // Wishlist status\n const productInWishlist = wishlist.has(Number(product.id));\n const handleWishlistToggle = useCallback(() => {\n wishlist.toggle(Number(product.id));\n }, [wishlist, product.id]);\n\n // Get image fit type from store settings\n const fitImageHeight = store?.settings?.product?.fit_type;\n\n // Product badge component\n const getProductBadge = () => {\n if (product?.preorder?.label && typeof product.preorder.label === 'string') {\n return <div className=\"s-product-card-promotion-title\">{product.preorder.label}</div>;\n }\n if (product.promotion_title) {\n return <div className=\"s-product-card-promotion-title\">{product.promotion_title}</div>;\n }\n if (withQuantity && product?.quantity) {\n const formattedQty = formatNumber(product.quantity);\n return (\n <div className=\"s-product-card-quantity\">\n {t('pages.products.remained', 'Remained')} {formattedQty}\n </div>\n );\n }\n if (withQuantity && product?.is_out_of_stock) {\n return (\n <div className=\"s-product-card-out-badge\">\n {t('pages.products.out_of_stock', 'Out of Stock')}\n </div>\n );\n }\n return null;\n };\n\n // Price display component\n const getProductPrice = () => {\n if (product.is_on_sale && product.sale_price) {\n return (\n <div className=\"s-product-card-sale-price\">\n <h4>{format(product.sale_price)}</h4>\n {product.regular_price && <span>{format(product.regular_price)}</span>}\n </div>\n );\n }\n if (product.starting_price) {\n return (\n <div className=\"s-product-card-starting-price\">\n <p>{t('pages.products.starting_price', 'Starting from')}</p>\n <h4>{format(product.starting_price)}</h4>\n </div>\n );\n }\n return <h4 className=\"s-product-card-price\">{format(product.price)}</h4>;\n };\n\n // Build card class names\n const cardClassName = [\n 's-product-card',\n 's-product-card-entry',\n isVertical ? 's-product-card-vertical' : '',\n isHorizontal ? 's-product-card-horizontal' : '',\n fitImageHeight && isVertical ? `s-product-card-fit-height` : '',\n isSpecial ? 's-product-card-special' : '',\n isFullImage ? 's-product-card-full-image' : '',\n isMinimal ? 's-product-card-minimal' : '',\n product?.donation ? 's-product-card-donation' : '',\n withShadow ? 's-product-card-shadow' : '',\n product?.is_out_of_stock ? 's-product-card-out-of-stock' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n // Image fit class\n const isProductPlaceholder = isPlaceholder(product.image?.url);\n const imageFitClass = isProductPlaceholder ? 'contain' : fitImageHeight || 'cover';\n\n return (\n <div\n id={`product-card-${product.id}`}\n className={cardClassName}\n data-product-id={product.id}\n style={{\n animationDelay: `${index * 100}ms`,\n }}\n >\n <div className={isFullImage ? 's-product-card-image-full' : 's-product-card-image'}>\n <a href={product.url} aria-label={product.image?.alt || product.name}>\n <Image\n className={`s-product-card-image-${imageFitClass}`}\n src={product.image?.url}\n alt={product.image?.alt ?? product.name}\n width={300}\n height={300}\n sizes={\n sizes ?? (isFullImage || isMinimal ? PRODUCT_WIDE_IMAGE_SIZES : PRODUCT_IMAGE_SIZES)\n }\n srcSetWidths={PRODUCT_IMAGE_SRCSET_WIDTHS}\n aspectRatio=\"1/1\"\n priority={imagePriority}\n />\n {!isFullImage && !isMinimal && getProductBadge()}\n </a>\n {isFullImage && (\n <a href={product.url} aria-label={product.name} className=\"s-product-card-overlay\" />\n )}\n {!isHorizontal && !isFullImage && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n <div className=\"s-product-card-content\">\n {/* Special card: quantity pie */}\n {isSpecial && product?.quantity && (\n <div className=\"s-product-card-content-pie\">\n <span>\n <b>{formatNumber(product.quantity)}</b>\n {t('pages.products.remained', 'Remained')}\n </span>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-2 -1 36 34\"\n className=\"s-product-card-content-pie-svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n )}\n\n <div\n className={`s-product-card-content-main ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n <h3 className=\"s-product-card-content-title\">\n <a href={product.url}>{product.name}</a>\n </h3>\n {product.subtitle && !isMinimal && (\n <p className=\"s-product-card-content-subtitle opacity-80\">{product.subtitle}</p>\n )}\n </div>\n\n <div\n className={`s-product-card-content-sub ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n {!product?.donation?.can_donate && getProductPrice()}\n {product.rating?.stars && (\n <div className=\"s-product-card-rating\">\n <i className=\"sicon-star2 text-orange-300\" />\n <span>{product.rating.stars}</span>\n </div>\n )}\n </div>\n\n {!withoutAddButton && (\n <div className=\"s-product-card-content-footer gap-2\">\n <SallaAddProductButton\n ref={addButtonRef}\n fill=\"outline\"\n width=\"wide\"\n productId={product.id}\n productStatus={addButtonStatus}\n productType={product.type}\n hasPreOrder={product.has_preorder_campaign}\n />\n {(isHorizontal || isFullImage) && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n )}\n </div>\n </div>\n );\n});\n\nexport const ProductCard = memo(function ProductCard(props: ProductCardProps) {\n const Component = useMemo(() => {\n const hasOverride = registry.getOriginal<ProductCardProps>(PRODUCT_CARD_KEY) !== null;\n if (hasOverride) {\n return registry.resolve<ProductCardProps>(PRODUCT_CARD_KEY);\n }\n return null;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductCardContent {...props} />;\n});\n\nexport default ProductCard;\n"]}
1
+ {"version":3,"sources":["../src/components/product/ProductCard.tsx"],"names":["ProductCardContent","ProductCard"],"mappings":";;;;;;;;;;;;;AAcA,IAAM,gBAAA,GAAmB,cAAA;AAEzB,IAAM,2BAAA,GAA8B,CAAC,GAAA,EAAK,GAAA,EAAK,KAAK,GAAG,CAAA;AAEvD,IAAM,mBAAA,GAAsB,+BAAA;AAE5B,IAAM,wBAAA,GAA2B,iCAAA;AAoCjC,IAAM,kBAAA,GAAqB,IAAA,CAAK,SAASA,mBAAAA,CAAmB;AAAA,EAC1D,OAAA;AAAA,EACA,MAAA,GAAS,UAAA;AAAA,EACT,SAAA,GAAY,EAAA;AAAA,EACZ,UAAA,GAAa,KAAA;AAAA,EACb,YAAA,GAAe,KAAA;AAAA,EACf,gBAAA,GAAmB,KAAA;AAAA,EACnB,KAAA,GAAQ,CAAA;AAAA,EACR,aAAA,GAAgB,KAAA;AAAA,EAChB;AACF,CAAA,EAAqB;AACnB,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,QAAA,EAAS;AAC5B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,EAAE,KAAA,EAAO,KAAA,EAAM,GAAI,WAAA,EAAY;AACrC,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,QAAA,EAAS;AACnC,EAAA,MAAM,EAAE,MAAA,EAAQ,YAAA,EAAa,GAAI,SAAA,EAAU;AAI3C,EA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BAAO,GAAA,CAAC,SAAA,EAAA,EAAW,GAAG,KAAA,EAAO,CAAA;AAAA,EAC/B;AAEA,EAAA,uBAAO,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA;AACxC,CAAC","file":"chunk-JOHFXU4C.js","sourcesContent":["import { memo, useCallback, useMemo } from 'react';\nimport { SallaAddProductButton } from '@salla.sa/twilight-components-react/add-product-button';\nimport { SallaButton } from '@salla.sa/twilight-components-react/button';\nimport { useHostAttributes } from '@salla.sa/twilight-theme-engine/hooks/useHostAttributes';\nimport { useMoney } from '../../hooks/useMoney';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useWishlist } from '../../hooks/useWishlist';\nimport { useAsset } from '../../hooks/useAsset';\nimport { useNumber } from '../../hooks/useNumber';\nimport { registry } from '../ComponentRegistry';\nimport { Image } from '../common';\nimport type { Product } from '../../types';\n\nconst PRODUCT_CARD_KEY = 'product:card';\n\nconst PRODUCT_IMAGE_SRCSET_WIDTHS = [150, 300, 450, 600] as const;\n/** Matches `.s-products-list-vertical-cards`: 2-col below 768px, 4-col above. */\nconst PRODUCT_IMAGE_SIZES = '(min-width: 768px) 25vw, 50vw';\n/** fullImage / minimal slots in FeaturedProductsStyle3 (`lg:grid-cols-2`). */\nconst PRODUCT_WIDE_IMAGE_SIZES = '(min-width: 1024px) 50vw, 100vw';\n\n/** Product card layout variants - mutually exclusive */\nexport type ProductCardLayout = 'vertical' | 'horizontal' | 'fullImage' | 'minimal' | 'special';\n\nexport interface ProductCardProps {\n product: Product;\n layout?: ProductCardLayout;\n className?: string;\n withShadow?: boolean;\n withQuantity?: boolean;\n withoutAddButton?: boolean;\n index?: number;\n imagePriority?: boolean;\n /** Overrides the layout-based image `sizes` hint. */\n sizes?: string;\n}\n\n/**\n * ProductCard - Displays a product in various layouts\n *\n * Layouts:\n * - vertical: Default card with image top, content bottom\n * - horizontal: Side-by-side image and content\n * - fullImage: Full bleed image with overlay content\n * - minimal: Compact version with reduced info\n * - special: Featured card with quantity pie chart\n *\n * Features:\n * - Native lazy loading for images\n * - Product badges (promotion, preorder, quantity, out of stock)\n * - Wishlist toggle button\n * - Price display (sale, starting, regular)\n * - Rating display\n * - Add to cart button via SallaAddProductButton (handles labels internally)\n */\nconst ProductCardContent = memo(function ProductCardContent({\n product,\n layout = 'vertical',\n className = '',\n withShadow = false,\n withQuantity = false,\n withoutAddButton = false,\n index = 0,\n imagePriority = false,\n sizes,\n}: ProductCardProps) {\n const { format } = useMoney();\n const { t } = useTranslation();\n const { store, theme } = useTwilight();\n const wishlist = useWishlist();\n const { isPlaceholder } = useAsset();\n const { format: formatNumber } = useNumber();\n\n // Out-of-stock cards offer \"notify me when available\" instead of a dead button, unless\n // the merchant switched `notify_when_available_in_card` off (Twig theme-raed parity).\n const notifyInCard = theme?.settings?.notify_when_available_in_card !== false;\n const addButtonStatus =\n notifyInCard &&\n product.is_out_of_stock &&\n product.type !== 'donating' &&\n product.type !== 'financial_support'\n ? 'out-and-notify'\n : product.status;\n\n const addButtonRef = useHostAttributes({ fill: 'outline', width: 'wide' });\n\n // Layout flags\n const isVertical = layout === 'vertical';\n const isHorizontal = layout === 'horizontal';\n const isFullImage = layout === 'fullImage';\n const isMinimal = layout === 'minimal';\n const isSpecial = layout === 'special';\n\n // Wishlist status\n const productInWishlist = wishlist.has(Number(product.id));\n const handleWishlistToggle = useCallback(() => {\n wishlist.toggle(Number(product.id));\n }, [wishlist, product.id]);\n\n // Get image fit type from store settings\n const fitImageHeight = store?.settings?.product?.fit_type;\n\n // Product badge component\n const getProductBadge = () => {\n if (product?.preorder?.label && typeof product.preorder.label === 'string') {\n return <div className=\"s-product-card-promotion-title\">{product.preorder.label}</div>;\n }\n if (product.promotion_title) {\n return <div className=\"s-product-card-promotion-title\">{product.promotion_title}</div>;\n }\n if (withQuantity && product?.quantity) {\n const formattedQty = formatNumber(product.quantity);\n return (\n <div className=\"s-product-card-quantity\">\n {t('pages.products.remained', 'Remained')} {formattedQty}\n </div>\n );\n }\n if (withQuantity && product?.is_out_of_stock) {\n return (\n <div className=\"s-product-card-out-badge\">\n {t('pages.products.out_of_stock', 'Out of Stock')}\n </div>\n );\n }\n return null;\n };\n\n // Price display component\n const getProductPrice = () => {\n if (product.is_on_sale && product.sale_price) {\n return (\n <div className=\"s-product-card-sale-price\">\n <h4>{format(product.sale_price)}</h4>\n {product.regular_price && <span>{format(product.regular_price)}</span>}\n </div>\n );\n }\n if (product.starting_price) {\n return (\n <div className=\"s-product-card-starting-price\">\n <p>{t('pages.products.starting_price', 'Starting from')}</p>\n <h4>{format(product.starting_price)}</h4>\n </div>\n );\n }\n return <h4 className=\"s-product-card-price\">{format(product.price)}</h4>;\n };\n\n // Build card class names\n const cardClassName = [\n 's-product-card',\n 's-product-card-entry',\n isVertical ? 's-product-card-vertical' : '',\n isHorizontal ? 's-product-card-horizontal' : '',\n fitImageHeight && isVertical ? `s-product-card-fit-height` : '',\n isSpecial ? 's-product-card-special' : '',\n isFullImage ? 's-product-card-full-image' : '',\n isMinimal ? 's-product-card-minimal' : '',\n product?.donation ? 's-product-card-donation' : '',\n withShadow ? 's-product-card-shadow' : '',\n product?.is_out_of_stock ? 's-product-card-out-of-stock' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n // Image fit class\n const isProductPlaceholder = isPlaceholder(product.image?.url);\n const imageFitClass = isProductPlaceholder ? 'contain' : fitImageHeight || 'cover';\n\n return (\n <div\n id={`product-card-${product.id}`}\n className={cardClassName}\n data-product-id={product.id}\n style={{\n animationDelay: `${index * 100}ms`,\n }}\n >\n <div className={isFullImage ? 's-product-card-image-full' : 's-product-card-image'}>\n <a href={product.url} aria-label={product.image?.alt || product.name}>\n <Image\n className={`s-product-card-image-${imageFitClass}`}\n src={product.image?.url}\n alt={product.image?.alt ?? product.name}\n width={300}\n height={300}\n sizes={\n sizes ?? (isFullImage || isMinimal ? PRODUCT_WIDE_IMAGE_SIZES : PRODUCT_IMAGE_SIZES)\n }\n srcSetWidths={PRODUCT_IMAGE_SRCSET_WIDTHS}\n aspectRatio=\"1/1\"\n priority={imagePriority}\n />\n {!isFullImage && !isMinimal && getProductBadge()}\n </a>\n {isFullImage && (\n <a href={product.url} aria-label={product.name} className=\"s-product-card-overlay\" />\n )}\n {!isHorizontal && !isFullImage && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n <div className=\"s-product-card-content\">\n {/* Special card: quantity pie */}\n {isSpecial && product?.quantity && (\n <div className=\"s-product-card-content-pie\">\n <span>\n <b>{formatNumber(product.quantity)}</b>\n {t('pages.products.remained', 'Remained')}\n </span>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-2 -1 36 34\"\n className=\"s-product-card-content-pie-svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n )}\n\n <div\n className={`s-product-card-content-main ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n <h3 className=\"s-product-card-content-title\">\n <a href={product.url}>{product.name}</a>\n </h3>\n {product.subtitle && !isMinimal && (\n <p className=\"s-product-card-content-subtitle opacity-80\">{product.subtitle}</p>\n )}\n </div>\n\n <div\n className={`s-product-card-content-sub ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n {!product?.donation?.can_donate && getProductPrice()}\n {product.rating?.stars && (\n <div className=\"s-product-card-rating\">\n <i className=\"sicon-star2 text-orange-300\" />\n <span>{product.rating.stars}</span>\n </div>\n )}\n </div>\n\n {!withoutAddButton && (\n <div className=\"s-product-card-content-footer gap-2\">\n <SallaAddProductButton\n ref={addButtonRef}\n fill=\"outline\"\n width=\"wide\"\n productId={product.id}\n productStatus={addButtonStatus}\n productType={product.type}\n hasPreOrder={product.has_preorder_campaign}\n />\n {(isHorizontal || isFullImage) && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n )}\n </div>\n </div>\n );\n});\n\nexport const ProductCard = memo(function ProductCard(props: ProductCardProps) {\n const Component = useMemo(() => {\n const hasOverride = registry.getOriginal<ProductCardProps>(PRODUCT_CARD_KEY) !== null;\n if (hasOverride) {\n return registry.resolve<ProductCardProps>(PRODUCT_CARD_KEY);\n }\n return null;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductCardContent {...props} />;\n});\n\nexport default ProductCard;\n"]}
@@ -2,24 +2,24 @@ import { lazyComponent } from './chunk-VYGA5AT5.js';
2
2
 
3
3
  // src/components/layout/lazy.ts
4
4
  var LazyHeader = lazyComponent(
5
- () => import('./Header-KDJL4YRP.js').then((m) => ({ default: m.Header }))
5
+ () => import('./Header-DI3OK5TC.js').then((m) => ({ default: m.Header }))
6
6
  );
7
7
  var LazyFooter = lazyComponent(
8
- () => import('./Footer-OWOF2AGC.js').then((m) => ({ default: m.Footer }))
8
+ () => import('./Footer-BNIVXKRM.js').then((m) => ({ default: m.Footer }))
9
9
  );
10
10
  var LazyCopyright = lazyComponent(
11
- () => import('./Copyright-B2GYPZBZ.js').then((m) => ({ default: m.Copyright }))
11
+ () => import('./Copyright-JLIFLENS.js').then((m) => ({ default: m.Copyright }))
12
12
  );
13
13
  var LazyMasterLayout = lazyComponent(
14
- () => import('./MasterLayout-ZMHHLGYL.js').then((m) => ({ default: m.MasterLayout }))
14
+ () => import('./MasterLayout-GHAXKYOR.js').then((m) => ({ default: m.MasterLayout }))
15
15
  );
16
16
  var LazyWidgetHead = lazyComponent(
17
17
  () => import('./WidgetHead-BCRIXIJQ.js').then((m) => ({ default: m.WidgetHead }))
18
18
  );
19
19
  var LazyCustomerLayout = lazyComponent(
20
- () => import('./CustomerLayout-I4XFBCOH.js').then((m) => ({ default: m.CustomerLayout }))
20
+ () => import('./CustomerLayout-JSIYPWY4.js').then((m) => ({ default: m.CustomerLayout }))
21
21
  );
22
22
 
23
23
  export { LazyCopyright, LazyCustomerLayout, LazyFooter, LazyHeader, LazyMasterLayout, LazyWidgetHead };
24
- //# sourceMappingURL=chunk-MZ4LTJQD.js.map
25
- //# sourceMappingURL=chunk-MZ4LTJQD.js.map
24
+ //# sourceMappingURL=chunk-K4YRFOFA.js.map
25
+ //# sourceMappingURL=chunk-K4YRFOFA.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/layout/lazy.ts"],"names":[],"mappings":";;;AAMO,IAAM,UAAA,GAAa,aAAA;AAAA,EAAc,MACtC,OAAO,sBAAU,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,MAAA,EAAO,CAAE;AACxD;AAEO,IAAM,UAAA,GAAa,aAAA;AAAA,EAAc,MACtC,OAAO,sBAAU,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,MAAA,EAAO,CAAE;AACxD;AAEO,IAAM,aAAA,GAAgB,aAAA;AAAA,EAAc,MACzC,OAAO,yBAAa,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,SAAA,EAAU,CAAE;AAC9D;AAEO,IAAM,gBAAA,GAAmB,aAAA;AAAA,EAAc,MAC5C,OAAO,4BAAgB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,YAAA,EAAa,CAAE;AACpE;AAEO,IAAM,cAAA,GAAiB,aAAA;AAAA,EAAc,MAC1C,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW,CAAE;AAChE;AAEO,IAAM,kBAAA,GAAqB,aAAA;AAAA,EAAc,MAC9C,OAAO,8BAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,cAAA,EAAe,CAAE;AACxE","file":"chunk-MZ4LTJQD.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\n/**\n * Lazy-loaded layout components\n * Use these for code-splitting layout sections\n */\nexport const LazyHeader = lazyComponent(() =>\n import('./Header').then((m) => ({ default: m.Header }))\n);\n\nexport const LazyFooter = lazyComponent(() =>\n import('./Footer').then((m) => ({ default: m.Footer }))\n);\n\nexport const LazyCopyright = lazyComponent(() =>\n import('./Copyright').then((m) => ({ default: m.Copyright }))\n);\n\nexport const LazyMasterLayout = lazyComponent(() =>\n import('./MasterLayout').then((m) => ({ default: m.MasterLayout }))\n);\n\nexport const LazyWidgetHead = lazyComponent(() =>\n import('./WidgetHead').then((m) => ({ default: m.WidgetHead }))\n);\n\nexport const LazyCustomerLayout = lazyComponent(() =>\n import('./CustomerLayout').then((m) => ({ default: m.CustomerLayout }))\n);\n"]}
1
+ {"version":3,"sources":["../src/components/layout/lazy.ts"],"names":[],"mappings":";;;AAMO,IAAM,UAAA,GAAa,aAAA;AAAA,EAAc,MACtC,OAAO,sBAAU,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,MAAA,EAAO,CAAE;AACxD;AAEO,IAAM,UAAA,GAAa,aAAA;AAAA,EAAc,MACtC,OAAO,sBAAU,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,MAAA,EAAO,CAAE;AACxD;AAEO,IAAM,aAAA,GAAgB,aAAA;AAAA,EAAc,MACzC,OAAO,yBAAa,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,SAAA,EAAU,CAAE;AAC9D;AAEO,IAAM,gBAAA,GAAmB,aAAA;AAAA,EAAc,MAC5C,OAAO,4BAAgB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,YAAA,EAAa,CAAE;AACpE;AAEO,IAAM,cAAA,GAAiB,aAAA;AAAA,EAAc,MAC1C,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW,CAAE;AAChE;AAEO,IAAM,kBAAA,GAAqB,aAAA;AAAA,EAAc,MAC9C,OAAO,8BAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,cAAA,EAAe,CAAE;AACxE","file":"chunk-K4YRFOFA.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\n/**\n * Lazy-loaded layout components\n * Use these for code-splitting layout sections\n */\nexport const LazyHeader = lazyComponent(() =>\n import('./Header').then((m) => ({ default: m.Header }))\n);\n\nexport const LazyFooter = lazyComponent(() =>\n import('./Footer').then((m) => ({ default: m.Footer }))\n);\n\nexport const LazyCopyright = lazyComponent(() =>\n import('./Copyright').then((m) => ({ default: m.Copyright }))\n);\n\nexport const LazyMasterLayout = lazyComponent(() =>\n import('./MasterLayout').then((m) => ({ default: m.MasterLayout }))\n);\n\nexport const LazyWidgetHead = lazyComponent(() =>\n import('./WidgetHead').then((m) => ({ default: m.WidgetHead }))\n);\n\nexport const LazyCustomerLayout = lazyComponent(() =>\n import('./CustomerLayout').then((m) => ({ default: m.CustomerLayout }))\n);\n"]}
@@ -1,6 +1,6 @@
1
1
  import { useTranslation } from './chunk-TYNZ5B2B.js';
2
2
  import { useAsyncFn } from './chunk-6BZ5TKEV.js';
3
- import { whenSallaLoaded, onSallaEvent } from './chunk-NHA4SBKG.js';
3
+ import { whenSallaLoaded, onSallaEvent } from './chunk-XMRNYUQY.js';
4
4
  import { useSyncExternalStore, useCallback } from 'react';
5
5
 
6
6
  var WISHLIST_STORAGE_KEY = "salla::wishlist";
@@ -126,5 +126,5 @@ function resetWishlistStore() {
126
126
  }
127
127
 
128
128
  export { resetWishlistStore, useWishlist };
129
- //# sourceMappingURL=chunk-LFHYQ6AN.js.map
130
- //# sourceMappingURL=chunk-LFHYQ6AN.js.map
129
+ //# sourceMappingURL=chunk-M5WTY3EH.js.map
130
+ //# sourceMappingURL=chunk-M5WTY3EH.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks/useWishlist.ts"],"names":[],"mappings":";;;;;AAuCA,IAAM,oBAAA,GAAuB,iBAAA;AAE7B,IAAI,MAAgB,EAAC;AACrB,IAAM,SAAA,uBAAgB,GAAA,EAAgB;AACtC,IAAI,UAAA,GAAa,KAAA;AAEjB,SAAS,UAAA,GAAa;AACpB,EAAA,KAAA,MAAW,QAAA,IAAY,WAAW,QAAA,EAAS;AAC7C;AAEA,SAAS,UAAU,QAAA,EAAsB;AACvC,EAAA,SAAA,CAAU,IAAI,QAAQ,CAAA;AACtB,EAAA,OAAO,MAAM;AACX,IAAA,SAAA,CAAU,OAAO,QAAQ,CAAA;AAAA,EAC3B,CAAA;AACF;AAEA,SAAS,WAAA,GAAwB;AAC/B,EAAA,OAAO,GAAA;AACT;AAEA,IAAM,iBAAA,GAAoB,MAAgB,EAAC;AAE3C,SAAS,UAAA,GAAa;AACpB,EAAA,IAAI;AACF,IAAA,YAAA,CAAa,OAAA,CAAQ,oBAAA,EAAsB,IAAA,CAAK,SAAA,CAAU,GAAG,CAAC,CAAA;AAAA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;AAAA,IACA,MAAA;AAAA,IACA,OAAA,EAAS,QAAA,CAAS,OAAA,IAAW,WAAA,CAAY,OAAA;AAAA,IACzC,KAAA,EAAA,CAAQ,QAAA,CAAS,KAAA,IAAS,WAAA,CAAY,QAAQ,OAAA,IAAW;AAAA,GAC3D;AACF;AAEO,SAAS,kBAAA,GAAqB;AACnC,EAAA,GAAA,GAAM,EAAC;AACP,EAAA,SAAA,CAAU,KAAA,EAAM;AAChB,EAAA,UAAA,GAAa,KAAA;AACf","file":"chunk-LFHYQ6AN.js","sourcesContent":["import { useCallback, useSyncExternalStore } from 'react';\nimport { useAsyncFn } from './useAsyncFn';\nimport { useTranslation } from '../providers/I18nProvider';\nimport { onSallaEvent, whenSallaLoaded } from '../utils/sdk-helpers';\nimport type { UseToggleWithItems } from './types';\n\nexport type UseWishlistResult = UseToggleWithItems<number>;\n\n/**\n * useWishlist - Hook for managing wishlist functionality\n *\n * Provides wishlist product management with local storage persistence\n * and Salla SDK integration. Syncs with the SDK's wishlist state and\n * listens for events to maintain real-time consistency.\n *\n * Uses a module-level singleton store so SDK event listeners are\n * registered ONCE globally — not per-component. All hook instances\n * share the same state via `useSyncExternalStore`.\n *\n * @returns Wishlist state and management functions\n *\n * @example\n * ```tsx\n * function WishlistButton({ productId }) {\n * const { has, toggle, loading } = useWishlist();\n *\n * return (\n * <button\n * onClick={() => toggle(productId)}\n * disabled={loading}\n * className={has(productId) ? 'liked' : ''}\n * >\n * ❤️\n * </button>\n * );\n * }\n * ```\n */\n\nconst WISHLIST_STORAGE_KEY = 'salla::wishlist';\n\nlet ids: number[] = [];\nconst listeners = new Set<() => void>();\nlet subscribed = false;\n\nfunction emitChange() {\n for (const listener of listeners) listener();\n}\n\nfunction subscribe(listener: () => void) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\nfunction getSnapshot(): number[] {\n return ids;\n}\n\nconst getServerSnapshot = (): number[] => [];\n\nfunction persistIds() {\n try {\n localStorage.setItem(WISHLIST_STORAGE_KEY, JSON.stringify(ids));\n } catch {\n /* ignore storage errors */\n }\n}\n\nfunction initFromStorage() {\n try {\n // `storage` is missing while `window.salla` is still the head script's stub.\n const sdkWishlist = window.salla?.storage?.get(WISHLIST_STORAGE_KEY, []);\n const stored = localStorage.getItem(WISHLIST_STORAGE_KEY);\n const parsed = stored ? JSON.parse(stored) : [];\n ids = Array.isArray(sdkWishlist) && sdkWishlist.length > 0 ? sdkWishlist : parsed;\n } catch {\n /* ignore storage errors */\n }\n}\n\nfunction reloadFromStorage() {\n initFromStorage();\n emitChange();\n}\n\nfunction ensureSubscribed() {\n if (subscribed || typeof window === 'undefined') return;\n subscribed = true;\n initFromStorage();\n\n // On a cold load hydration runs before the SDK has loaded.\n whenSallaLoaded((salla) => {\n reloadFromStorage();\n if (!salla.wishlist?.event) return;\n\n salla.wishlist.event.onAdded((_event: unknown, id: number) => {\n if (ids.includes(id)) return;\n ids = [...ids, id];\n persistIds();\n emitChange();\n });\n\n salla.wishlist.event.onRemoved((_response: unknown, id: number) => {\n ids = ids.filter((itemId) => itemId !== id);\n persistIds();\n emitChange();\n });\n });\n\n // The SDK fills its storage with the customer's saved wishlist after init.\n onSallaEvent('wishlist::storage.synced', reloadFromStorage);\n}\n\n/**\n * useAsyncFn resolves with whatever the SDK rejected with, and callers detect\n * failure via `instanceof Error`. Normalize non-Error rejections so they are\n * never mistaken for success.\n */\nfunction toError(reason: unknown, fallback: string): Error {\n if (reason instanceof Error) return reason;\n if (typeof reason === 'string') return new Error(reason);\n const message = (reason as { message?: unknown } | null)?.message;\n return new Error(typeof message === 'string' ? message : fallback);\n}\n\nexport function useWishlist(): UseWishlistResult {\n ensureSubscribed();\n const storedIds = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n const { t } = useTranslation();\n const failed = t('common.errors.error_occurred', 'Something went wrong');\n\n const [addState, addFn] = useAsyncFn(\n async (productId: number) => {\n const salla = window.salla;\n try {\n await salla?.wishlist.add(productId);\n } catch (reason) {\n throw toError(reason, failed);\n }\n if (!ids.includes(productId)) {\n ids = [...ids, productId];\n persistIds();\n emitChange();\n }\n },\n [failed]\n );\n\n const [removeState, removeFn] = useAsyncFn(\n async (productId: number) => {\n const salla = window.salla;\n try {\n await salla?.wishlist.remove(productId);\n } catch (reason) {\n throw toError(reason, failed);\n }\n ids = ids.filter((id) => id !== productId);\n persistIds();\n emitChange();\n },\n [failed]\n );\n\n const has = useCallback((productId: number) => storedIds.includes(productId), [storedIds]);\n\n const add = async (productId: number): Promise<boolean> =>\n !(((await addFn(productId)) as unknown) instanceof Error);\n\n const remove = async (productId: number): Promise<boolean> =>\n !(((await removeFn(productId)) as unknown) instanceof Error);\n\n const toggle = useCallback(\n (productId: number) => (has(productId) ? remove(productId) : add(productId)),\n [has, addFn, removeFn]\n );\n\n return {\n ids: storedIds,\n count: storedIds.length,\n has,\n add,\n remove,\n toggle,\n loading: addState.loading || removeState.loading,\n error: (addState.error ?? removeState.error)?.message ?? null,\n };\n}\n\nexport function resetWishlistStore() {\n ids = [];\n listeners.clear();\n subscribed = false;\n}\n"]}
1
+ {"version":3,"sources":["../src/hooks/useWishlist.ts"],"names":[],"mappings":";;;;;AAuCA,IAAM,oBAAA,GAAuB,iBAAA;AAE7B,IAAI,MAAgB,EAAC;AACrB,IAAM,SAAA,uBAAgB,GAAA,EAAgB;AACtC,IAAI,UAAA,GAAa,KAAA;AAEjB,SAAS,UAAA,GAAa;AACpB,EAAA,KAAA,MAAW,QAAA,IAAY,WAAW,QAAA,EAAS;AAC7C;AAEA,SAAS,UAAU,QAAA,EAAsB;AACvC,EAAA,SAAA,CAAU,IAAI,QAAQ,CAAA;AACtB,EAAA,OAAO,MAAM;AACX,IAAA,SAAA,CAAU,OAAO,QAAQ,CAAA;AAAA,EAC3B,CAAA;AACF;AAEA,SAAS,WAAA,GAAwB;AAC/B,EAAA,OAAO,GAAA;AACT;AAEA,IAAM,iBAAA,GAAoB,MAAgB,EAAC;AAE3C,SAAS,UAAA,GAAa;AACpB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A,IACL,GAAA,EAAK,SAAA;AAAA,IACL,OAAO,SAAA,CAAU,MAAA;AAAA,IACjB,GAAA;AAAA,IACA,GAAA;AAAA,IACA,MAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA,EAAS,QAAA,CAAS,OAAA,IAAW,WAAA,CAAY,OAAA;AAAA,IACzC,KAAA,EAAA,CAAQ,QAAA,CAAS,KAAA,IAAS,WAAA,CAAY,QAAQ,OAAA,IAAW;AAAA,GAC3D;AACF;AAEO,SAAS,kBAAA,GAAqB;AACnC,EAAA,GAAA,GAAM,EAAC;AACP,EAAA,SAAA,CAAU,KAAA,EAAM;AAChB,EAAA,UAAA,GAAa,KAAA;AACf","file":"chunk-M5WTY3EH.js","sourcesContent":["import { useCallback, useSyncExternalStore } from 'react';\nimport { useAsyncFn } from './useAsyncFn';\nimport { useTranslation } from '../providers/I18nProvider';\nimport { onSallaEvent, whenSallaLoaded } from '../utils/sdk-helpers';\nimport type { UseToggleWithItems } from './types';\n\nexport type UseWishlistResult = UseToggleWithItems<number>;\n\n/**\n * useWishlist - Hook for managing wishlist functionality\n *\n * Provides wishlist product management with local storage persistence\n * and Salla SDK integration. Syncs with the SDK's wishlist state and\n * listens for events to maintain real-time consistency.\n *\n * Uses a module-level singleton store so SDK event listeners are\n * registered ONCE globally — not per-component. All hook instances\n * share the same state via `useSyncExternalStore`.\n *\n * @returns Wishlist state and management functions\n *\n * @example\n * ```tsx\n * function WishlistButton({ productId }) {\n * const { has, toggle, loading } = useWishlist();\n *\n * return (\n * <button\n * onClick={() => toggle(productId)}\n * disabled={loading}\n * className={has(productId) ? 'liked' : ''}\n * >\n * ❤️\n * </button>\n * );\n * }\n * ```\n */\n\nconst WISHLIST_STORAGE_KEY = 'salla::wishlist';\n\nlet ids: number[] = [];\nconst listeners = new Set<() => void>();\nlet subscribed = false;\n\nfunction emitChange() {\n for (const listener of listeners) listener();\n}\n\nfunction subscribe(listener: () => void) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\nfunction getSnapshot(): number[] {\n return ids;\n}\n\nconst getServerSnapshot = (): number[] => [];\n\nfunction persistIds() {\n try {\n localStorage.setItem(WISHLIST_STORAGE_KEY, JSON.stringify(ids));\n } catch {\n /* ignore storage errors */\n }\n}\n\nfunction initFromStorage() {\n try {\n // `storage` is missing while `window.salla` is still the head script's stub.\n const sdkWishlist = window.salla?.storage?.get(WISHLIST_STORAGE_KEY, []);\n const stored = localStorage.getItem(WISHLIST_STORAGE_KEY);\n const parsed = stored ? JSON.parse(stored) : [];\n ids = Array.isArray(sdkWishlist) && sdkWishlist.length > 0 ? sdkWishlist : parsed;\n } catch {\n /* ignore storage errors */\n }\n}\n\nfunction reloadFromStorage() {\n initFromStorage();\n emitChange();\n}\n\nfunction ensureSubscribed() {\n if (subscribed || typeof window === 'undefined') return;\n subscribed = true;\n initFromStorage();\n\n // On a cold load hydration runs before the SDK has loaded.\n whenSallaLoaded((salla) => {\n reloadFromStorage();\n if (!salla.wishlist?.event) return;\n\n salla.wishlist.event.onAdded((_event: unknown, id: number) => {\n if (ids.includes(id)) return;\n ids = [...ids, id];\n persistIds();\n emitChange();\n });\n\n salla.wishlist.event.onRemoved((_response: unknown, id: number) => {\n ids = ids.filter((itemId) => itemId !== id);\n persistIds();\n emitChange();\n });\n });\n\n // The SDK fills its storage with the customer's saved wishlist after init.\n onSallaEvent('wishlist::storage.synced', reloadFromStorage);\n}\n\n/**\n * useAsyncFn resolves with whatever the SDK rejected with, and callers detect\n * failure via `instanceof Error`. Normalize non-Error rejections so they are\n * never mistaken for success.\n */\nfunction toError(reason: unknown, fallback: string): Error {\n if (reason instanceof Error) return reason;\n if (typeof reason === 'string') return new Error(reason);\n const message = (reason as { message?: unknown } | null)?.message;\n return new Error(typeof message === 'string' ? message : fallback);\n}\n\nexport function useWishlist(): UseWishlistResult {\n ensureSubscribed();\n const storedIds = useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n const { t } = useTranslation();\n const failed = t('common.errors.error_occurred', 'Something went wrong');\n\n const [addState, addFn] = useAsyncFn(\n async (productId: number) => {\n const salla = window.salla;\n try {\n await salla?.wishlist.add(productId);\n } catch (reason) {\n throw toError(reason, failed);\n }\n if (!ids.includes(productId)) {\n ids = [...ids, productId];\n persistIds();\n emitChange();\n }\n },\n [failed]\n );\n\n const [removeState, removeFn] = useAsyncFn(\n async (productId: number) => {\n const salla = window.salla;\n try {\n await salla?.wishlist.remove(productId);\n } catch (reason) {\n throw toError(reason, failed);\n }\n ids = ids.filter((id) => id !== productId);\n persistIds();\n emitChange();\n },\n [failed]\n );\n\n const has = useCallback((productId: number) => storedIds.includes(productId), [storedIds]);\n\n const add = async (productId: number): Promise<boolean> =>\n !(((await addFn(productId)) as unknown) instanceof Error);\n\n const remove = async (productId: number): Promise<boolean> =>\n !(((await removeFn(productId)) as unknown) instanceof Error);\n\n const toggle = useCallback(\n (productId: number) => (has(productId) ? remove(productId) : add(productId)),\n [has, addFn, removeFn]\n );\n\n return {\n ids: storedIds,\n count: storedIds.length,\n has,\n add,\n remove,\n toggle,\n loading: addState.loading || removeState.loading,\n error: (addState.error ?? removeState.error)?.message ?? null,\n };\n}\n\nexport function resetWishlistStore() {\n ids = [];\n listeners.clear();\n subscribed = false;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { resolveStoreBase, resolveStoreBaseFollowsLocale, splitLeadingSegment } from './chunk-FXVII733.js';
1
+ import { resolveStoreBase, resolveStoreBaseFollowsLocale, splitLeadingSegment } from './chunk-T2752RH7.js';
2
2
  import { FALLBACK_LOCALE, isLocale } from './chunk-T72DAX7R.js';
3
3
 
4
4
  // src/utils/baseHead.ts
@@ -135,5 +135,5 @@ function buildBaseHead(settings, locale = FALLBACK_LOCALE, path) {
135
135
  }
136
136
 
137
137
  export { buildBaseHead, buildHreflangAlternates, localeToOgLocale, storePageUrl };
138
- //# sourceMappingURL=chunk-RYGEIQWO.js.map
139
- //# sourceMappingURL=chunk-RYGEIQWO.js.map
138
+ //# sourceMappingURL=chunk-MGG4XAJ5.js.map
139
+ //# sourceMappingURL=chunk-MGG4XAJ5.js.map