@salla.sa/twilight-theme-engine 1.0.149 → 1.0.150

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 (258) hide show
  1. package/dist/{AddToCartForm-NMHCW3UT.js → AddToCartForm-P5Q4P763.js} +3 -3
  2. package/dist/{AddToCartForm-NMHCW3UT.js.map → AddToCartForm-P5Q4P763.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-2WTKZNOV.js → BlogAuthorPage-Z3R6AETN.js} +27 -27
  4. package/dist/{BlogAuthorPage-2WTKZNOV.js.map → BlogAuthorPage-Z3R6AETN.js.map} +1 -1
  5. package/dist/{BlogCategoryPage-SF3FJKUX.js → BlogCategoryPage-7VROFBGI.js} +27 -27
  6. package/dist/{BlogCategoryPage-SF3FJKUX.js.map → BlogCategoryPage-7VROFBGI.js.map} +1 -1
  7. package/dist/{BlogPage-LYB32QET.js → BlogPage-Q2NN4WTB.js} +25 -25
  8. package/dist/{BlogPage-LYB32QET.js.map → BlogPage-Q2NN4WTB.js.map} +1 -1
  9. package/dist/{BlogSinglePage-BLPEE6HL.js → BlogSinglePage-ZPCSNBIX.js} +25 -25
  10. package/dist/{BlogSinglePage-BLPEE6HL.js.map → BlogSinglePage-ZPCSNBIX.js.map} +1 -1
  11. package/dist/{BlogTagPage-D7QVEP5N.js → BlogTagPage-IGG2VEMR.js} +27 -27
  12. package/dist/{BlogTagPage-D7QVEP5N.js.map → BlogTagPage-IGG2VEMR.js.map} +1 -1
  13. package/dist/{BrandsPage-7C5IPCVT.js → BrandsPage-ZAJT6RGM.js} +26 -26
  14. package/dist/{BrandsPage-7C5IPCVT.js.map → BrandsPage-ZAJT6RGM.js.map} +1 -1
  15. package/dist/{Breadcrumb-WMXQ3SI3.js → Breadcrumb-KE4EWH7L.js} +25 -25
  16. package/dist/{Breadcrumb-WMXQ3SI3.js.map → Breadcrumb-KE4EWH7L.js.map} +1 -1
  17. package/dist/{CartItem-BBC25XRJ.js → CartItem-RMCXCGHT.js} +25 -25
  18. package/dist/{CartItem-BBC25XRJ.js.map → CartItem-RMCXCGHT.js.map} +1 -1
  19. package/dist/{CartSummary-6QADXXET.js → CartSummary-NLEAHKWF.js} +25 -25
  20. package/dist/{CartSummary-6QADXXET.js.map → CartSummary-NLEAHKWF.js.map} +1 -1
  21. package/dist/{Copyright-GFBOKME6.js → Copyright-EIBPTE3B.js} +3 -3
  22. package/dist/{Copyright-GFBOKME6.js.map → Copyright-EIBPTE3B.js.map} +1 -1
  23. package/dist/{CustomerLayout-4LOPQ7HW.js → CustomerLayout-POGWFN6R.js} +25 -25
  24. package/dist/{CustomerLayout-4LOPQ7HW.js.map → CustomerLayout-POGWFN6R.js.map} +1 -1
  25. package/dist/{Footer-HATEFXZP.js → Footer-LGIUINGS.js} +4 -4
  26. package/dist/{Footer-HATEFXZP.js.map → Footer-LGIUINGS.js.map} +1 -1
  27. package/dist/{Header-R2VM5EFR.js → Header-4TGYO6E4.js} +11 -11
  28. package/dist/{Header-R2VM5EFR.js.map → Header-4TGYO6E4.js.map} +1 -1
  29. package/dist/{LatestProducts-IOYD7Y4Z.js → LatestProducts-YYKQNL5N.js} +27 -27
  30. package/dist/{LatestProducts-IOYD7Y4Z.js.map → LatestProducts-YYKQNL5N.js.map} +1 -1
  31. package/dist/{LoyaltyPage-2JPXJ3DB.js → LoyaltyPage-MROFMZXV.js} +25 -25
  32. package/dist/{LoyaltyPage-2JPXJ3DB.js.map → LoyaltyPage-MROFMZXV.js.map} +1 -1
  33. package/dist/{LoyaltyPointsPage-B7EALH4Z.js → LoyaltyPointsPage-DVHJOAKP.js} +8 -8
  34. package/dist/{LoyaltyPointsPage-B7EALH4Z.js.map → LoyaltyPointsPage-DVHJOAKP.js.map} +1 -1
  35. package/dist/{MainMenu-BGVWE6TJ.js → MainMenu-GQO5KOTU.js} +7 -7
  36. package/dist/{MainMenu-BGVWE6TJ.js.map → MainMenu-GQO5KOTU.js.map} +1 -1
  37. package/dist/{MasterLayout-U33ZBIZO.js → MasterLayout-ZJBJ7EHM.js} +25 -25
  38. package/dist/{MasterLayout-U33ZBIZO.js.map → MasterLayout-ZJBJ7EHM.js.map} +1 -1
  39. package/dist/{MobileMenu-6OERFJSR.js → MobileMenu-TZSFYHPW.js} +26 -26
  40. package/dist/{MobileMenu-6OERFJSR.js.map → MobileMenu-TZSFYHPW.js.map} +1 -1
  41. package/dist/{NotificationsPage-YBFHEZYG.js → NotificationsPage-BX6OSIDY.js} +25 -25
  42. package/dist/{NotificationsPage-YBFHEZYG.js.map → NotificationsPage-BX6OSIDY.js.map} +1 -1
  43. package/dist/{OrderSinglePage-EPOX5KJG.js → OrderSinglePage-3RQ5TJDB.js} +26 -26
  44. package/dist/{OrderSinglePage-EPOX5KJG.js.map → OrderSinglePage-3RQ5TJDB.js.map} +1 -1
  45. package/dist/{OrdersPage-6RPTMFAL.js → OrdersPage-S4ECYNGI.js} +25 -25
  46. package/dist/{OrdersPage-6RPTMFAL.js.map → OrdersPage-S4ECYNGI.js.map} +1 -1
  47. package/dist/{PageSingle-CEFQDKOP.js → PageSingle-BZGDC4VE.js} +6 -6
  48. package/dist/{PageSingle-CEFQDKOP.js.map → PageSingle-BZGDC4VE.js.map} +1 -1
  49. package/dist/{ProductDetails-M6C6H3J4.js → ProductDetails-ZPRWPSVK.js} +7 -7
  50. package/dist/{ProductDetails-M6C6H3J4.js.map → ProductDetails-ZPRWPSVK.js.map} +1 -1
  51. package/dist/{ProfilePage-EJV2V46I.js → ProfilePage-SKAS6LFQ.js} +25 -25
  52. package/dist/{ProfilePage-EJV2V46I.js.map → ProfilePage-SKAS6LFQ.js.map} +1 -1
  53. package/dist/{ReviewsPage-5K4PEJVZ.js → ReviewsPage-NAZWXVXT.js} +3 -3
  54. package/dist/{ReviewsPage-5K4PEJVZ.js.map → ReviewsPage-NAZWXVXT.js.map} +1 -1
  55. package/dist/{SeoCartWidget-EQY6JIQR.js → SeoCartWidget-6NB6LT2Z.js} +25 -25
  56. package/dist/{SeoCartWidget-EQY6JIQR.js.map → SeoCartWidget-6NB6LT2Z.js.map} +1 -1
  57. package/dist/{SettingsPage-AXHVNXFO.js → SettingsPage-GZ2NJIUR.js} +25 -25
  58. package/dist/{SettingsPage-AXHVNXFO.js.map → SettingsPage-GZ2NJIUR.js.map} +1 -1
  59. package/dist/{StoreClosedNotification-W2ATH4WF.js → StoreClosedNotification-V72F7HE5.js} +26 -26
  60. package/dist/{StoreClosedNotification-W2ATH4WF.js.map → StoreClosedNotification-V72F7HE5.js.map} +1 -1
  61. package/dist/{TestimonialsPage-DYXOQOYG.js → TestimonialsPage-L6VBZFLT.js} +6 -6
  62. package/dist/{TestimonialsPage-DYXOQOYG.js.map → TestimonialsPage-L6VBZFLT.js.map} +1 -1
  63. package/dist/{ThankYouPage-NZVL7WLY.js → ThankYouPage-O5U3V6J4.js} +25 -25
  64. package/dist/{ThankYouPage-NZVL7WLY.js.map → ThankYouPage-O5U3V6J4.js.map} +1 -1
  65. package/dist/{WalletPage-6JUYGDBV.js → WalletPage-NJBBZIMM.js} +26 -26
  66. package/dist/{WalletPage-6JUYGDBV.js.map → WalletPage-NJBBZIMM.js.map} +1 -1
  67. package/dist/{WebMcpTools-5RGBTR7I.js → WebMcpTools-VAZH3S5G.js} +9 -9
  68. package/dist/{WebMcpTools-5RGBTR7I.js.map → WebMcpTools-VAZH3S5G.js.map} +1 -1
  69. package/dist/{WishlistPage-VVPNCLOP.js → WishlistPage-UKOGNFKB.js} +27 -27
  70. package/dist/{WishlistPage-VVPNCLOP.js.map → WishlistPage-UKOGNFKB.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-H2M2573Y.js → chunk-2CILV5ME.js} +5 -5
  92. package/dist/{chunk-H2M2573Y.js.map → chunk-2CILV5ME.js.map} +1 -1
  93. package/dist/{chunk-62IIZZPR.js → chunk-2HCODIC6.js} +4 -4
  94. package/dist/{chunk-62IIZZPR.js.map → chunk-2HCODIC6.js.map} +1 -1
  95. package/dist/{chunk-IQNTYZGF.js → chunk-2ZC5YGMI.js} +3 -3
  96. package/dist/{chunk-IQNTYZGF.js.map → chunk-2ZC5YGMI.js.map} +1 -1
  97. package/dist/{chunk-TJ3TISBF.js → chunk-34L65JGK.js} +4 -4
  98. package/dist/{chunk-TJ3TISBF.js.map → chunk-34L65JGK.js.map} +1 -1
  99. package/dist/{chunk-T2752RH7.js → chunk-4E6FD5W7.js} +60 -4
  100. package/dist/chunk-4E6FD5W7.js.map +1 -0
  101. package/dist/{chunk-M5WTY3EH.js → chunk-5EAISVPV.js} +3 -3
  102. package/dist/{chunk-M5WTY3EH.js.map → chunk-5EAISVPV.js.map} +1 -1
  103. package/dist/{chunk-E3Z3PQAP.js → chunk-5LI536P6.js} +5 -5
  104. package/dist/{chunk-E3Z3PQAP.js.map → chunk-5LI536P6.js.map} +1 -1
  105. package/dist/{chunk-6HUQL6WU.js → chunk-5M2AK5KE.js} +4 -4
  106. package/dist/{chunk-6HUQL6WU.js.map → chunk-5M2AK5KE.js.map} +1 -1
  107. package/dist/{chunk-EMNDPJRS.js → chunk-5NUCGUTE.js} +4 -4
  108. package/dist/{chunk-EMNDPJRS.js.map → chunk-5NUCGUTE.js.map} +1 -1
  109. package/dist/{chunk-CJTORCZE.js → chunk-5RBXCPG6.js} +3 -3
  110. package/dist/{chunk-CJTORCZE.js.map → chunk-5RBXCPG6.js.map} +1 -1
  111. package/dist/{chunk-MDZ7OUAW.js → chunk-5T4MJAUN.js} +3 -3
  112. package/dist/{chunk-MDZ7OUAW.js.map → chunk-5T4MJAUN.js.map} +1 -1
  113. package/dist/{chunk-4VDW24VN.js → chunk-6H6BVZBV.js} +3 -3
  114. package/dist/{chunk-4VDW24VN.js.map → chunk-6H6BVZBV.js.map} +1 -1
  115. package/dist/{chunk-D6OV66P2.js → chunk-6QIF6WJH.js} +3 -3
  116. package/dist/{chunk-D6OV66P2.js.map → chunk-6QIF6WJH.js.map} +1 -1
  117. package/dist/{chunk-SLBO4SEE.js → chunk-6YEE3VHL.js} +3 -3
  118. package/dist/{chunk-SLBO4SEE.js.map → chunk-6YEE3VHL.js.map} +1 -1
  119. package/dist/{chunk-XMRNYUQY.js → chunk-7XAGU6CT.js} +3 -3
  120. package/dist/{chunk-XMRNYUQY.js.map → chunk-7XAGU6CT.js.map} +1 -1
  121. package/dist/{chunk-SNTJYDYZ.js → chunk-AOQZHLZZ.js} +5 -5
  122. package/dist/{chunk-SNTJYDYZ.js.map → chunk-AOQZHLZZ.js.map} +1 -1
  123. package/dist/{chunk-H7LRGY7U.js → chunk-B57KIBQL.js} +3 -3
  124. package/dist/{chunk-H7LRGY7U.js.map → chunk-B57KIBQL.js.map} +1 -1
  125. package/dist/{chunk-QMIPHH5I.js → chunk-BYGVKW3M.js} +4 -4
  126. package/dist/{chunk-QMIPHH5I.js.map → chunk-BYGVKW3M.js.map} +1 -1
  127. package/dist/{chunk-5OMZ4GZ6.js → chunk-CAULDK3N.js} +6 -6
  128. package/dist/{chunk-5OMZ4GZ6.js.map → chunk-CAULDK3N.js.map} +1 -1
  129. package/dist/{chunk-EGI7F57E.js → chunk-DPQIVZ4T.js} +3 -3
  130. package/dist/{chunk-EGI7F57E.js.map → chunk-DPQIVZ4T.js.map} +1 -1
  131. package/dist/{chunk-HHJD2GGA.js → chunk-EMAAVDEK.js} +7 -7
  132. package/dist/{chunk-HHJD2GGA.js.map → chunk-EMAAVDEK.js.map} +1 -1
  133. package/dist/{chunk-LOXWQLSH.js → chunk-FCCGJ4DI.js} +7 -7
  134. package/dist/{chunk-LOXWQLSH.js.map → chunk-FCCGJ4DI.js.map} +1 -1
  135. package/dist/{chunk-IKCXJYYQ.js → chunk-FL3OK7AQ.js} +36 -16
  136. package/dist/chunk-FL3OK7AQ.js.map +1 -0
  137. package/dist/{chunk-DN3SKCOX.js → chunk-GLSRVHYJ.js} +4 -4
  138. package/dist/{chunk-DN3SKCOX.js.map → chunk-GLSRVHYJ.js.map} +1 -1
  139. package/dist/{chunk-2DM2EXRT.js → chunk-I2LK4IC2.js} +4 -4
  140. package/dist/{chunk-2DM2EXRT.js.map → chunk-I2LK4IC2.js.map} +1 -1
  141. package/dist/{chunk-ANVS7UYN.js → chunk-IEKP3HYS.js} +4 -4
  142. package/dist/{chunk-ANVS7UYN.js.map → chunk-IEKP3HYS.js.map} +1 -1
  143. package/dist/{chunk-IHOUADLX.js → chunk-JK45RUVV.js} +3 -3
  144. package/dist/{chunk-IHOUADLX.js.map → chunk-JK45RUVV.js.map} +1 -1
  145. package/dist/{chunk-ORLSTZ45.js → chunk-JSAWLWUN.js} +4 -4
  146. package/dist/{chunk-ORLSTZ45.js.map → chunk-JSAWLWUN.js.map} +1 -1
  147. package/dist/{chunk-ZN3RZJRX.js → chunk-KJ7NG3ZH.js} +3 -3
  148. package/dist/{chunk-ZN3RZJRX.js.map → chunk-KJ7NG3ZH.js.map} +1 -1
  149. package/dist/{chunk-VGZEPMXG.js → chunk-LBZNLTBM.js} +3 -3
  150. package/dist/{chunk-VGZEPMXG.js.map → chunk-LBZNLTBM.js.map} +1 -1
  151. package/dist/{chunk-5GMXXHV2.js → chunk-LWAJNEIM.js} +4 -4
  152. package/dist/{chunk-5GMXXHV2.js.map → chunk-LWAJNEIM.js.map} +1 -1
  153. package/dist/{chunk-4UGJ4VC3.js → chunk-O3XMYDNC.js} +5 -5
  154. package/dist/{chunk-4UGJ4VC3.js.map → chunk-O3XMYDNC.js.map} +1 -1
  155. package/dist/{chunk-2LXCSBJU.js → chunk-O63WBEAC.js} +22 -22
  156. package/dist/{chunk-2LXCSBJU.js.map → chunk-O63WBEAC.js.map} +1 -1
  157. package/dist/{chunk-WAVAK2RB.js → chunk-OOZQVX7C.js} +6 -6
  158. package/dist/{chunk-WAVAK2RB.js.map → chunk-OOZQVX7C.js.map} +1 -1
  159. package/dist/{chunk-MGG4XAJ5.js → chunk-P2PPBXHD.js} +3 -3
  160. package/dist/{chunk-MGG4XAJ5.js.map → chunk-P2PPBXHD.js.map} +1 -1
  161. package/dist/{chunk-KOR42MT5.js → chunk-PHPOMWQ4.js} +4 -4
  162. package/dist/{chunk-KOR42MT5.js.map → chunk-PHPOMWQ4.js.map} +1 -1
  163. package/dist/{chunk-MFTPNDEI.js → chunk-PPFD456V.js} +3 -3
  164. package/dist/{chunk-MFTPNDEI.js.map → chunk-PPFD456V.js.map} +1 -1
  165. package/dist/{chunk-NIPEIVU4.js → chunk-PVOJJ2BV.js} +5 -5
  166. package/dist/{chunk-NIPEIVU4.js.map → chunk-PVOJJ2BV.js.map} +1 -1
  167. package/dist/{chunk-A6Y33KCR.js → chunk-PYXAPLNB.js} +3 -3
  168. package/dist/{chunk-A6Y33KCR.js.map → chunk-PYXAPLNB.js.map} +1 -1
  169. package/dist/{chunk-WJVKBSKY.js → chunk-PZP3372I.js} +4 -4
  170. package/dist/{chunk-WJVKBSKY.js.map → chunk-PZP3372I.js.map} +1 -1
  171. package/dist/{chunk-TQEQECN7.js → chunk-Q7Z76F7N.js} +8 -8
  172. package/dist/{chunk-TQEQECN7.js.map → chunk-Q7Z76F7N.js.map} +1 -1
  173. package/dist/{chunk-FJWQ4PYX.js → chunk-QKKEBQ57.js} +6 -6
  174. package/dist/{chunk-FJWQ4PYX.js.map → chunk-QKKEBQ57.js.map} +1 -1
  175. package/dist/{chunk-QMWP2ZP6.js → chunk-R7QCNL62.js} +3 -3
  176. package/dist/{chunk-QMWP2ZP6.js.map → chunk-R7QCNL62.js.map} +1 -1
  177. package/dist/{chunk-WJJOFIBJ.js → chunk-RB7RHMKJ.js} +5 -5
  178. package/dist/{chunk-WJJOFIBJ.js.map → chunk-RB7RHMKJ.js.map} +1 -1
  179. package/dist/{chunk-F7RABDDP.js → chunk-RY6VPXG6.js} +3 -3
  180. package/dist/{chunk-F7RABDDP.js.map → chunk-RY6VPXG6.js.map} +1 -1
  181. package/dist/{chunk-R7VWIXFX.js → chunk-TEAYGNHT.js} +3 -3
  182. package/dist/{chunk-R7VWIXFX.js.map → chunk-TEAYGNHT.js.map} +1 -1
  183. package/dist/{chunk-XDA6N5GZ.js → chunk-TXYLHBUH.js} +3 -3
  184. package/dist/{chunk-XDA6N5GZ.js.map → chunk-TXYLHBUH.js.map} +1 -1
  185. package/dist/{chunk-6TFM3UTF.js → chunk-ULF4LPVA.js} +3 -3
  186. package/dist/{chunk-6TFM3UTF.js.map → chunk-ULF4LPVA.js.map} +1 -1
  187. package/dist/{chunk-FYL4GPXH.js → chunk-UUHLRFXB.js} +8 -8
  188. package/dist/{chunk-FYL4GPXH.js.map → chunk-UUHLRFXB.js.map} +1 -1
  189. package/dist/{chunk-ISW7G4IX.js → chunk-VJA4DVVT.js} +4 -4
  190. package/dist/{chunk-ISW7G4IX.js.map → chunk-VJA4DVVT.js.map} +1 -1
  191. package/dist/{chunk-JSHOX64U.js → chunk-W7CYFPGY.js} +6 -6
  192. package/dist/{chunk-JSHOX64U.js.map → chunk-W7CYFPGY.js.map} +1 -1
  193. package/dist/{chunk-5V4W3GBI.js → chunk-WAKCWE6P.js} +5 -5
  194. package/dist/{chunk-5V4W3GBI.js.map → chunk-WAKCWE6P.js.map} +1 -1
  195. package/dist/{chunk-EE7SB3QH.js → chunk-ZUVBDALM.js} +4 -4
  196. package/dist/{chunk-EE7SB3QH.js.map → chunk-ZUVBDALM.js.map} +1 -1
  197. package/dist/components/cart/index.js +1 -1
  198. package/dist/components/common/index.js +1 -1
  199. package/dist/components/drawer/index.js +23 -23
  200. package/dist/components/home/index.js +28 -28
  201. package/dist/components/layout/index.js +6 -6
  202. package/dist/components/product/index.js +25 -25
  203. package/dist/components/store/index.js +24 -24
  204. package/dist/components/toast/index.js +4 -4
  205. package/dist/dev/editor/index.js +2 -2
  206. package/dist/dev/index.js +2 -2
  207. package/dist/document-class-N7WF3WXG.js +33 -0
  208. package/dist/{document-class-FSNL65IJ.js.map → document-class-N7WF3WXG.js.map} +1 -1
  209. package/dist/hooks/index.js +23 -23
  210. package/dist/hooks/useComments.js +3 -3
  211. package/dist/hooks/useGtm.js +23 -23
  212. package/dist/hooks/useMoney.js +23 -23
  213. package/dist/hooks/useProduct.js +3 -3
  214. package/dist/hooks/useStore.js +23 -23
  215. package/dist/hooks/useUser.js +5 -5
  216. package/dist/hooks/useWishlist.js +3 -3
  217. package/dist/index.js +23 -23
  218. package/dist/native-app/index.js +3 -3
  219. package/dist/{navigation-CCGB3YEB.js → navigation-5DPDZQUU.js} +8 -8
  220. package/dist/{navigation-CCGB3YEB.js.map → navigation-5DPDZQUU.js.map} +1 -1
  221. package/dist/{navigation-I5H3HLZV.js → navigation-FRKMKNLK.js} +7 -7
  222. package/dist/{navigation-I5H3HLZV.js.map → navigation-FRKMKNLK.js.map} +1 -1
  223. package/dist/{not-found-SMNBZNFW.js → not-found-4U2TRCLF.js} +26 -26
  224. package/dist/{not-found-SMNBZNFW.js.map → not-found-4U2TRCLF.js.map} +1 -1
  225. package/dist/providers/index.js +23 -23
  226. package/dist/routes/account/orders.js +8 -8
  227. package/dist/routes/account.js +17 -17
  228. package/dist/routes/blog.js +12 -12
  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 +33 -33
  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-VFRN2MVI.js → store-lookup-S6JUSKNH.js} +11 -11
  243. package/dist/{store-lookup-VFRN2MVI.js.map → store-lookup-S6JUSKNH.js.map} +1 -1
  244. package/dist/tanstack.js +20 -20
  245. package/dist/utils/baseHead.js +2 -2
  246. package/dist/utils/index.js +6 -6
  247. package/dist/utils/shared-host-language.d.ts +5 -0
  248. package/dist/utils/shared-host-language.d.ts.map +1 -1
  249. package/dist/utils/store-base.d.ts +60 -0
  250. package/dist/utils/store-base.d.ts.map +1 -1
  251. package/dist/utils/store-identity.d.ts +14 -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/root/beforeLoad.ts.txt +37 -3
  256. package/dist/chunk-IKCXJYYQ.js.map +0 -1
  257. package/dist/chunk-T2752RH7.js.map +0 -1
  258. package/dist/document-class-FSNL65IJ.js +0 -33
