@salla.sa/twilight-theme-engine 1.0.174 → 1.0.175

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 (238) hide show
  1. package/dist/{AddToCartForm-PNQWWWDZ.js → AddToCartForm-C3FWHFD4.js} +3 -3
  2. package/dist/{AddToCartForm-PNQWWWDZ.js.map → AddToCartForm-C3FWHFD4.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-C2K2UGNK.js → BlogAuthorPage-7W7K7IMP.js} +17 -17
  4. package/dist/{BlogAuthorPage-C2K2UGNK.js.map → BlogAuthorPage-7W7K7IMP.js.map} +1 -1
  5. package/dist/{BlogCategoryPage-4FFC7XRL.js → BlogCategoryPage-DVCUXFFB.js} +17 -17
  6. package/dist/{BlogCategoryPage-4FFC7XRL.js.map → BlogCategoryPage-DVCUXFFB.js.map} +1 -1
  7. package/dist/{BlogPage-ZOWWYKQJ.js → BlogPage-JU7WXPAO.js} +15 -15
  8. package/dist/{BlogPage-ZOWWYKQJ.js.map → BlogPage-JU7WXPAO.js.map} +1 -1
  9. package/dist/{BlogSinglePage-2V3Y6G5Y.js → BlogSinglePage-BO3H373O.js} +15 -15
  10. package/dist/{BlogSinglePage-2V3Y6G5Y.js.map → BlogSinglePage-BO3H373O.js.map} +1 -1
  11. package/dist/{BlogTagPage-PA7HTLWH.js → BlogTagPage-TXVT2F4A.js} +17 -17
  12. package/dist/{BlogTagPage-PA7HTLWH.js.map → BlogTagPage-TXVT2F4A.js.map} +1 -1
  13. package/dist/{BrandsPage-2HE6ZLEH.js → BrandsPage-233ICYLO.js} +16 -16
  14. package/dist/{BrandsPage-2HE6ZLEH.js.map → BrandsPage-233ICYLO.js.map} +1 -1
  15. package/dist/{Breadcrumb-5MRNOQAE.js → Breadcrumb-AL6KQ3AJ.js} +15 -15
  16. package/dist/{Breadcrumb-5MRNOQAE.js.map → Breadcrumb-AL6KQ3AJ.js.map} +1 -1
  17. package/dist/{CartItem-OQNZL2JF.js → CartItem-STZEX5ML.js} +15 -15
  18. package/dist/{CartItem-OQNZL2JF.js.map → CartItem-STZEX5ML.js.map} +1 -1
  19. package/dist/{CartSummary-P7VJK5JA.js → CartSummary-NBL4W3MD.js} +15 -15
  20. package/dist/{CartSummary-P7VJK5JA.js.map → CartSummary-NBL4W3MD.js.map} +1 -1
  21. package/dist/{Copyright-FYVFAAT5.js → Copyright-57SVW6E5.js} +3 -3
  22. package/dist/{Copyright-FYVFAAT5.js.map → Copyright-57SVW6E5.js.map} +1 -1
  23. package/dist/{CustomerLayout-3A3CL75I.js → CustomerLayout-4IFBNFCA.js} +15 -15
  24. package/dist/{CustomerLayout-3A3CL75I.js.map → CustomerLayout-4IFBNFCA.js.map} +1 -1
  25. package/dist/{Footer-VDFYTUO4.js → Footer-RQ44MW6G.js} +3 -3
  26. package/dist/{Footer-VDFYTUO4.js.map → Footer-RQ44MW6G.js.map} +1 -1
  27. package/dist/GoogleTag-J7KKZZ2O.js +15 -0
  28. package/dist/{GoogleTag-DLJLHWI2.js.map → GoogleTag-J7KKZZ2O.js.map} +1 -1
  29. package/dist/{Header-CNSDCCQC.js → Header-CQ5OHZ45.js} +8 -8
  30. package/dist/{Header-CNSDCCQC.js.map → Header-CQ5OHZ45.js.map} +1 -1
  31. package/dist/{LatestProducts-KZ22YD6M.js → LatestProducts-XYGMGDMG.js} +17 -17
  32. package/dist/{LatestProducts-KZ22YD6M.js.map → LatestProducts-XYGMGDMG.js.map} +1 -1
  33. package/dist/{LoyaltyPage-RPT6VMT3.js → LoyaltyPage-C54UQ7D4.js} +15 -15
  34. package/dist/{LoyaltyPage-RPT6VMT3.js.map → LoyaltyPage-C54UQ7D4.js.map} +1 -1
  35. package/dist/{LoyaltyPointsPage-4AHJTVWX.js → LoyaltyPointsPage-UNDIJ7WA.js} +6 -6
  36. package/dist/{LoyaltyPointsPage-4AHJTVWX.js.map → LoyaltyPointsPage-UNDIJ7WA.js.map} +1 -1
  37. package/dist/{MainMenu-2HVPYYVL.js → MainMenu-4Z5FB5P4.js} +5 -5
  38. package/dist/{MainMenu-2HVPYYVL.js.map → MainMenu-4Z5FB5P4.js.map} +1 -1
  39. package/dist/{MasterLayout-K26OFXMM.js → MasterLayout-Q2ROPDUV.js} +15 -15
  40. package/dist/{MasterLayout-K26OFXMM.js.map → MasterLayout-Q2ROPDUV.js.map} +1 -1
  41. package/dist/{MobileMenu-GDBS42RE.js → MobileMenu-WAFUVW4A.js} +16 -16
  42. package/dist/{MobileMenu-GDBS42RE.js.map → MobileMenu-WAFUVW4A.js.map} +1 -1
  43. package/dist/{NotificationsPage-J62FIJPN.js → NotificationsPage-G7FMTEA2.js} +15 -15
  44. package/dist/{NotificationsPage-J62FIJPN.js.map → NotificationsPage-G7FMTEA2.js.map} +1 -1
  45. package/dist/{OrderSinglePage-676PZUI6.js → OrderSinglePage-X6MCOL6W.js} +16 -16
  46. package/dist/{OrderSinglePage-676PZUI6.js.map → OrderSinglePage-X6MCOL6W.js.map} +1 -1
  47. package/dist/{OrdersPage-HGQKZBVC.js → OrdersPage-UD7GBAVD.js} +15 -15
  48. package/dist/{OrdersPage-HGQKZBVC.js.map → OrdersPage-UD7GBAVD.js.map} +1 -1
  49. package/dist/{PageSingle-EI45GNA7.js → PageSingle-7ZH7WWMF.js} +3 -3
  50. package/dist/{PageSingle-EI45GNA7.js.map → PageSingle-7ZH7WWMF.js.map} +1 -1
  51. package/dist/{ProductDetails-L5HE4CBL.js → ProductDetails-GA6HMHFZ.js} +4 -4
  52. package/dist/{ProductDetails-L5HE4CBL.js.map → ProductDetails-GA6HMHFZ.js.map} +1 -1
  53. package/dist/{ProfilePage-A3ISXLE3.js → ProfilePage-GB46VBMN.js} +15 -15
  54. package/dist/{ProfilePage-A3ISXLE3.js.map → ProfilePage-GB46VBMN.js.map} +1 -1
  55. package/dist/{ReviewsPage-JUGPLYAX.js → ReviewsPage-4OFPQ73X.js} +3 -3
  56. package/dist/{ReviewsPage-JUGPLYAX.js.map → ReviewsPage-4OFPQ73X.js.map} +1 -1
  57. package/dist/{SeoCartWidget-O73BA34X.js → SeoCartWidget-3VJJPN6Q.js} +15 -15
  58. package/dist/{SeoCartWidget-O73BA34X.js.map → SeoCartWidget-3VJJPN6Q.js.map} +1 -1
  59. package/dist/{SettingsPage-TNJKMJHN.js → SettingsPage-ZBWPLXXZ.js} +15 -15
  60. package/dist/{SettingsPage-TNJKMJHN.js.map → SettingsPage-ZBWPLXXZ.js.map} +1 -1
  61. package/dist/{StoreClosedNotification-DJETR5C2.js → StoreClosedNotification-JKPZLCQW.js} +16 -16
  62. package/dist/{StoreClosedNotification-DJETR5C2.js.map → StoreClosedNotification-JKPZLCQW.js.map} +1 -1
  63. package/dist/{TestimonialsPage-H6PSAU35.js → TestimonialsPage-ZLKUBVH2.js} +3 -3
  64. package/dist/{TestimonialsPage-H6PSAU35.js.map → TestimonialsPage-ZLKUBVH2.js.map} +1 -1
  65. package/dist/{ThankYouPage-FAUFRNQW.js → ThankYouPage-W7TLYF5K.js} +15 -15
  66. package/dist/{ThankYouPage-FAUFRNQW.js.map → ThankYouPage-W7TLYF5K.js.map} +1 -1
  67. package/dist/{WalletPage-6BZP7XQH.js → WalletPage-2DFZQSBP.js} +16 -16
  68. package/dist/{WalletPage-6BZP7XQH.js.map → WalletPage-2DFZQSBP.js.map} +1 -1
  69. package/dist/{WebMcpTools-D2RKAEP7.js → WebMcpTools-5DGFFQDR.js} +5 -5
  70. package/dist/{WebMcpTools-D2RKAEP7.js.map → WebMcpTools-5DGFFQDR.js.map} +1 -1
  71. package/dist/{WishlistPage-ZQNWOZ6R.js → WishlistPage-76YDKKT3.js} +17 -17
  72. package/dist/{WishlistPage-ZQNWOZ6R.js.map → WishlistPage-76YDKKT3.js.map} +1 -1
  73. package/dist/api/advertisement.js +2 -2
  74. package/dist/api/apps.js +2 -2
  75. package/dist/api/blog.js +3 -3
  76. package/dist/api/brands.js +3 -3
  77. package/dist/api/cart.js +3 -3
  78. package/dist/api/category.js +3 -3
  79. package/dist/api/client.js +1 -1
  80. package/dist/api/custom-url.js +2 -2
  81. package/dist/api/home.js +2 -2
  82. package/dist/api/loyalty.js +3 -3
  83. package/dist/api/menu.js +2 -2
  84. package/dist/api/notification.js +2 -2
  85. package/dist/api/order.js +3 -3
  86. package/dist/api/page.js +3 -3
  87. package/dist/api/product.js +3 -3
  88. package/dist/api/profile.js +1 -1
  89. package/dist/api/store.js +2 -2
  90. package/dist/api/translations.js +2 -2
  91. package/dist/api/user.js +2 -2
  92. package/dist/api/wallet.js +2 -2
  93. package/dist/api/wishlist.js +4 -4
  94. package/dist/{chunk-UHR6OQQ2.js → chunk-2B3TEWS5.js} +4 -4
  95. package/dist/{chunk-UHR6OQQ2.js.map → chunk-2B3TEWS5.js.map} +1 -1
  96. package/dist/{chunk-AITHXRMX.js → chunk-36ZY4C3I.js} +4 -4
  97. package/dist/{chunk-AITHXRMX.js.map → chunk-36ZY4C3I.js.map} +1 -1
  98. package/dist/{chunk-2BSPH5XN.js → chunk-3WW5RRMV.js} +3 -3
  99. package/dist/{chunk-2BSPH5XN.js.map → chunk-3WW5RRMV.js.map} +1 -1
  100. package/dist/{chunk-5RZDS4XS.js → chunk-4NA4FWJR.js} +3 -3
  101. package/dist/{chunk-5RZDS4XS.js.map → chunk-4NA4FWJR.js.map} +1 -1
  102. package/dist/{chunk-YAFF6BST.js → chunk-4YBXC6VB.js} +3 -3
  103. package/dist/{chunk-YAFF6BST.js.map → chunk-4YBXC6VB.js.map} +1 -1
  104. package/dist/{chunk-PS3OD4HM.js → chunk-5CNEKDOL.js} +5 -5
  105. package/dist/{chunk-PS3OD4HM.js.map → chunk-5CNEKDOL.js.map} +1 -1
  106. package/dist/{chunk-HJSJ4LK4.js → chunk-5JTABBET.js} +3 -3
  107. package/dist/{chunk-HJSJ4LK4.js.map → chunk-5JTABBET.js.map} +1 -1
  108. package/dist/{chunk-MMLZYUKH.js → chunk-5SIHL4SO.js} +5 -5
  109. package/dist/{chunk-MMLZYUKH.js.map → chunk-5SIHL4SO.js.map} +1 -1
  110. package/dist/{chunk-KURYDW5X.js → chunk-5U26XIYM.js} +4 -4
  111. package/dist/{chunk-KURYDW5X.js.map → chunk-5U26XIYM.js.map} +1 -1
  112. package/dist/{chunk-6WKZBYYB.js → chunk-AEGTXS5Z.js} +3 -3
  113. package/dist/{chunk-6WKZBYYB.js.map → chunk-AEGTXS5Z.js.map} +1 -1
  114. package/dist/{chunk-ZHLPTETE.js → chunk-BOW6FYVT.js} +4 -4
  115. package/dist/{chunk-ZHLPTETE.js.map → chunk-BOW6FYVT.js.map} +1 -1
  116. package/dist/{chunk-D5WQJCN7.js → chunk-C6LFYWTH.js} +5 -5
  117. package/dist/{chunk-D5WQJCN7.js.map → chunk-C6LFYWTH.js.map} +1 -1
  118. package/dist/{chunk-KN6DIUPC.js → chunk-DCVO3Y3H.js} +3 -3
  119. package/dist/{chunk-KN6DIUPC.js.map → chunk-DCVO3Y3H.js.map} +1 -1
  120. package/dist/{chunk-ELARDYI2.js → chunk-EJN2SKCV.js} +3 -3
  121. package/dist/{chunk-ELARDYI2.js.map → chunk-EJN2SKCV.js.map} +1 -1
  122. package/dist/{chunk-5OG5JFV3.js → chunk-ELWQBJG5.js} +4 -4
  123. package/dist/{chunk-5OG5JFV3.js.map → chunk-ELWQBJG5.js.map} +1 -1
  124. package/dist/{chunk-DVQ2TYBY.js → chunk-F3L5GYPS.js} +7 -7
  125. package/dist/{chunk-DVQ2TYBY.js.map → chunk-F3L5GYPS.js.map} +1 -1
  126. package/dist/{chunk-R6W262WD.js → chunk-FBRQ27SR.js} +4 -4
  127. package/dist/{chunk-R6W262WD.js.map → chunk-FBRQ27SR.js.map} +1 -1
  128. package/dist/{chunk-EF5DMYAD.js → chunk-G7BQM7RU.js} +3 -3
  129. package/dist/{chunk-EF5DMYAD.js.map → chunk-G7BQM7RU.js.map} +1 -1
  130. package/dist/{chunk-FGYA7Y76.js → chunk-IM6MQVVO.js} +3 -3
  131. package/dist/{chunk-FGYA7Y76.js.map → chunk-IM6MQVVO.js.map} +1 -1
  132. package/dist/{chunk-4L752GAA.js → chunk-INOCELVE.js} +3 -3
  133. package/dist/{chunk-4L752GAA.js.map → chunk-INOCELVE.js.map} +1 -1
  134. package/dist/{chunk-RYW4EHAK.js → chunk-IPCZONQT.js} +3 -3
  135. package/dist/{chunk-RYW4EHAK.js.map → chunk-IPCZONQT.js.map} +1 -1
  136. package/dist/{chunk-MKT66FON.js → chunk-JOLKCJWI.js} +3 -3
  137. package/dist/{chunk-MKT66FON.js.map → chunk-JOLKCJWI.js.map} +1 -1
  138. package/dist/{chunk-AYPY4N5K.js → chunk-KOBI67BT.js} +8 -7
  139. package/dist/chunk-KOBI67BT.js.map +1 -0
  140. package/dist/{chunk-ZHVG76UU.js → chunk-LRJWJNJS.js} +3 -3
  141. package/dist/{chunk-ZHVG76UU.js.map → chunk-LRJWJNJS.js.map} +1 -1
  142. package/dist/{chunk-WHVHV5WH.js → chunk-MCHRCHO3.js} +4 -4
  143. package/dist/{chunk-WHVHV5WH.js.map → chunk-MCHRCHO3.js.map} +1 -1
  144. package/dist/{chunk-RBJGWGUA.js → chunk-MWTNO2CP.js} +7 -7
  145. package/dist/{chunk-RBJGWGUA.js.map → chunk-MWTNO2CP.js.map} +1 -1
  146. package/dist/{chunk-6S3CGQMV.js → chunk-NYSKWLQB.js} +16 -16
  147. package/dist/{chunk-6S3CGQMV.js.map → chunk-NYSKWLQB.js.map} +1 -1
  148. package/dist/{chunk-7BAJN6HJ.js → chunk-OIO6UK7R.js} +3 -3
  149. package/dist/{chunk-7BAJN6HJ.js.map → chunk-OIO6UK7R.js.map} +1 -1
  150. package/dist/{chunk-S7K7AXTQ.js → chunk-PVBV2NZC.js} +3 -3
  151. package/dist/{chunk-S7K7AXTQ.js.map → chunk-PVBV2NZC.js.map} +1 -1
  152. package/dist/{chunk-QKG7RKNB.js → chunk-QVKKI5MG.js} +3 -3
  153. package/dist/{chunk-QKG7RKNB.js.map → chunk-QVKKI5MG.js.map} +1 -1
  154. package/dist/{chunk-GEHHSIN3.js → chunk-RGQUB3PL.js} +3 -3
  155. package/dist/{chunk-GEHHSIN3.js.map → chunk-RGQUB3PL.js.map} +1 -1
  156. package/dist/{chunk-U4UVRMLL.js → chunk-SF7S7JTU.js} +3 -3
  157. package/dist/{chunk-U4UVRMLL.js.map → chunk-SF7S7JTU.js.map} +1 -1
  158. package/dist/{chunk-PGKKY7PZ.js → chunk-T3664AQW.js} +4 -4
  159. package/dist/{chunk-PGKKY7PZ.js.map → chunk-T3664AQW.js.map} +1 -1
  160. package/dist/{chunk-XG2BNSYJ.js → chunk-TCSM2DM4.js} +4 -4
  161. package/dist/{chunk-XG2BNSYJ.js.map → chunk-TCSM2DM4.js.map} +1 -1
  162. package/dist/{chunk-PX7SLEOL.js → chunk-TRY7HEE2.js} +4 -4
  163. package/dist/{chunk-PX7SLEOL.js.map → chunk-TRY7HEE2.js.map} +1 -1
  164. package/dist/{chunk-7DPQSLRR.js → chunk-UE2BAFKQ.js} +3 -3
  165. package/dist/{chunk-7DPQSLRR.js.map → chunk-UE2BAFKQ.js.map} +1 -1
  166. package/dist/{chunk-CPMWIFBV.js → chunk-UNCMDVB7.js} +14 -14
  167. package/dist/{chunk-CPMWIFBV.js.map → chunk-UNCMDVB7.js.map} +1 -1
  168. package/dist/{chunk-S7HFDX73.js → chunk-UVUQG4Q5.js} +5 -5
  169. package/dist/{chunk-S7HFDX73.js.map → chunk-UVUQG4Q5.js.map} +1 -1
  170. package/dist/{chunk-KNQMN6EZ.js → chunk-VKUXMOB3.js} +3 -3
  171. package/dist/{chunk-KNQMN6EZ.js.map → chunk-VKUXMOB3.js.map} +1 -1
  172. package/dist/{chunk-GC6PPRIV.js → chunk-WFJI3OLT.js} +4 -4
  173. package/dist/{chunk-GC6PPRIV.js.map → chunk-WFJI3OLT.js.map} +1 -1
  174. package/dist/{chunk-AC7S2D2Y.js → chunk-WJB3YBF5.js} +3 -3
  175. package/dist/{chunk-AC7S2D2Y.js.map → chunk-WJB3YBF5.js.map} +1 -1
  176. package/dist/{chunk-X7IMGFJE.js → chunk-XCGBPYRZ.js} +4 -4
  177. package/dist/{chunk-X7IMGFJE.js.map → chunk-XCGBPYRZ.js.map} +1 -1
  178. package/dist/{chunk-UAU7H5AY.js → chunk-XL6ITANU.js} +3 -3
  179. package/dist/{chunk-UAU7H5AY.js.map → chunk-XL6ITANU.js.map} +1 -1
  180. package/dist/{chunk-CUEVKXPE.js → chunk-XND5HU3O.js} +6 -6
  181. package/dist/{chunk-CUEVKXPE.js.map → chunk-XND5HU3O.js.map} +1 -1
  182. package/dist/{chunk-NEMKN7V3.js → chunk-XOFOMJ4E.js} +4 -4
  183. package/dist/{chunk-NEMKN7V3.js.map → chunk-XOFOMJ4E.js.map} +1 -1
  184. package/dist/{chunk-KCZPGVTT.js → chunk-XQ7N5EVD.js} +4 -4
  185. package/dist/{chunk-KCZPGVTT.js.map → chunk-XQ7N5EVD.js.map} +1 -1
  186. package/dist/{chunk-DMEHJEGE.js → chunk-XZO7ZWHI.js} +4 -4
  187. package/dist/{chunk-DMEHJEGE.js.map → chunk-XZO7ZWHI.js.map} +1 -1
  188. package/dist/components/cart/index.js +1 -1
  189. package/dist/components/common/index.js +1 -1
  190. package/dist/components/drawer/index.js +13 -13
  191. package/dist/components/home/HomePageRenderer.d.ts.map +1 -1
  192. package/dist/components/home/index.js +18 -18
  193. package/dist/components/layout/index.js +4 -4
  194. package/dist/components/product/index.js +15 -15
  195. package/dist/components/store/index.js +14 -14
  196. package/dist/components/tracking/index.js +6 -6
  197. package/dist/{custom-urls-F5BSCZZY.js → custom-urls-BAKURERE.js} +7 -7
  198. package/dist/{custom-urls-F5BSCZZY.js.map → custom-urls-BAKURERE.js.map} +1 -1
  199. package/dist/dev/editor/index.js +1 -1
  200. package/dist/dev/index.js +1 -1
  201. package/dist/{document-class-F36MMP24.js → document-class-VW4NEJUX.js} +17 -17
  202. package/dist/{document-class-F36MMP24.js.map → document-class-VW4NEJUX.js.map} +1 -1
  203. package/dist/hooks/index.js +13 -13
  204. package/dist/hooks/useGtm.js +13 -13
  205. package/dist/hooks/useMoney.js +13 -13
  206. package/dist/hooks/useStore.js +13 -13
  207. package/dist/hooks/useUser.js +3 -3
  208. package/dist/index.js +13 -13
  209. package/dist/{navigation-NUZWIAWM.js → navigation-54CI4J6L.js} +4 -4
  210. package/dist/{navigation-NUZWIAWM.js.map → navigation-54CI4J6L.js.map} +1 -1
  211. package/dist/{navigation-CXD6RFSJ.js → navigation-C26Y4VCK.js} +5 -5
  212. package/dist/{navigation-CXD6RFSJ.js.map → navigation-C26Y4VCK.js.map} +1 -1
  213. package/dist/{not-found-ITURTLAO.js → not-found-4RVH4PCY.js} +16 -16
  214. package/dist/{not-found-ITURTLAO.js.map → not-found-4RVH4PCY.js.map} +1 -1
  215. package/dist/providers/index.js +13 -13
  216. package/dist/routes/account/orders.js +4 -4
  217. package/dist/routes/account.js +13 -13
  218. package/dist/routes/blog.js +8 -8
  219. package/dist/routes/brands.js +4 -4
  220. package/dist/routes/cart.js +22 -22
  221. package/dist/routes/home.js +19 -19
  222. package/dist/routes/index.js +8 -8
  223. package/dist/routes/loyalty.js +5 -5
  224. package/dist/routes/page.js +4 -4
  225. package/dist/routes/product-listing.js +23 -23
  226. package/dist/routes/product.js +22 -22
  227. package/dist/routes/seo-redirects.js +8 -8
  228. package/dist/routes/testimonials.js +2 -2
  229. package/dist/routes/thank-you.js +4 -4
  230. package/dist/skeleton.js +19 -19
  231. package/dist/{store-lookup-EAQWF2ZT.js → store-lookup-DIUCAZKB.js} +8 -8
  232. package/dist/{store-lookup-EAQWF2ZT.js.map → store-lookup-DIUCAZKB.js.map} +1 -1
  233. package/dist/tanstack.js +17 -17
  234. package/dist/utils/index.js +2 -2
  235. package/package.json +1 -1
  236. package/tailwind/components/home/HomePageRenderer.tsx.txt +2 -0
  237. package/dist/GoogleTag-DLJLHWI2.js +0 -15
  238. package/dist/chunk-AYPY4N5K.js.map +0 -1
