@salla.sa/twilight-theme-engine 1.0.35 → 1.0.37

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 (249) hide show
  1. package/dist/{AddToCartForm-PNZBIPJU.js → AddToCartForm-BAXWUVBW.js} +3 -3
  2. package/dist/{AddToCartForm-PNZBIPJU.js.map → AddToCartForm-BAXWUVBW.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-FTVPPHHS.js → BlogAuthorPage-C7ENIUKC.js} +16 -15
  4. package/dist/BlogAuthorPage-C7ENIUKC.js.map +1 -0
  5. package/dist/{BlogCategoryPage-TJFW7DDI.js → BlogCategoryPage-QODJTKFE.js} +16 -15
  6. package/dist/BlogCategoryPage-QODJTKFE.js.map +1 -0
  7. package/dist/{BlogPage-RD4JUGKY.js → BlogPage-N5BKRIWD.js} +14 -13
  8. package/dist/BlogPage-N5BKRIWD.js.map +1 -0
  9. package/dist/{BlogSinglePage-DVZX3WVW.js → BlogSinglePage-HVSCXCCV.js} +14 -13
  10. package/dist/BlogSinglePage-HVSCXCCV.js.map +1 -0
  11. package/dist/{BlogTagPage-UON2ASKW.js → BlogTagPage-YXYYHD5S.js} +16 -15
  12. package/dist/BlogTagPage-YXYYHD5S.js.map +1 -0
  13. package/dist/{BrandsPage-R4KTDEG3.js → BrandsPage-UP3HKHGR.js} +14 -13
  14. package/dist/BrandsPage-UP3HKHGR.js.map +1 -0
  15. package/dist/{Breadcrumb-YNVX6ZXO.js → Breadcrumb-5464BOGG.js} +14 -13
  16. package/dist/Breadcrumb-5464BOGG.js.map +1 -0
  17. package/dist/{CartItem-6P4AB6LQ.js → CartItem-TARZW35A.js} +14 -13
  18. package/dist/CartItem-TARZW35A.js.map +1 -0
  19. package/dist/{CartSummary-A25PNJSY.js → CartSummary-2KSBKQM7.js} +14 -13
  20. package/dist/CartSummary-2KSBKQM7.js.map +1 -0
  21. package/dist/{Copyright-J6O4JUG7.js → Copyright-2D7W6OS4.js} +3 -3
  22. package/dist/{Copyright-J6O4JUG7.js.map → Copyright-2D7W6OS4.js.map} +1 -1
  23. package/dist/{CustomerLayout-JNUTNHBA.js → CustomerLayout-Z3JGXMO7.js} +14 -13
  24. package/dist/CustomerLayout-Z3JGXMO7.js.map +1 -0
  25. package/dist/{Footer-GR7WW7UA.js → Footer-DFZFOH5E.js} +14 -13
  26. package/dist/{Footer-GR7WW7UA.js.map → Footer-DFZFOH5E.js.map} +1 -1
  27. package/dist/{Header-2CTHBDYE.js → Header-CF5TQMWR.js} +6 -6
  28. package/dist/{Header-2CTHBDYE.js.map → Header-CF5TQMWR.js.map} +1 -1
  29. package/dist/{LoyaltyPage-EHRGBXF6.js → LoyaltyPage-TOXOPXEU.js} +15 -14
  30. package/dist/LoyaltyPage-TOXOPXEU.js.map +1 -0
  31. package/dist/{MainMenu-TFUVK4W7.js → MainMenu-6VTPCMMJ.js} +7 -7
  32. package/dist/{MainMenu-TFUVK4W7.js.map → MainMenu-6VTPCMMJ.js.map} +1 -1
  33. package/dist/{MasterLayout-ODH7CFAU.js → MasterLayout-PQ2XGL6A.js} +14 -13
  34. package/dist/{MasterLayout-ODH7CFAU.js.map → MasterLayout-PQ2XGL6A.js.map} +1 -1
  35. package/dist/{MobileMenu-5OJEI2CQ.js → MobileMenu-UWDB2BHQ.js} +15 -14
  36. package/dist/MobileMenu-UWDB2BHQ.js.map +1 -0
  37. package/dist/{NotificationsPage-U4ULROLR.js → NotificationsPage-3WUAFRTU.js} +14 -13
  38. package/dist/NotificationsPage-3WUAFRTU.js.map +1 -0
  39. package/dist/{OrderSinglePage-O2ODTG33.js → OrderSinglePage-T2UE2EJI.js} +15 -14
  40. package/dist/OrderSinglePage-T2UE2EJI.js.map +1 -0
  41. package/dist/{OrdersPage-72RXJGSH.js → OrdersPage-762O24YK.js} +15 -14
  42. package/dist/OrdersPage-762O24YK.js.map +1 -0
  43. package/dist/{PageSingle-7Y4WJAA6.js → PageSingle-Y6IVAY3E.js} +3 -3
  44. package/dist/{PageSingle-7Y4WJAA6.js.map → PageSingle-Y6IVAY3E.js.map} +1 -1
  45. package/dist/{ProductDetails-GYCTNAWE.js → ProductDetails-7G7QOLTB.js} +3 -3
  46. package/dist/{ProductDetails-GYCTNAWE.js.map → ProductDetails-7G7QOLTB.js.map} +1 -1
  47. package/dist/{ProfilePage-GVYL5NVL.js → ProfilePage-H2JWTJJY.js} +14 -13
  48. package/dist/ProfilePage-H2JWTJJY.js.map +1 -0
  49. package/dist/{SeoCartWidget-KHDAMXBG.js → SeoCartWidget-XYWATIV3.js} +14 -13
  50. package/dist/SeoCartWidget-XYWATIV3.js.map +1 -0
  51. package/dist/{SettingsPage-ZCLDJNHY.js → SettingsPage-WQX22FTS.js} +14 -13
  52. package/dist/SettingsPage-WQX22FTS.js.map +1 -0
  53. package/dist/{StoreClosedNotification-6O34WQJV.js → StoreClosedNotification-TL4XY6OS.js} +15 -14
  54. package/dist/{StoreClosedNotification-6O34WQJV.js.map → StoreClosedNotification-TL4XY6OS.js.map} +1 -1
  55. package/dist/{TestimonialsPage-Y3DCS2RB.js → TestimonialsPage-PWVTHBOS.js} +3 -3
  56. package/dist/{TestimonialsPage-Y3DCS2RB.js.map → TestimonialsPage-PWVTHBOS.js.map} +1 -1
  57. package/dist/{ThankYouPage-MPF4V5T3.js → ThankYouPage-C573J2KJ.js} +14 -13
  58. package/dist/ThankYouPage-C573J2KJ.js.map +1 -0
  59. package/dist/{WalletPage-XVEZKUCP.js → WalletPage-7JE6PELL.js} +15 -14
  60. package/dist/WalletPage-7JE6PELL.js.map +1 -0
  61. package/dist/{WishlistPage-MALKVYV4.js → WishlistPage-XTQ6IRG7.js} +15 -14
  62. package/dist/WishlistPage-XTQ6IRG7.js.map +1 -0
  63. package/dist/api/apps.js +4 -4
  64. package/dist/api/brands.js +5 -5
  65. package/dist/api/cart.js +5 -5
  66. package/dist/api/category.js +5 -5
  67. package/dist/api/client.d.ts.map +1 -1
  68. package/dist/api/client.js +3 -3
  69. package/dist/api/home.js +4 -4
  70. package/dist/api/loyalty.js +5 -5
  71. package/dist/api/menu.js +4 -4
  72. package/dist/api/notification.js +4 -4
  73. package/dist/api/order.js +5 -5
  74. package/dist/api/page.js +5 -5
  75. package/dist/api/product.js +5 -5
  76. package/dist/api/profile.js +3 -3
  77. package/dist/api/store.d.ts.map +1 -1
  78. package/dist/api/store.js +4 -4
  79. package/dist/api/translations.js +4 -4
  80. package/dist/api/user.js +4 -4
  81. package/dist/api/wishlist.js +4 -4
  82. package/dist/{chunk-QOK3ANNB.js → chunk-2AGMXJVP.js} +4 -4
  83. package/dist/{chunk-QOK3ANNB.js.map → chunk-2AGMXJVP.js.map} +1 -1
  84. package/dist/{chunk-Z2BE6MDB.js → chunk-2KZORZZN.js} +14 -6
  85. package/dist/chunk-2KZORZZN.js.map +1 -0
  86. package/dist/{chunk-BOOOVZS4.js → chunk-4PLGRQAS.js} +4 -4
  87. package/dist/{chunk-BOOOVZS4.js.map → chunk-4PLGRQAS.js.map} +1 -1
  88. package/dist/{chunk-DLDDKPRN.js → chunk-5FH6E2FQ.js} +16 -20
  89. package/dist/chunk-5FH6E2FQ.js.map +1 -0
  90. package/dist/{chunk-VBXAGCNI.js → chunk-5R5IGGI3.js} +5 -5
  91. package/dist/{chunk-VBXAGCNI.js.map → chunk-5R5IGGI3.js.map} +1 -1
  92. package/dist/{chunk-FQGCCV4T.js → chunk-5TRRUV7N.js} +3 -3
  93. package/dist/{chunk-FQGCCV4T.js.map → chunk-5TRRUV7N.js.map} +1 -1
  94. package/dist/{chunk-Q56S25OH.js → chunk-63WNORBK.js} +6 -6
  95. package/dist/{chunk-Q56S25OH.js.map → chunk-63WNORBK.js.map} +1 -1
  96. package/dist/chunk-6IATCGID.js +7 -0
  97. package/dist/chunk-6IATCGID.js.map +1 -0
  98. package/dist/{chunk-LG556DIE.js → chunk-6KI2QCPL.js} +3 -3
  99. package/dist/{chunk-LG556DIE.js.map → chunk-6KI2QCPL.js.map} +1 -1
  100. package/dist/{chunk-GQ7IBJ55.js → chunk-6MGDRMZM.js} +4 -4
  101. package/dist/{chunk-GQ7IBJ55.js.map → chunk-6MGDRMZM.js.map} +1 -1
  102. package/dist/{chunk-5ACY5CD3.js → chunk-6XWMNQ52.js} +10 -4
  103. package/dist/chunk-6XWMNQ52.js.map +1 -0
  104. package/dist/{chunk-WXOABH6J.js → chunk-AZ5HAIYQ.js} +26 -11
  105. package/dist/chunk-AZ5HAIYQ.js.map +1 -0
  106. package/dist/chunk-BK4VEUF3.js +14 -0
  107. package/dist/{chunk-IN5RFJF2.js.map → chunk-BK4VEUF3.js.map} +1 -1
  108. package/dist/{chunk-L6UGY2OB.js → chunk-BWIESZJK.js} +3 -3
  109. package/dist/{chunk-L6UGY2OB.js.map → chunk-BWIESZJK.js.map} +1 -1
  110. package/dist/{chunk-Z2P4M6T6.js → chunk-CCCKRNO4.js} +3 -3
  111. package/dist/{chunk-Z2P4M6T6.js.map → chunk-CCCKRNO4.js.map} +1 -1
  112. package/dist/{chunk-RQHOAA7U.js → chunk-CZS4ZHQK.js} +3 -3
  113. package/dist/{chunk-RQHOAA7U.js.map → chunk-CZS4ZHQK.js.map} +1 -1
  114. package/dist/{chunk-TXYT42AU.js → chunk-E5EH32L7.js} +3 -3
  115. package/dist/{chunk-TXYT42AU.js.map → chunk-E5EH32L7.js.map} +1 -1
  116. package/dist/{chunk-6EBQ27KE.js → chunk-EFHSAWDQ.js} +23 -15
  117. package/dist/chunk-EFHSAWDQ.js.map +1 -0
  118. package/dist/{chunk-T3I4T3XB.js → chunk-FKOBOGLQ.js} +7 -7
  119. package/dist/{chunk-T3I4T3XB.js.map → chunk-FKOBOGLQ.js.map} +1 -1
  120. package/dist/{chunk-Y5FBDMFV.js → chunk-JBXTU5NM.js} +22 -12
  121. package/dist/chunk-JBXTU5NM.js.map +1 -0
  122. package/dist/{chunk-OOYJHQLQ.js → chunk-KFH3OBFW.js} +4 -4
  123. package/dist/{chunk-OOYJHQLQ.js.map → chunk-KFH3OBFW.js.map} +1 -1
  124. package/dist/{chunk-LXIEAZZJ.js → chunk-KLTQ2UST.js} +3 -3
  125. package/dist/{chunk-LXIEAZZJ.js.map → chunk-KLTQ2UST.js.map} +1 -1
  126. package/dist/{chunk-6JLVUQWD.js → chunk-MCYEMXFY.js} +4 -4
  127. package/dist/{chunk-6JLVUQWD.js.map → chunk-MCYEMXFY.js.map} +1 -1
  128. package/dist/{chunk-C4S4VXWW.js → chunk-ME727LL4.js} +3 -3
  129. package/dist/{chunk-C4S4VXWW.js.map → chunk-ME727LL4.js.map} +1 -1
  130. package/dist/{chunk-NTOIR3NK.js → chunk-NX6BEOXW.js} +4 -4
  131. package/dist/{chunk-NTOIR3NK.js.map → chunk-NX6BEOXW.js.map} +1 -1
  132. package/dist/{chunk-FPQAYFHZ.js → chunk-OGGWNPF3.js} +3 -3
  133. package/dist/{chunk-FPQAYFHZ.js.map → chunk-OGGWNPF3.js.map} +1 -1
  134. package/dist/{chunk-STHBBSK2.js → chunk-QG2Q6HB5.js} +3 -3
  135. package/dist/{chunk-STHBBSK2.js.map → chunk-QG2Q6HB5.js.map} +1 -1
  136. package/dist/{chunk-CBQKQCKI.js → chunk-RBISDOPR.js} +4 -4
  137. package/dist/{chunk-CBQKQCKI.js.map → chunk-RBISDOPR.js.map} +1 -1
  138. package/dist/{chunk-57RYHNW2.js → chunk-RIZOT5FN.js} +3 -3
  139. package/dist/{chunk-57RYHNW2.js.map → chunk-RIZOT5FN.js.map} +1 -1
  140. package/dist/{chunk-47C6C2NN.js → chunk-TMR7TZMB.js} +4 -4
  141. package/dist/{chunk-47C6C2NN.js.map → chunk-TMR7TZMB.js.map} +1 -1
  142. package/dist/{chunk-5IEQLAAY.js → chunk-ULQMJUO2.js} +4 -4
  143. package/dist/{chunk-5IEQLAAY.js.map → chunk-ULQMJUO2.js.map} +1 -1
  144. package/dist/{chunk-6BVPVYLN.js → chunk-VZHYSYKG.js} +4 -4
  145. package/dist/{chunk-6BVPVYLN.js.map → chunk-VZHYSYKG.js.map} +1 -1
  146. package/dist/{chunk-EV4JSMFZ.js → chunk-X26WB7AG.js} +3 -3
  147. package/dist/{chunk-EV4JSMFZ.js.map → chunk-X26WB7AG.js.map} +1 -1
  148. package/dist/{chunk-E3J2RXBS.js → chunk-XLGVT7QF.js} +3 -3
  149. package/dist/{chunk-E3J2RXBS.js.map → chunk-XLGVT7QF.js.map} +1 -1
  150. package/dist/{chunk-XBLA5RFR.js → chunk-XLVAVCUV.js} +5 -5
  151. package/dist/{chunk-XBLA5RFR.js.map → chunk-XLVAVCUV.js.map} +1 -1
  152. package/dist/{chunk-GCAIIFF3.js → chunk-XTOXFAP7.js} +3 -3
  153. package/dist/{chunk-GCAIIFF3.js.map → chunk-XTOXFAP7.js.map} +1 -1
  154. package/dist/{chunk-B4SPJFNB.js → chunk-YOA3UVDE.js} +4 -4
  155. package/dist/{chunk-B4SPJFNB.js.map → chunk-YOA3UVDE.js.map} +1 -1
  156. package/dist/{chunk-HYESKIWZ.js → chunk-ZNWNJZSM.js} +4 -4
  157. package/dist/{chunk-HYESKIWZ.js.map → chunk-ZNWNJZSM.js.map} +1 -1
  158. package/dist/{chunk-MY3ZH5BA.js → chunk-ZZA7L3RI.js} +6 -6
  159. package/dist/{chunk-MY3ZH5BA.js.map → chunk-ZZA7L3RI.js.map} +1 -1
  160. package/dist/components/cart/index.js +1 -1
  161. package/dist/components/common/index.js +1 -1
  162. package/dist/components/drawer/index.js +12 -11
  163. package/dist/components/home/index.js +15 -14
  164. package/dist/components/layout/index.js +5 -5
  165. package/dist/components/product/index.js +13 -12
  166. package/dist/components/store/index.js +14 -13
  167. package/dist/components/store/index.js.map +1 -1
  168. package/dist/document-class-5BBGX5LN.js +24 -0
  169. package/dist/{document-class-BQBALA53.js.map → document-class-5BBGX5LN.js.map} +1 -1
  170. package/dist/hooks/index.js +12 -11
  171. package/dist/hooks/registerDefaultHooks.d.ts.map +1 -1
  172. package/dist/hooks/useGtm.js +12 -11
  173. package/dist/hooks/useMoney.js +12 -11
  174. package/dist/hooks/useStore.js +12 -11
  175. package/dist/hooks/useUser.js +5 -5
  176. package/dist/index.js +12 -11
  177. package/dist/index.js.map +1 -1
  178. package/dist/{navigation-B6TEUWEK.js → navigation-D7QS3NK2.js} +4 -4
  179. package/dist/{navigation-B6TEUWEK.js.map → navigation-D7QS3NK2.js.map} +1 -1
  180. package/dist/{navigation-RYSVWICZ.js → navigation-DQNNT2LY.js} +5 -5
  181. package/dist/{navigation-RYSVWICZ.js.map → navigation-DQNNT2LY.js.map} +1 -1
  182. package/dist/{not-found-OPY73PW5.js → not-found-QM2L2D7P.js} +14 -13
  183. package/dist/not-found-QM2L2D7P.js.map +1 -0
  184. package/dist/providers/index.js +12 -11
  185. package/dist/routes/account/orders.js +6 -6
  186. package/dist/routes/account.js +14 -14
  187. package/dist/routes/blog.js +10 -10
  188. package/dist/routes/brands.js +6 -6
  189. package/dist/routes/cart.js +20 -19
  190. package/dist/routes/cart.js.map +1 -1
  191. package/dist/routes/home.js +17 -16
  192. package/dist/routes/index.js +3 -3
  193. package/dist/routes/loyalty.js +6 -6
  194. package/dist/routes/page.js +6 -6
  195. package/dist/routes/product-listing.js +17 -16
  196. package/dist/routes/product-listing.js.map +1 -1
  197. package/dist/routes/product.js +15 -14
  198. package/dist/routes/product.js.map +1 -1
  199. package/dist/routes/root/head.d.ts.map +1 -1
  200. package/dist/routes/seo-redirects.js +3 -3
  201. package/dist/routes/testimonials.js +2 -2
  202. package/dist/routes/thank-you.js +6 -6
  203. package/dist/skeleton.js +17 -16
  204. package/dist/tanstack/middleware/twilight.d.ts.map +1 -1
  205. package/dist/tanstack.js +17 -15
  206. package/dist/tanstack.js.map +1 -1
  207. package/dist/twilight/context.d.ts +22 -5
  208. package/dist/twilight/context.d.ts.map +1 -1
  209. package/dist/utils/cookies.d.ts +46 -6
  210. package/dist/utils/cookies.d.ts.map +1 -1
  211. package/dist/utils/fast-checkout.d.ts +4 -0
  212. package/dist/utils/fast-checkout.d.ts.map +1 -0
  213. package/dist/utils/index.js +4 -4
  214. package/dist/utils/runtime-env.d.ts +13 -0
  215. package/dist/utils/runtime-env.d.ts.map +1 -1
  216. package/dist/utils/theme-version.d.ts +33 -0
  217. package/dist/utils/theme-version.d.ts.map +1 -0
  218. package/dist/vite/index.js +2 -2
  219. package/package.json +1 -1
  220. package/dist/BlogAuthorPage-FTVPPHHS.js.map +0 -1
  221. package/dist/BlogCategoryPage-TJFW7DDI.js.map +0 -1
  222. package/dist/BlogPage-RD4JUGKY.js.map +0 -1
  223. package/dist/BlogSinglePage-DVZX3WVW.js.map +0 -1
  224. package/dist/BlogTagPage-UON2ASKW.js.map +0 -1
  225. package/dist/BrandsPage-R4KTDEG3.js.map +0 -1
  226. package/dist/Breadcrumb-YNVX6ZXO.js.map +0 -1
  227. package/dist/CartItem-6P4AB6LQ.js.map +0 -1
  228. package/dist/CartSummary-A25PNJSY.js.map +0 -1
  229. package/dist/CustomerLayout-JNUTNHBA.js.map +0 -1
  230. package/dist/LoyaltyPage-EHRGBXF6.js.map +0 -1
  231. package/dist/MobileMenu-5OJEI2CQ.js.map +0 -1
  232. package/dist/NotificationsPage-U4ULROLR.js.map +0 -1
  233. package/dist/OrderSinglePage-O2ODTG33.js.map +0 -1
  234. package/dist/OrdersPage-72RXJGSH.js.map +0 -1
  235. package/dist/ProfilePage-GVYL5NVL.js.map +0 -1
  236. package/dist/SeoCartWidget-KHDAMXBG.js.map +0 -1
  237. package/dist/SettingsPage-ZCLDJNHY.js.map +0 -1
  238. package/dist/ThankYouPage-MPF4V5T3.js.map +0 -1
  239. package/dist/WalletPage-XVEZKUCP.js.map +0 -1
  240. package/dist/WishlistPage-MALKVYV4.js.map +0 -1
  241. package/dist/chunk-5ACY5CD3.js.map +0 -1
  242. package/dist/chunk-6EBQ27KE.js.map +0 -1
  243. package/dist/chunk-DLDDKPRN.js.map +0 -1
  244. package/dist/chunk-IN5RFJF2.js +0 -14
  245. package/dist/chunk-WXOABH6J.js.map +0 -1
  246. package/dist/chunk-Y5FBDMFV.js.map +0 -1
  247. package/dist/chunk-Z2BE6MDB.js.map +0 -1
  248. package/dist/document-class-BQBALA53.js +0 -23
  249. package/dist/not-found-OPY73PW5.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/utils/cookies.ts","../src/utils/inline-script.ts","../src/utils/runtime-env.ts","../src/utils/store-identity.ts","../src/utils/sdk-helpers.ts"],"names":[],"mappings":";;;AAAO,IAAM,sBAAA,GAAyB;AAC/B,IAAM,iBAAA,GAAoB,OAAA;AAoB1B,IAAM,oBAAA,GAAuB,WAAA;AAG7B,IAAM,cAAA,GAAiB,SAAA;AAUvB,SAAS,aAAa,GAAA,EAA+C;AAC1E,EAAA,IAAI,CAAC,KAAK,OAAO,IAAA;AACjB,EAAA,OAAO,oBAAA,CAAqB,IAAA,CAAK,GAAG,CAAA,GAAI,GAAA,GAAM,IAAA;AAChD;AAGO,SAAS,0BAA0B,YAAA,EAA4C;AACpF,EAAA,OAAO,YAAA,CAAa,uBAAA,CAAwB,YAAA,EAAc,oBAAoB,CAAC,CAAA;AACjF;AAqBO,IAAM,cAAA,GAAoC,CAAC,sBAAsB,CAAA;AAGxE,SAAS,WAAW,IAAA,EAAsB;AACxC,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,IAAA,EAAK,CAAE,WAAA,EAAY;AAExC,EAAA,IAAI,OAAA,CAAQ,UAAA,CAAW,GAAG,CAAA,EAAG,OAAO,OAAA,CAAQ,KAAA,CAAM,CAAA,EAAG,OAAA,CAAQ,OAAA,CAAQ,GAAG,CAAA,GAAI,CAAC,CAAA,IAAK,OAAA;AAClF,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,OAAA,CAAQ,GAAG,CAAA;AACjC,EAAA,OAAO,UAAU,EAAA,GAAK,OAAA,GAAU,OAAA,CAAQ,KAAA,CAAM,GAAG,KAAK,CAAA;AACxD;AAEA,SAAS,WAAW,QAAA,EAA2B;AAC7C,EAAA,OACE,QAAA,KAA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SAAS,IAAA,GAAO,IAAA;AAC3E,EAAA,IAAI,mBAAA,CAAoB,WAAW,CAAA,EAAG,OAAO,WAAA;AAE7C,EAAA,OAAO,OAAA,CAAQ,mBAAmB,CAAA,IAAK,OAAA,CAAQ,cAAc,CAAA,IAAK,EAAA;AACpE;;;AC/DA,IAAM,SAAA,GAAY,OAAO,MAAA,KAAW,WAAA;AAc7B,SAAS,mBAAmB,QAAA,EAA2B;AAC5D,EAAA,OAAO,uBAAuB,QAAQ,CAAA;AACxC;AAKO,SAAS,WAAA,GAA+C;AAC7D,EAAA,IAAI,CAAC,WAAW,OAAO,MAAA;AACvB,EAAA,OAAO,MAAA,CAAO,KAAA;AAChB;AAoBO,SAAS,cAAc,MAAA,EAAsB;AAClD,EAAA,MAAM,MAAM,WAAA,EAAY;AACxB,EAAA,IAAI,CAAC,GAAA,IAAO,CAAC,MAAA,EAAQ;AACrB,EAAA,IAAI;AACF,IAAA,GAAA,CAAI,IAAA,EAAM,YAAY,MAAM,CAAA;AAC5B,IAAA,GAAA,CAAI,GAAA,EAAK,SAAA,GAAY,iBAAA,EAAmB,MAAM,CAAA;AAG9C,IAAA,GAAA,CAAI,MAAA,EAAQ,GAAA,GAAM,oBAAA,EAAsB,MAAM,CAAA;AAAA,EAChD,CAAA,CAAA,MAAQ;AAAA,EAER;AACF","file":"chunk-Y5FBDMFV.js","sourcesContent":["export const AUTH_TOKEN_COOKIE_NAME = 'token';\nexport const SCOPE_COOKIE_NAME = 'scope';\n\n/**\n * Which store this request is for, when the hostname does not say.\n *\n * A live storefront is reached at its own domain, so the hostname identifies it\n * and nothing else is needed. A preview is not: every theme under review is\n * served from the one preview hostname, so the store has to be named some other\n * way — the dispatcher takes it from `?storeId=` and puts it here, the same way\n * it remembers which theme to serve.\n *\n * Written by the dispatcher rather than the theme, and set on the *forwarded\n * request* as well as the response, because the response cookie only arrives in\n * time for the second page load and the first one has to render too.\n *\n * The literal is a contract with `STORE_COOKIE` in store-front-dispacher\n * (`src/dispatch/preview.ts`), and **nothing checks the two agree**. Drift does\n * not fail loudly — it renders somebody else's shop. Grep both repos before\n * changing it.\n */\nexport const STORE_ID_COOKIE_NAME = 'salla_sid';\n\n/** Query parameter naming the store, on a host that serves more than one. */\nexport const STORE_ID_PARAM = 'storeId';\n\n/**\n * A store id is an integer, and anything else is not a store id.\n *\n * Validated rather than passed through because this value ends up in an upstream\n * API path. Leading zeroes, signs, decimals and whitespace are all rejected: the\n * point is a single canonical form, not the widest set of things that could be\n * coerced into a number.\n */\nexport function parseStoreId(raw: string | null | undefined): string | null {\n if (!raw) return null;\n return /^[1-9][0-9]{0,18}$/.test(raw) ? raw : null;\n}\n\n/** The store id the dispatcher left in the cookie, or null when absent or malformed. */\nexport function extractStoreIdFromCookies(cookieHeader: string | null): string | null {\n return parseStoreId(extractTokenFromCookies(cookieHeader, STORE_ID_COOKIE_NAME));\n}\n\n/**\n * The only hosts on which a request may name its own store.\n *\n * **This is a security boundary, not a convenience.** On a merchant's own domain\n * the hostname *is* the store, and it is the only thing that may decide. A theme\n * that also honoured `?storeId=` there would let anyone open\n * `https://reefperfumes.com/?storeId=<someone else>` and be served a different\n * merchant's shop from the domain its owner controls — their branding, their\n * customers' address bar, somebody else's catalogue — and the cookie would keep\n * serving it for the rest of that browser's session. Salla points SaaS domains\n * at this dispatcher, so those hostnames are real and reachable.\n *\n * The override exists for one situation: a host that serves many stores and so\n * cannot identify one from its name. That is the preview host, where every theme\n * under review answers on the same address, and local development.\n *\n * Adding an entry grants that host the ability to render any store on request.\n * Add nothing that a merchant's traffic reaches.\n */\nexport const STORE_ID_HOSTS: readonly string[] = ['preview.salla.design'];\n\n/** The hostname alone — a port never distinguishes one host's authority from another's. */\nfunction hostnameOf(host: string): string {\n const trimmed = host.trim().toLowerCase();\n // IPv6 literals are bracketed, and the colons inside them are not a port.\n if (trimmed.startsWith('[')) return trimmed.slice(0, trimmed.indexOf(']') + 1) || trimmed;\n const colon = trimmed.indexOf(':');\n return colon === -1 ? trimmed : trimmed.slice(0, colon);\n}\n\nfunction isLoopback(hostname: string): boolean {\n return (\n hostname === 'localhost' ||\n hostname === '127.0.0.1' ||\n hostname === '[::1]' ||\n hostname.endsWith('.localhost')\n );\n}\n\n/**\n * Whether this host is allowed to let the request choose a store.\n *\n * Deliberately an allowlist of exact hostnames plus loopback. No suffix matching:\n * a rule like \"anything ending in salla.design\" is one wildcard DNS record away\n * from admitting a host nobody meant to admit, and the list of hosts that serve\n * more than one store is short and known.\n */\nexport function allowsRequestStoreId(host: string | null | undefined): boolean {\n if (!host) return false;\n const hostname = hostnameOf(host);\n return STORE_ID_HOSTS.includes(hostname) || isLoopback(hostname);\n}\n\n/**\n * Whether this host *is* a store, so its name can be used as the identifier.\n *\n * The exact inverse of {@link allowsRequestStoreId}, and deliberately written as\n * one so the two can never disagree: a host that may name its store is a host\n * that serves more than one, and a host that serves more than one cannot be the\n * answer to \"which store is this?\". `preview.salla.design` and `localhost:5188`\n * are not shops; asking the API about them earns a 422 and a page that reads as\n * a broken theme.\n */\nexport function hostIdentifiesStore(host: string | null | undefined): boolean {\n return Boolean(host) && !allowsRequestStoreId(host);\n}\n\n/**\n * The store this request names, on a host permitted to name one.\n *\n * The host check is inside this function rather than at its call site, because a\n * call site is a thing someone can add without reading this comment. There is no\n * way to ask \"what store did the request name?\" without also asking \"is this a\n * host that may say?\" — get it wrong and the answer is a security bug that looks\n * like a feature.\n *\n * Between the two permitted sources the URL wins, the same precedence the\n * dispatcher uses for the theme and for the same reason: a link is how someone\n * switches, and a cookie they cannot see should never beat the address they\n * just typed.\n */\nexport function resolveRequestStoreId(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined\n): string | null {\n if (!allowsRequestStoreId(host)) return null;\n\n let fromQuery: string | null = null;\n try {\n fromQuery = parseStoreId(new URL(url).searchParams.get(STORE_ID_PARAM));\n } catch {\n /* a relative or malformed URL simply names no store */\n }\n return fromQuery ?? extractStoreIdFromCookies(cookieHeader);\n}\n\n/**\n * Deletes the auth `token` cookie. This cookie is written client-side by the theme\n * (TwilightProvider), not by the SDK — `salla.cookie.clearAll()` only clears its own\n * allowlist and leaves `token` behind — so logout must clear it here. Client-only.\n */\nexport function clearAuthTokenCookie(): void {\n if (typeof document === 'undefined') return;\n document.cookie = `${AUTH_TOKEN_COOKIE_NAME}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;\n}\n\nexport function extractTokenFromCookies(\n cookieHeader: string | null,\n cookieName: string\n): string | null {\n if (!cookieHeader) return null;\n\n const prefix = `${cookieName}=`;\n let start = 0;\n\n while (start < cookieHeader.length) {\n const idx = cookieHeader.indexOf(prefix, start);\n if (idx === -1) return null;\n\n const prevChar = idx > 0 ? cookieHeader[idx - 1] : '';\n if (prevChar === '' || prevChar === ';' || prevChar === ' ') {\n let end = cookieHeader.indexOf(';', idx);\n if (end === -1) end = cookieHeader.length;\n\n const value = cookieHeader.slice(idx + prefix.length, end).trim();\n try {\n return decodeURIComponent(value) || null;\n } catch {\n return value || null;\n }\n }\n\n start = idx + prefix.length;\n }\n\n return null;\n}\n\n/**\n * The scope the Salla SDK persists as `scope`: the market (`id`/`type`) plus, once\n * bullet delivery confirms an address or branch, the allocation. The SDK sends all\n * four as request headers (`s-scope-id`, `s-scope-type`, `s-scope-allocation-type`,\n * `s-scope-allocation-id`) and the API resolves stock per allocation — a scope sent\n * without its allocation is a different question, answered from a different branch.\n */\nexport interface ActiveScope {\n id: string;\n type?: string;\n allocation_type?: string;\n allocation_id?: string;\n}\n\n/** The SDK stores the scope either as its full object or as a bare id. */\nfunction normalizeScope(raw: unknown): ActiveScope | null {\n if (raw == null) return null;\n if (typeof raw !== 'object') return { id: String(raw) };\n const s = raw as Record<string, unknown>;\n if (s.id == null) return null;\n const scope: ActiveScope = { id: String(s.id) };\n if (s.type != null) scope.type = String(s.type);\n if (s.allocation_type != null) scope.allocation_type = String(s.allocation_type);\n if (s.allocation_id != null) scope.allocation_id = String(s.allocation_id);\n return scope;\n}\n\n/**\n * Reads the active scope from the `scope` cookie, which Salla persists as a JSON\n * object (e.g. `{\"id\":123,\"type\":\"scope\",\"allocation_type\":\"branch\",\"allocation_id\":\"9\"}`).\n * Returns null when the cookie is missing or unparseable. Used server-side, where\n * `salla.storage` is absent.\n */\nexport function extractScopeFromCookies(cookieHeader: string | null): ActiveScope | null {\n const raw = extractTokenFromCookies(cookieHeader, SCOPE_COOKIE_NAME);\n if (!raw) return null;\n try {\n return normalizeScope(JSON.parse(raw));\n } catch {\n return null;\n }\n}\n\n/** {@link extractScopeFromCookies} reduced to the id. */\nexport function extractScopeIdFromCookies(cookieHeader: string | null): string | null {\n return extractScopeFromCookies(cookieHeader)?.id ?? null;\n}\n\n/**\n * The scope the Salla SDK persisted in its storage (`salla.storage.get('scope')`).\n *\n * Returns `undefined` when the SDK storage API isn't ready yet — deliberately\n * distinct from `null` (\"no branch selected\"), so callers can't mistake a\n * not-yet-hydrated SDK for a cleared selection. Client-only.\n */\nexport function readSdkScope(): ActiveScope | null | undefined {\n const storage = typeof window !== 'undefined' ? window.salla?.storage : undefined;\n if (typeof storage?.get !== 'function') return undefined;\n return normalizeScope(storage.get(SCOPE_COOKIE_NAME));\n}\n\n/** {@link readSdkScope} reduced to the id; keeps the not-ready/none distinction. */\nexport function readSdkScopeId(): string | null | undefined {\n const scope = readSdkScope();\n return scope === undefined ? undefined : (scope?.id ?? null);\n}\n\n/** One year — the SDK keeps the selected branch in localStorage indefinitely. */\nconst SCOPE_COOKIE_MAX_AGE = 60 * 60 * 24 * 365;\n\nconst sameScope = (a: ActiveScope | null, b: ActiveScope | null): boolean =>\n JSON.stringify(a) === JSON.stringify(b);\n\n/**\n * Mirrors the scope the Salla SDK selected into the `scope` cookie so the SERVER\n * can see it. The SDK persists the selection in localStorage ONLY and writes no\n * cookie, so without this the server computes scope=null for every visitor who\n * picked a branch while the client computes the branch id — the dehydrated settings\n * query key never matches and the client refetches store settings on every page\n * load (SAL-122).\n *\n * Written in the SDK's own JSON shape so {@link extractScopeFromCookies} parses it,\n * allocation included: the bullet-delivery component writes the same cookie with the\n * full object, and rewriting it with the id alone would drop the branch the server\n * needs. Returns true when the cookie was (re)written. Client-only; no-op on the server.\n */\nexport function writeScopeCookie(scope: ActiveScope | null): boolean {\n if (typeof document === 'undefined') return false;\n if (sameScope(extractScopeFromCookies(document.cookie), scope)) return false;\n\n if (scope == null) {\n document.cookie = `${SCOPE_COOKIE_NAME}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;\n return true;\n }\n\n const value = encodeURIComponent(JSON.stringify(scope));\n document.cookie = `${SCOPE_COOKIE_NAME}=${value}; path=/; max-age=${SCOPE_COOKIE_MAX_AGE}; samesite=lax`;\n return true;\n}\n\n/**\n * Keeps the `scope` cookie in step with the SDK's selected branch. Call on every\n * client navigation; it no-ops while the SDK storage API is still hydrating so a\n * late-loading SDK can't wipe a valid cookie.\n */\nexport function syncScopeCookie(): boolean {\n const scope = readSdkScope();\n return scope === undefined ? false : writeScopeCookie(scope);\n}\n","/**\n * Escape a JSON-stringified value for safe embedding inside an inline `<script>` body.\n *\n * The head injects script bodies raw, so a `</script>` inside partner-set data would break out\n * of the tag; U+2028/U+2029 are line terminators in JS but not in JSON, so they must go too.\n */\nexport function escapeForInlineScript(value: string): string {\n return value\n .replace(/</g, '\\\\u003c')\n .replace(/>/g, '\\\\u003e')\n .replace(/&/g, '\\\\u0026')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n}\n","import { escapeForInlineScript } from './inline-script';\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore } from './cookies';\n\n/** Where `rootHead` publishes the SSR-resolved env for the browser bundle to read. */\nconst RUNTIME_ENV_KEY = '__SALLA_RUNTIME_ENV__';\n\n/** The env values that must agree between the SSR render and the hydrated client. */\nexport interface RuntimeEnv {\n /** Store API base — `VITE_API_URL`. */\n apiBase?: string;\n /** Store identifier — `VITE_STORE_DOMAIN`. */\n storeIdentifier?: string;\n}\n\n/**\n * A build-time `import.meta.env` var, falling back to the worker's runtime `process.env`\n * (wrangler `vars`, exposed via the `nodejs_compat_populate_process_env` flag).\n */\nexport function readEnv(key: string): string | undefined {\n try {\n const vite = (import.meta as unknown as { env?: Record<string, string | undefined> }).env?.[\n key\n ];\n if (vite) return vite;\n } catch {\n /* import.meta.env not available in all environments */\n }\n return typeof process !== 'undefined' ? process.env?.[key] : undefined;\n}\n\n/**\n * What this runtime resolves from its own env — server-side that includes the worker vars.\n * Prefers what the server already published, so re-rendering the head during hydration yields\n * the same script instead of dropping it.\n */\nexport function resolveRuntimeEnv(): RuntimeEnv {\n const injected = getInjectedRuntimeEnv();\n const { storeId, requestHost } = getRequestStore();\n return {\n apiBase: injected.apiBase || readEnv('VITE_API_URL'),\n // The request outranks the build-time var here for the same reason it does\n // in `resolveStoreIdentifier`, and this is the copy that reaches the\n // browser: publish the store SSR actually rendered, or hydration resolves\n // again from a URL whose `?storeId=` the dispatcher has already stripped and\n // queries a different store than the markup it is hydrating.\n storeIdentifier:\n injected.storeIdentifier ||\n storeId ||\n (hostIdentifiesStore(requestHost) ? requestHost : null) ||\n readEnv('VITE_STORE_DOMAIN'),\n };\n}\n\n/**\n * The env the SSR worker resolved, as handed to the browser by `rootHead`. Empty on the server\n * and on a client whose head carried nothing.\n *\n * Worker `vars` are *runtime* env: they live in `process.env` on the server only, while\n * `import.meta.env` is substituted at build time. A bundle built without those vars therefore\n * sees `undefined` in the browser and silently falls back to the production defaults — SSR\n * would render off the configured backend while every post-hydration fetch hits another one.\n */\nexport function getInjectedRuntimeEnv(): RuntimeEnv {\n const holder = globalThis as typeof globalThis & { [RUNTIME_ENV_KEY]?: RuntimeEnv };\n return holder[RUNTIME_ENV_KEY] ?? {};\n}\n\n/**\n * Inline head `<script>` body publishing the server-resolved env, or null when there is nothing\n * to publish (no overrides configured — the defaults already agree on both sides).\n */\nexport function renderRuntimeEnvScript(env: RuntimeEnv = resolveRuntimeEnv()): string | null {\n const set = Object.entries(env).filter(([, value]) => Boolean(value));\n if (!set.length) return null;\n const json = escapeForInlineScript(JSON.stringify(Object.fromEntries(set)));\n return `window.${RUNTIME_ENV_KEY}=${json};`;\n}\n","/**\n * @fileoverview Which store to ask about — the one answer, in one place.\n *\n * This lived in two places once. `api/store.ts` learned to read the store a\n * request names, and `utils/sdk-helpers.ts` — the copy `api/client.ts` actually\n * sets the `store-identifier` header from — did not. So the resolver that had\n * been taught the answer was consulted for a null check and thrown away, every\n * outgoing request carried an empty identifier, the API answered\n * `422 Store Identifier not found`, and every published theme rendered\n * \"Store Unavailable\" while its tests passed: the client's suite mocked the\n * resolver, and the resolver's suite never went near a request.\n *\n * Hence one module, imported by both. If a third place ever needs a store\n * identifier, it imports this — a second implementation is the bug, not a\n * refactor away from it.\n *\n * See `docs/store-identity.md` for the full picture, including the security\n * boundary on who may name a store.\n */\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore } from './cookies';\nimport { getInjectedRuntimeEnv, readEnv } from './runtime-env';\n\n/**\n * Which store to ask about, in the order the answers can be trusted.\n *\n * A deployed theme worker is published with **no vars and no bindings** — the\n * script metadata carries `main_module`, compatibility settings, assets and tags\n * and nothing else — so `VITE_STORE_DOMAIN` exists only where a build baked it\n * in, which is local development. In production this function used to reach the\n * end of that chain and return the empty string, `store.settings` refused to\n * call with no identifier, and the root loader threw \"Store Unavailable\" — a\n * theme that renders its own failure page for every visitor of every store.\n *\n * The order:\n *\n * 1. what the caller passed, which is always deliberate;\n * 2. the store this request names — the `?storeId=` a preview was opened with,\n * then the cookie remembering it — seeded by `twilightMiddleware`, and only\n * on a host permitted to name one;\n * 3. what SSR already resolved and published, so the hydrated client asks about\n * the same store the server rendered instead of resolving again from a URL\n * that no longer names it;\n * 4. the request's own host, which *is* the identity of a live storefront —\n * but only when that host is a storefront. `preview.salla.design` and\n * `localhost` serve many stores, so their names identify none;\n * 5. `VITE_STORE_DOMAIN`, last, because a build-time constant is a development\n * convenience and must never outrank what the request actually said.\n */\nexport function resolveStoreIdentifier(explicit?: string): string {\n if (explicit) return explicit;\n\n const { storeId, requestHost } = getRequestStore();\n if (storeId) return storeId;\n\n const injected = getInjectedRuntimeEnv().storeIdentifier;\n if (injected) return injected;\n\n if (hostIdentifiesStore(requestHost)) return requestHost as string;\n\n // The browser's own address, for a client render that reached neither of the\n // above — a live storefront, where the host is the store.\n const browserHost = typeof window !== 'undefined' ? window.location.host : null;\n if (hostIdentifiesStore(browserHost)) return browserHost as string;\n\n return readEnv('VITE_STORE_DOMAIN') || readEnv('STORE_DOMAIN') || '';\n}\n","export type { StoreContext } from '../api/store';\nimport { resolveStoreIdentifier } from './store-identity';\n\nconst isBrowser = typeof window !== 'undefined';\n\n/**\n * Which store to ask the API about — see {@link resolveStoreIdentifier}.\n *\n * A delegation, not a second implementation. This name is the one on the wire\n * (`api/client.ts` sets the `store-identifier` header from it) and the one\n * themes import from `@salla.sa/twilight-theme-engine/utils`, so it stays; what\n * it must never do again is answer differently from the resolver everything\n * else asks. It had its own copy of the order once, missing the store the\n * request names and preferring the build-time `VITE_STORE_DOMAIN` that a\n * deployed worker does not have — so every published theme sent an empty\n * identifier and rendered \"Store Unavailable\".\n */\nexport function getStoreIdentifier(explicit?: string): string {\n return resolveStoreIdentifier(explicit);\n}\n\n/**\n * Get Salla SDK instance if available\n */\nexport function getSallaSDK(): typeof window.salla | undefined {\n if (!isBrowser) return undefined;\n return window.salla;\n}\n\n/**\n * Push the active route locale onto the Salla SDK.\n *\n * Why this is needed (and why it must run on every navigation):\n * - The SDK seeds its locale from `navigator.language` — the theme sets no `s-lang`\n * cookie or `window.locale` — so an English browser starts the SDK in `en` even on\n * an `/ar` store.\n * - The SDK fixes its axios `accept-language` header ONCE, at init. `salla.lang.setLocale`\n * only swaps UI translations (it never touches the header), and `salla.init()` is a\n * no-op after `Salla.status === 'ready'`, so the header never refreshes on its own.\n * - `profile::info.fetched` (login / profile refresh on navigation) overrides the header\n * to the *account's* language.\n *\n * Net result without this: `salla.api.*` calls (cart/product details) return data in the\n * wrong locale — e.g. English cart item names on `/ar/cart` — intermittently, depending on\n * load order and whether a profile fetch ran. Re-asserting the URL locale here keeps the\n * header correct. No-op on the server and until the SDK exposes the methods.\n */\nexport function syncSdkLocale(locale: string): void {\n const sdk = getSallaSDK();\n if (!sdk || !locale) return;\n try {\n sdk.lang?.setLocale?.(locale);\n sdk.api?.setHeader?.('accept-language', locale);\n // The localization modal swaps `/${user.language_code}/` in the URL on submit;\n // the SDK never sets this locally, so without it the switch reloads the same page.\n sdk.config?.set?.('user.language_code', locale);\n } catch {\n // SDK partially loaded — the header is re-asserted on the next navigation.\n }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/api/store.ts"],"names":[],"mappings":";;;;;AAQA,IAAM,qBAAA,GAAwB;AAAA,EAC5B,OAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,gBAAA;AAAA,EACA,mBAAA;AAAA,EACA,YAAA;AAAA,EACA,WAAA;AAAA,EACA,UAAA;AAAA,EACA,iBAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA;AAmDA,SAAS,iBAAiB,SAAA,EAA8D;AACtF,EAAA,IAAI,CAAC,WAAW,OAAO,MAAA;AAGvB,EAAA,OAAO,MAAA,CAAO,MAAA,CAAO,SAAS,CAAA,CAAE,GAAA,CAAI,CAAC,IAAA,MAAU,EAAE,QAAA,EAAU,IAAA,CAAK,IAAA,EAAM,GAAG,MAAK,CAAE,CAAA;AAClF;AAEO,IAAM,KAAA,GAAQ;AAAA,EACnB,QAAA,EAAU,OAAO,eAAA,KAA2D;AAC1E,IAAA,MAAM,UAAA,GAAa,mBAAmB,sBAAA,EAAuB;AAE7D,IAAA,IAAI,CAAC,UAAA,EAAY;AACf,MAAA,OAAA,CAAQ,KAAK,gDAAgD,CAAA;AAC7D,MAAA,OAAO,IAAA;AAAA,IACT;AAEA,IAAA,MAAM,aAAA,GAAgB,qBAAA,CAAsB,GAAA,CAAI,CAAC,CAAA,KAAM,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mB,CAAE,MAAA;AAAA,QACrB,cAAA;AAAe,OACjB;AAAA,MACA,OAAA,EAAS,MAAM,KAAA,CAAM,QAAA,CAAS,eAAe;AAAA,KAC9C;AAAA;AAEP","file":"chunk-Z2BE6MDB.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope, getActiveScopeId, STORE_IDENTIFIER_HEADER } from './client';\nimport type { Store, Theme, Language } from '../types';\nimport { getTwilightContext } from '../twilight/context';\nimport { resolveStoreIdentifier } from '../utils/store-identity';\n\nexport { resolveStoreIdentifier };\n\nconst DEFAULT_INCLUDE_ITEMS = [\n 'store',\n 'settings',\n 'theme',\n 'theme_settings',\n 'external_services',\n 'currencies',\n 'languages',\n 'payments',\n 'product_widgets',\n 'rating',\n 'ratings',\n];\n\n/**\n * Raw API response for settings endpoint.\n * Languages come as object: { \"AR\": { code, name, ... }, \"EN\": {...} }\n */\ninterface SettingsApiResponse {\n store?: Store;\n theme?: Theme;\n languages?: Record<string, Language>;\n currencies?: Record<\n string,\n { code: string; name: string; symbol: string; amount: number; country_code: string }\n >;\n external_services?: Record<string, unknown>;\n headers?: Record<string, unknown>;\n login?: { url: string; turnstile_site_key: string };\n affiliate?: { utm_url: string; cta_enabled: boolean };\n debug?: boolean;\n trace_console?: boolean;\n policy_url?: string;\n}\n\n/**\n * Central settings context - single source of truth for all API data.\n * Contains everything from the settings endpoint response after processing.\n */\nexport interface StoreContext {\n store?: Store;\n theme?: Theme;\n /** Languages as array after conversion from API object format */\n languages?: Language[];\n currencies?: Record<\n string,\n { code: string; name: string; symbol: string; amount: number; country_code: string }\n >;\n external_services?: Record<string, unknown>;\n headers?: Record<string, unknown>;\n login?: { url: string; turnstile_site_key: string };\n affiliate?: { utm_url: string; cta_enabled: boolean };\n debug?: boolean;\n trace_console?: boolean; // todo:: remove it\n policy_url?: string;\n}\n\n/**\n * Converts languages object from API to array format.\n * API returns: { \"AR\": { code, name, ... }, \"EN\": { ... } }\n * We need: [{ code, name, ... }, { code, name, ... }]\n * todo:: return the languages as object from the APIs to avoid this\n */\nfunction languagesToArray(languages?: Record<string, Language>): Language[] | undefined {\n if (!languages) return undefined;\n // The SDK's localization modal reads `lang.iso_code` (not `code`) when a language is\n // selected — without it the switch navigates to `/undefined/...`.\n return Object.values(languages).map((lang) => ({ iso_code: lang.code, ...lang }));\n}\n\nexport const store = {\n settings: async (storeIdentifier?: string): Promise<StoreContext | null> => {\n const identifier = storeIdentifier ?? resolveStoreIdentifier();\n\n if (!identifier) {\n console.warn('[store.settings] No store identifier available');\n return null;\n }\n\n const includeParams = DEFAULT_INCLUDE_ITEMS.map((i) => `include[]=${i}`).join('&');\n const scopeId = getActiveScopeId();\n const params = scopeId != null ? `${includeParams}&scope=${scopeId}` : includeParams;\n\n try {\n const json = await api\n // Sent explicitly rather than left to the client's own resolution, so\n // the identifier this function checked is the identifier that travels.\n // They agree today; a caller passing one and being answered about\n // another is the failure this makes impossible rather than unlikely.\n .get(`store/settings?${params}`, {\n timeout: 5000,\n headers: { [STORE_IDENTIFIER_HEADER]: identifier },\n })\n .json<{ data?: SettingsApiResponse }>();\n\n const data = json?.data;\n if (!data) return null;\n\n // Convert languages from object to array\n const languages = languagesToArray(data.languages);\n\n return {\n store: data.store,\n theme: data.theme,\n languages,\n currencies: data.currencies,\n external_services: data.external_services,\n headers: data.headers,\n login: data.login,\n affiliate: data.affiliate,\n policy_url: data.policy_url,\n };\n } catch (error) {\n console.error('[store.settings] Failed:', error);\n return null;\n }\n },\n\n queries: {\n settings: (storeIdentifier?: string) =>\n queryOptions<StoreContext | null>({\n queryKey: [\n 'store',\n 'settings',\n storeIdentifier,\n getTwilightContext().locale,\n getActiveScope(),\n ],\n queryFn: () => store.settings(storeIdentifier),\n }),\n },\n};\n"]}
@@ -1,23 +0,0 @@
1
- export { RouteDocumentSync, TanStackDocumentSync, tanstackDocumentAdapter, useTanstackDocumentAttrs } from './chunk-DLDDKPRN.js';
2
- import './chunk-Z4Y55HWX.js';
3
- import './chunk-FQGCCV4T.js';
4
- import './chunk-EV4JSMFZ.js';
5
- import './chunk-B3EFOE57.js';
6
- import './chunk-Z2BE6MDB.js';
7
- import './chunk-GCAIIFF3.js';
8
- import './chunk-TZ3E5BN4.js';
9
- import './chunk-TXYT42AU.js';
10
- import './chunk-LG556DIE.js';
11
- import './chunk-E3J2RXBS.js';
12
- import './chunk-MTONGOJD.js';
13
- import './chunk-WXOABH6J.js';
14
- import './chunk-Y5FBDMFV.js';
15
- import './chunk-5ACY5CD3.js';
16
- import './chunk-JWXJPJBO.js';
17
- import './chunk-CW625T2E.js';
18
- import './chunk-TYNZ5B2B.js';
19
- import './chunk-T72DAX7R.js';
20
- import './chunk-DF6FBKDN.js';
21
- import './chunk-DGUM43GV.js';
22
- //# sourceMappingURL=document-class-BQBALA53.js.map
23
- //# sourceMappingURL=document-class-BQBALA53.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/routes/not-found.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,SAAS,YAAA,CAAa,KAAA,GAA2B,EAAC,EAAG;AAC1D,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAE7B,EAAA,MAAM;AAAA,IACJ,KAAA,GAAQ,CAAA,CAAE,mBAAmB,CAAA,IAAK,gBAAA;AAAA,IAClC,OAAA,GAAU,CAAA,CAAE,8BAA8B,CAAA,IACxC,gEAAA;AAAA,IACF,YAAA,GAAe,IAAA;AAAA,IACf,YAAA,GAAe,CAAA,CAAE,2BAA2B,CAAA,IAAK,cAAA;AAAA,IACjD;AAAA,GACF,GAAI,KAAA;AAEJ,EAAA,uBACE,IAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAM,GAAA;AAAA,MACN,KAAA;AAAA,MACA,OAAA;AAAA,MACA,UAAA,EAAY,YAAA;AAAA,MACZ,UAAA,EAAY,YAAA;AAAA,MACZ,aAAA;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,GAAA,CAAC,QAAA,EAAA,EAAS,MAAK,gBAAA,EAAiB,CAAA;AAAA,wBAChC,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAK,kBAAA,EAAmB,CAAA;AAAA,wBAClC,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAK,cAAA,EAAe;AAAA;AAAA;AAAA,GAChC;AAEJ","file":"not-found-OPY73PW5.js","sourcesContent":["import type { ComponentType, ReactNode } from 'react';\nimport { HookSlot } from '../hooks';\nimport { useTranslation } from '../providers/I18nProvider';\nimport { ErrorPage } from '../components/common';\n\nexport interface NotFoundPageProps {\n title?: string;\n message?: string;\n showHomeLink?: boolean;\n homeLinkText?: string;\n LinkComponent?: ComponentType<{\n to: string;\n className?: string;\n style?: React.CSSProperties;\n children: ReactNode;\n }>;\n}\n\nexport function NotFoundPage(props: NotFoundPageProps = {}) {\n const { t } = useTranslation();\n\n const {\n title = t('common.errors.404') || 'Page Not Found',\n message = t('common.errors.error_occurred') ||\n 'The page you are looking for does not exist or has been moved.',\n showHomeLink = true,\n homeLinkText = t('common.elements.back_home') || 'Back to Home',\n LinkComponent,\n } = props;\n\n return (\n <ErrorPage\n code={404}\n title={title}\n message={message}\n showAction={showHomeLink}\n actionText={homeLinkText}\n LinkComponent={LinkComponent}\n >\n <HookSlot name=\"notfound:start\" />\n <HookSlot name=\"notfound:content\" />\n <HookSlot name=\"notfound:end\" />\n </ErrorPage>\n );\n}\n"]}