@salla.sa/twilight-theme-engine 1.0.197 → 1.0.199

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 (367) hide show
  1. package/dist/{AddToCartForm-KIQ3YVC7.js → AddToCartForm-INTHBVVX.js} +5 -4
  2. package/dist/AddToCartForm-INTHBVVX.js.map +1 -0
  3. package/dist/{BlogAuthorPage-YNCYWLVN.js → BlogAuthorPage-H5H7TVSK.js} +32 -31
  4. package/dist/BlogAuthorPage-H5H7TVSK.js.map +1 -0
  5. package/dist/{BlogCategoryPage-IGIRJONV.js → BlogCategoryPage-LJOEQNGO.js} +32 -31
  6. package/dist/BlogCategoryPage-LJOEQNGO.js.map +1 -0
  7. package/dist/{BlogPage-RLY6E4E5.js → BlogPage-RLKZKLOB.js} +30 -29
  8. package/dist/BlogPage-RLKZKLOB.js.map +1 -0
  9. package/dist/{BlogSinglePage-7WB3VBNN.js → BlogSinglePage-7MWTO32X.js} +30 -29
  10. package/dist/BlogSinglePage-7MWTO32X.js.map +1 -0
  11. package/dist/{BlogTagPage-UIWFQX3P.js → BlogTagPage-OCCQVZWT.js} +32 -31
  12. package/dist/BlogTagPage-OCCQVZWT.js.map +1 -0
  13. package/dist/{BrandsPage-LY2PLW4S.js → BrandsPage-2YUNURJL.js} +31 -30
  14. package/dist/BrandsPage-2YUNURJL.js.map +1 -0
  15. package/dist/{Breadcrumb-IXERIJBI.js → Breadcrumb-XCIWXGZ2.js} +30 -29
  16. package/dist/Breadcrumb-XCIWXGZ2.js.map +1 -0
  17. package/dist/{CanvasOverlay-2WJ4QER3.js → CanvasOverlay-L2SE4YNF.js} +4 -4
  18. package/dist/{CanvasOverlay-2WJ4QER3.js.map → CanvasOverlay-L2SE4YNF.js.map} +1 -1
  19. package/dist/{CartItem-32Y2BVCY.js → CartItem-KGBPLEKI.js} +30 -29
  20. package/dist/CartItem-KGBPLEKI.js.map +1 -0
  21. package/dist/{CartSummary-XR52UPHU.js → CartSummary-UI26T2XZ.js} +30 -29
  22. package/dist/CartSummary-UI26T2XZ.js.map +1 -0
  23. package/dist/{Copyright-UHXO2XAS.js → Copyright-LERJ2GQG.js} +5 -4
  24. package/dist/Copyright-LERJ2GQG.js.map +1 -0
  25. package/dist/{CustomerLayout-CD3N3YVA.js → CustomerLayout-NBVNSACY.js} +30 -29
  26. package/dist/CustomerLayout-NBVNSACY.js.map +1 -0
  27. package/dist/Footer-N2IHHIYP.js +19 -0
  28. package/dist/{Footer-VDXJFLKM.js.map → Footer-N2IHHIYP.js.map} +1 -1
  29. package/dist/GoogleTag-MCDINMLU.js +15 -0
  30. package/dist/{GoogleTag-UDEQTF5G.js.map → GoogleTag-MCDINMLU.js.map} +1 -1
  31. package/dist/{Header-DMK4INZE.js → Header-3ZIJWLWT.js} +12 -11
  32. package/dist/{Header-DMK4INZE.js.map → Header-3ZIJWLWT.js.map} +1 -1
  33. package/dist/{LatestProducts-7KWFHGC5.js → LatestProducts-JSPMCNBR.js} +32 -31
  34. package/dist/LatestProducts-JSPMCNBR.js.map +1 -0
  35. package/dist/{LiveEditorBar-4C7Z7K3M.js → LiveEditorBar-BSCHU7WO.js} +3 -3
  36. package/dist/{LiveEditorBar-4C7Z7K3M.js.map → LiveEditorBar-BSCHU7WO.js.map} +1 -1
  37. package/dist/{LoyaltyPage-NKAAAGCX.js → LoyaltyPage-4FCXNGJU.js} +30 -29
  38. package/dist/LoyaltyPage-4FCXNGJU.js.map +1 -0
  39. package/dist/{LoyaltyPointsPage-RRAYL237.js → LoyaltyPointsPage-BVRMRPQP.js} +12 -11
  40. package/dist/LoyaltyPointsPage-BVRMRPQP.js.map +1 -0
  41. package/dist/{MainMenu-WJOVBJVW.js → MainMenu-ERTVTNVE.js} +8 -7
  42. package/dist/MainMenu-ERTVTNVE.js.map +1 -0
  43. package/dist/{MasterLayout-ORV7VBB4.js → MasterLayout-O7F5TP2X.js} +30 -29
  44. package/dist/{MasterLayout-ORV7VBB4.js.map → MasterLayout-O7F5TP2X.js.map} +1 -1
  45. package/dist/{MobileMenu-OS4IQUXT.js → MobileMenu-XLDU76UD.js} +32 -31
  46. package/dist/MobileMenu-XLDU76UD.js.map +1 -0
  47. package/dist/{NotificationsPage-2XF37NBH.js → NotificationsPage-PV3BZDDN.js} +30 -29
  48. package/dist/NotificationsPage-PV3BZDDN.js.map +1 -0
  49. package/dist/{OrderSinglePage-RU3ZWJNH.js → OrderSinglePage-N27RQCWW.js} +31 -30
  50. package/dist/OrderSinglePage-N27RQCWW.js.map +1 -0
  51. package/dist/{OrdersPage-NTQTWL72.js → OrdersPage-VAF25LAZ.js} +30 -29
  52. package/dist/OrdersPage-VAF25LAZ.js.map +1 -0
  53. package/dist/{PageSingle-PGV2RTUR.js → PageSingle-6DZL7G7F.js} +6 -5
  54. package/dist/PageSingle-6DZL7G7F.js.map +1 -0
  55. package/dist/{ProductDetails-ZY7J7RMY.js → ProductDetails-JELMTMQY.js} +9 -8
  56. package/dist/{ProductDetails-ZY7J7RMY.js.map → ProductDetails-JELMTMQY.js.map} +1 -1
  57. package/dist/{ProfilePage-VFI5XWAT.js → ProfilePage-7WPASJD3.js} +30 -29
  58. package/dist/ProfilePage-7WPASJD3.js.map +1 -0
  59. package/dist/{RenderWhenVisible-BQ7KVPHK.js → RenderWhenVisible-KNNLS5N2.js} +4 -2
  60. package/dist/RenderWhenVisible-KNNLS5N2.js.map +1 -0
  61. package/dist/{ReviewsPage-6AE54WFQ.js → ReviewsPage-OGU4HCDP.js} +5 -4
  62. package/dist/ReviewsPage-OGU4HCDP.js.map +1 -0
  63. package/dist/{SeoCartWidget-E2AWNOYU.js → SeoCartWidget-NF5S4KFI.js} +30 -29
  64. package/dist/SeoCartWidget-NF5S4KFI.js.map +1 -0
  65. package/dist/{SettingsPage-XHTIFJDC.js → SettingsPage-ZGQN6HZS.js} +30 -29
  66. package/dist/SettingsPage-ZGQN6HZS.js.map +1 -0
  67. package/dist/{StoreClosedNotification-QBKQZUYZ.js → StoreClosedNotification-RUNFBE3K.js} +31 -30
  68. package/dist/{StoreClosedNotification-QBKQZUYZ.js.map → StoreClosedNotification-RUNFBE3K.js.map} +1 -1
  69. package/dist/{TestimonialsPage-T3FE36LX.js → TestimonialsPage-RYT6EWHH.js} +6 -5
  70. package/dist/TestimonialsPage-RYT6EWHH.js.map +1 -0
  71. package/dist/{ThankYouPage-3MOKMZF5.js → ThankYouPage-G62URSEM.js} +30 -29
  72. package/dist/ThankYouPage-G62URSEM.js.map +1 -0
  73. package/dist/{WalletPage-QYU237QZ.js → WalletPage-V6EKL76S.js} +31 -30
  74. package/dist/WalletPage-V6EKL76S.js.map +1 -0
  75. package/dist/{WebMcpTools-B255SPSA.js → WebMcpTools-WSQQXYZF.js} +7 -6
  76. package/dist/WebMcpTools-WSQQXYZF.js.map +1 -0
  77. package/dist/WidgetHead-3NUEKRIE.js +8 -0
  78. package/dist/{WidgetHead-BCRIXIJQ.js.map → WidgetHead-3NUEKRIE.js.map} +1 -1
  79. package/dist/{WishlistPage-QQLWTHU2.js → WishlistPage-N7J54KUD.js} +32 -31
  80. package/dist/WishlistPage-N7J54KUD.js.map +1 -0
  81. package/dist/api/advertisement.js +2 -2
  82. package/dist/api/apps.js +2 -2
  83. package/dist/api/blog.js +5 -4
  84. package/dist/api/brands.js +5 -4
  85. package/dist/api/cart.js +5 -4
  86. package/dist/api/category.js +5 -4
  87. package/dist/api/client.js +1 -1
  88. package/dist/api/custom-url.js +2 -2
  89. package/dist/api/home.js +2 -2
  90. package/dist/api/loyalty.js +5 -4
  91. package/dist/api/menu.js +2 -2
  92. package/dist/api/notification.js +2 -2
  93. package/dist/api/order.js +5 -4
  94. package/dist/api/page.js +5 -4
  95. package/dist/api/product.js +5 -4
  96. package/dist/api/profile.js +1 -1
  97. package/dist/api/store.js +2 -2
  98. package/dist/api/translations.js +2 -2
  99. package/dist/api/user.js +2 -2
  100. package/dist/api/wallet.js +2 -2
  101. package/dist/api/wishlist.js +6 -5
  102. package/dist/{chunk-AXX7A2JJ.js → chunk-2QDPVKV3.js} +3 -3
  103. package/dist/{chunk-AXX7A2JJ.js.map → chunk-2QDPVKV3.js.map} +1 -1
  104. package/dist/{chunk-LDZJIVNG.js → chunk-3H6CED6M.js} +12 -10
  105. package/dist/chunk-3H6CED6M.js.map +1 -0
  106. package/dist/{chunk-DF6FBKDN.js → chunk-3VFOVWOE.js} +4 -3
  107. package/dist/chunk-3VFOVWOE.js.map +1 -0
  108. package/dist/{chunk-6R4ONYWT.js → chunk-5JEGXLR3.js} +9 -9
  109. package/dist/{chunk-6R4ONYWT.js.map → chunk-5JEGXLR3.js.map} +1 -1
  110. package/dist/{chunk-ZJYS5SJV.js → chunk-5LCLA2ER.js} +4 -4
  111. package/dist/{chunk-ZJYS5SJV.js.map → chunk-5LCLA2ER.js.map} +1 -1
  112. package/dist/chunk-6DHU2JNP.js +16 -0
  113. package/dist/{chunk-427CGPGK.js.map → chunk-6DHU2JNP.js.map} +1 -1
  114. package/dist/{chunk-ON7IFLME.js → chunk-6DVPJV53.js} +4 -4
  115. package/dist/{chunk-ON7IFLME.js.map → chunk-6DVPJV53.js.map} +1 -1
  116. package/dist/{chunk-4BDLDIHM.js → chunk-7DOPO5Y5.js} +4 -4
  117. package/dist/{chunk-4BDLDIHM.js.map → chunk-7DOPO5Y5.js.map} +1 -1
  118. package/dist/{chunk-44CLNMNF.js → chunk-7PLRJOAQ.js} +4 -4
  119. package/dist/{chunk-44CLNMNF.js.map → chunk-7PLRJOAQ.js.map} +1 -1
  120. package/dist/{chunk-DHSCGEZG.js → chunk-A3CRAPYV.js} +3 -3
  121. package/dist/{chunk-DHSCGEZG.js.map → chunk-A3CRAPYV.js.map} +1 -1
  122. package/dist/{chunk-62QKV5MR.js → chunk-A4FUMTWR.js} +3 -3
  123. package/dist/{chunk-62QKV5MR.js.map → chunk-A4FUMTWR.js.map} +1 -1
  124. package/dist/{chunk-TYMQSUHJ.js → chunk-ACUIK2FS.js} +3 -3
  125. package/dist/{chunk-TYMQSUHJ.js.map → chunk-ACUIK2FS.js.map} +1 -1
  126. package/dist/{chunk-YVCY6KOT.js → chunk-ANRVEE4Q.js} +4 -4
  127. package/dist/{chunk-YVCY6KOT.js.map → chunk-ANRVEE4Q.js.map} +1 -1
  128. package/dist/{chunk-3GIV335V.js → chunk-AQM3T2VJ.js} +3 -3
  129. package/dist/{chunk-3GIV335V.js.map → chunk-AQM3T2VJ.js.map} +1 -1
  130. package/dist/{chunk-7W43AJMQ.js → chunk-BB2HK4XJ.js} +3 -3
  131. package/dist/{chunk-7W43AJMQ.js.map → chunk-BB2HK4XJ.js.map} +1 -1
  132. package/dist/{chunk-NARBS52P.js → chunk-BLBWBTFO.js} +5 -5
  133. package/dist/{chunk-NARBS52P.js.map → chunk-BLBWBTFO.js.map} +1 -1
  134. package/dist/{chunk-OQIIJRAS.js → chunk-CBP4AT5U.js} +3 -3
  135. package/dist/{chunk-OQIIJRAS.js.map → chunk-CBP4AT5U.js.map} +1 -1
  136. package/dist/{chunk-H34NG4MP.js → chunk-CBRRRKGQ.js} +9 -7
  137. package/dist/chunk-CBRRRKGQ.js.map +1 -0
  138. package/dist/chunk-CFDSLP3D.js +25 -0
  139. package/dist/{chunk-NX2C7X4T.js.map → chunk-CFDSLP3D.js.map} +1 -1
  140. package/dist/{chunk-OA7ANM26.js → chunk-ENMUBWTR.js} +4 -4
  141. package/dist/{chunk-OA7ANM26.js.map → chunk-ENMUBWTR.js.map} +1 -1
  142. package/dist/{chunk-N4QBHMSZ.js → chunk-F5I7BANX.js} +5 -5
  143. package/dist/{chunk-N4QBHMSZ.js.map → chunk-F5I7BANX.js.map} +1 -1
  144. package/dist/{chunk-MAQQHQJX.js → chunk-FU2LJG5L.js} +4 -4
  145. package/dist/{chunk-MAQQHQJX.js.map → chunk-FU2LJG5L.js.map} +1 -1
  146. package/dist/{chunk-V2ZDTY6H.js → chunk-FWNSNBLY.js} +4 -4
  147. package/dist/{chunk-V2ZDTY6H.js.map → chunk-FWNSNBLY.js.map} +1 -1
  148. package/dist/{chunk-LDOFRMKE.js → chunk-FYE5XYLV.js} +4 -4
  149. package/dist/{chunk-LDOFRMKE.js.map → chunk-FYE5XYLV.js.map} +1 -1
  150. package/dist/{chunk-NQ6JUQHV.js → chunk-G7AL4NFZ.js} +3 -3
  151. package/dist/{chunk-NQ6JUQHV.js.map → chunk-G7AL4NFZ.js.map} +1 -1
  152. package/dist/{chunk-FZKRSGLP.js → chunk-GIMXGRBB.js} +3 -3
  153. package/dist/{chunk-FZKRSGLP.js.map → chunk-GIMXGRBB.js.map} +1 -1
  154. package/dist/{chunk-W4XBIDUP.js → chunk-GNC3U6G3.js} +4 -4
  155. package/dist/{chunk-W4XBIDUP.js.map → chunk-GNC3U6G3.js.map} +1 -1
  156. package/dist/{chunk-VPDADIS7.js → chunk-HYZXDMLX.js} +8 -8
  157. package/dist/{chunk-VPDADIS7.js.map → chunk-HYZXDMLX.js.map} +1 -1
  158. package/dist/{chunk-XQEWBUQ2.js → chunk-ID2UT4AE.js} +3 -3
  159. package/dist/{chunk-XQEWBUQ2.js.map → chunk-ID2UT4AE.js.map} +1 -1
  160. package/dist/{chunk-AA3PV6UD.js → chunk-JCI3IQJV.js} +4 -4
  161. package/dist/{chunk-AA3PV6UD.js.map → chunk-JCI3IQJV.js.map} +1 -1
  162. package/dist/{chunk-QT2D7JMW.js → chunk-K4HCMVAQ.js} +6 -6
  163. package/dist/{chunk-QT2D7JMW.js.map → chunk-K4HCMVAQ.js.map} +1 -1
  164. package/dist/{chunk-ELGZOQEY.js → chunk-K4QQRA6L.js} +4 -3
  165. package/dist/chunk-K4QQRA6L.js.map +1 -0
  166. package/dist/{chunk-KHK4UPEO.js → chunk-KNOIQCGE.js} +3 -3
  167. package/dist/{chunk-KHK4UPEO.js.map → chunk-KNOIQCGE.js.map} +1 -1
  168. package/dist/{chunk-QRAYSZPX.js → chunk-M4MMTQ75.js} +3 -3
  169. package/dist/{chunk-QRAYSZPX.js.map → chunk-M4MMTQ75.js.map} +1 -1
  170. package/dist/{chunk-4ZZKONOP.js → chunk-NDFBNHC4.js} +4 -4
  171. package/dist/{chunk-4ZZKONOP.js.map → chunk-NDFBNHC4.js.map} +1 -1
  172. package/dist/{chunk-MAT72BLA.js → chunk-NLH6ZEZ3.js} +3 -3
  173. package/dist/{chunk-MAT72BLA.js.map → chunk-NLH6ZEZ3.js.map} +1 -1
  174. package/dist/{chunk-G7WZ36MV.js → chunk-NXBYMNTS.js} +3 -3
  175. package/dist/{chunk-G7WZ36MV.js.map → chunk-NXBYMNTS.js.map} +1 -1
  176. package/dist/{chunk-Q4BL374L.js → chunk-OJA5QF6U.js} +15 -15
  177. package/dist/{chunk-Q4BL374L.js.map → chunk-OJA5QF6U.js.map} +1 -1
  178. package/dist/{chunk-LWI6MK3W.js → chunk-OKE2NZDI.js} +5 -3
  179. package/dist/chunk-OKE2NZDI.js.map +1 -0
  180. package/dist/{chunk-6TKIUG5C.js → chunk-OLN2QRGA.js} +3 -3
  181. package/dist/{chunk-6TKIUG5C.js.map → chunk-OLN2QRGA.js.map} +1 -1
  182. package/dist/{chunk-FFRTTMJN.js → chunk-OU55CVZI.js} +3 -3
  183. package/dist/{chunk-FFRTTMJN.js.map → chunk-OU55CVZI.js.map} +1 -1
  184. package/dist/{chunk-Q2D7CVAM.js → chunk-POSA5IOU.js} +3 -3
  185. package/dist/{chunk-Q2D7CVAM.js.map → chunk-POSA5IOU.js.map} +1 -1
  186. package/dist/{chunk-R6PS4MUD.js → chunk-PVKCR63Z.js} +4 -4
  187. package/dist/{chunk-R6PS4MUD.js.map → chunk-PVKCR63Z.js.map} +1 -1
  188. package/dist/{chunk-EUUIQ2RK.js → chunk-PZWVE7G6.js} +5 -5
  189. package/dist/{chunk-EUUIQ2RK.js.map → chunk-PZWVE7G6.js.map} +1 -1
  190. package/dist/{chunk-F5EDBW5Q.js → chunk-Q2VP3J4X.js} +6 -6
  191. package/dist/{chunk-F5EDBW5Q.js.map → chunk-Q2VP3J4X.js.map} +1 -1
  192. package/dist/{chunk-HHAR2YJN.js → chunk-R3FQW5X3.js} +4 -2
  193. package/dist/chunk-R3FQW5X3.js.map +1 -0
  194. package/dist/{chunk-FOSFAMZY.js → chunk-RBALJL3B.js} +4 -4
  195. package/dist/{chunk-FOSFAMZY.js.map → chunk-RBALJL3B.js.map} +1 -1
  196. package/dist/{chunk-Z7D36OEF.js → chunk-RBOZRX5Q.js} +4 -4
  197. package/dist/{chunk-Z7D36OEF.js.map → chunk-RBOZRX5Q.js.map} +1 -1
  198. package/dist/{chunk-7CQGFKKW.js → chunk-SG2B3Z7C.js} +4 -4
  199. package/dist/{chunk-7CQGFKKW.js.map → chunk-SG2B3Z7C.js.map} +1 -1
  200. package/dist/{chunk-PNJFMMPV.js → chunk-SM35CH2U.js} +3 -3
  201. package/dist/{chunk-PNJFMMPV.js.map → chunk-SM35CH2U.js.map} +1 -1
  202. package/dist/{chunk-NFD5EJ7W.js → chunk-SSMM6ZEQ.js} +3 -3
  203. package/dist/{chunk-NFD5EJ7W.js.map → chunk-SSMM6ZEQ.js.map} +1 -1
  204. package/dist/chunk-T43GL7UN.js +36 -0
  205. package/dist/chunk-T43GL7UN.js.map +1 -0
  206. package/dist/{chunk-VYGA5AT5.js → chunk-TLHZBTPZ.js} +8 -3
  207. package/dist/chunk-TLHZBTPZ.js.map +1 -0
  208. package/dist/{chunk-KYMWEUN2.js → chunk-TVL6UBN2.js} +3 -3
  209. package/dist/{chunk-KYMWEUN2.js.map → chunk-TVL6UBN2.js.map} +1 -1
  210. package/dist/{chunk-64BWBCE7.js → chunk-UY4VIWNH.js} +4 -2
  211. package/dist/chunk-UY4VIWNH.js.map +1 -0
  212. package/dist/{chunk-I3RQO6LI.js → chunk-V5DQMUSV.js} +4 -4
  213. package/dist/{chunk-I3RQO6LI.js.map → chunk-V5DQMUSV.js.map} +1 -1
  214. package/dist/{chunk-XGNKN4K5.js → chunk-VBMD3J7W.js} +5 -5
  215. package/dist/{chunk-XGNKN4K5.js.map → chunk-VBMD3J7W.js.map} +1 -1
  216. package/dist/{chunk-L5JO3H2U.js → chunk-WHGEXTQR.js} +40 -28
  217. package/dist/chunk-WHGEXTQR.js.map +1 -0
  218. package/dist/{chunk-XGOTO6VJ.js → chunk-X2QKWMWJ.js} +3 -3
  219. package/dist/{chunk-XGOTO6VJ.js.map → chunk-X2QKWMWJ.js.map} +1 -1
  220. package/dist/{chunk-5XDPAKF5.js → chunk-XZFWBF3P.js} +5 -3
  221. package/dist/chunk-XZFWBF3P.js.map +1 -0
  222. package/dist/{chunk-QANZP6LR.js → chunk-Y2YNVU6U.js} +3 -3
  223. package/dist/{chunk-QANZP6LR.js.map → chunk-Y2YNVU6U.js.map} +1 -1
  224. package/dist/{chunk-42N3PTIX.js → chunk-Y4WL6IRA.js} +3 -3
  225. package/dist/{chunk-42N3PTIX.js.map → chunk-Y4WL6IRA.js.map} +1 -1
  226. package/dist/{chunk-UJBNYOBE.js → chunk-ZCE3SGDY.js} +5 -5
  227. package/dist/{chunk-UJBNYOBE.js.map → chunk-ZCE3SGDY.js.map} +1 -1
  228. package/dist/{chunk-VTBDEJYJ.js → chunk-ZR6TA5TS.js} +4 -4
  229. package/dist/{chunk-VTBDEJYJ.js.map → chunk-ZR6TA5TS.js.map} +1 -1
  230. package/dist/components/cart/index.js +3 -2
  231. package/dist/components/common/RenderWhenVisible.d.ts.map +1 -1
  232. package/dist/components/common/index.js +3 -2
  233. package/dist/components/drawer/index.js +29 -28
  234. package/dist/components/home/ProductsSlider.d.ts.map +1 -1
  235. package/dist/components/home/index.js +33 -32
  236. package/dist/components/layout/index.js +10 -9
  237. package/dist/components/live-editor/frame.d.ts +5 -0
  238. package/dist/components/live-editor/frame.d.ts.map +1 -1
  239. package/dist/components/live-editor/index.d.ts.map +1 -1
  240. package/dist/components/modal/index.js +3 -2
  241. package/dist/components/product/ProductGallery.d.ts.map +1 -1
  242. package/dist/components/product/index.js +30 -29
  243. package/dist/components/store/index.js +29 -28
  244. package/dist/components/toast/index.js +3 -2
  245. package/dist/components/toast/index.js.map +1 -1
  246. package/dist/components/tracking/index.js +8 -7
  247. package/dist/components/tracking/index.js.map +1 -1
  248. package/dist/{custom-urls-NOM56TUW.js → custom-urls-3G5KPPAY.js} +9 -8
  249. package/dist/{custom-urls-NOM56TUW.js.map → custom-urls-3G5KPPAY.js.map} +1 -1
  250. package/dist/dev/editor/index.js +2 -2
  251. package/dist/dev/index.js +1 -1
  252. package/dist/{document-class-B6SA3O2R.js → document-class-LYNTNC52.js} +20 -19
  253. package/dist/{document-class-B6SA3O2R.js.map → document-class-LYNTNC52.js.map} +1 -1
  254. package/dist/hooks/HookSlot.d.ts.map +1 -1
  255. package/dist/hooks/HookSlot.js +3 -2
  256. package/dist/hooks/index.js +28 -27
  257. package/dist/hooks/useComments.d.ts.map +1 -1
  258. package/dist/hooks/useComments.js +2 -1
  259. package/dist/hooks/useGtm.js +28 -27
  260. package/dist/hooks/useMoney.js +28 -27
  261. package/dist/hooks/useProduct.d.ts.map +1 -1
  262. package/dist/hooks/useProduct.js +2 -1
  263. package/dist/hooks/useStore.js +28 -27
  264. package/dist/hooks/useTheme.js +3 -2
  265. package/dist/hooks/useUser.d.ts.map +1 -1
  266. package/dist/hooks/useUser.js +4 -3
  267. package/dist/index.js +28 -27
  268. package/dist/index.js.map +1 -1
  269. package/dist/{navigation-WSK4ESIY.js → navigation-AHHVAUWR.js} +7 -6
  270. package/dist/{navigation-WSK4ESIY.js.map → navigation-AHHVAUWR.js.map} +1 -1
  271. package/dist/{navigation-CVWUS27U.js → navigation-MRUGGEGM.js} +6 -5
  272. package/dist/navigation-MRUGGEGM.js.map +1 -0
  273. package/dist/{not-found-FHZ2IBEK.js → not-found-6EKRK524.js} +31 -30
  274. package/dist/not-found-6EKRK524.js.map +1 -0
  275. package/dist/providers/index.js +28 -27
  276. package/dist/providers/twilight-context.d.ts.map +1 -1
  277. package/dist/routes/account/orders.js +7 -6
  278. package/dist/routes/account.js +16 -15
  279. package/dist/routes/account.js.map +1 -1
  280. package/dist/routes/blog.js +11 -10
  281. package/dist/routes/blog.js.map +1 -1
  282. package/dist/routes/brands.js +7 -6
  283. package/dist/routes/brands.js.map +1 -1
  284. package/dist/routes/cart.js +38 -37
  285. package/dist/routes/cart.js.map +1 -1
  286. package/dist/routes/home.js +34 -33
  287. package/dist/routes/index.js +10 -9
  288. package/dist/routes/loyalty.js +8 -7
  289. package/dist/routes/loyalty.js.map +1 -1
  290. package/dist/routes/page.js +7 -6
  291. package/dist/routes/page.js.map +1 -1
  292. package/dist/routes/product-listing.js +39 -38
  293. package/dist/routes/product-listing.js.map +1 -1
  294. package/dist/routes/product.js +37 -36
  295. package/dist/routes/product.js.map +1 -1
  296. package/dist/routes/seo-redirects.js +10 -9
  297. package/dist/routes/testimonials.js +4 -3
  298. package/dist/routes/testimonials.js.map +1 -1
  299. package/dist/routes/thank-you.js +7 -6
  300. package/dist/routes/thank-you.js.map +1 -1
  301. package/dist/server/entry.js +24 -11
  302. package/dist/server/entry.js.map +1 -1
  303. package/dist/server/stream-handler.d.ts.map +1 -1
  304. package/dist/skeleton.js +36 -35
  305. package/dist/{store-lookup-ER67ZNEB.js → store-lookup-NRR66HZ7.js} +10 -9
  306. package/dist/store-lookup-NRR66HZ7.js.map +1 -0
  307. package/dist/tanstack.js +20 -19
  308. package/dist/tanstack.js.map +1 -1
  309. package/dist/utils/index.js +2 -2
  310. package/dist/utils/lazy-component.d.ts.map +1 -1
  311. package/dist/utils/render-probe.d.ts +31 -0
  312. package/dist/utils/render-probe.d.ts.map +1 -0
  313. package/package.json +1 -1
  314. package/tailwind/components/common/RenderWhenVisible.tsx.txt +2 -0
  315. package/tailwind/components/home/ProductsSlider.tsx.txt +2 -0
  316. package/tailwind/components/live-editor/frame.ts.txt +6 -0
  317. package/tailwind/components/live-editor/index.tsx.txt +22 -2
  318. package/tailwind/components/product/ProductGallery.tsx.txt +2 -0
  319. package/dist/AddToCartForm-KIQ3YVC7.js.map +0 -1
  320. package/dist/BlogAuthorPage-YNCYWLVN.js.map +0 -1
  321. package/dist/BlogCategoryPage-IGIRJONV.js.map +0 -1
  322. package/dist/BlogPage-RLY6E4E5.js.map +0 -1
  323. package/dist/BlogSinglePage-7WB3VBNN.js.map +0 -1
  324. package/dist/BlogTagPage-UIWFQX3P.js.map +0 -1
  325. package/dist/BrandsPage-LY2PLW4S.js.map +0 -1
  326. package/dist/Breadcrumb-IXERIJBI.js.map +0 -1
  327. package/dist/CartItem-32Y2BVCY.js.map +0 -1
  328. package/dist/CartSummary-XR52UPHU.js.map +0 -1
  329. package/dist/Copyright-UHXO2XAS.js.map +0 -1
  330. package/dist/CustomerLayout-CD3N3YVA.js.map +0 -1
  331. package/dist/Footer-VDXJFLKM.js +0 -18
  332. package/dist/GoogleTag-UDEQTF5G.js +0 -15
  333. package/dist/LatestProducts-7KWFHGC5.js.map +0 -1
  334. package/dist/LoyaltyPage-NKAAAGCX.js.map +0 -1
  335. package/dist/LoyaltyPointsPage-RRAYL237.js.map +0 -1
  336. package/dist/MainMenu-WJOVBJVW.js.map +0 -1
  337. package/dist/MobileMenu-OS4IQUXT.js.map +0 -1
  338. package/dist/NotificationsPage-2XF37NBH.js.map +0 -1
  339. package/dist/OrderSinglePage-RU3ZWJNH.js.map +0 -1
  340. package/dist/OrdersPage-NTQTWL72.js.map +0 -1
  341. package/dist/PageSingle-PGV2RTUR.js.map +0 -1
  342. package/dist/ProfilePage-VFI5XWAT.js.map +0 -1
  343. package/dist/RenderWhenVisible-BQ7KVPHK.js.map +0 -1
  344. package/dist/ReviewsPage-6AE54WFQ.js.map +0 -1
  345. package/dist/SeoCartWidget-E2AWNOYU.js.map +0 -1
  346. package/dist/SettingsPage-XHTIFJDC.js.map +0 -1
  347. package/dist/TestimonialsPage-T3FE36LX.js.map +0 -1
  348. package/dist/ThankYouPage-3MOKMZF5.js.map +0 -1
  349. package/dist/WalletPage-QYU237QZ.js.map +0 -1
  350. package/dist/WebMcpTools-B255SPSA.js.map +0 -1
  351. package/dist/WidgetHead-BCRIXIJQ.js +0 -7
  352. package/dist/WishlistPage-QQLWTHU2.js.map +0 -1
  353. package/dist/chunk-427CGPGK.js +0 -16
  354. package/dist/chunk-5XDPAKF5.js.map +0 -1
  355. package/dist/chunk-64BWBCE7.js.map +0 -1
  356. package/dist/chunk-DF6FBKDN.js.map +0 -1
  357. package/dist/chunk-ELGZOQEY.js.map +0 -1
  358. package/dist/chunk-H34NG4MP.js.map +0 -1
  359. package/dist/chunk-HHAR2YJN.js.map +0 -1
  360. package/dist/chunk-L5JO3H2U.js.map +0 -1
  361. package/dist/chunk-LDZJIVNG.js.map +0 -1
  362. package/dist/chunk-LWI6MK3W.js.map +0 -1
  363. package/dist/chunk-NX2C7X4T.js +0 -25
  364. package/dist/chunk-VYGA5AT5.js.map +0 -1
  365. package/dist/navigation-CVWUS27U.js.map +0 -1
  366. package/dist/not-found-FHZ2IBEK.js.map +0 -1
  367. package/dist/store-lookup-ER67ZNEB.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/api-base.ts","../src/utils/engine-version.ts","../src/api/dev-settings-cache.ts","../src/api/client.ts"],"names":["entry","createIsomorphicFn","getCookie"],"mappings":";;;;;;;;;AAWO,IAAM,eAAA,GAAkB;AAG/B,IAAM,aAAA,GAAgB,SAAA;AAQf,SAAS,qBAAA,CACd,QACA,WAAA,EACe;AACf,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,WAAA,EAAa,OAAO,IAAA;AACpC,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,IAAA,EAAM,CAAA;AAAA,EAC7B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,IAAI,GAAA,CAAI,QAAA,KAAa,QAAA,EAAU,OAAO,IAAA;AACtC,EAAA,IAAI,IAAI,IAAA,CAAK,WAAA,OAAkB,WAAA,CAAY,WAAA,IAAe,OAAO,IAAA;AACjE,EAAA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BAAA;AAAA;AAAA,MAEA,gBAAA,CAAiB;AAAA,KACnB;AAAA,IACA,aAAA,EAAe,CAAC,gBAAA,CAAiB,KAAK;AAAA;AAE1C,CAAC;AAEM,IAAM,GAAA,GAAM,GAAG,MAAA,CAAO;AAAA,EAC3B,MAAA,EAAQ,2BAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAC;AAUM,IAAM,QAAA,GAAW,GAAG,MAAA,CAAO;AAAA,EAChC,MAAA,EAAQ,iCAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAC","file":"chunk-XQEWBUQ2.js","sourcesContent":["/**\n * The header the storefront dispatcher names the Store API base in, on the\n * storefronts that must not call production: the beta storefront and its per-PR\n * previews (`web.beta.salla.group`, `web-<hash>.beta.salla.group`). There the\n * Store serves the storefront API under its own address, `https://<host>/api/v1`.\n *\n * Trusted for the same reason `x-salla-store-base` is: the dispatcher sets it\n * after dropping everything off its allowlist, so a visitor's copy never arrives.\n * It is still checked against the request's own host, so even a forged one could\n * only point the theme back at the storefront it is already serving.\n */\nexport const API_BASE_HEADER = 'x-salla-api-base';\n\n/** The one path the dispatcher names: the Store's storefront API under its own host. */\nconst API_BASE_PATH = '/api/v1';\n\n/**\n * The API base this request was told to use, or null for the build's default.\n *\n * Accepted only as `https://<the request's own host>/api/v1` (a trailing slash\n * allowed), with no credentials, query or fragment; returned without the slash.\n */\nexport function resolveRequestApiBase(\n header: string | null | undefined,\n requestHost: string | null\n): string | null {\n if (!header || !requestHost) return null;\n let url: URL;\n try {\n url = new URL(header.trim());\n } catch {\n return null;\n }\n if (url.protocol !== 'https:') return null;\n if (url.host.toLowerCase() !== requestHost.toLowerCase()) return null;\n if (url.username || url.password || url.search || url.hash) return null;\n if (url.pathname.replace(/\\/+$/, '') !== API_BASE_PATH) return null;\n return `${url.origin}${API_BASE_PATH}`;\n}\n\n/**\n * `url` moved from one API base to another: `https://api.salla.dev/store/v1/cart/1`\n * under `https://web.beta.salla.group/api/v1` is `https://web.beta.salla.group/api/v1/cart/1`.\n * Null when `url` is not under `from`, which leaves the request as it was.\n */\nexport function rebaseApiUrl(url: string, from: string, to: string): string | null {\n const base = from.replace(/\\/+$/, '');\n if (url !== base && !url.startsWith(`${base}/`) && !url.startsWith(`${base}?`)) return null;\n return to.replace(/\\/+$/, '') + url.slice(base.length);\n}\n","/**\n * The engine's own build version, injected by tsup `define` when dist is\n * built. Falls back to 'dev' when the source runs unbundled (vitest, direct\n * src imports in the monorepo).\n *\n * Exposed at runtime as `salla.versions.engine` by `useTwilightInit` so a\n * storefront can always be asked which engine build rendered it.\n */\nexport const ENGINE_VERSION: string =\n typeof __TWILIGHT_ENGINE_VERSION__ !== 'undefined' ? __TWILIGHT_ENGINE_VERSION__ : 'dev';\n","import type { AfterResponseHook, BeforeRequestHook } from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { DEV_SETTINGS_REFRESH_COOKIE } from '../utils/dev-settings-refresh';\n\n/**\n * A dev server reuses a store's settings for up to an hour.\n *\n * Every server render asks the API for `store/settings`, and a developer clicking\n * around a theme renders dozens of pages a minute. The API answers a burst of\n * settings requests for one store from one address with a challenge, which a\n * server-side fetch cannot pass, so the dev server rendered \"Store Unavailable\"\n * (6.05k challenged `(development; ssr)` calls in the 7 days to 2026-10-25). In\n * development, on the server, the same request within {@link DEV_SETTINGS_TTL_MS}\n * is answered from memory instead. An hour because the API counts settings\n * requests per hour, so one fetch an hour can never reach its limit; the theme\n * editor's \"Fetch fresh store data\" fetches sooner, and says how old the settings\n * are. A production build never runs it: `import.meta.env.DEV` is statically\n * false there.\n */\nexport const DEV_SETTINGS_TTL_MS = 60 * 60_000;\n\n/** Marks an answer from memory, so the store step does not file it again. */\nconst HIT_HEADER = 'x-twilight-dev-cache';\n\n/** When the answer was really fetched from the API (epoch ms), on fresh answers and reused ones alike. */\nconst FETCHED_AT_HEADER = 'x-twilight-dev-fetched-at';\n\n/**\n * When the dev server fetched these settings from the API, read off the answer the\n * cache handed back; `undefined` when the cache did not handle the call (a\n * production build, the browser, a test), so nothing new reaches the settings there.\n */\nexport function devSettingsFetchedAt(headers: Headers | undefined): number | undefined {\n const at = Number(headers?.get(FETCHED_AT_HEADER));\n return Number.isFinite(at) && at > 0 ? at : undefined;\n}\n\n/**\n * Not carried over to an answer from memory: the body is stored decoded, so its\n * original encoding and length no longer describe it.\n */\nconst DROPPED_HEADERS = new Set(['content-encoding', 'content-length']);\n\ninterface Entry {\n body: string;\n status: number;\n statusText: string;\n headers: [string, string][];\n fetchedAt: number;\n /** The refresh cookie's value when this answer was fetched. */\n refresh: string | null;\n}\n\nexport interface DevSettingsCacheOptions {\n /** Whether this call may use the cache at all. */\n enabled: () => boolean;\n /** The current value of {@link DEV_SETTINGS_REFRESH_COOKIE}, or null. */\n refreshToken: () => string | null;\n now?: () => number;\n ttlMs?: number;\n /** Called the first time an answer comes from memory. */\n onFirstHit?: () => void;\n}\n\nfunction isSettingsRequest(request: Request): boolean {\n if (request.method !== 'GET') return false;\n try {\n return new URL(request.url).pathname.endsWith('/store/settings');\n } catch {\n return false;\n }\n}\n\n/**\n * An answer `requestSettings` accepts: JSON carrying `data`. A 200 without it is\n * refused there as \"Store Unavailable\"; kept here, it would be refused for the next\n * hour too, after the API had recovered.\n */\nfunction hasSettings(body: string): boolean {\n try {\n return Boolean((JSON.parse(body) as { data?: unknown } | null)?.data);\n } catch {\n return false;\n }\n}\n\n/**\n * The request as the API receives it: method, URL and every header the client's\n * hooks set. Keyed on the request itself rather than on the inputs that build it,\n * so a header added to the client later cannot be missing from the key.\n */\nfunction keyOf(request: Request): string {\n const headers = [...request.headers].map(([name, value]) => `${name}: ${value}`).join('\\n');\n return `${request.method} ${request.url}\\n${headers}`;\n}\n\n/**\n * The two ky hooks behind the cache: `lookup` runs last among `beforeRequest`, once\n * every header is set, and `store` among `afterResponse`. Only an answer with\n * settings in it is kept, so a timeout, a 429, a challenge or an empty 200 is asked\n * again on the next render.\n */\nexport function createDevSettingsCache(options: DevSettingsCacheOptions) {\n const {\n enabled,\n refreshToken,\n now = Date.now,\n ttlMs = DEV_SETTINGS_TTL_MS,\n onFirstHit,\n } = options;\n const entries = new Map<string, Entry>();\n let announced = false;\n\n const isFresh = (entry: Entry): boolean =>\n now() - entry.fetchedAt < ttlMs && entry.refresh === refreshToken();\n\n const answerOf = (entry: Entry, hit: boolean): Response => {\n const headers = new Headers(entry.headers);\n headers.set(FETCHED_AT_HEADER, String(entry.fetchedAt));\n if (hit) headers.set(HIT_HEADER, 'hit');\n return new Response(entry.body, {\n status: entry.status,\n statusText: entry.statusText,\n headers,\n });\n };\n\n const lookup: BeforeRequestHook = ({ request }) => {\n if (!enabled() || !isSettingsRequest(request)) return;\n const key = keyOf(request);\n const entry = entries.get(key);\n if (!entry) return;\n if (!isFresh(entry)) {\n entries.delete(key);\n return;\n }\n if (!announced) {\n announced = true;\n onFirstHit?.();\n }\n return answerOf(entry, true);\n };\n\n const store: AfterResponseHook = async ({ request, response }) => {\n if (!enabled() || !isSettingsRequest(request) || !response.ok) return;\n if (response.headers.has(HIT_HEADER)) return;\n // ky hands each hook a clone, so reading it leaves the answer it returns intact.\n const body = await response.text();\n if (!hasSettings(body)) return;\n for (const [key, entry] of entries) {\n if (now() - entry.fetchedAt >= ttlMs) entries.delete(key);\n }\n const entry: Entry = {\n body,\n status: response.status,\n statusText: response.statusText,\n headers: [...response.headers].filter(([name]) => !DROPPED_HEADERS.has(name)),\n fetchedAt: now(),\n refresh: refreshToken(),\n };\n entries.set(keyOf(request), entry);\n // Handed on in place of the API's own answer, so it carries its fetch time too.\n return answerOf(entry, false);\n };\n\n return { lookup, store, clear: () => entries.clear() };\n}\n\nconst readRefreshCookie = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(DEV_SETTINGS_REFRESH_COOKIE) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\nexport const devSettingsCache = createDevSettingsCache({\n // A dev server's render only. A production build has `DEV` statically false,\n // the browser keeps the settings it was handed in its query cache, and vitest\n // runs in `test` mode, where every test wants the request it mocked.\n enabled: () =>\n import.meta.env.DEV && import.meta.env.MODE !== 'test' && typeof document === 'undefined',\n refreshToken: readRefreshCookie,\n onFirstHit: () =>\n console.warn(\n `[twilight] Store settings are reused for up to ${DEV_SETTINGS_TTL_MS / 60_000} minutes while you develop, to stay under the Salla API's rate limit. To see a change you made in the dashboard, press \"Fetch fresh store data\" in the theme editor's side panel: it also says when they were last fetched.`\n ),\n});\n","import ky from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { getStoreIdentifier } from '../utils/sdk-helpers';\nimport { requestedDraftThemeName, resolveThemeVersionId } from '../utils/theme-version';\nimport { getInjectedRuntimeEnv, readEnv } from '../utils/runtime-env';\nimport { getRequestStore, getTwilightContext, isAuthTokenRevoked } from '../twilight/context';\nimport { rebaseApiUrl } from '../utils/api-base';\nimport { ENGINE_VERSION } from '../utils/engine-version';\nimport { devSettingsCache } from './dev-settings-cache';\nimport {\n AUTH_TOKEN_COOKIE_NAME,\n CURRENCY_COOKIE_NAME,\n extractCurrencyFromCookies,\n extractScopeFromCookies,\n toCurrencyCode,\n extractTokenFromCookies,\n readSdkScope,\n type ActiveScope,\n} from '../utils/cookies';\n\n// The twilight module store doesn't reliably carry authToken into every scope: on the\n// SERVER workerd has no AsyncLocalStorage, and on BOTH sides this api client can live in a\n// different module instance than the one rootBeforeLoad populates (engine subpath import vs\n// engine-internal relative import). So `getTwilightContext().authToken` is often null even\n// for logged-in users → API calls (orders/customer/…) return `token_not_provided` (400).\n// Read the token directly from the request cookie (server) or document.cookie / salla.storage\n// (client) as a fallback. The server-only import is stripped from the client bundle by\n// createIsomorphicFn.\nconst readFallbackToken = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(AUTH_TOKEN_COOKIE_NAME) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => {\n const fromCookie =\n typeof document !== 'undefined'\n ? extractTokenFromCookies(document.cookie, AUTH_TOKEN_COOKIE_NAME)\n : null;\n if (fromCookie) return fromCookie;\n const storage = typeof window !== 'undefined' ? window.salla?.storage : undefined;\n const fromStorage =\n typeof storage?.get === 'function' ? storage.get(AUTH_TOKEN_COOKIE_NAME) : null;\n if (typeof fromStorage === 'string' && fromStorage) return fromStorage;\n // `?token=` webview injection lands only on the SDK's axios instance\n const fromSdkApi = typeof window !== 'undefined' ? window.salla?.api?.token : undefined;\n return typeof fromSdkApi === 'string' && fromSdkApi ? fromSdkApi : null;\n });\n\n/**\n * The auth token as the api client sees it: twilight context first, cookie/storage fallback.\n * Use this (not `getTwilightContext().authToken`, which is often null for logged-in users —\n * see the note above) to decide whether an authenticated-only query should run.\n */\nexport const getAuthToken = (): string | null =>\n isAuthTokenRevoked() ? null : (getTwilightContext().authToken ?? readFallbackToken());\n\nconst readRequestCurrency = createIsomorphicFn()\n .server((): string | null => {\n try {\n return toCurrencyCode(getCookie(CURRENCY_COOKIE_NAME));\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\n/**\n * The currency the visitor chose, from the `s-curr` cookie the SDK writes: the API\n * answers in the store's own currency unless the request names one.\n */\nexport function getActiveCurrency(): string | null;\nexport function getActiveCurrency(fallback: string): string;\nexport function getActiveCurrency(fallback: string | null = null): string | null {\n const chosen =\n typeof document !== 'undefined'\n ? extractCurrencyFromCookies(document.cookie)\n : readRequestCurrency();\n return chosen ?? fallback;\n}\n\nconst API_HEADERS = {\n ACCEPT: 'accept',\n ACCEPT_LANGUAGE: 'accept-language',\n APP_OS: 's-app-os',\n APP_VERSION: 's-app-version',\n RAY: 's-ray',\n SOURCE: 's-source',\n THEME_TYPE: 's-theme-type',\n REQUESTED_WITH: 'x-requested-with',\n CF_PROXY_WHITELIST: 's-cf-proxy-whitelist-id',\n STORE_IDENTIFIER: 'store-identifier',\n CURRENCY: 'currency',\n AUTHORIZATION: 'Authorization',\n VERSION_ID: 's-version-id',\n THEME_NAME: 's-theme-name',\n SCOPE_ID: 's-scope-id',\n SCOPE_TYPE: 's-scope-type',\n SCOPE_ALLOCATION_TYPE: 's-scope-allocation-type',\n SCOPE_ALLOCATION_ID: 's-scope-allocation-id',\n USER_AGENT: 'user-agent',\n} as const;\n\n/**\n * The header every Salla API call is answered by store.\n *\n * Exported because a caller that already knows which store it is asking about\n * must be able to say so on the request itself — see `store.settings`. Without\n * it the only way to name a store is the ambient resolver, and \"the identifier\n * I checked\" and \"the identifier that was sent\" become two different things.\n */\nexport const STORE_IDENTIFIER_HEADER = API_HEADERS.STORE_IDENTIFIER;\n\n/**\n * Active scope: the market plus its branch allocation, as the SDK stores it. On the\n * client it comes from `salla.storage.get('scope')`; before the SDK hydrates storage\n * it falls back to the `scope` cookie the theme mirrors that selection into (see\n * writeScopeCookie), then to the scope twilightMiddleware seeded from the same\n * cookie on the server. Requests vary by the `s-scope-*` headers, so React Query\n * keys must include this to avoid serving another branch's cached categories/products.\n *\n * The cookie step matters for hydration: the SDK is not guaranteed to have\n * populated `salla.storage` by the time the client rebuilds a dehydrated query\n * key, and without it the client would compute null against a scoped SSR key.\n */\nexport const getActiveScope = (): ActiveScope | null => {\n // `!== undefined`, not `!= null`: a null here is the SDK authoritatively saying \"no branch\n // selected\", which must beat a cookie left over from the previous selection. Only a\n // not-yet-ready storage API (undefined) falls through to the cookie.\n const fromStorage = readSdkScope();\n if (fromStorage !== undefined) return fromStorage;\n\n if (typeof document !== 'undefined') {\n const fromCookie = extractScopeFromCookies(document.cookie);\n if (fromCookie != null) return fromCookie;\n }\n\n try {\n return getTwilightContext().scope;\n } catch {\n return null;\n }\n};\n\n/** {@link getActiveScope} reduced to the market id. */\nexport const getActiveScopeId = (): string | null => getActiveScope()?.id ?? null;\n\n// The S-Ray (plan score) each store's settings named. Cloudflare routes api.salla.dev by it\n// (100 = VIP cluster, where VIP shoppers' address allocations are cached), so the fixed '50'\n// sent a VIP store's server render to the other cluster. Only the first render of a store in\n// an isolate, the settings call that names it, still goes with the default.\n// ponytail: one entry per store this isolate rendered, unbounded; isolates are short-lived.\nconst storeRays = new Map<string, string>();\n\nfunction rayOf(headers: Record<string, unknown> | undefined): string | null {\n const ray = Object.entries(headers ?? {}).find(([name]) => name.toLowerCase() === 's-ray')?.[1];\n // A plan score (the API sends a number) or nothing: any other value is not a routing input.\n const score = typeof ray === 'number' || typeof ray === 'string' ? String(ray) : '';\n return /^\\d{1,3}$/.test(score) ? score : null;\n}\n\n/** Keeps the S-Ray a store's settings named, for that store's next calls in this isolate. */\nexport function rememberStoreRay(identifier: string, headers: Record<string, unknown> | undefined) {\n const ray = rayOf(headers);\n if (ray) storeRays.set(identifier, ray);\n else storeRays.delete(identifier);\n}\n\nfunction resolveStoreRay(identifier: string | null): string | null {\n const learned = identifier ? storeRays.get(identifier) : undefined;\n if (learned) return learned;\n // The browser never makes the settings call: it reads the score off the settings SSR sent,\n // which are the ambient store's, so never for a call that names another store.\n try {\n if (identifier && identifier !== getStoreIdentifier()) return null;\n return rayOf(getTwilightContext().settings?.headers);\n } catch {\n return null;\n }\n}\n\n// No `s-store-api-version`: a Cloudflare rule on api.salla.dev adds it to the paths the\n// Swoole pool serves. Sent from here, it put every call there, `cart/{id}` among them.\nconst sharedHeaders = (locale: string) => ({\n [API_HEADERS.ACCEPT]: 'application/json' as const,\n [API_HEADERS.ACCEPT_LANGUAGE]: locale,\n [API_HEADERS.APP_OS]: 'browser',\n [API_HEADERS.APP_VERSION]: '2.14.363',\n [API_HEADERS.RAY]: '50',\n [API_HEADERS.SOURCE]: 'twilight',\n [API_HEADERS.THEME_TYPE]: 'react',\n [API_HEADERS.REQUESTED_WITH]: 'XMLHttpRequest',\n [API_HEADERS.CF_PROXY_WHITELIST]: '019a2f78-a64c-7edb-proxy-whitelist-id-9a3a-17afda90f03a',\n});\n\n/**\n * Who a server-rendered call says it is.\n *\n * Every theme worker reaches api.salla.dev from Cloudflare's one Workers address, so\n * salla.dev's per-IP rate limits counted every React store as a single client and\n * refused the calls each page makes (`store/settings` among them: \"Store Unavailable\").\n * The zone skips rate limiting for a User-Agent shaped `Salla-<Name>/<N.N.N> (<env>; <meta>)`\n * from Cloudflare's or AWS's networks, the convention Salla's other services already send.\n *\n * Built from fixed parts: the zone's pattern takes only digits and dots for the version,\n * so a prerelease suffix is dropped, and an unbundled engine (`dev`) reads as `0.0.0`.\n */\nconst SERVER_USER_AGENT = `Salla-TwilightReact/${\n /^\\d+(?:\\.\\d+)*/.exec(ENGINE_VERSION)?.[0] ?? '0.0.0'\n} (${import.meta.env.DEV ? 'development' : 'production'}; ssr)`;\n\n/**\n * Store API base. `VITE_API_URL` override points a preview at a branch backend; unset → prod\n * `api.salla.dev`. Resolution order matters: the value the SSR worker resolved (published into\n * the head, since worker `vars` are server-only `process.env` and never reach the browser\n * bundle) wins, so the hydrated client keeps talking to the backend that rendered the page.\n */\n\nconst STORE_API_BASE =\n getInjectedRuntimeEnv().apiBase || readEnv('VITE_API_URL') || 'https://api.salla.dev/store/v1';\n\n/**\n * Moves a call onto the API base this request was told to use, when it has one.\n *\n * `STORE_API_BASE` is read once per isolate, and one theme worker serves every\n * storefront the dispatcher sends it: production, and the beta and PR preview\n * storefronts (`web[-<hash>].beta.salla.group`), whose Store API is on their own\n * host (`x-salla-api-base`, see `utils/api-base.ts`). So SSR rebases each call per\n * request. In the browser the request store is empty and `STORE_API_BASE` is\n * already the published per-page value, so this does nothing there.\n *\n * After every hook that sets a header, so the request it copies carries them all.\n * It runs only where the dispatcher named a base (beta), and the dev settings cache\n * after it only in a dev build, which never gets that header.\n */\nfunction toRequestApiBase({ request }: { request: Request }): Request | undefined {\n const { apiBase } = getRequestStore();\n if (!apiBase || apiBase === STORE_API_BASE) return undefined;\n const url = rebaseApiUrl(request.url, STORE_API_BASE, apiBase);\n return url ? new Request(url, request) : undefined;\n}\n\nexport const api = ky.extend({\n prefix: STORE_API_BASE,\n timeout: 8000,\n hooks: {\n beforeRequest: [\n ({ request }) => {\n const { locale } = getTwilightContext();\n const headers = sharedHeaders(locale);\n for (const [key, value] of Object.entries(headers)) {\n request.headers.set(key, value);\n }\n // Only when the caller did not say. `headers.set` here would otherwise\n // overwrite a per-request identifier with the ambient one, which is a\n // silent way to answer a question about one store with another's data.\n if (!request.headers.get(API_HEADERS.STORE_IDENTIFIER)) {\n request.headers.set(API_HEADERS.STORE_IDENTIFIER, getStoreIdentifier());\n }\n\n const ray = resolveStoreRay(request.headers.get(API_HEADERS.STORE_IDENTIFIER));\n if (ray) request.headers.set(API_HEADERS.RAY, ray);\n\n // Server only. A browser call comes from the shopper's own address and is\n // counted against it, which is what the zone's limits are for.\n if (typeof document === 'undefined') {\n request.headers.set(API_HEADERS.USER_AGENT, SERVER_USER_AGENT);\n }\n\n const scope = getActiveScope();\n\n // The version the request asked for, else the one the settings named for\n // this scope. Absent means \"whatever is live\", which is what an ordinary\n // storefront visit wants — so a null is left off rather than sent empty.\n const versionId = resolveThemeVersionId(scope?.id ?? null);\n if (versionId) {\n request.headers.set(API_HEADERS.VERSION_ID, versionId);\n }\n\n // The draft theme a preview renders, by the name the Store knows drafts\n // by. Without it the Store answers the draft's version as the store's own\n // theme, and checks the draft's components against that one. Absent on\n // every other call, so an ordinary storefront request is unchanged.\n const draftThemeName = requestedDraftThemeName();\n if (draftThemeName) {\n request.headers.set(API_HEADERS.THEME_NAME, draftThemeName);\n }\n\n const currency = getActiveCurrency();\n if (currency) request.headers.set(API_HEADERS.CURRENCY, currency);\n\n const token = getAuthToken();\n if (token) {\n request.headers.set(API_HEADERS.AUTHORIZATION, `Bearer ${token}`);\n }\n\n // The same four the SDK's own client sends. The API resolves stock per\n // allocation: id alone asks about the market, not the branch the shopper chose.\n if (scope) {\n request.headers.set(API_HEADERS.SCOPE_ID, scope.id);\n if (scope.type) request.headers.set(API_HEADERS.SCOPE_TYPE, scope.type);\n if (scope.allocation_type)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_TYPE, scope.allocation_type);\n if (scope.allocation_id)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_ID, scope.allocation_id);\n }\n },\n toRequestApiBase,\n // Last, so it keys on the request with every header above set.\n devSettingsCache.lookup,\n ],\n afterResponse: [devSettingsCache.store],\n },\n});\n\nexport const cdn = ky.extend({\n prefix: 'https://cdn.salla.network',\n timeout: 5000,\n});\n\n/**\n * The merchant uploader's public bucket, `admin-uploader-prod`.\n *\n * A different host from {@link cdn} and a different thing behind it: this one\n * is an R2 custom domain, so a read never passes through a worker. Storefront\n * translations live here, per language, under `translations/` — see\n * `api/translations.ts`.\n */\nexport const filesCdn = ky.extend({\n prefix: 'https://cdn.files.salla.network',\n timeout: 5000,\n});\n"]}
1
+ {"version":3,"sources":["../src/utils/api-base.ts","../src/utils/engine-version.ts","../src/api/dev-settings-cache.ts","../src/api/client.ts"],"names":["entry","createIsomorphicFn","getCookie"],"mappings":";;;;;;;;;AAWO,IAAM,eAAA,GAAkB;AAG/B,IAAM,aAAA,GAAgB,SAAA;AAQf,SAAS,qBAAA,CACd,QACA,WAAA,EACe;AACf,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,WAAA,EAAa,OAAO,IAAA;AACpC,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,IAAA,EAAM,CAAA;AAAA,EAC7B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,IAAI,GAAA,CAAI,QAAA,KAAa,QAAA,EAAU,OAAO,IAAA;AACtC,EAAA,IAAI,IAAI,IAAA,CAAK,WAAA,OAAkB,WAAA,CAAY,WAAA,IAAe,OAAO,IAAA;AACjE,EAAA,IAAI,GAAA,CAAI,YAAY,GAAA,CAAI,QAAA,IAAY,IAAI,MAAA,IAAU,GAAA,CAAI,MAAM,OAAO,IAAA;AACnE,EAAA,IAAI,IAAI,QAAA,CAAS,OAAA,CAAQ,QAAQ,EAAE,CAAA,KAAM,eAAe,OAAO,IAAA;AAC/D,EAAA,O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,OAAA,EAAS;AACX,CAAC;AAUM,IAAM,QAAA,GAAW,GAAG,MAAA,CAAO;AAAA,EAChC,MAAA,EAAQ,iCAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAC","file":"chunk-ID2UT4AE.js","sourcesContent":["/**\n * The header the storefront dispatcher names the Store API base in, on the\n * storefronts that must not call production: the beta storefront and its per-PR\n * previews (`web.beta.salla.group`, `web-<hash>.beta.salla.group`). There the\n * Store serves the storefront API under its own address, `https://<host>/api/v1`.\n *\n * Trusted for the same reason `x-salla-store-base` is: the dispatcher sets it\n * after dropping everything off its allowlist, so a visitor's copy never arrives.\n * It is still checked against the request's own host, so even a forged one could\n * only point the theme back at the storefront it is already serving.\n */\nexport const API_BASE_HEADER = 'x-salla-api-base';\n\n/** The one path the dispatcher names: the Store's storefront API under its own host. */\nconst API_BASE_PATH = '/api/v1';\n\n/**\n * The API base this request was told to use, or null for the build's default.\n *\n * Accepted only as `https://<the request's own host>/api/v1` (a trailing slash\n * allowed), with no credentials, query or fragment; returned without the slash.\n */\nexport function resolveRequestApiBase(\n header: string | null | undefined,\n requestHost: string | null\n): string | null {\n if (!header || !requestHost) return null;\n let url: URL;\n try {\n url = new URL(header.trim());\n } catch {\n return null;\n }\n if (url.protocol !== 'https:') return null;\n if (url.host.toLowerCase() !== requestHost.toLowerCase()) return null;\n if (url.username || url.password || url.search || url.hash) return null;\n if (url.pathname.replace(/\\/+$/, '') !== API_BASE_PATH) return null;\n return `${url.origin}${API_BASE_PATH}`;\n}\n\n/**\n * `url` moved from one API base to another: `https://api.salla.dev/store/v1/cart/1`\n * under `https://web.beta.salla.group/api/v1` is `https://web.beta.salla.group/api/v1/cart/1`.\n * Null when `url` is not under `from`, which leaves the request as it was.\n */\nexport function rebaseApiUrl(url: string, from: string, to: string): string | null {\n const base = from.replace(/\\/+$/, '');\n if (url !== base && !url.startsWith(`${base}/`) && !url.startsWith(`${base}?`)) return null;\n return to.replace(/\\/+$/, '') + url.slice(base.length);\n}\n","/**\n * The engine's own build version, injected by tsup `define` when dist is\n * built. Falls back to 'dev' when the source runs unbundled (vitest, direct\n * src imports in the monorepo).\n *\n * Exposed at runtime as `salla.versions.engine` by `useTwilightInit` so a\n * storefront can always be asked which engine build rendered it.\n */\nexport const ENGINE_VERSION: string =\n typeof __TWILIGHT_ENGINE_VERSION__ !== 'undefined' ? __TWILIGHT_ENGINE_VERSION__ : 'dev';\n","import type { AfterResponseHook, BeforeRequestHook } from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { DEV_SETTINGS_REFRESH_COOKIE } from '../utils/dev-settings-refresh';\n\n/**\n * A dev server reuses a store's settings for up to an hour.\n *\n * Every server render asks the API for `store/settings`, and a developer clicking\n * around a theme renders dozens of pages a minute. The API answers a burst of\n * settings requests for one store from one address with a challenge, which a\n * server-side fetch cannot pass, so the dev server rendered \"Store Unavailable\"\n * (6.05k challenged `(development; ssr)` calls in the 7 days to 2026-10-25). In\n * development, on the server, the same request within {@link DEV_SETTINGS_TTL_MS}\n * is answered from memory instead. An hour because the API counts settings\n * requests per hour, so one fetch an hour can never reach its limit; the theme\n * editor's \"Fetch fresh store data\" fetches sooner, and says how old the settings\n * are. A production build never runs it: `import.meta.env.DEV` is statically\n * false there.\n */\nexport const DEV_SETTINGS_TTL_MS = 60 * 60_000;\n\n/** Marks an answer from memory, so the store step does not file it again. */\nconst HIT_HEADER = 'x-twilight-dev-cache';\n\n/** When the answer was really fetched from the API (epoch ms), on fresh answers and reused ones alike. */\nconst FETCHED_AT_HEADER = 'x-twilight-dev-fetched-at';\n\n/**\n * When the dev server fetched these settings from the API, read off the answer the\n * cache handed back; `undefined` when the cache did not handle the call (a\n * production build, the browser, a test), so nothing new reaches the settings there.\n */\nexport function devSettingsFetchedAt(headers: Headers | undefined): number | undefined {\n const at = Number(headers?.get(FETCHED_AT_HEADER));\n return Number.isFinite(at) && at > 0 ? at : undefined;\n}\n\n/**\n * Not carried over to an answer from memory: the body is stored decoded, so its\n * original encoding and length no longer describe it.\n */\nconst DROPPED_HEADERS = new Set(['content-encoding', 'content-length']);\n\ninterface Entry {\n body: string;\n status: number;\n statusText: string;\n headers: [string, string][];\n fetchedAt: number;\n /** The refresh cookie's value when this answer was fetched. */\n refresh: string | null;\n}\n\nexport interface DevSettingsCacheOptions {\n /** Whether this call may use the cache at all. */\n enabled: () => boolean;\n /** The current value of {@link DEV_SETTINGS_REFRESH_COOKIE}, or null. */\n refreshToken: () => string | null;\n now?: () => number;\n ttlMs?: number;\n /** Called the first time an answer comes from memory. */\n onFirstHit?: () => void;\n}\n\nfunction isSettingsRequest(request: Request): boolean {\n if (request.method !== 'GET') return false;\n try {\n return new URL(request.url).pathname.endsWith('/store/settings');\n } catch {\n return false;\n }\n}\n\n/**\n * An answer `requestSettings` accepts: JSON carrying `data`. A 200 without it is\n * refused there as \"Store Unavailable\"; kept here, it would be refused for the next\n * hour too, after the API had recovered.\n */\nfunction hasSettings(body: string): boolean {\n try {\n return Boolean((JSON.parse(body) as { data?: unknown } | null)?.data);\n } catch {\n return false;\n }\n}\n\n/**\n * The request as the API receives it: method, URL and every header the client's\n * hooks set. Keyed on the request itself rather than on the inputs that build it,\n * so a header added to the client later cannot be missing from the key.\n */\nfunction keyOf(request: Request): string {\n const headers = [...request.headers].map(([name, value]) => `${name}: ${value}`).join('\\n');\n return `${request.method} ${request.url}\\n${headers}`;\n}\n\n/**\n * The two ky hooks behind the cache: `lookup` runs last among `beforeRequest`, once\n * every header is set, and `store` among `afterResponse`. Only an answer with\n * settings in it is kept, so a timeout, a 429, a challenge or an empty 200 is asked\n * again on the next render.\n */\nexport function createDevSettingsCache(options: DevSettingsCacheOptions) {\n const {\n enabled,\n refreshToken,\n now = Date.now,\n ttlMs = DEV_SETTINGS_TTL_MS,\n onFirstHit,\n } = options;\n const entries = new Map<string, Entry>();\n let announced = false;\n\n const isFresh = (entry: Entry): boolean =>\n now() - entry.fetchedAt < ttlMs && entry.refresh === refreshToken();\n\n const answerOf = (entry: Entry, hit: boolean): Response => {\n const headers = new Headers(entry.headers);\n headers.set(FETCHED_AT_HEADER, String(entry.fetchedAt));\n if (hit) headers.set(HIT_HEADER, 'hit');\n return new Response(entry.body, {\n status: entry.status,\n statusText: entry.statusText,\n headers,\n });\n };\n\n const lookup: BeforeRequestHook = ({ request }) => {\n if (!enabled() || !isSettingsRequest(request)) return;\n const key = keyOf(request);\n const entry = entries.get(key);\n if (!entry) return;\n if (!isFresh(entry)) {\n entries.delete(key);\n return;\n }\n if (!announced) {\n announced = true;\n onFirstHit?.();\n }\n return answerOf(entry, true);\n };\n\n const store: AfterResponseHook = async ({ request, response }) => {\n if (!enabled() || !isSettingsRequest(request) || !response.ok) return;\n if (response.headers.has(HIT_HEADER)) return;\n // ky hands each hook a clone, so reading it leaves the answer it returns intact.\n const body = await response.text();\n if (!hasSettings(body)) return;\n for (const [key, entry] of entries) {\n if (now() - entry.fetchedAt >= ttlMs) entries.delete(key);\n }\n const entry: Entry = {\n body,\n status: response.status,\n statusText: response.statusText,\n headers: [...response.headers].filter(([name]) => !DROPPED_HEADERS.has(name)),\n fetchedAt: now(),\n refresh: refreshToken(),\n };\n entries.set(keyOf(request), entry);\n // Handed on in place of the API's own answer, so it carries its fetch time too.\n return answerOf(entry, false);\n };\n\n return { lookup, store, clear: () => entries.clear() };\n}\n\nconst readRefreshCookie = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(DEV_SETTINGS_REFRESH_COOKIE) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\nexport const devSettingsCache = createDevSettingsCache({\n // A dev server's render only. A production build has `DEV` statically false,\n // the browser keeps the settings it was handed in its query cache, and vitest\n // runs in `test` mode, where every test wants the request it mocked.\n enabled: () =>\n import.meta.env.DEV && import.meta.env.MODE !== 'test' && typeof document === 'undefined',\n refreshToken: readRefreshCookie,\n onFirstHit: () =>\n console.warn(\n `[twilight] Store settings are reused for up to ${DEV_SETTINGS_TTL_MS / 60_000} minutes while you develop, to stay under the Salla API's rate limit. To see a change you made in the dashboard, press \"Fetch fresh store data\" in the theme editor's side panel: it also says when they were last fetched.`\n ),\n});\n","import ky from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { getStoreIdentifier } from '../utils/sdk-helpers';\nimport { requestedDraftThemeName, resolveThemeVersionId } from '../utils/theme-version';\nimport { getInjectedRuntimeEnv, readEnv } from '../utils/runtime-env';\nimport { getRequestStore, getTwilightContext, isAuthTokenRevoked } from '../twilight/context';\nimport { rebaseApiUrl } from '../utils/api-base';\nimport { ENGINE_VERSION } from '../utils/engine-version';\nimport { devSettingsCache } from './dev-settings-cache';\nimport {\n AUTH_TOKEN_COOKIE_NAME,\n CURRENCY_COOKIE_NAME,\n extractCurrencyFromCookies,\n extractScopeFromCookies,\n toCurrencyCode,\n extractTokenFromCookies,\n readSdkScope,\n type ActiveScope,\n} from '../utils/cookies';\n\n// The twilight module store doesn't reliably carry authToken into every scope: on the\n// SERVER workerd has no AsyncLocalStorage, and on BOTH sides this api client can live in a\n// different module instance than the one rootBeforeLoad populates (engine subpath import vs\n// engine-internal relative import). So `getTwilightContext().authToken` is often null even\n// for logged-in users → API calls (orders/customer/…) return `token_not_provided` (400).\n// Read the token directly from the request cookie (server) or document.cookie / salla.storage\n// (client) as a fallback. The server-only import is stripped from the client bundle by\n// createIsomorphicFn.\nconst readFallbackToken = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(AUTH_TOKEN_COOKIE_NAME) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => {\n const fromCookie =\n typeof document !== 'undefined'\n ? extractTokenFromCookies(document.cookie, AUTH_TOKEN_COOKIE_NAME)\n : null;\n if (fromCookie) return fromCookie;\n const storage = typeof window !== 'undefined' ? window.salla?.storage : undefined;\n const fromStorage =\n typeof storage?.get === 'function' ? storage.get(AUTH_TOKEN_COOKIE_NAME) : null;\n if (typeof fromStorage === 'string' && fromStorage) return fromStorage;\n // `?token=` webview injection lands only on the SDK's axios instance\n const fromSdkApi = typeof window !== 'undefined' ? window.salla?.api?.token : undefined;\n return typeof fromSdkApi === 'string' && fromSdkApi ? fromSdkApi : null;\n });\n\n/**\n * The auth token as the api client sees it: twilight context first, cookie/storage fallback.\n * Use this (not `getTwilightContext().authToken`, which is often null for logged-in users —\n * see the note above) to decide whether an authenticated-only query should run.\n */\nexport const getAuthToken = (): string | null =>\n isAuthTokenRevoked() ? null : (getTwilightContext().authToken ?? readFallbackToken());\n\nconst readRequestCurrency = createIsomorphicFn()\n .server((): string | null => {\n try {\n return toCurrencyCode(getCookie(CURRENCY_COOKIE_NAME));\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\n/**\n * The currency the visitor chose, from the `s-curr` cookie the SDK writes: the API\n * answers in the store's own currency unless the request names one.\n */\nexport function getActiveCurrency(): string | null;\nexport function getActiveCurrency(fallback: string): string;\nexport function getActiveCurrency(fallback: string | null = null): string | null {\n const chosen =\n typeof document !== 'undefined'\n ? extractCurrencyFromCookies(document.cookie)\n : readRequestCurrency();\n return chosen ?? fallback;\n}\n\nconst API_HEADERS = {\n ACCEPT: 'accept',\n ACCEPT_LANGUAGE: 'accept-language',\n APP_OS: 's-app-os',\n APP_VERSION: 's-app-version',\n RAY: 's-ray',\n SOURCE: 's-source',\n THEME_TYPE: 's-theme-type',\n REQUESTED_WITH: 'x-requested-with',\n CF_PROXY_WHITELIST: 's-cf-proxy-whitelist-id',\n STORE_IDENTIFIER: 'store-identifier',\n CURRENCY: 'currency',\n AUTHORIZATION: 'Authorization',\n VERSION_ID: 's-version-id',\n THEME_NAME: 's-theme-name',\n SCOPE_ID: 's-scope-id',\n SCOPE_TYPE: 's-scope-type',\n SCOPE_ALLOCATION_TYPE: 's-scope-allocation-type',\n SCOPE_ALLOCATION_ID: 's-scope-allocation-id',\n USER_AGENT: 'user-agent',\n} as const;\n\n/**\n * The header every Salla API call is answered by store.\n *\n * Exported because a caller that already knows which store it is asking about\n * must be able to say so on the request itself — see `store.settings`. Without\n * it the only way to name a store is the ambient resolver, and \"the identifier\n * I checked\" and \"the identifier that was sent\" become two different things.\n */\nexport const STORE_IDENTIFIER_HEADER = API_HEADERS.STORE_IDENTIFIER;\n\n/**\n * Active scope: the market plus its branch allocation, as the SDK stores it. On the\n * client it comes from `salla.storage.get('scope')`; before the SDK hydrates storage\n * it falls back to the `scope` cookie the theme mirrors that selection into (see\n * writeScopeCookie), then to the scope twilightMiddleware seeded from the same\n * cookie on the server. Requests vary by the `s-scope-*` headers, so React Query\n * keys must include this to avoid serving another branch's cached categories/products.\n *\n * The cookie step matters for hydration: the SDK is not guaranteed to have\n * populated `salla.storage` by the time the client rebuilds a dehydrated query\n * key, and without it the client would compute null against a scoped SSR key.\n */\nexport const getActiveScope = (): ActiveScope | null => {\n // `!== undefined`, not `!= null`: a null here is the SDK authoritatively saying \"no branch\n // selected\", which must beat a cookie left over from the previous selection. Only a\n // not-yet-ready storage API (undefined) falls through to the cookie.\n const fromStorage = readSdkScope();\n if (fromStorage !== undefined) return fromStorage;\n\n if (typeof document !== 'undefined') {\n const fromCookie = extractScopeFromCookies(document.cookie);\n if (fromCookie != null) return fromCookie;\n }\n\n try {\n return getTwilightContext().scope;\n } catch {\n return null;\n }\n};\n\n/** {@link getActiveScope} reduced to the market id. */\nexport const getActiveScopeId = (): string | null => getActiveScope()?.id ?? null;\n\n// The S-Ray (plan score) each store's settings named. Cloudflare routes api.salla.dev by it\n// (100 = VIP cluster, where VIP shoppers' address allocations are cached), so the fixed '50'\n// sent a VIP store's server render to the other cluster. Only the first render of a store in\n// an isolate, the settings call that names it, still goes with the default.\n// ponytail: one entry per store this isolate rendered, unbounded; isolates are short-lived.\nconst storeRays = new Map<string, string>();\n\nfunction rayOf(headers: Record<string, unknown> | undefined): string | null {\n const ray = Object.entries(headers ?? {}).find(([name]) => name.toLowerCase() === 's-ray')?.[1];\n // A plan score (the API sends a number) or nothing: any other value is not a routing input.\n const score = typeof ray === 'number' || typeof ray === 'string' ? String(ray) : '';\n return /^\\d{1,3}$/.test(score) ? score : null;\n}\n\n/** Keeps the S-Ray a store's settings named, for that store's next calls in this isolate. */\nexport function rememberStoreRay(identifier: string, headers: Record<string, unknown> | undefined) {\n const ray = rayOf(headers);\n if (ray) storeRays.set(identifier, ray);\n else storeRays.delete(identifier);\n}\n\nfunction resolveStoreRay(identifier: string | null): string | null {\n const learned = identifier ? storeRays.get(identifier) : undefined;\n if (learned) return learned;\n // The browser never makes the settings call: it reads the score off the settings SSR sent,\n // which are the ambient store's, so never for a call that names another store.\n try {\n if (identifier && identifier !== getStoreIdentifier()) return null;\n return rayOf(getTwilightContext().settings?.headers);\n } catch {\n return null;\n }\n}\n\n// No `s-store-api-version`: a Cloudflare rule on api.salla.dev adds it to the paths the\n// Swoole pool serves. Sent from here, it put every call there, `cart/{id}` among them.\nconst sharedHeaders = (locale: string) => ({\n [API_HEADERS.ACCEPT]: 'application/json' as const,\n [API_HEADERS.ACCEPT_LANGUAGE]: locale,\n [API_HEADERS.APP_OS]: 'browser',\n [API_HEADERS.APP_VERSION]: '2.14.363',\n [API_HEADERS.RAY]: '50',\n [API_HEADERS.SOURCE]: 'twilight',\n [API_HEADERS.THEME_TYPE]: 'react',\n [API_HEADERS.REQUESTED_WITH]: 'XMLHttpRequest',\n [API_HEADERS.CF_PROXY_WHITELIST]: '019a2f78-a64c-7edb-proxy-whitelist-id-9a3a-17afda90f03a',\n});\n\n/**\n * Who a server-rendered call says it is.\n *\n * Every theme worker reaches api.salla.dev from Cloudflare's one Workers address, so\n * salla.dev's per-IP rate limits counted every React store as a single client and\n * refused the calls each page makes (`store/settings` among them: \"Store Unavailable\").\n * The zone skips rate limiting for a User-Agent shaped `Salla-<Name>/<N.N.N> (<env>; <meta>)`\n * from Cloudflare's or AWS's networks, the convention Salla's other services already send.\n *\n * Built from fixed parts: the zone's pattern takes only digits and dots for the version,\n * so a prerelease suffix is dropped, and an unbundled engine (`dev`) reads as `0.0.0`.\n */\nconst SERVER_USER_AGENT = `Salla-TwilightReact/${\n /^\\d+(?:\\.\\d+)*/.exec(ENGINE_VERSION)?.[0] ?? '0.0.0'\n} (${import.meta.env.DEV ? 'development' : 'production'}; ssr)`;\n\n/**\n * Store API base. `VITE_API_URL` override points a preview at a branch backend; unset → prod\n * `api.salla.dev`. Resolution order matters: the value the SSR worker resolved (published into\n * the head, since worker `vars` are server-only `process.env` and never reach the browser\n * bundle) wins, so the hydrated client keeps talking to the backend that rendered the page.\n */\n\nconst STORE_API_BASE =\n getInjectedRuntimeEnv().apiBase || readEnv('VITE_API_URL') || 'https://api.salla.dev/store/v1';\n\n/**\n * Moves a call onto the API base this request was told to use, when it has one.\n *\n * `STORE_API_BASE` is read once per isolate, and one theme worker serves every\n * storefront the dispatcher sends it: production, and the beta and PR preview\n * storefronts (`web[-<hash>].beta.salla.group`), whose Store API is on their own\n * host (`x-salla-api-base`, see `utils/api-base.ts`). So SSR rebases each call per\n * request. In the browser the request store is empty and `STORE_API_BASE` is\n * already the published per-page value, so this does nothing there.\n *\n * After every hook that sets a header, so the request it copies carries them all.\n * It runs only where the dispatcher named a base (beta), and the dev settings cache\n * after it only in a dev build, which never gets that header.\n */\nfunction toRequestApiBase({ request }: { request: Request }): Request | undefined {\n const { apiBase } = getRequestStore();\n if (!apiBase || apiBase === STORE_API_BASE) return undefined;\n const url = rebaseApiUrl(request.url, STORE_API_BASE, apiBase);\n return url ? new Request(url, request) : undefined;\n}\n\nexport const api = ky.extend({\n prefix: STORE_API_BASE,\n timeout: 8000,\n hooks: {\n beforeRequest: [\n ({ request }) => {\n const { locale } = getTwilightContext();\n const headers = sharedHeaders(locale);\n for (const [key, value] of Object.entries(headers)) {\n request.headers.set(key, value);\n }\n // Only when the caller did not say. `headers.set` here would otherwise\n // overwrite a per-request identifier with the ambient one, which is a\n // silent way to answer a question about one store with another's data.\n if (!request.headers.get(API_HEADERS.STORE_IDENTIFIER)) {\n request.headers.set(API_HEADERS.STORE_IDENTIFIER, getStoreIdentifier());\n }\n\n const ray = resolveStoreRay(request.headers.get(API_HEADERS.STORE_IDENTIFIER));\n if (ray) request.headers.set(API_HEADERS.RAY, ray);\n\n // Server only. A browser call comes from the shopper's own address and is\n // counted against it, which is what the zone's limits are for.\n if (typeof document === 'undefined') {\n request.headers.set(API_HEADERS.USER_AGENT, SERVER_USER_AGENT);\n }\n\n const scope = getActiveScope();\n\n // The version the request asked for, else the one the settings named for\n // this scope. Absent means \"whatever is live\", which is what an ordinary\n // storefront visit wants — so a null is left off rather than sent empty.\n const versionId = resolveThemeVersionId(scope?.id ?? null);\n if (versionId) {\n request.headers.set(API_HEADERS.VERSION_ID, versionId);\n }\n\n // The draft theme a preview renders, by the name the Store knows drafts\n // by. Without it the Store answers the draft's version as the store's own\n // theme, and checks the draft's components against that one. Absent on\n // every other call, so an ordinary storefront request is unchanged.\n const draftThemeName = requestedDraftThemeName();\n if (draftThemeName) {\n request.headers.set(API_HEADERS.THEME_NAME, draftThemeName);\n }\n\n const currency = getActiveCurrency();\n if (currency) request.headers.set(API_HEADERS.CURRENCY, currency);\n\n const token = getAuthToken();\n if (token) {\n request.headers.set(API_HEADERS.AUTHORIZATION, `Bearer ${token}`);\n }\n\n // The same four the SDK's own client sends. The API resolves stock per\n // allocation: id alone asks about the market, not the branch the shopper chose.\n if (scope) {\n request.headers.set(API_HEADERS.SCOPE_ID, scope.id);\n if (scope.type) request.headers.set(API_HEADERS.SCOPE_TYPE, scope.type);\n if (scope.allocation_type)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_TYPE, scope.allocation_type);\n if (scope.allocation_id)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_ID, scope.allocation_id);\n }\n },\n toRequestApiBase,\n // Last, so it keys on the request with every header above set.\n devSettingsCache.lookup,\n ],\n afterResponse: [devSettingsCache.store],\n },\n});\n\nexport const cdn = ky.extend({\n prefix: 'https://cdn.salla.network',\n timeout: 5000,\n});\n\n/**\n * The merchant uploader's public bucket, `admin-uploader-prod`.\n *\n * A different host from {@link cdn} and a different thing behind it: this one\n * is an R2 custom domain, so a read never passes through a worker. Storefront\n * translations live here, per language, under `translations/` — see\n * `api/translations.ts`.\n */\nexport const filesCdn = ky.extend({\n prefix: 'https://cdn.files.salla.network',\n timeout: 5000,\n});\n"]}
@@ -1,5 +1,5 @@
1
- import { orThrow } from './chunk-MAQQHQJX.js';
2
- import { api } from './chunk-XQEWBUQ2.js';
1
+ import { orThrow } from './chunk-FU2LJG5L.js';
2
+ import { api } from './chunk-ID2UT4AE.js';
3
3
  import { getSallaSDK } from './chunk-MZPX4EPS.js';
4
4
  import { queryOptions } from '@tanstack/react-query';
5
5
 
@@ -100,5 +100,5 @@ var cart = {
100
100
  };
101
101
 
102
102
  export { cart, replaceSdkCart };
103
- //# sourceMappingURL=chunk-AA3PV6UD.js.map
104
- //# sourceMappingURL=chunk-AA3PV6UD.js.map
103
+ //# sourceMappingURL=chunk-JCI3IQJV.js.map
104
+ //# sourceMappingURL=chunk-JCI3IQJV.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/sdk-cart.ts","../src/api/cart.ts"],"names":[],"mappings":";;;;;;AAGO,IAAM,SAAA,GAAY,MAAc,MAAA,CAAO,WAAA,IAAe,OAAA,EAAS,GAAA,CAAI,SAAS,CAAA,IAAK,EAAE,CAAA;AAO1F,eAAsB,cAAA,GAAkD;AACtE,EAAA,MAAM,QAAQ,WAAA,EAAY;AAE1B,EAAA,IAAI,CAAC,KAAA,EAAO,IAAA,EAAM,GAAA,EAAK,OAAO,IAAA;AAC9B,EAAA,KAAA,CAAM,IAAA,CAAK,IAAI,KAAA,IAAQ;AACvB,EAAA,MAAM,iBAAiB,MAAM;AAC3B,IAAA,KAAA,CAAM,KAAA,CAAM,SAAS,eAAA,EAAiB,EAAE,OAAO,CAAA,EAAG,KAAA,EAAO,GAAG,CAAA;AAC5D,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAEA,EAAA,IAAI,KAAA,CAAM,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,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-AA3PV6UD.js","sourcesContent":["import { getSallaSDK } from '../utils/sdk-helpers';\n\n/** The cart id the SDK holds, or `''` when it holds none. */\nexport const sdkCartId = (): string => String(getSallaSDK()?.storage?.get('cart.id') ?? '');\n\n/**\n * Drops the SDK's cart and loads the visitor's current one, since nothing tells the SDK that\n * checkout (a separate app) turned its cart into an order. Cart badges listen to\n * `cart::updated`, which the SDK fires for the cart it loads and this fires when there is none.\n */\nexport async function replaceSdkCart(): Promise<number | string | null> {\n const salla = getSallaSDK();\n // The head stub stands in for the SDK until it loads: it holds no cart to replace.\n if (!salla?.cart?.api) return null;\n salla.cart.api.reset?.();\n const announceNoCart = () => {\n salla.event.dispatch('cart::updated', { count: 0, total: 0 });\n return null;\n };\n // `cart/latest` would create an empty cart for a guest, who gets one on their next add anyway.\n if (salla.config.isGuest?.()) return announceNoCart();\n // A failed `cart/latest` leaves the SDK without a cart, and tells no badge either.\n return salla.cart.api.getCurrentCartId(true, 'engine::cart.replaced').catch(announceNoCart);\n}\n","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';\nimport { replaceSdkCart, sdkCartId } from './sdk-cart';\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\ntype CartId = number | string;\n\nasync function fetchCart(cartId: CartId): Promise<Cart | null> {\n const { data } = await api.get(`cart/${cartId}`).json<{ data: CartApiResponse }>();\n return normalizeCartResponse(data);\n}\n\n/**\n * Whether the API refused the cart id itself. An ordered cart answers 403 to anyone but its\n * buyer, and 404 once it is cleaned up; to the buyer it answers 200 with no `cart`.\n */\nfunction isGone(error: unknown): boolean {\n const status = (error as { response?: { status?: number } } | null)?.response?.status;\n return status === 403 || status === 404;\n}\n\n/** Carts the API stopped serving, each with the id of the cart the visitor has instead. */\nconst replacedCarts = new Map<string, Promise<CartId | null>>();\n\n/** Reads of the SDK's cart still in flight, so overlapping callers share one request and one reset. */\nconst sdkCartReads = new Map<string, Promise<Cart | null>>();\n\n/** The cart that took the place of `staleId`, or `null` when the visitor has none. */\nfunction readReplacement(staleId: string, currentId: CartId | null): Promise<Cart | null> {\n const isSameCart = currentId == null || String(currentId) === staleId;\n return isSameCart ? Promise.resolve(null) : fetchCart(currentId);\n}\n\n/** Reads the cart the SDK holds, and replaces it in the SDK when the API no longer serves it. */\nasync function readSdkCart(cartId: CartId): Promise<Cart | null> {\n const key = String(cartId);\n let found: Cart | null = null;\n try {\n found = await fetchCart(cartId);\n } catch (error) {\n if (!isGone(error)) throw error;\n }\n if (found) return found;\n // A newer cart in the SDK stays: an add to cart replaces a refused one while this request is\n // out. No cart in the SDK is the SDK having reset on its own 403, without telling the badges.\n const held = sdkCartId();\n const replacement =\n held && held !== key ? Promise.resolve<CartId | null>(held) : replaceSdkCart();\n replacedCarts.set(key, replacement);\n return readReplacement(key, await replacement);\n}\n\nexport const cart = {\n /**\n * The cart, or `null` when it was turned into an order. Unless the SDK holds another cart by\n * then, the SDK is moved to the visitor's current cart and that one is returned.\n */\n get: async (cartId: CartId): Promise<Cart | null> => {\n const key = String(cartId);\n const replacement = replacedCarts.get(key);\n if (replacement) return readReplacement(key, await replacement);\n // The SDK holds another cart, or there is no SDK (on the server): a plain read.\n const held = sdkCartId();\n if (!getSallaSDK() || (held && held !== key)) return fetchCart(cartId);\n\n let read = sdkCartReads.get(key);\n if (!read) {\n read = readSdkCart(cartId).finally(() => sdkCartReads.delete(key));\n sdkCartReads.set(key, read);\n }\n return read;\n },\n\n getOrThrow: (cartId: CartId): 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: CartId) =>\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/sdk-cart.ts","../src/api/cart.ts"],"names":[],"mappings":";;;;;;AAGO,IAAM,SAAA,GAAY,MAAc,MAAA,CAAO,WAAA,IAAe,OAAA,EAAS,GAAA,CAAI,SAAS,CAAA,IAAK,EAAE,CAAA;AAO1F,eAAsB,cAAA,GAAkD;AACtE,EAAA,MAAM,QAAQ,WAAA,EAAY;AAE1B,EAAA,IAAI,CAAC,KAAA,EAAO,IAAA,EAAM,GAAA,EAAK,OAAO,IAAA;AAC9B,EAAA,KAAA,CAAM,IAAA,CAAK,IAAI,KAAA,IAAQ;AACvB,EAAA,MAAM,iBAAiB,MAAM;AAC3B,IAAA,KAAA,CAAM,KAAA,CAAM,SAAS,eAAA,EAAiB,EAAE,OAAO,CAAA,EAAG,KAAA,EAAO,GAAG,CAAA;AAC5D,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAEA,EAAA,IAAI,KAAA,CAAM,MAAA,CAAO,OAAA,IAAU,SAAU,cAAA,EAAe;AAEpD,EAAA,OAAO,KAAA,CAAM,KAAK,GAAA,CAAI,gBAAA,CAAiB,MAAM,uBAAuB,CAAA,CAAE,MAAM,cAAc,CAAA;AAC5F;;;ACTA,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;AAIA,eAAe,UAAU,MAAA,EAAsC;AAC7D,EAAA,M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B,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-JCI3IQJV.js","sourcesContent":["import { getSallaSDK } from '../utils/sdk-helpers';\n\n/** The cart id the SDK holds, or `''` when it holds none. */\nexport const sdkCartId = (): string => String(getSallaSDK()?.storage?.get('cart.id') ?? '');\n\n/**\n * Drops the SDK's cart and loads the visitor's current one, since nothing tells the SDK that\n * checkout (a separate app) turned its cart into an order. Cart badges listen to\n * `cart::updated`, which the SDK fires for the cart it loads and this fires when there is none.\n */\nexport async function replaceSdkCart(): Promise<number | string | null> {\n const salla = getSallaSDK();\n // The head stub stands in for the SDK until it loads: it holds no cart to replace.\n if (!salla?.cart?.api) return null;\n salla.cart.api.reset?.();\n const announceNoCart = () => {\n salla.event.dispatch('cart::updated', { count: 0, total: 0 });\n return null;\n };\n // `cart/latest` would create an empty cart for a guest, who gets one on their next add anyway.\n if (salla.config.isGuest?.()) return announceNoCart();\n // A failed `cart/latest` leaves the SDK without a cart, and tells no badge either.\n return salla.cart.api.getCurrentCartId(true, 'engine::cart.replaced').catch(announceNoCart);\n}\n","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';\nimport { replaceSdkCart, sdkCartId } from './sdk-cart';\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\ntype CartId = number | string;\n\nasync function fetchCart(cartId: CartId): Promise<Cart | null> {\n const { data } = await api.get(`cart/${cartId}`).json<{ data: CartApiResponse }>();\n return normalizeCartResponse(data);\n}\n\n/**\n * Whether the API refused the cart id itself. An ordered cart answers 403 to anyone but its\n * buyer, and 404 once it is cleaned up; to the buyer it answers 200 with no `cart`.\n */\nfunction isGone(error: unknown): boolean {\n const status = (error as { response?: { status?: number } } | null)?.response?.status;\n return status === 403 || status === 404;\n}\n\n/** Carts the API stopped serving, each with the id of the cart the visitor has instead. */\nconst replacedCarts = new Map<string, Promise<CartId | null>>();\n\n/** Reads of the SDK's cart still in flight, so overlapping callers share one request and one reset. */\nconst sdkCartReads = new Map<string, Promise<Cart | null>>();\n\n/** The cart that took the place of `staleId`, or `null` when the visitor has none. */\nfunction readReplacement(staleId: string, currentId: CartId | null): Promise<Cart | null> {\n const isSameCart = currentId == null || String(currentId) === staleId;\n return isSameCart ? Promise.resolve(null) : fetchCart(currentId);\n}\n\n/** Reads the cart the SDK holds, and replaces it in the SDK when the API no longer serves it. */\nasync function readSdkCart(cartId: CartId): Promise<Cart | null> {\n const key = String(cartId);\n let found: Cart | null = null;\n try {\n found = await fetchCart(cartId);\n } catch (error) {\n if (!isGone(error)) throw error;\n }\n if (found) return found;\n // A newer cart in the SDK stays: an add to cart replaces a refused one while this request is\n // out. No cart in the SDK is the SDK having reset on its own 403, without telling the badges.\n const held = sdkCartId();\n const replacement =\n held && held !== key ? Promise.resolve<CartId | null>(held) : replaceSdkCart();\n replacedCarts.set(key, replacement);\n return readReplacement(key, await replacement);\n}\n\nexport const cart = {\n /**\n * The cart, or `null` when it was turned into an order. Unless the SDK holds another cart by\n * then, the SDK is moved to the visitor's current cart and that one is returned.\n */\n get: async (cartId: CartId): Promise<Cart | null> => {\n const key = String(cartId);\n const replacement = replacedCarts.get(key);\n if (replacement) return readReplacement(key, await replacement);\n // The SDK holds another cart, or there is no SDK (on the server): a plain read.\n const held = sdkCartId();\n if (!getSallaSDK() || (held && held !== key)) return fetchCart(cartId);\n\n let read = sdkCartReads.get(key);\n if (!read) {\n read = readSdkCart(cartId).finally(() => sdkCartReads.delete(key));\n sdkCartReads.set(key, read);\n }\n return read;\n },\n\n getOrThrow: (cartId: CartId): 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: CartId) =>\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,10 +1,10 @@
1
- import { MadeWithSalla } from './chunk-OQIIJRAS.js';
2
- import { HookSlot, useIsClient } from './chunk-5XDPAKF5.js';
1
+ import { MadeWithSalla } from './chunk-CBP4AT5U.js';
2
+ import { HookSlot, useIsClient } from './chunk-XZFWBF3P.js';
3
3
  import { useTranslation } from './chunk-TYNZ5B2B.js';
4
4
  import { Image } from './chunk-IVO6YRRK.js';
5
5
  import { Link } from './chunk-3GFD7WTJ.js';
6
- import { LazyImageModal } from './chunk-KYMWEUN2.js';
7
- import { useTwilight } from './chunk-DF6FBKDN.js';
6
+ import { LazyImageModal } from './chunk-TVL6UBN2.js';
7
+ import { useTwilight } from './chunk-3VFOVWOE.js';
8
8
  import { useState } from 'react';
9
9
  import { SallaAppsIcons } from '@salla.sa/twilight-components-react/apps-icons';
10
10
  import { SallaContacts } from '@salla.sa/twilight-components-react/contacts';
@@ -281,5 +281,5 @@ function Footer({ inSheet = false } = {}) {
281
281
  }
282
282
 
283
283
  export { Footer };
284
- //# sourceMappingURL=chunk-QT2D7JMW.js.map
285
- //# sourceMappingURL=chunk-QT2D7JMW.js.map
284
+ //# sourceMappingURL=chunk-K4HCMVAQ.js.map
285
+ //# sourceMappingURL=chunk-K4HCMVAQ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/layout/Footer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAiBA,IAAM,YAAA,GACJ,+HAAA;AAOF,SAAS,SAAA,CAAU,EAAE,IAAA,EAAK,EAAsB;AAC9C,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,WAAA,EAAY;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,KAAK,CAAA;AACtC,EAAA,MAAM,MAAA,GAAS,KAAA,CAAM,QAAA,EAAU,GAAA,EAAK,MAAA;AACpC,EAAA,MAAM,WAAA,GAAc,KAAA,CAAM,QAAA,EAAU,GAAA,EAAK,WAAA;AACzC,EAAA,IAAI,CAAC,QAAQ,OAAO,IAAA;AAEpB,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAA,EAAY,kBAAA;AAAA,MACZ,SAAA,EAAU,4DAAA;AAAA,MAET,QAAA,EAAA;AAAA,QAAA,WAAA,oBACC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,IAAA,EAAK,QA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AAAA,0BAAA,GAAA,CAAC,UAAK,SAAA,EAAW,CAAA,uBAAA,EAA0B,MAAA,GAAS,eAAA,GAAkB,eAAe,CAAA,CAAA,EACnF,QAAA,kBAAA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,IAAA,EAAK,WAAA;AAAA,cACL,OAAA,EAAS,EAAE,SAAA,EAAW,KAAA,CAAM,IAAA,EAAK;AAAA,cACjC,0BACE,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,gBAAA,CAAA,CAAE,2BAA2B,qBAAqB,CAAA;AAAA,gBAAG,GAAA;AAAA,oCACrD,IAAA,EAAA,EAAK,EAAA,EAAG,KAAI,SAAA,EAAU,wDAAA,EACpB,gBAAM,IAAA,EACT,CAAA;AAAA,gBAAQ,GAAA;AAAA,gBAAI,OAAA;AAAA,gBACT,IAAA;AAAA,gCACH,GAAA,CAAC,aAAA,EAAA,EAAc,SAAA,EAAU,MAAA,EAAO;AAAA,eAAA,EAClC;AAAA;AAAA,WAEJ,EACF,CAAA;AAAA,8BAEC,aAAA,EAAA,EAAc;AAAA,SAAA,EACjB,CAAA;AAAA,QAEC,CAAC,OAAA,oBAAW,GAAA,CAAC,QAAA,EAAA,EAAS,MAAK,YAAA,EAAa;AAAA;AAAA;AAAA,GAC3C;AAEJ","file":"chunk-QT2D7JMW.js","sourcesContent":["import { useState } from 'react';\nimport { SallaAppsIcons } from '@salla.sa/twilight-components-react/apps-icons';\nimport { SallaContacts } from '@salla.sa/twilight-components-react/contacts';\nimport { SallaSocial } from '@salla.sa/twilight-components-react/social';\nimport { SallaMenu } from '@salla.sa/twilight-components-react/menu';\nimport { SallaTrustBadges } from '@salla.sa/twilight-components-react/trust-badges';\nimport { SallaPayments } from '@salla.sa/twilight-components-react/payments';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { HookSlot } from '../../hooks/HookSlot';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { Link, Image } from '../common';\nimport { ImageModal } from '../modal';\nimport { MadeWithSalla } from './MadeWithSalla';\n\n/** Salla's value-added-tax badge icon (70×70, CDN-resized) — a platform\n * asset shared by every store, not specific to any one theme. */\nconst TAX_ICON_URL =\n 'https://cdn.salla.network/cdn-cgi/image/fit=scale-down,width=70,height=70,onerror=redirect,format=auto/images/tax.png?v=2.0.5';\n\n/**\n * The store's value-added-tax registration: the tax number, plus the certificate as\n * the tax icon that opens the certificate image full size in a modal. Nothing shows\n * when the store has no tax number.\n */\nfunction FooterTax({ dark }: { dark: boolean }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const [open, setOpen] = useState(false);\n const number = store.settings?.tax?.number;\n const certificate = store.settings?.tax?.certificate;\n if (!number) return null;\n\n return (\n <div\n data-testid=\"store-footer-tax\"\n className=\"store-footer__tax flex items-end gap-2 rtl:space-x-reverse\"\n >\n {certificate && (\n <>\n <button\n type=\"button\"\n data-testid=\"store-footer-tax-certificate\"\n className=\"store-footer__tax-cert shrink-0\"\n aria-label={t('common.elements.tax_certificate', 'Tax Certificate')}\n aria-haspopup=\"dialog\"\n onClick={() => setOpen(true)}\n >\n <img\n src={TAX_ICON_URL}\n alt={t('common.elements.tax_certificate', 'Tax Certificate')}\n width={40}\n height={50}\n loading=\"lazy\"\n decoding=\"async\"\n className=\"w-10 rounded-sm transition-opacity hover:opacity-80\"\n />\n </button>\n <ImageModal\n isOpen={open}\n onClose={() => setOpen(false)}\n src={certificate}\n alt={t('common.elements.tax_certificate', 'Tax Certificate')}\n title={t('common.elements.tax_certificate', 'Tax Certificate')}\n />\n </>\n )}\n <div>\n <p className={`mb-1 text-sm opacity-70 ${dark ? 'text-white' : ''}`}>\n {t('common.elements.tax_number', 'Tax Number')}\n </p>\n <b className=\"text-sm\">{number}</b>\n </div>\n </div>\n );\n}\n\n/** Saudi Business Center (SBC) logo, CDN-versioned like the tax icon -- also a\n * platform asset, not theme-specific. */\nconst SBC_ICON_URL = 'https://cdn.salla.network/images/sbc.png?v=2.0.5';\n\n/**\n * The store's Saudi Business Center certificate: a \"Trusted by Business Platform\" badge that\n * opens the certificate's page on the SBC site so visitors can verify the merchant. Nothing\n * shows when the store has no certificate.\n */\nfunction FooterSbc({ dark }: { dark: boolean }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const id = store.settings?.certificate?.id;\n if (!id) return null;\n\n return (\n <a\n href={`https://eauthenticate.saudibusiness.gov.sa/certificate-details/${encodeURIComponent(id)}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-testid=\"store-footer-sbc\"\n className=\"store-footer__sbc flex items-center gap-2.5 transition-opacity hover:opacity-75\"\n >\n <img\n src={SBC_ICON_URL}\n alt={`SBC ${id}`}\n width={56}\n height={40}\n loading=\"lazy\"\n decoding=\"async\"\n className=\"h-10 w-14 rounded-sm\"\n />\n <div>\n <p className={`text-xs opacity-70 ${dark ? 'text-white' : ''}`}>\n {t('blocks.footer.sbc_trusted_by', 'Trusted by')}\n </p>\n <b className=\"text-sm\">{t('blocks.footer.sbc_platform', 'Business Platform')}</b>\n </div>\n </a>\n );\n}\n\n/** Trust badges, the tax registration and the SBC badge, side by side (wrapping on narrow columns). */\nfunction FooterTrust({ dark, centered }: { dark: boolean; centered: boolean }) {\n return (\n <div\n data-testid=\"store-footer-trust\"\n className={`store-footer__trust flex flex-wrap items-end gap-x-6 gap-y-3${centered ? ' justify-center' : ''}`}\n >\n <FooterTax dark={dark} />\n <FooterSbc dark={dark} />\n <SallaTrustBadges {...(dark ? { dark: true } : {})} />\n </div>\n );\n}\n\n/**\n * The footer's own menu of (\"important\") links -- skipped entirely when\n * `inSheet`, for a theme that opens it from somewhere else of its own (a\n * mobile account sheet, a dedicated links screen, …) instead; showing it\n * again down here would just be a redundant second copy. `heading` wraps it\n * in the grid layout's own `.store-footer__links` column; the centered\n * layout's inline row has none.\n */\nfunction FooterLinksMenu({\n inSheet,\n className,\n heading,\n dark,\n}: {\n inSheet: boolean;\n className: string;\n heading?: string;\n dark: boolean;\n}) {\n if (inSheet) return null;\n\n const menu = <SallaMenu source=\"footer\" className={className} suppressHydrationWarning />;\n if (!heading) return menu;\n\n return (\n <div className=\"store-footer__links\">\n <h3 className={`mb-3 text-lg font-bold lg:mb-5 ${dark ? 'text-white' : 'text-gray-900'}`}>\n {heading}\n </h3>\n {menu}\n </div>\n );\n}\n\n/** App-store / Google-Play buttons. Nothing shows -- not even the wrapping\n * div -- when the store has neither link set. */\nfunction FooterApps({ className }: { className: string }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n // The web component fills its light DOM before React hydrates the footer, a hydration error.\n const isClient = useIsClient();\n if (!store.apps?.appstore && !store.apps?.googleplay) return null;\n\n return (\n <div data-testid=\"store-footer-apps\" className={`store-footer__apps ${className}`}>\n {isClient && (\n <SallaAppsIcons\n apps={store.apps}\n appsTitle={t('blocks.footer.download_apps', 'Get our apps')}\n />\n )}\n </div>\n );\n}\n\n/** The logo link, same shape in both layouts -- only its own spacing differs. */\nfunction FooterLogo({ className }: { className: string }) {\n const { store } = useTwilight();\n return (\n <Link\n to=\"/\"\n className={`store-footer__logo inline-flex items-center m-0 transition-opacity hover:opacity-75 ${className}`}\n >\n <Image\n src={store.logo}\n alt={store.name || 'Store'}\n width={150}\n height={44}\n objectFit=\"contain\"\n className=\"h-11 w-auto max-w-[180px]\"\n />\n </Link>\n );\n}\n\n/** Merchant-authored description HTML -- mirrors the Twig theme's\n * `store.description|raw`. Renders nothing when the store has none set. */\nfunction FooterDescription({ className }: { className: string }) {\n const { store } = useTwilight();\n if (!store.description) return null;\n return (\n <div\n className={`store-footer__desc opacity-80 ${className}`}\n dangerouslySetInnerHTML={{ __html: store.description }}\n />\n );\n}\n\n/** The store's phone and email as one \"Contact us: …\" row under the description\n * (`<salla-contacts>`'s compact `isHeader` layout, which shows only those two).\n * Renders nothing when the store has neither. */\nfunction FooterContacts({ className }: { className: string }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n // The web component fills its light DOM once the SDK is ready, which can come before\n // React hydrates the footer's Suspense boundary: a hydration error (React #418).\n const isClient = useIsClient();\n if (!store.contacts?.phone && !store.contacts?.email) return null;\n return (\n <div className={`store-footer__contacts ${className}`}>\n {isClient && (\n <SallaContacts\n contacts={store.contacts}\n contactsTitle={t('blocks.footer.social', 'Contact us')}\n isHeader\n />\n )}\n </div>\n );\n}\n\n/** Centered layout: logo, description, contacts, social, footer menu, trust\n * badges and app buttons stacked as one centered column. */\nfunction FooterCenteredBody({ inSheet, isDark }: { inSheet: boolean; isDark: boolean }) {\n return (\n <div className=\"container mx-auto flex max-w-2xl flex-col items-center gap-6 text-center\">\n <FooterLogo className=\"\" />\n <FooterDescription className=\"\" />\n <FooterContacts className=\"\" />\n <SallaSocial />\n\n <FooterLinksMenu\n inSheet={inSheet}\n className=\"store-footer__menu store-footer__menu--inline\"\n dark={isDark}\n />\n\n <FooterTrust dark={isDark} centered />\n\n <FooterApps className=\"flex flex-col items-center gap-3\" />\n </div>\n );\n}\n\n/** Columns layout: brand (logo / description / contacts / social / trust) and app\n * buttons side by side, with the footer menu as its own labeled column. */\nfunction FooterColumnsBody({ inSheet, isDark }: { inSheet: boolean; isDark: boolean }) {\n const { t } = useTranslation();\n\n return (\n <div className=\"container grid grid-cols-1 gap-10 sm:grid-cols-2 lg:grid-cols-4 lg:gap-16\">\n <div className=\"store-footer__brand rtl:lg:pl-16 ltr:lg:pr-16 sm:col-span-2\">\n <FooterLogo className=\"mb-5\" />\n <FooterDescription className=\"max-w-sm leading-6 my-5\" />\n <FooterContacts className=\"mb-6\" />\n <SallaSocial className=\"block mb-6\" />\n <FooterTrust dark={isDark} centered={false} />\n </div>\n\n <FooterLinksMenu\n inSheet={inSheet}\n className=\"store-footer__menu store-footer__menu--stacked\"\n heading={t('blocks.footer.important_links', 'Important links')}\n dark={isDark}\n />\n\n <FooterApps className=\"\" />\n </div>\n );\n}\n\nexport interface FooterProps {\n /**\n * Renders as a plain `<div>` (no second `<footer>` landmark) with the\n * `footer:start` / `footer:end` hook slots skipped -- for a theme that\n * repeats these widgets somewhere other than the page's own footer (a\n * mobile sheet, for example) rather than rendering the real page footer a\n * second time.\n */\n inSheet?: boolean;\n}\n\n/**\n * Storefront footer.\n *\n * Two layouts, chosen by the `footer_layout` theme setting:\n * - **columns** (default): logo / description / social / trust badges, the\n * footer menu (\"important links\"), and app-store buttons, side by side.\n * - **centered**: the same pieces stacked as one centered column, with the\n * footer menu laid out as an inline, pipe-separated row.\n *\n * Styling for the handful of pieces rendered by web components this owns no\n * markup for (`<salla-social>`'s `.social-link` icons, `<salla-menu>`'s\n * `.s-menu-footer-item` rows, `<salla-payments>`'s `.s-payments-list-item`\n * icons) is the consuming theme's own responsibility, the same way\n * `inSheet`'s own presentation is -- this component owns structure and data,\n * not every pixel.\n */\nexport function Footer({ inSheet = false }: FooterProps = {}) {\n const { store, theme } = useTwilight();\n const { t } = useTranslation();\n const year = new Date().getFullYear();\n const isCentered = theme.settings?.footer_layout === 'centered';\n const isDark = !!theme.settings?.footer_is_dark;\n\n const Root = inSheet ? 'div' : 'footer';\n\n return (\n <Root\n className={`store-footer store-footer--${isCentered ? 'centered' : 'columns'}${\n inSheet ? ' store-footer--sheet' : ''\n } relative mt-8 sm:mt-16 ${isDark ? 'bg-[#0E0F0F] text-white' : 'bg-[#F4F7F2] text-gray-600'}`}\n suppressHydrationWarning\n >\n {!inSheet && <HookSlot name=\"footer:start\" />}\n\n <div\n aria-label=\"footer\"\n className={`store-footer__inner border-b py-8 lg:py-16 ${\n isDark ? 'bg-[#1D1F1F] border-dashed border-white/10' : 'bg-transparent border-gray-200'\n }`}\n >\n {isCentered ? (\n <FooterCenteredBody inSheet={inSheet} isDark={isDark} />\n ) : (\n <FooterColumnsBody inSheet={inSheet} isDark={isDark} />\n )}\n </div>\n\n <div className=\"store-footer__bottom container md:flex items-center justify-between gap-4 py-4 lg:py-7 text-center\">\n <span className={`text-sm copyright-text ${isDark ? 'text-gray-400' : 'text-gray-700'}`}>\n <HookSlot\n name=\"copyright\"\n context={{ storeName: store.name }}\n fallback={\n <>\n {t('blocks.footer.copyright', 'All rights reserved')}{' '}\n <Link to=\"/\" className=\"transition-opacity hover:opacity-75 hover:text-primary\">\n {store.name}\n </Link>{' '}\n © {year}\n <MadeWithSalla className=\"ms-2\" />\n </>\n }\n />\n </span>\n\n <SallaPayments />\n </div>\n\n {!inSheet && <HookSlot name=\"footer:end\" />}\n </Root>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/components/layout/Footer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAiBA,IAAM,YAAA,GACJ,+HAAA;AAOF,SAAS,SAAA,CAAU,EAAE,IAAA,EAAK,EAAsB;AAC9C,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,WAAA,EAAY;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,KAAK,CAAA;AACtC,EAAA,MAAM,MAAA,GAAS,KAAA,CAAM,QAAA,EAAU,GAAA,EAAK,MAAA;AACpC,EAAA,MAAM,WAAA,GAAc,KAAA,CAAM,QAAA,EAAU,GAAA,EAAK,WAAA;AACzC,EAAA,IAAI,CAAC,QAAQ,OAAO,IAAA;AAEpB,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAA,EAAY,kBAAA;AAAA,MACZ,SAAA,EAAU,4DAAA;AAAA,MAET,QAAA,EAAA;AAAA,QAAA,WAAA,oBACC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,IAAA,EAAK,QAAA;AAAA,cACL,aAAA,EAAY,8BAAA;AAAA,cACZ,SAAA,EAAU,iCAAA;AAAA,cACV,YAAA,EAAY,CAAA,CAAE,iCAAA,EAAmC,iBAAiB,CAAA;AAAA,cAClE,eAAA,EAAc,QAAA;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AA;AAAA,cACC,IAAA,EAAK,WAAA;AAAA,cACL,OAAA,EAAS,EAAE,SAAA,EAAW,KAAA,CAAM,IAAA,EAAK;AAAA,cACjC,0BACE,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,gBAAA,CAAA,CAAE,2BAA2B,qBAAqB,CAAA;AAAA,gBAAG,GAAA;AAAA,oCACrD,IAAA,EAAA,EAAK,EAAA,EAAG,KAAI,SAAA,EAAU,wDAAA,EACpB,gBAAM,IAAA,EACT,CAAA;AAAA,gBAAQ,GAAA;AAAA,gBAAI,OAAA;AAAA,gBACT,IAAA;AAAA,gCACH,GAAA,CAAC,aAAA,EAAA,EAAc,SAAA,EAAU,MAAA,EAAO;AAAA,eAAA,EAClC;AAAA;AAAA,WAEJ,EACF,CAAA;AAAA,8BAEC,aAAA,EAAA,EAAc;AAAA,SAAA,EACjB,CAAA;AAAA,QAEC,CAAC,OAAA,oBAAW,GAAA,CAAC,QAAA,EAAA,EAAS,MAAK,YAAA,EAAa;AAAA;AAAA;AAAA,GAC3C;AAEJ","file":"chunk-K4HCMVAQ.js","sourcesContent":["import { useState } from 'react';\nimport { SallaAppsIcons } from '@salla.sa/twilight-components-react/apps-icons';\nimport { SallaContacts } from '@salla.sa/twilight-components-react/contacts';\nimport { SallaSocial } from '@salla.sa/twilight-components-react/social';\nimport { SallaMenu } from '@salla.sa/twilight-components-react/menu';\nimport { SallaTrustBadges } from '@salla.sa/twilight-components-react/trust-badges';\nimport { SallaPayments } from '@salla.sa/twilight-components-react/payments';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { HookSlot } from '../../hooks/HookSlot';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { Link, Image } from '../common';\nimport { ImageModal } from '../modal';\nimport { MadeWithSalla } from './MadeWithSalla';\n\n/** Salla's value-added-tax badge icon (70×70, CDN-resized) — a platform\n * asset shared by every store, not specific to any one theme. */\nconst TAX_ICON_URL =\n 'https://cdn.salla.network/cdn-cgi/image/fit=scale-down,width=70,height=70,onerror=redirect,format=auto/images/tax.png?v=2.0.5';\n\n/**\n * The store's value-added-tax registration: the tax number, plus the certificate as\n * the tax icon that opens the certificate image full size in a modal. Nothing shows\n * when the store has no tax number.\n */\nfunction FooterTax({ dark }: { dark: boolean }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const [open, setOpen] = useState(false);\n const number = store.settings?.tax?.number;\n const certificate = store.settings?.tax?.certificate;\n if (!number) return null;\n\n return (\n <div\n data-testid=\"store-footer-tax\"\n className=\"store-footer__tax flex items-end gap-2 rtl:space-x-reverse\"\n >\n {certificate && (\n <>\n <button\n type=\"button\"\n data-testid=\"store-footer-tax-certificate\"\n className=\"store-footer__tax-cert shrink-0\"\n aria-label={t('common.elements.tax_certificate', 'Tax Certificate')}\n aria-haspopup=\"dialog\"\n onClick={() => setOpen(true)}\n >\n <img\n src={TAX_ICON_URL}\n alt={t('common.elements.tax_certificate', 'Tax Certificate')}\n width={40}\n height={50}\n loading=\"lazy\"\n decoding=\"async\"\n className=\"w-10 rounded-sm transition-opacity hover:opacity-80\"\n />\n </button>\n <ImageModal\n isOpen={open}\n onClose={() => setOpen(false)}\n src={certificate}\n alt={t('common.elements.tax_certificate', 'Tax Certificate')}\n title={t('common.elements.tax_certificate', 'Tax Certificate')}\n />\n </>\n )}\n <div>\n <p className={`mb-1 text-sm opacity-70 ${dark ? 'text-white' : ''}`}>\n {t('common.elements.tax_number', 'Tax Number')}\n </p>\n <b className=\"text-sm\">{number}</b>\n </div>\n </div>\n );\n}\n\n/** Saudi Business Center (SBC) logo, CDN-versioned like the tax icon -- also a\n * platform asset, not theme-specific. */\nconst SBC_ICON_URL = 'https://cdn.salla.network/images/sbc.png?v=2.0.5';\n\n/**\n * The store's Saudi Business Center certificate: a \"Trusted by Business Platform\" badge that\n * opens the certificate's page on the SBC site so visitors can verify the merchant. Nothing\n * shows when the store has no certificate.\n */\nfunction FooterSbc({ dark }: { dark: boolean }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const id = store.settings?.certificate?.id;\n if (!id) return null;\n\n return (\n <a\n href={`https://eauthenticate.saudibusiness.gov.sa/certificate-details/${encodeURIComponent(id)}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-testid=\"store-footer-sbc\"\n className=\"store-footer__sbc flex items-center gap-2.5 transition-opacity hover:opacity-75\"\n >\n <img\n src={SBC_ICON_URL}\n alt={`SBC ${id}`}\n width={56}\n height={40}\n loading=\"lazy\"\n decoding=\"async\"\n className=\"h-10 w-14 rounded-sm\"\n />\n <div>\n <p className={`text-xs opacity-70 ${dark ? 'text-white' : ''}`}>\n {t('blocks.footer.sbc_trusted_by', 'Trusted by')}\n </p>\n <b className=\"text-sm\">{t('blocks.footer.sbc_platform', 'Business Platform')}</b>\n </div>\n </a>\n );\n}\n\n/** Trust badges, the tax registration and the SBC badge, side by side (wrapping on narrow columns). */\nfunction FooterTrust({ dark, centered }: { dark: boolean; centered: boolean }) {\n return (\n <div\n data-testid=\"store-footer-trust\"\n className={`store-footer__trust flex flex-wrap items-end gap-x-6 gap-y-3${centered ? ' justify-center' : ''}`}\n >\n <FooterTax dark={dark} />\n <FooterSbc dark={dark} />\n <SallaTrustBadges {...(dark ? { dark: true } : {})} />\n </div>\n );\n}\n\n/**\n * The footer's own menu of (\"important\") links -- skipped entirely when\n * `inSheet`, for a theme that opens it from somewhere else of its own (a\n * mobile account sheet, a dedicated links screen, …) instead; showing it\n * again down here would just be a redundant second copy. `heading` wraps it\n * in the grid layout's own `.store-footer__links` column; the centered\n * layout's inline row has none.\n */\nfunction FooterLinksMenu({\n inSheet,\n className,\n heading,\n dark,\n}: {\n inSheet: boolean;\n className: string;\n heading?: string;\n dark: boolean;\n}) {\n if (inSheet) return null;\n\n const menu = <SallaMenu source=\"footer\" className={className} suppressHydrationWarning />;\n if (!heading) return menu;\n\n return (\n <div className=\"store-footer__links\">\n <h3 className={`mb-3 text-lg font-bold lg:mb-5 ${dark ? 'text-white' : 'text-gray-900'}`}>\n {heading}\n </h3>\n {menu}\n </div>\n );\n}\n\n/** App-store / Google-Play buttons. Nothing shows -- not even the wrapping\n * div -- when the store has neither link set. */\nfunction FooterApps({ className }: { className: string }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n // The web component fills its light DOM before React hydrates the footer, a hydration error.\n const isClient = useIsClient();\n if (!store.apps?.appstore && !store.apps?.googleplay) return null;\n\n return (\n <div data-testid=\"store-footer-apps\" className={`store-footer__apps ${className}`}>\n {isClient && (\n <SallaAppsIcons\n apps={store.apps}\n appsTitle={t('blocks.footer.download_apps', 'Get our apps')}\n />\n )}\n </div>\n );\n}\n\n/** The logo link, same shape in both layouts -- only its own spacing differs. */\nfunction FooterLogo({ className }: { className: string }) {\n const { store } = useTwilight();\n return (\n <Link\n to=\"/\"\n className={`store-footer__logo inline-flex items-center m-0 transition-opacity hover:opacity-75 ${className}`}\n >\n <Image\n src={store.logo}\n alt={store.name || 'Store'}\n width={150}\n height={44}\n objectFit=\"contain\"\n className=\"h-11 w-auto max-w-[180px]\"\n />\n </Link>\n );\n}\n\n/** Merchant-authored description HTML -- mirrors the Twig theme's\n * `store.description|raw`. Renders nothing when the store has none set. */\nfunction FooterDescription({ className }: { className: string }) {\n const { store } = useTwilight();\n if (!store.description) return null;\n return (\n <div\n className={`store-footer__desc opacity-80 ${className}`}\n dangerouslySetInnerHTML={{ __html: store.description }}\n />\n );\n}\n\n/** The store's phone and email as one \"Contact us: …\" row under the description\n * (`<salla-contacts>`'s compact `isHeader` layout, which shows only those two).\n * Renders nothing when the store has neither. */\nfunction FooterContacts({ className }: { className: string }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n // The web component fills its light DOM once the SDK is ready, which can come before\n // React hydrates the footer's Suspense boundary: a hydration error (React #418).\n const isClient = useIsClient();\n if (!store.contacts?.phone && !store.contacts?.email) return null;\n return (\n <div className={`store-footer__contacts ${className}`}>\n {isClient && (\n <SallaContacts\n contacts={store.contacts}\n contactsTitle={t('blocks.footer.social', 'Contact us')}\n isHeader\n />\n )}\n </div>\n );\n}\n\n/** Centered layout: logo, description, contacts, social, footer menu, trust\n * badges and app buttons stacked as one centered column. */\nfunction FooterCenteredBody({ inSheet, isDark }: { inSheet: boolean; isDark: boolean }) {\n return (\n <div className=\"container mx-auto flex max-w-2xl flex-col items-center gap-6 text-center\">\n <FooterLogo className=\"\" />\n <FooterDescription className=\"\" />\n <FooterContacts className=\"\" />\n <SallaSocial />\n\n <FooterLinksMenu\n inSheet={inSheet}\n className=\"store-footer__menu store-footer__menu--inline\"\n dark={isDark}\n />\n\n <FooterTrust dark={isDark} centered />\n\n <FooterApps className=\"flex flex-col items-center gap-3\" />\n </div>\n );\n}\n\n/** Columns layout: brand (logo / description / contacts / social / trust) and app\n * buttons side by side, with the footer menu as its own labeled column. */\nfunction FooterColumnsBody({ inSheet, isDark }: { inSheet: boolean; isDark: boolean }) {\n const { t } = useTranslation();\n\n return (\n <div className=\"container grid grid-cols-1 gap-10 sm:grid-cols-2 lg:grid-cols-4 lg:gap-16\">\n <div className=\"store-footer__brand rtl:lg:pl-16 ltr:lg:pr-16 sm:col-span-2\">\n <FooterLogo className=\"mb-5\" />\n <FooterDescription className=\"max-w-sm leading-6 my-5\" />\n <FooterContacts className=\"mb-6\" />\n <SallaSocial className=\"block mb-6\" />\n <FooterTrust dark={isDark} centered={false} />\n </div>\n\n <FooterLinksMenu\n inSheet={inSheet}\n className=\"store-footer__menu store-footer__menu--stacked\"\n heading={t('blocks.footer.important_links', 'Important links')}\n dark={isDark}\n />\n\n <FooterApps className=\"\" />\n </div>\n );\n}\n\nexport interface FooterProps {\n /**\n * Renders as a plain `<div>` (no second `<footer>` landmark) with the\n * `footer:start` / `footer:end` hook slots skipped -- for a theme that\n * repeats these widgets somewhere other than the page's own footer (a\n * mobile sheet, for example) rather than rendering the real page footer a\n * second time.\n */\n inSheet?: boolean;\n}\n\n/**\n * Storefront footer.\n *\n * Two layouts, chosen by the `footer_layout` theme setting:\n * - **columns** (default): logo / description / social / trust badges, the\n * footer menu (\"important links\"), and app-store buttons, side by side.\n * - **centered**: the same pieces stacked as one centered column, with the\n * footer menu laid out as an inline, pipe-separated row.\n *\n * Styling for the handful of pieces rendered by web components this owns no\n * markup for (`<salla-social>`'s `.social-link` icons, `<salla-menu>`'s\n * `.s-menu-footer-item` rows, `<salla-payments>`'s `.s-payments-list-item`\n * icons) is the consuming theme's own responsibility, the same way\n * `inSheet`'s own presentation is -- this component owns structure and data,\n * not every pixel.\n */\nexport function Footer({ inSheet = false }: FooterProps = {}) {\n const { store, theme } = useTwilight();\n const { t } = useTranslation();\n const year = new Date().getFullYear();\n const isCentered = theme.settings?.footer_layout === 'centered';\n const isDark = !!theme.settings?.footer_is_dark;\n\n const Root = inSheet ? 'div' : 'footer';\n\n return (\n <Root\n className={`store-footer store-footer--${isCentered ? 'centered' : 'columns'}${\n inSheet ? ' store-footer--sheet' : ''\n } relative mt-8 sm:mt-16 ${isDark ? 'bg-[#0E0F0F] text-white' : 'bg-[#F4F7F2] text-gray-600'}`}\n suppressHydrationWarning\n >\n {!inSheet && <HookSlot name=\"footer:start\" />}\n\n <div\n aria-label=\"footer\"\n className={`store-footer__inner border-b py-8 lg:py-16 ${\n isDark ? 'bg-[#1D1F1F] border-dashed border-white/10' : 'bg-transparent border-gray-200'\n }`}\n >\n {isCentered ? (\n <FooterCenteredBody inSheet={inSheet} isDark={isDark} />\n ) : (\n <FooterColumnsBody inSheet={inSheet} isDark={isDark} />\n )}\n </div>\n\n <div className=\"store-footer__bottom container md:flex items-center justify-between gap-4 py-4 lg:py-7 text-center\">\n <span className={`text-sm copyright-text ${isDark ? 'text-gray-400' : 'text-gray-700'}`}>\n <HookSlot\n name=\"copyright\"\n context={{ storeName: store.name }}\n fallback={\n <>\n {t('blocks.footer.copyright', 'All rights reserved')}{' '}\n <Link to=\"/\" className=\"transition-opacity hover:opacity-75 hover:text-primary\">\n {store.name}\n </Link>{' '}\n © {year}\n <MadeWithSalla className=\"ms-2\" />\n </>\n }\n />\n </span>\n\n <SallaPayments />\n </div>\n\n {!inSheet && <HookSlot name=\"footer:end\" />}\n </Root>\n );\n}\n"]}
@@ -8,6 +8,7 @@ var EDITOR_ORIGINS = [
8
8
  ];
9
9
  var BETA_EDITOR_HOST_SUFFIX = ".beta.salla.group";
10
10
  var FRAME_LOADED_ACTION = "design::iframe.loaded";
11
+ var LIVE_EDITOR_DISABLE_ACTION = "design::live-editor.disable";
11
12
  var BLOCK_ATTRIBUTE = "data-live-block";
12
13
  function liveBlockIdOf(data) {
13
14
  const devId = typeof data.__dev_id === "string" ? data.__dev_id.replace(/~\d+$/, "") : void 0;
@@ -96,6 +97,6 @@ function targetOf(node) {
96
97
  return null;
97
98
  }
98
99
 
99
- export { BLOCK_ATTRIBUTE, FRAME_LOADED_ACTION, TARGET_SELECTOR, areaOf, editorFrame, liveBlockIdOf, parentOrigin, postToEditor, previewTheme, targetOf };
100
- //# sourceMappingURL=chunk-ELGZOQEY.js.map
101
- //# sourceMappingURL=chunk-ELGZOQEY.js.map
100
+ export { BLOCK_ATTRIBUTE, FRAME_LOADED_ACTION, LIVE_EDITOR_DISABLE_ACTION, TARGET_SELECTOR, areaOf, editorFrame, liveBlockIdOf, parentOrigin, postToEditor, previewTheme, targetOf };
101
+ //# sourceMappingURL=chunk-K4QQRA6L.js.map
102
+ //# sourceMappingURL=chunk-K4QQRA6L.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/live-editor/frame.ts"],"names":[],"mappings":";;;AAWO,IAAM,cAAA,GAAiB;AAAA,EAC5B,oBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAAA;AAOA,IAAM,uBAAA,GAA0B,mBAAA;AAGzB,IAAM,mBAAA,GAAsB;AAM5B,IAAM,0BAAA,GAA6B;AAQnC,IAAM,eAAA,GAAkB;AAUxB,SAAS,cAAc,IAAA,EAKP;AACrB,EAAA,MAAM,KAAA,GAAQ,OAAO,IAAA,CAAK,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D,IAAA,EAAA,GAAK,EAAA,CAAG,aAAA,EAAe,OAAA,CAAqB,eAAe,CAAA,IAAK,IAAA;AAAA,EAClE;AACA,EAAA,OAAO,IAAA;AACT","file":"chunk-K4QQRA6L.js","sourcesContent":["/**\n * The storefront's side of the merchant theme editor's live preview: the editor\n * (`s.salla.sa/themes/editor`) frames the store, and the store tells it which\n * block, header or footer the merchant acted on, with the same `postMessage`\n * protocol the twig themes' `live-themes-editor.js` speaks.\n */\n\nimport { isEditorFrame } from '../../dev/schema-types';\nimport type { Theme } from '../../types';\n\n/** Where the theme editor runs. Messages go to the one that framed the page, never to `*`. */\nexport const EDITOR_ORIGINS = [\n 'https://s.salla.sa',\n 'https://salla.design',\n 'https://demostore.salla.sa',\n] as const;\n\n/**\n * The merchant dashboard's beta builds (`https://dashboard-<build>.beta.salla.group`)\n * run the same editor. Without them the preview never says it has loaded, and the\n * editor warns that the preview can't be seen while it shows fine.\n */\nconst BETA_EDITOR_HOST_SUFFIX = '.beta.salla.group';\n\n/** Sent once the page has loaded; the editor's preview health check waits for it. */\nexport const FRAME_LOADED_ACTION = 'design::iframe.loaded';\n\n/**\n * The editor answers with this when it only previews a theme (not the merchant's\n * customization), so the page shows no action bar: there is nothing to edit.\n */\nexport const LIVE_EDITOR_DISABLE_ACTION = 'design::live-editor.disable';\n\nexport type BlockAction = 'edit' | 'hide' | 'moveup' | 'movedown' | 'duplicate' | 'add' | 'delete';\n\nexport type LiveEditorMessage =\n `preview::${BlockAction}.component` | 'preview::edit.header' | 'preview::edit.footer';\n\n/** A home block, rendered by `HomeComponentRenderer`, carries its id here. */\nexport const BLOCK_ATTRIBUTE = 'data-live-block';\n\n/**\n * What the theme editor addresses a block by: the dev editor's layout id (less\n * the remount suffix), its row id, or the uuid of one not saved yet. The layout\n * id comes first: a customized layout keeps the store blocks' row ids among\n * their fields, and duplicates share them. A built-in block (fixed products,\n * YouTube, …) has neither id nor key, so it goes by its path, which the\n * editor matches to the block's slug; the bar says which copy.\n */\nexport function liveBlockIdOf(data: {\n __dev_id?: unknown;\n id?: unknown;\n key?: unknown;\n path?: string;\n}): string | undefined {\n const devId = typeof data.__dev_id === 'string' ? data.__dev_id.replace(/~\\d+$/, '') : undefined;\n const id = devId ?? data.id ?? data.key;\n if (typeof id === 'number' || (typeof id === 'string' && id)) return String(id);\n return data.path || undefined;\n}\n\n/** A theme can name its header or footer for the editor: `data-live-editor=\"header\"`. */\nexport const AREA_ATTRIBUTE = 'data-live-editor';\n\n/** Header and footer of themes that don't mark theirs: the engine's own, and Raed's. */\nexport const AREA_FALLBACKS = {\n header: 'header.store-header, header.site-header',\n footer: '.store-footer',\n} as const;\n\nexport type Area = keyof typeof AREA_FALLBACKS;\n\n/** The origin of the page that frames this one, or `null` at the top or when unknown. */\nexport function parentOrigin(): string | null {\n if (window.self === window.top) return null;\n // Chromium and Safari name it directly; Firefox only through the referrer.\n const ancestor = window.location.ancestorOrigins?.[0];\n if (ancestor) return ancestor;\n try {\n return document.referrer ? new URL(document.referrer).origin : null;\n } catch {\n return null;\n }\n}\n\nfunction isBetaEditor(origin: string): boolean {\n try {\n const { protocol, hostname, port } = new URL(origin);\n return protocol === 'https:' && !port && hostname.endsWith(BETA_EDITOR_HOST_SUFFIX);\n } catch {\n return false;\n }\n}\n\n/**\n * On a dev server, a page on another localhost port (an editor run locally, or\n * a test harness) can frame the store too. Not its own origin: that is the\n * engine's dev editor, which has its own controls.\n */\nfunction isLocalEditor(origin: string): boolean {\n if (origin === window.location.origin) return false;\n try {\n const { protocol, hostname } = new URL(origin);\n return protocol === 'http:' && (hostname === 'localhost' || hostname === '127.0.0.1');\n } catch {\n return false;\n }\n}\n\n/** The theme editor's origin when it frames this page, otherwise `null`. Browser only. */\nexport function editorOrigin(): string | null {\n if (typeof window === 'undefined') return null;\n let origin: string | null;\n try {\n origin = parentOrigin();\n } catch {\n return null;\n }\n if (!origin) return null;\n if ((EDITOR_ORIGINS as readonly string[]).includes(origin) || isBetaEditor(origin)) return origin;\n return import.meta.env.DEV && isLocalEditor(origin) ? origin : null;\n}\n\nexport interface EditorFrame {\n origin: string;\n /** The engine's own dev editor (`/__twilight/editor`): edits apply live, and blocks can't be hidden. */\n dev: boolean;\n}\n\n/** The editor framing this page, the merchant's or (on a dev server) the engine's own. Browser only. */\nexport function editorFrame(): EditorFrame | null {\n if (typeof window === 'undefined') return null;\n if (import.meta.env.DEV && isEditorFrame()) return { origin: window.location.origin, dev: true };\n const origin = editorOrigin();\n return origin ? { origin, dev: false } : null;\n}\n\n/**\n * The theme as the editor's preview shows it: a sticky header would pin over the\n * blocks scrolled under it and cover their action bar, so the header scrolls away.\n */\nexport function previewTheme(theme: Theme): Theme {\n if (theme.settings?.header_is_sticky === false) return theme;\n return { ...theme, settings: { ...theme.settings, header_is_sticky: false } };\n}\n\nexport function postToEditor(\n origin: string,\n action: LiveEditorMessage | typeof FRAME_LOADED_ACTION,\n data?: { id: string; copy?: number; moved?: boolean }\n): void {\n window.parent.postMessage({ action, data, is_salla: true }, origin);\n}\n\n/** The header or footer `el` stands for, if any. One inside a dialog (a sheet's copy) is not it. */\nexport function areaOf(el: Element): Area | null {\n if (el.closest('[role=\"dialog\"]')) return null;\n const marked = el.getAttribute(AREA_ATTRIBUTE);\n if (marked === 'header' || marked === 'footer') return marked;\n if (el.matches(AREA_FALLBACKS.header)) return 'header';\n if (el.matches(AREA_FALLBACKS.footer)) return 'footer';\n return null;\n}\n\n/** What the editor can act on: a block with an id, the header, or the footer. */\nexport const TARGET_SELECTOR = [\n `[${BLOCK_ATTRIBUTE}]`,\n `[${AREA_ATTRIBUTE}=\"header\"]`,\n `[${AREA_ATTRIBUTE}=\"footer\"]`,\n AREA_FALLBACKS.header,\n AREA_FALLBACKS.footer,\n].join(', ');\n\n/** The block, header or footer under `node`, nearest first. */\nexport function targetOf(node: EventTarget | null): HTMLElement | null {\n let el = node instanceof Element ? node.closest<HTMLElement>(TARGET_SELECTOR) : null;\n while (el) {\n if (el.hasAttribute(BLOCK_ATTRIBUTE) || areaOf(el)) return el;\n el = el.parentElement?.closest<HTMLElement>(TARGET_SELECTOR) ?? null;\n }\n return null;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { api } from './chunk-XQEWBUQ2.js';
1
+ import { api } from './chunk-ID2UT4AE.js';
2
2
  import { getTwilightContext } from './chunk-MWUAHDQL.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
@@ -23,5 +23,5 @@ var menu = {
23
23
  };
24
24
 
25
25
  export { menu };
26
- //# sourceMappingURL=chunk-KHK4UPEO.js.map
27
- //# sourceMappingURL=chunk-KHK4UPEO.js.map
26
+ //# sourceMappingURL=chunk-KNOIQCGE.js.map
27
+ //# sourceMappingURL=chunk-KNOIQCGE.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/menu.ts"],"names":[],"mappings":";;;;AAKO,IAAM,IAAA,GAAO;AAAA,EAClB,QAAQ,YAAiC;AACvC,IAAA,MAAM,EAAE,MAAA,EAAO,GAAI,kBAAA,EAAmB;AACtC,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,kBAAA,EAAqB,MAAM,CAAA,CAAE,CAAA,CAAE,IAAA,EAA2B;AACzF,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA,EAEA,QAAQ,YAAiC;AACvC,IAAA,MAAM,EAAE,MAAA,EAAO,GAAI,kBAAA,EAAmB;AACtC,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,kBAAA,EAAqB,MAAM,CAAA,CAAE,CAAA,CAAE,IAAA,EAA2B;AACzF,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,MACN,YAAA,CAAa;AAAA,MACX,UAAU,CAAC,OAAA,EAAS,QAAA,EAAU,kBAAA,GAAqB,MAAM,CAAA;AAAA,MACzD,OAAA,EAAS,MAAM,IAAA,CAAK,MAAA,EAAO;AAAA,MAC3B,SAAA,EAAW,IAAI,EAAA,GAAK;AAAA,KACrB;AAAA;AAEP","file":"chunk-KHK4UPEO.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport { getTwilightContext } from '../twilight/context';\nimport type { MenuItem } from '../types';\n\nexport const menu = {\n header: async (): Promise<MenuItem[]> => {\n const { locale } = getTwilightContext();\n const { data } = await api.get(`menus/header?lang=${locale}`).json<{ data: MenuItem[] }>();\n return data || [];\n },\n\n footer: async (): Promise<MenuItem[]> => {\n const { locale } = getTwilightContext();\n const { data } = await api.get(`menus/footer?lang=${locale}`).json<{ data: MenuItem[] }>();\n return data || [];\n },\n\n queries: {\n header: () =>\n queryOptions({\n queryKey: ['menus', 'header', getTwilightContext().locale],\n queryFn: () => menu.header(),\n staleTime: 5 * 60 * 1000,\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/menu.ts"],"names":[],"mappings":";;;;AAKO,IAAM,IAAA,GAAO;AAAA,EAClB,QAAQ,YAAiC;AACvC,IAAA,MAAM,EAAE,MAAA,EAAO,GAAI,kBAAA,EAAmB;AACtC,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,kBAAA,EAAqB,MAAM,CAAA,CAAE,CAAA,CAAE,IAAA,EAA2B;AACzF,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA,EAEA,QAAQ,YAAiC;AACvC,IAAA,MAAM,EAAE,MAAA,EAAO,GAAI,kBAAA,EAAmB;AACtC,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,kBAAA,EAAqB,MAAM,CAAA,CAAE,CAAA,CAAE,IAAA,EAA2B;AACzF,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,MACN,YAAA,CAAa;AAAA,MACX,UAAU,CAAC,OAAA,EAAS,QAAA,EAAU,kBAAA,GAAqB,MAAM,CAAA;AAAA,MACzD,OAAA,EAAS,MAAM,IAAA,CAAK,MAAA,EAAO;AAAA,MAC3B,SAAA,EAAW,IAAI,EAAA,GAAK;AAAA,KACrB;AAAA;AAEP","file":"chunk-KNOIQCGE.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport { getTwilightContext } from '../twilight/context';\nimport type { MenuItem } from '../types';\n\nexport const menu = {\n header: async (): Promise<MenuItem[]> => {\n const { locale } = getTwilightContext();\n const { data } = await api.get(`menus/header?lang=${locale}`).json<{ data: MenuItem[] }>();\n return data || [];\n },\n\n footer: async (): Promise<MenuItem[]> => {\n const { locale } = getTwilightContext();\n const { data } = await api.get(`menus/footer?lang=${locale}`).json<{ data: MenuItem[] }>();\n return data || [];\n },\n\n queries: {\n header: () =>\n queryOptions({\n queryKey: ['menus', 'header', getTwilightContext().locale],\n queryFn: () => menu.header(),\n staleTime: 5 * 60 * 1000,\n }),\n },\n};\n"]}
@@ -147,7 +147,7 @@ function takeFrameReport(message) {
147
147
  async function answerLookup(message) {
148
148
  const { requestId, source, query } = message;
149
149
  try {
150
- const { lookupInStore } = await import('./store-lookup-ER67ZNEB.js');
150
+ const { lookupInStore } = await import('./store-lookup-NRR66HZ7.js');
151
151
  sendToEditor({ kind: "lookup-result", requestId, items: await lookupInStore(source, query) });
152
152
  } catch (error) {
153
153
  sendToEditor({
@@ -500,5 +500,5 @@ function useDevLayoutBlocks(components) {
500
500
  var useDevHomeBlocks = import.meta.env.DEV ? useDevLayoutBlocks : (components) => components;
501
501
 
502
502
  export { blockPath, devSettingsStore, useDevEditorMeta, useDevHomeBlocks, useDevReportSettingsFetchedAt, useDevSettingsOverrides, useDevSettingsState };
503
- //# sourceMappingURL=chunk-QRAYSZPX.js.map
504
- //# sourceMappingURL=chunk-QRAYSZPX.js.map
503
+ //# sourceMappingURL=chunk-M4MMTQ75.js.map
504
+ //# sourceMappingURL=chunk-M4MMTQ75.js.map