@@ -1,4 +1,4 @@
1
- export { STORE_IDENTIFIER_HEADER, api, cdn, filesCdn, getActiveCurrency, getActiveScope, getActiveScopeId, getAuthToken } from '../chunk-MKT66FON.js';
1
+ export { STORE_IDENTIFIER_HEADER, api, cdn, filesCdn, getActiveCurrency, getActiveScope, getActiveScopeId, getAuthToken } from '../chunk-JOLKCJWI.js';
2
2
  import '../chunk-Z5M4YYWT.js';
3
3
  import '../chunk-F6GOQAYU.js';
4
4
  import '../chunk-6L27TXQZ.js';
@@ -1,5 +1,5 @@
1
- export { customUrl } from '../chunk-ELARDYI2.js';
2
- import '../chunk-MKT66FON.js';
1
+ export { customUrl } from '../chunk-EJN2SKCV.js';
2
+ import '../chunk-JOLKCJWI.js';
3
3
  import '../chunk-Z5M4YYWT.js';
4
4
  import '../chunk-F6GOQAYU.js';
5
5
  import '../chunk-6L27TXQZ.js';
package/dist/api/home.js CHANGED
@@ -1,5 +1,5 @@
1
- export { home } from '../chunk-YAFF6BST.js';
2
- import '../chunk-MKT66FON.js';
1
+ export { home } from '../chunk-4YBXC6VB.js';
2
+ import '../chunk-JOLKCJWI.js';
3
3
  import '../chunk-Z5M4YYWT.js';