@@ -1,7 +1,7 @@
1
- import { isNotLaunchedNotice } from './chunk-SLBO4SEE.js';
2
- import { getActiveScope, api, STORE_IDENTIFIER_HEADER, devSettingsFetchedAt } from './chunk-WJJOFIBJ.js';
3
- import { requestedThemeVersionId } from './chunk-XMRNYUQY.js';
4
- import { LANGUAGE_COOKIE_NAME, LANGUAGE_COOKIE_MAX_AGE, resolveStoreIdentifier, extractScopeFromUrl, parseStoreId } from './chunk-T2752RH7.js';
1
+ import { isNotLaunchedNotice } from './chunk-6YEE3VHL.js';
2
+ import { getActiveScope, api, STORE_IDENTIFIER_HEADER, devSettingsFetchedAt } from './chunk-RB7RHMKJ.js';
3
+ import { requestedThemeVersionId } from './chunk-7XAGU6CT.js';
4
+ import { LANGUAGE_COOKIE_NAME, LANGUAGE_COOKIE_MAX_AGE, resolveStoreIdentifier, extractScopeFromUrl, parseStoreId } from './chunk-4E6FD5W7.js';
5
5
  import { getTwilightContext, SettingsError } from './chunk-6K34BCUP.js';
6
6
  import { queryOptions } from '@tanstack/react-query';
7
7
  import { isTimeoutError, isHTTPError, isNetworkError } from 'ky';
@@ -250,5 +250,5 @@ var store = {
250
250
  };
251
251
 
252
252
  export { persistLanguageCookie, readCookieHeader, readNativeAppHeaders, readPageSearch, store };
