@salla.sa/twilight-theme-engine 1.0.72 → 1.0.74

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 (304) hide show
  1. package/dist/{AddToCartForm-5KE3LZSE.js → AddToCartForm-H2PRWRO7.js} +8 -6
  2. package/dist/AddToCartForm-H2PRWRO7.js.map +1 -0
  3. package/dist/{BlogAuthorPage-ZE2H4IIQ.js → BlogAuthorPage-QDGBWGGT.js} +22 -22
  4. package/dist/{BlogAuthorPage-ZE2H4IIQ.js.map → BlogAuthorPage-QDGBWGGT.js.map} +1 -1
  5. package/dist/{BlogCategoryPage-Y5GBZV2E.js → BlogCategoryPage-BK4OL6T4.js} +22 -22
  6. package/dist/{BlogCategoryPage-Y5GBZV2E.js.map → BlogCategoryPage-BK4OL6T4.js.map} +1 -1
  7. package/dist/{BlogPage-WJ46QFWA.js → BlogPage-5LLIKUOQ.js} +20 -20
  8. package/dist/{BlogPage-WJ46QFWA.js.map → BlogPage-5LLIKUOQ.js.map} +1 -1
  9. package/dist/{BlogSinglePage-TWAW5FYE.js → BlogSinglePage-3BDXSFTY.js} +20 -20
  10. package/dist/{BlogSinglePage-TWAW5FYE.js.map → BlogSinglePage-3BDXSFTY.js.map} +1 -1
  11. package/dist/{BlogTagPage-GDSNBEUM.js → BlogTagPage-S77JPNEZ.js} +22 -22
  12. package/dist/{BlogTagPage-GDSNBEUM.js.map → BlogTagPage-S77JPNEZ.js.map} +1 -1
  13. package/dist/{BrandsPage-S5J5LPBJ.js → BrandsPage-2TJALMEG.js} +21 -21
  14. package/dist/{BrandsPage-S5J5LPBJ.js.map → BrandsPage-2TJALMEG.js.map} +1 -1
  15. package/dist/{Breadcrumb-JID6FMRH.js → Breadcrumb-SXC43X3D.js} +20 -20
  16. package/dist/{Breadcrumb-JID6FMRH.js.map → Breadcrumb-SXC43X3D.js.map} +1 -1
  17. package/dist/{CartItem-65SS67V5.js → CartItem-R6BYAM4O.js} +20 -20
  18. package/dist/{CartItem-65SS67V5.js.map → CartItem-R6BYAM4O.js.map} +1 -1
  19. package/dist/{CartSummary-N4JVOPO5.js → CartSummary-YQ2RMHID.js} +20 -20
  20. package/dist/{CartSummary-N4JVOPO5.js.map → CartSummary-YQ2RMHID.js.map} +1 -1
  21. package/dist/{Copyright-KMWFNZEF.js → Copyright-5VLQICDY.js} +3 -3
  22. package/dist/{Copyright-KMWFNZEF.js.map → Copyright-5VLQICDY.js.map} +1 -1
  23. package/dist/{CustomerLayout-RFFISOFD.js → CustomerLayout-DUT7BEKW.js} +20 -20
  24. package/dist/{CustomerLayout-RFFISOFD.js.map → CustomerLayout-DUT7BEKW.js.map} +1 -1
  25. package/dist/{Footer-NDSP2GVD.js → Footer-J2KXYFB3.js} +20 -20
  26. package/dist/{Footer-NDSP2GVD.js.map → Footer-J2KXYFB3.js.map} +1 -1
  27. package/dist/{Header-524EF77Y.js → Header-GZQINLEQ.js} +7 -7
  28. package/dist/{Header-524EF77Y.js.map → Header-GZQINLEQ.js.map} +1 -1
  29. package/dist/{LoyaltyPage-4BTICEVT.js → LoyaltyPage-IXLUF6MF.js} +20 -20
  30. package/dist/{LoyaltyPage-4BTICEVT.js.map → LoyaltyPage-IXLUF6MF.js.map} +1 -1
  31. package/dist/{LoyaltyPointsPage-D6S4DMGL.js → LoyaltyPointsPage-RDNXI5VY.js} +3 -3
  32. package/dist/{LoyaltyPointsPage-D6S4DMGL.js.map → LoyaltyPointsPage-RDNXI5VY.js.map} +1 -1
  33. package/dist/{MainMenu-KXNWUVAF.js → MainMenu-KNJDJFJX.js} +7 -7
  34. package/dist/{MainMenu-KXNWUVAF.js.map → MainMenu-KNJDJFJX.js.map} +1 -1
  35. package/dist/{MasterLayout-4PV6RJJN.js → MasterLayout-MFL2NYPF.js} +20 -20
  36. package/dist/{MasterLayout-4PV6RJJN.js.map → MasterLayout-MFL2NYPF.js.map} +1 -1
  37. package/dist/{MobileMenu-VJJ7BG56.js → MobileMenu-RXLYUAWL.js} +21 -21
  38. package/dist/{MobileMenu-VJJ7BG56.js.map → MobileMenu-RXLYUAWL.js.map} +1 -1
  39. package/dist/{NotificationsPage-PCWYS2WC.js → NotificationsPage-QSF7S2PD.js} +20 -20
  40. package/dist/{NotificationsPage-PCWYS2WC.js.map → NotificationsPage-QSF7S2PD.js.map} +1 -1
  41. package/dist/{OrderSinglePage-6MS5Q5GD.js → OrderSinglePage-CWBHU2C6.js} +28 -23
  42. package/dist/OrderSinglePage-CWBHU2C6.js.map +1 -0
  43. package/dist/{OrdersPage-UBGWPLRU.js → OrdersPage-L76IEAXR.js} +20 -20
  44. package/dist/{OrdersPage-UBGWPLRU.js.map → OrdersPage-L76IEAXR.js.map} +1 -1
  45. package/dist/{PageSingle-YFIFFSON.js → PageSingle-BUAZBPIQ.js} +6 -6
  46. package/dist/{PageSingle-YFIFFSON.js.map → PageSingle-BUAZBPIQ.js.map} +1 -1
  47. package/dist/{ProductDetails-PYWNF2YH.js → ProductDetails-MPNSWRTQ.js} +15 -7
  48. package/dist/ProductDetails-MPNSWRTQ.js.map +1 -0
  49. package/dist/{ProfilePage-F72TLSO5.js → ProfilePage-I72265CD.js} +20 -20
  50. package/dist/{ProfilePage-F72TLSO5.js.map → ProfilePage-I72265CD.js.map} +1 -1
  51. package/dist/ReviewsPage-M5GNHNZG.js +18 -0
  52. package/dist/ReviewsPage-M5GNHNZG.js.map +1 -0
  53. package/dist/{SeoCartWidget-TK2BVDFT.js → SeoCartWidget-KV3T3BO7.js} +20 -20
  54. package/dist/{SeoCartWidget-TK2BVDFT.js.map → SeoCartWidget-KV3T3BO7.js.map} +1 -1
  55. package/dist/{SettingsPage-4W5YIWPU.js → SettingsPage-3F5HZNXX.js} +20 -20
  56. package/dist/{SettingsPage-4W5YIWPU.js.map → SettingsPage-3F5HZNXX.js.map} +1 -1
  57. package/dist/{StoreClosedNotification-IV2JTVDU.js → StoreClosedNotification-65QIOIAM.js} +21 -21
  58. package/dist/{StoreClosedNotification-IV2JTVDU.js.map → StoreClosedNotification-65QIOIAM.js.map} +1 -1
  59. package/dist/{TestimonialsPage-YOQJQ2HD.js → TestimonialsPage-5U7PH4TT.js} +6 -6
  60. package/dist/{TestimonialsPage-YOQJQ2HD.js.map → TestimonialsPage-5U7PH4TT.js.map} +1 -1
  61. package/dist/{ThankYouPage-CRSSRVY7.js → ThankYouPage-HFUTJCRT.js} +20 -20
  62. package/dist/{ThankYouPage-CRSSRVY7.js.map → ThankYouPage-HFUTJCRT.js.map} +1 -1
  63. package/dist/{WalletPage-26HBCIHR.js → WalletPage-KURO6WSP.js} +21 -21
  64. package/dist/{WalletPage-26HBCIHR.js.map → WalletPage-KURO6WSP.js.map} +1 -1
  65. package/dist/{WishlistPage-AZ3DGIYV.js → WishlistPage-RLUK4JRD.js} +22 -22
  66. package/dist/{WishlistPage-AZ3DGIYV.js.map → WishlistPage-RLUK4JRD.js.map} +1 -1
  67. package/dist/api/apps.js +4 -4
  68. package/dist/api/blog.js +6 -6
  69. package/dist/api/brands.js +6 -6
  70. package/dist/api/cart.d.ts +1 -1
  71. package/dist/api/cart.d.ts.map +1 -1
  72. package/dist/api/cart.js +6 -6
  73. package/dist/api/category.js +6 -6
  74. package/dist/api/client.d.ts +6 -0
  75. package/dist/api/client.d.ts.map +1 -1
  76. package/dist/api/client.js +3 -3
  77. package/dist/api/home.js +4 -4
  78. package/dist/api/loyalty.js +6 -6
  79. package/dist/api/menu.js +4 -4
  80. package/dist/api/notification.js +4 -4
  81. package/dist/api/order.js +6 -6
  82. package/dist/api/page.js +6 -6
  83. package/dist/api/product.d.ts +20 -0
  84. package/dist/api/product.d.ts.map +1 -1
  85. package/dist/api/product.js +6 -6
  86. package/dist/api/profile.js +3 -3
  87. package/dist/api/store.d.ts +3 -1
  88. package/dist/api/store.d.ts.map +1 -1
  89. package/dist/api/store.js +4 -4
  90. package/dist/api/translations.js +4 -4
  91. package/dist/api/user.js +4 -4
  92. package/dist/api/wallet.js +4 -4
  93. package/dist/api/wishlist.js +7 -7
  94. package/dist/{chunk-3EE62REP.js → chunk-2OYXPNCE.js} +3 -3
  95. package/dist/{chunk-3EE62REP.js.map → chunk-2OYXPNCE.js.map} +1 -1
  96. package/dist/{chunk-YLSG4MEK.js → chunk-2ZQKAGSZ.js} +4 -4
  97. package/dist/{chunk-YLSG4MEK.js.map → chunk-2ZQKAGSZ.js.map} +1 -1
  98. package/dist/{chunk-RO6KBURF.js → chunk-3EBAXWBJ.js} +7 -6
  99. package/dist/chunk-3EBAXWBJ.js.map +1 -0
  100. package/dist/{chunk-4S3XHNUG.js → chunk-3EHECJ7M.js} +7 -6
  101. package/dist/chunk-3EHECJ7M.js.map +1 -0
  102. package/dist/{chunk-VFYT2VWC.js → chunk-3QT7JMAD.js} +13 -4
  103. package/dist/chunk-3QT7JMAD.js.map +1 -0
  104. package/dist/{chunk-OYP5CGHU.js → chunk-3TJKB3WR.js} +3 -3
  105. package/dist/{chunk-OYP5CGHU.js.map → chunk-3TJKB3WR.js.map} +1 -1
  106. package/dist/{chunk-WSXRUOI2.js → chunk-4VWWIA4M.js} +4 -4
  107. package/dist/{chunk-WSXRUOI2.js.map → chunk-4VWWIA4M.js.map} +1 -1
  108. package/dist/{chunk-DIVEHHMD.js → chunk-4YVGMXG7.js} +3 -3
  109. package/dist/{chunk-DIVEHHMD.js.map → chunk-4YVGMXG7.js.map} +1 -1
  110. package/dist/{chunk-5AFTFN72.js → chunk-5NUDOT33.js} +3 -3
  111. package/dist/{chunk-5AFTFN72.js.map → chunk-5NUDOT33.js.map} +1 -1
  112. package/dist/{chunk-MEPYG77L.js → chunk-6I4LWF5Y.js} +3 -3
  113. package/dist/{chunk-MEPYG77L.js.map → chunk-6I4LWF5Y.js.map} +1 -1
  114. package/dist/{chunk-JZ7BOB4G.js → chunk-6KVB2WHE.js} +4 -4
  115. package/dist/{chunk-JZ7BOB4G.js.map → chunk-6KVB2WHE.js.map} +1 -1
  116. package/dist/{chunk-BVSJPBJ6.js → chunk-6WI7R2BD.js} +14 -3
  117. package/dist/chunk-6WI7R2BD.js.map +1 -0
  118. package/dist/{chunk-BD4V56PZ.js → chunk-BLWLKRKH.js} +59 -28
  119. package/dist/chunk-BLWLKRKH.js.map +1 -0
  120. package/dist/{chunk-J427UFSZ.js → chunk-CJDAZQV6.js} +6 -6
  121. package/dist/{chunk-J427UFSZ.js.map → chunk-CJDAZQV6.js.map} +1 -1
  122. package/dist/{chunk-OGVUFMLX.js → chunk-D2T6246Q.js} +3 -3
  123. package/dist/{chunk-OGVUFMLX.js.map → chunk-D2T6246Q.js.map} +1 -1
  124. package/dist/chunk-E5O5ICIY.js +40 -0
  125. package/dist/chunk-E5O5ICIY.js.map +1 -0
  126. package/dist/{chunk-RSVAPXXI.js → chunk-E7EBWXCA.js} +23 -15
  127. package/dist/chunk-E7EBWXCA.js.map +1 -0
  128. package/dist/{chunk-LOMFLRJI.js → chunk-FIFNYC7B.js} +7 -7
  129. package/dist/{chunk-LOMFLRJI.js.map → chunk-FIFNYC7B.js.map} +1 -1
  130. package/dist/{chunk-7VYI6EF4.js → chunk-FVDUTMH6.js} +4 -4
  131. package/dist/{chunk-7VYI6EF4.js.map → chunk-FVDUTMH6.js.map} +1 -1
  132. package/dist/{chunk-L5K7VBOH.js → chunk-GFSTJ2PF.js} +3 -3
  133. package/dist/{chunk-L5K7VBOH.js.map → chunk-GFSTJ2PF.js.map} +1 -1
  134. package/dist/{chunk-MFR2WJBJ.js → chunk-IDY6OEXA.js} +8 -8
  135. package/dist/{chunk-MFR2WJBJ.js.map → chunk-IDY6OEXA.js.map} +1 -1
  136. package/dist/{chunk-EXBH6RGD.js → chunk-IK57LAIA.js} +19 -5
  137. package/dist/chunk-IK57LAIA.js.map +1 -0
  138. package/dist/{chunk-B5FDWE4U.js → chunk-JAPH535M.js} +4 -4
  139. package/dist/{chunk-B5FDWE4U.js.map → chunk-JAPH535M.js.map} +1 -1
  140. package/dist/{chunk-3IHFA2X5.js → chunk-JEG5WPNT.js} +3 -3
  141. package/dist/{chunk-3IHFA2X5.js.map → chunk-JEG5WPNT.js.map} +1 -1
  142. package/dist/{chunk-34VXOUQT.js → chunk-JHCLU3PS.js} +8 -8
  143. package/dist/{chunk-34VXOUQT.js.map → chunk-JHCLU3PS.js.map} +1 -1
  144. package/dist/{chunk-N56EGFBC.js → chunk-JNZLH2OR.js} +58 -9
  145. package/dist/chunk-JNZLH2OR.js.map +1 -0
  146. package/dist/{chunk-3CYIB6BL.js → chunk-KO3HG5GQ.js} +3 -3
  147. package/dist/{chunk-3CYIB6BL.js.map → chunk-KO3HG5GQ.js.map} +1 -1
  148. package/dist/{chunk-MISI3T6V.js → chunk-M6BXZTRK.js} +3 -3
  149. package/dist/{chunk-MISI3T6V.js.map → chunk-M6BXZTRK.js.map} +1 -1
  150. package/dist/{chunk-NZOXKPCW.js → chunk-MEMB7JYJ.js} +4 -4
  151. package/dist/{chunk-NZOXKPCW.js.map → chunk-MEMB7JYJ.js.map} +1 -1
  152. package/dist/{chunk-SDIQHTDG.js → chunk-OKNJFS44.js} +4 -4
  153. package/dist/{chunk-SDIQHTDG.js.map → chunk-OKNJFS44.js.map} +1 -1
  154. package/dist/{chunk-WNGLJJVH.js → chunk-OQA2MKZA.js} +30 -17
  155. package/dist/chunk-OQA2MKZA.js.map +1 -0
  156. package/dist/{chunk-ZGHRSRDO.js → chunk-OUW6WESU.js} +3 -2
  157. package/dist/chunk-OUW6WESU.js.map +1 -0
  158. package/dist/{chunk-YKFGUVF7.js → chunk-P2YAPWMS.js} +5 -4
  159. package/dist/chunk-P2YAPWMS.js.map +1 -0
  160. package/dist/{chunk-QVJDYSCT.js → chunk-P4GOLSA2.js} +3 -3
  161. package/dist/{chunk-QVJDYSCT.js.map → chunk-P4GOLSA2.js.map} +1 -1
  162. package/dist/{chunk-5DPR7GWH.js → chunk-PNM4NP4U.js} +3 -3
  163. package/dist/{chunk-5DPR7GWH.js.map → chunk-PNM4NP4U.js.map} +1 -1
  164. package/dist/{chunk-52ETYODY.js → chunk-R72Q5Z6M.js} +4 -4
  165. package/dist/{chunk-52ETYODY.js.map → chunk-R72Q5Z6M.js.map} +1 -1
  166. package/dist/{chunk-HBTIZWT2.js → chunk-RYSJOCHI.js} +3 -3
  167. package/dist/{chunk-HBTIZWT2.js.map → chunk-RYSJOCHI.js.map} +1 -1
  168. package/dist/{chunk-XVNXXF67.js → chunk-TWVTIAMO.js} +3 -3
  169. package/dist/{chunk-XVNXXF67.js.map → chunk-TWVTIAMO.js.map} +1 -1
  170. package/dist/{chunk-2ALN2BPM.js → chunk-VYCNB6VN.js} +3 -3
  171. package/dist/{chunk-2ALN2BPM.js.map → chunk-VYCNB6VN.js.map} +1 -1
  172. package/dist/chunk-WG47KLHH.js +14 -0
  173. package/dist/{chunk-DRMTTDZU.js.map → chunk-WG47KLHH.js.map} +1 -1
  174. package/dist/{chunk-IO77BQGI.js → chunk-WHGOO4A2.js} +6 -6
  175. package/dist/{chunk-IO77BQGI.js.map → chunk-WHGOO4A2.js.map} +1 -1
  176. package/dist/{chunk-25FWAL3O.js → chunk-WS3WQ3OL.js} +4 -4
  177. package/dist/{chunk-25FWAL3O.js.map → chunk-WS3WQ3OL.js.map} +1 -1
  178. package/dist/{chunk-UAY6LTWB.js → chunk-XN7TVPAU.js} +4 -4
  179. package/dist/{chunk-UAY6LTWB.js.map → chunk-XN7TVPAU.js.map} +1 -1
  180. package/dist/{chunk-LPQFTXBB.js → chunk-Y5OGXJLH.js} +10 -3
  181. package/dist/chunk-Y5OGXJLH.js.map +1 -0
  182. package/dist/{chunk-R5MZV6KW.js → chunk-YUGZDWD6.js} +4 -4
  183. package/dist/{chunk-R5MZV6KW.js.map → chunk-YUGZDWD6.js.map} +1 -1
  184. package/dist/components/cart/index.js +1 -1
  185. package/dist/components/common/index.js +1 -1
  186. package/dist/components/drawer/index.js +18 -18
  187. package/dist/components/home/ReorderProducts.d.ts +7 -0
  188. package/dist/components/home/ReorderProducts.d.ts.map +1 -0
  189. package/dist/components/home/SquarePhotos.d.ts +2 -1
  190. package/dist/components/home/SquarePhotos.d.ts.map +1 -1
  191. package/dist/components/home/index.d.ts +2 -0
  192. package/dist/components/home/index.d.ts.map +1 -1
  193. package/dist/components/home/index.js +22 -22
  194. package/dist/components/home/reorder-hooks.d.ts +6 -0
  195. package/dist/components/home/reorder-hooks.d.ts.map +1 -0
  196. package/dist/components/layout/index.js +1 -1
  197. package/dist/components/product/AddToCartForm.d.ts.map +1 -1
  198. package/dist/components/product/ProductDetails.d.ts.map +1 -1
  199. package/dist/components/product/index.js +19 -19
  200. package/dist/components/snippets/AppsSnippets.d.ts +2 -0
  201. package/dist/components/snippets/AppsSnippets.d.ts.map +1 -1
  202. package/dist/components/store/index.js +20 -20
  203. package/dist/components/toast/index.js +4 -4
  204. package/dist/document-class-5FTU6EZE.js +25 -0
  205. package/dist/{document-class-FIAXRNEM.js.map → document-class-5FTU6EZE.js.map} +1 -1
  206. package/dist/hooks/index.js +18 -18
  207. package/dist/hooks/useComments.js +3 -3
  208. package/dist/hooks/useCoupon.d.ts +0 -41
  209. package/dist/hooks/useCoupon.d.ts.map +1 -1
  210. package/dist/hooks/useCoupon.js +3 -1
  211. package/dist/hooks/useGtm.js +18 -18
  212. package/dist/hooks/useMoney.js +18 -18
  213. package/dist/hooks/useProduct.js +3 -3
  214. package/dist/hooks/useStore.js +18 -18
  215. package/dist/hooks/useUser.js +5 -5
  216. package/dist/hooks/useWishlist.d.ts.map +1 -1
  217. package/dist/hooks/useWishlist.js +4 -1
  218. package/dist/index.js +18 -18
  219. package/dist/native-app/index.js +3 -3
  220. package/dist/navigation-CDITJYUW.js +13 -0
  221. package/dist/{navigation-P3GZOWUU.js.map → navigation-CDITJYUW.js.map} +1 -1
  222. package/dist/{navigation-TA3I3XEC.js → navigation-WCGV6RUK.js} +5 -5
  223. package/dist/{navigation-TA3I3XEC.js.map → navigation-WCGV6RUK.js.map} +1 -1
  224. package/dist/{not-found-SCNJYKWP.js → not-found-EL2XQE5D.js} +59 -33
  225. package/dist/not-found-EL2XQE5D.js.map +1 -0
  226. package/dist/providers/index.js +18 -18
  227. package/dist/providers/twilight-init.d.ts.map +1 -1
  228. package/dist/router/route-ids.d.ts +1 -0
  229. package/dist/router/route-ids.d.ts.map +1 -1
  230. package/dist/routes/account/orders/single/OrderHeader.d.ts.map +1 -1
  231. package/dist/routes/account/orders.js +7 -7
  232. package/dist/routes/account.js +16 -16
  233. package/dist/routes/blog.js +11 -11
  234. package/dist/routes/brands.js +7 -7
  235. package/dist/routes/cart.js +26 -26
  236. package/dist/routes/home/HomePage.d.ts.map +1 -1
  237. package/dist/routes/home.js +23 -23
  238. package/dist/routes/index.d.ts +1 -1
  239. package/dist/routes/index.d.ts.map +1 -1
  240. package/dist/routes/index.js +4 -4
  241. package/dist/routes/loyalty.js +8 -8
  242. package/dist/routes/page.js +7 -7
  243. package/dist/routes/product/index.d.ts.map +1 -1
  244. package/dist/routes/product-listing/ProductListPage.d.ts.map +1 -1
  245. package/dist/routes/product-listing/loader.d.ts.map +1 -1
  246. package/dist/routes/product-listing/types.d.ts +1 -1
  247. package/dist/routes/product-listing/types.d.ts.map +1 -1
  248. package/dist/routes/product-listing.js +205 -184
  249. package/dist/routes/product-listing.js.map +1 -1
  250. package/dist/routes/product-short-link.d.ts +9 -5
  251. package/dist/routes/product-short-link.d.ts.map +1 -1
  252. package/dist/routes/product.js +23 -23
  253. package/dist/routes/product.js.map +1 -1
  254. package/dist/routes/seo-redirects.js +4 -4
  255. package/dist/routes/testimonials/ReviewsPage.d.ts +3 -0
  256. package/dist/routes/testimonials/ReviewsPage.d.ts.map +1 -0
  257. package/dist/routes/testimonials/index.d.ts +15 -3
  258. package/dist/routes/testimonials/index.d.ts.map +1 -1
  259. package/dist/routes/testimonials/loader.d.ts +3 -1
  260. package/dist/routes/testimonials/loader.d.ts.map +1 -1
  261. package/dist/routes/testimonials/types.d.ts +3 -0
  262. package/dist/routes/testimonials/types.d.ts.map +1 -1
  263. package/dist/routes/testimonials.js +38 -3
  264. package/dist/routes/testimonials.js.map +1 -1
  265. package/dist/routes/thank-you.js +7 -7
  266. package/dist/skeleton.js +23 -23
  267. package/dist/tanstack/document-class.d.ts.map +1 -1
  268. package/dist/tanstack/router.d.ts.map +1 -1
  269. package/dist/tanstack.js +16 -16
  270. package/dist/types/index.d.ts +3 -1
  271. package/dist/types/index.d.ts.map +1 -1
  272. package/dist/types/salla-sdk.d.ts +4 -0
  273. package/dist/types/salla-sdk.d.ts.map +1 -1
  274. package/dist/utils/cookies.d.ts +5 -0
  275. package/dist/utils/cookies.d.ts.map +1 -1
  276. package/dist/utils/index.js +5 -4
  277. package/dist/utils/index.js.map +1 -1
  278. package/dist/utils/sdk-events.d.ts +6 -0
  279. package/dist/utils/sdk-events.d.ts.map +1 -1
  280. package/dist/vite/adapters/tanstack.adapter.d.ts.map +1 -1
  281. package/dist/vite/index.js +83 -8
  282. package/dist/vite/index.js.map +1 -1
  283. package/package.json +1 -1
  284. package/dist/AddToCartForm-5KE3LZSE.js.map +0 -1
  285. package/dist/OrderSinglePage-6MS5Q5GD.js.map +0 -1
  286. package/dist/ProductDetails-PYWNF2YH.js.map +0 -1
  287. package/dist/chunk-4S3XHNUG.js.map +0 -1
  288. package/dist/chunk-5ZR2HKZ7.js +0 -14
  289. package/dist/chunk-5ZR2HKZ7.js.map +0 -1
  290. package/dist/chunk-BD4V56PZ.js.map +0 -1
  291. package/dist/chunk-BVSJPBJ6.js.map +0 -1
  292. package/dist/chunk-DRMTTDZU.js +0 -14
  293. package/dist/chunk-EXBH6RGD.js.map +0 -1
  294. package/dist/chunk-LPQFTXBB.js.map +0 -1
  295. package/dist/chunk-N56EGFBC.js.map +0 -1
  296. package/dist/chunk-RO6KBURF.js.map +0 -1
  297. package/dist/chunk-RSVAPXXI.js.map +0 -1
  298. package/dist/chunk-VFYT2VWC.js.map +0 -1
  299. package/dist/chunk-WNGLJJVH.js.map +0 -1
  300. package/dist/chunk-YKFGUVF7.js.map +0 -1
  301. package/dist/chunk-ZGHRSRDO.js.map +0 -1
  302. package/dist/document-class-FIAXRNEM.js +0 -25
  303. package/dist/navigation-P3GZOWUU.js +0 -13
  304. package/dist/not-found-SCNJYKWP.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/inline-script.ts","../src/utils/runtime-env.ts","../src/utils/store-identity.ts","../src/utils/sdk-helpers.ts"],"names":[],"mappings":";;;;AAMO,SAAS,sBAAsB,KAAA,EAAuB;AAC3D,EAAA,OAAO,MACJ,OAAA,CAAQ,IAAA,EAAM,SAAS,CAAA,CACvB,OAAA,CAAQ,MAAM,SAAS,CAAA,CACvB,QAAQ,IAAA,EAAM,SAAS,EACvB,OAAA,CAAQ,SAAA,EAAW,SAAS,CAAA,CAC5B,OAAA,CAAQ,WAAW,SAAS,CAAA;AACjC;;;ACRA,IAAM,eAAA,GAAkB,uBAAA;AAsCjB,SAAS,QAAQ,GAAA,EAAiC;AACvD,EAAA,IAAI;AACF,IAAA,MAAM,IAAA,GAAQ,MAAA,CAAA,IAAA,CAAwE,GAAA,GACpF,GACF,CAAA;AACA,IAAA,IAAI,MAAM,OAAO,IAAA;AAAA,EACnB,CAAA,CAAA,MAAQ;AAAA,EAER;AACA,EAAA,OAAO,OAAO,OAAA,KAAY,WAAA,GAAc,OAAA,CAAQ,GAAA,GAAM,GAAG,CAAA,GAAI,MAAA;AAC/D;AAOO,SAAS,iBAAA,GAAgC;AAC9C,EAAA,MAAM,WAAW,qBAAA,EAAsB;AACvC,EAAA,MAAM,EAAE,OAAA,EAAS,SAAA,EAAW,SAAA,EAAW,WAAA,KAAgB,eAAA,EAAgB;AACvE,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,QAAA,CAAS,OAAA,IAAW,OAAA,CAAQ,cAAc,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAMnD,eAAA,EACE,QAAA,CAAS,eAAA,IACT,OAAA,IACA,SAAA,KACC,mBAAA,CAAoB,WAAW,CAAA,GAAI,WAAA,GAAc,IAAA,CAAA,IAClD,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AA,IAAI,CAAC,GAAA,EAAK;AACV,EAAA,MAAM,SAAA,GAAY,UAAU,cAAc,CAAA;AAC1C,EAAA,IAAI;AACF,IAAA,IAAI,SAAA,IAAa,MAAM,GAAA,CAAI,GAAA,EAAK,YAAY,cAAA,EAAgB,MAAA,CAAO,SAAS,CAAC,CAAA;AAAA,gBACjE,GAAA,CAAI,GAAA,EAAK,OAAO,QAAA,EAAU,OAAA,EAAS,SAAS,cAAc,CAAA;AAAA,EACxE,CAAA,CAAA,MAAQ;AAAA,EAER;AACF","file":"chunk-QVJDYSCT.js","sourcesContent":["/**\n * Escape a JSON-stringified value for safe embedding inside an inline `<script>` body.\n *\n * The head injects script bodies raw, so a `</script>` inside partner-set data would break out\n * of the tag; U+2028/U+2029 are line terminators in JS but not in JSON, so they must go too.\n */\nexport function escapeForInlineScript(value: string): string {\n return value\n .replace(/</g, '\\\\u003c')\n .replace(/>/g, '\\\\u003e')\n .replace(/&/g, '\\\\u0026')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n}\n","import { escapeForInlineScript } from './inline-script';\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore } from './cookies';\n\n/** Where `rootHead` publishes the SSR-resolved env for the browser bundle to read. */\nconst RUNTIME_ENV_KEY = '__SALLA_RUNTIME_ENV__';\n\n/** The env values that must agree between the SSR render and the hydrated client. */\nexport interface RuntimeEnv {\n /** Store API base — `VITE_API_URL`. */\n apiBase?: string;\n /** Store identifier — `VITE_STORE_DOMAIN`. */\n storeIdentifier?: string;\n /**\n * The theme-settings version the request named, if any.\n *\n * Published for the same reason `storeIdentifier` is: the dispatcher strips\n * `?versionId=` on the way in, so by the time the browser has the page its own\n * URL no longer says which version it is showing. Without this the hydrated\n * client would ask the API about the store's live version and quietly replace\n * the draft it was handed.\n *\n * Absent — not empty — when nothing named one, so it drops out of the inline\n * script entirely rather than publishing a value that means \"live\".\n */\n versionId?: string;\n /**\n * The store segment at the root of this page's paths, when the store is\n * addressed that way — see `resolveStoreBase`.\n *\n * Published because the browser's address is not always the URL the server\n * read: the dispatcher removes `?storeId=` from the request it forwards but not\n * from the address bar, and a URL carrying it is never read for a segment. The\n * client builds its router from this, and a router that disagreed with the\n * server about the root would hydrate a different page.\n */\n storeBase?: string;\n}\n\n/**\n * A build-time `import.meta.env` var, falling back to the worker's runtime `process.env`\n * (wrangler `vars`, exposed via the `nodejs_compat_populate_process_env` flag).\n */\nexport function readEnv(key: string): string | undefined {\n try {\n const vite = (import.meta as unknown as { env?: Record<string, string | undefined> }).env?.[\n key\n ];\n if (vite) return vite;\n } catch {\n /* import.meta.env not available in all environments */\n }\n return typeof process !== 'undefined' ? process.env?.[key] : undefined;\n}\n\n/**\n * What this runtime resolves from its own env — server-side that includes the worker vars.\n * Prefers what the server already published, so re-rendering the head during hydration yields\n * the same script instead of dropping it.\n */\nexport function resolveRuntimeEnv(): RuntimeEnv {\n const injected = getInjectedRuntimeEnv();\n const { storeId, storeBase, versionId, requestHost } = getRequestStore();\n return {\n apiBase: injected.apiBase || readEnv('VITE_API_URL'),\n // The request outranks the build-time var here for the same reason it does\n // in `resolveStoreIdentifier`, and this is the copy that reaches the\n // browser: publish the store SSR actually rendered, or hydration resolves\n // again from a URL whose `?storeId=` the dispatcher has already stripped and\n // queries a different store than the markup it is hydrating.\n storeIdentifier:\n injected.storeIdentifier ||\n storeId ||\n storeBase ||\n (hostIdentifiesStore(requestHost) ? requestHost : null) ||\n readEnv('VITE_STORE_DOMAIN'),\n // Absent rather than empty when the path named no store, so it drops out of\n // the inline script, like `versionId`.\n storeBase: injected.storeBase || storeBase || undefined,\n // No env fallback on purpose. A store identifier has one because a build can\n // legitimately be pinned to a store; a version is something a request asks\n // for, and a build-time default would make every visitor of every store see\n // whichever draft was current when the theme was compiled.\n versionId: injected.versionId || versionId || undefined,\n };\n}\n\n/**\n * The env the SSR worker resolved, as handed to the browser by `rootHead`. Empty on the server\n * and on a client whose head carried nothing.\n *\n * Worker `vars` are *runtime* env: they live in `process.env` on the server only, while\n * `import.meta.env` is substituted at build time. A bundle built without those vars therefore\n * sees `undefined` in the browser and silently falls back to the production defaults — SSR\n * would render off the configured backend while every post-hydration fetch hits another one.\n */\nexport function getInjectedRuntimeEnv(): RuntimeEnv {\n const holder = globalThis as typeof globalThis & { [RUNTIME_ENV_KEY]?: RuntimeEnv };\n return holder[RUNTIME_ENV_KEY] ?? {};\n}\n\n/**\n * Inline head `<script>` body publishing the server-resolved env, or null when there is nothing\n * to publish (no overrides configured — the defaults already agree on both sides).\n */\nexport function renderRuntimeEnvScript(env: RuntimeEnv = resolveRuntimeEnv()): string | null {\n const set = Object.entries(env).filter(([, value]) => Boolean(value));\n if (!set.length) return null;\n const json = escapeForInlineScript(JSON.stringify(Object.fromEntries(set)));\n return `window.${RUNTIME_ENV_KEY}=${json};`;\n}\n","/**\n * @fileoverview Which store to ask about — the one answer, in one place.\n *\n * This lived in two places once. `api/store.ts` learned to read the store a\n * request names, and `utils/sdk-helpers.ts` — the copy `api/client.ts` actually\n * sets the `store-identifier` header from — did not. So the resolver that had\n * been taught the answer was consulted for a null check and thrown away, every\n * outgoing request carried an empty identifier, the API answered\n * `422 Store Identifier not found`, and every published theme rendered\n * \"Store Unavailable\" while its tests passed: the client's suite mocked the\n * resolver, and the resolver's suite never went near a request.\n *\n * Hence one module, imported by both. If a third place ever needs a store\n * identifier, it imports this — a second implementation is the bug, not a\n * refactor away from it.\n *\n * See `docs/store-identity.md` for the full picture, including the security\n * boundary on who may name a store.\n */\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore, resolveRequestStoreBase } from './cookies';\nimport { getInjectedRuntimeEnv, readEnv } from './runtime-env';\nimport { storeBaseRedirectHref } from './store-base';\n\n/**\n * Which store to ask about, in the order the answers can be trusted.\n *\n * A deployed theme worker is published with **no vars and no bindings** — the\n * script metadata carries `main_module`, compatibility settings, assets and tags\n * and nothing else — so `VITE_STORE_DOMAIN` exists only where a build baked it\n * in, which is local development. In production this function used to reach the\n * end of that chain and return the empty string, `store.settings` refused to\n * call with no identifier, and the root loader threw \"Store Unavailable\" — a\n * theme that renders its own failure page for every visitor of every store.\n *\n * The order:\n *\n * 1. what the caller passed, which is always deliberate;\n * 2. the store this request names — the `?storeId=` a preview was opened with,\n * then the cookie remembering it — seeded by `twilightMiddleware`, and only\n * on a host permitted to name one;\n * 3. the store the first segment of the path names, on those same hosts — its\n * username, which the API accepts as an identifier as readily as an id (see\n * {@link resolveStoreBase});\n * 4. what SSR already resolved and published, so the hydrated client asks about\n * the same store the server rendered instead of resolving again from a URL\n * that no longer names it;\n * 5. the request's own host, which *is* the identity of a live storefront —\n * but only when that host is a storefront. `preview.salla.design` and\n * `localhost` serve many stores, so their names identify none;\n * 6. `VITE_STORE_DOMAIN`, last, because a build-time constant is a development\n * convenience and must never outrank what the request actually said.\n *\n * Steps 2 and 3 never both answer: a path that names a store takes the place of\n * the cookie, and a URL carrying `?storeId=` is not read for a path segment.\n */\nexport function resolveStoreIdentifier(explicit?: string): string {\n if (explicit) return explicit;\n\n const { storeId, requestHost } = getRequestStore();\n if (storeId) return storeId;\n\n const storeBase = resolveStoreBase();\n if (storeBase) return storeBase;\n\n const injected = getInjectedRuntimeEnv().storeIdentifier;\n if (injected) return injected;\n\n if (hostIdentifiesStore(requestHost)) return requestHost as string;\n\n // The browser's own address, for a client render that reached neither of the\n // above — a live storefront, where the host is the store.\n const browserHost = typeof window !== 'undefined' ? window.location.host : null;\n if (hostIdentifiesStore(browserHost)) return browserHost as string;\n\n return readEnv('VITE_STORE_DOMAIN') || readEnv('STORE_DOMAIN') || '';\n}\n\n/**\n * The store segment at the root of this page's paths, or null when the store is\n * not addressed that way.\n *\n * On the server it is what `twilightMiddleware` read off the request. In the\n * browser it is what SSR published, because the address bar is not always the\n * URL the server rendered: on the preview host the dispatcher removes\n * `?storeId=` from the request it forwards and leaves it in the browser's, and a\n * URL carrying `storeId` is never read for a segment. Re-reading\n * `window.location` would, for `/ar?storeId=…`, route the page under a different\n * store than the one it was rendered for.\n *\n * The address bar is read only when SSR published nothing at all: a page the dev\n * server answered with its client shell instead of a render, where there is no\n * server decision to agree with.\n */\nexport function resolveStoreBase(): string | null {\n const { storeBase } = getRequestStore();\n if (storeBase) return storeBase;\n if (typeof window === 'undefined') return null;\n\n const published = getInjectedRuntimeEnv();\n if (published.storeBase) return published.storeBase;\n if (Object.keys(published).length > 0) return null;\n\n return resolveRequestStoreBase(window.location.href, window.location.host);\n}\n\n/**\n * The address this page should be loaded from instead, when the store is the root\n * of every URL on this host and this request did not use it; null otherwise.\n *\n * @param username - the store's username, from the settings the request loaded\n * @param href - the router's own href for the page, without any store segment\n *\n * See `storeBaseRedirectHref` for the rules. The host is the request's on the\n * server and the browser's own in the browser, so the decision is gated the same\n * way on both sides.\n */\nexport function resolveStoreBaseRedirect(\n username: string | null | undefined,\n href: string\n): string | null {\n const host =\n getRequestStore().requestHost ?? (typeof window !== 'undefined' ? window.location.host : null);\n return storeBaseRedirectHref({ host, base: resolveStoreBase(), username, href });\n}\n","export type { StoreContext } from '../api/store';\nimport type { StoreContext } from '../api/store';\nimport type { SallaSDK } from '../types/salla-sdk';\nimport { resolveStoreIdentifier } from './store-identity';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Which store to ask the API about — see {@link resolveStoreIdentifier}.\n *\n * A delegation, not a second implementation. This name is the one on the wire\n * (`api/client.ts` sets the `store-identifier` header from it) and the one\n * themes import from `@salla.sa/twilight-theme-engine/utils`, so it stays; what\n * it must never do again is answer differently from the resolver everything\n * else asks. It had its own copy of the order once, missing the store the\n * request names and preferring the build-time `VITE_STORE_DOMAIN` that a\n * deployed worker does not have — so every published theme sent an empty\n * identifier and rendered \"Store Unavailable\".\n */\nexport function getStoreIdentifier(explicit?: string): string {\n return resolveStoreIdentifier(explicit);\n}\n\n/**\n * Get Salla SDK instance if available\n */\nexport function getSallaSDK(): typeof window.salla | undefined {\n if (!isBrowser) return undefined;\n return window.salla;\n}\n\n/** Dispatched on `window` by the SDK as the last step of loading (twilight `src/index.js`). */\nconst SDK_CREATED_EVENT = 'salla::created';\n\nconst noop = () => {};\n\n/**\n * Whether `window.salla` is the SDK, rather than the stub that stands in for it.\n *\n * ⚠️ `window.salla` exists from the first bytes of the page. The `twilight-init`\n * head script defines it with an `onReady`, so app snippets can queue work, and\n * the SDK — a deferred module — fills it in later. React can hydrate and run\n * effects in between, and there `window.salla?.event.on(…)` passes its `?.` and\n * throws `Cannot read properties of undefined (reading 'on')`.\n *\n * The SDK defines `init` and `event` in one synchronous module evaluation and the\n * stub has neither, so either one means it has loaded.\n */\nfunction isLoaded(sdk: typeof window.salla): sdk is SallaSDK {\n return typeof sdk?.init === 'function' || typeof sdk?.event?.on === 'function';\n}\n\n/** An SDK whose event bus can take a listener — what {@link onSallaEvent} needs. */\nfunction hasEventBus(sdk: typeof window.salla): sdk is SallaSDK {\n return typeof sdk?.event?.on === 'function';\n}\n\n/**\n * Run `callback` with the SDK as soon as it has loaded: now if it has, otherwise\n * when it announces itself.\n *\n * Returns a cancel for an effect's cleanup, so a component that unmounts first\n * never has the callback run. An effect that returned early when the SDK was not\n * there yet never ran again — on a cold load, where hydration beats the SDK, the\n * engine never initialised it at all.\n */\nexport function whenSallaLoaded(callback: (sdk: SallaSDK) => void): () => void {\n return whenSalla(isLoaded, callback);\n}\n\nfunction whenSalla(\n isUsable: (sdk: typeof window.salla) => sdk is SallaSDK,\n callback: (sdk: SallaSDK) => void\n): () => void {\n if (!isBrowser) return noop;\n\n if (isUsable(window.salla)) {\n callback(window.salla);\n return noop;\n }\n\n let settled = false;\n const onCreated = () => {\n const sdk = window.salla;\n if (settled || !isUsable(sdk)) return;\n settled = true;\n window.removeEventListener(SDK_CREATED_EVENT, onCreated);\n callback(sdk);\n };\n window.addEventListener(SDK_CREATED_EVENT, onCreated);\n\n return () => {\n settled = true;\n window.removeEventListener(SDK_CREATED_EVENT, onCreated);\n };\n}\n\n/**\n * Run `callback` once the SDK has loaded **and been initialised** — for work that\n * talks to the API, which needs the store config `init` sets.\n *\n * Loaded is not enough for that: `init` finishes asynchronously, so a cart lookup\n * made the moment the SDK announces itself goes out without a store identifier\n * and is answered `Store Identifier not found`. Returns a cancel, as\n * {@link whenSallaLoaded} does.\n *\n * A rejected `onReady` still runs `callback`, as `useTwilightInit` carries on past\n * one: it means a partial initialisation, and waiting on it would leave the caller\n * waiting for good.\n */\nexport function whenSallaReady(callback: (sdk: SallaSDK) => void): () => void {\n let cancelled = false;\n const cancel = whenSallaLoaded((sdk) => {\n void new Promise((resolve) => resolve(sdk.onReady?.())).catch(noop).then(() => {\n if (!cancelled) callback(sdk);\n });\n });\n return () => {\n cancelled = true;\n cancel();\n };\n}\n\n/**\n * `salla.event.on(name, listener)` once the SDK has loaded. Returns the matching\n * unsubscribe, which also cancels a subscription still waiting for the SDK.\n *\n * Removed from the emitter it was added to, not from whatever `window.salla` is\n * by the time the component unmounts.\n *\n * Waits for an event bus specifically, not for \"loaded\": an SDK is recognised by\n * `init` alone, and subscribing on one without a bus would throw.\n */\nexport function onSallaEvent(name: string, listener: (...args: unknown[]) => void): () => void {\n let bus: SallaSDK['event'] | undefined;\n const cancel = whenSalla(hasEventBus, (sdk) => {\n bus = sdk.event;\n bus.on(name, listener);\n });\n return () => {\n cancel();\n bus?.off?.(name, listener);\n };\n}\n\n/**\n * Push the active route locale onto the Salla SDK.\n *\n * Why this is needed (and why it must run on every navigation):\n * - The SDK seeds its locale from `navigator.language` — the theme sets no `s-lang`\n * cookie or `window.locale` — so an English browser starts the SDK in `en` even on\n * an `/ar` store.\n * - The SDK fixes its axios `accept-language` header ONCE, at init. `salla.lang.setLocale`\n * only swaps UI translations (it never touches the header), and `salla.init()` is a\n * no-op after `Salla.status === 'ready'`, so the header never refreshes on its own.\n * - `profile::info.fetched` (login / profile refresh on navigation) overrides the header\n * to the *account's* language.\n *\n * Net result without this: `salla.api.*` calls (cart/product details) return data in the\n * wrong locale — e.g. English cart item names on `/ar/cart` — intermittently, depending on\n * load order and whether a profile fetch ran. Re-asserting the URL locale here keeps the\n * header correct. No-op on the server and until the SDK exposes the methods.\n */\nexport function syncSdkLocale(locale: string): void {\n const sdk = getSallaSDK();\n if (!sdk || !locale) return;\n try {\n sdk.lang?.setLocale?.(locale);\n sdk.api?.setHeader?.('accept-language', locale);\n // The localization modal swaps `/${user.language_code}/` in the URL on submit;\n // the SDK never sets this locally, so without it the switch reloads the same page.\n sdk.config?.set?.('user.language_code', locale);\n } catch {\n // SDK partially loaded — the header is re-asserted on the next navigation.\n }\n}\n\n/**\n * Push the theme version the current settings name onto the Salla SDK.\n *\n * The SDK copies `settings.headers` into its axios defaults ONCE, at init, and\n * `s-version-id` is one of them. Settings refetched on the client — the shopper\n * switched market, and each market has its own version — name a different one,\n * and without this every `salla.api.*` call keeps asking for the previous\n * market's version until a full page load. Settings that name no version take\n * the header off instead, so the SDK asks for the live one like the engine's own\n * client does. No-op on the server and until the SDK exposes its api.\n */\nexport function syncSdkThemeVersion(headers: StoreContext['headers']): void {\n const sdk = getSallaSDK();\n if (!sdk) return;\n const versionId = headers?.['s-version-id'];\n try {\n if (versionId != null) sdk.api?.setHeader?.('s-version-id', String(versionId));\n else delete sdk.api?.axios?.defaults?.headers?.common?.['s-version-id'];\n } catch {\n // SDK partially loaded — the header is re-asserted on the next navigation.\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/inline-script.ts","../src/utils/runtime-env.ts","../src/utils/store-identity.ts","../src/utils/sdk-helpers.ts"],"names":[],"mappings":";;;;AAMO,SAAS,sBAAsB,KAAA,EAAuB;AAC3D,EAAA,OAAO,MACJ,OAAA,CAAQ,IAAA,EAAM,SAAS,CAAA,CACvB,OAAA,CAAQ,MAAM,SAAS,CAAA,CACvB,QAAQ,IAAA,EAAM,SAAS,EACvB,OAAA,CAAQ,SAAA,EAAW,SAAS,CAAA,CAC5B,OAAA,CAAQ,WAAW,SAAS,CAAA;AACjC;;;ACRA,IAAM,eAAA,GAAkB,uBAAA;AAsC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AAA,GAAA,GAAM,GAAA,CAAI,KAAA;AACV,IAAA,GAAA,CAAI,EAAA,CAAG,MAAM,QAAQ,CAAA;AAAA,EACvB,CAAC,CAAA;AACD,EAAA,OAAO,MAAM;AACX,IAAA,MAAA,EAAO;AACP,IAAA,GAAA,EAAK,GAAA,GAAM,MAAM,QAAQ,CAAA;AAAA,EAC3B,CAAA;AACF;AAoBO,SAAS,cAAc,MAAA,EAAsB;AAClD,EAAA,MAAM,MAAM,WAAA,EAAY;AACxB,EAAA,IAAI,CAAC,GAAA,IAAO,CAAC,MAAA,EAAQ;AACrB,EAAA,IAAI;AACF,IAAA,GAAA,CAAI,IAAA,EAAM,YAAY,MAAM,CAAA;AAC5B,IAAA,GAAA,CAAI,GAAA,EAAK,SAAA,GAAY,iBAAA,EAAmB,MAAM,CAAA;AAG9C,IAAA,GAAA,CAAI,MAAA,EAAQ,GAAA,GAAM,oBAAA,EAAsB,MAAM,CAAA;AAAA,EAChD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF;AAaO,SAAS,oBAAoB,OAAA,EAAwC;AAC1E,EAAA,MAAM,MAAM,WAAA,EAAY;AACxB,EAAA,IAAI,CAAC,GAAA,EAAK;AACV,EAAA,MAAM,SAAA,GAAY,UAAU,cAAc,CAAA;AAC1C,EAAA,IAAI;AACF,IAAA,IAAI,SAAA,IAAa,MAAM,GAAA,CAAI,GAAA,EAAK,YAAY,cAAA,EAAgB,MAAA,CAAO,SAAS,CAAC,CAAA;AAAA,gBACjE,GAAA,CAAI,GAAA,EAAK,OAAO,QAAA,EAAU,OAAA,EAAS,SAAS,cAAc,CAAA;AAAA,EACxE,CAAA,CAAA,MAAQ;AAAA,EAER;AACF","file":"chunk-P4GOLSA2.js","sourcesContent":["/**\n * Escape a JSON-stringified value for safe embedding inside an inline `<script>` body.\n *\n * The head injects script bodies raw, so a `</script>` inside partner-set data would break out\n * of the tag; U+2028/U+2029 are line terminators in JS but not in JSON, so they must go too.\n */\nexport function escapeForInlineScript(value: string): string {\n return value\n .replace(/</g, '\\\\u003c')\n .replace(/>/g, '\\\\u003e')\n .replace(/&/g, '\\\\u0026')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n}\n","import { escapeForInlineScript } from './inline-script';\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore } from './cookies';\n\n/** Where `rootHead` publishes the SSR-resolved env for the browser bundle to read. */\nconst RUNTIME_ENV_KEY = '__SALLA_RUNTIME_ENV__';\n\n/** The env values that must agree between the SSR render and the hydrated client. */\nexport interface RuntimeEnv {\n /** Store API base — `VITE_API_URL`. */\n apiBase?: string;\n /** Store identifier — `VITE_STORE_DOMAIN`. */\n storeIdentifier?: string;\n /**\n * The theme-settings version the request named, if any.\n *\n * Published for the same reason `storeIdentifier` is: the dispatcher strips\n * `?versionId=` on the way in, so by the time the browser has the page its own\n * URL no longer says which version it is showing. Without this the hydrated\n * client would ask the API about the store's live version and quietly replace\n * the draft it was handed.\n *\n * Absent — not empty — when nothing named one, so it drops out of the inline\n * script entirely rather than publishing a value that means \"live\".\n */\n versionId?: string;\n /**\n * The store segment at the root of this page's paths, when the store is\n * addressed that way — see `resolveStoreBase`.\n *\n * Published because the browser's address is not always the URL the server\n * read: the dispatcher removes `?storeId=` from the request it forwards but not\n * from the address bar, and a URL carrying it is never read for a segment. The\n * client builds its router from this, and a router that disagreed with the\n * server about the root would hydrate a different page.\n */\n storeBase?: string;\n}\n\n/**\n * A build-time `import.meta.env` var, falling back to the worker's runtime `process.env`\n * (wrangler `vars`, exposed via the `nodejs_compat_populate_process_env` flag).\n */\nexport function readEnv(key: string): string | undefined {\n try {\n const vite = (import.meta as unknown as { env?: Record<string, string | undefined> }).env?.[\n key\n ];\n if (vite) return vite;\n } catch {\n /* import.meta.env not available in all environments */\n }\n return typeof process !== 'undefined' ? process.env?.[key] : undefined;\n}\n\n/**\n * What this runtime resolves from its own env — server-side that includes the worker vars.\n * Prefers what the server already published, so re-rendering the head during hydration yields\n * the same script instead of dropping it.\n */\nexport function resolveRuntimeEnv(): RuntimeEnv {\n const injected = getInjectedRuntimeEnv();\n const { storeId, storeBase, versionId, requestHost } = getRequestStore();\n return {\n apiBase: injected.apiBase || readEnv('VITE_API_URL'),\n // The request outranks the build-time var here for the same reason it does\n // in `resolveStoreIdentifier`, and this is the copy that reaches the\n // browser: publish the store SSR actually rendered, or hydration resolves\n // again from a URL whose `?storeId=` the dispatcher has already stripped and\n // queries a different store than the markup it is hydrating.\n storeIdentifier:\n injected.storeIdentifier ||\n storeId ||\n storeBase ||\n (hostIdentifiesStore(requestHost) ? requestHost : null) ||\n readEnv('VITE_STORE_DOMAIN'),\n // Absent rather than empty when the path named no store, so it drops out of\n // the inline script, like `versionId`.\n storeBase: injected.storeBase || storeBase || undefined,\n // No env fallback on purpose. A store identifier has one because a build can\n // legitimately be pinned to a store; a version is something a request asks\n // for, and a build-time default would make every visitor of every store see\n // whichever draft was current when the theme was compiled.\n versionId: injected.versionId || versionId || undefined,\n };\n}\n\n/**\n * The env the SSR worker resolved, as handed to the browser by `rootHead`. Empty on the server\n * and on a client whose head carried nothing.\n *\n * Worker `vars` are *runtime* env: they live in `process.env` on the server only, while\n * `import.meta.env` is substituted at build time. A bundle built without those vars therefore\n * sees `undefined` in the browser and silently falls back to the production defaults — SSR\n * would render off the configured backend while every post-hydration fetch hits another one.\n */\nexport function getInjectedRuntimeEnv(): RuntimeEnv {\n const holder = globalThis as typeof globalThis & { [RUNTIME_ENV_KEY]?: RuntimeEnv };\n return holder[RUNTIME_ENV_KEY] ?? {};\n}\n\n/**\n * Inline head `<script>` body publishing the server-resolved env, or null when there is nothing\n * to publish (no overrides configured — the defaults already agree on both sides).\n */\nexport function renderRuntimeEnvScript(env: RuntimeEnv = resolveRuntimeEnv()): string | null {\n const set = Object.entries(env).filter(([, value]) => Boolean(value));\n if (!set.length) return null;\n const json = escapeForInlineScript(JSON.stringify(Object.fromEntries(set)));\n return `window.${RUNTIME_ENV_KEY}=${json};`;\n}\n","/**\n * @fileoverview Which store to ask about — the one answer, in one place.\n *\n * This lived in two places once. `api/store.ts` learned to read the store a\n * request names, and `utils/sdk-helpers.ts` — the copy `api/client.ts` actually\n * sets the `store-identifier` header from — did not. So the resolver that had\n * been taught the answer was consulted for a null check and thrown away, every\n * outgoing request carried an empty identifier, the API answered\n * `422 Store Identifier not found`, and every published theme rendered\n * \"Store Unavailable\" while its tests passed: the client's suite mocked the\n * resolver, and the resolver's suite never went near a request.\n *\n * Hence one module, imported by both. If a third place ever needs a store\n * identifier, it imports this — a second implementation is the bug, not a\n * refactor away from it.\n *\n * See `docs/store-identity.md` for the full picture, including the security\n * boundary on who may name a store.\n */\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore, resolveRequestStoreBase } from './cookies';\nimport { getInjectedRuntimeEnv, readEnv } from './runtime-env';\nimport { storeBaseRedirectHref } from './store-base';\n\n/**\n * Which store to ask about, in the order the answers can be trusted.\n *\n * A deployed theme worker is published with **no vars and no bindings** — the\n * script metadata carries `main_module`, compatibility settings, assets and tags\n * and nothing else — so `VITE_STORE_DOMAIN` exists only where a build baked it\n * in, which is local development. In production this function used to reach the\n * end of that chain and return the empty string, `store.settings` refused to\n * call with no identifier, and the root loader threw \"Store Unavailable\" — a\n * theme that renders its own failure page for every visitor of every store.\n *\n * The order:\n *\n * 1. what the caller passed, which is always deliberate;\n * 2. the store this request names — the `?storeId=` a preview was opened with,\n * then the cookie remembering it — seeded by `twilightMiddleware`, and only\n * on a host permitted to name one;\n * 3. the store the first segment of the path names, on those same hosts — its\n * username, which the API accepts as an identifier as readily as an id (see\n * {@link resolveStoreBase});\n * 4. what SSR already resolved and published, so the hydrated client asks about\n * the same store the server rendered instead of resolving again from a URL\n * that no longer names it;\n * 5. the request's own host, which *is* the identity of a live storefront —\n * but only when that host is a storefront. `preview.salla.design` and\n * `localhost` serve many stores, so their names identify none;\n * 6. `VITE_STORE_DOMAIN`, last, because a build-time constant is a development\n * convenience and must never outrank what the request actually said.\n *\n * Steps 2 and 3 never both answer: a path that names a store takes the place of\n * the cookie, and a URL carrying `?storeId=` is not read for a path segment.\n */\nexport function resolveStoreIdentifier(explicit?: string): string {\n if (explicit) return explicit;\n\n const { storeId, requestHost } = getRequestStore();\n if (storeId) return storeId;\n\n const storeBase = resolveStoreBase();\n if (storeBase) return storeBase;\n\n const injected = getInjectedRuntimeEnv().storeIdentifier;\n if (injected) return injected;\n\n if (hostIdentifiesStore(requestHost)) return requestHost as string;\n\n // The browser's own address, for a client render that reached neither of the\n // above — a live storefront, where the host is the store.\n const browserHost = typeof window !== 'undefined' ? window.location.host : null;\n if (hostIdentifiesStore(browserHost)) return browserHost as string;\n\n return readEnv('VITE_STORE_DOMAIN') || readEnv('STORE_DOMAIN') || '';\n}\n\n/**\n * The store segment at the root of this page's paths, or null when the store is\n * not addressed that way.\n *\n * On the server it is what `twilightMiddleware` read off the request. In the\n * browser it is what SSR published, because the address bar is not always the\n * URL the server rendered: on the preview host the dispatcher removes\n * `?storeId=` from the request it forwards and leaves it in the browser's, and a\n * URL carrying `storeId` is never read for a segment. Re-reading\n * `window.location` would, for `/ar?storeId=…`, route the page under a different\n * store than the one it was rendered for.\n *\n * The address bar is read only when SSR published nothing at all: a page the dev\n * server answered with its client shell instead of a render, where there is no\n * server decision to agree with.\n */\nexport function resolveStoreBase(): string | null {\n const { storeBase } = getRequestStore();\n if (storeBase) return storeBase;\n if (typeof window === 'undefined') return null;\n\n const published = getInjectedRuntimeEnv();\n if (published.storeBase) return published.storeBase;\n if (Object.keys(published).length > 0) return null;\n\n return resolveRequestStoreBase(window.location.href, window.location.host);\n}\n\n/**\n * The address this page should be loaded from instead, when the store is the root\n * of every URL on this host and this request did not use it; null otherwise.\n *\n * @param username - the store's username, from the settings the request loaded\n * @param href - the router's own href for the page, without any store segment\n *\n * See `storeBaseRedirectHref` for the rules. The host is the request's on the\n * server and the browser's own in the browser, so the decision is gated the same\n * way on both sides.\n */\nexport function resolveStoreBaseRedirect(\n username: string | null | undefined,\n href: string\n): string | null {\n const host =\n getRequestStore().requestHost ?? (typeof window !== 'undefined' ? window.location.host : null);\n return storeBaseRedirectHref({ host, base: resolveStoreBase(), username, href });\n}\n","export type { StoreContext } from '../api/store';\nimport type { StoreContext } from '../api/store';\nimport type { SallaSDK } from '../types/salla-sdk';\nimport { resolveStoreIdentifier } from './store-identity';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Which store to ask the API about — see {@link resolveStoreIdentifier}.\n *\n * A delegation, not a second implementation. This name is the one on the wire\n * (`api/client.ts` sets the `store-identifier` header from it) and the one\n * themes import from `@salla.sa/twilight-theme-engine/utils`, so it stays; what\n * it must never do again is answer differently from the resolver everything\n * else asks. It had its own copy of the order once, missing the store the\n * request names and preferring the build-time `VITE_STORE_DOMAIN` that a\n * deployed worker does not have — so every published theme sent an empty\n * identifier and rendered \"Store Unavailable\".\n */\nexport function getStoreIdentifier(explicit?: string): string {\n return resolveStoreIdentifier(explicit);\n}\n\n/**\n * Get Salla SDK instance if available\n */\nexport function getSallaSDK(): typeof window.salla | undefined {\n if (!isBrowser) return undefined;\n return window.salla;\n}\n\n/** Dispatched on `window` by the SDK as the last step of loading (twilight `src/index.js`). */\nconst SDK_CREATED_EVENT = 'salla::created';\n\nconst noop = () => {};\n\n/**\n * Whether `window.salla` is the SDK, rather than the stub that stands in for it.\n *\n * ⚠️ `window.salla` exists from the first bytes of the page. The `twilight-init`\n * head script defines it with an `onReady`, so app snippets can queue work, and\n * the SDK — a deferred module — fills it in later. React can hydrate and run\n * effects in between, and there `window.salla?.event.on(…)` passes its `?.` and\n * throws `Cannot read properties of undefined (reading 'on')`.\n *\n * The SDK defines `init` and `event` in one synchronous module evaluation and the\n * stub has neither, so either one means it has loaded.\n */\nfunction isLoaded(sdk: typeof window.salla): sdk is SallaSDK {\n return typeof sdk?.init === 'function' || typeof sdk?.event?.on === 'function';\n}\n\n/** An SDK whose event bus can take a listener — what {@link onSallaEvent} needs. */\nfunction hasEventBus(sdk: typeof window.salla): sdk is SallaSDK {\n return typeof sdk?.event?.on === 'function';\n}\n\n/**\n * Run `callback` with the SDK as soon as it has loaded: now if it has, otherwise\n * when it announces itself.\n *\n * Returns a cancel for an effect's cleanup, so a component that unmounts first\n * never has the callback run. An effect that returned early when the SDK was not\n * there yet never ran again — on a cold load, where hydration beats the SDK, the\n * engine never initialised it at all.\n */\nexport function whenSallaLoaded(callback: (sdk: SallaSDK) => void): () => void {\n return whenSalla(isLoaded, callback);\n}\n\nfunction whenSalla(\n isUsable: (sdk: typeof window.salla) => sdk is SallaSDK,\n callback: (sdk: SallaSDK) => void\n): () => void {\n if (!isBrowser) return noop;\n\n if (isUsable(window.salla)) {\n callback(window.salla);\n return noop;\n }\n\n let settled = false;\n const onCreated = () => {\n const sdk = window.salla;\n if (settled || !isUsable(sdk)) return;\n settled = true;\n window.removeEventListener(SDK_CREATED_EVENT, onCreated);\n callback(sdk);\n };\n window.addEventListener(SDK_CREATED_EVENT, onCreated);\n\n return () => {\n settled = true;\n window.removeEventListener(SDK_CREATED_EVENT, onCreated);\n };\n}\n\n/**\n * Run `callback` once the SDK has loaded **and been initialised** — for work that\n * talks to the API, which needs the store config `init` sets.\n *\n * Loaded is not enough for that: `init` finishes asynchronously, so a cart lookup\n * made the moment the SDK announces itself goes out without a store identifier\n * and is answered `Store Identifier not found`. Returns a cancel, as\n * {@link whenSallaLoaded} does.\n *\n * A rejected `onReady` still runs `callback`, as `useTwilightInit` carries on past\n * one: it means a partial initialisation, and waiting on it would leave the caller\n * waiting for good.\n */\nexport function whenSallaReady(callback: (sdk: SallaSDK) => void): () => void {\n let cancelled = false;\n const cancel = whenSallaLoaded((sdk) => {\n void new Promise((resolve) => resolve(sdk.onReady?.())).catch(noop).then(() => {\n if (!cancelled) callback(sdk);\n });\n });\n return () => {\n cancelled = true;\n cancel();\n };\n}\n\n/**\n * `salla.event.on(name, listener)` once the SDK has loaded. Returns the matching\n * unsubscribe, which also cancels a subscription still waiting for the SDK.\n *\n * Removed from the emitter it was added to, not from whatever `window.salla` is\n * by the time the component unmounts.\n *\n * Waits for an event bus specifically, not for \"loaded\": an SDK is recognised by\n * `init` alone, and subscribing on one without a bus would throw.\n */\nexport function onSallaEvent(name: string, listener: (...args: unknown[]) => void): () => void {\n let bus: SallaSDK['event'] | undefined;\n const cancel = whenSalla(hasEventBus, (sdk) => {\n bus = sdk.event;\n bus.on(name, listener);\n });\n return () => {\n cancel();\n bus?.off?.(name, listener);\n };\n}\n\n/**\n * Push the active route locale onto the Salla SDK.\n *\n * Why this is needed (and why it must run on every navigation):\n * - The SDK seeds its locale from `navigator.language` — the theme sets no `s-lang`\n * cookie or `window.locale` — so an English browser starts the SDK in `en` even on\n * an `/ar` store.\n * - The SDK fixes its axios `accept-language` header ONCE, at init. `salla.lang.setLocale`\n * only swaps UI translations (it never touches the header), and `salla.init()` is a\n * no-op after `Salla.status === 'ready'`, so the header never refreshes on its own.\n * - `profile::info.fetched` (login / profile refresh on navigation) overrides the header\n * to the *account's* language.\n *\n * Net result without this: `salla.api.*` calls (cart/product details) return data in the\n * wrong locale — e.g. English cart item names on `/ar/cart` — intermittently, depending on\n * load order and whether a profile fetch ran. Re-asserting the URL locale here keeps the\n * header correct. No-op on the server and until the SDK exposes the methods.\n */\nexport function syncSdkLocale(locale: string): void {\n const sdk = getSallaSDK();\n if (!sdk || !locale) return;\n try {\n sdk.lang?.setLocale?.(locale);\n sdk.api?.setHeader?.('accept-language', locale);\n // The localization modal swaps `/${user.language_code}/` in the URL on submit;\n // the SDK never sets this locally, so without it the switch reloads the same page.\n sdk.config?.set?.('user.language_code', locale);\n } catch {\n // SDK partially loaded — the header is re-asserted on the next navigation.\n }\n}\n\n/**\n * Push the theme version the current settings name onto the Salla SDK.\n *\n * The SDK copies `settings.headers` into its axios defaults ONCE, at init, and\n * `s-version-id` is one of them. Settings refetched on the client — the shopper\n * switched market, and each market has its own version — name a different one,\n * and without this every `salla.api.*` call keeps asking for the previous\n * market's version until a full page load. Settings that name no version take\n * the header off instead, so the SDK asks for the live one like the engine's own\n * client does. No-op on the server and until the SDK exposes its api.\n */\nexport function syncSdkThemeVersion(headers: StoreContext['headers']): void {\n const sdk = getSallaSDK();\n if (!sdk) return;\n const versionId = headers?.['s-version-id'];\n try {\n if (versionId != null) sdk.api?.setHeader?.('s-version-id', String(versionId));\n else delete sdk.api?.axios?.defaults?.headers?.common?.['s-version-id'];\n } catch {\n // SDK partially loaded — the header is re-asserted on the next navigation.\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { api } from './chunk-EXBH6RGD.js';
1
+ import { api } from './chunk-IK57LAIA.js';
2
2
  import { queryOptions } from '@tanstack/react-query';
3
3
 
4
4
  var notification = {
@@ -24,5 +24,5 @@ var notification = {
24
24
  };
25
25
 
26
26
  export { notification };
27
- //# sourceMappingURL=chunk-5DPR7GWH.js.map
28
- //# sourceMappingURL=chunk-5DPR7GWH.js.map
27
+ //# sourceMappingURL=chunk-PNM4NP4U.js.map
28
+ //# sourceMappingURL=chunk-PNM4NP4U.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/notification.ts"],"names":[],"mappings":";;;AAcO,IAAM,YAAA,GAAe;AAAA,EAC1B,MAAM,YAAgD;AACpD,IAAA,MAAM,WAAW,MAAM,GAAA,CACpB,GAAA,CAAI,eAAe,EACnB,IAAA,EAAmF;AACtF,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,QAAA,CAAS,IAAA,IAAQ,EAAC;AAAA,MACxB,QAAQ,QAAA,CAAS;AAAA,KACnB;AAAA,EACF,CAAA;AAAA,EAEA,UAAA,EAAY,OAAO,EAAA,KAA8B;AAC/C,IAAA,MAAM,IAAI,GAAA,CAAI,CAAA,cAAA,EAAiB,EAAE,CAAA,KAAA,CAAO,EAAE,IAAA,EAAK;AAAA,EACjD,CAAA;AAAA,EAEA,eAAe,YAA2B;AACxC,IAAA,MAAM,GAAA,CAAI,GAAA,CAAI,wBAAwB,CAAA,CAAE,IAAA,EAAK;AAAA,EAC/C,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,MACJ,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,eAAA,EAAiB,MAAM,CAAA;AAAA,MAClC,OAAA,EAAS,MAAM,YAAA,CAAa,IAAA;AAAK,KAClC;AAAA;AAEP","file":"chunk-5DPR7GWH.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { Notification } from '../routes/account/notifications/types';\n\nexport interface NotificationsListResponse {\n data: Notification[];\n cursor: {\n current: number;\n previous: number | null;\n next: number | null;\n count: number;\n };\n}\n\nexport const notification = {\n list: async (): Promise<NotificationsListResponse> => {\n const response = await api\n .get('notifications')\n .json<{ data: Notification[] | null; cursor: NotificationsListResponse['cursor'] }>();\n return {\n data: response.data ?? [],\n cursor: response.cursor,\n };\n },\n\n markAsRead: async (id: number): Promise<void> => {\n await api.put(`notifications/${id}/read`).json();\n },\n\n markAllAsRead: async (): Promise<void> => {\n await api.put('notifications/read-all').json();\n },\n\n queries: {\n list: () =>\n queryOptions({\n queryKey: ['notifications', 'list'],\n queryFn: () => notification.list(),\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/notification.ts"],"names":[],"mappings":";;;AAcO,IAAM,YAAA,GAAe;AAAA,EAC1B,MAAM,YAAgD;AACpD,IAAA,MAAM,WAAW,MAAM,GAAA,CACpB,GAAA,CAAI,eAAe,EACnB,IAAA,EAAmF;AACtF,IAAA,OAAO;AAAA,MACL,IAAA,EAAM,QAAA,CAAS,IAAA,IAAQ,EAAC;AAAA,MACxB,QAAQ,QAAA,CAAS;AAAA,KACnB;AAAA,EACF,CAAA;AAAA,EAEA,UAAA,EAAY,OAAO,EAAA,KAA8B;AAC/C,IAAA,MAAM,IAAI,GAAA,CAAI,CAAA,cAAA,EAAiB,EAAE,CAAA,KAAA,CAAO,EAAE,IAAA,EAAK;AAAA,EACjD,CAAA;AAAA,EAEA,eAAe,YAA2B;AACxC,IAAA,MAAM,GAAA,CAAI,GAAA,CAAI,wBAAwB,CAAA,CAAE,IAAA,EAAK;AAAA,EAC/C,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,MACJ,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,eAAA,EAAiB,MAAM,CAAA;AAAA,MAClC,OAAA,EAAS,MAAM,YAAA,CAAa,IAAA;AAAK,KAClC;AAAA;AAEP","file":"chunk-PNM4NP4U.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { Notification } from '../routes/account/notifications/types';\n\nexport interface NotificationsListResponse {\n data: Notification[];\n cursor: {\n current: number;\n previous: number | null;\n next: number | null;\n count: number;\n };\n}\n\nexport const notification = {\n list: async (): Promise<NotificationsListResponse> => {\n const response = await api\n .get('notifications')\n .json<{ data: Notification[] | null; cursor: NotificationsListResponse['cursor'] }>();\n return {\n data: response.data ?? [],\n cursor: response.cursor,\n };\n },\n\n markAsRead: async (id: number): Promise<void> => {\n await api.put(`notifications/${id}/read`).json();\n },\n\n markAllAsRead: async (): Promise<void> => {\n await api.put('notifications/read-all').json();\n },\n\n queries: {\n list: () =>\n queryOptions({\n queryKey: ['notifications', 'list'],\n queryFn: () => notification.list(),\n }),\n },\n};\n"]}
@@ -1,5 +1,5 @@
1
- import { rememberProductPreview } from './chunk-VFYT2VWC.js';
2
- import { getActiveScope, api } from './chunk-EXBH6RGD.js';
1
+ import { rememberProductPreview } from './chunk-3QT7JMAD.js';
2
+ import { getActiveScope, api } from './chunk-IK57LAIA.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
5
5
  var wishlist = {
@@ -31,5 +31,5 @@ var wishlist = {
31
31
  };
32
32
 
33
33
  export { wishlist };
34
- //# sourceMappingURL=chunk-52ETYODY.js.map
35
- //# sourceMappingURL=chunk-52ETYODY.js.map
34
+ //# sourceMappingURL=chunk-R72Q5Z6M.js.map
35
+ //# sourceMappingURL=chunk-R72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AAA,MACX,QAAA,EAAU,CAAC,UAAA,EAAY,MAAA,EAAQ,QAAQ,EAAE,KAAA,EAAO,cAAA,EAAe,EAAG,CAAA;AAAA,MAClE,OAAA,EAAS,CAAC,EAAE,MAAA,EAAO,KAAM,QAAA,CAAS,IAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,MAAA,EAAQ;AAAA,KAC7D;AAAA;AAEP","file":"chunk-52ETYODY.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport {\n rememberProductPreview,\n type ProductsListResult,\n type ProductsListResponse,\n} from './product';\n\nexport interface WishlistListParams {\n page?: number;\n perPage?: number;\n filterable?: boolean;\n signal?: AbortSignal;\n}\n\n/**\n * Wishlist API — page-based pagination only.\n * Kept separate from product.list to avoid mixing cursor and page pagination strategies.\n */\nexport const wishlist = {\n list: async (params: WishlistListParams = {}): Promise<ProductsListResult> => {\n const { page = 1, perPage = 15, filterable, signal } = params;\n\n const searchParams = new URLSearchParams();\n searchParams.set('source', 'wishlist');\n searchParams.set('page', String(page));\n searchParams.set('per_page', String(perPage));\n\n if (filterable !== undefined) {\n searchParams.set('filterable', filterable ? '1' : '0');\n }\n\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`products?${searchParams.toString()}`, options as any)\n .json<ProductsListResponse>();\n\n const items = response.data ?? [];\n for (const item of items) rememberProductPreview(item);\n\n return {\n items,\n next: response.cursor?.next ?? null,\n };\n },\n\n queries: {\n list: (params: Omit<WishlistListParams, 'signal'>) =>\n queryOptions({\n queryKey: ['wishlist', 'list', params, { scope: getActiveScope() }],\n queryFn: ({ signal }) => wishlist.list({ ...params, signal }),\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/wishlist.ts"],"names":[],"mappings":";;;;AAmBO,IAAM,QAAA,GAAW;AAAA,EACtB,IAAA,EAAM,OAAO,MAAA,GAA6B,EAAC,KAAmC;AAC5E,IAAA,MAAM,EAAE,IAAA,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MAAA,EAAQ,MAAA,EAAQ;AAAA,KAC7D;AAAA;AAEP","file":"chunk-R72Q5Z6M.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport {\n rememberProductPreview,\n type ProductsListResult,\n type ProductsListResponse,\n} from './product';\n\nexport interface WishlistListParams {\n page?: number;\n perPage?: number;\n filterable?: boolean;\n signal?: AbortSignal;\n}\n\n/**\n * Wishlist API — page-based pagination only.\n * Kept separate from product.list to avoid mixing cursor and page pagination strategies.\n */\nexport const wishlist = {\n list: async (params: WishlistListParams = {}): Promise<ProductsListResult> => {\n const { page = 1, perPage = 15, filterable, signal } = params;\n\n const searchParams = new URLSearchParams();\n searchParams.set('source', 'wishlist');\n searchParams.set('page', String(page));\n searchParams.set('per_page', String(perPage));\n\n if (filterable !== undefined) {\n searchParams.set('filterable', filterable ? '1' : '0');\n }\n\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`products?${searchParams.toString()}`, options as any)\n .json<ProductsListResponse>();\n\n const items = response.data ?? [];\n for (const item of items) rememberProductPreview(item);\n\n return {\n items,\n next: response.cursor?.next ?? null,\n };\n },\n\n queries: {\n list: (params: Omit<WishlistListParams, 'signal'>) =>\n queryOptions({\n queryKey: ['wishlist', 'list', params, { scope: getActiveScope() }],\n queryFn: ({ signal }) => wishlist.list({ ...params, signal }),\n }),\n },\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { escapeForInlineScript } from './chunk-QVJDYSCT.js';
1
+ import { escapeForInlineScript } from './chunk-P4GOLSA2.js';
2
2
 
3
3
  // src/utils/app-scope.ts
4
4
  var isBrowser = typeof window !== "undefined";
@@ -132,5 +132,5 @@ function renderThemeHookSlotsScript(names = getRegisteredThemeHookSlots()) {
132
132
  }
133
133
 
134
134
  export { applyAppScopeMocks, applyThemeHookSlots, installAppScope, registerThemeHookSlots, renderAppScopeInstallScript, renderThemeHookSlotsScript };
135
- //# sourceMappingURL=chunk-HBTIZWT2.js.map
136
- //# sourceMappingURL=chunk-HBTIZWT2.js.map
135
+ //# sourceMappingURL=chunk-RYSJOCHI.js.map
136
+ //# sourceMappingURL=chunk-RYSJOCHI.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/app-scope.ts","../src/utils/theme-hook-slots.ts"],"names":[],"mappings":";;;AAGA,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA;AA2B7B,IAAM,qBAAA,GAAgD,CAAC,CAAA,EAAG,MAAA,KAAW;AAC1E,EAAA,MAAM,QAAA,GAAW,CAAC,GAAA,KAChB,OAAO,QAAQ,QAAA,IAAY,GAAA,CAAI,OAAA,CAAQ,MAAM,CAAA,KAAM,CAAA;AACrD,EAAA,MAAM,SAAA,GAAY,CAAC,GAAA,KAAwB,GAAA,CAAI,MAAM,CAAC,CAAA;AACtD,EAAA,MAAM,YAAY,MAA+B,CAAA,CAAE,KAAA,IAAS,CAAA,CAAE,SAAS,EAAC;AACxE,EAAA,MAAM,UAAA,GAAa,MAChB,SAAA,EAAU,CAAE,UAAsC,EAAC;AACtD,EAAA,MAAM,WAAA,GAAc,CAAC,GAAA,EAA8B,IAAA,KAAmC;AACpF,IAAA,MAAM,MAAA,GAAS,IAAI,IAAc,CAAA;AACjC,IAAA,OAAO,OAAO,MAAA,KAAW,UAAA,GAAa,MAAA,CAAO,IAAA,CAAK,GAAG,CAAA,GAAI,MAAA;AAAA,EAC3D,CAAA;AAEA,EAAA,MAAM,cAAA,GAAiB,CAAC,OAAA,KAA8B;AACpD,IAAA,MAAM,MAAA,GAAS,MAAqB,MAAA,CAAO,OAAO,IAAI,MAAA,CAAO,OAAO,KAAK,EAAC;AAE1E,IAAA,MAAM,SAAA,GAAY,CAAC,GAAA,EAAa,QAAA,KAAgC;AAC9D,MAAA,IAAI,QAAA,CAAS,GAAG,CAAA,EAAG;AACjB,QAAA,MAAM,GAAA,GAAM,UAAU,GAAG,CAAA;AACzB,QAAA,MAAM,IAAI,MAAA,EAAO;A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EAAM,CAAA;AACvF;AAGO,SAAS,2BAAA,GAAwC;AACtD,EAAA,OAAO,CAAC,GAAG,UAAU,CAAA;AACvB;AAeO,SAAS,0BAAA,CAA2B,KAAA,GAAkB,2BAAA,EAA4B,EAAG;AAC1F,EAAA,IAAI,CAAC,KAAA,CAAM,MAAA,EAAQ,OAAO,IAAA;AAC1B,EAAA,MAAM,IAAA,GAAO,qBAAA,CAAsB,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAA;AACxD,EAAA,OACE,wUASM,IAAI,CAAA,EAAA,CAAA;AAEd","file":"chunk-HBTIZWT2.js","sourcesContent":["import type { SallaSDK } from '../types/salla-sdk';\nimport { escapeForInlineScript } from './inline-script';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/** One app's private `app.*` bag, keyed without the `app.` prefix (`app.color` → `color`). */\nexport type AppConfigBag = Record<string, unknown>;\n\n/** One public `app.*` bucket per app, keyed by appScopeId. Everything else is read from the\n * real `salla.config` at runtime. */\nexport interface AppScopeContexts {\n apps: Record<string, AppConfigBag>;\n}\n\n/** Builds the `scopeId → sandboxed SDK` factory over a live bucket bag. */\nexport type AppScopeFactoryBuilder = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n w: any,\n appCtx: Record<string, AppConfigBag>\n) => (scopeId: string) => SallaSDK;\n\n/**\n * The sandbox itself: proxies that resolve `app.*` against the app's own bucket and pass\n * everything else through to the real SDK.\n *\n * MUST stay self-contained (only `Object`/`Proxy` and its two arguments): it is serialized via\n * `.toString()` next to {@link appScopeBootstrap} and handed in as an argument, so anything it\n * closed over at module scope would be undefined in the inline head copy. Split out from the\n * bootstrap purely to keep both halves reviewable.\n */\nexport const createAppScopeFactory: AppScopeFactoryBuilder = (w, appCtx) => {\n const isAppKey = (key: unknown): key is string =>\n typeof key === 'string' && key.indexOf('app.') === 0;\n const bucketKey = (key: string): string => key.slice(4);\n const realSalla = (): Record<string, unknown> => w.salla || w.Salla || {};\n const realConfig = (): Record<string, unknown> =>\n (realSalla().config as Record<string, unknown>) || {};\n const passthrough = (obj: Record<string, unknown>, prop: string | symbol): unknown => {\n const member = obj[prop as string];\n return typeof member === 'function' ? member.bind(obj) : member;\n };\n\n const createAppScope = (scopeId: string): SallaSDK => {\n const bucket = (): AppConfigBag => (appCtx[scopeId] = appCtx[scopeId] || {});\n\n const getConfig = (key: string, fallback?: unknown): unknown => {\n if (isAppKey(key)) {\n const sub = bucketKey(key);\n const b = bucket();\n // `app.*` miss returns the caller default, never the real config — a missing app\n // setting must not resolve to a same-named global.\n return sub in b ? b[sub] : fallback;\n }\n const cfg = realConfig();\n return typeof cfg.get === 'function'\n ? (cfg.get as (k: string, d?: unknown) => unknown)(key, fallback)\n : fallback;\n };\n\n const setConfig = (key: string, value: unknown): unknown => {\n if (isAppKey(key)) {\n bucket()[bucketKey(key)] = value;\n return value;\n }\n const cfg = realConfig();\n return typeof cfg.set === 'function'\n ? (cfg.set as (k: string, v: unknown) => unknown)(key, value)\n : value;\n };\n\n const hasConfig = (key: string): boolean =>\n isAppKey(key) ? bucketKey(key) in bucket() : key in realConfig();\n\n const configProxy = new Proxy({} as Record<string, unknown>, {\n get(_t, prop) {\n if (prop === 'get') return getConfig;\n if (prop === 'set') return setConfig;\n if (prop === 'has') return hasConfig;\n if (isAppKey(prop)) return getConfig(prop);\n return passthrough(realConfig(), prop);\n },\n set(_t, prop, value) {\n setConfig(prop as string, value);\n return true;\n },\n has(_t, prop) {\n return hasConfig(prop as string);\n },\n });\n\n return new Proxy({} as Record<string, unknown>, {\n get(_t, prop) {\n return prop === 'config' ? configProxy : passthrough(realSalla(), prop);\n },\n set(_t, prop, value) {\n // Reassigning `salla.config` wholesale would escape the sandbox; swallow it.\n if (prop === 'config') return true;\n realSalla()[prop as string] = value;\n return true;\n },\n }) as unknown as SallaSDK;\n };\n\n return createAppScope;\n};\n\n/**\n * Installs `window.Salla.appScope`, seeded with `contexts` and sandboxed by `makeFactory`.\n *\n * MUST stay self-contained (only `window`/`Object` and its arguments): it's serialized via\n * `.toString()` and inlined into the SSR head so the factory exists at parse time — before the\n * SDK init/hydration a CDN snippet's `onReady` races, else it throws `Salla.appScope is not a\n * function`. `makeFactory` is passed in rather than imported for exactly that reason. Also\n * called directly by `installAppScope` (tests/fallback).\n *\n * Idempotent: the factory is first-write-wins, while buckets are merged per scope (also\n * first-write-wins) so a later call can seed scopes the first one had no data for. `appCtx` is\n * closure-private (namespacing, not security: buckets are public-only and the boundary is\n * server-side).\n */\nexport function appScopeBootstrap(\n contexts: AppScopeContexts,\n makeFactory: AppScopeFactoryBuilder\n): void {\n if (typeof window === 'undefined') return;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const w = window as any;\n const Salla = (w.Salla = w.Salla || {});\n if (Salla.appScope) {\n // Already installed (normally by the inline head copy). The factory is first-write-wins,\n // but buckets are not: the head may have installed with none of them — the settings\n // endpoint can fail or lag behind the snippets one — so hand them to the existing install.\n if (Salla.__appScopeSeed) Salla.__appScopeSeed(contexts);\n return;\n }\n\n // Live bag + pristine snapshot (for mock overlays). Copy, don't alias: a snippet may\n // `config.set('app.x')` and the payload can be a cached response.\n const appCtx: Record<string, AppConfigBag> = {};\n const base: Record<string, AppConfigBag> = {};\n // Which scopes already got their real bucket, so a later seed can't overwrite one.\n const seeded: Record<string, boolean> = {};\n const seed = (next: AppScopeContexts): void => {\n const bags = (next && next.apps) || {};\n Object.keys(bags).forEach((scopeId) => {\n if (seeded[scopeId]) return;\n seeded[scopeId] = true;\n appCtx[scopeId] = Object.assign({}, appCtx[scopeId] || {}, bags[scopeId] || {});\n base[scopeId] = Object.assign({}, appCtx[scopeId]);\n });\n };\n seed(contexts);\n\n const createAppScope = makeFactory(w, appCtx);\n Salla.appScope = (scopeId: string): SallaSDK => createAppScope(scopeId);\n\n // Fill in buckets for scopes not seeded yet (first-write-wins per scope). Lets the head\n // install the factory unconditionally — at parse time, before any snippet's onReady — and\n // still pick up buckets that only the client managed to fetch.\n Salla.__appScopeSeed = (next: AppScopeContexts): void => seed(next);\n\n // Overlay preview mocks onto an app's pristine baseline, so fields the partner did not mock\n // keep their real values. Returns false for an unknown scope or before install.\n Salla.__appScopeMock = (scopeId: string, mocks: AppConfigBag): boolean => {\n if (!(scopeId in base)) return false;\n appCtx[scopeId] = Object.assign({}, base[scopeId], mocks);\n return true;\n };\n}\n\n/** Overlay preview mocks onto one app's bucket (over its pristine values). Delegates to the\n * bootstrap's `__appScopeMock`, so it works for both install paths. False if unknown/uninstalled. */\nexport function applyAppScopeMocks(appScopeId: string, mocks: AppConfigBag): boolean {\n if (!isBrowser) return false;\n const mock = (window.Salla as unknown as { __appScopeMock?: MockApplier } | undefined)\n ?.__appScopeMock;\n return mock?.(appScopeId, mocks) ?? false;\n}\n\ntype MockApplier = (appScopeId: string, mocks: AppConfigBag) => boolean;\n\n/** Serialize the installer into an inline `<script>` body seeded with `contexts` — both halves\n * via `.toString()`, hence their self-contained requirement. See `rootHead`. */\nexport function renderAppScopeInstallScript(contexts: AppScopeContexts): string {\n // Bucket values are partner-set, so escape the JSON seed against a `</script>` breakout.\n // The function sources have no `<`, so they need no escaping.\n const json = escapeForInlineScript(JSON.stringify(contexts));\n return `(${appScopeBootstrap.toString()})(${json},${createAppScopeFactory.toString()});`;\n}\n\n/** Install `Salla.appScope` on the client, or seed buckets into the inline SSR head copy that\n * already installed it. No-op on the server. Fallback for unseeded loads + the unit-test entry\n * point. */\nexport function installAppScope(contexts: AppScopeContexts): void {\n if (!isBrowser) return;\n appScopeBootstrap(contexts, createAppScopeFactory);\n}\n","import { escapeForInlineScript } from './inline-script';\n\nconst registered = new Set<string>();\n\nlet retryArmed = false;\n\n/**\n * Declare hook slots the theme renders itself so apps may mount into them.\n *\n * The SDK rejects `mount()` for any name absent from its `_themeSlots` whitelist, so a theme\n * rendering its own `<salla-hook>` must register the name. Call at module scope; the engine\n * applies the names via {@link applyThemeHookSlots}.\n */\nexport function registerThemeHookSlots(...names: string[]): void {\n for (const name of names) registered.add(name);\n}\n\n/** Push the registered names in. Returns false if the SDK hasn't exposed the list yet. */\nfunction pushSlots(): boolean {\n const slots = window.salla?.hooks?._themeSlots;\n if (!Array.isArray(slots)) return false;\n for (const name of registered) if (!slots.includes(name)) slots.push(name);\n return true;\n}\n\n/**\n * Push every registered slot name into the SDK whitelist. Idempotent. Engine-only.\n *\n * The SDK's hooks module may attach after this runs, so a first no-op falls back to a\n * one-shot retry on `twilight::initiated` — still before apps mount from their own onReady.\n *\n * This is only the late backstop: the whitelist is primarily seeded at parse time by the\n * inline head script from {@link renderThemeHookSlotsScript}, because an app's snippet\n * registers its `onReady` callback before React ever hydrates.\n */\nexport function applyThemeHookSlots(): void {\n if (typeof window === 'undefined' || registered.size === 0) return;\n if (pushSlots() || retryArmed) return;\n\n retryArmed = true;\n window.addEventListener('twilight::initiated', () => void pushSlots(), { once: true });\n}\n\n/** The slot names registered so far. Read by `rootHead` when rendering the inline script. */\nexport function getRegisteredThemeHookSlots(): string[] {\n return [...registered];\n}\n\n/**\n * Serialize the whitelist push into an inline head `<script>` body, so the slots are\n * registered at parse time.\n *\n * Ordering is the whole point: CDN snippets are parser-inserted `<script defer>` tags in the\n * body, so an app's `Salla.onReady` callback is registered long before React hydrates and runs\n * {@link applyThemeHookSlots}. Whichever `twilight::initiated` listener was added first runs\n * first, so the push must be armed from the head — otherwise the SDK rejects the app's\n * `hooks.mount()` with \"Hook <name> is not allowed\" and the app never renders.\n *\n * Returns null when the theme registered no slots. Kept self-contained (only `window`) since\n * it ships as raw source, not as a bundled module.\n */\nexport function renderThemeHookSlotsScript(names: string[] = getRegisteredThemeHookSlots()) {\n if (!names.length) return null;\n const json = escapeForInlineScript(JSON.stringify(names));\n return (\n `(function(names){` +\n `var w=window;` +\n `function push(){` +\n `var h=w.salla&&w.salla.hooks;var slots=h&&h._themeSlots;` +\n `if(!Array.isArray(slots))return false;` +\n `for(var i=0;i<names.length;i++)if(slots.indexOf(names[i])<0)slots.push(names[i]);` +\n `return true}` +\n `if(push())return;` +\n `w.addEventListener('twilight::initiated',function(){push()},{once:true})` +\n `})(${json});`\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/utils/app-scope.ts","../src/utils/theme-hook-slots.ts"],"names":[],"mappings":";;;AAGA,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA;AA2B7B,IAAM,qBAAA,GAAgD,CAAC,CAAA,EAAG,MAAA,KAAW;AAC1E,EAAA,MAAM,QAAA,GAAW,CAAC,GAAA,KAChB,OAAO,QAAQ,QAAA,IAAY,GAAA,CAAI,OAAA,CAAQ,MAAM,CAAA,KAAM,CAAA;AACrD,EAAA,MAAM,SAAA,GAAY,CAAC,GAAA,KAAwB,GAAA,CAAI,MAAM,CAAC,CAAA;AACtD,EAAA,MAAM,YAAY,MAA+B,CAAA,CAAE,KAAA,IAAS,CAAA,CAAE,SAAS,EAAC;AACxE,EAAA,MAAM,UAAA,GAAa,MAChB,SAAA,EAAU,CAAE,UAAsC,EAAC;AACtD,EAAA,MAAM,WAAA,GAAc,CAAC,GAAA,EAA8B,IAAA,KAAmC;AACpF,IAAA,MAAM,MAAA,GAAS,IAAI,IAAc,CAAA;AACjC,IAAA,OAAO,OAAO,MAAA,KAAW,UAAA,GAAa,MAAA,CAAO,IAAA,CAAK,GAAG,CAAA,GAAI,MAAA;AAAA,EAC3D,CAAA;AAEA,EAAA,MAAM,cAAA,GAAiB,CAAC,OAAA,KAA8B;AACpD,IAAA,MAAM,MAAA,GAAS,MAAqB,MAAA,CAAO,OAAO,IAAI,MAAA,CAAO,OAAO,KAAK,EAAC;AAE1E,IAAA,MAAM,SAAA,GAAY,CAAC,GAAA,EAAa,QAAA,KAAgC;AAC9D,MAAA,IAAI,QAAA,CAAS,GAAG,CAAA,EAAG;AACjB,QAAA,MAAM,GAAA,GAAM,UAAU,GAAG,CAAA;AACzB,QAAA,MAAM,IAAI,MAAA,EAAO;AAGjB,QAAA,OAAO,GAAA,IAAO,CAAA,GAAI,CAAA,CAAE,GAAG,CAAA,GAAI,QAAA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AU,CAAA;AACvB;AAeO,SAAS,0BAAA,CAA2B,KAAA,GAAkB,2BAAA,EAA4B,EAAG;AAC1F,EAAA,IAAI,CAAC,KAAA,CAAM,MAAA,EAAQ,OAAO,IAAA;AAC1B,EAAA,MAAM,IAAA,GAAO,qBAAA,CAAsB,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAA;AACxD,EAAA,OACE,wUASM,IAAI,CAAA,EAAA,CAAA;AAEd","file":"chunk-RYSJOCHI.js","sourcesContent":["import type { SallaSDK } from '../types/salla-sdk';\nimport { escapeForInlineScript } from './inline-script';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/** One app's private `app.*` bag, keyed without the `app.` prefix (`app.color` → `color`). */\nexport type AppConfigBag = Record<string, unknown>;\n\n/** One public `app.*` bucket per app, keyed by appScopeId. Everything else is read from the\n * real `salla.config` at runtime. */\nexport interface AppScopeContexts {\n apps: Record<string, AppConfigBag>;\n}\n\n/** Builds the `scopeId → sandboxed SDK` factory over a live bucket bag. */\nexport type AppScopeFactoryBuilder = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n w: any,\n appCtx: Record<string, AppConfigBag>\n) => (scopeId: string) => SallaSDK;\n\n/**\n * The sandbox itself: proxies that resolve `app.*` against the app's own bucket and pass\n * everything else through to the real SDK.\n *\n * MUST stay self-contained (only `Object`/`Proxy` and its two arguments): it is serialized via\n * `.toString()` next to {@link appScopeBootstrap} and handed in as an argument, so anything it\n * closed over at module scope would be undefined in the inline head copy. Split out from the\n * bootstrap purely to keep both halves reviewable.\n */\nexport const createAppScopeFactory: AppScopeFactoryBuilder = (w, appCtx) => {\n const isAppKey = (key: unknown): key is string =>\n typeof key === 'string' && key.indexOf('app.') === 0;\n const bucketKey = (key: string): string => key.slice(4);\n const realSalla = (): Record<string, unknown> => w.salla || w.Salla || {};\n const realConfig = (): Record<string, unknown> =>\n (realSalla().config as Record<string, unknown>) || {};\n const passthrough = (obj: Record<string, unknown>, prop: string | symbol): unknown => {\n const member = obj[prop as string];\n return typeof member === 'function' ? member.bind(obj) : member;\n };\n\n const createAppScope = (scopeId: string): SallaSDK => {\n const bucket = (): AppConfigBag => (appCtx[scopeId] = appCtx[scopeId] || {});\n\n const getConfig = (key: string, fallback?: unknown): unknown => {\n if (isAppKey(key)) {\n const sub = bucketKey(key);\n const b = bucket();\n // `app.*` miss returns the caller default, never the real config — a missing app\n // setting must not resolve to a same-named global.\n return sub in b ? b[sub] : fallback;\n }\n const cfg = realConfig();\n return typeof cfg.get === 'function'\n ? (cfg.get as (k: string, d?: unknown) => unknown)(key, fallback)\n : fallback;\n };\n\n const setConfig = (key: string, value: unknown): unknown => {\n if (isAppKey(key)) {\n bucket()[bucketKey(key)] = value;\n return value;\n }\n const cfg = realConfig();\n return typeof cfg.set === 'function'\n ? (cfg.set as (k: string, v: unknown) => unknown)(key, value)\n : value;\n };\n\n const hasConfig = (key: string): boolean =>\n isAppKey(key) ? bucketKey(key) in bucket() : key in realConfig();\n\n const configProxy = new Proxy({} as Record<string, unknown>, {\n get(_t, prop) {\n if (prop === 'get') return getConfig;\n if (prop === 'set') return setConfig;\n if (prop === 'has') return hasConfig;\n if (isAppKey(prop)) return getConfig(prop);\n return passthrough(realConfig(), prop);\n },\n set(_t, prop, value) {\n setConfig(prop as string, value);\n return true;\n },\n has(_t, prop) {\n return hasConfig(prop as string);\n },\n });\n\n return new Proxy({} as Record<string, unknown>, {\n get(_t, prop) {\n return prop === 'config' ? configProxy : passthrough(realSalla(), prop);\n },\n set(_t, prop, value) {\n // Reassigning `salla.config` wholesale would escape the sandbox; swallow it.\n if (prop === 'config') return true;\n realSalla()[prop as string] = value;\n return true;\n },\n }) as unknown as SallaSDK;\n };\n\n return createAppScope;\n};\n\n/**\n * Installs `window.Salla.appScope`, seeded with `contexts` and sandboxed by `makeFactory`.\n *\n * MUST stay self-contained (only `window`/`Object` and its arguments): it's serialized via\n * `.toString()` and inlined into the SSR head so the factory exists at parse time — before the\n * SDK init/hydration a CDN snippet's `onReady` races, else it throws `Salla.appScope is not a\n * function`. `makeFactory` is passed in rather than imported for exactly that reason. Also\n * called directly by `installAppScope` (tests/fallback).\n *\n * Idempotent: the factory is first-write-wins, while buckets are merged per scope (also\n * first-write-wins) so a later call can seed scopes the first one had no data for. `appCtx` is\n * closure-private (namespacing, not security: buckets are public-only and the boundary is\n * server-side).\n */\nexport function appScopeBootstrap(\n contexts: AppScopeContexts,\n makeFactory: AppScopeFactoryBuilder\n): void {\n if (typeof window === 'undefined') return;\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const w = window as any;\n const Salla = (w.Salla = w.Salla || {});\n if (Salla.appScope) {\n // Already installed (normally by the inline head copy). The factory is first-write-wins,\n // but buckets are not: the head may have installed with none of them — the settings\n // endpoint can fail or lag behind the snippets one — so hand them to the existing install.\n if (Salla.__appScopeSeed) Salla.__appScopeSeed(contexts);\n return;\n }\n\n // Live bag + pristine snapshot (for mock overlays). Copy, don't alias: a snippet may\n // `config.set('app.x')` and the payload can be a cached response.\n const appCtx: Record<string, AppConfigBag> = {};\n const base: Record<string, AppConfigBag> = {};\n // Which scopes already got their real bucket, so a later seed can't overwrite one.\n const seeded: Record<string, boolean> = {};\n const seed = (next: AppScopeContexts): void => {\n const bags = (next && next.apps) || {};\n Object.keys(bags).forEach((scopeId) => {\n if (seeded[scopeId]) return;\n seeded[scopeId] = true;\n appCtx[scopeId] = Object.assign({}, appCtx[scopeId] || {}, bags[scopeId] || {});\n base[scopeId] = Object.assign({}, appCtx[scopeId]);\n });\n };\n seed(contexts);\n\n const createAppScope = makeFactory(w, appCtx);\n Salla.appScope = (scopeId: string): SallaSDK => createAppScope(scopeId);\n\n // Fill in buckets for scopes not seeded yet (first-write-wins per scope). Lets the head\n // install the factory unconditionally — at parse time, before any snippet's onReady — and\n // still pick up buckets that only the client managed to fetch.\n Salla.__appScopeSeed = (next: AppScopeContexts): void => seed(next);\n\n // Overlay preview mocks onto an app's pristine baseline, so fields the partner did not mock\n // keep their real values. Returns false for an unknown scope or before install.\n Salla.__appScopeMock = (scopeId: string, mocks: AppConfigBag): boolean => {\n if (!(scopeId in base)) return false;\n appCtx[scopeId] = Object.assign({}, base[scopeId], mocks);\n return true;\n };\n}\n\n/** Overlay preview mocks onto one app's bucket (over its pristine values). Delegates to the\n * bootstrap's `__appScopeMock`, so it works for both install paths. False if unknown/uninstalled. */\nexport function applyAppScopeMocks(appScopeId: string, mocks: AppConfigBag): boolean {\n if (!isBrowser) return false;\n const mock = (window.Salla as unknown as { __appScopeMock?: MockApplier } | undefined)\n ?.__appScopeMock;\n return mock?.(appScopeId, mocks) ?? false;\n}\n\ntype MockApplier = (appScopeId: string, mocks: AppConfigBag) => boolean;\n\n/** Serialize the installer into an inline `<script>` body seeded with `contexts` — both halves\n * via `.toString()`, hence their self-contained requirement. See `rootHead`. */\nexport function renderAppScopeInstallScript(contexts: AppScopeContexts): string {\n // Bucket values are partner-set, so escape the JSON seed against a `</script>` breakout.\n // The function sources have no `<`, so they need no escaping.\n const json = escapeForInlineScript(JSON.stringify(contexts));\n return `(${appScopeBootstrap.toString()})(${json},${createAppScopeFactory.toString()});`;\n}\n\n/** Install `Salla.appScope` on the client, or seed buckets into the inline SSR head copy that\n * already installed it. No-op on the server. Fallback for unseeded loads + the unit-test entry\n * point. */\nexport function installAppScope(contexts: AppScopeContexts): void {\n if (!isBrowser) return;\n appScopeBootstrap(contexts, createAppScopeFactory);\n}\n","import { escapeForInlineScript } from './inline-script';\n\nconst registered = new Set<string>();\n\nlet retryArmed = false;\n\n/**\n * Declare hook slots the theme renders itself so apps may mount into them.\n *\n * The SDK rejects `mount()` for any name absent from its `_themeSlots` whitelist, so a theme\n * rendering its own `<salla-hook>` must register the name. Call at module scope; the engine\n * applies the names via {@link applyThemeHookSlots}.\n */\nexport function registerThemeHookSlots(...names: string[]): void {\n for (const name of names) registered.add(name);\n}\n\n/** Push the registered names in. Returns false if the SDK hasn't exposed the list yet. */\nfunction pushSlots(): boolean {\n const slots = window.salla?.hooks?._themeSlots;\n if (!Array.isArray(slots)) return false;\n for (const name of registered) if (!slots.includes(name)) slots.push(name);\n return true;\n}\n\n/**\n * Push every registered slot name into the SDK whitelist. Idempotent. Engine-only.\n *\n * The SDK's hooks module may attach after this runs, so a first no-op falls back to a\n * one-shot retry on `twilight::initiated` — still before apps mount from their own onReady.\n *\n * This is only the late backstop: the whitelist is primarily seeded at parse time by the\n * inline head script from {@link renderThemeHookSlotsScript}, because an app's snippet\n * registers its `onReady` callback before React ever hydrates.\n */\nexport function applyThemeHookSlots(): void {\n if (typeof window === 'undefined' || registered.size === 0) return;\n if (pushSlots() || retryArmed) return;\n\n retryArmed = true;\n window.addEventListener('twilight::initiated', () => void pushSlots(), { once: true });\n}\n\n/** The slot names registered so far. Read by `rootHead` when rendering the inline script. */\nexport function getRegisteredThemeHookSlots(): string[] {\n return [...registered];\n}\n\n/**\n * Serialize the whitelist push into an inline head `<script>` body, so the slots are\n * registered at parse time.\n *\n * Ordering is the whole point: CDN snippets are parser-inserted `<script defer>` tags in the\n * body, so an app's `Salla.onReady` callback is registered long before React hydrates and runs\n * {@link applyThemeHookSlots}. Whichever `twilight::initiated` listener was added first runs\n * first, so the push must be armed from the head — otherwise the SDK rejects the app's\n * `hooks.mount()` with \"Hook <name> is not allowed\" and the app never renders.\n *\n * Returns null when the theme registered no slots. Kept self-contained (only `window`) since\n * it ships as raw source, not as a bundled module.\n */\nexport function renderThemeHookSlotsScript(names: string[] = getRegisteredThemeHookSlots()) {\n if (!names.length) return null;\n const json = escapeForInlineScript(JSON.stringify(names));\n return (\n `(function(names){` +\n `var w=window;` +\n `function push(){` +\n `var h=w.salla&&w.salla.hooks;var slots=h&&h._themeSlots;` +\n `if(!Array.isArray(slots))return false;` +\n `for(var i=0;i<names.length;i++)if(slots.indexOf(names[i])<0)slots.push(names[i]);` +\n `return true}` +\n `if(push())return;` +\n `w.addEventListener('twilight::initiated',function(){push()},{once:true})` +\n `})(${json});`\n );\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { filesCdn, cdn } from './chunk-EXBH6RGD.js';
1
+ import { filesCdn, cdn } from './chunk-IK57LAIA.js';
2
2
  import { storeTranslationsQueryKey, translationsQueryKey, composeMessages, isPlainObject } from './chunk-N2S25NXP.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
@@ -126,5 +126,5 @@ var translations = {
126
126
  };
127
127
 
128
128
  export { commonTranslationsPath, storeTranslationsPath, translations };
129
- //# sourceMappingURL=chunk-XVNXXF67.js.map
130
- //# sourceMappingURL=chunk-XVNXXF67.js.map
129
+ //# sourceMappingURL=chunk-TWVTIAMO.js.map
130
+ //# sourceMappingURL=chunk-TWVTIAMO.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,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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AAA,MACnD,OAAA,EAAS,MAAM,YAAA,CAAa,QAAA,CAAS,SAAS,MAAM;AAAA,KACrD;AAAA;AAEP","file":"chunk-XVNXXF67.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;AAEpC,IAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,MAAA,OAAO,UAAA,CAAW,CAAA,SAAA,EAAY,QAAA,CAAS,MAAM,CAAA,CAAE,CAAA;AAAA,IACjD;AAEA,IAAA,MAAM,IAAA,GAAgB,MAAM,QAAA,CAAS,IAAA,EAAK;AAC1C,I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AA;AAAA;AAAA;AAAA,EAcA,QAAA,EAAU,OAAO,OAAA,EAA0B,MAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQzC,cAAA,CAAe,sBAAsB,OAAA,EAAS,MAAM,GAAG,EAAE,UAAA,EAAY,MAAM;AAAA,GAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAc7E,KAAA,EAAO,CACL,MAAA,EACA,SAAA,EACA,WAC+B,eAAA,CAAgB,MAAA,EAAQ,SAAA,EAAW,MAAM,CAAA,IAAK,IAAA;AAAA,EAE/E,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAgBP,QAAA,EAAU,CAAC,MAAA,KACT,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,qBAAqB,MAAM,CAAA;AAAA,MACrC,OAAA,EAAS,MAAM,YAAA,CAAa,GAAA,CAAI,MAAM;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-TWVTIAMO.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,4 +1,4 @@
1
- import { api } from './chunk-EXBH6RGD.js';
1
+ import { api } from './chunk-IK57LAIA.js';
2
2
  import { getTwilightContext } from './chunk-N2S25NXP.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
@@ -23,5 +23,5 @@ var menu = {
23
23
  };
24
24
 
25
25
  export { menu };
26
- //# sourceMappingURL=chunk-2ALN2BPM.js.map
27
- //# sourceMappingURL=chunk-2ALN2BPM.js.map
26
+ //# sourceMappingURL=chunk-VYCNB6VN.js.map
27
+ //# sourceMappingURL=chunk-VYCNB6VN.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/menu.ts"],"names":[],"mappings":";;;;AAKO,IAAM,IAAA,GAAO;AAAA,EAClB,QAAQ,YAAiC;AACvC,IAAA,MAAM,EAAE,MAAA,EAAO,GAAI,kBAAA,EAAmB;AACtC,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,kBAAA,EAAqB,MAAM,CAAA,CAAE,CAAA,CAAE,IAAA,EAA2B;AACzF,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA,EAEA,QAAQ,YAAiC;AACvC,IAAA,MAAM,EAAE,MAAA,EAAO,GAAI,kBAAA,EAAmB;AACtC,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,kBAAA,EAAqB,MAAM,CAAA,CAAE,CAAA,CAAE,IAAA,EAA2B;AACzF,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,MACN,YAAA,CAAa;AAAA,MACX,UAAU,CAAC,OAAA,EAAS,QAAA,EAAU,kBAAA,GAAqB,MAAM,CAAA;AAAA,MACzD,OAAA,EAAS,MAAM,IAAA,CAAK,MAAA,EAAO;AAAA,MAC3B,SAAA,EAAW,IAAI,EAAA,GAAK;AAAA,KACrB;AAAA;AAEP","file":"chunk-2ALN2BPM.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport { getTwilightContext } from '../twilight/context';\nimport type { MenuItem } from '../types';\n\nexport const menu = {\n header: async (): Promise<MenuItem[]> => {\n const { locale } = getTwilightContext();\n const { data } = await api.get(`menus/header?lang=${locale}`).json<{ data: MenuItem[] }>();\n return data || [];\n },\n\n footer: async (): Promise<MenuItem[]> => {\n const { locale } = getTwilightContext();\n const { data } = await api.get(`menus/footer?lang=${locale}`).json<{ data: MenuItem[] }>();\n return data || [];\n },\n\n queries: {\n header: () =>\n queryOptions({\n queryKey: ['menus', 'header', getTwilightContext().locale],\n queryFn: () => menu.header(),\n staleTime: 5 * 60 * 1000,\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/menu.ts"],"names":[],"mappings":";;;;AAKO,IAAM,IAAA,GAAO;AAAA,EAClB,QAAQ,YAAiC;AACvC,IAAA,MAAM,EAAE,MAAA,EAAO,GAAI,kBAAA,EAAmB;AACtC,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,kBAAA,EAAqB,MAAM,CAAA,CAAE,CAAA,CAAE,IAAA,EAA2B;AACzF,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA,EAEA,QAAQ,YAAiC;AACvC,IAAA,MAAM,EAAE,MAAA,EAAO,GAAI,kBAAA,EAAmB;AACtC,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,kBAAA,EAAqB,MAAM,CAAA,CAAE,CAAA,CAAE,IAAA,EAA2B;AACzF,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,MACN,YAAA,CAAa;AAAA,MACX,UAAU,CAAC,OAAA,EAAS,QAAA,EAAU,kBAAA,GAAqB,MAAM,CAAA;AAAA,MACzD,OAAA,EAAS,MAAM,IAAA,CAAK,MAAA,EAAO;AAAA,MAC3B,SAAA,EAAW,IAAI,EAAA,GAAK;AAAA,KACrB;AAAA;AAEP","file":"chunk-VYCNB6VN.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport { getTwilightContext } from '../twilight/context';\nimport type { MenuItem } from '../types';\n\nexport const menu = {\n header: async (): Promise<MenuItem[]> => {\n const { locale } = getTwilightContext();\n const { data } = await api.get(`menus/header?lang=${locale}`).json<{ data: MenuItem[] }>();\n return data || [];\n },\n\n footer: async (): Promise<MenuItem[]> => {\n const { locale } = getTwilightContext();\n const { data } = await api.get(`menus/footer?lang=${locale}`).json<{ data: MenuItem[] }>();\n return data || [];\n },\n\n queries: {\n header: () =>\n queryOptions({\n queryKey: ['menus', 'header', getTwilightContext().locale],\n queryFn: () => menu.header(),\n staleTime: 5 * 60 * 1000,\n }),\n },\n};\n"]}
@@ -0,0 +1,14 @@
1
+ import { lazy } from 'react';
2
+
3
+ // src/components/cart/lazy.ts
4
+ var LazyCartItem = lazy(() => import('./CartItem-R6BYAM4O.js').then((m) => ({ default: m.CartItem })));
5
+ var LazyCartSummary = lazy(
6
+ () => import('./CartSummary-YQ2RMHID.js').then((m) => ({ default: m.CartSummary }))
7
+ );
8
+ var LazySeoCartWidget = lazy(
9
+ () => import('./SeoCartWidget-KV3T3BO7.js').then((m) => ({ default: m.SeoCartWidget }))
10
+ );
11
+
12
+ export { LazyCartItem, LazyCartSummary, LazySeoCartWidget };
13
+ //# sourceMappingURL=chunk-WG47KLHH.js.map
14
+ //# sourceMappingURL=chunk-WG47KLHH.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/cart/lazy.ts"],"names":[],"mappings":";;;AAMO,IAAM,YAAA,GAAe,IAAA,CAAK,MAAM,OAAO,wBAAY,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,QAAA,GAAW,CAAC;AAE3F,IAAM,eAAA,GAAkB,IAAA;AAAA,EAAK,MAClC,OAAO,2BAAe,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,WAAA,EAAY,CAAE;AAClE;AAEO,IAAM,iBAAA,GAAoB,IAAA;AAAA,EAAK,MACpC,OAAO,6BAAiB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,aAAA,EAAc,CAAE;AACtE","file":"chunk-DRMTTDZU.js","sourcesContent":["import { lazy } from 'react';\n\n/**\n * Lazy-loaded cart components\n * Use these for code-splitting cart sections\n */\nexport const LazyCartItem = lazy(() => import('./CartItem').then((m) => ({ default: m.CartItem })));\n\nexport const LazyCartSummary = lazy(() =>\n import('./CartSummary').then((m) => ({ default: m.CartSummary }))\n);\n\nexport const LazySeoCartWidget = lazy(() =>\n import('./SeoCartWidget').then((m) => ({ default: m.SeoCartWidget }))\n);\n"]}
1
+ {"version":3,"sources":["../src/components/cart/lazy.ts"],"names":[],"mappings":";;;AAMO,IAAM,YAAA,GAAe,IAAA,CAAK,MAAM,OAAO,wBAAY,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,QAAA,GAAW,CAAC;AAE3F,IAAM,eAAA,GAAkB,IAAA;AAAA,EAAK,MAClC,OAAO,2BAAe,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,WAAA,EAAY,CAAE;AAClE;AAEO,IAAM,iBAAA,GAAoB,IAAA;AAAA,EAAK,MACpC,OAAO,6BAAiB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,aAAA,EAAc,CAAE;AACtE","file":"chunk-WG47KLHH.js","sourcesContent":["import { lazy } from 'react';\n\n/**\n * Lazy-loaded cart components\n * Use these for code-splitting cart sections\n */\nexport const LazyCartItem = lazy(() => import('./CartItem').then((m) => ({ default: m.CartItem })));\n\nexport const LazyCartSummary = lazy(() =>\n import('./CartSummary').then((m) => ({ default: m.CartSummary }))\n);\n\nexport const LazySeoCartWidget = lazy(() =>\n import('./SeoCartWidget').then((m) => ({ default: m.SeoCartWidget }))\n);\n"]}
@@ -1,7 +1,7 @@
1
- import { useIsHome } from './chunk-SDIQHTDG.js';
1
+ import { useIsHome } from './chunk-OKNJFS44.js';
2
2
  import { useTranslation } from './chunk-TYNZ5B2B.js';
3
3
  import { HookSlot } from './chunk-5XDPAKF5.js';
4
- import { Image } from './chunk-MEPYG77L.js';
4
+ import { Image } from './chunk-6I4LWF5Y.js';
5
5
  import { useTwilight } from './chunk-DF6FBKDN.js';
6
6
  import { lazy, useState } from 'react';
7
7
  import { SallaAdvertisement } from '@salla.sa/twilight-components-react/advertisement';
@@ -13,9 +13,9 @@ import { SallaSearch } from '@salla.sa/twilight-components-react/search';
13
13
  import { SallaUserMenu } from '@salla.sa/twilight-components-react/user-menu';
14
14
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
15
15
 
16
- var LazyMainMenu = lazy(() => import('./MainMenu-KXNWUVAF.js').then((m) => ({ default: m.MainMenu })));
16
+ var LazyMainMenu = lazy(() => import('./MainMenu-KNJDJFJX.js').then((m) => ({ default: m.MainMenu })));
17
17
  var LazyMobileMenu = lazy(
18
- () => import('./MobileMenu-VJJ7BG56.js').then((m) => ({ default: m.MobileMenu }))
18
+ () => import('./MobileMenu-RXLYUAWL.js').then((m) => ({ default: m.MobileMenu }))
19
19
  );
20
20
  function Header(_props) {
21
21
  const { currency, theme, store } = useTwilight();
@@ -120,5 +120,5 @@ function Header(_props) {
120
120
  }
121
121
 
122
122
  export { Header };
123
- //# sourceMappingURL=chunk-IO77BQGI.js.map
124
- //# sourceMappingURL=chunk-IO77BQGI.js.map
123
+ //# sourceMappingURL=chunk-WHGOO4A2.js.map
124
+ //# sourceMappingURL=chunk-WHGOO4A2.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/navigation/lazy.ts","../src/components/layout/Header.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAMO,IAAM,YAAA,GAAe,IAAA,CAAK,MAAM,OAAO,wBAAY,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,QAAA,GAAW,CAAC,CAAA;AAE3F,IAAM,cAAA,GAAiB,IAAA;AAAA,EAAK,MACjC,O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,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-IO77BQGI.js","sourcesContent":["import { lazy } from 'react';\n\n/**\n * Lazy-loaded navigation components\n * Use these for code-splitting navigation sections\n */\nexport const LazyMainMenu = lazy(() => import('./MainMenu').then((m) => ({ default: m.MainMenu })));\n\nexport const LazyMobileMenu = lazy(() =>\n import('./MobileMenu').then((m) => ({ default: m.MobileMenu }))\n);\n","import { useState } from 'react';\nimport { useIsHome } from '../../providers/NavigationProvider';\nimport { SallaAdvertisement } from '@salla.sa/twilight-components-react/advertisement';\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 { MainMenu, MobileMenu } from '../navigation';\nimport { Image } from '../common';\nimport type { Cart } from '../../types';\n\ninterface HeaderProps {\n cart?: Cart;\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 <SallaAdvertisement />\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 <SallaContacts contacts={store?.contacts} contactsTitle=\"N/A\" isHeader />\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,IAAA,CAAK,MAAM,OAAO,wBAAY,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,QAAA,GAAW,CAAC,CAAA;AAE3F,IAAM,cAAA,GAAiB,IAAA;AAAA,EAAK,MACjC,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW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AAA,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-WHGOO4A2.js","sourcesContent":["import { lazy } from 'react';\n\n/**\n * Lazy-loaded navigation components\n * Use these for code-splitting navigation sections\n */\nexport const LazyMainMenu = lazy(() => import('./MainMenu').then((m) => ({ default: m.MainMenu })));\n\nexport const LazyMobileMenu = lazy(() =>\n import('./MobileMenu').then((m) => ({ default: m.MobileMenu }))\n);\n","import { useState } from 'react';\nimport { useIsHome } from '../../providers/NavigationProvider';\nimport { SallaAdvertisement } from '@salla.sa/twilight-components-react/advertisement';\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 { MainMenu, MobileMenu } from '../navigation';\nimport { Image } from '../common';\nimport type { Cart } from '../../types';\n\ninterface HeaderProps {\n cart?: Cart;\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 <SallaAdvertisement />\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 <SallaContacts contacts={store?.contacts} contactsTitle=\"N/A\" isHeader />\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
- import { orThrow } from './chunk-SDIQHTDG.js';
2
- import { getAuthToken, api } from './chunk-EXBH6RGD.js';
1
+ import { orThrow } from './chunk-OKNJFS44.js';
2
+ import { getAuthToken, api } from './chunk-IK57LAIA.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
5
5
  var loyalty = {
@@ -29,5 +29,5 @@ var loyalty = {
29
29
  };
30
30
 
31
31
  export { loyalty };
32
- //# sourceMappingURL=chunk-25FWAL3O.js.map
33
- //# sourceMappingURL=chunk-25FWAL3O.js.map
32
+ //# sourceMappingURL=chunk-WS3WQ3OL.js.map
33
+ //# sourceMappingURL=chunk-WS3WQ3OL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/loyalty.ts"],"names":[],"mappings":";;;;AAKO,IAAM,OAAA,GAAU;AAAA,EACrB,KAAK,YAA8B;AACjC,IAAA,MAAM,EAAE,MAAK,GAAI,MAAM,IAAI,GAAA,CAAI,SAAS,EAAE,IAAA,EAAwB;AAClE,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,UAAA,EAAY,MAAwB,OAAA,CAAQ,OAAA,CAAQ,KAAK,CAAA;AAAA,EAEzD,kBAAkB,YAA6B;AAC7C,IAAA,MAAM,WAAW,MAAM,GAAA,CAAI,GAAA,CAAI,gBAAgB,EAAE,IAAA,EAA2B;AAC5E,IAAA,OAAO,QAAA,CAAS,OAAA;AAAA,EAClB,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,MACN,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,SAAS,CAAA;AAAA,MACpB,OAAA,EAAS,MAAM,OAAA,CAAQ,GAAA;AAAI,KAC5B,CAAA;AAAA,IACH,MAAA,EAAQ,MACN,YAAA,CAA4B;AAAA,MAC1B,QAAA,EAAU,CAAC,SAAA,EAAW,QAAQ,CAAA;AAAA,MAC9B,OAAA,EAAS,MAAM,OAAA,CAAQ,gBAAA,EAAiB;AAAA;AAAA;AAAA,MAGxC,OAAA,EAAS,CAAC,CAAC,YAAA,EAAa;AAAA,MACxB,SAAA,EAAW;AAAA,KACZ;AAAA;AAEP","file":"chunk-25FWAL3O.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getAuthToken } from './client';\nimport type { Loyalty, PointBalanceResponse } from '../routes/loyalty/types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const loyalty = {\n get: async (): Promise<Loyalty> => {\n const { data } = await api.get('loyalty').json<{ data: Loyalty }>();\n return data;\n },\n\n getOrThrow: (): Promise<Loyalty> => orThrow(loyalty.get()),\n\n getPointsBalance: async (): Promise<number> => {\n const response = await api.get('balance/points').json<PointBalanceResponse>();\n return response.balance;\n },\n\n queries: {\n detail: () =>\n queryOptions({\n queryKey: ['loyalty'],\n queryFn: () => loyalty.get(),\n }),\n points: () =>\n queryOptions<number | null>({\n queryKey: ['loyalty', 'points'],\n queryFn: () => loyalty.getPointsBalance(),\n // Points are customer-scoped; skip for guests (no token) — the request would\n // otherwise 400 with `token_not_provided`.\n enabled: !!getAuthToken(),\n staleTime: 30_000,\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/loyalty.ts"],"names":[],"mappings":";;;;AAKO,IAAM,OAAA,GAAU;AAAA,EACrB,KAAK,YAA8B;AACjC,IAAA,MAAM,EAAE,MAAK,GAAI,MAAM,IAAI,GAAA,CAAI,SAAS,EAAE,IAAA,EAAwB;AAClE,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,UAAA,EAAY,MAAwB,OAAA,CAAQ,OAAA,CAAQ,KAAK,CAAA;AAAA,EAEzD,kBAAkB,YAA6B;AAC7C,IAAA,MAAM,WAAW,MAAM,GAAA,CAAI,GAAA,CAAI,gBAAgB,EAAE,IAAA,EAA2B;AAC5E,IAAA,OAAO,QAAA,CAAS,OAAA;AAAA,EAClB,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,MACN,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,SAAS,CAAA;AAAA,MACpB,OAAA,EAAS,MAAM,OAAA,CAAQ,GAAA;AAAI,KAC5B,CAAA;AAAA,IACH,MAAA,EAAQ,MACN,YAAA,CAA4B;AAAA,MAC1B,QAAA,EAAU,CAAC,SAAA,EAAW,QAAQ,CAAA;AAAA,MAC9B,OAAA,EAAS,MAAM,OAAA,CAAQ,gBAAA,EAAiB;AAAA;AAAA;AAAA,MAGxC,OAAA,EAAS,CAAC,CAAC,YAAA,EAAa;AAAA,MACxB,SAAA,EAAW;AAAA,KACZ;AAAA;AAEP","file":"chunk-WS3WQ3OL.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getAuthToken } from './client';\nimport type { Loyalty, PointBalanceResponse } from '../routes/loyalty/types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const loyalty = {\n get: async (): Promise<Loyalty> => {\n const { data } = await api.get('loyalty').json<{ data: Loyalty }>();\n return data;\n },\n\n getOrThrow: (): Promise<Loyalty> => orThrow(loyalty.get()),\n\n getPointsBalance: async (): Promise<number> => {\n const response = await api.get('balance/points').json<PointBalanceResponse>();\n return response.balance;\n },\n\n queries: {\n detail: () =>\n queryOptions({\n queryKey: ['loyalty'],\n queryFn: () => loyalty.get(),\n }),\n points: () =>\n queryOptions<number | null>({\n queryKey: ['loyalty', 'points'],\n queryFn: () => loyalty.getPointsBalance(),\n // Points are customer-scoped; skip for guests (no token) — the request would\n // otherwise 400 with `token_not_provided`.\n enabled: !!getAuthToken(),\n staleTime: 30_000,\n }),\n },\n};\n"]}
@@ -1,5 +1,5 @@
1
- import { orThrow, orUnauthorized } from './chunk-SDIQHTDG.js';
2
- import { api } from './chunk-EXBH6RGD.js';
1
+ import { orThrow, orUnauthorized } from './chunk-OKNJFS44.js';
2
+ import { api } from './chunk-IK57LAIA.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
5
5
  var order = {
@@ -78,5 +78,5 @@ var order = {
78
78
  };
79
79
 
80
80
  export { order };
81
- //# sourceMappingURL=chunk-UAY6LTWB.js.map
82
- //# sourceMappingURL=chunk-UAY6LTWB.js.map
81
+ //# sourceMappingURL=chunk-XN7TVPAU.js.map
82
+ //# sourceMappingURL=chunk-XN7TVPAU.js.map