4
4
  import '../chunk-F6GOQAYU.js';
5
5
  import '../chunk-6L27TXQZ.js';
@@ -1,7 +1,7 @@
1
- export { loyalty } from '../chunk-XG2BNSYJ.js';
2
- import '../chunk-QKG7RKNB.js';
1
+ export { loyalty } from '../chunk-TCSM2DM4.js';
2
+ import '../chunk-QVKKI5MG.js';
3
3
  import '../chunk-OUW6WESU.js';
4
- import '../chunk-MKT66FON.js';
4
+ import '../chunk-JOLKCJWI.js';
5
5
  import '../chunk-Z5M4YYWT.js';
6
6
  import '../chunk-GHKOMS3G.js';
7
7
  import '../chunk-F6GOQAYU.js';
package/dist/api/menu.js CHANGED
@@ -1,5 +1,5 @@
1
- export { menu } from '../chunk-KNQMN6EZ.js';
2
- import '../chunk-MKT66FON.js';
1
+ export { menu } from '../chunk-VKUXMOB3.js';
2
+ import '../chunk-JOLKCJWI.js';
3
3
  import '../chunk-Z5M4YYWT.js';
4
4
  import '../chunk-F6GOQAYU.js';
5
5
  import '../chunk-6L27TXQZ.js';
@@ -1,5 +1,5 @@
1
- export { notification } from '../chunk-EF5DMYAD.js';
2
- import '../chunk-MKT66FON.js';
1
+ export { notification } from '../chunk-G7BQM7RU.js';
2
+ import '../chunk-JOLKCJWI.js';
3
3
  import '../chunk-Z5M4YYWT.js';
4
4
  import '../chunk-F6GOQAYU.js';
5
5
  import '../chunk-6L27TXQZ.js';
package/dist/api/order.js CHANGED
@@ -1,7 +1,7 @@
1
- export { order } from '../chunk-KURYDW5X.js';
2
- import '../chunk-QKG7RKNB.js';
1
+ export { order } from '../chunk-5U26XIYM.js';
2
+ import '../chunk-QVKKI5MG.js';
3
3
  import '../chunk-OUW6WESU.js';
4
- import '../chunk-MKT66FON.js';
4
+ import '../chunk-JOLKCJWI.js';
5
5
  import '../chunk-Z5M4YYWT.js';
6
6
  import '../chunk-GHKOMS3G.js';
7
7
  import '../chunk-F6GOQAYU.js';
package/dist/api/page.js CHANGED
@@ -1,7 +1,7 @@
1
- export { page } from '../chunk-ZHLPTETE.js';
2
- import '../chunk-QKG7RKNB.js';
1
+ export { page } from '../chunk-BOW6FYVT.js';
2
+ import '../chunk-QVKKI5MG.js';
3
3
  import '../chunk-OUW6WESU.js';
4
- import '../chunk-MKT66FON.js';
4
+ import '../chunk-JOLKCJWI.js';
5
5
  import '../chunk-Z5M4YYWT.js';
6
6
  import '../chunk-GHKOMS3G.js';
7
7
  import '../chunk-F6GOQAYU.js';
@@ -1,7 +1,7 @@
1
- export { getProductPreview, isProductPreviewQuery, parseNextPageToken, product, productDetailQueryKey, productPreviewQueryKey, rememberProductPreview, shouldDehydrateQuery } from '../chunk-R6W262WD.js';
2
- import '../chunk-QKG7RKNB.js';
1
+ export { getProductPreview, isProductPreviewQuery, parseNextPageToken, product, productDetailQueryKey, productPreviewQueryKey, rememberProductPreview, shouldDehydrateQuery } from '../chunk-FBRQ27SR.js';
2
+ import '../chunk-QVKKI5MG.js';
3
3
  import '../chunk-OUW6WESU.js';
4
- import '../chunk-MKT66FON.js';
4
+ import '../chunk-JOLKCJWI.js';
5
5
  import '../chunk-Z5M4YYWT.js';
6
6
  import '../chunk-GHKOMS3G.js';
7
7
  import '../chunk-F6GOQAYU.js';
@@ -1,4 +1,4 @@
1
- import { api } from '../chunk-MKT66FON.js';
1
+ import { api } from '../chunk-JOLKCJWI.js';
2
2
  import '../chunk-Z5M4YYWT.js';
3
3
  import '../chunk-F6GOQAYU.js';
4
4
  import '../chunk-6L27TXQZ.js';
package/dist/api/store.js CHANGED
@@ -1,6 +1,6 @@
1
- export { store } from '../chunk-ZHVG76UU.js';
1
+ export { store } from '../chunk-LRJWJNJS.js';
2
2
  import '../chunk-FFN6BITL.js';
3
- import '../chunk-MKT66FON.js';
3
+ import '../chunk-JOLKCJWI.js';
4
4
  import '../chunk-Z5M4YYWT.js';
5
5
  import '../chunk-F6GOQAYU.js';
6
6
  export { resolveStoreIdentifier } from '../chunk-6L27TXQZ.js';
@@ -1,5 +1,5 @@
1
- export { commonTranslationsPath, storeTranslationsPath, translations } from '../chunk-5RZDS4XS.js';
2
- import '../chunk-MKT66FON.js';
1
+ export { commonTranslationsPath, storeTranslationsPath, translations } from '../chunk-4NA4FWJR.js';
2
+ import '../chunk-JOLKCJWI.js';
3
3
  import '../chunk-Z5M4YYWT.js';
4
4
  import '../chunk-F6GOQAYU.js';
5
5
  import '../chunk-6L27TXQZ.js';
package/dist/api/user.js CHANGED
@@ -1,5 +1,5 @@
1
- export { user } from '../chunk-AC7S2D2Y.js';
2
- import '../chunk-MKT66FON.js';
1
+ export { user } from '../chunk-WJB3YBF5.js';
2
+ import '../chunk-JOLKCJWI.js';
3
3
  import '../chunk-Z5M4YYWT.js';
4
4
  import '../chunk-F6GOQAYU.js';
5
5
  import '../chunk-6L27TXQZ.js';
@@ -1,5 +1,5 @@
1
- export { wallet } from '../chunk-UAU7H5AY.js';
2
- import '../chunk-MKT66FON.js';
1
+ export { wallet } from '../chunk-XL6ITANU.js';
2
+ import '../chunk-JOLKCJWI.js';
3
3
  import '../chunk-Z5M4YYWT.js';
4
4
  import '../chunk-F6GOQAYU.js';
5
5
  import '../chunk-6L27TXQZ.js';
@@ -1,8 +1,8 @@
1
- export { wishlist } from '../chunk-WHVHV5WH.js';
2
- import '../chunk-R6W262WD.js';
3
- import '../chunk-QKG7RKNB.js';
1
+ export { wishlist } from '../chunk-MCHRCHO3.js';
2
+ import '../chunk-FBRQ27SR.js';
3
+ import '../chunk-QVKKI5MG.js';
4
4
  import '../chunk-OUW6WESU.js';
5
- import '../chunk-MKT66FON.js';
5
+ import '../chunk-JOLKCJWI.js';
6
6
  import '../chunk-Z5M4YYWT.js';
7
7
  import '../chunk-GHKOMS3G.js';
8
8
  import '../chunk-F6GOQAYU.js';