253
- //# sourceMappingURL=chunk-WAVAK2RB.js.map
254
- //# sourceMappingURL=chunk-WAVAK2RB.js.map
253
+ //# sourceMappingURL=chunk-OOZQVX7C.js.map
254
+ //# sourceMappingURL=chunk-OOZQVX7C.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/language-cookie.ts","../src/utils/native-app-headers.ts","../src/api/store.ts"],"names":[],"mappings":";;;;;;;;;;AAaA,IAAM,sBAAA,GAAyB,kBAAA,EAAmB,CAC/C,MAAA,CAAO,MAAqB;AAC3B,EAAA,IAAI;AACF,IAAA,OAAO,gBAAA,CAAiB,QAAQ,CAAA,IAAK,IAAA;AAAA,EACvC,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF,CAAC,CAAA,CACA,MAAA,CAAO,MAAqB,IAAI,CAAA;AAEnC,IAAM,yBAAA,GAA4B,kBAAA,EAAmB,CAClD,MAAA,CAAO,CAAC,IAAA,KAAuB;AAC9B,EAAA,IAAI;AACF,IAAA,SAAA,CAAU,sBAAsB,IAAA,EAAM;AAAA,MACpC,IAAA,EAAM,GAAA;AAAA,MACN,MAAA,EAAQ,uBAAA;AAAA,MACR,QAAA,EAAU;AAAA,KACX,CAAA;AAAA,EACH,CAAA,CAAA,MAAQ;AAAA,EAER;AACF,CAAC,CAAA,CACA,OAAO,MAAY;AAAC,CAAC,CAAA;AAExB,IAAM,gBAAA,GAAmB,kBAAA,EAAmB,CACzC,MAAA,C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CAAM,kBAAA,EAAoB,KAAA,CAAM,OAAA,EAAS,GAAI,KAAA,KAAU,KAAA,GAAQ,EAAC,GAAI,CAAC,KAAK,CAAE,CAAA;AACpF,IAAA,MAAM,KAAA;AAAA,EACR;AACF;AAEO,IAAM,KAAA,GAAQ;AAAA,EACnB,QAAA,EAAU,OAAO,eAAA,KAA2D;AAC1E,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,cAAc,eAAe,CAAA;AAAA,IAC5C,CAAA,CAAA,MAAQ;AAEN,MAAA,OAAO,IAAA;AAAA,IACT;AAAA,EACF,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,QAAA,EAAU,CAAC,eAAA,KACT,YAAA,CAAkC;AAAA,MAChC,QAAA,EAAU;AAAA,QACR,OAAA;AAAA,QACA,UAAA;AAAA,QACA,eAAA;AAAA,QACA,oBAAmB,CAAE,MAAA;AAAA,QACrB,cAAA,EAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,QAQf,uBAAA;AAAwB,OAC1B;AAAA;AAAA,MAEA,OAAA,EAAS,MAAM,aAAA,CAAc,eAAe,CAAA;AAAA;AAAA;AAAA,MAG5C,KAAA,EAAO;AAAA,KACR;AAAA;AAEP","file":"chunk-WAVAK2RB.js","sourcesContent":["/**\n * @fileoverview Reading and writing the `s-lang` cookie, on the server and in the browser.\n *\n * The server reads it from the request the framework is handling and writes it to that\n * request's response. The server-only import is stripped from the client bundle by\n * `createIsomorphicFn`, as in `routes/root/beforeLoad.ts`. The browser uses `document.cookie`.\n * Either side outside a request (a prerender, a test) has nothing to read or write and says so\n * quietly.\n */\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getRequestHeader, getRequestUrl, setCookie } from '@tanstack/react-start/server';\nimport { LANGUAGE_COOKIE_MAX_AGE, LANGUAGE_COOKIE_NAME } from './cookies';\n\nconst readServerCookieHeader = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getRequestHeader('cookie') ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\nconst writeServerLanguageCookie = createIsomorphicFn()\n .server((code: string): void => {\n try {\n setCookie(LANGUAGE_COOKIE_NAME, code, {\n path: '/',\n maxAge: LANGUAGE_COOKIE_MAX_AGE,\n sameSite: 'lax',\n });\n } catch {\n // Outside a request: there is no response to write to.\n }\n })\n .client((): void => {});\n\nconst readServerSearch = createIsomorphicFn()\n .server((): string => {\n try {\n return getRequestUrl().search;\n } catch {\n return '';\n }\n })\n .client((): string => '');\n\n/**\n * The query string of the page being rendered (`?lang=en`, or `''`): the request's on the\n * server, the address bar's in the browser, so both sides read the same one.\n */\nexport function readPageSearch(): string {\n return readServerSearch() || (typeof window !== 'undefined' ? window.location.search : '');\n}\n\n/** The `Cookie` header of the request being handled, or `document.cookie` in the browser. */\nexport function readCookieHeader(): string | null {\n return readServerCookieHeader() ?? (typeof document !== 'undefined' ? document.cookie : null);\n}\n\n/** Remembers `code` as the visitor's language for every store on this host. */\nexport function persistLanguageCookie(code: string): void {\n writeServerLanguageCookie(code);\n if (typeof document !== 'undefined') {\n document.cookie = `${LANGUAGE_COOKIE_NAME}=${encodeURIComponent(code)}; path=/; max-age=${LANGUAGE_COOKIE_MAX_AGE}; SameSite=Lax`;\n }\n}\n","/** The headers the Salla native app sends with every page it loads in its webview. */\nexport const NATIVE_APP_HEADERS = [\n 's-app-os',\n 's-app-version',\n 's-app-full-version',\n 's-app-os-version',\n];\n\n/**\n * The native app's own headers on this request, or null when it is not the app.\n *\n * On a Twig theme Laravel copies them into the settings' `jitsu.context.extra.headers`,\n * where the SDK reads the app's platform and version from (`salla.config.isMobileApp()`).\n * A React theme asks for its settings from the server, through the API, so the app's\n * headers never reach that call: the request is the only place they are.\n */\nexport function readNativeAppHeaders(headers: Headers): Record<string, string> | null {\n const os = headers.get('s-app-os')?.toLowerCase();\n if (os !== 'ios' && os !== 'android') return null;\n const found: Record<string, string> = {};\n for (const name of NATIVE_APP_HEADERS) {\n const value = headers.get(name);\n if (value) found[name] = value;\n }\n return found;\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport { isHTTPError, isNetworkError, isTimeoutError } from 'ky';\nimport { api, getActiveScope, STORE_IDENTIFIER_HEADER } from './client';\nimport { devSettingsFetchedAt } from './dev-settings-cache';\nimport { SettingsError } from '../utils/errors';\nimport type { Store, Theme, Language, JitsuConfig, MaintenanceDetails } from '../types';\nimport { getTwilightContext } from '../twilight/context';\nimport { resolveStoreIdentifier } from '../utils/store-identity';\nimport { extractScopeFromUrl, parseStoreId } from '../utils/cookies';\nimport { readPageSearch } from '../utils/language-cookie';\nimport { requestedThemeVersionId } from '../utils/theme-version';\nimport { NATIVE_APP_HEADERS } from '../utils/native-app-headers';\nimport { isNotLaunchedNotice } from '../utils/maintenance';\n\nexport { resolveStoreIdentifier };\n\nconst DEFAULT_INCLUDE_ITEMS = [\n 'store',\n 'settings',\n 'theme',\n 'theme_settings',\n 'external_services',\n 'currencies',\n 'languages',\n 'payments',\n 'product_widgets',\n 'rating',\n 'ratings',\n 'user',\n];\n\n/** Twig's `salla.init({ user })` object; the endpoint ignores the token, so always the guest. */\nexport interface SettingsUser {\n type: 'guest' | 'user';\n id?: number | string | null;\n language_code?: string;\n currency_code?: string;\n country_code?: string;\n [key: string]: unknown;\n}\n\n/**\n * Raw API response for settings endpoint.\n * Languages come as object: { \"AR\": { code, name, ... }, \"EN\": {...} }\n */\ninterface SettingsApiResponse {\n store?: Store;\n theme?: Theme;\n languages?: Record<string, Language>;\n currencies?: Record<\n string,\n { code: string; name: string; symbol: string; amount: number; country_code: string }\n >;\n external_services?: Record<string, unknown>;\n headers?: Record<string, unknown>;\n login?: { url: string; turnstile_site_key: string };\n affiliate?: { utm_url: string; cta_enabled: boolean };\n debug?: boolean;\n trace_console?: boolean;\n policy_url?: string;\n user?: SettingsUser;\n swoole?: string[];\n jitsu?: JitsuConfig;\n maintenance?: boolean;\n maintenance_details?: MaintenanceDetails;\n}\n\n/**\n * Central settings context - single source of truth for all API data.\n * Contains everything from the settings endpoint response after processing.\n */\nexport interface StoreContext {\n store?: Store;\n theme?: Theme;\n /** Languages as array after conversion from API object format */\n languages?: Language[];\n currencies?: Record<\n string,\n { code: string; name: string; symbol: string; amount: number; country_code: string }\n >;\n external_services?: Record<string, unknown>;\n headers?: Record<string, unknown>;\n login?: { url: string; turnstile_site_key: string };\n affiliate?: { utm_url: string; cta_enabled: boolean };\n debug?: boolean;\n trace_console?: boolean; // todo:: remove it\n policy_url?: string;\n user?: SettingsUser;\n /** API paths the SDK sends with `s-store-api-version: swoole` */\n swoole?: string[];\n /** Where the SDK's analytics send events, and which ones; without it the SDK tracks nothing. */\n jitsu?: JitsuConfig;\n /**\n * The store is closed: by the merchant from the dashboard, by the platform, or\n * for the selected market only. The engine then renders the maintenance page\n * to everyone but the merchant; see `rootBeforeLoad`.\n */\n maintenance?: boolean;\n /** What the maintenance page says; sent beside `maintenance`. */\n maintenance_details?: MaintenanceDetails;\n /**\n * `false` while the store has not launched yet: `maintenance` is then `true` and the\n * engine's maintenance page says the store is launching soon. Absent otherwise. Not\n * from the API: read off `maintenance_details` by `store.settings`, since the\n * backend sends the merchant's \"finish launching\" notice there for every visitor,\n * which is not for a customer's eyes.\n */\n launched?: false;\n /**\n * The scope these settings were requested with; absent when none was. Not from\n * the API: stamped by `store.settings`, so `resolveThemeVersionId` can tell\n * whether the version they name still answers the scope that is active now.\n */\n requestedScopeId?: string;\n /** Which answer of the API these settings are; see {@link SettingsAnswer}. */\n answer?: SettingsAnswer;\n /**\n * When the dev server fetched these settings from the API (epoch ms). It reuses\n * them for a while (see `dev-settings-cache.ts`) and the theme editor says how old\n * they are. Only on a dev server render; absent everywhere else.\n */\n devFetchedAt?: number;\n}\n\n/**\n * Which answer of the settings API a set of settings came from, read off the\n * response rather than the body: the API's request id, the Store's trace, and\n * whether Cloudflare served it from its cache and how old it was. A decision the\n * settings drive for every visitor alike (the maintenance page) can then be\n * traced to the exact request the backend logged, or to a cached copy of it.\n */\nexport interface SettingsAnswer {\n requestId?: string;\n traceId?: string;\n cacheStatus?: string;\n age?: string;\n}\n\nconst ANSWER_HEADERS: Record<keyof SettingsAnswer, string> = {\n requestId: 's-request-id',\n traceId: 'x-trace-id',\n cacheStatus: 'cf-cache-status',\n age: 'age',\n};\n\nfunction settingsAnswerOf(headers: Headers | undefined): SettingsAnswer | undefined {\n if (!headers) return undefined;\n const answer: SettingsAnswer = {};\n for (const [field, name] of Object.entries(ANSWER_HEADERS) as [keyof SettingsAnswer, string][]) {\n const value = headers.get(name);\n if (value) answer[field] = value;\n }\n return Object.keys(answer).length ? answer : undefined;\n}\n\n/**\n * Converts languages object from API to array format.\n * API returns: { \"AR\": { code, name, ... }, \"EN\": { ... } }\n * We need: [{ code, name, ... }, { code, name, ... }]\n * todo:: return the languages as object from the APIs to avoid this\n */\nfunction languagesToArray(languages?: Record<string, Language>): Language[] | undefined {\n if (!languages) return undefined;\n // The SDK's localization modal reads `lang.iso_code` (not `code`) when a language is\n // selected — without it the switch navigates to `/undefined/...`.\n return Object.values(languages).map((lang) => ({ iso_code: lang.code, ...lang }));\n}\n\n/**\n * The settings' analytics context with the native app's headers in it, as Laravel\n * writes it for a Twig theme: the SDK reads the app's platform and version from there.\n * The API answers a server-side call with the engine's own headers, never the app's.\n */\nfunction withNativeAppHeaders(jitsu?: JitsuConfig): JitsuConfig | undefined {\n if (!jitsu || typeof window !== 'undefined') return jitsu;\n let appHeaders: Record<string, string> | null = null;\n try {\n appHeaders = getTwilightContext().nativeAppHeaders;\n } catch {\n return jitsu;\n }\n if (!appHeaders) return jitsu;\n const extra = jitsu.context?.extra;\n // The engine's own app headers go, so an app that sends no version doesn't get the engine's.\n const headers = { ...extra?.headers };\n for (const name of NATIVE_APP_HEADERS) delete headers[name];\n return {\n ...jitsu,\n context: {\n ...jitsu.context,\n extra: { ...extra, headers: { ...headers, ...appHeaders } },\n },\n };\n}\n\nconst SETTINGS_TIMEOUT_MS = 5000;\n\n/**\n * Whether the page's own address switches market (`?scope=`).\n *\n * Only then does the settings request name the scope in its query string. The API\n * reads `?scope=` as a switch and lets it override the market a market's own domain\n * is pinned to, which the `s-scope-id` header never does. Sent on every request, a\n * market remembered from another visit would win over the host the shopper is on: the\n * settings, and the SDK seeded from them, would answer for that market while every\n * call without the parameter (the cart, among them) answers for the host's, and a\n * guest's cart created in one is refused by the other (TD-17588).\n */\nfunction pageSwitchesScope(): boolean {\n return extractScopeFromUrl(`http://page.invalid/${readPageSearch()}`) !== null;\n}\n\nasync function requestSettings(identifier: string): Promise<StoreContext> {\n const includeParams = DEFAULT_INCLUDE_ITEMS.map((i) => `include[]=${i}`).join('&');\n const scope = getActiveScope();\n const params =\n scope != null && pageSwitchesScope() ? `${includeParams}&scope=${scope.id}` : includeParams;\n\n const request = api\n // Sent explicitly rather than left to the client's own resolution, so\n // the identifier this function checked is the identifier that travels.\n // They agree today; a caller passing one and being answered about\n // another is the failure this makes impossible rather than unlikely.\n .get(`store/settings?${params}`, {\n timeout: SETTINGS_TIMEOUT_MS,\n headers: { [STORE_IDENTIFIER_HEADER]: identifier },\n });\n const json = await request.json<{ data?: SettingsApiResponse }>();\n // The same response, already settled; only its headers are read.\n const headers = (await request)?.headers;\n const answer = settingsAnswerOf(headers);\n const devFetchedAt = devSettingsFetchedAt(headers);\n\n const data = json?.data;\n if (!data) {\n throw new SettingsError(\n `The Salla API answered the settings request for store \"${identifier}\" without settings.`,\n { reason: 'empty' }\n );\n }\n\n // Convert languages from object to array\n const languages = languagesToArray(data.languages);\n\n return {\n store: data.store,\n theme: data.theme,\n languages,\n currencies: data.currencies,\n external_services: data.external_services,\n headers: data.headers,\n login: data.login,\n affiliate: data.affiliate,\n policy_url: data.policy_url,\n user: data.user,\n swoole: data.swoole,\n jitsu: withNativeAppHeaders(data.jitsu),\n maintenance: data.maintenance,\n maintenance_details: data.maintenance_details,\n ...(data.maintenance === true &&\n isNotLaunchedNotice(data.maintenance_details) && { launched: false as const }),\n ...(scope && { requestedScopeId: scope.id }),\n ...(answer && { answer }),\n ...(devFetchedAt && { devFetchedAt }),\n };\n}\n\n/** The message the API put in an error body, `{ error: { message } }`, when it sent one. */\nfunction apiErrorMessage(data: unknown): string | undefined {\n const message = (data as { error?: { message?: unknown } } | undefined)?.error?.message;\n return typeof message === 'string' && message.length > 0 && message.length <= 200\n ? message\n : undefined;\n}\n\n/**\n * What core's `CurrentStoreMiddleware` answers, with a 422, when no store has the\n * username or domain it was given (or the store's status is `deleted`). The lookup is\n * `loadUseUsernameOrDomain`, the same one Twig's `checkUsername` turns into its 410.\n * The literal is not translated: it reads the same whatever language was asked for.\n */\nconst STORE_NOT_FOUND_MESSAGE = 'المتجر غير موجود';\n\n/**\n * Whether the API answered that no store has this identifier. A numeric identifier\n * is looked up with `findOrFail`, which Store's exception handler answers with a 410;\n * a username or domain gets {@link STORE_NOT_FOUND_MESSAGE}. A 410 for a username is\n * not read as one: nothing on that path answers it, and a store that does exist must\n * never be told it does not.\n */\nfunction isStoreNotFound(identifier: string, status: number, said: string | undefined): boolean {\n if (status === 410) return parseStoreId(identifier) !== null;\n return status === 422 && said === STORE_NOT_FOUND_MESSAGE;\n}\n\n/**\n * Names what went wrong, because the page, the server log and Sentry all carry\n * this message. Every failure used to read \"Make sure VITE_STORE_DOMAIN is set\",\n * a local-development variable no deployed theme has, so a slow API looked like\n * a misconfigured theme.\n */\nfunction describeSettingsFailure(identifier: string, error: unknown): SettingsError {\n if (error instanceof SettingsError) return error;\n const request = `the settings request for store \"${identifier}\"`;\n if (isTimeoutError(error)) {\n return new SettingsError(\n `The Salla API did not answer ${request} within ${SETTINGS_TIMEOUT_MS} ms.`,\n { reason: 'timeout' }\n );\n }\n if (isHTTPError(error)) {\n const { status } = error.response;\n const said = apiErrorMessage(error.data);\n return new SettingsError(\n `The Salla API answered ${request} with HTTP ${status}${said ? `: ${said}` : ''}.`,\n { reason: isStoreNotFound(identifier, status, said) ? 'not-found' : 'http', status }\n );\n }\n if (isNetworkError(error)) {\n return new SettingsError(`The Salla API could not be reached for ${request}.`, {\n reason: 'network',\n });\n }\n const detail = error instanceof Error ? `: ${error.message}` : '';\n return new SettingsError(`The settings request for store \"${identifier}\" failed${detail}.`);\n}\n\n/**\n * The settings, or a {@link SettingsError} that says why there are none. The\n * query throws it so the root route can say why the store did not load;\n * `store.settings` keeps answering `null` for its own callers.\n */\nasync function fetchSettings(storeIdentifier?: string): Promise<StoreContext> {\n const identifier = storeIdentifier ?? resolveStoreIdentifier();\n\n if (!identifier) {\n const error = new SettingsError(\n 'No store is named for this request: add `?storeId=` on the preview host, or set VITE_STORE_DOMAIN in local development.',\n { reason: 'no-store' }\n );\n console.warn('[store.settings]', error.message);\n throw error;\n }\n\n try {\n return await requestSettings(identifier);\n } catch (cause) {\n const error = describeSettingsFailure(identifier, cause);\n console.error('[store.settings]', error.message, ...(cause === error ? [] : [cause]));\n throw error;\n }\n}\n\nexport const store = {\n settings: async (storeIdentifier?: string): Promise<StoreContext | null> => {\n try {\n return await fetchSettings(storeIdentifier);\n } catch {\n // Already logged, with the reason.\n return null;\n }\n },\n\n queries: {\n settings: (storeIdentifier?: string) =>\n queryOptions<StoreContext | null>({\n queryKey: [\n 'store',\n 'settings',\n storeIdentifier,\n getTwilightContext().locale,\n getActiveScope(),\n // Two versions of one store's settings are two different answers, and\n // this is the query whose answer decides what every other call is\n // pinned to. `requestedThemeVersionId` rather than the resolved one:\n // the resolved value falls back to what these settings report, so it\n // is not knowable until after this query has run — the key would be\n // one thing on the server and another on the client, and the hydrated\n // page would refetch the settings it was just handed.\n requestedThemeVersionId(),\n ],\n // Throws rather than resolving `null`, so the failure keeps its reason.\n queryFn: () => fetchSettings(storeIdentifier),\n // A null never retried, and the root route waits on this: the router's\n // default `retry: 1` would sit through the timeout twice.\n retry: 0,\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/utils/language-cookie.ts","../src/utils/native-app-headers.ts","../src/api/store.ts"],"names":[],"mappings":";;;;;;;;;;AAaA,IAAM,sBAAA,GAAyB,kBAAA,EAAm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QAQf,uBAAA;AAAwB,OAC1B;AAAA;AAAA,MAEA,OAAA,EAAS,MAAM,aAAA,CAAc,eAAe,CAAA;AAAA;AAAA;AAAA,MAG5C,KAAA,EAAO;AAAA,KACR;AAAA;AAEP","file":"chunk-OOZQVX7C.js","sourcesContent":["/**\n * @fileoverview Reading and writing the `s-lang` cookie, on the server and in the browser.\n *\n * The server reads it from the request the framework is handling and writes it to that\n * request's response. The server-only import is stripped from the client bundle by\n * `createIsomorphicFn`, as in `routes/root/beforeLoad.ts`. The browser uses `document.cookie`.\n * Either side outside a request (a prerender, a test) has nothing to read or write and says so\n * quietly.\n */\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getRequestHeader, getRequestUrl, setCookie } from '@tanstack/react-start/server';\nimport { LANGUAGE_COOKIE_MAX_AGE, LANGUAGE_COOKIE_NAME } from './cookies';\n\nconst readServerCookieHeader = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getRequestHeader('cookie') ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\nconst writeServerLanguageCookie = createIsomorphicFn()\n .server((code: string): void => {\n try {\n setCookie(LANGUAGE_COOKIE_NAME, code, {\n path: '/',\n maxAge: LANGUAGE_COOKIE_MAX_AGE,\n sameSite: 'lax',\n });\n } catch {\n // Outside a request: there is no response to write to.\n }\n })\n .client((): void => {});\n\nconst readServerSearch = createIsomorphicFn()\n .server((): string => {\n try {\n return getRequestUrl().search;\n } catch {\n return '';\n }\n })\n .client((): string => '');\n\n/**\n * The query string of the page being rendered (`?lang=en`, or `''`): the request's on the\n * server, the address bar's in the browser, so both sides read the same one.\n */\nexport function readPageSearch(): string {\n return readServerSearch() || (typeof window !== 'undefined' ? window.location.search : '');\n}\n\n/** The `Cookie` header of the request being handled, or `document.cookie` in the browser. */\nexport function readCookieHeader(): string | null {\n return readServerCookieHeader() ?? (typeof document !== 'undefined' ? document.cookie : null);\n}\n\n/** Remembers `code` as the visitor's language for every store on this host. */\nexport function persistLanguageCookie(code: string): void {\n writeServerLanguageCookie(code);\n if (typeof document !== 'undefined') {\n document.cookie = `${LANGUAGE_COOKIE_NAME}=${encodeURIComponent(code)}; path=/; max-age=${LANGUAGE_COOKIE_MAX_AGE}; SameSite=Lax`;\n }\n}\n","/** The headers the Salla native app sends with every page it loads in its webview. */\nexport const NATIVE_APP_HEADERS = [\n 's-app-os',\n 's-app-version',\n 's-app-full-version',\n 's-app-os-version',\n];\n\n/**\n * The native app's own headers on this request, or null when it is not the app.\n *\n * On a Twig theme Laravel copies them into the settings' `jitsu.context.extra.headers`,\n * where the SDK reads the app's platform and version from (`salla.config.isMobileApp()`).\n * A React theme asks for its settings from the server, through the API, so the app's\n * headers never reach that call: the request is the only place they are.\n */\nexport function readNativeAppHeaders(headers: Headers): Record<string, string> | null {\n const os = headers.get('s-app-os')?.toLowerCase();\n if (os !== 'ios' && os !== 'android') return null;\n const found: Record<string, string> = {};\n for (const name of NATIVE_APP_HEADERS) {\n const value = headers.get(name);\n if (value) found[name] = value;\n }\n return found;\n}\n","import { queryOptions } from '@tanstack/react-query';\nimport { isHTTPError, isNetworkError, isTimeoutError } from 'ky';\nimport { api, getActiveScope, STORE_IDENTIFIER_HEADER } from './client';\nimport { devSettingsFetchedAt } from './dev-settings-cache';\nimport { SettingsError } from '../utils/errors';\nimport type { Store, Theme, Language, JitsuConfig, MaintenanceDetails } from '../types';\nimport { getTwilightContext } from '../twilight/context';\nimport { resolveStoreIdentifier } from '../utils/store-identity';\nimport { extractScopeFromUrl, parseStoreId } from '../utils/cookies';\nimport { readPageSearch } from '../utils/language-cookie';\nimport { requestedThemeVersionId } from '../utils/theme-version';\nimport { NATIVE_APP_HEADERS } from '../utils/native-app-headers';\nimport { isNotLaunchedNotice } from '../utils/maintenance';\n\nexport { resolveStoreIdentifier };\n\nconst DEFAULT_INCLUDE_ITEMS = [\n 'store',\n 'settings',\n 'theme',\n 'theme_settings',\n 'external_services',\n 'currencies',\n 'languages',\n 'payments',\n 'product_widgets',\n 'rating',\n 'ratings',\n 'user',\n];\n\n/** Twig's `salla.init({ user })` object; the endpoint ignores the token, so always the guest. */\nexport interface SettingsUser {\n type: 'guest' | 'user';\n id?: number | string | null;\n language_code?: string;\n currency_code?: string;\n country_code?: string;\n [key: string]: unknown;\n}\n\n/**\n * Raw API response for settings endpoint.\n * Languages come as object: { \"AR\": { code, name, ... }, \"EN\": {...} }\n */\ninterface SettingsApiResponse {\n store?: Store;\n theme?: Theme;\n languages?: Record<string, Language>;\n currencies?: Record<\n string,\n { code: string; name: string; symbol: string; amount: number; country_code: string }\n >;\n external_services?: Record<string, unknown>;\n headers?: Record<string, unknown>;\n login?: { url: string; turnstile_site_key: string };\n affiliate?: { utm_url: string; cta_enabled: boolean };\n debug?: boolean;\n trace_console?: boolean;\n policy_url?: string;\n user?: SettingsUser;\n swoole?: string[];\n jitsu?: JitsuConfig;\n maintenance?: boolean;\n maintenance_details?: MaintenanceDetails;\n}\n\n/**\n * Central settings context - single source of truth for all API data.\n * Contains everything from the settings endpoint response after processing.\n */\nexport interface StoreContext {\n store?: Store;\n theme?: Theme;\n /** Languages as array after conversion from API object format */\n languages?: Language[];\n currencies?: Record<\n string,\n { code: string; name: string; symbol: string; amount: number; country_code: string }\n >;\n external_services?: Record<string, unknown>;\n headers?: Record<string, unknown>;\n login?: { url: string; turnstile_site_key: string };\n affiliate?: { utm_url: string; cta_enabled: boolean };\n debug?: boolean;\n trace_console?: boolean; // todo:: remove it\n policy_url?: string;\n user?: SettingsUser;\n /** API paths the SDK sends with `s-store-api-version: swoole` */\n swoole?: string[];\n /** Where the SDK's analytics send events, and which ones; without it the SDK tracks nothing. */\n jitsu?: JitsuConfig;\n /**\n * The store is closed: by the merchant from the dashboard, by the platform, or\n * for the selected market only. The engine then renders the maintenance page\n * to everyone but the merchant; see `rootBeforeLoad`.\n */\n maintenance?: boolean;\n /** What the maintenance page says; sent beside `maintenance`. */\n maintenance_details?: MaintenanceDetails;\n /**\n * `false` while the store has not launched yet: `maintenance` is then `true` and the\n * engine's maintenance page says the store is launching soon. Absent otherwise. Not\n * from the API: read off `maintenance_details` by `store.settings`, since the\n * backend sends the merchant's \"finish launching\" notice there for every visitor,\n * which is not for a customer's eyes.\n */\n launched?: false;\n /**\n * The scope these settings were requested with; absent when none was. Not from\n * the API: stamped by `store.settings`, so `resolveThemeVersionId` can tell\n * whether the version they name still answers the scope that is active now.\n */\n requestedScopeId?: string;\n /** Which answer of the API these settings are; see {@link SettingsAnswer}. */\n answer?: SettingsAnswer;\n /**\n * When the dev server fetched these settings from the API (epoch ms). It reuses\n * them for a while (see `dev-settings-cache.ts`) and the theme editor says how old\n * they are. Only on a dev server render; absent everywhere else.\n */\n devFetchedAt?: number;\n}\n\n/**\n * Which answer of the settings API a set of settings came from, read off the\n * response rather than the body: the API's request id, the Store's trace, and\n * whether Cloudflare served it from its cache and how old it was. A decision the\n * settings drive for every visitor alike (the maintenance page) can then be\n * traced to the exact request the backend logged, or to a cached copy of it.\n */\nexport interface SettingsAnswer {\n requestId?: string;\n traceId?: string;\n cacheStatus?: string;\n age?: string;\n}\n\nconst ANSWER_HEADERS: Record<keyof SettingsAnswer, string> = {\n requestId: 's-request-id',\n traceId: 'x-trace-id',\n cacheStatus: 'cf-cache-status',\n age: 'age',\n};\n\nfunction settingsAnswerOf(headers: Headers | undefined): SettingsAnswer | undefined {\n if (!headers) return undefined;\n const answer: SettingsAnswer = {};\n for (const [field, name] of Object.entries(ANSWER_HEADERS) as [keyof SettingsAnswer, string][]) {\n const value = headers.get(name);\n if (value) answer[field] = value;\n }\n return Object.keys(answer).length ? answer : undefined;\n}\n\n/**\n * Converts languages object from API to array format.\n * API returns: { \"AR\": { code, name, ... }, \"EN\": { ... } }\n * We need: [{ code, name, ... }, { code, name, ... }]\n * todo:: return the languages as object from the APIs to avoid this\n */\nfunction languagesToArray(languages?: Record<string, Language>): Language[] | undefined {\n if (!languages) return undefined;\n // The SDK's localization modal reads `lang.iso_code` (not `code`) when a language is\n // selected — without it the switch navigates to `/undefined/...`.\n return Object.values(languages).map((lang) => ({ iso_code: lang.code, ...lang }));\n}\n\n/**\n * The settings' analytics context with the native app's headers in it, as Laravel\n * writes it for a Twig theme: the SDK reads the app's platform and version from there.\n * The API answers a server-side call with the engine's own headers, never the app's.\n */\nfunction withNativeAppHeaders(jitsu?: JitsuConfig): JitsuConfig | undefined {\n if (!jitsu || typeof window !== 'undefined') return jitsu;\n let appHeaders: Record<string, string> | null = null;\n try {\n appHeaders = getTwilightContext().nativeAppHeaders;\n } catch {\n return jitsu;\n }\n if (!appHeaders) return jitsu;\n const extra = jitsu.context?.extra;\n // The engine's own app headers go, so an app that sends no version doesn't get the engine's.\n const headers = { ...extra?.headers };\n for (const name of NATIVE_APP_HEADERS) delete headers[name];\n return {\n ...jitsu,\n context: {\n ...jitsu.context,\n extra: { ...extra, headers: { ...headers, ...appHeaders } },\n },\n };\n}\n\nconst SETTINGS_TIMEOUT_MS = 5000;\n\n/**\n * Whether the page's own address switches market (`?scope=`).\n *\n * Only then does the settings request name the scope in its query string. The API\n * reads `?scope=` as a switch and lets it override the market a market's own domain\n * is pinned to, which the `s-scope-id` header never does. Sent on every request, a\n * market remembered from another visit would win over the host the shopper is on: the\n * settings, and the SDK seeded from them, would answer for that market while every\n * call without the parameter (the cart, among them) answers for the host's, and a\n * guest's cart created in one is refused by the other (TD-17588).\n */\nfunction pageSwitchesScope(): boolean {\n return extractScopeFromUrl(`http://page.invalid/${readPageSearch()}`) !== null;\n}\n\nasync function requestSettings(identifier: string): Promise<StoreContext> {\n const includeParams = DEFAULT_INCLUDE_ITEMS.map((i) => `include[]=${i}`).join('&');\n const scope = getActiveScope();\n const params =\n scope != null && pageSwitchesScope() ? `${includeParams}&scope=${scope.id}` : includeParams;\n\n const request = api\n // Sent explicitly rather than left to the client's own resolution, so\n // the identifier this function checked is the identifier that travels.\n // They agree today; a caller passing one and being answered about\n // another is the failure this makes impossible rather than unlikely.\n .get(`store/settings?${params}`, {\n timeout: SETTINGS_TIMEOUT_MS,\n headers: { [STORE_IDENTIFIER_HEADER]: identifier },\n });\n const json = await request.json<{ data?: SettingsApiResponse }>();\n // The same response, already settled; only its headers are read.\n const headers = (await request)?.headers;\n const answer = settingsAnswerOf(headers);\n const devFetchedAt = devSettingsFetchedAt(headers);\n\n const data = json?.data;\n if (!data) {\n throw new SettingsError(\n `The Salla API answered the settings request for store \"${identifier}\" without settings.`,\n { reason: 'empty' }\n );\n }\n\n // Convert languages from object to array\n const languages = languagesToArray(data.languages);\n\n return {\n store: data.store,\n theme: data.theme,\n languages,\n currencies: data.currencies,\n external_services: data.external_services,\n headers: data.headers,\n login: data.login,\n affiliate: data.affiliate,\n policy_url: data.policy_url,\n user: data.user,\n swoole: data.swoole,\n jitsu: withNativeAppHeaders(data.jitsu),\n maintenance: data.maintenance,\n maintenance_details: data.maintenance_details,\n ...(data.maintenance === true &&\n isNotLaunchedNotice(data.maintenance_details) && { launched: false as const }),\n ...(scope && { requestedScopeId: scope.id }),\n ...(answer && { answer }),\n ...(devFetchedAt && { devFetchedAt }),\n };\n}\n\n/** The message the API put in an error body, `{ error: { message } }`, when it sent one. */\nfunction apiErrorMessage(data: unknown): string | undefined {\n const message = (data as { error?: { message?: unknown } } | undefined)?.error?.message;\n return typeof message === 'string' && message.length > 0 && message.length <= 200\n ? message\n : undefined;\n}\n\n/**\n * What core's `CurrentStoreMiddleware` answers, with a 422, when no store has the\n * username or domain it was given (or the store's status is `deleted`). The lookup is\n * `loadUseUsernameOrDomain`, the same one Twig's `checkUsername` turns into its 410.\n * The literal is not translated: it reads the same whatever language was asked for.\n */\nconst STORE_NOT_FOUND_MESSAGE = 'المتجر غير موجود';\n\n/**\n * Whether the API answered that no store has this identifier. A numeric identifier\n * is looked up with `findOrFail`, which Store's exception handler answers with a 410;\n * a username or domain gets {@link STORE_NOT_FOUND_MESSAGE}. A 410 for a username is\n * not read as one: nothing on that path answers it, and a store that does exist must\n * never be told it does not.\n */\nfunction isStoreNotFound(identifier: string, status: number, said: string | undefined): boolean {\n if (status === 410) return parseStoreId(identifier) !== null;\n return status === 422 && said === STORE_NOT_FOUND_MESSAGE;\n}\n\n/**\n * Names what went wrong, because the page, the server log and Sentry all carry\n * this message. Every failure used to read \"Make sure VITE_STORE_DOMAIN is set\",\n * a local-development variable no deployed theme has, so a slow API looked like\n * a misconfigured theme.\n */\nfunction describeSettingsFailure(identifier: string, error: unknown): SettingsError {\n if (error instanceof SettingsError) return error;\n const request = `the settings request for store \"${identifier}\"`;\n if (isTimeoutError(error)) {\n return new SettingsError(\n `The Salla API did not answer ${request} within ${SETTINGS_TIMEOUT_MS} ms.`,\n { reason: 'timeout' }\n );\n }\n if (isHTTPError(error)) {\n const { status } = error.response;\n const said = apiErrorMessage(error.data);\n return new SettingsError(\n `The Salla API answered ${request} with HTTP ${status}${said ? `: ${said}` : ''}.`,\n { reason: isStoreNotFound(identifier, status, said) ? 'not-found' : 'http', status }\n );\n }\n if (isNetworkError(error)) {\n return new SettingsError(`The Salla API could not be reached for ${request}.`, {\n reason: 'network',\n });\n }\n const detail = error instanceof Error ? `: ${error.message}` : '';\n return new SettingsError(`The settings request for store \"${identifier}\" failed${detail}.`);\n}\n\n/**\n * The settings, or a {@link SettingsError} that says why there are none. The\n * query throws it so the root route can say why the store did not load;\n * `store.settings` keeps answering `null` for its own callers.\n */\nasync function fetchSettings(storeIdentifier?: string): Promise<StoreContext> {\n const identifier = storeIdentifier ?? resolveStoreIdentifier();\n\n if (!identifier) {\n const error = new SettingsError(\n 'No store is named for this request: add `?storeId=` on the preview host, or set VITE_STORE_DOMAIN in local development.',\n { reason: 'no-store' }\n );\n console.warn('[store.settings]', error.message);\n throw error;\n }\n\n try {\n return await requestSettings(identifier);\n } catch (cause) {\n const error = describeSettingsFailure(identifier, cause);\n console.error('[store.settings]', error.message, ...(cause === error ? [] : [cause]));\n throw error;\n }\n}\n\nexport const store = {\n settings: async (storeIdentifier?: string): Promise<StoreContext | null> => {\n try {\n return await fetchSettings(storeIdentifier);\n } catch {\n // Already logged, with the reason.\n return null;\n }\n },\n\n queries: {\n settings: (storeIdentifier?: string) =>\n queryOptions<StoreContext | null>({\n queryKey: [\n 'store',\n 'settings',\n storeIdentifier,\n getTwilightContext().locale,\n getActiveScope(),\n // Two versions of one store's settings are two different answers, and\n // this is the query whose answer decides what every other call is\n // pinned to. `requestedThemeVersionId` rather than the resolved one:\n // the resolved value falls back to what these settings report, so it\n // is not knowable until after this query has run — the key would be\n // one thing on the server and another on the client, and the hydrated\n // page would refetch the settings it was just handed.\n requestedThemeVersionId(),\n ],\n // Throws rather than resolving `null`, so the failure keeps its reason.\n queryFn: () => fetchSettings(storeIdentifier),\n // A null never retried, and the root route waits on this: the router's\n // default `retry: 1` would sit through the timeout twice.\n retry: 0,\n }),\n },\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { resolveStoreBase, resolveStoreBaseFollowsLocale, splitLeadingSegment } from './chunk-T2752RH7.js';
1
+ import { resolveStoreBase, resolveStoreBaseFollowsLocale, splitLeadingSegment } from './chunk-4E6FD5W7.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-MGG4XAJ5.js.map
139
- //# sourceMappingURL=chunk-MGG4XAJ5.js.map
138
+ //# sourceMappingURL=chunk-P2PPBXHD.js.map
139
+ //# sourceMappingURL=chunk-P2PPBXHD.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/baseHead.ts"],"names":[],"mappings":";;;;AAWA,IAAM,aAAA,GAAwC;AAAA,EAC5C,EAAA,EAAI,OAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAKO,SAAS,iBAAiB,MAAA,EAAwB;AACvD,EAAA,IAAI,CAAC,MAAA,EAAQ,OA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B,QAAA,EAAU,IAAI,CAAA,EAAE,GAAI;AAAC,GAChF;AACF","file":"chunk-MGG4XAJ5.js","sourcesContent":["import type { HeadDescriptor } from './head';\nimport type { StoreContext } from '../api/store';\nimport { FALLBACK_LOCALE, isLocale } from '../providers/locale-constants';\nimport { resolveStoreBase, resolveStoreBaseFollowsLocale } from './store-identity';\nimport { splitLeadingSegment } from './store-base';\n\n// ============================================================================\n// Locale helpers\n// ============================================================================\n\n/** Maps ISO-639-1 locale codes to the og:locale format (language_TERRITORY). */\nconst LOCALE_OG_MAP: Record<string, string> = {\n ar: 'ar_AR',\n en: 'en_US',\n};\n\n/**\n * Converts an ISO-639-1 locale string to the og:locale format (e.g. `ar` → `ar_AR`).\n */\nexport function localeToOgLocale(locale: string): string {\n if (!locale) return LOCALE_OG_MAP[FALLBACK_LOCALE] ?? 'ar_AR';\n const base = locale.split(/[-_]/)[0].toLowerCase();\n return LOCALE_OG_MAP[base] ?? `${base}_${base.toUpperCase()}`;\n}\n\n/**\n * The page's own segments of an absolute URL's path: without the store's path (`storePath`, the\n * `/<username>` of a store without a domain) and without a locale beside it. The locale may sit\n * on either side: after the store in a store root (`/<username>/ar/shoes`), and in front of it in\n * the URLs the API hands out for a shared-host store (`/ar/<username>/shoes`).\n */\nfunction pageSegmentsOfUrl(pathname: string, storePath: string): string[] {\n const parts = pathname.split('/').filter(Boolean);\n const store = storePath.split('/').filter(Boolean);\n const storeAt = (index: number) =>\n store.length > 0 && store.every((segment, i) => parts[index + i] === segment);\n const localeAt = (index: number) => parts[index]?.length === 2;\n\n if (storeAt(0)) return parts.slice(store.length + (localeAt(store.length) ? 1 : 0));\n if (localeAt(0) && storeAt(1)) return parts.slice(1 + store.length);\n return parts.slice(localeAt(0) ? 1 : 0);\n}\n\n/**\n * Extracts the path portion from a URL or path string, removing any locale prefix and, from an\n * absolute URL, the store's own path (`storePath`, the `/<username>` of a store without a domain).\n */\nfunction extractPath(urlOrPath: string | undefined, storePath = ''): string {\n if (!urlOrPath) return '/';\n\n try {\n const parsed = new URL(urlOrPath);\n return '/' + pageSegmentsOfUrl(parsed.pathname, storePath).join('/');\n } catch {\n const pathParts = urlOrPath.split('/').filter(Boolean);\n if (pathParts.length > 0 && pathParts[0].length === 2) {\n pathParts.shift();\n }\n return '/' + pathParts.join('/');\n }\n}\n\n/**\n * The store's root URL from its store URL: the domain, plus the `/<username>` a store without\n * its own domain lives under, without a trailing locale.\n * \"https://saudiseamless.com/ar/\" → \"https://saudiseamless.com\"\n * \"https://salla.sa/my-store/ar/\" → \"https://salla.sa/my-store\"\n */\nfunction extractBaseUrl(storeUrl: string): string {\n try {\n const parsed = new URL(storeUrl);\n const segments = parsed.pathname.split('/').filter(Boolean);\n if (isLocale(segments[segments.length - 1])) segments.pop();\n return parsed.origin + segments.map((segment) => `/${segment}`).join('');\n } catch {\n return storeUrl.replace(/\\/[a-z]{2}\\/?$/i, '').replace(/\\/$/, '');\n }\n}\n\n/**\n * The store's root URL as pages are addressed now. On a Salla shared host that is\n * `https://demostore.salla.sa/<username>`: the API's `store.url` still carries the old\n * language segment (`/ar/<username>/`), which redirects, so it is not used there.\n */\nfunction storeRootUrl(storeUrl: string): string {\n const base = resolveStoreBase();\n if (base && resolveStoreBaseFollowsLocale()) {\n try {\n return `${new URL(storeUrl).origin}/${base}`;\n } catch {\n // Not an absolute URL: fall through to the generic rule.\n }\n }\n return extractBaseUrl(storeUrl);\n}\n\n/** Whether pages are addressed without a language segment (a Salla shared host). */\nfunction languageInQuery(): boolean {\n return Boolean(resolveStoreBase() && resolveStoreBaseFollowsLocale());\n}\n\n/**\n * A router path (`/ar/brands`) as a shared host addresses it: the leading locale comes off the\n * path and becomes `?lang=`, since the address carries no language. A path with no leading\n * locale takes `fallbackLocale` for its `?lang=`, or none when that is not given. `path` is\n * `''` for the store root.\n */\nfunction sharedHostPage(\n routerPath: string,\n fallbackLocale?: string\n): { path: string; search: string } {\n const { first, rest } = splitLeadingSegment(routerPath);\n const leading = isLocale(first);\n const remainder = leading ? rest : routerPath;\n const locale = leading ? first : fallbackLocale;\n return {\n path: remainder === '/' ? '' : remainder,\n search: locale ? `?lang=${encodeURIComponent(locale)}` : '',\n };\n}\n\n/**\n * `path` under the store's root URL, the way canonical URLs name a page.\n *\n * On a shared host `path` is the router's, with its virtual locale in front (`/ar/brands`),\n * and the page's address is `/<username>/brands?lang=ar`.\n */\nexport function storePageUrl(\n settings: StoreContext | null | undefined,\n path: string\n): string | undefined {\n const storeUrl = settings?.store?.url;\n if (!storeUrl) return undefined;\n const base = storeRootUrl(storeUrl);\n const page = languageInQuery()\n ? sharedHostPage(path)\n : { path: path === '/' ? '' : path, search: '' };\n if (!page.path && !page.search) return base;\n try {\n // Percent-encodes the decoded path the router hands over, and keeps escapes it left in.\n return new URL(`${base}${page.path}${page.search}`).href;\n } catch {\n return `${base}${page.path}${page.search}`;\n }\n}\n\n// ============================================================================\n// Hreflang alternates builder\n// ============================================================================\n\n/**\n * Builds hreflang alternate links for multilingual SEO.\n *\n * @param settings - StoreContext containing store and languages\n * @param path - Current route path from router (e.g., '/ar/products/123')\n */\nexport function buildHreflangAlternates(\n settings: StoreContext | null | undefined,\n path?: string\n): HeadDescriptor['alternateLanguages'] {\n const languages = settings?.languages;\n if (!languages?.length) {\n return undefined;\n }\n\n const baseUrl = settings?.store?.url ? storeRootUrl(settings.store.url) : '';\n const extractedPath = extractPath(path, baseUrl.replace(/^https?:\\/\\/[^/]+/, ''));\n const defaultLang = languages.find((l) => l.code === FALLBACK_LOCALE) ?? languages[0];\n const inQuery = languageInQuery();\n\n const buildUrl = (langCode: string) => {\n const pagePath = extractedPath === '/' ? '' : extractedPath;\n // On a shared host the language is not in the address; `?lang=` is how a link asks for one.\n return inQuery\n ? `${baseUrl}${pagePath}?lang=${encodeURIComponent(langCode)}`\n : `${baseUrl}/${langCode}${pagePath}`;\n };\n\n return [\n { hreflang: 'x-default', href: buildUrl(defaultLang.code) },\n ...languages.map((lang) => ({ hreflang: lang.code, href: buildUrl(lang.code) })),\n ];\n}\n\n// ============================================================================\n// Base head builder (for __root.tsx)\n// ============================================================================\n\n/**\n * Builds a base {@link HeadDescriptor} with store-wide OG and Twitter defaults.\n * Used in __root.tsx to set base metadata that can be overridden by child routes.\n *\n * Note: hreflang alternates, the canonical and og:url are only generated when\n * path is provided, since we need the current route path. Child routes call\n * buildHreflangAlternates directly with ctx.path.\n */\nexport function buildBaseHead(\n settings: StoreContext | null | undefined,\n locale: string = FALLBACK_LOCALE,\n path?: string\n): HeadDescriptor {\n const store = settings?.store;\n if (!store) return {};\n\n const title = store.meta?.title || store.name;\n const description = store.meta?.description || store.description || undefined;\n const keywords = store.meta?.keywords || undefined;\n const baseUrl = store.url ? storeRootUrl(store.url) : undefined;\n // A child route cannot replace a <link>, so a store-wide canonical would stick to every page.\n // On a shared host `path` is the router's, with the virtual locale in front: the address has\n // none, so it comes off and goes into `?lang=`, which keeps each language's page its own.\n const page = path && languageInQuery() ? sharedHostPage(path, locale) : null;\n const canonicalUrl =\n path && baseUrl\n ? page\n ? `${baseUrl}${page.path}${page.search}`\n : `${baseUrl}${path}`\n : undefined;\n const pagePath = path === '/' ? '' : path;\n const ogUrl =\n path && baseUrl ? (page ? canonicalUrl : `${baseUrl}/${locale}${pagePath}`) : undefined;\n\n // The store saves either a handle or a profile URL (https://x.com/<handle>).\n const twitterHandle = store.social?.twitter\n ?.split('?')[0]\n .replace(/\\/+$/, '')\n .split('/')\n .pop()\n ?.replace(/^@/, '');\n const twitterSite = twitterHandle ? `@${twitterHandle}` : undefined;\n\n return {\n title,\n ...(description ? { description } : {}),\n ...(keywords ? { keywords } : {}),\n ...(canonicalUrl ? { canonical: canonicalUrl } : {}),\n openGraph: {\n type: 'website',\n siteName: store.name,\n title,\n ...(description ? { description } : {}),\n ...(ogUrl ? { url: ogUrl } : {}),\n locale: localeToOgLocale(locale),\n ...(store.logo ? { images: store.logo } : {}),\n },\n twitter: {\n card: 'summary_large_image',\n title,\n ...(description ? { description } : {}),\n ...(twitterSite ? { site: twitterSite } : {}),\n ...(store.logo ? { images: store.logo } : {}),\n },\n ...(path ? { alternateLanguages: buildHreflangAlternates(settings, path) } : {}),\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/baseHead.ts"],"names":[],"mappings":";;;;AAWA,IAAM,aAAA,GAAwC;AAAA,EAC5C,EAAA,EAAI,OAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAKO,SAAS,iBAAiB,MAAA,EAAwB;AACvD,EAAA,IAAI,CAAC,MAAA,EAAQ,OAAO,aAAA,CAAc,eAAe,CAAA,IAAK,OAAA;AACtD,EAAA,MAAM,OAAO,MAAA,CAAO,KAAA,CAAM,MAAM,CAAA,CAAE,CAAC,EAAE,WAAA,EAAY;AACjD,EAAA,OAAO,aAAA,CAAc,IAAI,CAAA,IAAK,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,IAAA,CAAK,aAAa,CAAA,CAAA;AAC7D;AAQA,SAAS,iBAAA,CAAkB,UAAkB,SAAA,EAA6B;AACxE,EAAA,MAAM,QAAQ,QAAA,CAAS,KAAA,CAAM,GAAG,CAAA,CAAE,OAAO,OAAO,CAAA;AAChD,EAAA,MAAM,QAAQ,SAAA,CAAU,KAAA,CAAM,GAAG,CAAA,CAAE,OAAO,OAAO,CAAA;AACjD,EAAA,MAAM,OAAA,GAAU,CAAC,KAAA,KACf,KAAA,CAAM,SAAS,CAAA,IAAK,KAAA,CAAM,KAAA,CAAM,CAAC,SAAS,CAAA,KAAM,KAAA,CAAM,KAAA,GAAQ,CAAC,MAAM,OAAO,CAAA;AAC9E,EAAA,MAAM,WAAW,CAAC,KAAA,KAAkB,KAAA,CAAM,KAAK,GAAG,MAAA,KAAW,CAAA;AAE7D,EAAA,IAAI,OAAA,CAAQ,CAAC,CAAA,EAAG,OAAO,KAAA,CAAM,KAAA,CAAM,KAAA,CAAM,MAAA,IAAU,QAAA,CAAS,KAAA,CAAM,MAAM,CAAA,GAAI,IAAI,CAAA,CAAE,CAAA;AA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AAAA,IACA,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,qBAAA;AAAA,MACN,KAAA;AAAA,MACA,GAAI,WAAA,GAAc,EAAE,WAAA,KAAgB,EAAC;AAAA,MACrC,GAAI,WAAA,GAAc,EAAE,IAAA,EAAM,WAAA,KAAgB,EAAC;AAAA,MAC3C,GAAI,MAAM,IAAA,GAAO,EAAE,QAAQ,KAAA,CAAM,IAAA,KAAS;AAAC,KAC7C;AAAA,IACA,GAAI,OAAO,EAAE,kBAAA,EAAoB,wBAAwB,QAAA,EAAU,IAAI,CAAA,EAAE,GAAI;AAAC,GAChF;AACF","file":"chunk-P2PPBXHD.js","sourcesContent":["import type { HeadDescriptor } from './head';\nimport type { StoreContext } from '../api/store';\nimport { FALLBACK_LOCALE, isLocale } from '../providers/locale-constants';\nimport { resolveStoreBase, resolveStoreBaseFollowsLocale } from './store-identity';\nimport { splitLeadingSegment } from './store-base';\n\n// ============================================================================\n// Locale helpers\n// ============================================================================\n\n/** Maps ISO-639-1 locale codes to the og:locale format (language_TERRITORY). */\nconst LOCALE_OG_MAP: Record<string, string> = {\n ar: 'ar_AR',\n en: 'en_US',\n};\n\n/**\n * Converts an ISO-639-1 locale string to the og:locale format (e.g. `ar` → `ar_AR`).\n */\nexport function localeToOgLocale(locale: string): string {\n if (!locale) return LOCALE_OG_MAP[FALLBACK_LOCALE] ?? 'ar_AR';\n const base = locale.split(/[-_]/)[0].toLowerCase();\n return LOCALE_OG_MAP[base] ?? `${base}_${base.toUpperCase()}`;\n}\n\n/**\n * The page's own segments of an absolute URL's path: without the store's path (`storePath`, the\n * `/<username>` of a store without a domain) and without a locale beside it. The locale may sit\n * on either side: after the store in a store root (`/<username>/ar/shoes`), and in front of it in\n * the URLs the API hands out for a shared-host store (`/ar/<username>/shoes`).\n */\nfunction pageSegmentsOfUrl(pathname: string, storePath: string): string[] {\n const parts = pathname.split('/').filter(Boolean);\n const store = storePath.split('/').filter(Boolean);\n const storeAt = (index: number) =>\n store.length > 0 && store.every((segment, i) => parts[index + i] === segment);\n const localeAt = (index: number) => parts[index]?.length === 2;\n\n if (storeAt(0)) return parts.slice(store.length + (localeAt(store.length) ? 1 : 0));\n if (localeAt(0) && storeAt(1)) return parts.slice(1 + store.length);\n return parts.slice(localeAt(0) ? 1 : 0);\n}\n\n/**\n * Extracts the path portion from a URL or path string, removing any locale prefix and, from an\n * absolute URL, the store's own path (`storePath`, the `/<username>` of a store without a domain).\n */\nfunction extractPath(urlOrPath: string | undefined, storePath = ''): string {\n if (!urlOrPath) return '/';\n\n try {\n const parsed = new URL(urlOrPath);\n return '/' + pageSegmentsOfUrl(parsed.pathname, storePath).join('/');\n } catch {\n const pathParts = urlOrPath.split('/').filter(Boolean);\n if (pathParts.length > 0 && pathParts[0].length === 2) {\n pathParts.shift();\n }\n return '/' + pathParts.join('/');\n }\n}\n\n/**\n * The store's root URL from its store URL: the domain, plus the `/<username>` a store without\n * its own domain lives under, without a trailing locale.\n * \"https://saudiseamless.com/ar/\" → \"https://saudiseamless.com\"\n * \"https://salla.sa/my-store/ar/\" → \"https://salla.sa/my-store\"\n */\nfunction extractBaseUrl(storeUrl: string): string {\n try {\n const parsed = new URL(storeUrl);\n const segments = parsed.pathname.split('/').filter(Boolean);\n if (isLocale(segments[segments.length - 1])) segments.pop();\n return parsed.origin + segments.map((segment) => `/${segment}`).join('');\n } catch {\n return storeUrl.replace(/\\/[a-z]{2}\\/?$/i, '').replace(/\\/$/, '');\n }\n}\n\n/**\n * The store's root URL as pages are addressed now. On a Salla shared host that is\n * `https://demostore.salla.sa/<username>`: the API's `store.url` still carries the old\n * language segment (`/ar/<username>/`), which redirects, so it is not used there.\n */\nfunction storeRootUrl(storeUrl: string): string {\n const base = resolveStoreBase();\n if (base && resolveStoreBaseFollowsLocale()) {\n try {\n return `${new URL(storeUrl).origin}/${base}`;\n } catch {\n // Not an absolute URL: fall through to the generic rule.\n }\n }\n return extractBaseUrl(storeUrl);\n}\n\n/** Whether pages are addressed without a language segment (a Salla shared host). */\nfunction languageInQuery(): boolean {\n return Boolean(resolveStoreBase() && resolveStoreBaseFollowsLocale());\n}\n\n/**\n * A router path (`/ar/brands`) as a shared host addresses it: the leading locale comes off the\n * path and becomes `?lang=`, since the address carries no language. A path with no leading\n * locale takes `fallbackLocale` for its `?lang=`, or none when that is not given. `path` is\n * `''` for the store root.\n */\nfunction sharedHostPage(\n routerPath: string,\n fallbackLocale?: string\n): { path: string; search: string } {\n const { first, rest } = splitLeadingSegment(routerPath);\n const leading = isLocale(first);\n const remainder = leading ? rest : routerPath;\n const locale = leading ? first : fallbackLocale;\n return {\n path: remainder === '/' ? '' : remainder,\n search: locale ? `?lang=${encodeURIComponent(locale)}` : '',\n };\n}\n\n/**\n * `path` under the store's root URL, the way canonical URLs name a page.\n *\n * On a shared host `path` is the router's, with its virtual locale in front (`/ar/brands`),\n * and the page's address is `/<username>/brands?lang=ar`.\n */\nexport function storePageUrl(\n settings: StoreContext | null | undefined,\n path: string\n): string | undefined {\n const storeUrl = settings?.store?.url;\n if (!storeUrl) return undefined;\n const base = storeRootUrl(storeUrl);\n const page = languageInQuery()\n ? sharedHostPage(path)\n : { path: path === '/' ? '' : path, search: '' };\n if (!page.path && !page.search) return base;\n try {\n // Percent-encodes the decoded path the router hands over, and keeps escapes it left in.\n return new URL(`${base}${page.path}${page.search}`).href;\n } catch {\n return `${base}${page.path}${page.search}`;\n }\n}\n\n// ============================================================================\n// Hreflang alternates builder\n// ============================================================================\n\n/**\n * Builds hreflang alternate links for multilingual SEO.\n *\n * @param settings - StoreContext containing store and languages\n * @param path - Current route path from router (e.g., '/ar/products/123')\n */\nexport function buildHreflangAlternates(\n settings: StoreContext | null | undefined,\n path?: string\n): HeadDescriptor['alternateLanguages'] {\n const languages = settings?.languages;\n if (!languages?.length) {\n return undefined;\n }\n\n const baseUrl = settings?.store?.url ? storeRootUrl(settings.store.url) : '';\n const extractedPath = extractPath(path, baseUrl.replace(/^https?:\\/\\/[^/]+/, ''));\n const defaultLang = languages.find((l) => l.code === FALLBACK_LOCALE) ?? languages[0];\n const inQuery = languageInQuery();\n\n const buildUrl = (langCode: string) => {\n const pagePath = extractedPath === '/' ? '' : extractedPath;\n // On a shared host the language is not in the address; `?lang=` is how a link asks for one.\n return inQuery\n ? `${baseUrl}${pagePath}?lang=${encodeURIComponent(langCode)}`\n : `${baseUrl}/${langCode}${pagePath}`;\n };\n\n return [\n { hreflang: 'x-default', href: buildUrl(defaultLang.code) },\n ...languages.map((lang) => ({ hreflang: lang.code, href: buildUrl(lang.code) })),\n ];\n}\n\n// ============================================================================\n// Base head builder (for __root.tsx)\n// ============================================================================\n\n/**\n * Builds a base {@link HeadDescriptor} with store-wide OG and Twitter defaults.\n * Used in __root.tsx to set base metadata that can be overridden by child routes.\n *\n * Note: hreflang alternates, the canonical and og:url are only generated when\n * path is provided, since we need the current route path. Child routes call\n * buildHreflangAlternates directly with ctx.path.\n */\nexport function buildBaseHead(\n settings: StoreContext | null | undefined,\n locale: string = FALLBACK_LOCALE,\n path?: string\n): HeadDescriptor {\n const store = settings?.store;\n if (!store) return {};\n\n const title = store.meta?.title || store.name;\n const description = store.meta?.description || store.description || undefined;\n const keywords = store.meta?.keywords || undefined;\n const baseUrl = store.url ? storeRootUrl(store.url) : undefined;\n // A child route cannot replace a <link>, so a store-wide canonical would stick to every page.\n // On a shared host `path` is the router's, with the virtual locale in front: the address has\n // none, so it comes off and goes into `?lang=`, which keeps each language's page its own.\n const page = path && languageInQuery() ? sharedHostPage(path, locale) : null;\n const canonicalUrl =\n path && baseUrl\n ? page\n ? `${baseUrl}${page.path}${page.search}`\n : `${baseUrl}${path}`\n : undefined;\n const pagePath = path === '/' ? '' : path;\n const ogUrl =\n path && baseUrl ? (page ? canonicalUrl : `${baseUrl}/${locale}${pagePath}`) : undefined;\n\n // The store saves either a handle or a profile URL (https://x.com/<handle>).\n const twitterHandle = store.social?.twitter\n ?.split('?')[0]\n .replace(/\\/+$/, '')\n .split('/')\n .pop()\n ?.replace(/^@/, '');\n const twitterSite = twitterHandle ? `@${twitterHandle}` : undefined;\n\n return {\n title,\n ...(description ? { description } : {}),\n ...(keywords ? { keywords } : {}),\n ...(canonicalUrl ? { canonical: canonicalUrl } : {}),\n openGraph: {\n type: 'website',\n siteName: store.name,\n title,\n ...(description ? { description } : {}),\n ...(ogUrl ? { url: ogUrl } : {}),\n locale: localeToOgLocale(locale),\n ...(store.logo ? { images: store.logo } : {}),\n },\n twitter: {\n card: 'summary_large_image',\n title,\n ...(description ? { description } : {}),\n ...(twitterSite ? { site: twitterSite } : {}),\n ...(store.logo ? { images: store.logo } : {}),\n },\n ...(path ? { alternateLanguages: buildHreflangAlternates(settings, path) } : {}),\n };\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { useOpeningHours } from './chunk-2LXCSBJU.js';
2
- import { useIsProduct } from './chunk-4UGJ4VC3.js';
1
+ import { useOpeningHours } from './chunk-O63WBEAC.js';
2
+ import { useIsProduct } from './chunk-O3XMYDNC.js';
3
3
  import { useTranslation } from './chunk-TYNZ5B2B.js';
