@salla.sa/twilight-theme-engine 1.0.178 → 1.0.180

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 (324) hide show
  1. package/dist/{AddToCartForm-KN67K7AQ.js → AddToCartForm-OZGZROUJ.js} +3 -3
  2. package/dist/{AddToCartForm-KN67K7AQ.js.map → AddToCartForm-OZGZROUJ.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-E74LKVMH.js → BlogAuthorPage-Y4PJPT7L.js} +30 -29
  4. package/dist/BlogAuthorPage-Y4PJPT7L.js.map +1 -0
  5. package/dist/{BlogCategoryPage-77QEH2VO.js → BlogCategoryPage-4J335KY4.js} +30 -29
  6. package/dist/BlogCategoryPage-4J335KY4.js.map +1 -0
  7. package/dist/{BlogPage-2XST3XR2.js → BlogPage-MUIHZYXB.js} +28 -27
  8. package/dist/BlogPage-MUIHZYXB.js.map +1 -0
  9. package/dist/{BlogSinglePage-4ML5A2OB.js → BlogSinglePage-4JOY3UVT.js} +28 -27
  10. package/dist/BlogSinglePage-4JOY3UVT.js.map +1 -0
  11. package/dist/{BlogTagPage-7XP4FXK6.js → BlogTagPage-M7ZQFHUT.js} +30 -29
  12. package/dist/BlogTagPage-M7ZQFHUT.js.map +1 -0
  13. package/dist/{BrandsPage-YKYYYVDU.js → BrandsPage-BC4BMJG4.js} +29 -28
  14. package/dist/BrandsPage-BC4BMJG4.js.map +1 -0
  15. package/dist/{Breadcrumb-FNWRNQ24.js → Breadcrumb-V2URFP4B.js} +28 -27
  16. package/dist/Breadcrumb-V2URFP4B.js.map +1 -0
  17. package/dist/{CartItem-WHBZF4JF.js → CartItem-3AMNNBOL.js} +28 -27
  18. package/dist/CartItem-3AMNNBOL.js.map +1 -0
  19. package/dist/{CartSummary-Z4AC2L2X.js → CartSummary-KSVVKDUG.js} +28 -27
  20. package/dist/CartSummary-KSVVKDUG.js.map +1 -0
  21. package/dist/{Copyright-P3W6UZVC.js → Copyright-NUPXDALZ.js} +3 -3
  22. package/dist/{Copyright-P3W6UZVC.js.map → Copyright-NUPXDALZ.js.map} +1 -1
  23. package/dist/{CustomerLayout-RB44K7JV.js → CustomerLayout-R3L5PIOS.js} +28 -27
  24. package/dist/CustomerLayout-R3L5PIOS.js.map +1 -0
  25. package/dist/{Footer-RMNHNTZM.js → Footer-KMBA7SPY.js} +3 -3
  26. package/dist/{Footer-RMNHNTZM.js.map → Footer-KMBA7SPY.js.map} +1 -1
  27. package/dist/GoogleTag-NWYDC6WD.js +15 -0
  28. package/dist/{GoogleTag-IBUOI4BU.js.map → GoogleTag-NWYDC6WD.js.map} +1 -1
  29. package/dist/Header-2XH6SHUO.js +25 -0
  30. package/dist/{Header-3W742LRD.js.map → Header-2XH6SHUO.js.map} +1 -1
  31. package/dist/{LatestProducts-QFRDI7TQ.js → LatestProducts-57JGQJVN.js} +30 -29
  32. package/dist/LatestProducts-57JGQJVN.js.map +1 -0
  33. package/dist/{LoyaltyPage-N5D5Q3NL.js → LoyaltyPage-WPQ34KLX.js} +28 -27
  34. package/dist/LoyaltyPage-WPQ34KLX.js.map +1 -0
  35. package/dist/{LoyaltyPointsPage-G3XGE4HT.js → LoyaltyPointsPage-RSSXJM6I.js} +9 -9
  36. package/dist/{LoyaltyPointsPage-G3XGE4HT.js.map → LoyaltyPointsPage-RSSXJM6I.js.map} +1 -1
  37. package/dist/{MainMenu-4GUU2NAF.js → MainMenu-LB3XL25D.js} +8 -8
  38. package/dist/{MainMenu-4GUU2NAF.js.map → MainMenu-LB3XL25D.js.map} +1 -1
  39. package/dist/MaintenancePage-BNI7DUIN.js +7 -0
  40. package/dist/{MaintenancePage-3YUQXVN2.js.map → MaintenancePage-BNI7DUIN.js.map} +1 -1
  41. package/dist/{MasterLayout-BJA7J6RF.js → MasterLayout-KGUQ4N2G.js} +28 -27
  42. package/dist/{MasterLayout-BJA7J6RF.js.map → MasterLayout-KGUQ4N2G.js.map} +1 -1
  43. package/dist/{MobileMenu-ORFZ7IKI.js → MobileMenu-ZAFU2ZN6.js} +29 -28
  44. package/dist/MobileMenu-ZAFU2ZN6.js.map +1 -0
  45. package/dist/{NotificationsPage-2S4PT63V.js → NotificationsPage-D7ZTDST7.js} +28 -27
  46. package/dist/NotificationsPage-D7ZTDST7.js.map +1 -0
  47. package/dist/{OrderSinglePage-3VW6TSFJ.js → OrderSinglePage-FT5NO5M4.js} +29 -28
  48. package/dist/OrderSinglePage-FT5NO5M4.js.map +1 -0
  49. package/dist/{OrdersPage-26MUU5J7.js → OrdersPage-CHH2UX5S.js} +28 -27
  50. package/dist/OrdersPage-CHH2UX5S.js.map +1 -0
  51. package/dist/{PageSingle-5BBSPDMH.js → PageSingle-5ZX3FUBB.js} +7 -7
  52. package/dist/{PageSingle-5BBSPDMH.js.map → PageSingle-5ZX3FUBB.js.map} +1 -1
  53. package/dist/{ProductDetails-E7OGZJ3G.js → ProductDetails-6HTLTQBT.js} +8 -8
  54. package/dist/{ProductDetails-E7OGZJ3G.js.map → ProductDetails-6HTLTQBT.js.map} +1 -1
  55. package/dist/{ProfilePage-KKHEJCAF.js → ProfilePage-2YWL4JWQ.js} +28 -27
  56. package/dist/ProfilePage-2YWL4JWQ.js.map +1 -0
  57. package/dist/{ReviewsPage-364PK4XM.js → ReviewsPage-ADWCW5P6.js} +3 -3
  58. package/dist/{ReviewsPage-364PK4XM.js.map → ReviewsPage-ADWCW5P6.js.map} +1 -1
  59. package/dist/{SeoCartWidget-GLTV6C4J.js → SeoCartWidget-FFZXG7GS.js} +28 -27
  60. package/dist/SeoCartWidget-FFZXG7GS.js.map +1 -0
  61. package/dist/{SettingsPage-A2H4WKQ3.js → SettingsPage-O5E4SCHB.js} +28 -27
  62. package/dist/SettingsPage-O5E4SCHB.js.map +1 -0
  63. package/dist/{StoreClosedNotification-QAMEUZQD.js → StoreClosedNotification-4HPWJKWS.js} +29 -28
  64. package/dist/{StoreClosedNotification-QAMEUZQD.js.map → StoreClosedNotification-4HPWJKWS.js.map} +1 -1
  65. package/dist/{TestimonialsPage-2UH35ZXG.js → TestimonialsPage-YAXINHYG.js} +7 -7
  66. package/dist/{TestimonialsPage-2UH35ZXG.js.map → TestimonialsPage-YAXINHYG.js.map} +1 -1
  67. package/dist/{ThankYouPage-2LUGL65U.js → ThankYouPage-DCQZVYIA.js} +28 -27
  68. package/dist/ThankYouPage-DCQZVYIA.js.map +1 -0
  69. package/dist/{WalletPage-WNZP37OM.js → WalletPage-NPBCYOBS.js} +29 -28
  70. package/dist/WalletPage-NPBCYOBS.js.map +1 -0
  71. package/dist/{WebMcpTools-F663L3R7.js → WebMcpTools-VNHKJNI7.js} +10 -10
  72. package/dist/{WebMcpTools-F663L3R7.js.map → WebMcpTools-VNHKJNI7.js.map} +1 -1
  73. package/dist/{WishlistPage-4G4B5ZE5.js → WishlistPage-ISSKWME2.js} +30 -29
  74. package/dist/WishlistPage-ISSKWME2.js.map +1 -0
  75. package/dist/api/advertisement.js +5 -5
  76. package/dist/api/apps.js +5 -5
  77. package/dist/api/blog.js +7 -7
  78. package/dist/api/brands.js +7 -7
  79. package/dist/api/cart.d.ts +11 -5
  80. package/dist/api/cart.d.ts.map +1 -1
  81. package/dist/api/cart.js +7 -7
  82. package/dist/api/category.js +7 -7
  83. package/dist/api/client.d.ts.map +1 -1
  84. package/dist/api/client.js +4 -4
  85. package/dist/api/custom-url.js +5 -5
  86. package/dist/api/home.js +5 -5
  87. package/dist/api/loyalty.js +7 -7
  88. package/dist/api/menu.js +5 -5
  89. package/dist/api/notification.js +5 -5
  90. package/dist/api/order.js +7 -7
  91. package/dist/api/page.js +7 -7
  92. package/dist/api/product.js +7 -7
  93. package/dist/api/profile.js +4 -4
  94. package/dist/api/sdk-cart.d.ts +9 -0
  95. package/dist/api/sdk-cart.d.ts.map +1 -0
  96. package/dist/api/store.d.ts.map +1 -1
  97. package/dist/api/store.js +6 -6
  98. package/dist/api/translations.js +5 -5
  99. package/dist/api/user.js +5 -5
  100. package/dist/api/wallet.js +5 -5
  101. package/dist/api/wishlist.js +8 -8
  102. package/dist/{chunk-VLL4GO7G.js → chunk-4OZIBANF.js} +3 -3
  103. package/dist/{chunk-VLL4GO7G.js.map → chunk-4OZIBANF.js.map} +1 -1
  104. package/dist/{chunk-2QQSSJKZ.js → chunk-5MUY4AUU.js} +70 -32
  105. package/dist/chunk-5MUY4AUU.js.map +1 -0
  106. package/dist/{chunk-HJZJTZD6.js → chunk-5ZVKOLFZ.js} +9 -9
  107. package/dist/{chunk-HJZJTZD6.js.map → chunk-5ZVKOLFZ.js.map} +1 -1
  108. package/dist/{chunk-7JNZQKJ3.js → chunk-64BWBCE7.js} +3 -3
  109. package/dist/{chunk-7JNZQKJ3.js.map → chunk-64BWBCE7.js.map} +1 -1
  110. package/dist/{chunk-AODCG7WZ.js → chunk-6MTG5HRF.js} +4 -4
  111. package/dist/{chunk-AODCG7WZ.js.map → chunk-6MTG5HRF.js.map} +1 -1
  112. package/dist/{chunk-N7SDFCJG.js → chunk-6UUBYWC4.js} +5 -5
  113. package/dist/{chunk-N7SDFCJG.js.map → chunk-6UUBYWC4.js.map} +1 -1
  114. package/dist/chunk-AWOMNZIJ.js +104 -0
  115. package/dist/chunk-AWOMNZIJ.js.map +1 -0
  116. package/dist/{chunk-6AK5XDNZ.js → chunk-AXX7A2JJ.js} +3 -3
  117. package/dist/{chunk-6AK5XDNZ.js.map → chunk-AXX7A2JJ.js.map} +1 -1
  118. package/dist/{chunk-BFSGYXFL.js → chunk-AY2XD3S2.js} +7 -7
  119. package/dist/{chunk-BFSGYXFL.js.map → chunk-AY2XD3S2.js.map} +1 -1
  120. package/dist/{chunk-4MKA22LE.js → chunk-BSWV7U3V.js} +9 -9
  121. package/dist/{chunk-4MKA22LE.js.map → chunk-BSWV7U3V.js.map} +1 -1
  122. package/dist/{chunk-AWANNFME.js → chunk-BTQ2SAMS.js} +6 -6
  123. package/dist/{chunk-AWANNFME.js.map → chunk-BTQ2SAMS.js.map} +1 -1
  124. package/dist/{chunk-YF72DLML.js → chunk-BYA4ZF7E.js} +3 -3
  125. package/dist/{chunk-YF72DLML.js.map → chunk-BYA4ZF7E.js.map} +1 -1
  126. package/dist/{chunk-H73VXFYO.js → chunk-BZ2QSBXM.js} +3 -3
  127. package/dist/{chunk-H73VXFYO.js.map → chunk-BZ2QSBXM.js.map} +1 -1
  128. package/dist/{chunk-PCPERWKJ.js → chunk-CB473WUX.js} +4 -4
  129. package/dist/{chunk-PCPERWKJ.js.map → chunk-CB473WUX.js.map} +1 -1
  130. package/dist/{chunk-KBOBADKK.js → chunk-CRXXKAFW.js} +5 -5
  131. package/dist/{chunk-KBOBADKK.js.map → chunk-CRXXKAFW.js.map} +1 -1
  132. package/dist/{chunk-THFF2FSI.js → chunk-D4ACJS2K.js} +3 -3
  133. package/dist/{chunk-THFF2FSI.js.map → chunk-D4ACJS2K.js.map} +1 -1
  134. package/dist/{chunk-Z3DFIJCE.js → chunk-DASAKSKN.js} +4 -4
  135. package/dist/{chunk-Z3DFIJCE.js.map → chunk-DASAKSKN.js.map} +1 -1
  136. package/dist/{chunk-2AF6PXGC.js → chunk-DCDWTP6S.js} +5 -5
  137. package/dist/{chunk-2AF6PXGC.js.map → chunk-DCDWTP6S.js.map} +1 -1
  138. package/dist/{chunk-NM4KWMCR.js → chunk-DPB47XO7.js} +5 -5
  139. package/dist/{chunk-NM4KWMCR.js.map → chunk-DPB47XO7.js.map} +1 -1
  140. package/dist/{chunk-EEI5I5PL.js → chunk-DVJGKIFQ.js} +3 -3
  141. package/dist/{chunk-EEI5I5PL.js.map → chunk-DVJGKIFQ.js.map} +1 -1
  142. package/dist/{chunk-C7WEJHTK.js → chunk-EOZAJ6SP.js} +9 -9
  143. package/dist/{chunk-C7WEJHTK.js.map → chunk-EOZAJ6SP.js.map} +1 -1
  144. package/dist/{chunk-7WJ5YLUV.js → chunk-F6MAM7HZ.js} +8 -8
  145. package/dist/{chunk-7WJ5YLUV.js.map → chunk-F6MAM7HZ.js.map} +1 -1
  146. package/dist/{chunk-JFAYJBLJ.js → chunk-H22ABA6K.js} +4 -4
  147. package/dist/{chunk-JFAYJBLJ.js.map → chunk-H22ABA6K.js.map} +1 -1
  148. package/dist/{chunk-UTP3UKCB.js → chunk-HHAR2YJN.js} +3 -3
  149. package/dist/{chunk-UTP3UKCB.js.map → chunk-HHAR2YJN.js.map} +1 -1
  150. package/dist/{chunk-5P477R4M.js → chunk-I7LWEJDL.js} +4 -4
  151. package/dist/{chunk-5P477R4M.js.map → chunk-I7LWEJDL.js.map} +1 -1
  152. package/dist/{chunk-VV5MI7CL.js → chunk-IAVHDEMZ.js} +4 -4
  153. package/dist/{chunk-VV5MI7CL.js.map → chunk-IAVHDEMZ.js.map} +1 -1
  154. package/dist/{chunk-QNWO52KK.js → chunk-IHHJGUI3.js} +5 -5
  155. package/dist/{chunk-QNWO52KK.js.map → chunk-IHHJGUI3.js.map} +1 -1
  156. package/dist/{chunk-4R5DOFG3.js → chunk-K6AQYYJR.js} +22 -8
  157. package/dist/chunk-K6AQYYJR.js.map +1 -0
  158. package/dist/{chunk-4DPJCTO3.js → chunk-KAQV2WZ6.js} +3 -3
  159. package/dist/{chunk-4DPJCTO3.js.map → chunk-KAQV2WZ6.js.map} +1 -1
  160. package/dist/{chunk-VDTDYLVU.js → chunk-M4GK6JZO.js} +5 -5
  161. package/dist/{chunk-VDTDYLVU.js.map → chunk-M4GK6JZO.js.map} +1 -1
  162. package/dist/{chunk-PLD6KSYE.js → chunk-MWUAHDQL.js} +17 -4
  163. package/dist/chunk-MWUAHDQL.js.map +1 -0
  164. package/dist/{chunk-JCYX7HXB.js → chunk-MZPX4EPS.js} +4 -4
  165. package/dist/{chunk-JCYX7HXB.js.map → chunk-MZPX4EPS.js.map} +1 -1
  166. package/dist/{chunk-UBIFYEHW.js → chunk-NQXXID34.js} +4 -4
  167. package/dist/{chunk-UBIFYEHW.js.map → chunk-NQXXID34.js.map} +1 -1
  168. package/dist/{chunk-VXF7HAHK.js → chunk-O6KQRFTR.js} +19 -19
  169. package/dist/{chunk-VXF7HAHK.js.map → chunk-O6KQRFTR.js.map} +1 -1
  170. package/dist/{chunk-4EQ2XUD2.js → chunk-O7JTXTGP.js} +3 -3
  171. package/dist/{chunk-4EQ2XUD2.js.map → chunk-O7JTXTGP.js.map} +1 -1
  172. package/dist/{chunk-VCPCJ55V.js → chunk-OAH2JE3U.js} +4 -4
  173. package/dist/{chunk-VCPCJ55V.js.map → chunk-OAH2JE3U.js.map} +1 -1
  174. package/dist/{chunk-ZO56PBTD.js → chunk-OP7DHR4L.js} +4 -4
  175. package/dist/{chunk-ZO56PBTD.js.map → chunk-OP7DHR4L.js.map} +1 -1
  176. package/dist/{chunk-7TAKJT7L.js → chunk-OU6DYIG5.js} +3 -3
  177. package/dist/{chunk-7TAKJT7L.js.map → chunk-OU6DYIG5.js.map} +1 -1
  178. package/dist/{chunk-QHYIQLJ7.js → chunk-P6FREDWL.js} +4 -4
  179. package/dist/{chunk-QHYIQLJ7.js.map → chunk-P6FREDWL.js.map} +1 -1
  180. package/dist/{chunk-CACGTFUX.js → chunk-PFUDIAWY.js} +4 -4
  181. package/dist/{chunk-CACGTFUX.js.map → chunk-PFUDIAWY.js.map} +1 -1
  182. package/dist/{chunk-TARGBVMN.js → chunk-PGX4SXVF.js} +3 -3
  183. package/dist/{chunk-TARGBVMN.js.map → chunk-PGX4SXVF.js.map} +1 -1
  184. package/dist/{chunk-VPBV2BQV.js → chunk-QJOTD2GJ.js} +3 -3
  185. package/dist/{chunk-VPBV2BQV.js.map → chunk-QJOTD2GJ.js.map} +1 -1
  186. package/dist/{chunk-7XSTKJK7.js → chunk-QPRU3PVD.js} +7 -7
  187. package/dist/{chunk-7XSTKJK7.js.map → chunk-QPRU3PVD.js.map} +1 -1
  188. package/dist/{chunk-2NT6SBRT.js → chunk-QRG7YWRL.js} +3 -3
  189. package/dist/{chunk-2NT6SBRT.js.map → chunk-QRG7YWRL.js.map} +1 -1
  190. package/dist/{chunk-NGA74AJ3.js → chunk-RKSWLLP7.js} +5 -5
  191. package/dist/{chunk-NGA74AJ3.js.map → chunk-RKSWLLP7.js.map} +1 -1
  192. package/dist/{chunk-DQKUMGEK.js → chunk-TUM4ABEA.js} +7 -7
  193. package/dist/{chunk-DQKUMGEK.js.map → chunk-TUM4ABEA.js.map} +1 -1
  194. package/dist/{chunk-XV2KLAYG.js → chunk-UA6LTD55.js} +5 -5
  195. package/dist/{chunk-XV2KLAYG.js.map → chunk-UA6LTD55.js.map} +1 -1
  196. package/dist/{chunk-PPTHMKKL.js → chunk-UAPBMOOV.js} +3 -3
  197. package/dist/{chunk-PPTHMKKL.js.map → chunk-UAPBMOOV.js.map} +1 -1
  198. package/dist/{chunk-MOF4DY5N.js → chunk-UD4NGJML.js} +4 -4
  199. package/dist/{chunk-MOF4DY5N.js.map → chunk-UD4NGJML.js.map} +1 -1
  200. package/dist/{chunk-2I4H5BQU.js → chunk-UYY5FXLW.js} +4 -4
  201. package/dist/{chunk-2I4H5BQU.js.map → chunk-UYY5FXLW.js.map} +1 -1
  202. package/dist/{chunk-E36SKXG2.js → chunk-VXTPMEFC.js} +3 -3
  203. package/dist/{chunk-E36SKXG2.js.map → chunk-VXTPMEFC.js.map} +1 -1
  204. package/dist/{chunk-RLZUJSEZ.js → chunk-VY2TPXFO.js} +3 -3
  205. package/dist/{chunk-RLZUJSEZ.js.map → chunk-VY2TPXFO.js.map} +1 -1
  206. package/dist/{chunk-ENXFWV3Z.js → chunk-WHNF7WBH.js} +4 -4
  207. package/dist/{chunk-ENXFWV3Z.js.map → chunk-WHNF7WBH.js.map} +1 -1
  208. package/dist/{chunk-VZ5EMKBD.js → chunk-WLRNZYCA.js} +6 -6
  209. package/dist/{chunk-VZ5EMKBD.js.map → chunk-WLRNZYCA.js.map} +1 -1
  210. package/dist/{chunk-G5VJKMKU.js → chunk-X4VIKIQM.js} +5 -5
  211. package/dist/{chunk-G5VJKMKU.js.map → chunk-X4VIKIQM.js.map} +1 -1
  212. package/dist/{chunk-WACEL34M.js → chunk-XEGALTQJ.js} +3 -3
  213. package/dist/{chunk-WACEL34M.js.map → chunk-XEGALTQJ.js.map} +1 -1
  214. package/dist/{chunk-7JGHOV3X.js → chunk-YA4O3EZC.js} +7 -7
  215. package/dist/{chunk-7JGHOV3X.js.map → chunk-YA4O3EZC.js.map} +1 -1
  216. package/dist/{chunk-ZMOAJ562.js → chunk-YEVLRCSL.js} +5 -5
  217. package/dist/{chunk-ZMOAJ562.js.map → chunk-YEVLRCSL.js.map} +1 -1
  218. package/dist/{chunk-TPHLHWCB.js → chunk-YZDL6GF7.js} +3 -3
  219. package/dist/{chunk-TPHLHWCB.js.map → chunk-YZDL6GF7.js.map} +1 -1
  220. package/dist/{chunk-BSJBPL3O.js → chunk-Z5LSS25A.js} +4 -4
  221. package/dist/{chunk-BSJBPL3O.js.map → chunk-Z5LSS25A.js.map} +1 -1
  222. package/dist/{chunk-SF46OQ4Z.js → chunk-ZWX33T7S.js} +3 -3
  223. package/dist/{chunk-SF46OQ4Z.js.map → chunk-ZWX33T7S.js.map} +1 -1
  224. package/dist/components/cart/index.js +1 -1
  225. package/dist/components/common/index.js +1 -1
  226. package/dist/components/drawer/index.js +26 -25
  227. package/dist/components/home/index.js +31 -30
  228. package/dist/components/layout/index.js +7 -7
  229. package/dist/components/product/index.js +28 -27
  230. package/dist/components/store/index.js +28 -27
  231. package/dist/components/toast/index.js +5 -5
  232. package/dist/components/tracking/index.js +10 -10
  233. package/dist/custom-urls-SNKCSUFH.js +17 -0
  234. package/dist/{custom-urls-OV5L65QA.js.map → custom-urls-SNKCSUFH.js.map} +1 -1
  235. package/dist/dev/editor/index.js +3 -3
  236. package/dist/dev/index.js +3 -3
  237. package/dist/document-class-GMZDY55X.js +39 -0
  238. package/dist/{document-class-VJN4AHON.js.map → document-class-GMZDY55X.js.map} +1 -1
  239. package/dist/hooks/index.js +26 -25
  240. package/dist/hooks/useComments.js +4 -4
  241. package/dist/hooks/useGtm.js +26 -25
  242. package/dist/hooks/useMoney.js +26 -25
  243. package/dist/hooks/useProduct.js +4 -4
  244. package/dist/hooks/useStore.js +26 -25
  245. package/dist/hooks/useUser.js +6 -6
  246. package/dist/hooks/useWishlist.js +4 -4
  247. package/dist/index.js +26 -25
  248. package/dist/index.js.map +1 -1
  249. package/dist/native-app/index.js +4 -4
  250. package/dist/{navigation-LZ6YYSKB.js → navigation-MEWHF2SI.js} +8 -8
  251. package/dist/{navigation-LZ6YYSKB.js.map → navigation-MEWHF2SI.js.map} +1 -1
  252. package/dist/navigation-PVCAQHKP.js +15 -0
  253. package/dist/{navigation-DZCTOUGV.js.map → navigation-PVCAQHKP.js.map} +1 -1
  254. package/dist/{not-found-LM3CWGPG.js → not-found-AWSO6GKQ.js} +29 -28
  255. package/dist/not-found-AWSO6GKQ.js.map +1 -0
  256. package/dist/providers/TwilightProvider.d.ts.map +1 -1
  257. package/dist/providers/index.js +26 -25
  258. package/dist/providers/stale-cart.d.ts +11 -0
  259. package/dist/providers/stale-cart.d.ts.map +1 -0
  260. package/dist/routes/account/orders.js +9 -9
  261. package/dist/routes/account.js +18 -18
  262. package/dist/routes/blog.js +13 -13
  263. package/dist/routes/brands.js +9 -9
  264. package/dist/routes/cart/CartPage.d.ts.map +1 -1
  265. package/dist/routes/cart.js +38 -37
  266. package/dist/routes/cart.js.map +1 -1
  267. package/dist/routes/home.js +32 -31
  268. package/dist/routes/index.js +13 -13
  269. package/dist/routes/loyalty.js +10 -10
  270. package/dist/routes/page.js +9 -9
  271. package/dist/routes/product-listing.js +36 -35
  272. package/dist/routes/product-listing.js.map +1 -1
  273. package/dist/routes/product.js +35 -34
  274. package/dist/routes/product.js.map +1 -1
  275. package/dist/routes/seo-redirects.js +13 -13
  276. package/dist/routes/testimonials.js +5 -5
  277. package/dist/routes/thank-you.js +9 -9
  278. package/dist/skeleton.js +32 -31
  279. package/dist/{store-lookup-535R3FGU.js → store-lookup-GPDB2LWO.js} +12 -12
  280. package/dist/{store-lookup-535R3FGU.js.map → store-lookup-GPDB2LWO.js.map} +1 -1
  281. package/dist/tanstack.js +27 -27
  282. package/dist/twilight/context.d.ts +8 -0
  283. package/dist/twilight/context.d.ts.map +1 -1
  284. package/dist/types/salla-sdk.d.ts +4 -1
  285. package/dist/types/salla-sdk.d.ts.map +1 -1
  286. package/dist/utils/baseHead.js +3 -3
  287. package/dist/utils/index.js +7 -7
  288. package/dist/vite/index.js +5 -5
  289. package/package.json +1 -1
  290. package/tailwind/routes/cart/CartPage.tsx.txt +5 -3
  291. package/dist/BlogAuthorPage-E74LKVMH.js.map +0 -1
  292. package/dist/BlogCategoryPage-77QEH2VO.js.map +0 -1
  293. package/dist/BlogPage-2XST3XR2.js.map +0 -1
  294. package/dist/BlogSinglePage-4ML5A2OB.js.map +0 -1
  295. package/dist/BlogTagPage-7XP4FXK6.js.map +0 -1
  296. package/dist/BrandsPage-YKYYYVDU.js.map +0 -1
  297. package/dist/Breadcrumb-FNWRNQ24.js.map +0 -1
  298. package/dist/CartItem-WHBZF4JF.js.map +0 -1
  299. package/dist/CartSummary-Z4AC2L2X.js.map +0 -1
  300. package/dist/CustomerLayout-RB44K7JV.js.map +0 -1
  301. package/dist/GoogleTag-IBUOI4BU.js +0 -15
  302. package/dist/Header-3W742LRD.js +0 -25
  303. package/dist/LatestProducts-QFRDI7TQ.js.map +0 -1
  304. package/dist/LoyaltyPage-N5D5Q3NL.js.map +0 -1
  305. package/dist/MaintenancePage-3YUQXVN2.js +0 -7
  306. package/dist/MobileMenu-ORFZ7IKI.js.map +0 -1
  307. package/dist/NotificationsPage-2S4PT63V.js.map +0 -1
  308. package/dist/OrderSinglePage-3VW6TSFJ.js.map +0 -1
  309. package/dist/OrdersPage-26MUU5J7.js.map +0 -1
  310. package/dist/ProfilePage-KKHEJCAF.js.map +0 -1
  311. package/dist/SeoCartWidget-GLTV6C4J.js.map +0 -1
  312. package/dist/SettingsPage-A2H4WKQ3.js.map +0 -1
  313. package/dist/ThankYouPage-2LUGL65U.js.map +0 -1
  314. package/dist/WalletPage-WNZP37OM.js.map +0 -1
  315. package/dist/WishlistPage-4G4B5ZE5.js.map +0 -1
  316. package/dist/chunk-2QQSSJKZ.js.map +0 -1
  317. package/dist/chunk-4R5DOFG3.js.map +0 -1
  318. package/dist/chunk-PLD6KSYE.js.map +0 -1
  319. package/dist/chunk-WN573HB3.js +0 -48
  320. package/dist/chunk-WN573HB3.js.map +0 -1
  321. package/dist/custom-urls-OV5L65QA.js +0 -17
  322. package/dist/document-class-VJN4AHON.js +0 -39
  323. package/dist/navigation-DZCTOUGV.js +0 -15
  324. package/dist/not-found-LM3CWGPG.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/api-base.ts","../src/utils/engine-version.ts","../src/api/dev-settings-cache.ts","../src/api/client.ts"],"names":["entry","createIsomorphicFn","getCookie"],"mappings":";;;;;;;;;AAWO,IAAM,eAAA,GAAkB;AAG/B,IAAM,aAAA,GAAgB,SAAA;AAQf,SAAS,qBAAA,CACd,QACA,WAAA,EACe;AACf,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,WAAA,EAAa,OAAO,IAAA;AACpC,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,IAAA,EAAM,CAAA;AAAA,EAC7B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,IAAI,GAAA,CAAI,QAAA,KAAa,QAAA,EAAU,OAAO,IAAA;AACtC,EAAA,IAAI,IAAI,IAAA,CAAK,WAAA,OAAkB,WAAA,CAAY,WAAA,IAAe,OAAO,IAAA;AACjE,EAAA,IAAI,GAAA,CAAI,YAAY,GAAA,CAAI,QAAA,IAAY,IAAI,MAAA,IAAU,GAAA,CAAI,MAAM,OAAO,IAAA;AACnE,EAAA,IAAI,IAAI,QAAA,CAAS,OAAA,CAAQ,QAAQ,EAAE,CAAA,KAAM,eAAe,OAAO,IAAA;AAC/D,EAAA,OAAO,CAAA,EAAG,GAAA,CAA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EAChC,MAAA,EAAQ,iCAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAC","file":"chunk-4MKA22LE.js","sourcesContent":["/**\n * The header the storefront dispatcher names the Store API base in, on the\n * storefronts that must not call production: the beta storefront and its per-PR\n * previews (`web.beta.salla.group`, `web-<hash>.beta.salla.group`). There the\n * Store serves the storefront API under its own address, `https://<host>/api/v1`.\n *\n * Trusted for the same reason `x-salla-store-base` is: the dispatcher sets it\n * after dropping everything off its allowlist, so a visitor's copy never arrives.\n * It is still checked against the request's own host, so even a forged one could\n * only point the theme back at the storefront it is already serving.\n */\nexport const API_BASE_HEADER = 'x-salla-api-base';\n\n/** The one path the dispatcher names: the Store's storefront API under its own host. */\nconst API_BASE_PATH = '/api/v1';\n\n/**\n * The API base this request was told to use, or null for the build's default.\n *\n * Accepted only as `https://<the request's own host>/api/v1` (a trailing slash\n * allowed), with no credentials, query or fragment; returned without the slash.\n */\nexport function resolveRequestApiBase(\n header: string | null | undefined,\n requestHost: string | null\n): string | null {\n if (!header || !requestHost) return null;\n let url: URL;\n try {\n url = new URL(header.trim());\n } catch {\n return null;\n }\n if (url.protocol !== 'https:') return null;\n if (url.host.toLowerCase() !== requestHost.toLowerCase()) return null;\n if (url.username || url.password || url.search || url.hash) return null;\n if (url.pathname.replace(/\\/+$/, '') !== API_BASE_PATH) return null;\n return `${url.origin}${API_BASE_PATH}`;\n}\n\n/**\n * `url` moved from one API base to another: `https://api.salla.dev/store/v1/cart/1`\n * under `https://web.beta.salla.group/api/v1` is `https://web.beta.salla.group/api/v1/cart/1`.\n * Null when `url` is not under `from`, which leaves the request as it was.\n */\nexport function rebaseApiUrl(url: string, from: string, to: string): string | null {\n const base = from.replace(/\\/+$/, '');\n if (url !== base && !url.startsWith(`${base}/`) && !url.startsWith(`${base}?`)) return null;\n return to.replace(/\\/+$/, '') + url.slice(base.length);\n}\n","/**\n * The engine's own build version, injected by tsup `define` when dist is\n * built. Falls back to 'dev' when the source runs unbundled (vitest, direct\n * src imports in the monorepo).\n *\n * Exposed at runtime as `salla.versions.engine` by `useTwilightInit` so a\n * storefront can always be asked which engine build rendered it.\n */\nexport const ENGINE_VERSION: string =\n typeof __TWILIGHT_ENGINE_VERSION__ !== 'undefined' ? __TWILIGHT_ENGINE_VERSION__ : 'dev';\n","import type { AfterResponseHook, BeforeRequestHook } from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { DEV_SETTINGS_REFRESH_COOKIE } from '../utils/dev-settings-refresh';\n\n/**\n * A dev server reuses a store's settings for up to an hour.\n *\n * Every server render asks the API for `store/settings`, and a developer clicking\n * around a theme renders dozens of pages a minute. The API answers a burst of\n * settings requests for one store from one address with a challenge, which a\n * server-side fetch cannot pass, so the dev server rendered \"Store Unavailable\"\n * (6.05k challenged `(development; ssr)` calls in the 7 days to 2026-10-25). In\n * development, on the server, the same request within {@link DEV_SETTINGS_TTL_MS}\n * is answered from memory instead. An hour because the API counts settings\n * requests per hour, so one fetch an hour can never reach its limit; the theme\n * editor's \"Fetch fresh store data\" fetches sooner, and says how old the settings\n * are. A production build never runs it: `import.meta.env.DEV` is statically\n * false there.\n */\nexport const DEV_SETTINGS_TTL_MS = 60 * 60_000;\n\n/** Marks an answer from memory, so the store step does not file it again. */\nconst HIT_HEADER = 'x-twilight-dev-cache';\n\n/** When the answer was really fetched from the API (epoch ms), on fresh answers and reused ones alike. */\nconst FETCHED_AT_HEADER = 'x-twilight-dev-fetched-at';\n\n/**\n * When the dev server fetched these settings from the API, read off the answer the\n * cache handed back; `undefined` when the cache did not handle the call (a\n * production build, the browser, a test), so nothing new reaches the settings there.\n */\nexport function devSettingsFetchedAt(headers: Headers | undefined): number | undefined {\n const at = Number(headers?.get(FETCHED_AT_HEADER));\n return Number.isFinite(at) && at > 0 ? at : undefined;\n}\n\n/**\n * Not carried over to an answer from memory: the body is stored decoded, so its\n * original encoding and length no longer describe it.\n */\nconst DROPPED_HEADERS = new Set(['content-encoding', 'content-length']);\n\ninterface Entry {\n body: string;\n status: number;\n statusText: string;\n headers: [string, string][];\n fetchedAt: number;\n /** The refresh cookie's value when this answer was fetched. */\n refresh: string | null;\n}\n\nexport interface DevSettingsCacheOptions {\n /** Whether this call may use the cache at all. */\n enabled: () => boolean;\n /** The current value of {@link DEV_SETTINGS_REFRESH_COOKIE}, or null. */\n refreshToken: () => string | null;\n now?: () => number;\n ttlMs?: number;\n /** Called the first time an answer comes from memory. */\n onFirstHit?: () => void;\n}\n\nfunction isSettingsRequest(request: Request): boolean {\n if (request.method !== 'GET') return false;\n try {\n return new URL(request.url).pathname.endsWith('/store/settings');\n } catch {\n return false;\n }\n}\n\n/**\n * An answer `requestSettings` accepts: JSON carrying `data`. A 200 without it is\n * refused there as \"Store Unavailable\"; kept here, it would be refused for the next\n * hour too, after the API had recovered.\n */\nfunction hasSettings(body: string): boolean {\n try {\n return Boolean((JSON.parse(body) as { data?: unknown } | null)?.data);\n } catch {\n return false;\n }\n}\n\n/**\n * The request as the API receives it: method, URL and every header the client's\n * hooks set. Keyed on the request itself rather than on the inputs that build it,\n * so a header added to the client later cannot be missing from the key.\n */\nfunction keyOf(request: Request): string {\n const headers = [...request.headers].map(([name, value]) => `${name}: ${value}`).join('\\n');\n return `${request.method} ${request.url}\\n${headers}`;\n}\n\n/**\n * The two ky hooks behind the cache: `lookup` runs last among `beforeRequest`, once\n * every header is set, and `store` among `afterResponse`. Only an answer with\n * settings in it is kept, so a timeout, a 429, a challenge or an empty 200 is asked\n * again on the next render.\n */\nexport function createDevSettingsCache(options: DevSettingsCacheOptions) {\n const {\n enabled,\n refreshToken,\n now = Date.now,\n ttlMs = DEV_SETTINGS_TTL_MS,\n onFirstHit,\n } = options;\n const entries = new Map<string, Entry>();\n let announced = false;\n\n const isFresh = (entry: Entry): boolean =>\n now() - entry.fetchedAt < ttlMs && entry.refresh === refreshToken();\n\n const answerOf = (entry: Entry, hit: boolean): Response => {\n const headers = new Headers(entry.headers);\n headers.set(FETCHED_AT_HEADER, String(entry.fetchedAt));\n if (hit) headers.set(HIT_HEADER, 'hit');\n return new Response(entry.body, {\n status: entry.status,\n statusText: entry.statusText,\n headers,\n });\n };\n\n const lookup: BeforeRequestHook = ({ request }) => {\n if (!enabled() || !isSettingsRequest(request)) return;\n const key = keyOf(request);\n const entry = entries.get(key);\n if (!entry) return;\n if (!isFresh(entry)) {\n entries.delete(key);\n return;\n }\n if (!announced) {\n announced = true;\n onFirstHit?.();\n }\n return answerOf(entry, true);\n };\n\n const store: AfterResponseHook = async ({ request, response }) => {\n if (!enabled() || !isSettingsRequest(request) || !response.ok) return;\n if (response.headers.has(HIT_HEADER)) return;\n // ky hands each hook a clone, so reading it leaves the answer it returns intact.\n const body = await response.text();\n if (!hasSettings(body)) return;\n for (const [key, entry] of entries) {\n if (now() - entry.fetchedAt >= ttlMs) entries.delete(key);\n }\n const entry: Entry = {\n body,\n status: response.status,\n statusText: response.statusText,\n headers: [...response.headers].filter(([name]) => !DROPPED_HEADERS.has(name)),\n fetchedAt: now(),\n refresh: refreshToken(),\n };\n entries.set(keyOf(request), entry);\n // Handed on in place of the API's own answer, so it carries its fetch time too.\n return answerOf(entry, false);\n };\n\n return { lookup, store, clear: () => entries.clear() };\n}\n\nconst readRefreshCookie = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(DEV_SETTINGS_REFRESH_COOKIE) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\nexport const devSettingsCache = createDevSettingsCache({\n // A dev server's render only. A production build has `DEV` statically false,\n // the browser keeps the settings it was handed in its query cache, and vitest\n // runs in `test` mode, where every test wants the request it mocked.\n enabled: () =>\n import.meta.env.DEV && import.meta.env.MODE !== 'test' && typeof document === 'undefined',\n refreshToken: readRefreshCookie,\n onFirstHit: () =>\n console.warn(\n `[twilight] Store settings are reused for up to ${DEV_SETTINGS_TTL_MS / 60_000} minutes while you develop, to stay under the Salla API's rate limit. To see a change you made in the dashboard, press \"Fetch fresh store data\" in the theme editor's side panel: it also says when they were last fetched.`\n ),\n});\n","import ky from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { getStoreIdentifier } from '../utils/sdk-helpers';\nimport { requestedDraftThemeName, resolveThemeVersionId } from '../utils/theme-version';\nimport { getInjectedRuntimeEnv, readEnv } from '../utils/runtime-env';\nimport { getRequestStore, getTwilightContext } from '../twilight/context';\nimport { rebaseApiUrl } from '../utils/api-base';\nimport { ENGINE_VERSION } from '../utils/engine-version';\nimport { devSettingsCache } from './dev-settings-cache';\nimport {\n AUTH_TOKEN_COOKIE_NAME,\n CURRENCY_COOKIE_NAME,\n extractCurrencyFromCookies,\n extractScopeFromCookies,\n toCurrencyCode,\n extractTokenFromCookies,\n readSdkScope,\n type ActiveScope,\n} from '../utils/cookies';\n\n// The twilight module store doesn't reliably carry authToken into every scope: on the\n// SERVER workerd has no AsyncLocalStorage, and on BOTH sides this api client can live in a\n// different module instance than the one rootBeforeLoad populates (engine subpath import vs\n// engine-internal relative import). So `getTwilightContext().authToken` is often null even\n// for logged-in users → API calls (orders/customer/…) return `token_not_provided` (400).\n// Read the token directly from the request cookie (server) or document.cookie / salla.storage\n// (client) as a fallback. The server-only import is stripped from the client bundle by\n// createIsomorphicFn.\nconst readFallbackToken = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(AUTH_TOKEN_COOKIE_NAME) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => {\n const fromCookie =\n typeof document !== 'undefined'\n ? extractTokenFromCookies(document.cookie, AUTH_TOKEN_COOKIE_NAME)\n : null;\n if (fromCookie) return fromCookie;\n const storage = typeof window !== 'undefined' ? window.salla?.storage : undefined;\n const fromStorage =\n typeof storage?.get === 'function' ? storage.get(AUTH_TOKEN_COOKIE_NAME) : null;\n if (typeof fromStorage === 'string' && fromStorage) return fromStorage;\n // `?token=` webview injection lands only on the SDK's axios instance\n const fromSdkApi = typeof window !== 'undefined' ? window.salla?.api?.token : undefined;\n return typeof fromSdkApi === 'string' && fromSdkApi ? fromSdkApi : null;\n });\n\n/**\n * The auth token as the api client sees it: twilight context first, cookie/storage fallback.\n * Use this (not `getTwilightContext().authToken`, which is often null for logged-in users —\n * see the note above) to decide whether an authenticated-only query should run.\n */\nexport const getAuthToken = (): string | null =>\n getTwilightContext().authToken ?? readFallbackToken();\n\nconst readRequestCurrency = createIsomorphicFn()\n .server((): string | null => {\n try {\n return toCurrencyCode(getCookie(CURRENCY_COOKIE_NAME));\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\n/**\n * The currency the visitor chose, from the `s-curr` cookie the SDK writes: the API\n * answers in the store's own currency unless the request names one.\n */\nexport function getActiveCurrency(): string | null;\nexport function getActiveCurrency(fallback: string): string;\nexport function getActiveCurrency(fallback: string | null = null): string | null {\n const chosen =\n typeof document !== 'undefined'\n ? extractCurrencyFromCookies(document.cookie)\n : readRequestCurrency();\n return chosen ?? fallback;\n}\n\nconst API_HEADERS = {\n ACCEPT: 'accept',\n ACCEPT_LANGUAGE: 'accept-language',\n APP_OS: 's-app-os',\n APP_VERSION: 's-app-version',\n RAY: 's-ray',\n SOURCE: 's-source',\n THEME_TYPE: 's-theme-type',\n REQUESTED_WITH: 'x-requested-with',\n CF_PROXY_WHITELIST: 's-cf-proxy-whitelist-id',\n STORE_IDENTIFIER: 'store-identifier',\n CURRENCY: 'currency',\n AUTHORIZATION: 'Authorization',\n VERSION_ID: 's-version-id',\n THEME_NAME: 's-theme-name',\n SCOPE_ID: 's-scope-id',\n SCOPE_TYPE: 's-scope-type',\n SCOPE_ALLOCATION_TYPE: 's-scope-allocation-type',\n SCOPE_ALLOCATION_ID: 's-scope-allocation-id',\n USER_AGENT: 'user-agent',\n} as const;\n\n/**\n * The header every Salla API call is answered by store.\n *\n * Exported because a caller that already knows which store it is asking about\n * must be able to say so on the request itself — see `store.settings`. Without\n * it the only way to name a store is the ambient resolver, and \"the identifier\n * I checked\" and \"the identifier that was sent\" become two different things.\n */\nexport const STORE_IDENTIFIER_HEADER = API_HEADERS.STORE_IDENTIFIER;\n\n/**\n * Active scope: the market plus its branch allocation, as the SDK stores it. On the\n * client it comes from `salla.storage.get('scope')`; before the SDK hydrates storage\n * it falls back to the `scope` cookie the theme mirrors that selection into (see\n * writeScopeCookie), then to the scope twilightMiddleware seeded from the same\n * cookie on the server. Requests vary by the `s-scope-*` headers, so React Query\n * keys must include this to avoid serving another branch's cached categories/products.\n *\n * The cookie step matters for hydration: the SDK is not guaranteed to have\n * populated `salla.storage` by the time the client rebuilds a dehydrated query\n * key, and without it the client would compute null against a scoped SSR key.\n */\nexport const getActiveScope = (): ActiveScope | null => {\n // `!== undefined`, not `!= null`: a null here is the SDK authoritatively saying \"no branch\n // selected\", which must beat a cookie left over from the previous selection. Only a\n // not-yet-ready storage API (undefined) falls through to the cookie.\n const fromStorage = readSdkScope();\n if (fromStorage !== undefined) return fromStorage;\n\n if (typeof document !== 'undefined') {\n const fromCookie = extractScopeFromCookies(document.cookie);\n if (fromCookie != null) return fromCookie;\n }\n\n try {\n return getTwilightContext().scope;\n } catch {\n return null;\n }\n};\n\n/** {@link getActiveScope} reduced to the market id. */\nexport const getActiveScopeId = (): string | null => getActiveScope()?.id ?? null;\n\n// No `s-store-api-version`: a Cloudflare rule on api.salla.dev adds it to the paths the\n// Swoole pool serves. Sent from here, it put every call there, `cart/{id}` among them.\nconst sharedHeaders = (locale: string) => ({\n [API_HEADERS.ACCEPT]: 'application/json' as const,\n [API_HEADERS.ACCEPT_LANGUAGE]: locale,\n [API_HEADERS.APP_OS]: 'browser',\n [API_HEADERS.APP_VERSION]: '2.14.363',\n [API_HEADERS.RAY]: '50',\n [API_HEADERS.SOURCE]: 'twilight',\n [API_HEADERS.THEME_TYPE]: 'react',\n [API_HEADERS.REQUESTED_WITH]: 'XMLHttpRequest',\n [API_HEADERS.CF_PROXY_WHITELIST]: '019a2f78-a64c-7edb-proxy-whitelist-id-9a3a-17afda90f03a',\n});\n\n/**\n * Who a server-rendered call says it is.\n *\n * Every theme worker reaches api.salla.dev from Cloudflare's one Workers address, so\n * salla.dev's per-IP rate limits counted every React store as a single client and\n * refused the calls each page makes (`store/settings` among them: \"Store Unavailable\").\n * The zone skips rate limiting for a User-Agent shaped `Salla-<Name>/<N.N.N> (<env>; <meta>)`\n * from Cloudflare's or AWS's networks, the convention Salla's other services already send.\n *\n * Built from fixed parts: the zone's pattern takes only digits and dots for the version,\n * so a prerelease suffix is dropped, and an unbundled engine (`dev`) reads as `0.0.0`.\n */\nconst SERVER_USER_AGENT = `Salla-TwilightReact/${\n /^\\d+(?:\\.\\d+)*/.exec(ENGINE_VERSION)?.[0] ?? '0.0.0'\n} (${import.meta.env.DEV ? 'development' : 'production'}; ssr)`;\n\n/**\n * Store API base. `VITE_API_URL` override points a preview at a branch backend; unset → prod\n * `api.salla.dev`. Resolution order matters: the value the SSR worker resolved (published into\n * the head, since worker `vars` are server-only `process.env` and never reach the browser\n * bundle) wins, so the hydrated client keeps talking to the backend that rendered the page.\n */\n\nconst STORE_API_BASE =\n getInjectedRuntimeEnv().apiBase || readEnv('VITE_API_URL') || 'https://api.salla.dev/store/v1';\n\n/**\n * Moves a call onto the API base this request was told to use, when it has one.\n *\n * `STORE_API_BASE` is read once per isolate, and one theme worker serves every\n * storefront the dispatcher sends it: production, and the beta and PR preview\n * storefronts (`web[-<hash>].beta.salla.group`), whose Store API is on their own\n * host (`x-salla-api-base`, see `utils/api-base.ts`). So SSR rebases each call per\n * request. In the browser the request store is empty and `STORE_API_BASE` is\n * already the published per-page value, so this does nothing there.\n *\n * After every hook that sets a header, so the request it copies carries them all.\n * It runs only where the dispatcher named a base (beta), and the dev settings cache\n * after it only in a dev build, which never gets that header.\n */\nfunction toRequestApiBase({ request }: { request: Request }): Request | undefined {\n const { apiBase } = getRequestStore();\n if (!apiBase || apiBase === STORE_API_BASE) return undefined;\n const url = rebaseApiUrl(request.url, STORE_API_BASE, apiBase);\n return url ? new Request(url, request) : undefined;\n}\n\nexport const api = ky.extend({\n prefix: STORE_API_BASE,\n timeout: 8000,\n hooks: {\n beforeRequest: [\n ({ request }) => {\n const { locale, authToken } = getTwilightContext();\n const headers = sharedHeaders(locale);\n for (const [key, value] of Object.entries(headers)) {\n request.headers.set(key, value);\n }\n // Only when the caller did not say. `headers.set` here would otherwise\n // overwrite a per-request identifier with the ambient one, which is a\n // silent way to answer a question about one store with another's data.\n if (!request.headers.get(API_HEADERS.STORE_IDENTIFIER)) {\n request.headers.set(API_HEADERS.STORE_IDENTIFIER, getStoreIdentifier());\n }\n\n // Server only. A browser call comes from the shopper's own address and is\n // counted against it, which is what the zone's limits are for.\n if (typeof document === 'undefined') {\n request.headers.set(API_HEADERS.USER_AGENT, SERVER_USER_AGENT);\n }\n\n const scope = getActiveScope();\n\n // The version the request asked for, else the one the settings named for\n // this scope. Absent means \"whatever is live\", which is what an ordinary\n // storefront visit wants — so a null is left off rather than sent empty.\n const versionId = resolveThemeVersionId(scope?.id ?? null);\n if (versionId) {\n request.headers.set(API_HEADERS.VERSION_ID, versionId);\n }\n\n // The draft theme a preview renders, by the name the Store knows drafts\n // by. Without it the Store answers the draft's version as the store's own\n // theme, and checks the draft's components against that one. Absent on\n // every other call, so an ordinary storefront request is unchanged.\n const draftThemeName = requestedDraftThemeName();\n if (draftThemeName) {\n request.headers.set(API_HEADERS.THEME_NAME, draftThemeName);\n }\n\n const currency = getActiveCurrency();\n if (currency) request.headers.set(API_HEADERS.CURRENCY, currency);\n\n const token = authToken ?? readFallbackToken();\n if (token) {\n request.headers.set(API_HEADERS.AUTHORIZATION, `Bearer ${token}`);\n }\n\n // The same four the SDK's own client sends. The API resolves stock per\n // allocation: id alone asks about the market, not the branch the shopper chose.\n if (scope) {\n request.headers.set(API_HEADERS.SCOPE_ID, scope.id);\n if (scope.type) request.headers.set(API_HEADERS.SCOPE_TYPE, scope.type);\n if (scope.allocation_type)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_TYPE, scope.allocation_type);\n if (scope.allocation_id)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_ID, scope.allocation_id);\n }\n },\n toRequestApiBase,\n // Last, so it keys on the request with every header above set.\n devSettingsCache.lookup,\n ],\n afterResponse: [devSettingsCache.store],\n },\n});\n\nexport const cdn = ky.extend({\n prefix: 'https://cdn.salla.network',\n timeout: 5000,\n});\n\n/**\n * The merchant uploader's public bucket, `admin-uploader-prod`.\n *\n * A different host from {@link cdn} and a different thing behind it: this one\n * is an R2 custom domain, so a read never passes through a worker. Storefront\n * translations live here, per language, under `translations/` — see\n * `api/translations.ts`.\n */\nexport const filesCdn = ky.extend({\n prefix: 'https://cdn.files.salla.network',\n timeout: 5000,\n});\n"]}
1
+ {"version":3,"sources":["../src/utils/api-base.ts","../src/utils/engine-version.ts","../src/api/dev-settings-cache.ts","../src/api/client.ts"],"names":["entry","createIsomorphicFn","getCookie"],"mappings":";;;;;;;;;AAWO,IAAM,eAAA,GAAkB;AAG/B,IAAM,aAAA,GAAgB,SAAA;AAQf,SAAS,qBAAA,CACd,QACA,WAAA,EACe;AACf,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,WAAA,EAAa,OAAO,IAAA;AACpC,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,IAAA,EAAM,CAAA;AAAA,EAC7B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,IAAI,GAAA,CAAI,QAAA,KAAa,QAAA,EAAU,OAAO,IAAA;AACtC,EAAA,IAAI,IAAI,IAAA,CAAK,WAAA,OAAkB,WAAA,CAAY,WAAA,IAAe,OAAO,IAAA;AACjE,EAAA,IAAI,GAAA,CAAI,YAAY,GAAA,CAAI,QAAA,IAAY,IAAI,MAAA,IAAU,GAAA,CAAI,MAAM,OAAO,IAAA;AACnE,EAAA,IAAI,IAAI,QAAA,CAAS,OAAA,CAAQ,QAAQ,EAAE,CAAA,KAAM,eAA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,CAAC;AAUM,IAAM,QAAA,GAAW,GAAG,MAAA,CAAO;AAAA,EAChC,MAAA,EAAQ,iCAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAC","file":"chunk-BSWV7U3V.js","sourcesContent":["/**\n * The header the storefront dispatcher names the Store API base in, on the\n * storefronts that must not call production: the beta storefront and its per-PR\n * previews (`web.beta.salla.group`, `web-<hash>.beta.salla.group`). There the\n * Store serves the storefront API under its own address, `https://<host>/api/v1`.\n *\n * Trusted for the same reason `x-salla-store-base` is: the dispatcher sets it\n * after dropping everything off its allowlist, so a visitor's copy never arrives.\n * It is still checked against the request's own host, so even a forged one could\n * only point the theme back at the storefront it is already serving.\n */\nexport const API_BASE_HEADER = 'x-salla-api-base';\n\n/** The one path the dispatcher names: the Store's storefront API under its own host. */\nconst API_BASE_PATH = '/api/v1';\n\n/**\n * The API base this request was told to use, or null for the build's default.\n *\n * Accepted only as `https://<the request's own host>/api/v1` (a trailing slash\n * allowed), with no credentials, query or fragment; returned without the slash.\n */\nexport function resolveRequestApiBase(\n header: string | null | undefined,\n requestHost: string | null\n): string | null {\n if (!header || !requestHost) return null;\n let url: URL;\n try {\n url = new URL(header.trim());\n } catch {\n return null;\n }\n if (url.protocol !== 'https:') return null;\n if (url.host.toLowerCase() !== requestHost.toLowerCase()) return null;\n if (url.username || url.password || url.search || url.hash) return null;\n if (url.pathname.replace(/\\/+$/, '') !== API_BASE_PATH) return null;\n return `${url.origin}${API_BASE_PATH}`;\n}\n\n/**\n * `url` moved from one API base to another: `https://api.salla.dev/store/v1/cart/1`\n * under `https://web.beta.salla.group/api/v1` is `https://web.beta.salla.group/api/v1/cart/1`.\n * Null when `url` is not under `from`, which leaves the request as it was.\n */\nexport function rebaseApiUrl(url: string, from: string, to: string): string | null {\n const base = from.replace(/\\/+$/, '');\n if (url !== base && !url.startsWith(`${base}/`) && !url.startsWith(`${base}?`)) return null;\n return to.replace(/\\/+$/, '') + url.slice(base.length);\n}\n","/**\n * The engine's own build version, injected by tsup `define` when dist is\n * built. Falls back to 'dev' when the source runs unbundled (vitest, direct\n * src imports in the monorepo).\n *\n * Exposed at runtime as `salla.versions.engine` by `useTwilightInit` so a\n * storefront can always be asked which engine build rendered it.\n */\nexport const ENGINE_VERSION: string =\n typeof __TWILIGHT_ENGINE_VERSION__ !== 'undefined' ? __TWILIGHT_ENGINE_VERSION__ : 'dev';\n","import type { AfterResponseHook, BeforeRequestHook } from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { DEV_SETTINGS_REFRESH_COOKIE } from '../utils/dev-settings-refresh';\n\n/**\n * A dev server reuses a store's settings for up to an hour.\n *\n * Every server render asks the API for `store/settings`, and a developer clicking\n * around a theme renders dozens of pages a minute. The API answers a burst of\n * settings requests for one store from one address with a challenge, which a\n * server-side fetch cannot pass, so the dev server rendered \"Store Unavailable\"\n * (6.05k challenged `(development; ssr)` calls in the 7 days to 2026-10-25). In\n * development, on the server, the same request within {@link DEV_SETTINGS_TTL_MS}\n * is answered from memory instead. An hour because the API counts settings\n * requests per hour, so one fetch an hour can never reach its limit; the theme\n * editor's \"Fetch fresh store data\" fetches sooner, and says how old the settings\n * are. A production build never runs it: `import.meta.env.DEV` is statically\n * false there.\n */\nexport const DEV_SETTINGS_TTL_MS = 60 * 60_000;\n\n/** Marks an answer from memory, so the store step does not file it again. */\nconst HIT_HEADER = 'x-twilight-dev-cache';\n\n/** When the answer was really fetched from the API (epoch ms), on fresh answers and reused ones alike. */\nconst FETCHED_AT_HEADER = 'x-twilight-dev-fetched-at';\n\n/**\n * When the dev server fetched these settings from the API, read off the answer the\n * cache handed back; `undefined` when the cache did not handle the call (a\n * production build, the browser, a test), so nothing new reaches the settings there.\n */\nexport function devSettingsFetchedAt(headers: Headers | undefined): number | undefined {\n const at = Number(headers?.get(FETCHED_AT_HEADER));\n return Number.isFinite(at) && at > 0 ? at : undefined;\n}\n\n/**\n * Not carried over to an answer from memory: the body is stored decoded, so its\n * original encoding and length no longer describe it.\n */\nconst DROPPED_HEADERS = new Set(['content-encoding', 'content-length']);\n\ninterface Entry {\n body: string;\n status: number;\n statusText: string;\n headers: [string, string][];\n fetchedAt: number;\n /** The refresh cookie's value when this answer was fetched. */\n refresh: string | null;\n}\n\nexport interface DevSettingsCacheOptions {\n /** Whether this call may use the cache at all. */\n enabled: () => boolean;\n /** The current value of {@link DEV_SETTINGS_REFRESH_COOKIE}, or null. */\n refreshToken: () => string | null;\n now?: () => number;\n ttlMs?: number;\n /** Called the first time an answer comes from memory. */\n onFirstHit?: () => void;\n}\n\nfunction isSettingsRequest(request: Request): boolean {\n if (request.method !== 'GET') return false;\n try {\n return new URL(request.url).pathname.endsWith('/store/settings');\n } catch {\n return false;\n }\n}\n\n/**\n * An answer `requestSettings` accepts: JSON carrying `data`. A 200 without it is\n * refused there as \"Store Unavailable\"; kept here, it would be refused for the next\n * hour too, after the API had recovered.\n */\nfunction hasSettings(body: string): boolean {\n try {\n return Boolean((JSON.parse(body) as { data?: unknown } | null)?.data);\n } catch {\n return false;\n }\n}\n\n/**\n * The request as the API receives it: method, URL and every header the client's\n * hooks set. Keyed on the request itself rather than on the inputs that build it,\n * so a header added to the client later cannot be missing from the key.\n */\nfunction keyOf(request: Request): string {\n const headers = [...request.headers].map(([name, value]) => `${name}: ${value}`).join('\\n');\n return `${request.method} ${request.url}\\n${headers}`;\n}\n\n/**\n * The two ky hooks behind the cache: `lookup` runs last among `beforeRequest`, once\n * every header is set, and `store` among `afterResponse`. Only an answer with\n * settings in it is kept, so a timeout, a 429, a challenge or an empty 200 is asked\n * again on the next render.\n */\nexport function createDevSettingsCache(options: DevSettingsCacheOptions) {\n const {\n enabled,\n refreshToken,\n now = Date.now,\n ttlMs = DEV_SETTINGS_TTL_MS,\n onFirstHit,\n } = options;\n const entries = new Map<string, Entry>();\n let announced = false;\n\n const isFresh = (entry: Entry): boolean =>\n now() - entry.fetchedAt < ttlMs && entry.refresh === refreshToken();\n\n const answerOf = (entry: Entry, hit: boolean): Response => {\n const headers = new Headers(entry.headers);\n headers.set(FETCHED_AT_HEADER, String(entry.fetchedAt));\n if (hit) headers.set(HIT_HEADER, 'hit');\n return new Response(entry.body, {\n status: entry.status,\n statusText: entry.statusText,\n headers,\n });\n };\n\n const lookup: BeforeRequestHook = ({ request }) => {\n if (!enabled() || !isSettingsRequest(request)) return;\n const key = keyOf(request);\n const entry = entries.get(key);\n if (!entry) return;\n if (!isFresh(entry)) {\n entries.delete(key);\n return;\n }\n if (!announced) {\n announced = true;\n onFirstHit?.();\n }\n return answerOf(entry, true);\n };\n\n const store: AfterResponseHook = async ({ request, response }) => {\n if (!enabled() || !isSettingsRequest(request) || !response.ok) return;\n if (response.headers.has(HIT_HEADER)) return;\n // ky hands each hook a clone, so reading it leaves the answer it returns intact.\n const body = await response.text();\n if (!hasSettings(body)) return;\n for (const [key, entry] of entries) {\n if (now() - entry.fetchedAt >= ttlMs) entries.delete(key);\n }\n const entry: Entry = {\n body,\n status: response.status,\n statusText: response.statusText,\n headers: [...response.headers].filter(([name]) => !DROPPED_HEADERS.has(name)),\n fetchedAt: now(),\n refresh: refreshToken(),\n };\n entries.set(keyOf(request), entry);\n // Handed on in place of the API's own answer, so it carries its fetch time too.\n return answerOf(entry, false);\n };\n\n return { lookup, store, clear: () => entries.clear() };\n}\n\nconst readRefreshCookie = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(DEV_SETTINGS_REFRESH_COOKIE) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\nexport const devSettingsCache = createDevSettingsCache({\n // A dev server's render only. A production build has `DEV` statically false,\n // the browser keeps the settings it was handed in its query cache, and vitest\n // runs in `test` mode, where every test wants the request it mocked.\n enabled: () =>\n import.meta.env.DEV && import.meta.env.MODE !== 'test' && typeof document === 'undefined',\n refreshToken: readRefreshCookie,\n onFirstHit: () =>\n console.warn(\n `[twilight] Store settings are reused for up to ${DEV_SETTINGS_TTL_MS / 60_000} minutes while you develop, to stay under the Salla API's rate limit. To see a change you made in the dashboard, press \"Fetch fresh store data\" in the theme editor's side panel: it also says when they were last fetched.`\n ),\n});\n","import ky from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { getStoreIdentifier } from '../utils/sdk-helpers';\nimport { requestedDraftThemeName, resolveThemeVersionId } from '../utils/theme-version';\nimport { getInjectedRuntimeEnv, readEnv } from '../utils/runtime-env';\nimport { getRequestStore, getTwilightContext, isAuthTokenRevoked } from '../twilight/context';\nimport { rebaseApiUrl } from '../utils/api-base';\nimport { ENGINE_VERSION } from '../utils/engine-version';\nimport { devSettingsCache } from './dev-settings-cache';\nimport {\n AUTH_TOKEN_COOKIE_NAME,\n CURRENCY_COOKIE_NAME,\n extractCurrencyFromCookies,\n extractScopeFromCookies,\n toCurrencyCode,\n extractTokenFromCookies,\n readSdkScope,\n type ActiveScope,\n} from '../utils/cookies';\n\n// The twilight module store doesn't reliably carry authToken into every scope: on the\n// SERVER workerd has no AsyncLocalStorage, and on BOTH sides this api client can live in a\n// different module instance than the one rootBeforeLoad populates (engine subpath import vs\n// engine-internal relative import). So `getTwilightContext().authToken` is often null even\n// for logged-in users → API calls (orders/customer/…) return `token_not_provided` (400).\n// Read the token directly from the request cookie (server) or document.cookie / salla.storage\n// (client) as a fallback. The server-only import is stripped from the client bundle by\n// createIsomorphicFn.\nconst readFallbackToken = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(AUTH_TOKEN_COOKIE_NAME) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => {\n const fromCookie =\n typeof document !== 'undefined'\n ? extractTokenFromCookies(document.cookie, AUTH_TOKEN_COOKIE_NAME)\n : null;\n if (fromCookie) return fromCookie;\n const storage = typeof window !== 'undefined' ? window.salla?.storage : undefined;\n const fromStorage =\n typeof storage?.get === 'function' ? storage.get(AUTH_TOKEN_COOKIE_NAME) : null;\n if (typeof fromStorage === 'string' && fromStorage) return fromStorage;\n // `?token=` webview injection lands only on the SDK's axios instance\n const fromSdkApi = typeof window !== 'undefined' ? window.salla?.api?.token : undefined;\n return typeof fromSdkApi === 'string' && fromSdkApi ? fromSdkApi : null;\n });\n\n/**\n * The auth token as the api client sees it: twilight context first, cookie/storage fallback.\n * Use this (not `getTwilightContext().authToken`, which is often null for logged-in users —\n * see the note above) to decide whether an authenticated-only query should run.\n */\nexport const getAuthToken = (): string | null =>\n isAuthTokenRevoked() ? null : (getTwilightContext().authToken ?? readFallbackToken());\n\nconst readRequestCurrency = createIsomorphicFn()\n .server((): string | null => {\n try {\n return toCurrencyCode(getCookie(CURRENCY_COOKIE_NAME));\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\n/**\n * The currency the visitor chose, from the `s-curr` cookie the SDK writes: the API\n * answers in the store's own currency unless the request names one.\n */\nexport function getActiveCurrency(): string | null;\nexport function getActiveCurrency(fallback: string): string;\nexport function getActiveCurrency(fallback: string | null = null): string | null {\n const chosen =\n typeof document !== 'undefined'\n ? extractCurrencyFromCookies(document.cookie)\n : readRequestCurrency();\n return chosen ?? fallback;\n}\n\nconst API_HEADERS = {\n ACCEPT: 'accept',\n ACCEPT_LANGUAGE: 'accept-language',\n APP_OS: 's-app-os',\n APP_VERSION: 's-app-version',\n RAY: 's-ray',\n SOURCE: 's-source',\n THEME_TYPE: 's-theme-type',\n REQUESTED_WITH: 'x-requested-with',\n CF_PROXY_WHITELIST: 's-cf-proxy-whitelist-id',\n STORE_IDENTIFIER: 'store-identifier',\n CURRENCY: 'currency',\n AUTHORIZATION: 'Authorization',\n VERSION_ID: 's-version-id',\n THEME_NAME: 's-theme-name',\n SCOPE_ID: 's-scope-id',\n SCOPE_TYPE: 's-scope-type',\n SCOPE_ALLOCATION_TYPE: 's-scope-allocation-type',\n SCOPE_ALLOCATION_ID: 's-scope-allocation-id',\n USER_AGENT: 'user-agent',\n} as const;\n\n/**\n * The header every Salla API call is answered by store.\n *\n * Exported because a caller that already knows which store it is asking about\n * must be able to say so on the request itself — see `store.settings`. Without\n * it the only way to name a store is the ambient resolver, and \"the identifier\n * I checked\" and \"the identifier that was sent\" become two different things.\n */\nexport const STORE_IDENTIFIER_HEADER = API_HEADERS.STORE_IDENTIFIER;\n\n/**\n * Active scope: the market plus its branch allocation, as the SDK stores it. On the\n * client it comes from `salla.storage.get('scope')`; before the SDK hydrates storage\n * it falls back to the `scope` cookie the theme mirrors that selection into (see\n * writeScopeCookie), then to the scope twilightMiddleware seeded from the same\n * cookie on the server. Requests vary by the `s-scope-*` headers, so React Query\n * keys must include this to avoid serving another branch's cached categories/products.\n *\n * The cookie step matters for hydration: the SDK is not guaranteed to have\n * populated `salla.storage` by the time the client rebuilds a dehydrated query\n * key, and without it the client would compute null against a scoped SSR key.\n */\nexport const getActiveScope = (): ActiveScope | null => {\n // `!== undefined`, not `!= null`: a null here is the SDK authoritatively saying \"no branch\n // selected\", which must beat a cookie left over from the previous selection. Only a\n // not-yet-ready storage API (undefined) falls through to the cookie.\n const fromStorage = readSdkScope();\n if (fromStorage !== undefined) return fromStorage;\n\n if (typeof document !== 'undefined') {\n const fromCookie = extractScopeFromCookies(document.cookie);\n if (fromCookie != null) return fromCookie;\n }\n\n try {\n return getTwilightContext().scope;\n } catch {\n return null;\n }\n};\n\n/** {@link getActiveScope} reduced to the market id. */\nexport const getActiveScopeId = (): string | null => getActiveScope()?.id ?? null;\n\n// No `s-store-api-version`: a Cloudflare rule on api.salla.dev adds it to the paths the\n// Swoole pool serves. Sent from here, it put every call there, `cart/{id}` among them.\nconst sharedHeaders = (locale: string) => ({\n [API_HEADERS.ACCEPT]: 'application/json' as const,\n [API_HEADERS.ACCEPT_LANGUAGE]: locale,\n [API_HEADERS.APP_OS]: 'browser',\n [API_HEADERS.APP_VERSION]: '2.14.363',\n [API_HEADERS.RAY]: '50',\n [API_HEADERS.SOURCE]: 'twilight',\n [API_HEADERS.THEME_TYPE]: 'react',\n [API_HEADERS.REQUESTED_WITH]: 'XMLHttpRequest',\n [API_HEADERS.CF_PROXY_WHITELIST]: '019a2f78-a64c-7edb-proxy-whitelist-id-9a3a-17afda90f03a',\n});\n\n/**\n * Who a server-rendered call says it is.\n *\n * Every theme worker reaches api.salla.dev from Cloudflare's one Workers address, so\n * salla.dev's per-IP rate limits counted every React store as a single client and\n * refused the calls each page makes (`store/settings` among them: \"Store Unavailable\").\n * The zone skips rate limiting for a User-Agent shaped `Salla-<Name>/<N.N.N> (<env>; <meta>)`\n * from Cloudflare's or AWS's networks, the convention Salla's other services already send.\n *\n * Built from fixed parts: the zone's pattern takes only digits and dots for the version,\n * so a prerelease suffix is dropped, and an unbundled engine (`dev`) reads as `0.0.0`.\n */\nconst SERVER_USER_AGENT = `Salla-TwilightReact/${\n /^\\d+(?:\\.\\d+)*/.exec(ENGINE_VERSION)?.[0] ?? '0.0.0'\n} (${import.meta.env.DEV ? 'development' : 'production'}; ssr)`;\n\n/**\n * Store API base. `VITE_API_URL` override points a preview at a branch backend; unset → prod\n * `api.salla.dev`. Resolution order matters: the value the SSR worker resolved (published into\n * the head, since worker `vars` are server-only `process.env` and never reach the browser\n * bundle) wins, so the hydrated client keeps talking to the backend that rendered the page.\n */\n\nconst STORE_API_BASE =\n getInjectedRuntimeEnv().apiBase || readEnv('VITE_API_URL') || 'https://api.salla.dev/store/v1';\n\n/**\n * Moves a call onto the API base this request was told to use, when it has one.\n *\n * `STORE_API_BASE` is read once per isolate, and one theme worker serves every\n * storefront the dispatcher sends it: production, and the beta and PR preview\n * storefronts (`web[-<hash>].beta.salla.group`), whose Store API is on their own\n * host (`x-salla-api-base`, see `utils/api-base.ts`). So SSR rebases each call per\n * request. In the browser the request store is empty and `STORE_API_BASE` is\n * already the published per-page value, so this does nothing there.\n *\n * After every hook that sets a header, so the request it copies carries them all.\n * It runs only where the dispatcher named a base (beta), and the dev settings cache\n * after it only in a dev build, which never gets that header.\n */\nfunction toRequestApiBase({ request }: { request: Request }): Request | undefined {\n const { apiBase } = getRequestStore();\n if (!apiBase || apiBase === STORE_API_BASE) return undefined;\n const url = rebaseApiUrl(request.url, STORE_API_BASE, apiBase);\n return url ? new Request(url, request) : undefined;\n}\n\nexport const api = ky.extend({\n prefix: STORE_API_BASE,\n timeout: 8000,\n hooks: {\n beforeRequest: [\n ({ request }) => {\n const { locale } = getTwilightContext();\n const headers = sharedHeaders(locale);\n for (const [key, value] of Object.entries(headers)) {\n request.headers.set(key, value);\n }\n // Only when the caller did not say. `headers.set` here would otherwise\n // overwrite a per-request identifier with the ambient one, which is a\n // silent way to answer a question about one store with another's data.\n if (!request.headers.get(API_HEADERS.STORE_IDENTIFIER)) {\n request.headers.set(API_HEADERS.STORE_IDENTIFIER, getStoreIdentifier());\n }\n\n // Server only. A browser call comes from the shopper's own address and is\n // counted against it, which is what the zone's limits are for.\n if (typeof document === 'undefined') {\n request.headers.set(API_HEADERS.USER_AGENT, SERVER_USER_AGENT);\n }\n\n const scope = getActiveScope();\n\n // The version the request asked for, else the one the settings named for\n // this scope. Absent means \"whatever is live\", which is what an ordinary\n // storefront visit wants — so a null is left off rather than sent empty.\n const versionId = resolveThemeVersionId(scope?.id ?? null);\n if (versionId) {\n request.headers.set(API_HEADERS.VERSION_ID, versionId);\n }\n\n // The draft theme a preview renders, by the name the Store knows drafts\n // by. Without it the Store answers the draft's version as the store's own\n // theme, and checks the draft's components against that one. Absent on\n // every other call, so an ordinary storefront request is unchanged.\n const draftThemeName = requestedDraftThemeName();\n if (draftThemeName) {\n request.headers.set(API_HEADERS.THEME_NAME, draftThemeName);\n }\n\n const currency = getActiveCurrency();\n if (currency) request.headers.set(API_HEADERS.CURRENCY, currency);\n\n const token = getAuthToken();\n if (token) {\n request.headers.set(API_HEADERS.AUTHORIZATION, `Bearer ${token}`);\n }\n\n // The same four the SDK's own client sends. The API resolves stock per\n // allocation: id alone asks about the market, not the branch the shopper chose.\n if (scope) {\n request.headers.set(API_HEADERS.SCOPE_ID, scope.id);\n if (scope.type) request.headers.set(API_HEADERS.SCOPE_TYPE, scope.type);\n if (scope.allocation_type)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_TYPE, scope.allocation_type);\n if (scope.allocation_id)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_ID, scope.allocation_id);\n }\n },\n toRequestApiBase,\n // Last, so it keys on the request with every header above set.\n devSettingsCache.lookup,\n ],\n afterResponse: [devSettingsCache.store],\n },\n});\n\nexport const cdn = ky.extend({\n prefix: 'https://cdn.salla.network',\n timeout: 5000,\n});\n\n/**\n * The merchant uploader's public bucket, `admin-uploader-prod`.\n *\n * A different host from {@link cdn} and a different thing behind it: this one\n * is an R2 custom domain, so a read never passes through a worker. Storefront\n * translations live here, per language, under `translations/` — see\n * `api/translations.ts`.\n */\nexport const filesCdn = ky.extend({\n prefix: 'https://cdn.files.salla.network',\n timeout: 5000,\n});\n"]}
@@ -1,5 +1,5 @@
1
- import { useIsHome } from './chunk-VZ5EMKBD.js';
2
- import { PageAdvertisements } from './chunk-KBOBADKK.js';
1
+ import { useIsHome } from './chunk-WLRNZYCA.js';
2
+ import { PageAdvertisements } from './chunk-CRXXKAFW.js';
3
3
  import { HookSlot, useIsClient } from './chunk-5XDPAKF5.js';
4
4
  import { useTranslation } from './chunk-TYNZ5B2B.js';
5
5
  import { Image } from './chunk-IVO6YRRK.js';
@@ -16,10 +16,10 @@ import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
16
16
 
17
17
  // src/components/navigation/lazy.ts
18
18
  var LazyMainMenu = lazyComponent(
19
- () => import('./MainMenu-4GUU2NAF.js').then((m) => ({ default: m.MainMenu }))
19
+ () => import('./MainMenu-LB3XL25D.js').then((m) => ({ default: m.MainMenu }))
20
20
  );
21
21
  var LazyMobileMenu = lazyComponent(
22
- () => import('./MobileMenu-ORFZ7IKI.js').then((m) => ({ default: m.MobileMenu }))
22
+ () => import('./MobileMenu-ZAFU2ZN6.js').then((m) => ({ default: m.MobileMenu }))
23
23
  );
24
24
  function HeaderContacts() {
25
25
  const { store } = useTwilight();
@@ -130,5 +130,5 @@ function Header(_props) {
130
130
  }
131
131
 
132
132
  export { Header };
133
- //# sourceMappingURL=chunk-AWANNFME.js.map
134
- //# sourceMappingURL=chunk-AWANNFME.js.map
133
+ //# sourceMappingURL=chunk-BTQ2SAMS.js.map
134
+ //# sourceMappingURL=chunk-BTQ2SAMS.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/navigation/lazy.ts","../src/components/layout/Header.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAMO,IAAM,YAAA,GAAe,aAAA;AAAA,EAAc,MACxC,OAAO,wBAAY,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,QAAA,EAAS,CAAE;AAC5D,CAAA;AAEO,IAAM,cAAA,GAAiB,aAAA;AAAA,EAAc,MAC1C,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW,CAAE;AAChE,CAAA;ACYA,SAAS,cAAA,GAAiB;AACxB,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,WAAA,EAAY;AAC9B,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,IAAI,CAAC,UAAU,OAAO,IAAA;AACtB,EAAA,uBAAO,GAAA,CAAC,iBAAc,QAAA,EAAU,KAAA,EAAO,UAAU,aAAA,EAAc,KAAA,EAAM,UAAQ,IAAA,EAAC,CAAA;AAChF;AAEO,SAAS,OAAO,MAAA,EAAqB;AAC1C,EAAA,MAAM,EAAE,QAAA,EAAU,KAAA,EAAO,KAAA,KAAU,WAAA,EAAY;AAC/C,EAAA,MAAM,EAAE,MAAA,EAAQ,YAAA,EAAa,GAAI,cAAA,EAAe;AAChD,EAAA,MAAM,QAAA,GAAW,KAAA,EAAO,QAAA,IAAY,EAAC;AACrC,EAAA,MAAM,CAAC,gBAAA,EAAkB,mBAAmB,CAAA,GAAI,SAAS,KAAK,CAAA;AAG9D,EAAA,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AA,EAAO,IAAA;AAAA,kBACZ,GAAA,EAAK,CAAA,EAAG,KAAA,EAAO,IAAA,IAAQ,OAAO,CAAA,KAAA,CAAA;AAAA,kBAC9B,QAAA,EAAQ,IAAA;AAAA,kBACR,KAAA,EAAO,GAAA;AAAA,kBACP,MAAA,EAAQ;AAAA;AAAA,eACV,EACF,CAAA;AAAA,kCACC,UAAA,EAAA,EAAW,SAAA,EAAU,SAAA,EAAW,QAAA,EAAA,KAAA,EAAO,QAAQ,OAAA,EAAQ;AAAA,aAAA,EAC1D,CAAA;AAAA,gCACC,YAAA,EAAA,EAAS;AAAA,WAAA,EACZ,CAAA;AAAA,0BACA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,sCAAA,EACb,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,iBAAc,UAAA,EAAU,IAAA,EAAC,UAAA,EAAU,IAAA,EAAC,WAAU,YAAA,EAAa,CAAA;AAAA,4BAC5D,GAAA,CAAC,gBAAA,EAAA,EAAiB,SAAA,EAAU,8BAAA,EAC1B,QAAA,kBAAA,GAAA,CAAC,OAAE,IAAA,EAAK,MAAA,EAAO,SAAA,EAAU,0CAAA,EAA2C,CAAA,EACtE;AAAA,WAAA,EACF;AAAA,SAAA,EACF,GACF,CAAA,EACF;AAAA;AAAA,KACF;AAAA,oBAGA,GAAA,CAAC,kBAAW,MAAA,EAAQ,gBAAA,EAAkB,SAAS,MAAM,mBAAA,CAAoB,KAAK,CAAA,EAAG,CAAA;AAAA,oBACjF,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAK,YAAA,EAAa;AAAA,GAAA,EAC9B,CAAA;AAEJ","file":"chunk-AWANNFME.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\n/**\n * Lazy-loaded navigation components\n * Use these for code-splitting navigation sections\n */\nexport const LazyMainMenu = lazyComponent(() =>\n import('./MainMenu').then((m) => ({ default: m.MainMenu }))\n);\n\nexport const LazyMobileMenu = lazyComponent(() =>\n import('./MobileMenu').then((m) => ({ default: m.MobileMenu }))\n);\n","import { useState } from 'react';\nimport { useIsHome } from '../../providers/NavigationProvider';\nimport { SallaCartSummary } from '@salla.sa/twilight-components-react/cart-summary';\nimport { SallaContacts } from '@salla.sa/twilight-components-react/contacts';\nimport { SallaLocalizationModal } from '@salla.sa/twilight-components-react/localization-modal';\nimport { SallaMenu } from '@salla.sa/twilight-components-react/menu';\nimport { SallaSearch } from '@salla.sa/twilight-components-react/search';\nimport { SallaUserMenu } from '@salla.sa/twilight-components-react/user-menu';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { HookSlot } from '../../hooks/HookSlot';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { MainMenu, MobileMenu } from '../navigation';\nimport { Image } from '../common';\nimport { PageAdvertisements } from './PageAdvertisements';\nimport type { Cart } from '../../types';\n\ninterface HeaderProps {\n cart?: Cart;\n}\n\n/** The store's phone and email in the top nav. `<salla-contacts>` fills its light DOM\n * once the SDK is ready, which can come before React hydrates it: a hydration error\n * (React #418). So it renders after mount. */\nfunction HeaderContacts() {\n const { store } = useTwilight();\n const isClient = useIsClient();\n if (!isClient) return null;\n return <SallaContacts contacts={store?.contacts} contactsTitle=\"N/A\" isHeader />;\n}\n\nexport function Header(_props: HeaderProps) {\n const { currency, theme, store } = useTwilight();\n const { locale, languageName } = useTranslation();\n const settings = theme?.settings || {};\n const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);\n\n // Check if we're on homepage\n const isHomepage = useIsHome();\n\n const StoreTitle = isHomepage ? 'h1' : 'span';\n\n return (\n <header className=\"store-header\" suppressHydrationWarning>\n <HookSlot name=\"header:start\" />\n <div className=\"advertisement-slot\">\n <PageAdvertisements />\n </div>\n {/* Top Nav */}\n <div className={`top-navbar${settings.topnav_is_dark ? ' top-navbar--dark' : ''}`}>\n <div className=\"container flex justify-between\">\n <div className=\"flex-1 flex items-center gap-2\">\n {/* Footer Menu */}\n {settings.important_links && <SallaMenu source=\"footer\" topnav />}\n\n {/* Language & Currency */}\n <div className=\"header-buttons\">\n {(store?.settings?.is_multilingual || store?.settings?.currencies_enabled) && (\n <>\n <button\n type=\"button\"\n onClick={() => window.salla?.event.dispatch('localization::open')}\n className=\"btn--rounded-gray basis-0\"\n >\n <span>{languageName}</span>\n <span className=\"mx-1.5\">|</span>\n <span className={`flag iti__flag iti__${store?.country.toLowerCase()}`}></span>\n\n <span>\n {store?.settings?.use_sar_symbol && currency?.code === 'SAR' ? (\n <i className=\"sicon-sar\"></i>\n ) : (\n <>{currency?.symbol}</>\n )}\n </span>\n </button>\n {/* TODO:: support switch the lang without hit the web API, by set it in the sdk and local storage */}\n {/* TODO:: Support switch the curency without hit the web API, by set it in the sdk and local storage */}\n <SallaLocalizationModal\n language={locale}\n currency={currency?.code || 'SAR'}\n suppressHydrationWarning\n />\n </>\n )}\n </div>\n\n {/* Scopes / Branches */}\n {store?.scope && (\n <button\n type=\"button\"\n className=\"btn--rounded-gray\"\n onClick={() =>\n window.salla?.event.dispatch('scopes::open', {\n mode: 'default',\n })\n }\n >\n <i className=\"sicon-location rtl:ml-1 ltr:mr-1\"></i>\n {store.scope.name}\n </button>\n )}\n\n {/* Search bar */}\n <div className=\"header-search flex-1\">\n {/* todo:: use a search icon insted with open the search popup */}\n <SallaSearch inline oval height={36} />\n </div>\n </div>\n\n <HeaderContacts />\n </div>\n </div>\n\n {/* Main Nav */}\n <div\n id=\"mainnav\"\n className={`main-nav-container shadow-default bg-white flex items-center relative z-50${settings.header_is_sticky ? ' sticky top-0' : ''}`}\n >\n <div className=\"inner bg-inherit w-full\">\n <div className=\"container\">\n <div className=\"flex items-stretch justify-between relative\">\n <div className=\"flex items-center\">\n <a\n className=\"lg:hidden mburger mburger--collapse leading-none rtl:ml-4 ltr:mr-4\"\n href=\"#mobile-menu\"\n aria-label=\"Open-menu\"\n onClick={(e) => {\n e.preventDefault();\n setIsMobileMenuOpen(true);\n }}\n >\n <i className=\"sicon-menu text-primary text-2xl\"></i>\n </a>\n <a className=\"navbar-brand\" href={store?.url || '/'}>\n <div className=\"logo-wrapper\">\n <Image\n src={store?.logo}\n alt={`${store?.name || 'Store'} logo`}\n priority\n width={120}\n height={48}\n />\n </div>\n <StoreTitle className=\"sr-only\">{store?.name || 'Store'}</StoreTitle>\n </a>\n <MainMenu />\n </div>\n <div className=\"flex items-center justify-end my-2.5\">\n <SallaUserMenu avatarOnly showHeader className=\"header-btn\" />\n <SallaCartSummary className=\"ml-4 rtl:ml-[unset] rtl:mr-4\">\n <i slot=\"icon\" className=\"header-btn__icon icon sicon-shopping-bag\"></i>\n </SallaCartSummary>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n {/* Mobile Menu */}\n <MobileMenu isOpen={isMobileMenuOpen} onClose={() => setIsMobileMenuOpen(false)} />\n <HookSlot name=\"header:end\" />\n </header>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/components/navigation/lazy.ts","../src/components/layout/Header.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAMO,IAAM,YAAA,GAAe,aAAA;AAAA,EAAc,MACxC,OAAO,wBAAY,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,QAAA,EAAS,CAAE;AAC5D,CAAA;AAEO,IAAM,cAAA,GAAiB,aAAA;AAAA,EAAc,MAC1C,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW,CAAE;AAChE,CAAA;ACYA,SAAS,cAAA,GAAiB;AACxB,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,WAAA,EAAY;AAC9B,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,IAAI,CAAC,UAAU,OAAO,IAAA;AACtB,EAAA,uBAAO,GAAA,CAAC,iBAAc,QAAA,EAAU,KAAA,EAAO,UAAU,aAAA,EAAc,KAAA,EAAM,UAAQ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AM,mBAAA,CAAoB,KAAK,CAAA,EAAG,CAAA;AAAA,oBACjF,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAK,YAAA,EAAa;AAAA,GAAA,EAC9B,CAAA;AAEJ","file":"chunk-BTQ2SAMS.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\n/**\n * Lazy-loaded navigation components\n * Use these for code-splitting navigation sections\n */\nexport const LazyMainMenu = lazyComponent(() =>\n import('./MainMenu').then((m) => ({ default: m.MainMenu }))\n);\n\nexport const LazyMobileMenu = lazyComponent(() =>\n import('./MobileMenu').then((m) => ({ default: m.MobileMenu }))\n);\n","import { useState } from 'react';\nimport { useIsHome } from '../../providers/NavigationProvider';\nimport { SallaCartSummary } from '@salla.sa/twilight-components-react/cart-summary';\nimport { SallaContacts } from '@salla.sa/twilight-components-react/contacts';\nimport { SallaLocalizationModal } from '@salla.sa/twilight-components-react/localization-modal';\nimport { SallaMenu } from '@salla.sa/twilight-components-react/menu';\nimport { SallaSearch } from '@salla.sa/twilight-components-react/search';\nimport { SallaUserMenu } from '@salla.sa/twilight-components-react/user-menu';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { HookSlot } from '../../hooks/HookSlot';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { MainMenu, MobileMenu } from '../navigation';\nimport { Image } from '../common';\nimport { PageAdvertisements } from './PageAdvertisements';\nimport type { Cart } from '../../types';\n\ninterface HeaderProps {\n cart?: Cart;\n}\n\n/** The store's phone and email in the top nav. `<salla-contacts>` fills its light DOM\n * once the SDK is ready, which can come before React hydrates it: a hydration error\n * (React #418). So it renders after mount. */\nfunction HeaderContacts() {\n const { store } = useTwilight();\n const isClient = useIsClient();\n if (!isClient) return null;\n return <SallaContacts contacts={store?.contacts} contactsTitle=\"N/A\" isHeader />;\n}\n\nexport function Header(_props: HeaderProps) {\n const { currency, theme, store } = useTwilight();\n const { locale, languageName } = useTranslation();\n const settings = theme?.settings || {};\n const [isMobileMenuOpen, setIsMobileMenuOpen] = useState(false);\n\n // Check if we're on homepage\n const isHomepage = useIsHome();\n\n const StoreTitle = isHomepage ? 'h1' : 'span';\n\n return (\n <header className=\"store-header\" suppressHydrationWarning>\n <HookSlot name=\"header:start\" />\n <div className=\"advertisement-slot\">\n <PageAdvertisements />\n </div>\n {/* Top Nav */}\n <div className={`top-navbar${settings.topnav_is_dark ? ' top-navbar--dark' : ''}`}>\n <div className=\"container flex justify-between\">\n <div className=\"flex-1 flex items-center gap-2\">\n {/* Footer Menu */}\n {settings.important_links && <SallaMenu source=\"footer\" topnav />}\n\n {/* Language & Currency */}\n <div className=\"header-buttons\">\n {(store?.settings?.is_multilingual || store?.settings?.currencies_enabled) && (\n <>\n <button\n type=\"button\"\n onClick={() => window.salla?.event.dispatch('localization::open')}\n className=\"btn--rounded-gray basis-0\"\n >\n <span>{languageName}</span>\n <span className=\"mx-1.5\">|</span>\n <span className={`flag iti__flag iti__${store?.country.toLowerCase()}`}></span>\n\n <span>\n {store?.settings?.use_sar_symbol && currency?.code === 'SAR' ? (\n <i className=\"sicon-sar\"></i>\n ) : (\n <>{currency?.symbol}</>\n )}\n </span>\n </button>\n {/* TODO:: support switch the lang without hit the web API, by set it in the sdk and local storage */}\n {/* TODO:: Support switch the curency without hit the web API, by set it in the sdk and local storage */}\n <SallaLocalizationModal\n language={locale}\n currency={currency?.code || 'SAR'}\n suppressHydrationWarning\n />\n </>\n )}\n </div>\n\n {/* Scopes / Branches */}\n {store?.scope && (\n <button\n type=\"button\"\n className=\"btn--rounded-gray\"\n onClick={() =>\n window.salla?.event.dispatch('scopes::open', {\n mode: 'default',\n })\n }\n >\n <i className=\"sicon-location rtl:ml-1 ltr:mr-1\"></i>\n {store.scope.name}\n </button>\n )}\n\n {/* Search bar */}\n <div className=\"header-search flex-1\">\n {/* todo:: use a search icon insted with open the search popup */}\n <SallaSearch inline oval height={36} />\n </div>\n </div>\n\n <HeaderContacts />\n </div>\n </div>\n\n {/* Main Nav */}\n <div\n id=\"mainnav\"\n className={`main-nav-container shadow-default bg-white flex items-center relative z-50${settings.header_is_sticky ? ' sticky top-0' : ''}`}\n >\n <div className=\"inner bg-inherit w-full\">\n <div className=\"container\">\n <div className=\"flex items-stretch justify-between relative\">\n <div className=\"flex items-center\">\n <a\n className=\"lg:hidden mburger mburger--collapse leading-none rtl:ml-4 ltr:mr-4\"\n href=\"#mobile-menu\"\n aria-label=\"Open-menu\"\n onClick={(e) => {\n e.preventDefault();\n setIsMobileMenuOpen(true);\n }}\n >\n <i className=\"sicon-menu text-primary text-2xl\"></i>\n </a>\n <a className=\"navbar-brand\" href={store?.url || '/'}>\n <div className=\"logo-wrapper\">\n <Image\n src={store?.logo}\n alt={`${store?.name || 'Store'} logo`}\n priority\n width={120}\n height={48}\n />\n </div>\n <StoreTitle className=\"sr-only\">{store?.name || 'Store'}</StoreTitle>\n </a>\n <MainMenu />\n </div>\n <div className=\"flex items-center justify-end my-2.5\">\n <SallaUserMenu avatarOnly showHeader className=\"header-btn\" />\n <SallaCartSummary className=\"ml-4 rtl:ml-[unset] rtl:mr-4\">\n <i slot=\"icon\" className=\"header-btn__icon icon sicon-shopping-bag\"></i>\n </SallaCartSummary>\n </div>\n </div>\n </div>\n </div>\n </div>\n\n {/* Mobile Menu */}\n <MobileMenu isOpen={isMobileMenuOpen} onClose={() => setIsMobileMenuOpen(false)} />\n <HookSlot name=\"header:end\" />\n </header>\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { isProductKeyUrl } from './chunk-SDBR4X3K.js';
2
- import { resolveStoreBase, isMultilingualStore, resolveStoreBaseFollowsLocale, splitLeadingSegment } from './chunk-VLL4GO7G.js';
2
+ import { resolveStoreBase, isMultilingualStore, resolveStoreBaseFollowsLocale, splitLeadingSegment } from './chunk-4OZIBANF.js';
3
3
  import { FALLBACK_LOCALE, isLocale } from './chunk-T72DAX7R.js';
4
4
 
5
5
  // src/utils/baseHead.ts
@@ -175,5 +175,5 @@ function buildBaseHead(settings, locale = FALLBACK_LOCALE, path) {
175
175
  }
176
176
 
177
177
  export { buildBaseHead, buildHreflangAlternates, localeToOgLocale, slugOfPageUrl, slugPageCanonical, storePageUrl };
178
- //# sourceMappingURL=chunk-YF72DLML.js.map
179
- //# sourceMappingURL=chunk-YF72DLML.js.map
178
+ //# sourceMappingURL=chunk-BYA4ZF7E.js.map
179
+ //# sourceMappingURL=chunk-BYA4ZF7E.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/baseHead.ts"],"names":[],"mappings":";;;;;AAaA,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;AAG9E,EAAA,MAAM,WAAW,CAAC,KAAA,KAAkB,QAAA,CAAS,KAAA,CAAM,KAAK,CA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ACrC,GAAI,KAAA,GAAQ,EAAE,GAAA,EAAK,KAAA,KAAU,EAAC;AAAA,MAC9B,MAAA,EAAQ,iBAAiB,MAAM,CAAA;AAAA,MAC/B,GAAI,MAAM,IAAA,GAAO,EAAE,QAAQ,KAAA,CAAM,IAAA,KAAS;AAAC,KAC7C;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-YF72DLML.js","sourcesContent":["import type { HeadDescriptor } from './head';\nimport type { StoreContext } from '../api/store';\nimport { FALLBACK_LOCALE, isLocale } from '../providers/locale-constants';\nimport { isProductKeyUrl } from '../router/product-key-urls';\nimport { resolveStoreBase, resolveStoreBaseFollowsLocale } from './store-identity';\nimport { splitLeadingSegment } from './store-base';\nimport { isMultilingualStore } from './shared-host-language';\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 // A language the engine knows (the router's own test), not any two letters: a category slugged\n // `tv` is no language, and Indonesian is `ind`.\n const localeAt = (index: number) => isLocale(parts[index]);\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 && isLocale(pathParts[0])) {\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/** The `{key}-{name}` segment a SKU-link product URL ends with, or null for any other URL. */\nfunction productKeySegmentOf(url: string | undefined): string | null {\n if (!isProductKeyUrl(url)) return null;\n try {\n return new URL(url ?? '').pathname.split('/').filter(Boolean).pop() ?? null;\n } catch {\n return null;\n }\n}\n\n/**\n * The SEO slug of a product (`p`) or category (`c`) URL that ends `/{slug}/{kind}{id}`, or `-`\n * when it ends otherwise. A slug is never a language, nor the store's own segment\n * (`salla.sa/<username>/p1` has none).\n */\nexport function slugOfPageUrl(url: string | undefined, kind: 'p' | 'c', id: string): string {\n try {\n const segments = new URL(url ?? '').pathname.split('/').filter(Boolean);\n const [slug, last] = segments.slice(-2);\n if (segments.length < 2 || last !== `${kind}${id}`) return '-';\n return isLocale(slug) || slug === resolveStoreBase() ? '-' : slug;\n } catch {\n return '-';\n }\n}\n\n/**\n * The canonical URL of a product (`p`) or category (`c`) page: `/{slug}/{kind}{id}` under the\n * store root, in the language of the page's address (`routerPath`), with the slug the API's\n * `url` carries, or `-` when it carries none.\n *\n * It is built, not taken from the API, because the API's `url` is not always an address the\n * engine serves. A store on hash URLs gets `/{code}` and `/category/{code}`, and a store on \"new\n * links\" gets `/p{id}-{name}` or `/{sku}-{name}`. The engine redirects those to `/-/{kind}{id}`,\n * so a canonical naming one told search engines the page lived at an address that redirected\n * back to it. On a store with SEO URLs the result is the API's own `url`.\n */\nexport function slugPageCanonical(\n settings: StoreContext | null | undefined,\n kind: 'p' | 'c',\n id: string | number,\n apiUrl: string | undefined,\n routerPath: string\n): string | undefined {\n const first = routerPath.split('/').filter(Boolean)[0];\n const locale = isLocale(first) ? `/${first}` : '';\n // A store on SKU links names its product `/{key}-{name}`, and the engine serves it there.\n const keyAddress = kind === 'p' ? productKeySegmentOf(apiUrl) : null;\n if (keyAddress) return storePageUrl(settings, `${locale}/${keyAddress}`) ?? apiUrl;\n const slug = slugOfPageUrl(apiUrl, kind, String(id));\n return storePageUrl(settings, `${locale}/${slug}/${kind}${id}`) ?? apiUrl;\n}\n\n// ============================================================================\n// Hreflang alternates builder\n// ============================================================================\n\n/**\n * The language a single-language store's addresses carry: its one language, unless that is the\n * fallback, which an address with no language is read as. The locale layout's `addressLanguage`\n * decides the same way, so `/ar/x` on an Arabic-only store redirects to `/x`.\n */\nfunction singleLanguageSegment(settings: StoreContext): string | null {\n const listed = settings.languages;\n const sole = listed?.length === 1 ? (listed[0].iso_code ?? listed[0].code)?.toLowerCase() : null;\n return isLocale(sole ?? undefined) && sole !== FALLBACK_LOCALE ? sole : null;\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 pagePath = extractedPath === '/' ? '' : extractedPath;\n const buildUrl = (langCode: string) => {\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 // A single-language store is shown in one language, at addresses that carry it only when it\n // is not the fallback. Every alternate named `/<lang>/…`, which redirects there (or `/en/…`,\n // a language the store does not show).\n if (!inQuery && settings && !isMultilingualStore(settings)) {\n const segment = singleLanguageSegment(settings);\n const href = `${baseUrl}${segment ? `/${segment}` : ''}${pagePath}`;\n return [\n { hreflang: 'x-default', href },\n { hreflang: segment ?? FALLBACK_LOCALE, href },\n ];\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.log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A,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-BYA4ZF7E.js","sourcesContent":["import type { HeadDescriptor } from './head';\nimport type { StoreContext } from '../api/store';\nimport { FALLBACK_LOCALE, isLocale } from '../providers/locale-constants';\nimport { isProductKeyUrl } from '../router/product-key-urls';\nimport { resolveStoreBase, resolveStoreBaseFollowsLocale } from './store-identity';\nimport { splitLeadingSegment } from './store-base';\nimport { isMultilingualStore } from './shared-host-language';\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 // A language the engine knows (the router's own test), not any two letters: a category slugged\n // `tv` is no language, and Indonesian is `ind`.\n const localeAt = (index: number) => isLocale(parts[index]);\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 && isLocale(pathParts[0])) {\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/** The `{key}-{name}` segment a SKU-link product URL ends with, or null for any other URL. */\nfunction productKeySegmentOf(url: string | undefined): string | null {\n if (!isProductKeyUrl(url)) return null;\n try {\n return new URL(url ?? '').pathname.split('/').filter(Boolean).pop() ?? null;\n } catch {\n return null;\n }\n}\n\n/**\n * The SEO slug of a product (`p`) or category (`c`) URL that ends `/{slug}/{kind}{id}`, or `-`\n * when it ends otherwise. A slug is never a language, nor the store's own segment\n * (`salla.sa/<username>/p1` has none).\n */\nexport function slugOfPageUrl(url: string | undefined, kind: 'p' | 'c', id: string): string {\n try {\n const segments = new URL(url ?? '').pathname.split('/').filter(Boolean);\n const [slug, last] = segments.slice(-2);\n if (segments.length < 2 || last !== `${kind}${id}`) return '-';\n return isLocale(slug) || slug === resolveStoreBase() ? '-' : slug;\n } catch {\n return '-';\n }\n}\n\n/**\n * The canonical URL of a product (`p`) or category (`c`) page: `/{slug}/{kind}{id}` under the\n * store root, in the language of the page's address (`routerPath`), with the slug the API's\n * `url` carries, or `-` when it carries none.\n *\n * It is built, not taken from the API, because the API's `url` is not always an address the\n * engine serves. A store on hash URLs gets `/{code}` and `/category/{code}`, and a store on \"new\n * links\" gets `/p{id}-{name}` or `/{sku}-{name}`. The engine redirects those to `/-/{kind}{id}`,\n * so a canonical naming one told search engines the page lived at an address that redirected\n * back to it. On a store with SEO URLs the result is the API's own `url`.\n */\nexport function slugPageCanonical(\n settings: StoreContext | null | undefined,\n kind: 'p' | 'c',\n id: string | number,\n apiUrl: string | undefined,\n routerPath: string\n): string | undefined {\n const first = routerPath.split('/').filter(Boolean)[0];\n const locale = isLocale(first) ? `/${first}` : '';\n // A store on SKU links names its product `/{key}-{name}`, and the engine serves it there.\n const keyAddress = kind === 'p' ? productKeySegmentOf(apiUrl) : null;\n if (keyAddress) return storePageUrl(settings, `${locale}/${keyAddress}`) ?? apiUrl;\n const slug = slugOfPageUrl(apiUrl, kind, String(id));\n return storePageUrl(settings, `${locale}/${slug}/${kind}${id}`) ?? apiUrl;\n}\n\n// ============================================================================\n// Hreflang alternates builder\n// ============================================================================\n\n/**\n * The language a single-language store's addresses carry: its one language, unless that is the\n * fallback, which an address with no language is read as. The locale layout's `addressLanguage`\n * decides the same way, so `/ar/x` on an Arabic-only store redirects to `/x`.\n */\nfunction singleLanguageSegment(settings: StoreContext): string | null {\n const listed = settings.languages;\n const sole = listed?.length === 1 ? (listed[0].iso_code ?? listed[0].code)?.toLowerCase() : null;\n return isLocale(sole ?? undefined) && sole !== FALLBACK_LOCALE ? sole : null;\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 pagePath = extractedPath === '/' ? '' : extractedPath;\n const buildUrl = (langCode: string) => {\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 // A single-language store is shown in one language, at addresses that carry it only when it\n // is not the fallback. Every alternate named `/<lang>/…`, which redirects there (or `/en/…`,\n // a language the store does not show).\n if (!inQuery && settings && !isMultilingualStore(settings)) {\n const segment = singleLanguageSegment(settings);\n const href = `${baseUrl}${segment ? `/${segment}` : ''}${pagePath}`;\n return [\n { hreflang: 'x-default', href },\n { hreflang: segment ?? FALLBACK_LOCALE, href },\n ];\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,4 +1,4 @@
1
- import { getSallaSDK, whenSallaReady } from './chunk-JCYX7HXB.js';
1
+ import { getSallaSDK, whenSallaReady } from './chunk-MZPX4EPS.js';
2
2
  import { useState, useEffect } from 'react';
3
3
 
4
4
  function isNativeApp() {
@@ -54,5 +54,5 @@ function useNativeStatusBarColor() {
54
54
  }
55
55
 
56
56
  export { hapticImpact, isNativeApp, nativeAppVersion, openNativeBrowser, openNativeSheet, useIsNativeApp, useNativeAppVersion, useNativeStatusBarColor };
57
- //# sourceMappingURL=chunk-H73VXFYO.js.map
58
- //# sourceMappingURL=chunk-H73VXFYO.js.map
57
+ //# sourceMappingURL=chunk-BZ2QSBXM.js.map
58
+ //# sourceMappingURL=chunk-BZ2QSBXM.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/native-app/index.ts"],"names":[],"mappings":";;;AAQO,SAAS,WAAA,GAAuB;AACrC,EAAA,OAAO,OAAA,CAAQ,WAAA,EAAY,EAAG,MAAA,EAAQ,aAAa,CAAA;AACrD;AAOO,SAAS,cAAA,GAA0B;AACxC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,KAAK,CAAA;AAExC,EAAA,SAAA,CAAU,MAAM,eAAe,MAAM,QAAA,CAAS,aAAa,CAAC,CAAA,EAAG,EAAE,CAAA;AAEjE,EAAA,OAAO,KAAA;AACT;AAOO,SAAS,gBAAA,GAAkC;AAChD,EAAA,IAAI,CAAC,WAAA,EAAY,EAAG,OAAO,IAAA;AAC3B,EAAA,MAAM,SAAA,GAAa,aAAY,EAAgD,SAAA;AAC/E,EAAA,OAAO,SAAA,EAAW,cAAA,EAAgB,kBAAA,GAAqB,KAAK,GAAG,eAAA,IAAmB,IAAA;AACpF;AASO,SAAS,mBAAA,GAAqC;AACnD,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAwB,IAAI,CAAA;AAE1D,EAAA,SAAA,CAAU,MAAM,eAAe,MAAM,UAAA,CAAW,kBAAkB,CAAC,CAAA,EAAG,EAAE,CAAA;AAExE,EAAA,OAAO,OAAA;AACT;AAeO,SAAS,gBAAgB,KAAA,EAA6B;AAC3D,EAAA,IAAI,CAAC,WAAA,EAAY,EAAG,O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AK,EAAE,CAAC,CAAA,CAAA;AACb;AAWO,SAAS,uBAAA,GAAiE;AAC/E,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAmB,IAAI,CAAA;AACrD,EAAA,MAAM,QAAQ,cAAA,EAAe;AAE7B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,KAAA,IAAS,CAAC,OAAA,EAAS;AACxB,IAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,gBAAA,CAAiB,OAAO,EAAE,eAAe,CAAA;AAChE,IAAA,IAAI,KAAA,eAAmB,EAAG,KAAA,CAAM,SAAS,yBAAA,EAA2B,EAAE,OAAO,CAAA;AAAA,EAC/E,CAAA,EAAG,CAAC,KAAA,EAAO,OAAO,CAAC,CAAA;AAEnB,EAAA,OAAO,UAAA;AACT","file":"chunk-H73VXFYO.js","sourcesContent":["import { useEffect, useState, type RefCallback } from 'react';\nimport { getSallaSDK, whenSallaReady } from '../utils/sdk-helpers';\n\n/**\n * True inside the Salla native app's webview, read at call time: the SDK's\n * `salla.mobile.isEnabled()`. False on the server and until the SDK has loaded, so call it\n * from an event handler or an effect, and use {@link useIsNativeApp} to decide what to render.\n */\nexport function isNativeApp(): boolean {\n return Boolean(getSallaSDK()?.mobile?.isEnabled?.());\n}\n\n/**\n * {@link isNativeApp} as state, for a render decision. False on the server and on the first\n * client render, then true once the SDK is ready inside the app: an app that identifies\n * itself through its config has not said so before `init`.\n */\nexport function useIsNativeApp(): boolean {\n const [inApp, setInApp] = useState(false);\n\n useEffect(() => whenSallaReady(() => setInApp(isNativeApp())), []);\n\n return inApp;\n}\n\n/**\n * The native app's release (`5.4.19`), the `s-app-version` it loaded the page with, or null\n * outside the app. The SDK keeps it in its analytics context, where it also learns that this\n * is the app. Read at call time like {@link isNativeApp}; render with {@link useNativeAppVersion}.\n */\nexport function nativeAppVersion(): string | null {\n if (!isNativeApp()) return null;\n const analytics = (getSallaSDK() as { analytics?: SdkAnalytics } | undefined)?.analytics;\n return analytics?.jitsuAnalytics?.getContextProperty?.('app')?.app_release_tag || null;\n}\n\ntype SdkAnalytics = {\n jitsuAnalytics?: {\n getContextProperty?: (key: 'app') => { app_release_tag?: string } | undefined;\n };\n};\n\n/** {@link nativeAppVersion} as state: null on the server and until the SDK is ready in the app. */\nexport function useNativeAppVersion(): string | null {\n const [version, setVersion] = useState<string | null>(null);\n\n useEffect(() => whenSallaReady(() => setVersion(nativeAppVersion())), []);\n\n return version;\n}\n\n/** The native app's own pickers that replace the store's web modals. */\nexport type NativeSheet = 'language' | 'currency';\n\n/**\n * Inside the Salla app, opens the app's own language or currency sheet\n * (`mobile::language.open` / `mobile::currency.open`) and returns `true`; the app\n * applies the choice and reloads. Outside the app it does nothing and returns\n * `false`, so a caller opens the web modal instead:\n *\n * ```ts\n * if (!openNativeSheet('currency')) salla.event.dispatch('localization::open');\n * ```\n */\nexport function openNativeSheet(sheet: NativeSheet): boolean {\n if (!isNativeApp()) return false;\n const sdk = getSallaSDK();\n const open = sheet === 'language' ? sdk?.mobile?.openLanguages : sdk?.mobile?.openCurrencies;\n if (typeof open === 'function') open.call(sdk?.mobile);\n // An SDK without the methods still forwards an emitted `mobile::*` event to the app.\n else sdk?.event.dispatch(`mobile::${sheet}.open`, {});\n return true;\n}\n\n/**\n * Inside the Salla app, hands `url` to the app to open in the device's browser\n * (`mobile::browser.open`) and returns `true`; a page off the store would\n * otherwise load inside the app with no way back. Outside the app it does nothing\n * and returns `false`. The engine's link interceptor calls it for every tap on a\n * link that leaves the store.\n */\nexport function openNativeBrowser(url: string): boolean {\n if (!isNativeApp()) return false;\n const sdk = getSallaSDK();\n if (typeof sdk?.mobile?.openBrowser === 'function') sdk.mobile.openBrowser(url);\n else sdk?.event.dispatch('mobile::browser.open', { url });\n return true;\n}\n\nexport type HapticImpact = 'light' | 'medium' | 'heavy';\n\n/** Asks the native app for a tap vibration. The SDK ignores it outside the app. */\nexport function hapticImpact(impact: HapticImpact): void {\n getSallaSDK()?.mobile?.action?.('haptic.impact', { impact_type: impact });\n}\n\n/**\n * `rgb(232, 245, 255)`, what `getComputedStyle` returns, as `#e8f5ff`. A partial alpha is\n * dropped. A fully transparent colour is no colour at all: an element with no background\n * of its own computes to `rgba(0, 0, 0, 0)`, which would otherwise read as black.\n */\nfunction rgbToHex(rgb: string): string | null {\n const match = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*([\\d.]+))?\\)/);\n if (!match || Number(match[4]) === 0) return null;\n return `#${match\n .slice(1, 4)\n .map((channel) => Number(channel).toString(16).padStart(2, '0'))\n .join('')}`;\n}\n\n/**\n * Tells the native app to paint its status bar with the rendered background of the element\n * the returned ref is attached to. The colour is read from the DOM, because a theme's tint\n * is often a relative CSS colour (`hsl(from …)`) with no hex to pass. Does nothing outside\n * the app, and for an element with no background of its own.\n *\n * The ref is a callback, kept in state, so an element that mounts after the app has been\n * recognised still reports its colour.\n */\nexport function useNativeStatusBarColor<T extends HTMLElement>(): RefCallback<T> {\n const [element, setElement] = useState<T | null>(null);\n const inApp = useIsNativeApp();\n\n useEffect(() => {\n if (!inApp || !element) return;\n const color = rgbToHex(getComputedStyle(element).backgroundColor);\n if (color) getSallaSDK()?.event.dispatch('mobile::statusbar.color', { color });\n }, [inApp, element]);\n\n return setElement;\n}\n"]}
1
+ {"version":3,"sources":["../src/native-app/index.ts"],"names":[],"mappings":";;;AAQO,SAAS,WAAA,GAAuB;AACrC,EAAA,OAAO,OAAA,CAAQ,WAAA,EAAY,EAAG,MAAA,EAAQ,aAAa,CAAA;AACrD;AAOO,SAAS,cAAA,GAA0B;AACxC,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAI,SAAS,KAAK,CAAA;AAExC,EAAA,SAAA,CAAU,MAAM,eAAe,MAAM,QAAA,CAAS,aAAa,CAAC,CAAA,EAAG,EAAE,CAAA;AAEjE,EAAA,OAAO,KAAA;AACT;AAOO,SAAS,gBAAA,GAAkC;AAChD,EAAA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AAA,EAAQ,MAAA,GAAS,iBAAiB,EAAE,WAAA,EAAa,QAAQ,CAAA;AAC1E;AAOA,SAAS,SAAS,GAAA,EAA4B;AAC5C,EAAA,MAAM,KAAA,GAAQ,GAAA,CAAI,KAAA,CAAM,oDAAoD,CAAA;AAC5E,EAAA,IAAI,CAAC,SAAS,MAAA,CAAO,KAAA,CAAM,CAAC,CAAC,CAAA,KAAM,GAAG,OAAO,IAAA;AAC7C,EAAA,OAAO,CAAA,CAAA,EAAI,MACR,KAAA,CAAM,CAAA,EAAG,CAAC,CAAA,CACV,GAAA,CAAI,CAAC,OAAA,KAAY,MAAA,CAAO,OAAO,EAAE,QAAA,CAAS,EAAE,EAAE,QAAA,CAAS,CAAA,EAAG,GAAG,CAAC,CAAA,CAC9D,IAAA,CAAK,EAAE,CAAC,CAAA,CAAA;AACb;AAWO,SAAS,uBAAA,GAAiE;AAC/E,EAAA,MAAM,CAAC,OAAA,EAAS,UAAU,CAAA,GAAI,SAAmB,IAAI,CAAA;AACrD,EAAA,MAAM,QAAQ,cAAA,EAAe;AAE7B,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,IAAI,CAAC,KAAA,IAAS,CAAC,OAAA,EAAS;AACxB,IAAA,MAAM,KAAA,GAAQ,QAAA,CAAS,gBAAA,CAAiB,OAAO,EAAE,eAAe,CAAA;AAChE,IAAA,IAAI,KAAA,eAAmB,EAAG,KAAA,CAAM,SAAS,yBAAA,EAA2B,EAAE,OAAO,CAAA;AAAA,EAC/E,CAAA,EAAG,CAAC,KAAA,EAAO,OAAO,CAAC,CAAA;AAEnB,EAAA,OAAO,UAAA;AACT","file":"chunk-BZ2QSBXM.js","sourcesContent":["import { useEffect, useState, type RefCallback } from 'react';\nimport { getSallaSDK, whenSallaReady } from '../utils/sdk-helpers';\n\n/**\n * True inside the Salla native app's webview, read at call time: the SDK's\n * `salla.mobile.isEnabled()`. False on the server and until the SDK has loaded, so call it\n * from an event handler or an effect, and use {@link useIsNativeApp} to decide what to render.\n */\nexport function isNativeApp(): boolean {\n return Boolean(getSallaSDK()?.mobile?.isEnabled?.());\n}\n\n/**\n * {@link isNativeApp} as state, for a render decision. False on the server and on the first\n * client render, then true once the SDK is ready inside the app: an app that identifies\n * itself through its config has not said so before `init`.\n */\nexport function useIsNativeApp(): boolean {\n const [inApp, setInApp] = useState(false);\n\n useEffect(() => whenSallaReady(() => setInApp(isNativeApp())), []);\n\n return inApp;\n}\n\n/**\n * The native app's release (`5.4.19`), the `s-app-version` it loaded the page with, or null\n * outside the app. The SDK keeps it in its analytics context, where it also learns that this\n * is the app. Read at call time like {@link isNativeApp}; render with {@link useNativeAppVersion}.\n */\nexport function nativeAppVersion(): string | null {\n if (!isNativeApp()) return null;\n const analytics = (getSallaSDK() as { analytics?: SdkAnalytics } | undefined)?.analytics;\n return analytics?.jitsuAnalytics?.getContextProperty?.('app')?.app_release_tag || null;\n}\n\ntype SdkAnalytics = {\n jitsuAnalytics?: {\n getContextProperty?: (key: 'app') => { app_release_tag?: string } | undefined;\n };\n};\n\n/** {@link nativeAppVersion} as state: null on the server and until the SDK is ready in the app. */\nexport function useNativeAppVersion(): string | null {\n const [version, setVersion] = useState<string | null>(null);\n\n useEffect(() => whenSallaReady(() => setVersion(nativeAppVersion())), []);\n\n return version;\n}\n\n/** The native app's own pickers that replace the store's web modals. */\nexport type NativeSheet = 'language' | 'currency';\n\n/**\n * Inside the Salla app, opens the app's own language or currency sheet\n * (`mobile::language.open` / `mobile::currency.open`) and returns `true`; the app\n * applies the choice and reloads. Outside the app it does nothing and returns\n * `false`, so a caller opens the web modal instead:\n *\n * ```ts\n * if (!openNativeSheet('currency')) salla.event.dispatch('localization::open');\n * ```\n */\nexport function openNativeSheet(sheet: NativeSheet): boolean {\n if (!isNativeApp()) return false;\n const sdk = getSallaSDK();\n const open = sheet === 'language' ? sdk?.mobile?.openLanguages : sdk?.mobile?.openCurrencies;\n if (typeof open === 'function') open.call(sdk?.mobile);\n // An SDK without the methods still forwards an emitted `mobile::*` event to the app.\n else sdk?.event.dispatch(`mobile::${sheet}.open`, {});\n return true;\n}\n\n/**\n * Inside the Salla app, hands `url` to the app to open in the device's browser\n * (`mobile::browser.open`) and returns `true`; a page off the store would\n * otherwise load inside the app with no way back. Outside the app it does nothing\n * and returns `false`. The engine's link interceptor calls it for every tap on a\n * link that leaves the store.\n */\nexport function openNativeBrowser(url: string): boolean {\n if (!isNativeApp()) return false;\n const sdk = getSallaSDK();\n if (typeof sdk?.mobile?.openBrowser === 'function') sdk.mobile.openBrowser(url);\n else sdk?.event.dispatch('mobile::browser.open', { url });\n return true;\n}\n\nexport type HapticImpact = 'light' | 'medium' | 'heavy';\n\n/** Asks the native app for a tap vibration. The SDK ignores it outside the app. */\nexport function hapticImpact(impact: HapticImpact): void {\n getSallaSDK()?.mobile?.action?.('haptic.impact', { impact_type: impact });\n}\n\n/**\n * `rgb(232, 245, 255)`, what `getComputedStyle` returns, as `#e8f5ff`. A partial alpha is\n * dropped. A fully transparent colour is no colour at all: an element with no background\n * of its own computes to `rgba(0, 0, 0, 0)`, which would otherwise read as black.\n */\nfunction rgbToHex(rgb: string): string | null {\n const match = rgb.match(/^rgba?\\((\\d+),\\s*(\\d+),\\s*(\\d+)(?:,\\s*([\\d.]+))?\\)/);\n if (!match || Number(match[4]) === 0) return null;\n return `#${match\n .slice(1, 4)\n .map((channel) => Number(channel).toString(16).padStart(2, '0'))\n .join('')}`;\n}\n\n/**\n * Tells the native app to paint its status bar with the rendered background of the element\n * the returned ref is attached to. The colour is read from the DOM, because a theme's tint\n * is often a relative CSS colour (`hsl(from …)`) with no hex to pass. Does nothing outside\n * the app, and for an element with no background of its own.\n *\n * The ref is a callback, kept in state, so an element that mounts after the app has been\n * recognised still reports its colour.\n */\nexport function useNativeStatusBarColor<T extends HTMLElement>(): RefCallback<T> {\n const [element, setElement] = useState<T | null>(null);\n const inApp = useIsNativeApp();\n\n useEffect(() => {\n if (!inApp || !element) return;\n const color = rgbToHex(getComputedStyle(element).backgroundColor);\n if (color) getSallaSDK()?.event.dispatch('mobile::statusbar.color', { color });\n }, [inApp, element]);\n\n return setElement;\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { filesCdn, cdn } from './chunk-4MKA22LE.js';
2
- import { storeTranslationsQueryKey, translationsQueryKey, composeMessages, isPlainObject } from './chunk-PLD6KSYE.js';
1
+ import { filesCdn, cdn } from './chunk-BSWV7U3V.js';
2
+ import { storeTranslationsQueryKey, translationsQueryKey, composeMessages, isPlainObject } from './chunk-MWUAHDQL.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
5
5
  var LEGACY_GLOBAL_FILE = "js/translations.json";
@@ -126,5 +126,5 @@ var translations = {
126
126
  };
127
127
 
128
128
  export { commonTranslationsPath, storeTranslationsPath, translations };
129
- //# sourceMappingURL=chunk-PCPERWKJ.js.map
130
- //# sourceMappingURL=chunk-PCPERWKJ.js.map
129
+ //# sourceMappingURL=chunk-CB473WUX.js.map
130
+ //# sourceMappingURL=chunk-CB473WUX.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/translations.ts"],"names":[],"mappings":";;;;AAiEA,IAAM,kBAAA,GAAqB,sBAAA;AAGpB,SAAS,uBAAuB,MAAA,EAAwB;AAC7D,EAAA,OAAO,uBAAuB,MAAM,CAAA,KAAA,CAAA;AACtC;AAWO,SAAS,qBAAA,CAAsB,SAA0B,MAAA,EAAwB;AACtF,EAAA,OAAO,CAAA,aAAA,EAAgB,OAAO,CAAA,CAAA,EAAI,MAAM,CAAA,KAAA,CAAA;AAC1C;AAUA,eAAe,eACb,IAAA,EACA,EAAE,aAAa,KAAA,EAAM,GAA8B,EAAC,EAC1B;AAE1B,EAAA,MAAM,UAAA,GAAa,CAAC,MAAA,EAAgB,KAAA,KAA0B;AAC5D,IAAA,IAAI,UAAA,EAAY,MAAM,IAAI,KAAA,CAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,EAAA,EAAK,MAAM,CAAA,CAAA,EAAI,EAAE,KAAA,EAAO,CA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M;AAAA,KACvC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWH,OAAA,EAAS,CAAC,OAAA,EAA0B,MAAA,KAClC,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,yBAAA,CAA0B,OAAA,EAAS,MAAM,CAAA;AAAA,MACnD,OAAA,EAAS,MAAM,YAAA,CAAa,QAAA,CAAS,SAAS,MAAM;AAAA,KACrD;AAAA;AAEP","file":"chunk-PCPERWKJ.js","sourcesContent":["/**\n * @fileoverview Where a storefront's words come from.\n *\n * Two files, merged: the platform's copy for this language, and the merchant's\n * own edits for this language and this store. Both are plain JSON objects on\n * the uploader's CDN, one per language.\n *\n * ```\n * https://cdn.files.salla.network/translations/common/<locale>.json the platform's\n * https://cdn.files.salla.network/translations/<storeId>/<locale>.json the merchant's\n * ```\n *\n * **What this replaces, and why.** Until now the engine read a single global\n * file, `cdn.salla.network/js/translations.json`, holding every language keyed\n * `\"<locale>.trans\"`. Nothing publishes that file: it is an object last written\n * on 2026-03-26, carrying only `ar` and `en` where the platform has 39 locales,\n * 405 keys behind `Languages-Module` and 959 English strings textually\n * different from it. So every React storefront has been serving copy from\n * March, and a key added since has never reached one. It also carried no\n * merchant overrides at all — a merchant editing their theme's wording in the\n * Dashboard changed nothing on a React theme.\n *\n * **Merchant overrides are read, and only when there are any.** Getting here\n * took two corrections worth keeping.\n *\n * The first is the address. A merchant's own wording lives at\n * `translations/<storeId>/<locale>.json`, keyed by `store()->getRouteKey()` —\n * the Optimus-encoded numeric id. An early version addressed it with\n * `resolveStoreIdentifier()`, on the claim that the two are the same string.\n * That is true of the `store-identifier` *header*, which accepts a host, a\n * username or an id, and false of the R2 key: on a custom domain the resolver\n * returns `reefperfumes.com` and on a shared host a username like\n * `mtgr-alaatr-2`. Both 404, both then read as \"this store has no overrides\",\n * and the merchant's wording silently never appears — so the feature would have\n * worked under `?storeId=` alone, which is preview and localhost. It is\n * `settings.store.id` now, which is known only after the settings query.\n *\n * The second is when to ask at all. Most stores have never customised a word,\n * and a miss is an uncached round trip (`cf-cache-status: DYNAMIC` on the 404)\n * on the critical path of every SSR render. So the request is made only when\n * `settings.languages[<ISO>].has_custom_translations` says there is something\n * to get — a flag `Languages-Module` writes when a merchant saves a\n * translation. A store without overrides pays nothing, which is what made this\n * shippable at all.\n *\n * ⚠️ The flag is written on save, so a store whose wording predates it reads as\n * `false` until someone edits a translation or the backfill runs. That is a\n * store keeping today's behaviour, not a regression — React themes have never\n * read merchant overrides — but it does mean the feature is only as complete as\n * the backfill.\n *\n * **Rollout is by fallback, not by flag.** `translations/common/` is written by\n * a sync in the theme build service that may not have run yet, and a hard switch\n * would leave every storefront with no platform strings at all. A missing common\n * file therefore falls back to the old global one, which is exactly today's\n * behaviour — so this is safe to ship before the bucket is populated, and stops\n * using the fallback on its own once it is.\n */\nimport { queryOptions } from '@tanstack/react-query';\nimport { cdn, filesCdn } from './client';\nimport { storeTranslationsQueryKey, translationsQueryKey } from './translations-key';\nimport { composeMessages, isPlainObject, type Messages } from './messages';\nimport type { TranslationMessages } from '../providers/I18nProvider';\n\n/** The global file this used to be the only reader of. See the file comment. */\nconst LEGACY_GLOBAL_FILE = 'js/translations.json';\n\n/** One language of platform copy, shared by every store. */\nexport function commonTranslationsPath(locale: string): string {\n return `translations/common/${locale}.json`;\n}\n\n/**\n * One language of a single merchant's own wording.\n *\n * `storeId` is `settings.store.id`, which is the value `Languages-Module` names\n * the object with (`store()->getRouteKey()`, the Optimus-encoded numeric id).\n * It is **not** `resolveStoreIdentifier()`: that returns a hostname on a custom\n * domain and a username on a shared host, both of which 404 here and would read\n * as \"this merchant has no overrides\" — silently, on every store but a preview.\n */\nexport function storeTranslationsPath(storeId: string | number, locale: string): string {\n return `translations/${storeId}/${locale}.json`;\n}\n\n/**\n * Reads one language file, or `null` when there is nothing to read.\n *\n * A 404 is the ordinary answer, not a failure: most stores have never had a\n * word customised, so their file does not exist. Distinguishing it from a real\n * error matters only for the log — both end in `null` — but a warning on every\n * page load of every uncustomised store is a warning nobody will read.\n */\nasync function readLocaleFile(\n path: string,\n { failLoudly = false }: { failLoudly?: boolean } = {}\n): Promise<Messages | null> {\n /** A 404 always means \"absent\"; everything else is a failure to read. */\n const unreadable = (reason: string, cause?: unknown): null => {\n if (failLoudly) throw new Error(`[translations] ${path}: ${reason}`, { cause });\n console.warn('[translations]', reason, path, cause ?? '');\n return null;\n };\n\n try {\n const response = await filesCdn.get(path, { throwHttpErrors: false, timeout: 5000 });\n if (response.status === 404) return null;\n\n if (!response.ok) {\n return unreadable(`answered ${response.status}`);\n }\n\n const data: unknown = await response.json();\n if (!isPlainObject(data)) {\n return unreadable('is not a JSON object');\n }\n\n return data;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith('[translations]')) throw error;\n return unreadable('could not be read', error);\n }\n}\n\n/**\n * The pre-CDN global file, sliced to one language.\n *\n * Only reached when `translations/common/<locale>.json` is missing, which is\n * the state of the bucket until the sync has run once.\n */\nasync function readLegacyGlobal(locale: string): Promise<Messages | null> {\n try {\n const data = await cdn.get(LEGACY_GLOBAL_FILE, { timeout: 5000 }).json<TranslationMessages>();\n const forLocale = data?.[`${locale}.trans`];\n return isPlainObject(forLocale) ? forLocale : null;\n } catch {\n console.warn('[translations] the legacy global file could not be read either');\n return null;\n }\n}\n\nexport const translations = {\n /**\n * The platform's copy for `locale`.\n *\n * One file, so one request. See the file comment for why the merchant's own\n * wording is not merged in here yet and what it is waiting on.\n */\n get: async (locale: string): Promise<TranslationMessages | null> => {\n const common = await readLocaleFile(commonTranslationsPath(locale));\n const base = common ?? (await readLegacyGlobal(locale));\n if (!base) return null;\n\n // Still wrapped in the `<locale>.trans` shape the rest of the engine reads.\n // `createI18nInstance` slices by that key and so does the SDK bridge in\n // `I18nProvider`; changing the envelope here would be a second change for\n // no gain, since one language is all any of them ever take out of it.\n return { [`${locale}.trans`]: base as Record<string, string> };\n },\n\n /**\n * This merchant's own wording for `locale`, or `null` if they have none.\n *\n * Only worth calling when `settings.languages[<ISO>].has_custom_translations`\n * says there is something to get. Most stores have never customised a word,\n * and a miss here is an uncached round trip — `cf-cache-status: DYNAMIC` on a\n * 404 — on the critical path of an SSR render. The flag is what makes this\n * free for everyone who does not use it.\n *\n * Returned unwrapped, unlike {@link translations.get}: this is merged into\n * that one's messages rather than handed to i18next on its own.\n */\n forStore: async (storeId: string | number, locale: string): Promise<Messages | null> =>\n // `failLoudly`, unlike the platform file: this is only ever called because\n // the settings said overrides exist, so a 500, a timeout or a body that is\n // not JSON is a failure to read them — not a store that has none. Returning\n // `null` there would cache \"no overrides\" as a success, skip the query's\n // retry, and serve Salla's wording in place of the merchant's until the\n // entry expired. A 404 still means absent, and `rootBeforeLoad` catches the\n // throw and keeps the platform copy, so the worst case is unchanged.\n readLocaleFile(storeTranslationsPath(storeId, locale), { failLoudly: true }),\n\n /**\n * The platform's copy for `locale` with this merchant's wording laid over it.\n *\n * Takes the two as values rather than fetching them, so the caller decides\n * whether the second request happens at all and both stay separately cached.\n */\n /**\n * The platform's copy for `locale` with this merchant's wording over it.\n *\n * Delegates to `composeMessages`, which every other reader of these two\n * entries also uses — see `api/messages.ts` for why there is exactly one.\n */\n merge: (\n common: TranslationMessages | null,\n overrides: Messages | null,\n locale: string\n ): TranslationMessages | null => composeMessages(common, overrides, locale) ?? null,\n\n queries: {\n /**\n * @param locale taken as an argument rather than read from the twilight\n * context, and that is load-bearing. This key is built on the server, on\n * hydration, and again lazily from the context accessor; if any of the\n * three read a locale the others had not been given yet, the hydrated page\n * would miss the dehydrated entry and refetch both files it was just\n * handed. Every caller already has the locale in hand.\n *\n * The store is deliberately **not** in the key. One document serves one\n * store — a request that names a different one is redirected with\n * `reloadDocument`, so the client never changes store under a live cache —\n * and adding a value that resolves from the request on the server and from\n * the injected env on the client is how a key stops matching across\n * hydration.\n */\n byLocale: (locale: string) =>\n queryOptions({\n queryKey: translationsQueryKey(locale),\n queryFn: () => translations.get(locale),\n }),\n\n /**\n * This merchant's overrides, cached apart from the platform's copy.\n *\n * Its own entry rather than a wider `byLocale` key, so the common file is\n * fetched and dehydrated once per language whatever the store does, and a\n * store with no overrides never has an entry at all. Both sides compute the\n * key from the settings payload, so the hydrated page finds what the server\n * dehydrated instead of refetching it.\n */\n byStore: (storeId: string | number, locale: string) =>\n queryOptions({\n queryKey: storeTranslationsQueryKey(storeId, locale),\n queryFn: () => translations.forStore(storeId, locale),\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/translations.ts"],"names":[],"mappings":";;;;AAiEA,IAAM,kBAAA,GAAqB,sBAAA;AAGpB,SAAS,uBAAuB,MAAA,EAAwB;AAC7D,EAAA,OAAO,uBAAuB,MAAM,CAAA,KAAA,CAAA;AACtC;AAWO,SAAS,qBAAA,CAAsB,SAA0B,MAAA,EAAwB;AACtF,EAAA,OAAO,CAAA,aAAA,EAAgB,OAAO,CAAA,CAAA,EAAI,MAAM,CAAA,KAAA,CAAA;AAC1C;AAUA,eAAe,eACb,IAAA,EACA,EAAE,aAAa,KAAA,EAAM,GAA8B,EAAC,EAC1B;AAE1B,EAAA,MAAM,UAAA,GAAa,CAAC,MAAA,EAAgB,KAAA,KAA0B;AAC5D,IAAA,IAAI,UAAA,EAAY,MAAM,IAAI,KAAA,CAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,EAAA,EAAK,MAAM,CAAA,CAAA,EAAI,EAAE,KAAA,EAAO,CAAA;AAC9E,IAAA,OAAA,CAAQ,IAAA,CAAK,gBAAA,EAAkB,MAAA,EAAQ,IAAA,EAAM,SAAS,EAAE,CAAA;AACxD,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,QAAA,GAAW,MAAM,QAAA,CAAS,GAAA,CAAI,IAAA,EAAM,EAAE,eAAA,EAAiB,KAAA,EAAO,OAAA,EAAS,GAAA,EAAM,CAAA;AACnF,IAAA,IAAI,QAAA,CAAS,MAAA,KAAW,GAAA,EAAK,OAAO,IAAA;AAE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merged: the platform's copy for this language, and the merchant's\n * own edits for this language and this store. Both are plain JSON objects on\n * the uploader's CDN, one per language.\n *\n * ```\n * https://cdn.files.salla.network/translations/common/<locale>.json the platform's\n * https://cdn.files.salla.network/translations/<storeId>/<locale>.json the merchant's\n * ```\n *\n * **What this replaces, and why.** Until now the engine read a single global\n * file, `cdn.salla.network/js/translations.json`, holding every language keyed\n * `\"<locale>.trans\"`. Nothing publishes that file: it is an object last written\n * on 2026-03-26, carrying only `ar` and `en` where the platform has 39 locales,\n * 405 keys behind `Languages-Module` and 959 English strings textually\n * different from it. So every React storefront has been serving copy from\n * March, and a key added since has never reached one. It also carried no\n * merchant overrides at all — a merchant editing their theme's wording in the\n * Dashboard changed nothing on a React theme.\n *\n * **Merchant overrides are read, and only when there are any.** Getting here\n * took two corrections worth keeping.\n *\n * The first is the address. A merchant's own wording lives at\n * `translations/<storeId>/<locale>.json`, keyed by `store()->getRouteKey()` —\n * the Optimus-encoded numeric id. An early version addressed it with\n * `resolveStoreIdentifier()`, on the claim that the two are the same string.\n * That is true of the `store-identifier` *header*, which accepts a host, a\n * username or an id, and false of the R2 key: on a custom domain the resolver\n * returns `reefperfumes.com` and on a shared host a username like\n * `mtgr-alaatr-2`. Both 404, both then read as \"this store has no overrides\",\n * and the merchant's wording silently never appears — so the feature would have\n * worked under `?storeId=` alone, which is preview and localhost. It is\n * `settings.store.id` now, which is known only after the settings query.\n *\n * The second is when to ask at all. Most stores have never customised a word,\n * and a miss is an uncached round trip (`cf-cache-status: DYNAMIC` on the 404)\n * on the critical path of every SSR render. So the request is made only when\n * `settings.languages[<ISO>].has_custom_translations` says there is something\n * to get — a flag `Languages-Module` writes when a merchant saves a\n * translation. A store without overrides pays nothing, which is what made this\n * shippable at all.\n *\n * ⚠️ The flag is written on save, so a store whose wording predates it reads as\n * `false` until someone edits a translation or the backfill runs. That is a\n * store keeping today's behaviour, not a regression — React themes have never\n * read merchant overrides — but it does mean the feature is only as complete as\n * the backfill.\n *\n * **Rollout is by fallback, not by flag.** `translations/common/` is written by\n * a sync in the theme build service that may not have run yet, and a hard switch\n * would leave every storefront with no platform strings at all. A missing common\n * file therefore falls back to the old global one, which is exactly today's\n * behaviour — so this is safe to ship before the bucket is populated, and stops\n * using the fallback on its own once it is.\n */\nimport { queryOptions } from '@tanstack/react-query';\nimport { cdn, filesCdn } from './client';\nimport { storeTranslationsQueryKey, translationsQueryKey } from './translations-key';\nimport { composeMessages, isPlainObject, type Messages } from './messages';\nimport type { TranslationMessages } from '../providers/I18nProvider';\n\n/** The global file this used to be the only reader of. See the file comment. */\nconst LEGACY_GLOBAL_FILE = 'js/translations.json';\n\n/** One language of platform copy, shared by every store. */\nexport function commonTranslationsPath(locale: string): string {\n return `translations/common/${locale}.json`;\n}\n\n/**\n * One language of a single merchant's own wording.\n *\n * `storeId` is `settings.store.id`, which is the value `Languages-Module` names\n * the object with (`store()->getRouteKey()`, the Optimus-encoded numeric id).\n * It is **not** `resolveStoreIdentifier()`: that returns a hostname on a custom\n * domain and a username on a shared host, both of which 404 here and would read\n * as \"this merchant has no overrides\" — silently, on every store but a preview.\n */\nexport function storeTranslationsPath(storeId: string | number, locale: string): string {\n return `translations/${storeId}/${locale}.json`;\n}\n\n/**\n * Reads one language file, or `null` when there is nothing to read.\n *\n * A 404 is the ordinary answer, not a failure: most stores have never had a\n * word customised, so their file does not exist. Distinguishing it from a real\n * error matters only for the log — both end in `null` — but a warning on every\n * page load of every uncustomised store is a warning nobody will read.\n */\nasync function readLocaleFile(\n path: string,\n { failLoudly = false }: { failLoudly?: boolean } = {}\n): Promise<Messages | null> {\n /** A 404 always means \"absent\"; everything else is a failure to read. */\n const unreadable = (reason: string, cause?: unknown): null => {\n if (failLoudly) throw new Error(`[translations] ${path}: ${reason}`, { cause });\n console.warn('[translations]', reason, path, cause ?? '');\n return null;\n };\n\n try {\n const response = await filesCdn.get(path, { throwHttpErrors: false, timeout: 5000 });\n if (response.status === 404) return null;\n\n if (!response.ok) {\n return unreadable(`answered ${response.status}`);\n }\n\n const data: unknown = await response.json();\n if (!isPlainObject(data)) {\n return unreadable('is not a JSON object');\n }\n\n return data;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith('[translations]')) throw error;\n return unreadable('could not be read', error);\n }\n}\n\n/**\n * The pre-CDN global file, sliced to one language.\n *\n * Only reached when `translations/common/<locale>.json` is missing, which is\n * the state of the bucket until the sync has run once.\n */\nasync function readLegacyGlobal(locale: string): Promise<Messages | null> {\n try {\n const data = await cdn.get(LEGACY_GLOBAL_FILE, { timeout: 5000 }).json<TranslationMessages>();\n const forLocale = data?.[`${locale}.trans`];\n return isPlainObject(forLocale) ? forLocale : null;\n } catch {\n console.warn('[translations] the legacy global file could not be read either');\n return null;\n }\n}\n\nexport const translations = {\n /**\n * The platform's copy for `locale`.\n *\n * One file, so one request. See the file comment for why the merchant's own\n * wording is not merged in here yet and what it is waiting on.\n */\n get: async (locale: string): Promise<TranslationMessages | null> => {\n const common = await readLocaleFile(commonTranslationsPath(locale));\n const base = common ?? (await readLegacyGlobal(locale));\n if (!base) return null;\n\n // Still wrapped in the `<locale>.trans` shape the rest of the engine reads.\n // `createI18nInstance` slices by that key and so does the SDK bridge in\n // `I18nProvider`; changing the envelope here would be a second change for\n // no gain, since one language is all any of them ever take out of it.\n return { [`${locale}.trans`]: base as Record<string, string> };\n },\n\n /**\n * This merchant's own wording for `locale`, or `null` if they have none.\n *\n * Only worth calling when `settings.languages[<ISO>].has_custom_translations`\n * says there is something to get. Most stores have never customised a word,\n * and a miss here is an uncached round trip — `cf-cache-status: DYNAMIC` on a\n * 404 — on the critical path of an SSR render. The flag is what makes this\n * free for everyone who does not use it.\n *\n * Returned unwrapped, unlike {@link translations.get}: this is merged into\n * that one's messages rather than handed to i18next on its own.\n */\n forStore: async (storeId: string | number, locale: string): Promise<Messages | null> =>\n // `failLoudly`, unlike the platform file: this is only ever called because\n // the settings said overrides exist, so a 500, a timeout or a body that is\n // not JSON is a failure to read them — not a store that has none. Returning\n // `null` there would cache \"no overrides\" as a success, skip the query's\n // retry, and serve Salla's wording in place of the merchant's until the\n // entry expired. A 404 still means absent, and `rootBeforeLoad` catches the\n // throw and keeps the platform copy, so the worst case is unchanged.\n readLocaleFile(storeTranslationsPath(storeId, locale), { failLoudly: true }),\n\n /**\n * The platform's copy for `locale` with this merchant's wording laid over it.\n *\n * Takes the two as values rather than fetching them, so the caller decides\n * whether the second request happens at all and both stay separately cached.\n */\n /**\n * The platform's copy for `locale` with this merchant's wording over it.\n *\n * Delegates to `composeMessages`, which every other reader of these two\n * entries also uses — see `api/messages.ts` for why there is exactly one.\n */\n merge: (\n common: TranslationMessages | null,\n overrides: Messages | null,\n locale: string\n ): TranslationMessages | null => composeMessages(common, overrides, locale) ?? null,\n\n queries: {\n /**\n * @param locale taken as an argument rather than read from the twilight\n * context, and that is load-bearing. This key is built on the server, on\n * hydration, and again lazily from the context accessor; if any of the\n * three read a locale the others had not been given yet, the hydrated page\n * would miss the dehydrated entry and refetch both files it was just\n * handed. Every caller already has the locale in hand.\n *\n * The store is deliberately **not** in the key. One document serves one\n * store — a request that names a different one is redirected with\n * `reloadDocument`, so the client never changes store under a live cache —\n * and adding a value that resolves from the request on the server and from\n * the injected env on the client is how a key stops matching across\n * hydration.\n */\n byLocale: (locale: string) =>\n queryOptions({\n queryKey: translationsQueryKey(locale),\n queryFn: () => translations.get(locale),\n }),\n\n /**\n * This merchant's overrides, cached apart from the platform's copy.\n *\n * Its own entry rather than a wider `byLocale` key, so the common file is\n * fetched and dehydrated once per language whatever the store does, and a\n * store with no overrides never has an entry at all. Both sides compute the\n * key from the settings payload, so the hydrated page finds what the server\n * dehydrated instead of refetching it.\n */\n byStore: (storeId: string | number, locale: string) =>\n queryOptions({\n queryKey: storeTranslationsQueryKey(storeId, locale),\n queryFn: () => translations.forStore(storeId, locale),\n }),\n },\n};\n"]}
@@ -1,7 +1,7 @@
1
- import { advertisement, advertisementsFor } from './chunk-VV5MI7CL.js';
1
+ import { advertisement, advertisementsFor } from './chunk-IAVHDEMZ.js';
2
2
  import { useTranslation } from './chunk-TYNZ5B2B.js';
3
- import { whenSallaReady } from './chunk-JCYX7HXB.js';
4
- import { subscribeTwilight, getTwilightContext } from './chunk-PLD6KSYE.js';
3
+ import { whenSallaReady } from './chunk-MZPX4EPS.js';
4
+ import { subscribeTwilight, getTwilightContext } from './chunk-MWUAHDQL.js';
5
5
  import { useSyncExternalStore, useState, useEffect } from 'react';
6
6
  import { useQuery } from '@tanstack/react-query';
7
7
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
@@ -99,5 +99,5 @@ function PageAdvertisements() {
99
99
  }
100
100
 
101
101
  export { PageAdvertisements };
102
- //# sourceMappingURL=chunk-KBOBADKK.js.map
103
- //# sourceMappingURL=chunk-KBOBADKK.js.map
102
+ //# sourceMappingURL=chunk-CRXXKAFW.js.map
103
+ //# sourceMappingURL=chunk-CRXXKAFW.js.map