@@ -1,5 +1,5 @@
1
- import { orThrow } from './chunk-QKG7RKNB.js';
2
- import { api } from './chunk-MKT66FON.js';
1
+ import { orThrow } from './chunk-QVKKI5MG.js';
2
+ import { api } from './chunk-JOLKCJWI.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
5
5
  var blog = {
@@ -63,5 +63,5 @@ var blog = {
63
63
  };
64
64
 
65
65
  export { blog };
66
- //# sourceMappingURL=chunk-UHR6OQQ2.js.map
67
- //# sourceMappingURL=chunk-UHR6OQQ2.js.map
66
+ //# sourceMappingURL=chunk-2B3TEWS5.js.map
67
+ //# sourceMappingURL=chunk-2B3TEWS5.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/blog.ts"],"names":[],"mappings":";;;;AAyCO,IAAM,IAAA,GAAO;AAAA,EAClB,GAAA,EAAK,OAAO,MAAA,KAAgD;AAC1D,IAAA,MAAM,UAAmC,EAAC;AAC1C,IAAA,IAAI,MAAA,UAAgB,MAAA,GAAS,MAAA;AAE7B,IAAA,MAAM,WAAW,MAAM,GAAA,CAAI,IAAI,MAAA,EAAQ,OAAoB,EAAE,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,CAAK,QAAA,CAAS,IAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,MAAA,EAAQ;AAAA,KAClE,CAAA;AAAA,IACH,OAAA,EAAS,CAAC,EAAA,KACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,SAAA,EAAW,EAAE,CAAA;AAAA,MAChC,OAAA,EAAS,CAAC,EAAE,MAAA,OAAa,IAAA,CAAK,QAAA,CAAS,IAAA,CAAK,EAAA,EAAI,MAAM;AAAA,KACvD;AAAA;AAEP","file":"chunk-UHR6OQQ2.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport type { Options as KyOptions } from 'ky';\nimport { api } from './client';\nimport type { Pagination } from './types';\nimport type {\n ArticleSummary,\n ArticleDetail,\n BlogAuthor,\n BlogCategory,\n BlogTag,\n BlogOverview,\n} from '../routes/blog/types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport interface BlogArticlesListParams {\n category?: string;\n author?: string;\n tag?: string;\n page?: number;\n cursor?: string | null;\n signal?: AbortSignal;\n}\n\nexport interface BlogArticlesListResponse {\n data: ArticleSummary[];\n categories?: BlogCategory[];\n category: BlogCategory;\n author: BlogAuthor;\n tag: BlogTag;\n cursor: Pagination;\n}\n\nexport interface BlogGetResponse {\n data: {\n categories: BlogCategory[] | null;\n slides: ArticleSummary[] | null;\n articles: ArticleSummary[] | null;\n popular: ArticleSummary[] | null;\n };\n}\n\nexport const blog = {\n get: async (signal?: AbortSignal): Promise<BlogOverview> => {\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api.get('blog', options as KyOptions).json<BlogGetResponse>();\n\n return {\n categories: response.data.categories ?? [],\n slides: response.data.slides ?? [],\n articles: response.data.articles ?? [],\n popular: response.data.popular ?? [],\n };\n },\n\n articles: {\n list: async (params?: BlogArticlesListParams): Promise<BlogArticlesListResponse> => {\n const { category, author, tag, page, cursor, signal } = params ?? {};\n\n const searchParams = new URLSearchParams();\n if (page !== undefined) searchParams.set('page', String(page));\n if (cursor) searchParams.set('cursor', cursor);\n if (category) searchParams.set('category', category);\n if (author) searchParams.set('author', author);\n if (tag) searchParams.set('tag', tag);\n\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`blog/articles?${searchParams.toString()}`, options as KyOptions)\n .json<{\n data: ArticleSummary[] | null;\n categories?: BlogCategory[] | null;\n category: BlogCategory;\n author: BlogAuthor;\n tag: BlogTag;\n cursor: Pagination;\n }>();\n\n return {\n data: response.data ?? [],\n categories: response.categories ?? undefined,\n category: response.category,\n author: response.author,\n tag: response.tag,\n cursor: response.cursor,\n };\n },\n\n find: async (id: string, signal?: AbortSignal): Promise<ArticleDetail> => {\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`blog/articles/${id}`, options as KyOptions)\n .json<{ data: ArticleDetail | null }>();\n\n if (!response.data) {\n throw new Error(`Article ${id} not found`);\n }\n\n return response.data;\n },\n\n findOrThrow: (id: string, signal?: AbortSignal): Promise<ArticleDetail> =>\n orThrow(blog.articles.find(id, signal)),\n },\n\n queries: {\n overview: () =>\n queryOptions({\n queryKey: ['blog', 'overview'],\n queryFn: ({ signal }) => blog.get(signal),\n }),\n articles: (params?: Omit<BlogArticlesListParams, 'signal'>) =>\n queryOptions({\n queryKey: ['blog', 'articles', params],\n queryFn: ({ signal }) => blog.articles.list({ ...params, signal }),\n }),\n article: (id: string) =>\n queryOptions({\n queryKey: ['blog', 'article', id],\n queryFn: ({ signal }) => blog.articles.find(id, signal),\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/blog.ts"],"names":[],"mappings":";;;;AAyCO,IAAM,IAAA,GAAO;AAAA,EAClB,GAAA,EAAK,OAAO,MAAA,KAAgD;AAC1D,IAAA,MAAM,UAAmC,EAAC;AAC1C,IAAA,IAAI,MAAA,UAAgB,MAAA,GAAS,MAAA;AAE7B,IAAA,MAAM,WAAW,MAAM,GAAA,CAAI,IAAI,MAAA,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AA,EAAO,KAAM,IAAA,CAAK,QAAA,CAAS,IAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,MAAA,EAAQ;AAAA,KAClE,CAAA;AAAA,IACH,OAAA,EAAS,CAAC,EAAA,KACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,SAAA,EAAW,EAAE,CAAA;AAAA,MAChC,OAAA,EAAS,CAAC,EAAE,MAAA,OAAa,IAAA,CAAK,QAAA,CAAS,IAAA,CAAK,EAAA,EAAI,MAAM;AAAA,KACvD;AAAA;AAEP","file":"chunk-2B3TEWS5.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport type { Options as KyOptions } from 'ky';\nimport { api } from './client';\nimport type { Pagination } from './types';\nimport type {\n ArticleSummary,\n ArticleDetail,\n BlogAuthor,\n BlogCategory,\n BlogTag,\n BlogOverview,\n} from '../routes/blog/types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport interface BlogArticlesListParams {\n category?: string;\n author?: string;\n tag?: string;\n page?: number;\n cursor?: string | null;\n signal?: AbortSignal;\n}\n\nexport interface BlogArticlesListResponse {\n data: ArticleSummary[];\n categories?: BlogCategory[];\n category: BlogCategory;\n author: BlogAuthor;\n tag: BlogTag;\n cursor: Pagination;\n}\n\nexport interface BlogGetResponse {\n data: {\n categories: BlogCategory[] | null;\n slides: ArticleSummary[] | null;\n articles: ArticleSummary[] | null;\n popular: ArticleSummary[] | null;\n };\n}\n\nexport const blog = {\n get: async (signal?: AbortSignal): Promise<BlogOverview> => {\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api.get('blog', options as KyOptions).json<BlogGetResponse>();\n\n return {\n categories: response.data.categories ?? [],\n slides: response.data.slides ?? [],\n articles: response.data.articles ?? [],\n popular: response.data.popular ?? [],\n };\n },\n\n articles: {\n list: async (params?: BlogArticlesListParams): Promise<BlogArticlesListResponse> => {\n const { category, author, tag, page, cursor, signal } = params ?? {};\n\n const searchParams = new URLSearchParams();\n if (page !== undefined) searchParams.set('page', String(page));\n if (cursor) searchParams.set('cursor', cursor);\n if (category) searchParams.set('category', category);\n if (author) searchParams.set('author', author);\n if (tag) searchParams.set('tag', tag);\n\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`blog/articles?${searchParams.toString()}`, options as KyOptions)\n .json<{\n data: ArticleSummary[] | null;\n categories?: BlogCategory[] | null;\n category: BlogCategory;\n author: BlogAuthor;\n tag: BlogTag;\n cursor: Pagination;\n }>();\n\n return {\n data: response.data ?? [],\n categories: response.categories ?? undefined,\n category: response.category,\n author: response.author,\n tag: response.tag,\n cursor: response.cursor,\n };\n },\n\n find: async (id: string, signal?: AbortSignal): Promise<ArticleDetail> => {\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`blog/articles/${id}`, options as KyOptions)\n .json<{ data: ArticleDetail | null }>();\n\n if (!response.data) {\n throw new Error(`Article ${id} not found`);\n }\n\n return response.data;\n },\n\n findOrThrow: (id: string, signal?: AbortSignal): Promise<ArticleDetail> =>\n orThrow(blog.articles.find(id, signal)),\n },\n\n queries: {\n overview: () =>\n queryOptions({\n queryKey: ['blog', 'overview'],\n queryFn: ({ signal }) => blog.get(signal),\n }),\n articles: (params?: Omit<BlogArticlesListParams, 'signal'>) =>\n queryOptions({\n queryKey: ['blog', 'articles', params],\n queryFn: ({ signal }) => blog.articles.list({ ...params, signal }),\n }),\n article: (id: string) =>\n queryOptions({\n queryKey: ['blog', 'article', id],\n queryFn: ({ signal }) => blog.articles.find(id, signal),\n }),\n },\n};\n"]}
@@ -1,5 +1,5 @@
1
- import { orThrow } from './chunk-QKG7RKNB.js';
2
- import { api } from './chunk-MKT66FON.js';
1
+ import { orThrow } from './chunk-QVKKI5MG.js';
2
+ import { api } from './chunk-JOLKCJWI.js';
3
3
  import { getSallaSDK } from './chunk-F6GOQAYU.js';
4
4
  import { queryOptions } from '@tanstack/react-query';
5
5
 
@@ -44,5 +44,5 @@ var cart = {
44
44
  };
45
45
 
46
46
  export { cart };
47
- //# sourceMappingURL=chunk-AITHXRMX.js.map
48
- //# sourceMappingURL=chunk-AITHXRMX.js.map
47
+ //# sourceMappingURL=chunk-36ZY4C3I.js.map
48
+ //# sourceMappingURL=chunk-36ZY4C3I.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/cart.ts"],"names":[],"mappings":";;;;;AAaA,SAAS,sBAAsB,IAAA,EAAoC;AACjE,EAAA,IAAI,CAAC,IAAA,CAAK,IAAA,EAAM,OAAO,IAAA;AACvB,EAAA,OAAO;AAAA,IACL,GAAG,IAAA,CAAK,IAAA;AAAA,IACR,OAAA,EAAS,KAAK,OAAA,IAAW,IAAA;AAAA;AAAA,IAEzB,IAAA,EAAM,IAAA,CAAK,IAAA,IAAQ,IAAA,CAAK,KAAK,IAAA,IAAQ;AAAA,GACvC;AACF;AAEO,IAAM,IAAA,GAAO;AAAA,EAClB,GAAA,EAAK,OAAO,MAAA,KAAyC;AACnD,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,KAAA,EAAQ,MAAM,CAAA,CAAE,CAAA,CAAE,IAAA,EAAgC;AACjF,IAAA,OAAO,sBAAsB,IAAI,CAAA;AAAA,EACnC,CAAA;AAAA,EAEA,YAAY,CAAC,MAAA,KAAyC,QAAQ,IAAA,CAAK,GAAA,CAAI,MAAM,CAAC,CAAA;AAAA;AAAA,EAG9E,cAAc,YAAoC;AAChD,IAAA,MAAM,QAAQ,WAAA,EAAY;AAC1B,IAAA,IAAI,CAAC,OAAO,OAAO,IAAA;AAEnB,IAAA,MAAM,KAAA,CAAM,OAAA,EAAQ,CAAE,KAAA,CAAM,MAAM,MAAS,CAAA;AAC3C,IAAA,OAAO,KAAA,CAAM,IAAA,CAAK,GAAA,CAAI,gBAAA,EAAiB;AAAA,EACzC,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,CAAC,MAAA,KACP,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,MAAM,CAAA;AAAA,MACzB,OAAA,EAAS,MAAM,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA;AAAA;AAAA,MAE9B,SAAA,EAAW,CAAA;AAAA,MACX,MAAA,EAAQ;AAAA,KACT,CAAA;AAAA,IACH,SAAA,EAAW,MACT,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,YAAY,CAAA;AAAA,MAC/B,OAAA,EAAS,MAAM,IAAA,CAAK,YAAA,EAAa;AAAA;AAAA,MAEjC,SAAA,EAAW,CAAA;AAAA,MACX,MAAA,EAAQ;AAAA,KACT;AAAA;AAEP","file":"chunk-AITHXRMX.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { Cart } from '../types';\nimport { orThrow } from '../providers/NavigationProvider';\nimport { getSallaSDK } from '../utils/sdk-helpers';\n\nexport interface CartApiResponse {\n /** Absent once the cart was turned into an order (the body then carries a top-level `redirect`). */\n cart?: Omit<Cart, 'loyalty'>;\n loyalty?: Cart['loyalty'];\n gift?: Cart['gift'];\n}\n\nfunction normalizeCartResponse(data: CartApiResponse): Cart | null {\n if (!data.cart) return null;\n return {\n ...data.cart,\n loyalty: data.loyalty ?? null,\n // The API sends `gift` inside `cart`.\n gift: data.gift ?? data.cart.gift ?? null,\n } as Cart;\n}\n\nexport const cart = {\n get: async (cartId: number): Promise<Cart | null> => {\n const { data } = await api.get(`cart/${cartId}`).json<{ data: CartApiResponse }>();\n return normalizeCartResponse(data);\n },\n\n getOrThrow: (cartId: number): Promise<Cart | null> => orThrow(cart.get(cartId)),\n\n /** The visitor's cart id, which only the Salla SDK knows; `null` outside the browser. */\n getCurrentId: async (): Promise<number | null> => {\n const salla = getSallaSDK();\n if (!salla) return null;\n // The app bundle can run before the SDK module, when `salla` is still the head stub.\n await salla.onReady().catch(() => undefined);\n return salla.cart.api.getCurrentCartId();\n },\n\n queries: {\n detail: (cartId: number) =>\n queryOptions({\n queryKey: ['cart', cartId],\n queryFn: () => cart.get(cartId),\n // The SDK changes the cart from any page, so a cached copy is never safe to show.\n staleTime: 0,\n gcTime: 0,\n }),\n currentId: () =>\n queryOptions({\n queryKey: ['cart', 'current-id'],\n queryFn: () => cart.getCurrentId(),\n // Completing an order starts a new cart, so an earlier id is never reused.\n staleTime: 0,\n gcTime: 0,\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/cart.ts"],"names":[],"mappings":";;;;;AAaA,SAAS,sBAAsB,IAAA,EAAoC;AACjE,EAAA,IAAI,CAAC,IAAA,CAAK,IAAA,EAAM,OAAO,IAAA;AACvB,EAAA,OAAO;AAAA,IACL,GAAG,IAAA,CAAK,IAAA;AAAA,IACR,OAAA,EAAS,KAAK,OAAA,IAAW,IAAA;AAAA;AAAA,IAEzB,IAAA,EAAM,IAAA,CAAK,IAAA,IAAQ,IAAA,CAAK,KAAK,IAAA,IAAQ;AAAA,GACvC;AACF;AAEO,IAAM,IAAA,GAAO;AAAA,EAClB,GAAA,EAAK,OAAO,MAAA,KAAyC;AACnD,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,KAAA,EAAQ,MAAM,CAAA,CAAE,CAAA,CAAE,IAAA,EAAgC;AACjF,IAAA,OAAO,sBAAsB,IAAI,CAAA;AAAA,EACnC,CAAA;AAAA,EAEA,YAAY,CAAC,MAAA,KAAyC,QAAQ,IAAA,CAAK,GAAA,CAAI,MAAM,CAAC,CAAA;AAAA;AAAA,EAG9E,cAAc,YAAoC;AAChD,IAAA,MAAM,QAAQ,WAAA,EAAY;AAC1B,IAAA,IAAI,CAAC,OAAO,OAAO,IAAA;AAEnB,IAAA,MAAM,KAAA,CAAM,OAAA,EAAQ,CAAE,KAAA,CAAM,MAAM,MAAS,CAAA;AAC3C,IAAA,OAAO,KAAA,CAAM,IAAA,CAAK,GAAA,CAAI,gBAAA,EAAiB;AAAA,EACzC,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,CAAC,MAAA,KACP,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,MAAM,CAAA;AAAA,MACzB,OAAA,EAAS,MAAM,IAAA,CAAK,GAAA,CAAI,MAAM,CAAA;AAAA;AAAA,MAE9B,SAAA,EAAW,CAAA;AAAA,MACX,MAAA,EAAQ;AAAA,KACT,CAAA;AAAA,IACH,SAAA,EAAW,MACT,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,YAAY,CAAA;AAAA,MAC/B,OAAA,EAAS,MAAM,IAAA,CAAK,YAAA,EAAa;AAAA;AAAA,MAEjC,SAAA,EAAW,CAAA;AAAA,MACX,MAAA,EAAQ;AAAA,KACT;AAAA;AAEP","file":"chunk-36ZY4C3I.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { Cart } from '../types';\nimport { orThrow } from '../providers/NavigationProvider';\nimport { getSallaSDK } from '../utils/sdk-helpers';\n\nexport interface CartApiResponse {\n /** Absent once the cart was turned into an order (the body then carries a top-level `redirect`). */\n cart?: Omit<Cart, 'loyalty'>;\n loyalty?: Cart['loyalty'];\n gift?: Cart['gift'];\n}\n\nfunction normalizeCartResponse(data: CartApiResponse): Cart | null {\n if (!data.cart) return null;\n return {\n ...data.cart,\n loyalty: data.loyalty ?? null,\n // The API sends `gift` inside `cart`.\n gift: data.gift ?? data.cart.gift ?? null,\n } as Cart;\n}\n\nexport const cart = {\n get: async (cartId: number): Promise<Cart | null> => {\n const { data } = await api.get(`cart/${cartId}`).json<{ data: CartApiResponse }>();\n return normalizeCartResponse(data);\n },\n\n getOrThrow: (cartId: number): Promise<Cart | null> => orThrow(cart.get(cartId)),\n\n /** The visitor's cart id, which only the Salla SDK knows; `null` outside the browser. */\n getCurrentId: async (): Promise<number | null> => {\n const salla = getSallaSDK();\n if (!salla) return null;\n // The app bundle can run before the SDK module, when `salla` is still the head stub.\n await salla.onReady().catch(() => undefined);\n return salla.cart.api.getCurrentCartId();\n },\n\n queries: {\n detail: (cartId: number) =>\n queryOptions({\n queryKey: ['cart', cartId],\n queryFn: () => cart.get(cartId),\n // The SDK changes the cart from any page, so a cached copy is never safe to show.\n staleTime: 0,\n gcTime: 0,\n }),\n currentId: () =>\n queryOptions({\n queryKey: ['cart', 'current-id'],\n queryFn: () => cart.getCurrentId(),\n // Completing an order starts a new cart, so an earlier id is never reused.\n staleTime: 0,\n gcTime: 0,\n }),\n },\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { api } from './chunk-MKT66FON.js';
1
+ import { api } from './chunk-JOLKCJWI.js';
2
2
  import { queryOptions } from '@tanstack/react-query';
3
3
 
4
4
  var apps = {
@@ -40,5 +40,5 @@ var apps = {
40
40
  };
41
41
 
42
42
  export { apps };
43
- //# sourceMappingURL=chunk-2BSPH5XN.js.map
44
- //# sourceMappingURL=chunk-2BSPH5XN.js.map
43
+ //# sourceMappingURL=chunk-3WW5RRMV.js.map
44
+ //# sourceMappingURL=chunk-3WW5RRMV.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/apps.ts"],"names":[],"mappings":";;;AAmCO,IAAM,IAAA,GAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlB,UAAU,YAAmC;AAC3C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,eAAA,EAAiB,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA,CACtC,IAAA,EAA8B;AACjC,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU,YAAkC;AAC1C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,wBAAA,EAA0B,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA,CAC/C,IAAA,EAAsC;AACzC,IAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,IAAQ,EAAC,EAAE;AAAA,EAClC,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,QAAA,EAAU,MACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC7B,OAAA,EAAS,MAAM,IAAA,CAAK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA;AAAA;AAAA;AAAA,MAIX,KAAA,EAAO;AAAA,KACR,CAAA;AAAA,IAEH,QAAA,EAAU,MACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC7B,OAAA,EAAS,MAAM,IAAA,CAAK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA,MACX,KAAA,EAAO;AAAA,KACR;AAAA;AAEP","file":"chunk-2BSPH5XN.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\n\nexport interface AppSnippetRow {\n place: string;\n content: string;\n url?: string | null;\n /**\n * Raw snippet id, emitted as `data-snippet-id`. Present only on CDN rows — the\n * inline branch of the backend's snippet parser omits the key entirely.\n */\n id?: number;\n /** `{{customer.x}}` placeholders in `content` to substitute from SDK config `user.*` keys. */\n customer_parameters?: string[];\n}\n\nexport interface AppSnippet {\n service: string;\n app_id: string;\n /** Encoded app id (`getRouteKey()`): the scope id its snippets bind to via `data-scope-id`,\n * and its settings-bucket key. Absent on payloads predating the settings API. */\n id?: string;\n app_slug: string;\n status: string;\n snippets: AppSnippetRow[];\n}\n\n/**\n * Per-app public `app.*` buckets for CDN snippets, keyed by encoded app id (== `AppSnippet.id`,\n * the `Salla.appScope` scope id). One isolated bucket per app; reads within a scope are bare `app.*`.\n */\nexport interface AppSettings {\n apps: Record<string, Record<string, unknown>>;\n}\n\nexport const apps = {\n /**\n * Installed apps' snippets (scripts/HTML to inject). Timeout-bounded because it's awaited in\n * rootBeforeLoad (SSR/TTFB): a slow response degrades to no CDN tags, never stalls the page.\n */\n snippets: async (): Promise<AppSnippet[]> => {\n const { data } = await api\n .get('apps/snippets', { timeout: 2500 })\n .json<{ data?: AppSnippet[] }>();\n return data ?? [];\n },\n\n /**\n * Per-app public `app.*` buckets, keyed by encoded app id. Timeout-bounded (SSR-awaited):\n * a slow response degrades to empty buckets (fail-open), never strands injection.\n */\n settings: async (): Promise<AppSettings> => {\n const { data } = await api\n .get('apps/snippets/settings', { timeout: 2500 })\n .json<{ data?: Partial<AppSettings> }>();\n return { apps: data?.apps ?? {} };\n },\n\n queries: {\n snippets: () =>\n queryOptions({\n queryKey: ['apps', 'snippets'],\n queryFn: () => apps.snippets(),\n // Snippets are static per session; one fetch per page load is enough.\n staleTime: Infinity,\n // No retry: this is awaited in rootBeforeLoad, so the router's default `retry: 1` would\n // make the SSR wait 2 x the 2500ms timeout (plus backoff) before failing open. The\n // 2500ms timeout must be the whole budget; the client fallback query does the retrying.\n retry: 0,\n }),\n\n settings: () =>\n queryOptions({\n queryKey: ['apps', 'settings'],\n queryFn: () => apps.settings(),\n // Encoded app ids and their buckets are stable per page; one fetch is enough.\n staleTime: Infinity,\n retry: 0,\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/apps.ts"],"names":[],"mappings":";;;AAmCO,IAAM,IAAA,GAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlB,UAAU,YAAmC;AAC3C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,eAAA,EAAiB,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA,CACtC,IAAA,EAA8B;AACjC,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU,YAAkC;AAC1C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,wBAAA,EAA0B,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA,CAC/C,IAAA,EAAsC;AACzC,IAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,IAAQ,EAAC,EAAE;AAAA,EAClC,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,QAAA,EAAU,MACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC7B,OAAA,EAAS,MAAM,IAAA,CAAK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA;AAAA;AAAA;AAAA,MAIX,KAAA,EAAO;AAAA,KACR,CAAA;AAAA,IAEH,QAAA,EAAU,MACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC7B,OAAA,EAAS,MAAM,IAAA,CAAK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA,MACX,KAAA,EAAO;AAAA,KACR;AAAA;AAEP","file":"chunk-3WW5RRMV.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\n\nexport interface AppSnippetRow {\n place: string;\n content: string;\n url?: string | null;\n /**\n * Raw snippet id, emitted as `data-snippet-id`. Present only on CDN rows — the\n * inline branch of the backend's snippet parser omits the key entirely.\n */\n id?: number;\n /** `{{customer.x}}` placeholders in `content` to substitute from SDK config `user.*` keys. */\n customer_parameters?: string[];\n}\n\nexport interface AppSnippet {\n service: string;\n app_id: string;\n /** Encoded app id (`getRouteKey()`): the scope id its snippets bind to via `data-scope-id`,\n * and its settings-bucket key. Absent on payloads predating the settings API. */\n id?: string;\n app_slug: string;\n status: string;\n snippets: AppSnippetRow[];\n}\n\n/**\n * Per-app public `app.*` buckets for CDN snippets, keyed by encoded app id (== `AppSnippet.id`,\n * the `Salla.appScope` scope id). One isolated bucket per app; reads within a scope are bare `app.*`.\n */\nexport interface AppSettings {\n apps: Record<string, Record<string, unknown>>;\n}\n\nexport const apps = {\n /**\n * Installed apps' snippets (scripts/HTML to inject). Timeout-bounded because it's awaited in\n * rootBeforeLoad (SSR/TTFB): a slow response degrades to no CDN tags, never stalls the page.\n */\n snippets: async (): Promise<AppSnippet[]> => {\n const { data } = await api\n .get('apps/snippets', { timeout: 2500 })\n .json<{ data?: AppSnippet[] }>();\n return data ?? [];\n },\n\n /**\n * Per-app public `app.*` buckets, keyed by encoded app id. Timeout-bounded (SSR-awaited):\n * a slow response degrades to empty buckets (fail-open), never strands injection.\n */\n settings: async (): Promise<AppSettings> => {\n const { data } = await api\n .get('apps/snippets/settings', { timeout: 2500 })\n .json<{ data?: Partial<AppSettings> }>();\n return { apps: data?.apps ?? {} };\n },\n\n queries: {\n snippets: () =>\n queryOptions({\n queryKey: ['apps', 'snippets'],\n queryFn: () => apps.snippets(),\n // Snippets are static per session; one fetch per page load is enough.\n staleTime: Infinity,\n // No retry: this is awaited in rootBeforeLoad, so the router's default `retry: 1` would\n // make the SSR wait 2 x the 2500ms timeout (plus backoff) before failing open. The\n // 2500ms timeout must be the whole budget; the client fallback query does the retrying.\n retry: 0,\n }),\n\n settings: () =>\n queryOptions({\n queryKey: ['apps', 'settings'],\n queryFn: () => apps.settings(),\n // Encoded app ids and their buckets are stable per page; one fetch is enough.\n staleTime: Infinity,\n retry: 0,\n }),\n },\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { filesCdn, cdn } from './chunk-MKT66FON.js';
1
+ import { filesCdn, cdn } from './chunk-JOLKCJWI.js';
2
2
  import { storeTranslationsQueryKey, translationsQueryKey, composeMessages, isPlainObject } from './chunk-AWV3WEKH.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-5RZDS4XS.js.map
130
- //# sourceMappingURL=chunk-5RZDS4XS.js.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A;AAAA;AAAA;AAAA;AAAA;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-5RZDS4XS.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,C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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-4NA4FWJR.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 { getActiveScope, api } from './chunk-MKT66FON.js';
1
+ import { getActiveScope, api } from './chunk-JOLKCJWI.js';
2
2
  import { queryOptions } from '@tanstack/react-query';
3
3
 
4
4
  async function list(params) {
@@ -45,5 +45,5 @@ var home = {
45
45
  };
46
46
 
47
47
  export { home };
48
- //# sourceMappingURL=chunk-YAFF6BST.js.map
49
- //# sourceMappingURL=chunk-YAFF6BST.js.map
48
+ //# sourceMappingURL=chunk-4YBXC6VB.js.map
49
+ //# sourceMappingURL=chunk-4YBXC6VB.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/home.ts"],"names":[],"mappings":";;;AAQA,eAAe,KAAK,MAAA,EAA+D;AACjF,EAAA,MAAM,KAAA,GAAQ,SAAS,CAAA,CAAA,EAAI,IAAI,gBAAgB,MAAM,CAAA,CAAE,QAAA,EAAU,CAAA,CAAA,GAAK,EAAA;AACtE,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IA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OAAA,CAAQ,KAAK,CAAA,CAAE,IAAI,CAAC,CAAC,GAAA,EAAK,EAAE,MAAM,CAAC,GAAA,EAAK,MAAA,CAAO,EAAE,CAAC,CAAC;AAAA,KAC5D;AACA,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,CAAK,EAAE,OAAO,IAAA,EAAM,GAAG,aAAa,CAAA;AACzD,IAAA,OAAO,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,MAAW,EAAE,GAAG,KAAA,EAAO,IAAA,EAAM,KAAA,CAAM,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAS,EAAE,GAAE,CAAE,CAAA;AAAA,EACpF,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,UAAA,EAAY,MACV,YAAA,CAAa;AAAA;AAAA,MAEX,QAAA,EAAU,CAAC,MAAA,EAAQ,YAAA,EAAc,EAAE,KAAA,EAAO,cAAA,IAAkB,CAAA;AAAA,MAC5D,OAAA,EAAS,MAAM,IAAA,CAAK,UAAA;AAAW,KAChC,CAAA;AAAA,IAEH,MAAA,EAAQ,CAAC,IAAA,EAAc,KAAA,KACrB,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,QAAA,EAAU,MAAM,KAAK,CAAA;AAAA,MACxC,OAAA,EAAS,MAAM,IAAA,CAAK,MAAA,CAAO,MAAM,KAAK;AAAA,KACvC;AAAA;AAEP","file":"chunk-YAFF6BST.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport type { HomeComponentData } from '../types';\n\n/** The page a hook's blocks render on; blocks can target specific products, categories or pages. */\nexport type BlockScope =\n { product_id: number | string } | { category_id: number | string } | { page_id: number | string };\n\nasync function list(params?: Record<string, string>): Promise<HomeComponentData[]> {\n const query = params ? `?${new URLSearchParams(params).toString()}` : '';\n const { data } = await api.get(`component/list${query}`).json<{ data: HomeComponentData[] }>();\n return data ?? [];\n}\n\n/** `blocks` minus each of `excluded`, matched by content: the API sends no id or order to match on. */\nfunction without(blocks: HomeComponentData[], excluded: HomeComponentData[]): HomeComponentData[] {\n if (!excluded.length) return blocks;\n const paths = new Set(excluded.map((block) => block.path));\n const left = excluded.map((block) => JSON.stringify(block));\n return blocks.filter((block) => {\n if (!paths.has(block.path)) return true;\n const index = left.indexOf(JSON.stringify(block));\n if (index === -1) return true;\n left.splice(index, 1);\n return false;\n });\n}\n\nexport const home = {\n components: async (): Promise<HomeComponentData[]> => {\n // The unfiltered list also has the product, category and page blocks, which the home leaves out.\n const [blocks, pageBlocks] = await Promise.all([list(), list({ show_in: 'pages' })]);\n return without(blocks, pageBlocks);\n },\n\n /** The blocks the merchant placed at `hook` on a product, category or page. */\n blocks: async (hook: string, scope: BlockScope): Promise<HomeComponentData[]> => {\n const scopeParams = Object.fromEntries(\n Object.entries(scope).map(([key, id]) => [key, String(id)])\n );\n const blocks = await list({ hooks: hook, ...scopeParams });\n return blocks.map((block) => ({ ...block, path: block.path.replace('home.', '') }));\n },\n\n queries: {\n components: () =>\n queryOptions({\n // Each market (scope) has its own theme version, and its own home page with it.\n queryKey: ['home', 'components', { scope: getActiveScope() }],\n queryFn: () => home.components(),\n }),\n\n blocks: (hook: string, scope: BlockScope) =>\n queryOptions({\n queryKey: ['home', 'blocks', hook, scope],\n queryFn: () => home.blocks(hook, scope),\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/home.ts"],"names":[],"mappings":";;;AAQA,eAAe,KAAK,MAAA,EAA+D;AACjF,EAAA,MAAM,KAAA,GAAQ,SAAS,CAAA,CAAA,EAAI,IAAI,gBAAgB,MAAM,CAAA,CAAE,QAAA,EAAU,CAAA,CAAA,GAAK,EAAA;AACtE,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,cAAA,EAAiB,KAAK,CAAA,CAAE,CAAA,CAAE,IAAA,EAAoC;AAC7F,EAAA,OAAO,QAAQ,EAAC;AAClB;AAGA,SAAS,OAAA,CA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A,KAC5D;AACA,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,CAAK,EAAE,OAAO,IAAA,EAAM,GAAG,aAAa,CAAA;AACzD,IAAA,OAAO,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,MAAW,EAAE,GAAG,KAAA,EAAO,IAAA,EAAM,KAAA,CAAM,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAS,EAAE,GAAE,CAAE,CAAA;AAAA,EACpF,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,UAAA,EAAY,MACV,YAAA,CAAa;AAAA;AAAA,MAEX,QAAA,EAAU,CAAC,MAAA,EAAQ,YAAA,EAAc,EAAE,KAAA,EAAO,cAAA,IAAkB,CAAA;AAAA,MAC5D,OAAA,EAAS,MAAM,IAAA,CAAK,UAAA;AAAW,KAChC,CAAA;AAAA,IAEH,MAAA,EAAQ,CAAC,IAAA,EAAc,KAAA,KACrB,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,QAAA,EAAU,MAAM,KAAK,CAAA;AAAA,MACxC,OAAA,EAAS,MAAM,IAAA,CAAK,MAAA,CAAO,MAAM,KAAK;AAAA,KACvC;AAAA;AAEP","file":"chunk-4YBXC6VB.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport type { HomeComponentData } from '../types';\n\n/** The page a hook's blocks render on; blocks can target specific products, categories or pages. */\nexport type BlockScope =\n { product_id: number | string } | { category_id: number | string } | { page_id: number | string };\n\nasync function list(params?: Record<string, string>): Promise<HomeComponentData[]> {\n const query = params ? `?${new URLSearchParams(params).toString()}` : '';\n const { data } = await api.get(`component/list${query}`).json<{ data: HomeComponentData[] }>();\n return data ?? [];\n}\n\n/** `blocks` minus each of `excluded`, matched by content: the API sends no id or order to match on. */\nfunction without(blocks: HomeComponentData[], excluded: HomeComponentData[]): HomeComponentData[] {\n if (!excluded.length) return blocks;\n const paths = new Set(excluded.map((block) => block.path));\n const left = excluded.map((block) => JSON.stringify(block));\n return blocks.filter((block) => {\n if (!paths.has(block.path)) return true;\n const index = left.indexOf(JSON.stringify(block));\n if (index === -1) return true;\n left.splice(index, 1);\n return false;\n });\n}\n\nexport const home = {\n components: async (): Promise<HomeComponentData[]> => {\n // The unfiltered list also has the product, category and page blocks, which the home leaves out.\n const [blocks, pageBlocks] = await Promise.all([list(), list({ show_in: 'pages' })]);\n return without(blocks, pageBlocks);\n },\n\n /** The blocks the merchant placed at `hook` on a product, category or page. */\n blocks: async (hook: string, scope: BlockScope): Promise<HomeComponentData[]> => {\n const scopeParams = Object.fromEntries(\n Object.entries(scope).map(([key, id]) => [key, String(id)])\n );\n const blocks = await list({ hooks: hook, ...scopeParams });\n return blocks.map((block) => ({ ...block, path: block.path.replace('home.', '') }));\n },\n\n queries: {\n components: () =>\n queryOptions({\n // Each market (scope) has its own theme version, and its own home page with it.\n queryKey: ['home', 'components', { scope: getActiveScope() }],\n queryFn: () => home.components(),\n }),\n\n blocks: (hook: string, scope: BlockScope) =>\n queryOptions({\n queryKey: ['home', 'blocks', hook, scope],\n queryFn: () => home.blocks(hook, scope),\n }),\n },\n};\n"]}
@@ -1,6 +1,6 @@
1
- import { customUrl } from './chunk-ELARDYI2.js';
2
- import { store } from './chunk-ZHVG76UU.js';
3
- import { redirect } from './chunk-QKG7RKNB.js';
1
+ import { customUrl } from './chunk-EJN2SKCV.js';
2
+ import { store } from './chunk-LRJWJNJS.js';
3
+ import { redirect } from './chunk-QVKKI5MG.js';
4
4
  import { isLocale } from './chunk-T72DAX7R.js';
5
5
 
6
6
  // src/routes/custom-urls.ts
@@ -87,5 +87,5 @@ async function customUrlRedirect(pathname, search, options) {
87
87
  }
88
88
 
89
89
  export { customUrlKey, customUrlPagePath, customUrlRedirect, storePathOf, withAddressQuery };
90
- //# sourceMappingURL=chunk-PS3OD4HM.js.map
91
- //# sourceMappingURL=chunk-PS3OD4HM.js.map
90
+ //# sourceMappingURL=chunk-5CNEKDOL.js.map
91
+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AA,EAAQ,QAAA,CAAS,OAAO,GAAG,CAAA;AAC1D,EAAA,IAAI,IAAA,EAAM;AACR,IAAA,MAAM,MAAA,GAAS,QAAQ,YAAA,GACnB,MAAM,QAAQ,YAAA,CAAa,OAAA,CAAQ,MAAM,CAAA,GACzC,OAAA,CAAQ,MAAA;AACZ,IAAA,MAAM,QAAA,CAAS,gBAAA,CAAiB,CAAA,EAAG,MAAA,GAAS,CAAA,CAAA,EAAI,MAAM,CAAA,CAAA,GAAK,EAAE,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,MAAM,CAAA,EAAG;AAAA,MAC/E,UAAA,EAAY;AAAA,KACb,CAAA;AAAA,EACH;AACA,EAAA,MAAM,IAAA,GAAO,OAAA,CAAQ,MAAA,CAAO,GAAG,CAAA;AAC/B,EAAA,IAAI,IAAA,EAAM;AACR,IAAA,MAAM,QAAA,CAAS,gBAAA,CAAiB,IAAA,EAAM,MAAM,CAAA,EAAG,EAAE,UAAA,EAAY,GAAA,EAAK,cAAA,EAAgB,IAAA,EAAM,CAAA;AAAA,EAC1F;AACF","file":"chunk-PS3OD4HM.js","sourcesContent":["/**\n * @fileoverview A merchant's custom URLs (Dashboard → SEO → custom links) on a React storefront.\n *\n * Twig answers them in the Store's catch-all, its last fallback: after every route, and after the\n * product lookups by short code (`/{code}`) and by SKU (`/{sku}-{name}`). A React theme has no\n * catch-all, so the locale layout's `beforeLoad` asks the API (Store-Module#1798, the catch-all's\n * own lookup) at the same two points:\n * - an address no page answers (`twigUrlRedirect`, after the short code);\n * - a SKU-link address whose SKU names no product (`resolveProductKeyPage`).\n *\n * It asks only on a store that lists `custom-urls` in `store.features` (the plan has it, and the\n * store has an active one), so an address no page answers costs a store without one nothing. The answer is a 302, as Twig's, because the\n * merchant can point the URL elsewhere at any time.\n */\nimport type { QueryClient } from '@tanstack/react-query';\nimport { customUrl, type CustomUrlTarget } from '../api/custom-url';\nimport { store } from '../api/store';\nimport type { StoreContext } from '../api/store';\nimport { redirect } from '../providers/NavigationProvider';\nimport { isLocale } from '../providers/locale-constants';\n\nexport interface CustomUrlRedirectOptions {\n /** The request's query client: the settings are in it already, and a lookup is shared. */\n queryClient: QueryClient;\n /** The language segment an item's page takes, given the one the address had (the locale layout's rule). */\n targetLocale?: (addressLocale: string | undefined) => Promise<string | undefined>;\n}\n\n/**\n * The path a custom URL is saved under, for an address the router hands over (the store base\n * already off): without a language segment, which the Store strips before its catch-all, and\n * without the slashes around it. `null` for a home page.\n */\nexport function customUrlKey(pathname: string): { key: string; locale?: string } | null {\n const segments = pathname.split('/').filter(Boolean);\n const locale = isLocale(segments[0]) ? segments.shift() : undefined;\n if (!segments.length) return null;\n return { key: segments.join('/'), locale };\n}\n\n/**\n * The path an item's URL has under the store root, without its language segment:\n * `https://salla.sa/dev-x/en/shoes/p1` with store URL `https://salla.sa/dev-x/` is `/shoes/p1`.\n * `null` when the URL is not on the store (another host, or outside the store's segment).\n */\nexport function storePathOf(url: string, storeUrl: string | undefined): string | null {\n let item: URL;\n let root: URL;\n try {\n item = new URL(url);\n root = new URL(storeUrl ?? '');\n } catch {\n return null;\n }\n if (item.host !== root.host) return null;\n const rootPath = root.pathname.replace(/\\/+$/, '');\n if (rootPath && item.pathname !== rootPath && !item.pathname.startsWith(`${rootPath}/`)) {\n return null;\n }\n const segments = item.pathname.slice(rootPath.length).split('/').filter(Boolean);\n if (isLocale(segments[0])) segments.shift();\n return `/${segments.join('/')}`;\n}\n\n/** Twig's brand address, `/{slug}/brand-{id}`: the engine's brand page is `/brands/{id}`. */\nconst TWIG_BRAND_PATH = /^\\/[^/]+\\/brand-(\\d+)$/;\n\n/**\n * The engine's page for the item a custom URL names, under the store root and with no language,\n * or `null` for a `custom` row or an item URL that is not on the store. The item's own address\n * is used: the engine serves Twig's product, category, tag and page addresses (and redirects a\n * hash URL itself), and only a brand is sent straight to its page, a hop shorter.\n */\nexport function customUrlPagePath(\n target: CustomUrlTarget,\n storeUrl: string | undefined\n): string | null {\n if (target.type === 'custom') return null;\n const path = storePathOf(target.url, storeUrl);\n if (!path) return null;\n const brand = TWIG_BRAND_PATH.exec(path);\n return brand ? `/brands/${brand[1]}` : path;\n}\n\n/**\n * `target` with the address's query string on it, as the Store's catch-all keeps it (an ad's\n * `utm_*`): after the target's own query, and before its fragment.\n */\nexport function withAddressQuery(target: string, search: string): string {\n const query = search.replace(/^\\?/, '');\n if (!query) return target;\n const hashAt = target.indexOf('#');\n const [head, fragment] =\n hashAt < 0 ? [target, ''] : [target.slice(0, hashAt), target.slice(hashAt)];\n return `${head}${head.includes('?') ? '&' : '?'}${query}${fragment}`;\n}\n\n/** A URL when it is http(s): the Dashboard asks for a URL, and the router refuses any other scheme. */\nfunction httpUrl(url: string): string | null {\n try {\n const { protocol } = new URL(url);\n return protocol === 'http:' || protocol === 'https:' ? url : null;\n } catch {\n return null;\n }\n}\n\n/** The settings, when they list `custom-urls` in the store's features; else `null`. */\nasync function settingsWithCustomUrls(queryClient: QueryClient): Promise<StoreContext | null> {\n try {\n const settings = await queryClient.ensureQueryData(store.queries.settings());\n return settings?.store?.features?.includes('custom-urls') ? settings : null;\n } catch {\n return null;\n }\n}\n\n/**\n * The custom URL saved for `key`, or `undefined`. Any failure counts as none: an address no page\n * answers is also every scanner's, and an API error must leave it the 404 it was, not a 500.\n */\nasync function lookup(key: string, queryClient: QueryClient): Promise<CustomUrlTarget | undefined> {\n try {\n return await queryClient.ensureQueryData(customUrl.queries.resolve(key));\n } catch {\n return undefined;\n }\n}\n\n/**\n * Sends the visitor where the custom URL saved for `pathname` leads, with the address's query, by\n * a 302; returns when there is none, and the caller answers as it would have. An item on the store\n * is reached in one hop, in the language the locale layout would give it. A `custom` row's URL,\n * or an item URL on another site, is a full page load.\n */\nexport async function customUrlRedirect(\n pathname: string,\n search: string,\n options: CustomUrlRedirectOptions\n): Promise<void> {\n const address = customUrlKey(pathname);\n if (!address) return;\n const settings = await settingsWithCustomUrls(options.queryClient);\n if (!settings) return;\n const target = await lookup(address.key, options.queryClient);\n if (!target) return;\n\n const path = customUrlPagePath(target, settings.store?.url);\n if (path) {\n const locale = options.targetLocale\n ? await options.targetLocale(address.locale)\n : address.locale;\n throw redirect(withAddressQuery(`${locale ? `/${locale}` : ''}${path}`, search), {\n statusCode: 302,\n });\n }\n const href = httpUrl(target.url);\n if (href) {\n throw redirect(withAddressQuery(href, search), { statusCode: 302, reloadDocument: true });\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/routes/custom-urls.ts"],"names":[],"mappings":";;;;;;AAiCO,SAAS,aAAa,QAAA,EAA2D;AACtF,EAAA,MAAM,WAAW,QAAA,CAAS,KAAA,CAAM,GAAG,CAAA,CAAE,OAAO,OAAO,CAAA;AACnD,EAAA,MAAM,MAAA,GAAS,SAAS,QAAA,CAAS,CAAC,CAAC,CAAA,GAAI,QAAA,CAAS,OAAM,GAAI,MAAA;AAC1D,EAAA,IAAI,CAAC,QAAA,CAAS,MAAA,EAAQ,OAAO,IAAA;AAC7B,EAAA,OAAO,EAAE,GAAA,EAAK,QAAA,CAAS,IAAA,CAAK,GAAG,GAAG,MAAA,EAAO;AAC3C;AAOO,SAAS,WAAA,CAAY,KAAa,QAAA,EAA6C;AACpF,EAAA,IAAI,IAAA;AACJ,EAAA,IAAI,IAAA;AACJ,EAAA,IAAI;AACF,IAAA,IAAA,GAAO,IAAI,IAAI,GAAG,CAAA;AAClB,IAAA,IAAA,GAAO,IAAI,GAAA,CAAI,QAAA,IAAY,EAAE,CAAA;AAAA,EAC/B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,IAAI,IAAA,CAAK,IAAA,KAAS,IAAA,CAAK,IAAA,EAAM,OAAO,IAAA;AACpC,EAAA,MAAM,QAAA,GAAW,IAAA,CAAK,QAAA,CAAS,OAAA,CAAQ,QAAQ,EAAE,CAAA;AACjD,EAAA,IAAI,QAAA,IAAY,IAAA,CAAK,QAAA,KAAa,QAAA,IAAY,CAAC,IAAA,CAAK,QAAA,CAAS,U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E,EAAA,IAAI,CAAC,QAAA,EAAU;AACf,EAAA,MAAM,SAAS,MAAM,MAAA,CAAO,OAAA,CAAQ,GAAA,EAAK,QAAQ,WAAW,CAAA;AAC5D,EAAA,IAAI,CAAC,MAAA,EAAQ;AAEb,EAAA,MAAM,IAAA,GAAO,iBAAA,CAAkB,MAAA,EAAQ,QAAA,CAAS,OAAO,GAAG,CAAA;AAC1D,EAAA,IAAI,IAAA,EAAM;AACR,IAAA,MAAM,MAAA,GAAS,QAAQ,YAAA,GACnB,MAAM,QAAQ,YAAA,CAAa,OAAA,CAAQ,MAAM,CAAA,GACzC,OAAA,CAAQ,MAAA;AACZ,IAAA,MAAM,QAAA,CAAS,gBAAA,CAAiB,CAAA,EAAG,MAAA,GAAS,CAAA,CAAA,EAAI,MAAM,CAAA,CAAA,GAAK,EAAE,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,MAAM,CAAA,EAAG;AAAA,MAC/E,UAAA,EAAY;AAAA,KACb,CAAA;AAAA,EACH;AACA,EAAA,MAAM,IAAA,GAAO,OAAA,CAAQ,MAAA,CAAO,GAAG,CAAA;AAC/B,EAAA,IAAI,IAAA,EAAM;AACR,IAAA,MAAM,QAAA,CAAS,gBAAA,CAAiB,IAAA,EAAM,MAAM,CAAA,EAAG,EAAE,UAAA,EAAY,GAAA,EAAK,cAAA,EAAgB,IAAA,EAAM,CAAA;AAAA,EAC1F;AACF","file":"chunk-5CNEKDOL.js","sourcesContent":["/**\n * @fileoverview A merchant's custom URLs (Dashboard → SEO → custom links) on a React storefront.\n *\n * Twig answers them in the Store's catch-all, its last fallback: after every route, and after the\n * product lookups by short code (`/{code}`) and by SKU (`/{sku}-{name}`). A React theme has no\n * catch-all, so the locale layout's `beforeLoad` asks the API (Store-Module#1798, the catch-all's\n * own lookup) at the same two points:\n * - an address no page answers (`twigUrlRedirect`, after the short code);\n * - a SKU-link address whose SKU names no product (`resolveProductKeyPage`).\n *\n * It asks only on a store that lists `custom-urls` in `store.features` (the plan has it, and the\n * store has an active one), so an address no page answers costs a store without one nothing. The answer is a 302, as Twig's, because the\n * merchant can point the URL elsewhere at any time.\n */\nimport type { QueryClient } from '@tanstack/react-query';\nimport { customUrl, type CustomUrlTarget } from '../api/custom-url';\nimport { store } from '../api/store';\nimport type { StoreContext } from '../api/store';\nimport { redirect } from '../providers/NavigationProvider';\nimport { isLocale } from '../providers/locale-constants';\n\nexport interface CustomUrlRedirectOptions {\n /** The request's query client: the settings are in it already, and a lookup is shared. */\n queryClient: QueryClient;\n /** The language segment an item's page takes, given the one the address had (the locale layout's rule). */\n targetLocale?: (addressLocale: string | undefined) => Promise<string | undefined>;\n}\n\n/**\n * The path a custom URL is saved under, for an address the router hands over (the store base\n * already off): without a language segment, which the Store strips before its catch-all, and\n * without the slashes around it. `null` for a home page.\n */\nexport function customUrlKey(pathname: string): { key: string; locale?: string } | null {\n const segments = pathname.split('/').filter(Boolean);\n const locale = isLocale(segments[0]) ? segments.shift() : undefined;\n if (!segments.length) return null;\n return { key: segments.join('/'), locale };\n}\n\n/**\n * The path an item's URL has under the store root, without its language segment:\n * `https://salla.sa/dev-x/en/shoes/p1` with store URL `https://salla.sa/dev-x/` is `/shoes/p1`.\n * `null` when the URL is not on the store (another host, or outside the store's segment).\n */\nexport function storePathOf(url: string, storeUrl: string | undefined): string | null {\n let item: URL;\n let root: URL;\n try {\n item = new URL(url);\n root = new URL(storeUrl ?? '');\n } catch {\n return null;\n }\n if (item.host !== root.host) return null;\n const rootPath = root.pathname.replace(/\\/+$/, '');\n if (rootPath && item.pathname !== rootPath && !item.pathname.startsWith(`${rootPath}/`)) {\n return null;\n }\n const segments = item.pathname.slice(rootPath.length).split('/').filter(Boolean);\n if (isLocale(segments[0])) segments.shift();\n return `/${segments.join('/')}`;\n}\n\n/** Twig's brand address, `/{slug}/brand-{id}`: the engine's brand page is `/brands/{id}`. */\nconst TWIG_BRAND_PATH = /^\\/[^/]+\\/brand-(\\d+)$/;\n\n/**\n * The engine's page for the item a custom URL names, under the store root and with no language,\n * or `null` for a `custom` row or an item URL that is not on the store. The item's own address\n * is used: the engine serves Twig's product, category, tag and page addresses (and redirects a\n * hash URL itself), and only a brand is sent straight to its page, a hop shorter.\n */\nexport function customUrlPagePath(\n target: CustomUrlTarget,\n storeUrl: string | undefined\n): string | null {\n if (target.type === 'custom') return null;\n const path = storePathOf(target.url, storeUrl);\n if (!path) return null;\n const brand = TWIG_BRAND_PATH.exec(path);\n return brand ? `/brands/${brand[1]}` : path;\n}\n\n/**\n * `target` with the address's query string on it, as the Store's catch-all keeps it (an ad's\n * `utm_*`): after the target's own query, and before its fragment.\n */\nexport function withAddressQuery(target: string, search: string): string {\n const query = search.replace(/^\\?/, '');\n if (!query) return target;\n const hashAt = target.indexOf('#');\n const [head, fragment] =\n hashAt < 0 ? [target, ''] : [target.slice(0, hashAt), target.slice(hashAt)];\n return `${head}${head.includes('?') ? '&' : '?'}${query}${fragment}`;\n}\n\n/** A URL when it is http(s): the Dashboard asks for a URL, and the router refuses any other scheme. */\nfunction httpUrl(url: string): string | null {\n try {\n const { protocol } = new URL(url);\n return protocol === 'http:' || protocol === 'https:' ? url : null;\n } catch {\n return null;\n }\n}\n\n/** The settings, when they list `custom-urls` in the store's features; else `null`. */\nasync function settingsWithCustomUrls(queryClient: QueryClient): Promise<StoreContext | null> {\n try {\n const settings = await queryClient.ensureQueryData(store.queries.settings());\n return settings?.store?.features?.includes('custom-urls') ? settings : null;\n } catch {\n return null;\n }\n}\n\n/**\n * The custom URL saved for `key`, or `undefined`. Any failure counts as none: an address no page\n * answers is also every scanner's, and an API error must leave it the 404 it was, not a 500.\n */\nasync function lookup(key: string, queryClient: QueryClient): Promise<CustomUrlTarget | undefined> {\n try {\n return await queryClient.ensureQueryData(customUrl.queries.resolve(key));\n } catch {\n return undefined;\n }\n}\n\n/**\n * Sends the visitor where the custom URL saved for `pathname` leads, with the address's query, by\n * a 302; returns when there is none, and the caller answers as it would have. An item on the store\n * is reached in one hop, in the language the locale layout would give it. A `custom` row's URL,\n * or an item URL on another site, is a full page load.\n */\nexport async function customUrlRedirect(\n pathname: string,\n search: string,\n options: CustomUrlRedirectOptions\n): Promise<void> {\n const address = customUrlKey(pathname);\n if (!address) return;\n const settings = await settingsWithCustomUrls(options.queryClient);\n if (!settings) return;\n const target = await lookup(address.key, options.queryClient);\n if (!target) return;\n\n const path = customUrlPagePath(target, settings.store?.url);\n if (path) {\n const locale = options.targetLocale\n ? await options.targetLocale(address.locale)\n : address.locale;\n throw redirect(withAddressQuery(`${locale ? `/${locale}` : ''}${path}`, search), {\n statusCode: 302,\n });\n }\n const href = httpUrl(target.url);\n if (href) {\n throw redirect(withAddressQuery(href, search), { statusCode: 302, reloadDocument: true });\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { user } from './chunk-AC7S2D2Y.js';
1
+ import { user } from './chunk-WJB3YBF5.js';
2
2
  import { getTwilightContext } from './chunk-AWV3WEKH.js';
3
3
  import { useQuery } from '@tanstack/react-query';
4
4
 
@@ -13,5 +13,5 @@ function useUser() {
13
13
  }
14
14
 
15
15
  export { useUser };
16
- //# sourceMappingURL=chunk-HJSJ4LK4.js.map
17
- //# sourceMappingURL=chunk-HJSJ4LK4.js.map
16
+ //# sourceMappingURL=chunk-5JTABBET.js.map
17
+ //# sourceMappingURL=chunk-5JTABBET.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/hooks/useUser.ts"],"names":[],"mappings":";;;;AAUO,SAAS,OAAA,GAAyB;AACvC,EAAA,MAAM,KAAA,GAAQ,oBAAmB,CAAE,SAAA;AAEnC,EAAA,MAAM,QAAQ,QAAA,CAAS;AAAA,IACrB,GAAG,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAQ;AAAA,IACxB,OAAA,EAAS,CAAC,CAAC,KAAA;AAAA,IACX,eAAA,EAAiB;AAAA,GAClB,CAAA;AAED,EAAA,OAAO,EAAE,GAAG,KAAA,EAAO,UAAA,EAAY,CAAC,CAAC,KAAA,EAAM;AACzC","file":"chunk-HJSJ4LK4.js","sourcesContent":["import { useQuery, type UseQueryResult } from '@tanstack/react-query';\nimport { getTwilightContext } from '../twilight/context';\nimport { user } from '../api/user';\nimport type { User } from '../types';\n\nexport type UseUserReturn = UseQueryResult<User | null> & {\n /** True when an auth token exists (regardless of query state). */\n isLoggedIn: boolean;\n};\n\nexport function useUser(): UseUserReturn {\n const token = getTwilightContext().authToken;\n\n const query = useQuery({\n ...user.queries.current(),\n enabled: !!token,\n placeholderData: null,\n });\n\n return { ...query, isLoggedIn: !!token };\n}\n"]}
1
+ {"version":3,"sources":["../src/hooks/useUser.ts"],"names":[],"mappings":";;;;AAUO,SAAS,OAAA,GAAyB;AACvC,EAAA,MAAM,KAAA,GAAQ,oBAAmB,CAAE,SAAA;AAEnC,EAAA,MAAM,QAAQ,QAAA,CAAS;AAAA,IACrB,GAAG,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAQ;AAAA,IACxB,OAAA,EAAS,CAAC,CAAC,KAAA;AAAA,IACX,eAAA,EAAiB;AAAA,GAClB,CAAA;AAED,EAAA,OAAO,EAAE,GAAG,KAAA,EAAO,UAAA,EAAY,CAAC,CAAC,KAAA,EAAM;AACzC","file":"chunk-5JTABBET.js","sourcesContent":["import { useQuery, type UseQueryResult } from '@tanstack/react-query';\nimport { getTwilightContext } from '../twilight/context';\nimport { user } from '../api/user';\nimport type { User } from '../types';\n\nexport type UseUserReturn = UseQueryResult<User | null> & {\n /** True when an auth token exists (regardless of query state). */\n isLoggedIn: boolean;\n};\n\nexport function useUser(): UseUserReturn {\n const token = getTwilightContext().authToken;\n\n const query = useQuery({\n ...user.queries.current(),\n enabled: !!token,\n placeholderData: null,\n });\n\n return { ...query, isLoggedIn: !!token };\n}\n"]}
@@ -2,15 +2,15 @@ import { lazyComponent } from './chunk-VYGA5AT5.js';
2
2
 
3
3
  // src/components/cart/lazy.ts
4
4
  var LazyCartItem = lazyComponent(
5
- () => import('./CartItem-OQNZL2JF.js').then((m) => ({ default: m.CartItem }))
5
+ () => import('./CartItem-STZEX5ML.js').then((m) => ({ default: m.CartItem }))
6
6
  );
7
7
  var LazyCartSummary = lazyComponent(
8
- () => import('./CartSummary-P7VJK5JA.js').then((m) => ({ default: m.CartSummary }))
8
+ () => import('./CartSummary-NBL4W3MD.js').then((m) => ({ default: m.CartSummary }))
9
9
  );
10
10
  var LazySeoCartWidget = lazyComponent(
11
- () => import('./SeoCartWidget-O73BA34X.js').then((m) => ({ default: m.SeoCartWidget }))
11
+ () => import('./SeoCartWidget-3VJJPN6Q.js').then((m) => ({ default: m.SeoCartWidget }))
12
12
  );
13
13
 
14
14
  export { LazyCartItem, LazyCartSummary, LazySeoCartWidget };
15
- //# sourceMappingURL=chunk-MMLZYUKH.js.map
16
- //# sourceMappingURL=chunk-MMLZYUKH.js.map
15
+ //# sourceMappingURL=chunk-5SIHL4SO.js.map
16
+ //# sourceMappingURL=chunk-5SIHL4SO.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/cart/lazy.ts"],"names":[],"mappings":";;;AAMO,IAAM,YAAA,GAAe,aAAA;AAAA,EAAc,MACxC,OAAO,wBAAY,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,QAAA,EAAS,CAAE;AAC5D;AAEO,IAAM,eAAA,GAAkB,aAAA;AAAA,EAAc,MAC3C,OAAO,2BAAe,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,WAAA,EAAY,CAAE;AAClE;AAEO,IAAM,iBAAA,GAAoB,aAAA;AAAA,EAAc,MAC7C,OAAO,6BAAiB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,aAAA,EAAc,CAAE;AACtE","file":"chunk-MMLZYUKH.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\n/**\n * Lazy-loaded cart components\n * Use these for code-splitting cart sections\n */\nexport const LazyCartItem = lazyComponent(() =>\n import('./CartItem').then((m) => ({ default: m.CartItem }))\n);\n\nexport const LazyCartSummary = lazyComponent(() =>\n import('./CartSummary').then((m) => ({ default: m.CartSummary }))\n);\n\nexport const LazySeoCartWidget = lazyComponent(() =>\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,aAAA;AAAA,EAAc,MACxC,OAAO,wBAAY,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,QAAA,EAAS,CAAE;AAC5D;AAEO,IAAM,eAAA,GAAkB,aAAA;AAAA,EAAc,MAC3C,OAAO,2BAAe,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,WAAA,EAAY,CAAE;AAClE;AAEO,IAAM,iBAAA,GAAoB,aAAA;AAAA,EAAc,MAC7C,OAAO,6BAAiB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,aAAA,EAAc,CAAE;AACtE","file":"chunk-5SIHL4SO.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\n/**\n * Lazy-loaded cart components\n * Use these for code-splitting cart sections\n */\nexport const LazyCartItem = lazyComponent(() =>\n import('./CartItem').then((m) => ({ default: m.CartItem }))\n);\n\nexport const LazyCartSummary = lazyComponent(() =>\n import('./CartSummary').then((m) => ({ default: m.CartSummary }))\n);\n\nexport const LazySeoCartWidget = lazyComponent(() =>\n import('./SeoCartWidget').then((m) => ({ default: m.SeoCartWidget }))\n);\n"]}
@@ -1,5 +1,5 @@
1
- import { orThrow, orUnauthorized } from './chunk-QKG7RKNB.js';
2
- import { api } from './chunk-MKT66FON.js';
1
+ import { orThrow, orUnauthorized } from './chunk-QVKKI5MG.js';
2
+ import { api } from './chunk-JOLKCJWI.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
5
5
  async function twilightShape(path) {
@@ -89,5 +89,5 @@ var order = {
89
89
  };
90
90
 
91
91
  export { order };
92
- //# sourceMappingURL=chunk-KURYDW5X.js.map
93
- //# sourceMappingURL=chunk-KURYDW5X.js.map
92
+ //# sourceMappingURL=chunk-5U26XIYM.js.map
93
+ //# sourceMappingURL=chunk-5U26XIYM.js.map