4
4
  import { useTwilight } from './chunk-DF6FBKDN.js';
5
5
  import { useState } from 'react';
@@ -54,5 +54,5 @@ function StoreClosedNotification(_props) {
54
54
  }
55
55
 
56
56
  export { StoreClosedNotification };
57
- //# sourceMappingURL=chunk-KOR42MT5.js.map
58
- //# sourceMappingURL=chunk-KOR42MT5.js.map
57
+ //# sourceMappingURL=chunk-PHPOMWQ4.js.map
58
+ //# sourceMappingURL=chunk-PHPOMWQ4.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/store/StoreClosedNotification.tsx"],"names":[],"mappings":";;;;;;;AAsBO,SAAS,wBAAwB,MAAA,EAAsC;AAC5E,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,WAAA,EAAY;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,EAAE,QAAQ,SAAA,EAAW,iBAAA,KAAsB,eAAA,CAAgB,KAAA,C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AAA,EAAQ,CAAA,EAAG,SAAA,EAAW,QAAA,EAAU,IAAA,EAAM,CAAA,EAAE,EACjD,QAAA,EAAA,CAAA,CAAE,2BAAA,EAA6B;AAAA,UAC9B,YAAA,EAAc,qPAAkD,iBAAiB,CAAA,CAAA,CAAA;AAAA,UACjF,QAAA,EAAU;AAAA,SACX,CAAA,EACH;AAAA;AAAA;AAAA,GACF;AAEJ","file":"chunk-KOR42MT5.js","sourcesContent":["import { useState } from 'react';\nimport { useIsProduct } from '../../providers/NavigationProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useOpeningHours } from '../../hooks/useOpeningHours';\nimport { useTranslation } from '../../providers/I18nProvider';\n\nexport interface StoreClosedNotificationProps {\n /** Whether to show the notification (defaults to true when store is closed on product page) */\n show?: boolean;\n}\n\n/**\n * StoreClosedNotification - Shows a notification bar when the store is closed.\n *\n * Mirrors PHP ReceivingOrdersTimesWidget:\n * - Only shows on product pages\n * - Only shows when store is closed for receiving orders\n * - Displays when the store will open next\n * - Has a close button to dismiss\n *\n * Injected via hook registry at body:start.\n */\nexport function StoreClosedNotification(_props: StoreClosedNotificationProps) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const { isOpen, isEnabled, nextOpenFormatted } = useOpeningHours(store.settings?.opening_hours);\n const [dismissed, setDismissed] = useState(false);\n\n // Check if we're on a product page\n const isProductPage = useIsProduct();\n\n // Conditions: product page, opening hours enabled, store closed, not dismissed\n if (!isProductPage || !isEnabled || isOpen || dismissed || !nextOpenFormatted) {\n return null;\n }\n\n const handleClose = (e: React.MouseEvent) => {\n e.preventDefault();\n setDismissed(true);\n };\n\n return (\n <div\n className=\"store-notify\"\n id=\"store-closed-notification\"\n data-testid=\"store-closed-notification\"\n style={{\n backgroundColor: '#d63031',\n color: '#fff',\n padding: '10px 15px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'relative',\n }}\n >\n <a\n href=\"#\"\n id=\"notify-close\"\n onClick={handleClose}\n style={{ position: 'absolute', left: 15, color: '#fff', textDecoration: 'none' }}\n >\n <i className=\"sicon-cancel\" />\n </a>\n <p style={{ margin: 0, textAlign: 'center', flex: 1 }}>\n {t('store.closed_notification', {\n defaultValue: `المتجر حاليا مغلق لاستقبال الطلبات وسيتم فتحه (${nextOpenFormatted})`,\n nextOpen: nextOpenFormatted,\n })}\n </p>\n </div>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/components/store/StoreClosedNotification.tsx"],"names":[],"mappings":";;;;;;;AAsBO,SAAS,wBAAwB,MAAA,EAAsC;AAC5E,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,WAAA,EAAY;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,EAAE,QAAQ,SAAA,EAAW,iBAAA,KAAsB,eAAA,CAAgB,KAAA,CAAM,UAAU,aAAa,CAAA;AAC9F,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAGhD,EAAA,MAAM,gBAAgB,YAAA,EAAa;AAGnC,EAAA,IAAI,CAAC,aAAA,IAAiB,CAAC,aAAa,MAAA,IAAU,SAAA,IAAa,CAAC,iBAAA,EAAmB;AAC7E,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,MAAM,WAAA,GAAc,CAAC,CAAA,KAAwB;AAC3C,IAAA,CAAA,CAAE,cAAA,EAAe;AACjB,IAAA,YAAA,CAAa,IAAI,CAAA;AAAA,EACnB,CAAA;AAEA,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,cAAA;AAAA,MACV,EAAA,EAAG,2BAAA;AAAA,MACH,aAAA,EAAY,2BAAA;AAAA,MACZ,KAAA,EAAO;AAAA,QACL,eAAA,EAAiB,SAAA;AAAA,QACjB,KAAA,EAAO,MAAA;AAAA,QACP,OAAA,EAAS,WAAA;AAAA,QACT,OAAA,EAAS,MAAA;AAAA,QACT,UAAA,EAAY,QAAA;AAAA,QACZ,cAAA,EAAgB,QAAA;AAAA,QAChB,QAAA,EAAU;AAAA,OACZ;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,GAAA;AAAA,UAAA;AAAA,YACC,IAAA,EAAK,GAAA;AAAA,YACL,EAAA,EAAG,cAAA;AAAA,YACH,OAAA,EAAS,WAAA;AAAA,YACT,KAAA,EAAO,EAAE,QAAA,EAAU,UAAA,EAAY,MAAM,EAAA,EAAI,KAAA,EAAO,MAAA,EAAQ,cAAA,EAAgB,MAAA,EAAO;AAAA,YAE/E,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,cAAA,EAAe;AAAA;AAAA,SAC9B;AAAA,wBACA,GAAA,CAAC,GAAA,EAAA,EAAE,KAAA,EAAO,EAAE,MAAA,EAAQ,CAAA,EAAG,SAAA,EAAW,QAAA,EAAU,IAAA,EAAM,CAAA,EAAE,EACjD,QAAA,EAAA,CAAA,CAAE,2BAAA,EAA6B;AAAA,UAC9B,YAAA,EAAc,qPAAkD,iBAAiB,CAAA,CAAA,CAAA;AAAA,UACjF,QAAA,EAAU;AAAA,SACX,CAAA,EACH;AAAA;AAAA;AAAA,GACF;AAEJ","file":"chunk-PHPOMWQ4.js","sourcesContent":["import { useState } from 'react';\nimport { useIsProduct } from '../../providers/NavigationProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useOpeningHours } from '../../hooks/useOpeningHours';\nimport { useTranslation } from '../../providers/I18nProvider';\n\nexport interface StoreClosedNotificationProps {\n /** Whether to show the notification (defaults to true when store is closed on product page) */\n show?: boolean;\n}\n\n/**\n * StoreClosedNotification - Shows a notification bar when the store is closed.\n *\n * Mirrors PHP ReceivingOrdersTimesWidget:\n * - Only shows on product pages\n * - Only shows when store is closed for receiving orders\n * - Displays when the store will open next\n * - Has a close button to dismiss\n *\n * Injected via hook registry at body:start.\n */\nexport function StoreClosedNotification(_props: StoreClosedNotificationProps) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const { isOpen, isEnabled, nextOpenFormatted } = useOpeningHours(store.settings?.opening_hours);\n const [dismissed, setDismissed] = useState(false);\n\n // Check if we're on a product page\n const isProductPage = useIsProduct();\n\n // Conditions: product page, opening hours enabled, store closed, not dismissed\n if (!isProductPage || !isEnabled || isOpen || dismissed || !nextOpenFormatted) {\n return null;\n }\n\n const handleClose = (e: React.MouseEvent) => {\n e.preventDefault();\n setDismissed(true);\n };\n\n return (\n <div\n className=\"store-notify\"\n id=\"store-closed-notification\"\n data-testid=\"store-closed-notification\"\n style={{\n backgroundColor: '#d63031',\n color: '#fff',\n padding: '10px 15px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'relative',\n }}\n >\n <a\n href=\"#\"\n id=\"notify-close\"\n onClick={handleClose}\n style={{ position: 'absolute', left: 15, color: '#fff', textDecoration: 'none' }}\n >\n <i className=\"sicon-cancel\" />\n </a>\n <p style={{ margin: 0, textAlign: 'center', flex: 1 }}>\n {t('store.closed_notification', {\n defaultValue: `المتجر حاليا مغلق لاستقبال الطلبات وسيتم فتحه (${nextOpenFormatted})`,\n nextOpen: nextOpenFormatted,\n })}\n </p>\n </div>\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { getActiveScope, api } from './chunk-WJJOFIBJ.js';
1
+ import { getActiveScope, api } from './chunk-RB7RHMKJ.js';
2
2
  import { getTwilightContext } from './chunk-6K34BCUP.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
@@ -25,5 +25,5 @@ var advertisement = {
25
25
  };
26
26
 
27
27
  export { advertisement, advertisementsFor };
28
- //# sourceMappingURL=chunk-MFTPNDEI.js.map
29
- //# sourceMappingURL=chunk-MFTPNDEI.js.map
28
+ //# sourceMappingURL=chunk-PPFD456V.js.map
29
+ //# sourceMappingURL=chunk-PPFD456V.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/advertisement.ts"],"names":[],"mappings":";;;;AAkBO,SAAS,iBAAA,CACd,KACA,QAAA,EACiB;AACjB,EAAA,OAAO,GAAA,CAAI,MAAA;AAAA,IACT,CAAC,EAAA,KACC,KAAA,CAAM,QAAQ,EAAA,CAAG,KAAK,MACrB,EAAA,CAAG,KAAA,CAAM,QAAA,CAAS,KAAK,KAAM,CAAC,CAAC,YAAY,EAAA,CAAG,KAAA,CAAM,SAAS,QAAQ,CAAA;AAAA,GAC1E;AACF;AAEO,IAAM,aAAA,GAAgB;AAAA;AAAA,EAE3B,MAAM,YAAsC;AAE1C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,gBAAA,EAAkB,EAAE,OAAA,EAAS,GAAA,EAAM,CAAA,CACvC,IAAA,EAAiC;AACpC,IAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA,GAAI,OAAO,EAAC;AAAA,EACvC,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,MACJ,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,gBAAA,EAAkB,kBAAA,EAAmB,CAAE,QAAQ,EAAE,KAAA,EAAO,cAAA,EAAe,EAAG,CAAA;AAAA,MACrF,OAAA,EAAS,MAAM,aAAA,CAAc,IAAA,EAAK;AAAA,MAClC,SAAA,EAAW,QAAA;AAAA;AAAA,MAEX,KAAA,EAAO;AAAA,KACR;AAAA;AAEP","file":"chunk-MFTPNDEI.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport { getTwilightContext } from '../twilight/context';\n\n/** A merchant's announcement bar, as `GET advertisements` returns it. */\nexport interface Advertisement {\n id: number;\n title?: string;\n description?: string;\n icon?: string | null;\n url?: string | null;\n target?: string | null;\n colors?: { bg?: string; text?: string };\n /** Page slugs the ad shows on (`salla.config` `page.slug`), or `all`. */\n pages?: string[];\n}\n\n/** The ads a page shows: the rule the API applies to `?page=`, run on the full list. */\nexport function advertisementsFor(\n ads: readonly Advertisement[],\n pageSlug: string | null | undefined\n): Advertisement[] {\n return ads.filter(\n (ad) =>\n Array.isArray(ad.pages) &&\n (ad.pages.includes('all') || (!!pageSlug && ad.pages.includes(pageSlug)))\n );\n}\n\nexport const advertisement = {\n /** Every active ad, unfiltered: one request serves all pages, filtered with `advertisementsFor`. */\n list: async (): Promise<Advertisement[]> => {\n // Short timeout: it is fetched with the store settings on every server render.\n const { data } = await api\n .get('advertisements', { timeout: 3000 })\n .json<{ data?: Advertisement[] }>();\n return Array.isArray(data) ? data : [];\n },\n\n queries: {\n list: () =>\n queryOptions({\n queryKey: ['advertisements', getTwilightContext().locale, { scope: getActiveScope() }],\n queryFn: () => advertisement.list(),\n staleTime: Infinity,\n // Awaited in rootBeforeLoad: a retry would double the 3s budget. `PageAdvertisements` retries.\n retry: 0,\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/advertisement.ts"],"names":[],"mappings":";;;;AAkBO,SAAS,iBAAA,CACd,KACA,QAAA,EACiB;AACjB,EAAA,OAAO,GAAA,CAAI,MAAA;AAAA,IACT,CAAC,EAAA,KACC,KAAA,CAAM,QAAQ,EAAA,CAAG,KAAK,MACrB,EAAA,CAAG,KAAA,CAAM,QAAA,CAAS,KAAK,KAAM,CAAC,CAAC,YAAY,EAAA,CAAG,KAAA,CAAM,SAAS,QAAQ,CAAA;AAAA,GAC1E;AACF;AAEO,IAAM,aAAA,GAAgB;AAAA;AAAA,EAE3B,MAAM,YAAsC;AAE1C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,gBAAA,EAAkB,EAAE,OAAA,EAAS,GAAA,EAAM,CAAA,CACvC,IAAA,EAAiC;AACpC,IAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,IAAI,CAAA,GAAI,OAAO,EAAC;AAAA,EACvC,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,MACJ,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,gBAAA,EAAkB,kBAAA,EAAmB,CAAE,QAAQ,EAAE,KAAA,EAAO,cAAA,EAAe,EAAG,CAAA;AAAA,MACrF,OAAA,EAAS,MAAM,aAAA,CAAc,IAAA,EAAK;AAAA,MAClC,SAAA,EAAW,QAAA;AAAA;AAAA,MAEX,KAAA,EAAO;AAAA,KACR;AAAA;AAEP","file":"chunk-PPFD456V.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport { getTwilightContext } from '../twilight/context';\n\n/** A merchant's announcement bar, as `GET advertisements` returns it. */\nexport interface Advertisement {\n id: number;\n title?: string;\n description?: string;\n icon?: string | null;\n url?: string | null;\n target?: string | null;\n colors?: { bg?: string; text?: string };\n /** Page slugs the ad shows on (`salla.config` `page.slug`), or `all`. */\n pages?: string[];\n}\n\n/** The ads a page shows: the rule the API applies to `?page=`, run on the full list. */\nexport function advertisementsFor(\n ads: readonly Advertisement[],\n pageSlug: string | null | undefined\n): Advertisement[] {\n return ads.filter(\n (ad) =>\n Array.isArray(ad.pages) &&\n (ad.pages.includes('all') || (!!pageSlug && ad.pages.includes(pageSlug)))\n );\n}\n\nexport const advertisement = {\n /** Every active ad, unfiltered: one request serves all pages, filtered with `advertisementsFor`. */\n list: async (): Promise<Advertisement[]> => {\n // Short timeout: it is fetched with the store settings on every server render.\n const { data } = await api\n .get('advertisements', { timeout: 3000 })\n .json<{ data?: Advertisement[] }>();\n return Array.isArray(data) ? data : [];\n },\n\n queries: {\n list: () =>\n queryOptions({\n queryKey: ['advertisements', getTwilightContext().locale, { scope: getActiveScope() }],\n queryFn: () => advertisement.list(),\n staleTime: Infinity,\n // Awaited in rootBeforeLoad: a retry would double the 3s budget. `PageAdvertisements` retries.\n retry: 0,\n }),\n },\n};\n"]}
@@ -1,9 +1,9 @@
1
1
  import { registry } from './chunk-Y32RHCOH.js';
2
- import { useMoney, useNumber } from './chunk-2LXCSBJU.js';
2
+ import { useMoney, useNumber } from './chunk-O63WBEAC.js';
3
3
  import { useAsset } from './chunk-Z653O7MX.js';
4
- import { useWishlist } from './chunk-M5WTY3EH.js';
4
+ import { useWishlist } from './chunk-5EAISVPV.js';
5
5
  import { useTranslation } from './chunk-TYNZ5B2B.js';
6
- import { Image } from './chunk-VGZEPMXG.js';
6
+ import { Image } from './chunk-LBZNLTBM.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';
@@ -229,5 +229,5 @@ var ProductCard = memo(function ProductCard2(props) {
229
229
  });
230
230
 
231
231
  export { ProductCard };
232
- //# sourceMappingURL=chunk-NIPEIVU4.js.map
233
- //# sourceMappingURL=chunk-NIPEIVU4.js.map
232
+ //# sourceMappingURL=chunk-PVOJJ2BV.js.map
233
+ //# sourceMappingURL=chunk-PVOJJ2BV.js.map
@@ -1 +1 @@
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,EA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AyB;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-NIPEIVU4.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 // As Twig's card: the store's unified image height sizes horizontal cards too.\n fitImageHeight && (isVertical || isHorizontal) ? `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,IA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,SAAA;AAAA,gBACL,KAAA,EAAM,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-PVOJJ2BV.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 // As Twig's card: the store's unified image height sizes horizontal cards too.\n fitImageHeight && (isVertical || isHorizontal) ? `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,4 +1,4 @@
1
- import { api } from './chunk-WJJOFIBJ.js';
1
+ import { api } from './chunk-RB7RHMKJ.js';
2
2
  import { queryOptions } from '@tanstack/react-query';
3
3
 
4
4
  var user = {
@@ -19,5 +19,5 @@ var user = {
19
19
  };
20
20
 
21
21
  export { user };
22
- //# sourceMappingURL=chunk-A6Y33KCR.js.map
23
- //# sourceMappingURL=chunk-A6Y33KCR.js.map
22
+ //# sourceMappingURL=chunk-PYXAPLNB.js.map
23
+ //# sourceMappingURL=chunk-PYXAPLNB.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/user.ts"],"names":[],"mappings":";;;AAIO,IAAM,IAAA,GAAO;AAAA,EAClB,KAAK,YAAkC;AACrC,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,GAAA,CACV,GAAA,CAAI,WAAW,CAAA,CACf,MAAmC,CACnC,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,GAAG,CAAA,CAAE,IAAA,EAAM,IAAA,EAAM,QAAgB,CAAE,CAAA;AAAA,IACvD,SAAS,KAAA,EAAO;AACd,MAAA,OAAA,CAAQ,KAAA,CAAM,sBAAsB,KAAK,CAAA;AACzC,MAAA,OAAO,IAAA;AAAA,IACT;AAAA,EACF,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,MACP,YAAA,CAA0B;AAAA,MACxB,QAAA,EAAU,CAAC,MAAA,EAAQ,SAAS,CAAA;AAAA,MAC5B,SAAS,IAAA,CAAK;AAAA,KACf;AAAA;AAEP","file":"chunk-A6Y33KCR.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { User } from '../types';\n\nexport const user = {\n get: async (): Promise<User | null> => {\n try {\n return await api\n .get('auth/user')\n .json<{ data: Omit<User, 'type'> }>()\n .then((r) => ({ ...r.data, type: 'user' as const }));\n } catch (error) {\n console.debug('[user.get] Failed:', error);\n return null;\n }\n },\n\n queries: {\n current: () =>\n queryOptions<User | null>({\n queryKey: ['user', 'current'],\n queryFn: user.get,\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/user.ts"],"names":[],"mappings":";;;AAIO,IAAM,IAAA,GAAO;AAAA,EAClB,KAAK,YAAkC;AACrC,IAAA,IAAI;AACF,MAAA,OAAO,MAAM,GAAA,CACV,GAAA,CAAI,WAAW,CAAA,CACf,MAAmC,CACnC,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,GAAG,CAAA,CAAE,IAAA,EAAM,IAAA,EAAM,QAAgB,CAAE,CAAA;AAAA,IACvD,SAAS,KAAA,EAAO;AACd,MAAA,OAAA,CAAQ,KAAA,CAAM,sBAAsB,KAAK,CAAA;AACzC,MAAA,OAAO,IAAA;AAAA,IACT;AAAA,EACF,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,OAAA,EAAS,MACP,YAAA,CAA0B;AAAA,MACxB,QAAA,EAAU,CAAC,MAAA,EAAQ,SAAS,CAAA;AAAA,MAC5B,SAAS,IAAA,CAAK;AAAA,KACf;AAAA;AAEP","file":"chunk-PYXAPLNB.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { User } from '../types';\n\nexport const user = {\n get: async (): Promise<User | null> => {\n try {\n return await api\n .get('auth/user')\n .json<{ data: Omit<User, 'type'> }>()\n .then((r) => ({ ...r.data, type: 'user' as const }));\n } catch (error) {\n console.debug('[user.get] Failed:', error);\n return null;\n }\n },\n\n queries: {\n current: () =>\n queryOptions<User | null>({\n queryKey: ['user', 'current'],\n queryFn: user.get,\n }),\n },\n};\n"]}
@@ -1,5 +1,5 @@
1
- import { getActiveCurrency } from './chunk-WJJOFIBJ.js';
2
- import { whenSallaLoaded } from './chunk-XMRNYUQY.js';
1
+ import { getActiveCurrency } from './chunk-RB7RHMKJ.js';
2
+ import { whenSallaLoaded } from './chunk-7XAGU6CT.js';
3
3
  import { getTwilightContext } from './chunk-6K34BCUP.js';
4
4
 
5
5
  // src/utils/sdk-events.ts
@@ -86,5 +86,5 @@ function dispatchProductsFetched(list, source) {
86
86
  }
87
87
 
88
88
  export { dispatchCartViewed, dispatchPageViewed, dispatchProductViewed, dispatchProductsFetched, dispatchRouteChanged, setAnalyticsPage };
89
- //# sourceMappingURL=chunk-WJVKBSKY.js.map
90
- //# sourceMappingURL=chunk-WJVKBSKY.js.map
89
+ //# sourceMappingURL=chunk-PZP3372I.js.map
90
+ //# sourceMappingURL=chunk-PZP3372I.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/sdk-events.ts"],"names":[],"mappings":";;;;;AA6BO,SAAS,oBAAA,GAA6B;AAC3C,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AAEnC,EAAA,MAAM,QAAQ,MAAA,CAAO,KAAA;AACrB,EAAA,IAAI,CAAC,KAAA,EAAO,KAAA,EAAO,QAAA,EAAU;AAE7B,EAAA,MAAM,MAAM,kBAAA,EAAmB;AAC/B,EAAA,KAAA,CAAM,MAAM,QAAA,CAAS,gBAAA,EAAkB,GAAA,CAAI,IAAA,IAAQ,EAAE,CAAA;AACvD;AAMO,SAAS,sBAAsB,OAAA,EAAwB;AAC5D,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,EAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,IAAK,CAAA;AACvC,EAAA,MAAM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A,EAAQ,KAAK,MAAA,IAAU,MAAA;AAAA,MACvB,UAAU,IAAA,CAAK;AAAA,KACjB,CAAE;AAAA,GACJ;AACA,EAAA,eAAA;AAAA,IACE,CAAC,GAAA,KAAQ,KAAK,GAAA,CAAI,SAAQ,CAAE,IAAA,CAAK,MAAM,GAAA,CAAI,MAAM,QAAA,CAAS,aAAA,EAAe,CAAC,OAAO,CAAC,CAAC;AAAA,GACrF;AACF;AAcO,SAAS,uBAAA,CACd,MACA,MAAA,EACM;AACN,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,EAAA,MAAM,OAAA,GAAU;AAAA,IACd,MAAM,IAAA,CAAK,KAAA;AAAA,IACX,MAAA,EAAQ,EAAE,IAAA,EAAM,IAAA,CAAK,IAAA,EAAK;AAAA,IAC1B,UAAU,IAAA,CAAK,IAAA;AAAA,IACf,QAAQ,MAAA,CAAO,IAAA;AAAA,IACf,aAAa,MAAA,CAAO;AAAA,GACtB;AACA,EAAA,eAAA;AAAA,IACE,CAAC,GAAA,KACC,KAAK,GAAA,CACF,OAAA,EAAQ,CACR,IAAA,CAAK,MAAM,GAAA,CAAI,KAAA,CAAM,QAAA,CAAS,uCAAA,EAAyC,OAAO,CAAC;AAAA,GACtF;AACF","file":"chunk-WJVKBSKY.js","sourcesContent":["import { getTwilightContext } from '../twilight/context';\nimport type { PageContext } from '../twilight/context';\nimport type { Cart, Money, Product } from '../types';\nimport { getActiveCurrency } from '../api/client';\nimport { whenSallaLoaded } from './sdk-helpers';\n\n/**\n * Payload dispatched via `salla.event.dispatch('route::changed', payload)`\n * after each client-side navigation completes.\n *\n * The page config fields are spread at root level. When the matched route\n * has no page data (e.g., 404, error boundary), an empty object is dispatched.\n *\n * @example\n * ```ts\n * salla.event.on('route::changed', (page: RouteChangedEvent) => {\n * console.log(page.slug, page.title, page.id);\n * });\n * ```\n */\nexport type RouteChangedEvent = PageContext;\n\n/**\n * Dispatch the `route::changed` Salla SDK event with the current page config.\n *\n * Framework-agnostic — reads from the twilight context store which is\n * populated by whichever framework adapter is active (TanStack, Next.js, etc.).\n * Each adapter should call this after navigation resolves.\n */\nexport function dispatchRouteChanged(): void {\n if (typeof window === 'undefined') return;\n\n const salla = window.salla;\n if (!salla?.event?.dispatch) return;\n\n const ctx = getTwilightContext();\n salla.event.dispatch('route::changed', ctx.page ?? {});\n}\n\n/**\n * Dispatch `Product Viewed`, which Twig's product page hands the SDK through `salla.init`'s\n * `events`: store analytics, pixels and apps that remember viewed products listen for it.\n */\nexport function dispatchProductViewed(product: Product): void {\n if (typeof window === 'undefined') return;\n const price = Number(product.price) || 0;\n const image = product.image?.url ?? '';\n const payload = {\n id: product.id,\n name: product.name,\n categories: product.category ? [{ id: product.category.id, name: product.category.name }] : [],\n category: product.category?.name ?? '',\n price,\n quantity: 1,\n variant: '',\n brand: product.brand?.name ?? '',\n image,\n currency: getActiveCurrency(product.currency),\n sku: product.sku ?? '',\n value: price,\n url: product.url,\n image_url: image,\n };\n // After init: analytics drops events until `salla.init` has merged the store's `jitsu` list.\n whenSallaLoaded(\n (sdk) => void sdk.onReady().then(() => sdk.event.dispatch('Product Viewed', [payload]))\n );\n}\n\n/**\n * Report a page view after a client-side navigation. Twig loads every page, and the SDK's\n * analytics reports one view on ready; a React navigation loads nothing, so the store's\n * analytics saw the first page only, and every later event carried that page's context.\n *\n * `referrer` is the page navigated from: `document.referrer` still names the page before the\n * first one.\n */\nexport function dispatchPageViewed(referrer: string): void {\n if (typeof window === 'undefined') return;\n const page = getTwilightContext().page;\n if (!page) return;\n const payload = analyticsPage(page);\n whenSallaLoaded(\n (sdk) => void sdk.onReady().then(() => sdk.analytics?.page?.({ ...payload, referrer }))\n );\n}\n\nconst analyticsPage = (page: PageContext) => ({ name: page.slug ?? '', id: String(page.id ?? '') });\n\n/** Point the analytics `page` context at a page navigated to, before its own events go out. */\nexport function setAnalyticsPage(page: PageContext): void {\n if (typeof window === 'undefined') return;\n const context = analyticsPage(page);\n whenSallaLoaded(\n (sdk) => void sdk.onReady().then(() => sdk.analytics?.setContext?.('page', context))\n );\n}\n\nconst amountOf = (price: number | Money | undefined): number =>\n typeof price === 'object' ? Number(price.amount) || 0 : Number(price) || 0;\n\n/**\n * Dispatch `Cart Viewed`, which Twig's cart page hands the SDK through `salla.init`'s `events`.\n * The React cart page loads the cart in the browser, so the engine reports it once it has it.\n */\nexport function dispatchCartViewed(cart: Cart): void {\n if (typeof window === 'undefined') return;\n const payload = {\n cart_id: cart.id,\n products: cart.items.map((item) => ({\n id: item.product_id,\n cart_item_id: item.id,\n name: item.product_name,\n price: amountOf(item.price),\n url: item.url,\n image_url: item.product_image,\n coupon: cart.coupon ?? undefined,\n quantity: item.quantity,\n })),\n };\n whenSallaLoaded(\n (sdk) => void sdk.onReady().then(() => sdk.event.dispatch('Cart Viewed', [payload]))\n );\n}\n\n/** A page of a product listing, as `product.list` returns it. */\nexport interface ProductsFetched {\n items: Product[];\n /** The API's next-page URL: it carries the sort and any `filters[...]` the page was fetched with. */\n next: string | null;\n}\n\n/**\n * Emit `salla-products-list::products.fetched` for a page of a product listing, as Twig's\n * `<salla-products-list>` does on each page it fetches. The store's analytics maps it to\n * `Product List Viewed`, or `Product List Filtered` when the page was fetched with filters.\n */\nexport function dispatchProductsFetched(\n list: ProductsFetched,\n source: { type: string; value?: string }\n): void {\n if (typeof window === 'undefined') return;\n const payload = {\n data: list.items,\n cursor: { next: list.next },\n nextPage: list.next,\n source: source.type,\n sourceValue: source.value,\n };\n whenSallaLoaded(\n (sdk) =>\n void sdk\n .onReady()\n .then(() => sdk.event.dispatch('salla-products-list::products.fetched', payload))\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/sdk-events.ts"],"names":[],"mappings":";;;;;AA6BO,SAAS,oBAAA,GAA6B;AAC3C,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AAEnC,EAAA,MAAM,QAAQ,MAAA,CAAO,KAAA;AACrB,EAAA,IAAI,CAAC,KAAA,EAAO,KAAA,EAAO,QAAA,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,QAAA,EAAU,IAAA,CAAK,KAAA,CAAM,GAAA,CAAI,CAAC,IAAA,MAAU;AAAA,MAClC,IAAI,IAAA,CAAK,UAAA;AAAA,MACT,cAAc,IAAA,CAAK,EAAA;AAAA,MACnB,MAAM,IAAA,CAAK,YAAA;AAAA,MACX,KAAA,EAAO,QAAA,CAAS,IAAA,CAAK,KAAK,CAAA;AAAA,MAC1B,KAAK,IAAA,CAAK,GAAA;AAAA,MACV,WAAW,IAAA,CAAK,aAAA;AAAA,MAChB,MAAA,EAAQ,KAAK,MAAA,IAAU,MAAA;AAAA,MACvB,UAAU,IAAA,CAAK;AAAA,KACjB,CAAE;AAAA,GACJ;AACA,EAAA,eAAA;AAAA,IACE,CAAC,GAAA,KAAQ,KAAK,GAAA,CAAI,SAAQ,CAAE,IAAA,CAAK,MAAM,GAAA,CAAI,MAAM,QAAA,CAAS,aAAA,EAAe,CAAC,OAAO,CAAC,CAAC;AAAA,GACrF;AACF;AAcO,SAAS,uBAAA,CACd,MACA,MAAA,EACM;AACN,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,EAAA,MAAM,OAAA,GAAU;AAAA,IACd,MAAM,IAAA,CAAK,KAAA;AAAA,IACX,MAAA,EAAQ,EAAE,IAAA,EAAM,IAAA,CAAK,IAAA,EAAK;AAAA,IAC1B,UAAU,IAAA,CAAK,IAAA;AAAA,IACf,QAAQ,MAAA,CAAO,IAAA;AAAA,IACf,aAAa,MAAA,CAAO;AAAA,GACtB;AACA,EAAA,eAAA;AAAA,IACE,CAAC,GAAA,KACC,KAAK,GAAA,CACF,OAAA,EAAQ,CACR,IAAA,CAAK,MAAM,GAAA,CAAI,KAAA,CAAM,QAAA,CAAS,uCAAA,EAAyC,OAAO,CAAC;AAAA,GACtF;AACF","file":"chunk-PZP3372I.js","sourcesContent":["import { getTwilightContext } from '../twilight/context';\nimport type { PageContext } from '../twilight/context';\nimport type { Cart, Money, Product } from '../types';\nimport { getActiveCurrency } from '../api/client';\nimport { whenSallaLoaded } from './sdk-helpers';\n\n/**\n * Payload dispatched via `salla.event.dispatch('route::changed', payload)`\n * after each client-side navigation completes.\n *\n * The page config fields are spread at root level. When the matched route\n * has no page data (e.g., 404, error boundary), an empty object is dispatched.\n *\n * @example\n * ```ts\n * salla.event.on('route::changed', (page: RouteChangedEvent) => {\n * console.log(page.slug, page.title, page.id);\n * });\n * ```\n */\nexport type RouteChangedEvent = PageContext;\n\n/**\n * Dispatch the `route::changed` Salla SDK event with the current page config.\n *\n * Framework-agnostic — reads from the twilight context store which is\n * populated by whichever framework adapter is active (TanStack, Next.js, etc.).\n * Each adapter should call this after navigation resolves.\n */\nexport function dispatchRouteChanged(): void {\n if (typeof window === 'undefined') return;\n\n const salla = window.salla;\n if (!salla?.event?.dispatch) return;\n\n const ctx = getTwilightContext();\n salla.event.dispatch('route::changed', ctx.page ?? {});\n}\n\n/**\n * Dispatch `Product Viewed`, which Twig's product page hands the SDK through `salla.init`'s\n * `events`: store analytics, pixels and apps that remember viewed products listen for it.\n */\nexport function dispatchProductViewed(product: Product): void {\n if (typeof window === 'undefined') return;\n const price = Number(product.price) || 0;\n const image = product.image?.url ?? '';\n const payload = {\n id: product.id,\n name: product.name,\n categories: product.category ? [{ id: product.category.id, name: product.category.name }] : [],\n category: product.category?.name ?? '',\n price,\n quantity: 1,\n variant: '',\n brand: product.brand?.name ?? '',\n image,\n currency: getActiveCurrency(product.currency),\n sku: product.sku ?? '',\n value: price,\n url: product.url,\n image_url: image,\n };\n // After init: analytics drops events until `salla.init` has merged the store's `jitsu` list.\n whenSallaLoaded(\n (sdk) => void sdk.onReady().then(() => sdk.event.dispatch('Product Viewed', [payload]))\n );\n}\n\n/**\n * Report a page view after a client-side navigation. Twig loads every page, and the SDK's\n * analytics reports one view on ready; a React navigation loads nothing, so the store's\n * analytics saw the first page only, and every later event carried that page's context.\n *\n * `referrer` is the page navigated from: `document.referrer` still names the page before the\n * first one.\n */\nexport function dispatchPageViewed(referrer: string): void {\n if (typeof window === 'undefined') return;\n const page = getTwilightContext().page;\n if (!page) return;\n const payload = analyticsPage(page);\n whenSallaLoaded(\n (sdk) => void sdk.onReady().then(() => sdk.analytics?.page?.({ ...payload, referrer }))\n );\n}\n\nconst analyticsPage = (page: PageContext) => ({ name: page.slug ?? '', id: String(page.id ?? '') });\n\n/** Point the analytics `page` context at a page navigated to, before its own events go out. */\nexport function setAnalyticsPage(page: PageContext): void {\n if (typeof window === 'undefined') return;\n const context = analyticsPage(page);\n whenSallaLoaded(\n (sdk) => void sdk.onReady().then(() => sdk.analytics?.setContext?.('page', context))\n );\n}\n\nconst amountOf = (price: number | Money | undefined): number =>\n typeof price === 'object' ? Number(price.amount) || 0 : Number(price) || 0;\n\n/**\n * Dispatch `Cart Viewed`, which Twig's cart page hands the SDK through `salla.init`'s `events`.\n * The React cart page loads the cart in the browser, so the engine reports it once it has it.\n */\nexport function dispatchCartViewed(cart: Cart): void {\n if (typeof window === 'undefined') return;\n const payload = {\n cart_id: cart.id,\n products: cart.items.map((item) => ({\n id: item.product_id,\n cart_item_id: item.id,\n name: item.product_name,\n price: amountOf(item.price),\n url: item.url,\n image_url: item.product_image,\n coupon: cart.coupon ?? undefined,\n quantity: item.quantity,\n })),\n };\n whenSallaLoaded(\n (sdk) => void sdk.onReady().then(() => sdk.event.dispatch('Cart Viewed', [payload]))\n );\n}\n\n/** A page of a product listing, as `product.list` returns it. */\nexport interface ProductsFetched {\n items: Product[];\n /** The API's next-page URL: it carries the sort and any `filters[...]` the page was fetched with. */\n next: string | null;\n}\n\n/**\n * Emit `salla-products-list::products.fetched` for a page of a product listing, as Twig's\n * `<salla-products-list>` does on each page it fetches. The store's analytics maps it to\n * `Product List Viewed`, or `Product List Filtered` when the page was fetched with filters.\n */\nexport function dispatchProductsFetched(\n list: ProductsFetched,\n source: { type: string; value?: string }\n): void {\n if (typeof window === 'undefined') return;\n const payload = {\n data: list.items,\n cursor: { next: list.next },\n nextPage: list.next,\n source: source.type,\n sourceValue: source.value,\n };\n whenSallaLoaded(\n (sdk) =>\n void sdk\n .onReady()\n .then(() => sdk.event.dispatch('salla-products-list::products.fetched', payload))\n );\n}\n"]}
@@ -1,8 +1,8 @@
1
- import { order } from './chunk-ISW7G4IX.js';
2
- import { buildHreflangAlternates } from './chunk-MGG4XAJ5.js';
3
- import { unauthorized, orUnauthorized, orThrow } from './chunk-4UGJ4VC3.js';
1
+ import { order } from './chunk-VJA4DVVT.js';
2
+ import { buildHreflangAlternates } from './chunk-P2PPBXHD.js';
3
+ import { unauthorized, orUnauthorized, orThrow } from './chunk-O3XMYDNC.js';
4
4
  import { RouteId } from './chunk-OUW6WESU.js';
5
- import { getAuthToken } from './chunk-WJJOFIBJ.js';
5
+ import { getAuthToken } from './chunk-RB7RHMKJ.js';
6
6
  import { getTwilightContext } from './chunk-6K34BCUP.js';
7
7
  import { lazyComponent } from './chunk-VYGA5AT5.js';
8
8
 
@@ -56,10 +56,10 @@ async function orderSingleLoader({
56
56
 
57
57
  // src/routes/account/orders/index.tsx
58
58
  var LazyOrdersPage = lazyComponent(
59
- () => import('./OrdersPage-6RPTMFAL.js').then((m) => ({ default: m.OrdersPage }))
59
+ () => import('./OrdersPage-S4ECYNGI.js').then((m) => ({ default: m.OrdersPage }))
60
60
  );
61
61
  var LazyOrderSinglePage = lazyComponent(
62
- () => import('./OrderSinglePage-EPOX5KJG.js').then((m) => ({ default: m.OrderSinglePage }))
62
+ () => import('./OrderSinglePage-3RQ5TJDB.js').then((m) => ({ default: m.OrderSinglePage }))
63
63
  );
64
64
  var OrdersPage = LazyOrdersPage;
65
65
  var OrderSinglePage = LazyOrderSinglePage;
@@ -106,5 +106,5 @@ var OrderSingle = {
106
106
  };
107
107
 
108
108
  export { OrderSingle, OrderSinglePage, Orders, OrdersPage, orderSingleLoader, ordersLoader };
109
- //# sourceMappingURL=chunk-TQEQECN7.js.map
110
- //# sourceMappingURL=chunk-TQEQECN7.js.map
109
+ //# sourceMappingURL=chunk-Q7Z76F7N.js.map
110
+ //# sourceMappingURL=chunk-Q7Z76F7N.js.map