@salla.sa/twilight-theme-engine 1.0.168 → 1.0.170

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 (300) hide show
  1. package/dist/{AddToCartForm-MJET75YK.js → AddToCartForm-N5KRFZHA.js} +3 -3
  2. package/dist/{AddToCartForm-MJET75YK.js.map → AddToCartForm-N5KRFZHA.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-STM7CHCX.js → BlogAuthorPage-CFZJ4GBK.js} +30 -30
  4. package/dist/{BlogAuthorPage-STM7CHCX.js.map → BlogAuthorPage-CFZJ4GBK.js.map} +1 -1
  5. package/dist/{BlogCategoryPage-4RC5Z3S5.js → BlogCategoryPage-U234IWSO.js} +30 -30
  6. package/dist/{BlogCategoryPage-4RC5Z3S5.js.map → BlogCategoryPage-U234IWSO.js.map} +1 -1
  7. package/dist/{BlogPage-YTCOYYNJ.js → BlogPage-S3UANDPF.js} +28 -28
  8. package/dist/{BlogPage-YTCOYYNJ.js.map → BlogPage-S3UANDPF.js.map} +1 -1
  9. package/dist/{BlogSinglePage-ZA645VKI.js → BlogSinglePage-VGQOKXCD.js} +28 -28
  10. package/dist/{BlogSinglePage-ZA645VKI.js.map → BlogSinglePage-VGQOKXCD.js.map} +1 -1
  11. package/dist/{BlogTagPage-H5ZAKDY3.js → BlogTagPage-H2JY5LUB.js} +30 -30
  12. package/dist/{BlogTagPage-H5ZAKDY3.js.map → BlogTagPage-H2JY5LUB.js.map} +1 -1
  13. package/dist/{BrandsPage-EI3RXI7P.js → BrandsPage-DILFCLUR.js} +29 -29
  14. package/dist/{BrandsPage-EI3RXI7P.js.map → BrandsPage-DILFCLUR.js.map} +1 -1
  15. package/dist/{Breadcrumb-2VTKPEDN.js → Breadcrumb-AWJTQ3UI.js} +28 -28
  16. package/dist/{Breadcrumb-2VTKPEDN.js.map → Breadcrumb-AWJTQ3UI.js.map} +1 -1
  17. package/dist/{CartItem-GQQFSJWY.js → CartItem-3MUT6WOD.js} +28 -28
  18. package/dist/{CartItem-GQQFSJWY.js.map → CartItem-3MUT6WOD.js.map} +1 -1
  19. package/dist/{CartSummary-QLFV3PMY.js → CartSummary-WDDX4RO6.js} +28 -28
  20. package/dist/{CartSummary-QLFV3PMY.js.map → CartSummary-WDDX4RO6.js.map} +1 -1
  21. package/dist/{Copyright-Y5YOBPMO.js → Copyright-3VHGRYFB.js} +3 -3
  22. package/dist/{Copyright-Y5YOBPMO.js.map → Copyright-3VHGRYFB.js.map} +1 -1
  23. package/dist/{CustomerLayout-4J4PXFCZ.js → CustomerLayout-4AXP2TSB.js} +28 -28
  24. package/dist/{CustomerLayout-4J4PXFCZ.js.map → CustomerLayout-4AXP2TSB.js.map} +1 -1
  25. package/dist/{Footer-FFAPF75A.js → Footer-2EMD7B6K.js} +4 -4
  26. package/dist/{Footer-FFAPF75A.js.map → Footer-2EMD7B6K.js.map} +1 -1
  27. package/dist/GoogleTag-CEYIEWCD.js +15 -0
  28. package/dist/{GoogleTag-KJQJWIGL.js.map → GoogleTag-CEYIEWCD.js.map} +1 -1
  29. package/dist/Header-BWUDOZIG.js +24 -0
  30. package/dist/{Header-V4UEPHWU.js.map → Header-BWUDOZIG.js.map} +1 -1
  31. package/dist/{LatestProducts-BQXOELU5.js → LatestProducts-FGBUOJNV.js} +30 -30
  32. package/dist/{LatestProducts-BQXOELU5.js.map → LatestProducts-FGBUOJNV.js.map} +1 -1
  33. package/dist/{LoyaltyPage-6UTFEXKJ.js → LoyaltyPage-GZRK5ALQ.js} +28 -28
  34. package/dist/{LoyaltyPage-6UTFEXKJ.js.map → LoyaltyPage-GZRK5ALQ.js.map} +1 -1
  35. package/dist/{LoyaltyPointsPage-BUI2AQ6D.js → LoyaltyPointsPage-UQEPGH4O.js} +9 -9
  36. package/dist/{LoyaltyPointsPage-BUI2AQ6D.js.map → LoyaltyPointsPage-UQEPGH4O.js.map} +1 -1
  37. package/dist/{MainMenu-BY4YGIKY.js → MainMenu-SJIJTJDI.js} +8 -8
  38. package/dist/{MainMenu-BY4YGIKY.js.map → MainMenu-SJIJTJDI.js.map} +1 -1
  39. package/dist/MaintenancePage-SFZN7G27.js +7 -0
  40. package/dist/{MaintenancePage-U5P43D52.js.map → MaintenancePage-SFZN7G27.js.map} +1 -1
  41. package/dist/{MasterLayout-NFUEMWTA.js → MasterLayout-UKYVRBWD.js} +28 -28
  42. package/dist/{MasterLayout-NFUEMWTA.js.map → MasterLayout-UKYVRBWD.js.map} +1 -1
  43. package/dist/{MobileMenu-7CBD3WLM.js → MobileMenu-EXT5NER6.js} +29 -29
  44. package/dist/{MobileMenu-7CBD3WLM.js.map → MobileMenu-EXT5NER6.js.map} +1 -1
  45. package/dist/{NotificationsPage-3MBXQY44.js → NotificationsPage-JKPLPPRY.js} +28 -28
  46. package/dist/{NotificationsPage-3MBXQY44.js.map → NotificationsPage-JKPLPPRY.js.map} +1 -1
  47. package/dist/{OrderSinglePage-5VLPW436.js → OrderSinglePage-YEZUALDJ.js} +29 -29
  48. package/dist/{OrderSinglePage-5VLPW436.js.map → OrderSinglePage-YEZUALDJ.js.map} +1 -1
  49. package/dist/{OrdersPage-4XHZMJHG.js → OrdersPage-3NX6H3M2.js} +28 -28
  50. package/dist/{OrdersPage-4XHZMJHG.js.map → OrdersPage-3NX6H3M2.js.map} +1 -1
  51. package/dist/{PageSingle-ISZVV5KV.js → PageSingle-WHCTDTN4.js} +7 -7
  52. package/dist/{PageSingle-ISZVV5KV.js.map → PageSingle-WHCTDTN4.js.map} +1 -1
  53. package/dist/{ProductDetails-AGXBUXNF.js → ProductDetails-6A4NQZUG.js} +8 -8
  54. package/dist/{ProductDetails-AGXBUXNF.js.map → ProductDetails-6A4NQZUG.js.map} +1 -1
  55. package/dist/{ProfilePage-FJOR5B3D.js → ProfilePage-4JN4FWDL.js} +28 -28
  56. package/dist/{ProfilePage-FJOR5B3D.js.map → ProfilePage-4JN4FWDL.js.map} +1 -1
  57. package/dist/{ReviewsPage-7LUNOZ6K.js → ReviewsPage-Z72EVOUP.js} +3 -3
  58. package/dist/{ReviewsPage-7LUNOZ6K.js.map → ReviewsPage-Z72EVOUP.js.map} +1 -1
  59. package/dist/{SeoCartWidget-QZEXYDDZ.js → SeoCartWidget-YTUXIE5K.js} +28 -28
  60. package/dist/{SeoCartWidget-QZEXYDDZ.js.map → SeoCartWidget-YTUXIE5K.js.map} +1 -1
  61. package/dist/{SettingsPage-ISAJVECQ.js → SettingsPage-KP3TZA6T.js} +28 -28
  62. package/dist/{SettingsPage-ISAJVECQ.js.map → SettingsPage-KP3TZA6T.js.map} +1 -1
  63. package/dist/{StoreClosedNotification-N3IBELFL.js → StoreClosedNotification-PKCCIWYS.js} +29 -29
  64. package/dist/{StoreClosedNotification-N3IBELFL.js.map → StoreClosedNotification-PKCCIWYS.js.map} +1 -1
  65. package/dist/{TestimonialsPage-JSCUGFKU.js → TestimonialsPage-L6TPOHFS.js} +7 -7
  66. package/dist/{TestimonialsPage-JSCUGFKU.js.map → TestimonialsPage-L6TPOHFS.js.map} +1 -1
  67. package/dist/{ThankYouPage-3IJMBXF4.js → ThankYouPage-AJQHNAMC.js} +28 -28
  68. package/dist/{ThankYouPage-3IJMBXF4.js.map → ThankYouPage-AJQHNAMC.js.map} +1 -1
  69. package/dist/{WalletPage-OGVRLC5Z.js → WalletPage-OODS46SY.js} +29 -29
  70. package/dist/{WalletPage-OGVRLC5Z.js.map → WalletPage-OODS46SY.js.map} +1 -1
  71. package/dist/{WebMcpTools-QLTEVKNZ.js → WebMcpTools-QER3LZDE.js} +10 -10
  72. package/dist/{WebMcpTools-QLTEVKNZ.js.map → WebMcpTools-QER3LZDE.js.map} +1 -1
  73. package/dist/{WishlistPage-O4CIL5EO.js → WishlistPage-CPFMDBOK.js} +30 -30
  74. package/dist/{WishlistPage-O4CIL5EO.js.map → WishlistPage-CPFMDBOK.js.map} +1 -1
  75. package/dist/api/advertisement.js +5 -5
  76. package/dist/api/apps.js +5 -5
  77. package/dist/api/blog.js +7 -7
  78. package/dist/api/brands.js +7 -7
  79. package/dist/api/cart.js +7 -7
  80. package/dist/api/category.js +7 -7
  81. package/dist/api/client.d.ts.map +1 -1
  82. package/dist/api/client.js +4 -4
  83. package/dist/api/custom-url.js +5 -5
  84. package/dist/api/home.js +5 -5
  85. package/dist/api/loyalty.js +7 -7
  86. package/dist/api/menu.js +5 -5
  87. package/dist/api/notification.js +5 -5
  88. package/dist/api/order.js +7 -7
  89. package/dist/api/page.js +7 -7
  90. package/dist/api/product.js +7 -7
  91. package/dist/api/profile.js +4 -4
  92. package/dist/api/store.js +6 -6
  93. package/dist/api/translations.js +5 -5
  94. package/dist/api/user.js +5 -5
  95. package/dist/api/wallet.js +5 -5
  96. package/dist/api/wishlist.js +8 -8
  97. package/dist/{chunk-24JPD5MN.js → chunk-2KZ7XUJU.js} +3 -3
  98. package/dist/{chunk-24JPD5MN.js.map → chunk-2KZ7XUJU.js.map} +1 -1
  99. package/dist/{chunk-MDE65FXE.js → chunk-4W3WHZMS.js} +5 -5
  100. package/dist/{chunk-MDE65FXE.js.map → chunk-4W3WHZMS.js.map} +1 -1
  101. package/dist/{chunk-YFAALRGJ.js → chunk-5BOLKNHR.js} +3 -3
  102. package/dist/{chunk-YFAALRGJ.js.map → chunk-5BOLKNHR.js.map} +1 -1
  103. package/dist/{chunk-24SECEZ4.js → chunk-5EQTMPDZ.js} +4 -4
  104. package/dist/{chunk-24SECEZ4.js.map → chunk-5EQTMPDZ.js.map} +1 -1
  105. package/dist/{chunk-LK643DPN.js → chunk-5VIATSFK.js} +3 -3
  106. package/dist/{chunk-LK643DPN.js.map → chunk-5VIATSFK.js.map} +1 -1
  107. package/dist/{chunk-TZOXDPIG.js → chunk-5VOMO5MU.js} +4 -4
  108. package/dist/{chunk-TZOXDPIG.js.map → chunk-5VOMO5MU.js.map} +1 -1
  109. package/dist/{chunk-I2WKCWOQ.js → chunk-6HIW7MTL.js} +9 -9
  110. package/dist/{chunk-I2WKCWOQ.js.map → chunk-6HIW7MTL.js.map} +1 -1
  111. package/dist/{chunk-CMBMJNKU.js → chunk-75EUSH73.js} +4 -4
  112. package/dist/{chunk-CMBMJNKU.js.map → chunk-75EUSH73.js.map} +1 -1
  113. package/dist/{chunk-7LP5WA3U.js → chunk-7EQX7PQH.js} +3 -3
  114. package/dist/{chunk-7LP5WA3U.js.map → chunk-7EQX7PQH.js.map} +1 -1
  115. package/dist/{chunk-M54B252W.js → chunk-7XV65HOU.js} +3 -3
  116. package/dist/{chunk-M54B252W.js.map → chunk-7XV65HOU.js.map} +1 -1
  117. package/dist/{chunk-5VG3PFTB.js → chunk-7YULQON5.js} +4 -4
  118. package/dist/{chunk-5VG3PFTB.js.map → chunk-7YULQON5.js.map} +1 -1
  119. package/dist/{chunk-EZ7U2LSG.js → chunk-ADILJ36S.js} +4 -4
  120. package/dist/{chunk-EZ7U2LSG.js.map → chunk-ADILJ36S.js.map} +1 -1
  121. package/dist/{chunk-3VII4U2I.js → chunk-AN75QHVE.js} +3 -3
  122. package/dist/{chunk-3VII4U2I.js.map → chunk-AN75QHVE.js.map} +1 -1
  123. package/dist/{chunk-LRJFPMD2.js → chunk-ASIK6ELH.js} +8 -8
  124. package/dist/{chunk-LRJFPMD2.js.map → chunk-ASIK6ELH.js.map} +1 -1
  125. package/dist/{chunk-6K34BCUP.js → chunk-AWV3WEKH.js} +12 -4
  126. package/dist/chunk-AWV3WEKH.js.map +1 -0
  127. package/dist/{chunk-QHTO6H7T.js → chunk-DDH4NPLR.js} +3 -3
  128. package/dist/{chunk-QHTO6H7T.js.map → chunk-DDH4NPLR.js.map} +1 -1
  129. package/dist/{chunk-W2TVQNZT.js → chunk-DQ2N5TEK.js} +7 -7
  130. package/dist/{chunk-W2TVQNZT.js.map → chunk-DQ2N5TEK.js.map} +1 -1
  131. package/dist/{chunk-6IUO4G6Z.js → chunk-DWSLSXJ3.js} +5 -5
  132. package/dist/{chunk-6IUO4G6Z.js.map → chunk-DWSLSXJ3.js.map} +1 -1
  133. package/dist/{chunk-A5MCFXY2.js → chunk-F7YL2DOY.js} +5 -5
  134. package/dist/{chunk-A5MCFXY2.js.map → chunk-F7YL2DOY.js.map} +1 -1
  135. package/dist/{chunk-ILCDUF7M.js → chunk-FTVDHLIQ.js} +4 -4
  136. package/dist/{chunk-ILCDUF7M.js.map → chunk-FTVDHLIQ.js.map} +1 -1
  137. package/dist/{chunk-PQMG5FDD.js → chunk-G5V2MPC5.js} +4 -4
  138. package/dist/{chunk-PQMG5FDD.js.map → chunk-G5V2MPC5.js.map} +1 -1
  139. package/dist/{chunk-4B75V3OU.js → chunk-HTMXU4ZK.js} +3 -3
  140. package/dist/{chunk-4B75V3OU.js.map → chunk-HTMXU4ZK.js.map} +1 -1
  141. package/dist/{chunk-7P2ZLW6S.js → chunk-HVUC24DL.js} +4 -4
  142. package/dist/{chunk-7P2ZLW6S.js.map → chunk-HVUC24DL.js.map} +1 -1
  143. package/dist/{chunk-CZ6VJPCG.js → chunk-IDFWFDVF.js} +3 -3
  144. package/dist/{chunk-CZ6VJPCG.js.map → chunk-IDFWFDVF.js.map} +1 -1
  145. package/dist/{chunk-SY7ESZ44.js → chunk-IPW4JC7Z.js} +3 -3
  146. package/dist/{chunk-SY7ESZ44.js.map → chunk-IPW4JC7Z.js.map} +1 -1
  147. package/dist/{chunk-ZCBBDLJU.js → chunk-JS2UUQ5B.js} +5 -5
  148. package/dist/{chunk-ZCBBDLJU.js.map → chunk-JS2UUQ5B.js.map} +1 -1
  149. package/dist/{chunk-4YGEAIFB.js → chunk-JW4QTH2U.js} +3 -3
  150. package/dist/{chunk-4YGEAIFB.js.map → chunk-JW4QTH2U.js.map} +1 -1
  151. package/dist/{chunk-AKPRDR3B.js → chunk-KNVMG7LJ.js} +5 -5
  152. package/dist/{chunk-AKPRDR3B.js.map → chunk-KNVMG7LJ.js.map} +1 -1
  153. package/dist/{chunk-MJHYGAN3.js → chunk-KY2VNPZX.js} +4 -4
  154. package/dist/{chunk-MJHYGAN3.js.map → chunk-KY2VNPZX.js.map} +1 -1
  155. package/dist/{chunk-AWYEN6BR.js → chunk-LQY6T5AK.js} +4 -4
  156. package/dist/{chunk-AWYEN6BR.js.map → chunk-LQY6T5AK.js.map} +1 -1
  157. package/dist/{chunk-N6ZPXZ6I.js → chunk-MHWMDWOK.js} +9 -9
  158. package/dist/{chunk-N6ZPXZ6I.js.map → chunk-MHWMDWOK.js.map} +1 -1
  159. package/dist/{chunk-USK24DJ7.js → chunk-ODMEJVTL.js} +6 -6
  160. package/dist/{chunk-USK24DJ7.js.map → chunk-ODMEJVTL.js.map} +1 -1
  161. package/dist/{chunk-G3BVPJQL.js → chunk-OQDYOVAR.js} +7 -7
  162. package/dist/{chunk-G3BVPJQL.js.map → chunk-OQDYOVAR.js.map} +1 -1
  163. package/dist/{chunk-QAA4KBUH.js → chunk-OYZPZU4A.js} +4 -4
  164. package/dist/{chunk-QAA4KBUH.js.map → chunk-OYZPZU4A.js.map} +1 -1
  165. package/dist/{chunk-NKRWGDGH.js → chunk-P5KLE7KA.js} +7 -7
  166. package/dist/{chunk-NKRWGDGH.js.map → chunk-P5KLE7KA.js.map} +1 -1
  167. package/dist/{chunk-FYCIDZJW.js → chunk-P62RTWYQ.js} +37 -7
  168. package/dist/chunk-P62RTWYQ.js.map +1 -0
  169. package/dist/{chunk-7IW6QMVN.js → chunk-PJYPHDVM.js} +7 -7
  170. package/dist/{chunk-7IW6QMVN.js.map → chunk-PJYPHDVM.js.map} +1 -1
  171. package/dist/{chunk-3Y6HAX72.js → chunk-PQR776WF.js} +43 -6
  172. package/dist/chunk-PQR776WF.js.map +1 -0
  173. package/dist/{chunk-X55R4VVK.js → chunk-PZ4ARDUK.js} +3 -3
  174. package/dist/{chunk-X55R4VVK.js.map → chunk-PZ4ARDUK.js.map} +1 -1
  175. package/dist/{chunk-7QGUNZQI.js → chunk-QWHZO63B.js} +4 -4
  176. package/dist/{chunk-7QGUNZQI.js.map → chunk-QWHZO63B.js.map} +1 -1
  177. package/dist/{chunk-WIU2K7P7.js → chunk-R2QTV2BX.js} +3 -3
  178. package/dist/{chunk-WIU2K7P7.js.map → chunk-R2QTV2BX.js.map} +1 -1
  179. package/dist/{chunk-LOSHC7HD.js → chunk-RASX3WAM.js} +4 -4
  180. package/dist/{chunk-LOSHC7HD.js.map → chunk-RASX3WAM.js.map} +1 -1
  181. package/dist/{chunk-4D6MHAXI.js → chunk-RBTYXV7Z.js} +7 -7
  182. package/dist/{chunk-4D6MHAXI.js.map → chunk-RBTYXV7Z.js.map} +1 -1
  183. package/dist/{chunk-IXUYCRYA.js → chunk-RRCEFLFD.js} +3 -3
  184. package/dist/{chunk-IXUYCRYA.js.map → chunk-RRCEFLFD.js.map} +1 -1
  185. package/dist/{chunk-6S3RRREO.js → chunk-S5CMEVMB.js} +25 -25
  186. package/dist/{chunk-6S3RRREO.js.map → chunk-S5CMEVMB.js.map} +1 -1
  187. package/dist/{chunk-JUIALGO2.js → chunk-SDYSEO5A.js} +4 -4
  188. package/dist/{chunk-JUIALGO2.js.map → chunk-SDYSEO5A.js.map} +1 -1
  189. package/dist/{chunk-J5HHXQQO.js → chunk-SZ5FM2HR.js} +5 -5
  190. package/dist/{chunk-J5HHXQQO.js.map → chunk-SZ5FM2HR.js.map} +1 -1
  191. package/dist/{chunk-VSB6OH62.js → chunk-T3NWHBEO.js} +5 -5
  192. package/dist/{chunk-VSB6OH62.js.map → chunk-T3NWHBEO.js.map} +1 -1
  193. package/dist/{chunk-KHBMMAK7.js → chunk-TGOHNUQJ.js} +5 -5
  194. package/dist/{chunk-KHBMMAK7.js.map → chunk-TGOHNUQJ.js.map} +1 -1
  195. package/dist/{chunk-I62L6AEC.js → chunk-TPL7C44F.js} +3 -3
  196. package/dist/{chunk-I62L6AEC.js.map → chunk-TPL7C44F.js.map} +1 -1
  197. package/dist/{chunk-ENHT7GRB.js → chunk-TPLORTAB.js} +7 -7
  198. package/dist/{chunk-ENHT7GRB.js.map → chunk-TPLORTAB.js.map} +1 -1
  199. package/dist/{chunk-HWFTMI37.js → chunk-UF7APKW2.js} +3 -3
  200. package/dist/{chunk-HWFTMI37.js.map → chunk-UF7APKW2.js.map} +1 -1
  201. package/dist/{chunk-UB22F4FC.js → chunk-ULGMHZXV.js} +3 -3
  202. package/dist/{chunk-UB22F4FC.js.map → chunk-ULGMHZXV.js.map} +1 -1
  203. package/dist/{chunk-5IM34REC.js → chunk-USSE7F4G.js} +4 -4
  204. package/dist/{chunk-5IM34REC.js.map → chunk-USSE7F4G.js.map} +1 -1
  205. package/dist/{chunk-ANECYRP2.js → chunk-VI2MEH77.js} +23 -19
  206. package/dist/chunk-VI2MEH77.js.map +1 -0
  207. package/dist/{chunk-2VUFGJHL.js → chunk-VUTFOCYS.js} +5 -5
  208. package/dist/{chunk-2VUFGJHL.js.map → chunk-VUTFOCYS.js.map} +1 -1
  209. package/dist/{chunk-5MOYPNLN.js → chunk-WIRMHJF3.js} +4 -4
  210. package/dist/{chunk-5MOYPNLN.js.map → chunk-WIRMHJF3.js.map} +1 -1
  211. package/dist/{chunk-AHR2RGKC.js → chunk-WZNSF45B.js} +3 -3
  212. package/dist/{chunk-AHR2RGKC.js.map → chunk-WZNSF45B.js.map} +1 -1
  213. package/dist/{chunk-5OIZY4FF.js → chunk-YGWCFYTF.js} +5 -5
  214. package/dist/{chunk-5OIZY4FF.js.map → chunk-YGWCFYTF.js.map} +1 -1
  215. package/dist/{chunk-4E5X7COD.js → chunk-YKWH7W75.js} +5 -5
  216. package/dist/{chunk-4E5X7COD.js.map → chunk-YKWH7W75.js.map} +1 -1
  217. package/dist/{chunk-MSZVSP2O.js → chunk-YZU3GL3K.js} +3 -3
  218. package/dist/{chunk-MSZVSP2O.js.map → chunk-YZU3GL3K.js.map} +1 -1
  219. package/dist/{chunk-Y2JWGES7.js → chunk-ZJUQMRLD.js} +6 -6
  220. package/dist/{chunk-Y2JWGES7.js.map → chunk-ZJUQMRLD.js.map} +1 -1
  221. package/dist/components/cart/index.js +1 -1
  222. package/dist/components/common/index.js +1 -1
  223. package/dist/components/drawer/index.js +26 -26
  224. package/dist/components/home/index.js +31 -31
  225. package/dist/components/layout/index.js +7 -7
  226. package/dist/components/product/index.js +28 -28
  227. package/dist/components/store/index.js +28 -28
  228. package/dist/components/toast/index.js +5 -5
  229. package/dist/components/tracking/index.js +10 -10
  230. package/dist/custom-urls-JDYZLJSU.js +17 -0
  231. package/dist/{custom-urls-2JI5ITZZ.js.map → custom-urls-JDYZLJSU.js.map} +1 -1
  232. package/dist/dev/editor/index.js +3 -3
  233. package/dist/dev/index.js +3 -3
  234. package/dist/document-class-CZ2DCXTF.js +38 -0
  235. package/dist/{document-class-UAA7Q3HO.js.map → document-class-CZ2DCXTF.js.map} +1 -1
  236. package/dist/hooks/index.js +26 -26
  237. package/dist/hooks/useComments.js +4 -4
  238. package/dist/hooks/useGtm.js +26 -26
  239. package/dist/hooks/useMoney.js +26 -26
  240. package/dist/hooks/useProduct.js +4 -4
  241. package/dist/hooks/useStore.js +26 -26
  242. package/dist/hooks/useUser.js +6 -6
  243. package/dist/hooks/useWishlist.js +4 -4
  244. package/dist/index.js +26 -26
  245. package/dist/native-app/index.js +4 -4
  246. package/dist/navigation-6LMWRB3S.js +15 -0
  247. package/dist/{navigation-H57C5F3A.js.map → navigation-6LMWRB3S.js.map} +1 -1
  248. package/dist/{navigation-MMMUJNJL.js → navigation-IZVDSLQ5.js} +8 -8
  249. package/dist/{navigation-MMMUJNJL.js.map → navigation-IZVDSLQ5.js.map} +1 -1
  250. package/dist/{not-found-ILLMC2E6.js → not-found-FVQDUMNN.js} +29 -29
  251. package/dist/{not-found-ILLMC2E6.js.map → not-found-FVQDUMNN.js.map} +1 -1
  252. package/dist/providers/index.js +26 -26
  253. package/dist/routes/account/orders.js +9 -9
  254. package/dist/routes/account.js +18 -18
  255. package/dist/routes/blog.js +13 -13
  256. package/dist/routes/brands.js +9 -9
  257. package/dist/routes/cart.js +35 -35
  258. package/dist/routes/home.js +32 -32
  259. package/dist/routes/index.js +13 -13
  260. package/dist/routes/loyalty.js +10 -10
  261. package/dist/routes/page.js +9 -9
  262. package/dist/routes/product-listing.js +36 -36
  263. package/dist/routes/product.js +35 -35
  264. package/dist/routes/root/beforeLoad.d.ts.map +1 -1
  265. package/dist/routes/seo-redirects.js +13 -13
  266. package/dist/routes/testimonials.js +5 -5
  267. package/dist/routes/thank-you.js +9 -9
  268. package/dist/skeleton.js +32 -32
  269. package/dist/{store-lookup-756PL3AO.js → store-lookup-ATPY4J4T.js} +12 -12
  270. package/dist/{store-lookup-756PL3AO.js.map → store-lookup-ATPY4J4T.js.map} +1 -1
  271. package/dist/tanstack/middleware/twilight.d.ts.map +1 -1
  272. package/dist/tanstack.js +28 -26
  273. package/dist/tanstack.js.map +1 -1
  274. package/dist/twilight/context.d.ts +7 -0
  275. package/dist/twilight/context.d.ts.map +1 -1
  276. package/dist/types/index.d.ts +6 -0
  277. package/dist/types/index.d.ts.map +1 -1
  278. package/dist/utils/api-base.d.ts +26 -0
  279. package/dist/utils/api-base.d.ts.map +1 -0
  280. package/dist/utils/baseHead.js +3 -3
  281. package/dist/utils/index.js +7 -7
  282. package/dist/utils/runtime-env.d.ts +1 -1
  283. package/dist/utils/runtime-env.d.ts.map +1 -1
  284. package/dist/utils/store-base.d.ts +39 -0
  285. package/dist/utils/store-base.d.ts.map +1 -1
  286. package/dist/utils/store-identity.d.ts +9 -0
  287. package/dist/utils/store-identity.d.ts.map +1 -1
  288. package/dist/vite/index.js +5 -5
  289. package/package.json +1 -1
  290. package/tailwind/routes/root/beforeLoad.ts.txt +14 -2
  291. package/dist/GoogleTag-KJQJWIGL.js +0 -15
  292. package/dist/Header-V4UEPHWU.js +0 -24
  293. package/dist/MaintenancePage-U5P43D52.js +0 -7
  294. package/dist/chunk-3Y6HAX72.js.map +0 -1
  295. package/dist/chunk-6K34BCUP.js.map +0 -1
  296. package/dist/chunk-ANECYRP2.js.map +0 -1
  297. package/dist/chunk-FYCIDZJW.js.map +0 -1
  298. package/dist/custom-urls-2JI5ITZZ.js +0 -17
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AAA,GAAW,IAAI,GAAA,CAAI,eAAe,CAAA;AACxC,EAAA,OAAO,MAAA,CAAO,OAAA,CAAQ,gBAAA,IAAoB,EAAE,EAAE,MAAA,CAAO,CAAC,CAAC,IAAI,CAAA,KAAM;AAC/D,IAAA,MAAM,OAAA,GAAU,wBAAA,CAAyB,IAAA,CAAK,IAAI,IAAI,CAAC,CAAA;AACvD,IAAA,IAAI,CAAC,OAAA,IAAW,eAAA,CAAgB,GAAA,CAAI,OAAO,GAAG,OAAO,KAAA;AACrD,IAAA,OAAO,CAAC,QAAA,CAAS,GAAA,CAAI,OAAO,CAAA,IAAK,0BAAA,CAA2B,IAAI,OAAO,CAAA;AAAA,EACzE,CAAC,CAAA;AACH","file":"chunk-M54B252W.js","sourcesContent":["/**\n * The data a Twig storefront hands Google Tag Manager, built in the browser.\n *\n * On Twig the Store writes it on the server (the `Salla\\GoogleTags` package): each page opens\n * with one `dataLayer.push` naming the page, the store and the customer, plus the page's own\n * ecommerce block (a product's `detail`, the cart's `checkout`, an order's `purchase`). Salla's\n * container and the merchants' own containers read these exact keys, so every builder here\n * copies a PHP one, named beside it. A list's `impressions` copies `<salla-products-list>`\n * instead, which pushes them itself on Twig.\n */\nimport type { Cart, CartItem, Money, Product, User } from '../../types';\nimport type { Order, OrderItem } from '../../routes/account/types';\nimport type { StoreContext } from '../../api/store';\nimport type { PageContext } from '../../twilight/context';\nimport { getActiveCurrency } from '../../api/client';\nimport { RouteId } from '../../router/route-ids';\n\nexport type DataLayerEntry = Record<string, unknown>;\n\n/** True when the store loads a Tag Manager container; without one nothing reads the data layer. */\nexport function gtmEnabled(settings: StoreContext | undefined): boolean {\n return Boolean(settings?.store?.settings?.keys?.gtm?.length);\n}\n\nexport function pushToDataLayer(entry: DataLayerEntry): void {\n if (typeof window === 'undefined') return;\n window.dataLayer = window.dataLayer ?? [];\n window.dataLayer.push(entry);\n}\n\n/**\n * Twig's `dataLayer` proxy (`googletagmanager::head`): it drops request, payment and form\n * fields from every object pushed after it. The root head runs it before anything is pushed;\n * GTM's own script runs it too, for a theme that loads GTM by hand. Once per page.\n */\nexport const DATA_LAYER_PROXY_SCRIPT = `\nwindow.dataLayer = window.dataLayer || [];\nif (!window.__sallaDataLayerProxy) {\n window.__sallaDataLayerProxy = true;\n window.dataLayer = new Proxy(window.dataLayer, {\n set(target, property, value) {\n target[property] = value;\n if (typeof value === 'object') {\n ['form_data', 'data', 'gateway', 'config', 'request', 'headers']\n .forEach(function(key) { value && value.hasOwnProperty(key) && delete value[key]; });\n }\n return true;\n }\n });\n}\n`.trim();\n\n// ─── page ────────────────────────────────────────────────────────────────────\n\n/**\n * `page.pageName`: the Laravel route that renders the page on Twig, camel-cased without\n * `store` (`RequestResolver::getPageName`). The containers compare it: `productShow`,\n * `catShow`, `cartShow`, `search`, `brandsShow`, `thankyou`.\n */\nconst PAGE_NAMES: Record<string, string> = {\n [RouteId.INDEX]: 'home', // store.home\n [RouteId.PRODUCT_SINGLE]: 'productShow', // product.showWithSlug → product.show\n [RouteId.PRODUCT_INDEX]: 'catShow', // cat.showWithSlug → cat.show\n [RouteId.SEARCH]: 'search', // store.search\n [RouteId.PRODUCT_INDEX_LATEST]: 'latestProducts', // store.latest-products\n [RouteId.PRODUCT_INDEX_OFFERS]: 'productOffers', // product.offers\n [RouteId.BRANDS_INDEX]: 'brands', // store.brands\n [RouteId.BRANDS_SINGLE]: 'brandsShow', // store.brands.show\n [RouteId.CART]: 'cartShow', // cart.show\n [RouteId.THANK_YOU]: 'thankyou', // store.thankyou\n [RouteId.BLOG_INDEX]: 'blogIndex', // blog.index\n [RouteId.BLOG_SINGLE]: 'articlesShow', // articles.show\n [RouteId.BLOG_INDEX_CATEGORY]: 'articlesCategoryShow', // articles.category.show\n [RouteId.BLOG_INDEX_TAG]: 'articlesTagShow', // articles.tag.show\n [RouteId.PAGE_SINGLE]: 'pagesSlugShow', // pages.slug.show\n [RouteId.CUSTOMER_PROFILE]: 'userIndex', // user.index\n [RouteId.CUSTOMER_ORDERS_INDEX]: 'myorders', // store.myorders\n [RouteId.CUSTOMER_ORDERS_INDEX_PENDING]: 'myPendingOrders', // store.my_pending_orders\n [RouteId.CUSTOMER_ORDERS_SINGLE]: 'myOrder', // store.my_order\n [RouteId.CUSTOMER_WISHLIST]: 'myWishes', // store.my_wishes\n [RouteId.CUSTOMER_NOTIFICATIONS]: 'userNotificationsIndex', // user.notifications.index\n [RouteId.CUSTOMER_WALLET]: 'wallet', // wallet\n [RouteId.CUSTOMER_LOYALTY_POINTS]: 'customerLoyaltyPoints', // customer.loyalty_points\n [RouteId.LOYALTY]: 'loyaltyProgram', // store.loyalty_program\n [RouteId.TESTIMONIALS]: 'reviewsIndex', // store.reviews.index\n};\n\n/** A page with no known Twig route is named after its slug, camel-cased the same way. */\nexport function gtmPageName(slug: string): string {\n return (\n PAGE_NAMES[slug] ??\n slug.replace(/[._-]+([a-z0-9])/gi, (_, letter: string) => letter.toUpperCase())\n );\n}\n\n/** A fresh 40-hex id, as Twig's `sha1(… now()->timestamp)` gives each page and event one. */\nexport function gtmEventId(): string {\n const bytes = new Uint8Array(20);\n globalThis.crypto.getRandomValues(bytes);\n return Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');\n}\n\n/** `config('theme.name')`: a number on Salla's themes. */\nfunction themeName(settings: StoreContext | undefined): string | number | undefined {\n const name = settings?.theme?.name;\n return name && /^\\d+$/.test(name) ? Number(name) : name;\n}\n\nexport interface GtmPageInput {\n slug: string;\n referrer: string;\n /** Inside the Salla app's webview (`mobileAgent()->is()`). */\n mobileApp: boolean;\n}\n\n/** `RequestResolver::getData`. */\nexport function gtmPage(input: GtmPageInput, settings: StoreContext | undefined): DataLayerEntry {\n return {\n fingerprint: gtmEventId(),\n pageName: gtmPageName(input.slug),\n mobileApp: input.mobileApp ? 1 : 0,\n referrer: input.referrer,\n theme: themeName(settings),\n };\n}\n\n/**\n * `StoreResolver::getData`. The settings API sends none of the legacy built-in pixel ids\n * (`facebook_pixel_id`, …), so they are null, as Twig sends them for a store that set none.\n */\nexport function gtmStore(settings: StoreContext | undefined): DataLayerEntry {\n return {\n store: settings?.store?.username ?? '',\n facebook_pixel_id: null,\n google_analytics_id: null,\n snapchat_pixel_id: null,\n };\n}\n\n// ─── customer ────────────────────────────────────────────────────────────────\n\nasync function sha256(value: string): Promise<string | null> {\n const subtle = globalThis.crypto?.subtle;\n if (!subtle) return null;\n const digest = await subtle.digest('SHA-256', new TextEncoder().encode(value));\n return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, '0')).join('');\n}\n\n/** Lower-cased, no whitespace, and only a valid address (Twig: `FILTER_VALIDATE_EMAIL`). */\nfunction cleanEmail(email: string | undefined): string | null {\n const clean = email?.replace(/\\s+/g, '').toLowerCase();\n return clean && /^[^@]+@[^@]+\\.[^@]+$/.test(clean) ? clean : null;\n}\n\n/** E.164 without the plus (`966501234567`), as `fullMobileFormat(false)`; null when it isn't one. */\nfunction cleanPhone(mobile: string | undefined): string | null {\n const compact = mobile?.replace(/[\\s()-]+/g, '') ?? '';\n const digits = compact.startsWith('+')\n ? compact.slice(1)\n : compact.startsWith('00')\n ? compact.slice(2)\n : compact;\n return /^[1-9]\\d{7,14}$/.test(digits) ? digits : null;\n}\n\n/** `Store\\CustomerResolver::getData`: a guest is `{ isGuest: true }`. */\nexport async function gtmCustomer(\n user: User | null | undefined,\n settings: StoreContext | undefined\n): Promise<DataLayerEntry> {\n if (!user) return { isGuest: true };\n const email = cleanEmail(user.email);\n const phone = cleanPhone(user.mobile);\n const phoneWithPlus = phone ? `+${phone}` : null;\n const [firstName, lastName, emailHashed, phoneHashed, phoneWithPlusHashed] = await Promise.all([\n sha256(user.first_name ?? ''),\n sha256(user.last_name ?? ''),\n email ? sha256(email) : null,\n phone ? sha256(phone) : null,\n phoneWithPlus ? sha256(phoneWithPlus) : null,\n ]);\n return {\n isGuest: false,\n name: [user.first_name, user.last_name].filter(Boolean).join(' '),\n first_name: firstName,\n last_name: lastName,\n created_at: user.created_at ?? Math.floor(Date.now() / 1000),\n email,\n phone,\n phone_with_plus: phoneWithPlus,\n phone_with_plus_hashed: phoneWithPlusHashed,\n currency: user.preferences?.currency_code ?? settings?.user?.currency_code ?? 'SAR',\n email_hashed: emailHashed,\n phone_hashed: phoneHashed,\n };\n}\n\n// ─── money ───────────────────────────────────────────────────────────────────\n\nconst amountOf = (value: number | string | Money | null | undefined): number =>\n value && typeof value === 'object' ? Number(value.amount) || 0 : Number(value) || 0;\n\n/**\n * The currency prices are shown in: the visitor's choice, else the market's own (settings\n * `user.currency_code`; `OMR` on an Omani market of a Saudi store), as `currency()` on Twig.\n */\nexport function gtmCurrency(settings: StoreContext | undefined, fallback?: string): string {\n return getActiveCurrency() ?? fallback ?? settings?.user?.currency_code ?? 'SAR';\n}\n\n/**\n * `getGoogleTagManagerExchangeRate`: riyals per unit of `code`, as moneyphp prints a ratio.\n * Settings give each currency's `amount` per riyal.\n */\nexport function gtmExchangeRate(code: string, settings: StoreContext | undefined): string {\n const perRiyal = Number(settings?.currencies?.[code]?.amount);\n if (code === 'SAR' || !(perRiyal > 0)) return '1';\n return String(Number((1 / perRiyal).toPrecision(14)));\n}\n\n// ─── ecommerce ───────────────────────────────────────────────────────────────\n\nexport interface GtmProduct {\n id: number | string;\n name: string;\n categories: Array<{ id?: number | string; name: string }>;\n category: string;\n price: number;\n quantity: number;\n variant: string | null;\n brand: string;\n image: string;\n}\n\n/** `IsTaggingProduct::getGoogleTagManagerData`. */\nexport function gtmProduct(product: Product): GtmProduct {\n const categories = product.category\n ? [{ id: product.category.id, name: product.category.name }]\n : [];\n return {\n id: product.id,\n name: product.name,\n categories,\n category: categories.map((category) => category.name).join('/'),\n price: amountOf(product.price),\n quantity: 1,\n variant: '',\n brand: product.brand?.name ?? '',\n image: product.image?.url ?? '',\n };\n}\n\n/** `GoogleTagManager::detail`, which the product page pushes with its page data. */\nexport function gtmDetail(product: Product, settings: StoreContext | undefined): DataLayerEntry {\n const currencyCode = gtmCurrency(settings, product.currency);\n return {\n event: 'detail',\n ecommerce: {\n currencyCode,\n exchangeRate: gtmExchangeRate(currencyCode, settings),\n event_id: gtmEventId(),\n detail: { products: [gtmProduct(product)] },\n },\n };\n}\n\n/** `CartItem::getGoogleTagManagerData`: the cart line's taxed total as its price. */\nfunction gtmCartItem(item: CartItem, currency: string): DataLayerEntry {\n return {\n id: item.product_id,\n name: item.product_name,\n categories: [],\n category: '',\n price: amountOf(item.total),\n quantity: item.quantity,\n variant: null,\n brand: '',\n image: item.product_image ?? '',\n cart_item_id: item.id,\n currency,\n };\n}\n\n/**\n * `GoogleTagManager::checkout`, from the cart page's `SeoCartWidget` (step 1). It sets no\n * `event`: on Twig it rides on the page's own push. Only the available lines, and no order\n * options, as `getAvailableItems()` and the macro leave them out.\n */\nexport function gtmCartCheckout(\n cart: Cart,\n settings: StoreContext | undefined,\n step = 1\n): DataLayerEntry {\n const currencyCode = gtmCurrency(settings);\n const total = amountOf(cart.total);\n return {\n ecommerce: {\n currencyCode,\n exchangeRate: gtmExchangeRate(currencyCode, settings),\n event_id: gtmEventId(),\n checkout: {\n actionField: {\n id: cart.id,\n total,\n revenue: total,\n currency_code: currencyCode,\n step,\n },\n products: cart.items\n .filter((item) => item.is_available !== false && String(item.type) !== 'order_option')\n .map((item) => gtmCartItem(item, currencyCode)),\n },\n },\n };\n}\n\n/** `OrderItems::getGoogleTagManagerData`: the line before its discount, tax included. */\nfunction gtmOrderItem(item: OrderItem, currency: string): DataLayerEntry | null {\n if (!item.product) return null;\n return {\n id: item.product.id,\n name: item.name,\n categories: [],\n category: '',\n price: amountOf(item.amounts?.total) + amountOf(item.amounts?.total_discount),\n quantity: item.quantity,\n variant: null,\n brand: '',\n image: item.thumbnail ?? item.product_thumbnail ?? item.image ?? '',\n currency,\n };\n}\n\n/** `GoogleTagManager::purchase`, from the thank-you page's `SeoThankYouWidget`. */\nexport function gtmPurchase(order: Order, settings: StoreContext | undefined): DataLayerEntry {\n const currencyCode = order.currency || gtmCurrency(settings);\n const total = amountOf(order.amounts?.total);\n return {\n event: 'purchase',\n ecommerce: {\n currencyCode,\n exchangeRate: gtmExchangeRate(currencyCode, settings),\n event_id: order.id,\n purchase: {\n actionField: {\n id: order.id,\n total,\n revenue: total,\n currency_code: currencyCode,\n step: null,\n },\n products: (order.items ?? [])\n .map((item) => gtmOrderItem(item, currencyCode))\n .filter((item): item is DataLayerEntry => item !== null),\n },\n },\n };\n}\n\n/**\n * The `impressions` `<salla-products-list>` pushes for each page of products it fetches\n * (`appendDataLayer`), with the page's title and id where a product names no category.\n */\nexport function gtmImpressions(\n products: Product[],\n page: PageContext | undefined,\n settings: StoreContext | undefined\n): DataLayerEntry {\n return {\n event: 'impressions',\n ecommerce: {\n currencyCode: gtmCurrency(settings),\n impressions: products.map((product, index) => {\n const category = product.category?.name || page?.title;\n return {\n id: product.id,\n name: product.name,\n price: amountOf(product.price),\n brand: product.brand?.name || '',\n quantity: product.quantity,\n categories: [{ name: category, id: page?.id }],\n category,\n position: index + 1,\n };\n }),\n },\n };\n}\n\n// ─── services ────────────────────────────────────────────────────────────────\n\n/** Services Twig renders itself rather than announcing (`ExternalServicesWidget::$serviceWidgets`). */\nconst WIDGET_SERVICES = new Set([\n 'google_tags_manager',\n 'mailchimp',\n 'addon-mailchimp-marketing',\n 'klaviyo',\n]);\n\n/** Apps with a snippet that Twig still announces (`ExternalServicesWidget::$serviceTracking`). */\nconst ANNOUNCED_SNIPPET_SERVICES = new Set(['facebook_pixel', 'tiktok_pixel', 'google_analytics']);\n\n/**\n * The `services::<name>.init` events a Twig page dispatches through the SDK, which copies each\n * into the data layer, where Salla's container loads GA4, Google Ads, Clarity and the pixels\n * from them. The settings API lists every active service; Twig leaves out the ones it renders\n * as a widget and the apps whose snippet the page loads instead.\n */\nexport function servicesInitEvents(\n externalServices: StoreContext['external_services'],\n snippetServices: Iterable<string>\n): Array<[name: string, payload: unknown]> {\n const snippets = new Set(snippetServices);\n return Object.entries(externalServices ?? {}).filter(([name]) => {\n const service = /^services::(.+)\\.init$/.exec(name)?.[1];\n if (!service || WIDGET_SERVICES.has(service)) return false;\n return !snippets.has(service) || ANNOUNCED_SNIPPET_SERVICES.has(service);\n });\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/analytics/gtm.ts"],"names":[],"mappings":";;;;AAoBO,SAAS,WAAW,QAAA,EAA6C;AACtE,EAAA,OAAO,QAAQ,QAAA,EAAU,KAAA,EAAO,QAAA,EAAU,IAAA,EAAM,KAAK,MAAM,CAAA;AAC7D;AAEO,SAAS,gBAAgB,KAAA,EAA6B;AAC3D,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,EAAA,MAAA,CAAO,SAAA,GAAY,MAAA,CAAO,SAAA,IAAa,EAAC;AACxC,EAAA,MAAA,CAAO,SAAA,CAAU,KAAK,KAAK,CAAA;AAC7B;AAOO,IAAM,uBAAA,GAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA,CAerC,IAAA;AASF,IAAM,UAAA,GAAqC;AAAA,EACzC,CAAC,OAAA,CAAQ,KAAK,GAAG,MAAA;AAAA;AAAA,EACjB,CAAC,OAAA,CAAQ,cAAc,GAAG,aAAA;AAAA;AAAA,EAC1B,CAAC,OAAA,CAAQ,aAAa,GAAG,SAAA;AAAA;AAAA,EACzB,CAAC,OAAA,CAAQ,MAAM,GAAG,QAAA;AAAA;AAAA,EAClB,CAAC,OAAA,CAAQ,oBAAoB,GAAG,gBAAA;AAAA;AAAA,EAChC,CAAC,OAAA,CAAQ,oBAAoB,GAAG,eAAA;AAAA;AAAA,EAChC,CAAC,OAAA,CAAQ,YAAY,GAAG,QAAA;AAAA;AAAA,EACxB,CAAC,OAAA,CAAQ,aAAa,GAAG,YAAA;AAAA;AAAA,EACzB,CAAC,OAAA,CAAQ,IAAI,GAAG,UAAA;AAAA;AAAA,EAChB,CAAC,OAAA,CAAQ,SAAS,GAAG,UAAA;A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A,CACd,kBACA,eAAA,EACyC;AACzC,EAAA,MAAM,QAAA,GAAW,IAAI,GAAA,CAAI,eAAe,CAAA;AACxC,EAAA,OAAO,MAAA,CAAO,OAAA,CAAQ,gBAAA,IAAoB,EAAE,EAAE,MAAA,CAAO,CAAC,CAAC,IAAI,CAAA,KAAM;AAC/D,IAAA,MAAM,OAAA,GAAU,wBAAA,CAAyB,IAAA,CAAK,IAAI,IAAI,CAAC,CAAA;AACvD,IAAA,IAAI,CAAC,OAAA,IAAW,eAAA,CAAgB,GAAA,CAAI,OAAO,GAAG,OAAO,KAAA;AACrD,IAAA,OAAO,CAAC,QAAA,CAAS,GAAA,CAAI,OAAO,CAAA,IAAK,0BAAA,CAA2B,IAAI,OAAO,CAAA;AAAA,EACzE,CAAC,CAAA;AACH","file":"chunk-7XV65HOU.js","sourcesContent":["/**\n * The data a Twig storefront hands Google Tag Manager, built in the browser.\n *\n * On Twig the Store writes it on the server (the `Salla\\GoogleTags` package): each page opens\n * with one `dataLayer.push` naming the page, the store and the customer, plus the page's own\n * ecommerce block (a product's `detail`, the cart's `checkout`, an order's `purchase`). Salla's\n * container and the merchants' own containers read these exact keys, so every builder here\n * copies a PHP one, named beside it. A list's `impressions` copies `<salla-products-list>`\n * instead, which pushes them itself on Twig.\n */\nimport type { Cart, CartItem, Money, Product, User } from '../../types';\nimport type { Order, OrderItem } from '../../routes/account/types';\nimport type { StoreContext } from '../../api/store';\nimport type { PageContext } from '../../twilight/context';\nimport { getActiveCurrency } from '../../api/client';\nimport { RouteId } from '../../router/route-ids';\n\nexport type DataLayerEntry = Record<string, unknown>;\n\n/** True when the store loads a Tag Manager container; without one nothing reads the data layer. */\nexport function gtmEnabled(settings: StoreContext | undefined): boolean {\n return Boolean(settings?.store?.settings?.keys?.gtm?.length);\n}\n\nexport function pushToDataLayer(entry: DataLayerEntry): void {\n if (typeof window === 'undefined') return;\n window.dataLayer = window.dataLayer ?? [];\n window.dataLayer.push(entry);\n}\n\n/**\n * Twig's `dataLayer` proxy (`googletagmanager::head`): it drops request, payment and form\n * fields from every object pushed after it. The root head runs it before anything is pushed;\n * GTM's own script runs it too, for a theme that loads GTM by hand. Once per page.\n */\nexport const DATA_LAYER_PROXY_SCRIPT = `\nwindow.dataLayer = window.dataLayer || [];\nif (!window.__sallaDataLayerProxy) {\n window.__sallaDataLayerProxy = true;\n window.dataLayer = new Proxy(window.dataLayer, {\n set(target, property, value) {\n target[property] = value;\n if (typeof value === 'object') {\n ['form_data', 'data', 'gateway', 'config', 'request', 'headers']\n .forEach(function(key) { value && value.hasOwnProperty(key) && delete value[key]; });\n }\n return true;\n }\n });\n}\n`.trim();\n\n// ─── page ────────────────────────────────────────────────────────────────────\n\n/**\n * `page.pageName`: the Laravel route that renders the page on Twig, camel-cased without\n * `store` (`RequestResolver::getPageName`). The containers compare it: `productShow`,\n * `catShow`, `cartShow`, `search`, `brandsShow`, `thankyou`.\n */\nconst PAGE_NAMES: Record<string, string> = {\n [RouteId.INDEX]: 'home', // store.home\n [RouteId.PRODUCT_SINGLE]: 'productShow', // product.showWithSlug → product.show\n [RouteId.PRODUCT_INDEX]: 'catShow', // cat.showWithSlug → cat.show\n [RouteId.SEARCH]: 'search', // store.search\n [RouteId.PRODUCT_INDEX_LATEST]: 'latestProducts', // store.latest-products\n [RouteId.PRODUCT_INDEX_OFFERS]: 'productOffers', // product.offers\n [RouteId.BRANDS_INDEX]: 'brands', // store.brands\n [RouteId.BRANDS_SINGLE]: 'brandsShow', // store.brands.show\n [RouteId.CART]: 'cartShow', // cart.show\n [RouteId.THANK_YOU]: 'thankyou', // store.thankyou\n [RouteId.BLOG_INDEX]: 'blogIndex', // blog.index\n [RouteId.BLOG_SINGLE]: 'articlesShow', // articles.show\n [RouteId.BLOG_INDEX_CATEGORY]: 'articlesCategoryShow', // articles.category.show\n [RouteId.BLOG_INDEX_TAG]: 'articlesTagShow', // articles.tag.show\n [RouteId.PAGE_SINGLE]: 'pagesSlugShow', // pages.slug.show\n [RouteId.CUSTOMER_PROFILE]: 'userIndex', // user.index\n [RouteId.CUSTOMER_ORDERS_INDEX]: 'myorders', // store.myorders\n [RouteId.CUSTOMER_ORDERS_INDEX_PENDING]: 'myPendingOrders', // store.my_pending_orders\n [RouteId.CUSTOMER_ORDERS_SINGLE]: 'myOrder', // store.my_order\n [RouteId.CUSTOMER_WISHLIST]: 'myWishes', // store.my_wishes\n [RouteId.CUSTOMER_NOTIFICATIONS]: 'userNotificationsIndex', // user.notifications.index\n [RouteId.CUSTOMER_WALLET]: 'wallet', // wallet\n [RouteId.CUSTOMER_LOYALTY_POINTS]: 'customerLoyaltyPoints', // customer.loyalty_points\n [RouteId.LOYALTY]: 'loyaltyProgram', // store.loyalty_program\n [RouteId.TESTIMONIALS]: 'reviewsIndex', // store.reviews.index\n};\n\n/** A page with no known Twig route is named after its slug, camel-cased the same way. */\nexport function gtmPageName(slug: string): string {\n return (\n PAGE_NAMES[slug] ??\n slug.replace(/[._-]+([a-z0-9])/gi, (_, letter: string) => letter.toUpperCase())\n );\n}\n\n/** A fresh 40-hex id, as Twig's `sha1(… now()->timestamp)` gives each page and event one. */\nexport function gtmEventId(): string {\n const bytes = new Uint8Array(20);\n globalThis.crypto.getRandomValues(bytes);\n return Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');\n}\n\n/** `config('theme.name')`: a number on Salla's themes. */\nfunction themeName(settings: StoreContext | undefined): string | number | undefined {\n const name = settings?.theme?.name;\n return name && /^\\d+$/.test(name) ? Number(name) : name;\n}\n\nexport interface GtmPageInput {\n slug: string;\n referrer: string;\n /** Inside the Salla app's webview (`mobileAgent()->is()`). */\n mobileApp: boolean;\n}\n\n/** `RequestResolver::getData`. */\nexport function gtmPage(input: GtmPageInput, settings: StoreContext | undefined): DataLayerEntry {\n return {\n fingerprint: gtmEventId(),\n pageName: gtmPageName(input.slug),\n mobileApp: input.mobileApp ? 1 : 0,\n referrer: input.referrer,\n theme: themeName(settings),\n };\n}\n\n/**\n * `StoreResolver::getData`. The settings API sends none of the legacy built-in pixel ids\n * (`facebook_pixel_id`, …), so they are null, as Twig sends them for a store that set none.\n */\nexport function gtmStore(settings: StoreContext | undefined): DataLayerEntry {\n return {\n store: settings?.store?.username ?? '',\n facebook_pixel_id: null,\n google_analytics_id: null,\n snapchat_pixel_id: null,\n };\n}\n\n// ─── customer ────────────────────────────────────────────────────────────────\n\nasync function sha256(value: string): Promise<string | null> {\n const subtle = globalThis.crypto?.subtle;\n if (!subtle) return null;\n const digest = await subtle.digest('SHA-256', new TextEncoder().encode(value));\n return Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, '0')).join('');\n}\n\n/** Lower-cased, no whitespace, and only a valid address (Twig: `FILTER_VALIDATE_EMAIL`). */\nfunction cleanEmail(email: string | undefined): string | null {\n const clean = email?.replace(/\\s+/g, '').toLowerCase();\n return clean && /^[^@]+@[^@]+\\.[^@]+$/.test(clean) ? clean : null;\n}\n\n/** E.164 without the plus (`966501234567`), as `fullMobileFormat(false)`; null when it isn't one. */\nfunction cleanPhone(mobile: string | undefined): string | null {\n const compact = mobile?.replace(/[\\s()-]+/g, '') ?? '';\n const digits = compact.startsWith('+')\n ? compact.slice(1)\n : compact.startsWith('00')\n ? compact.slice(2)\n : compact;\n return /^[1-9]\\d{7,14}$/.test(digits) ? digits : null;\n}\n\n/** `Store\\CustomerResolver::getData`: a guest is `{ isGuest: true }`. */\nexport async function gtmCustomer(\n user: User | null | undefined,\n settings: StoreContext | undefined\n): Promise<DataLayerEntry> {\n if (!user) return { isGuest: true };\n const email = cleanEmail(user.email);\n const phone = cleanPhone(user.mobile);\n const phoneWithPlus = phone ? `+${phone}` : null;\n const [firstName, lastName, emailHashed, phoneHashed, phoneWithPlusHashed] = await Promise.all([\n sha256(user.first_name ?? ''),\n sha256(user.last_name ?? ''),\n email ? sha256(email) : null,\n phone ? sha256(phone) : null,\n phoneWithPlus ? sha256(phoneWithPlus) : null,\n ]);\n return {\n isGuest: false,\n name: [user.first_name, user.last_name].filter(Boolean).join(' '),\n first_name: firstName,\n last_name: lastName,\n created_at: user.created_at ?? Math.floor(Date.now() / 1000),\n email,\n phone,\n phone_with_plus: phoneWithPlus,\n phone_with_plus_hashed: phoneWithPlusHashed,\n currency: user.preferences?.currency_code ?? settings?.user?.currency_code ?? 'SAR',\n email_hashed: emailHashed,\n phone_hashed: phoneHashed,\n };\n}\n\n// ─── money ───────────────────────────────────────────────────────────────────\n\nconst amountOf = (value: number | string | Money | null | undefined): number =>\n value && typeof value === 'object' ? Number(value.amount) || 0 : Number(value) || 0;\n\n/**\n * The currency prices are shown in: the visitor's choice, else the market's own (settings\n * `user.currency_code`; `OMR` on an Omani market of a Saudi store), as `currency()` on Twig.\n */\nexport function gtmCurrency(settings: StoreContext | undefined, fallback?: string): string {\n return getActiveCurrency() ?? fallback ?? settings?.user?.currency_code ?? 'SAR';\n}\n\n/**\n * `getGoogleTagManagerExchangeRate`: riyals per unit of `code`, as moneyphp prints a ratio.\n * Settings give each currency's `amount` per riyal.\n */\nexport function gtmExchangeRate(code: string, settings: StoreContext | undefined): string {\n const perRiyal = Number(settings?.currencies?.[code]?.amount);\n if (code === 'SAR' || !(perRiyal > 0)) return '1';\n return String(Number((1 / perRiyal).toPrecision(14)));\n}\n\n// ─── ecommerce ───────────────────────────────────────────────────────────────\n\nexport interface GtmProduct {\n id: number | string;\n name: string;\n categories: Array<{ id?: number | string; name: string }>;\n category: string;\n price: number;\n quantity: number;\n variant: string | null;\n brand: string;\n image: string;\n}\n\n/** `IsTaggingProduct::getGoogleTagManagerData`. */\nexport function gtmProduct(product: Product): GtmProduct {\n const categories = product.category\n ? [{ id: product.category.id, name: product.category.name }]\n : [];\n return {\n id: product.id,\n name: product.name,\n categories,\n category: categories.map((category) => category.name).join('/'),\n price: amountOf(product.price),\n quantity: 1,\n variant: '',\n brand: product.brand?.name ?? '',\n image: product.image?.url ?? '',\n };\n}\n\n/** `GoogleTagManager::detail`, which the product page pushes with its page data. */\nexport function gtmDetail(product: Product, settings: StoreContext | undefined): DataLayerEntry {\n const currencyCode = gtmCurrency(settings, product.currency);\n return {\n event: 'detail',\n ecommerce: {\n currencyCode,\n exchangeRate: gtmExchangeRate(currencyCode, settings),\n event_id: gtmEventId(),\n detail: { products: [gtmProduct(product)] },\n },\n };\n}\n\n/** `CartItem::getGoogleTagManagerData`: the cart line's taxed total as its price. */\nfunction gtmCartItem(item: CartItem, currency: string): DataLayerEntry {\n return {\n id: item.product_id,\n name: item.product_name,\n categories: [],\n category: '',\n price: amountOf(item.total),\n quantity: item.quantity,\n variant: null,\n brand: '',\n image: item.product_image ?? '',\n cart_item_id: item.id,\n currency,\n };\n}\n\n/**\n * `GoogleTagManager::checkout`, from the cart page's `SeoCartWidget` (step 1). It sets no\n * `event`: on Twig it rides on the page's own push. Only the available lines, and no order\n * options, as `getAvailableItems()` and the macro leave them out.\n */\nexport function gtmCartCheckout(\n cart: Cart,\n settings: StoreContext | undefined,\n step = 1\n): DataLayerEntry {\n const currencyCode = gtmCurrency(settings);\n const total = amountOf(cart.total);\n return {\n ecommerce: {\n currencyCode,\n exchangeRate: gtmExchangeRate(currencyCode, settings),\n event_id: gtmEventId(),\n checkout: {\n actionField: {\n id: cart.id,\n total,\n revenue: total,\n currency_code: currencyCode,\n step,\n },\n products: cart.items\n .filter((item) => item.is_available !== false && String(item.type) !== 'order_option')\n .map((item) => gtmCartItem(item, currencyCode)),\n },\n },\n };\n}\n\n/** `OrderItems::getGoogleTagManagerData`: the line before its discount, tax included. */\nfunction gtmOrderItem(item: OrderItem, currency: string): DataLayerEntry | null {\n if (!item.product) return null;\n return {\n id: item.product.id,\n name: item.name,\n categories: [],\n category: '',\n price: amountOf(item.amounts?.total) + amountOf(item.amounts?.total_discount),\n quantity: item.quantity,\n variant: null,\n brand: '',\n image: item.thumbnail ?? item.product_thumbnail ?? item.image ?? '',\n currency,\n };\n}\n\n/** `GoogleTagManager::purchase`, from the thank-you page's `SeoThankYouWidget`. */\nexport function gtmPurchase(order: Order, settings: StoreContext | undefined): DataLayerEntry {\n const currencyCode = order.currency || gtmCurrency(settings);\n const total = amountOf(order.amounts?.total);\n return {\n event: 'purchase',\n ecommerce: {\n currencyCode,\n exchangeRate: gtmExchangeRate(currencyCode, settings),\n event_id: order.id,\n purchase: {\n actionField: {\n id: order.id,\n total,\n revenue: total,\n currency_code: currencyCode,\n step: null,\n },\n products: (order.items ?? [])\n .map((item) => gtmOrderItem(item, currencyCode))\n .filter((item): item is DataLayerEntry => item !== null),\n },\n },\n };\n}\n\n/**\n * The `impressions` `<salla-products-list>` pushes for each page of products it fetches\n * (`appendDataLayer`), with the page's title and id where a product names no category.\n */\nexport function gtmImpressions(\n products: Product[],\n page: PageContext | undefined,\n settings: StoreContext | undefined\n): DataLayerEntry {\n return {\n event: 'impressions',\n ecommerce: {\n currencyCode: gtmCurrency(settings),\n impressions: products.map((product, index) => {\n const category = product.category?.name || page?.title;\n return {\n id: product.id,\n name: product.name,\n price: amountOf(product.price),\n brand: product.brand?.name || '',\n quantity: product.quantity,\n categories: [{ name: category, id: page?.id }],\n category,\n position: index + 1,\n };\n }),\n },\n };\n}\n\n// ─── services ────────────────────────────────────────────────────────────────\n\n/** Services Twig renders itself rather than announcing (`ExternalServicesWidget::$serviceWidgets`). */\nconst WIDGET_SERVICES = new Set([\n 'google_tags_manager',\n 'mailchimp',\n 'addon-mailchimp-marketing',\n 'klaviyo',\n]);\n\n/** Apps with a snippet that Twig still announces (`ExternalServicesWidget::$serviceTracking`). */\nconst ANNOUNCED_SNIPPET_SERVICES = new Set(['facebook_pixel', 'tiktok_pixel', 'google_analytics']);\n\n/**\n * The `services::<name>.init` events a Twig page dispatches through the SDK, which copies each\n * into the data layer, where Salla's container loads GA4, Google Ads, Clarity and the pixels\n * from them. The settings API lists every active service; Twig leaves out the ones it renders\n * as a widget and the apps whose snippet the page loads instead.\n */\nexport function servicesInitEvents(\n externalServices: StoreContext['external_services'],\n snippetServices: Iterable<string>\n): Array<[name: string, payload: unknown]> {\n const snippets = new Set(snippetServices);\n return Object.entries(externalServices ?? {}).filter(([name]) => {\n const service = /^services::(.+)\\.init$/.exec(name)?.[1];\n if (!service || WIDGET_SERVICES.has(service)) return false;\n return !snippets.has(service) || ANNOUNCED_SNIPPET_SERVICES.has(service);\n });\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { useOpeningHours } from './chunk-6S3RRREO.js';
2
- import { useIsProduct } from './chunk-USK24DJ7.js';
1
+ import { useOpeningHours } from './chunk-S5CMEVMB.js';
2
+ import { useIsProduct } from './chunk-ODMEJVTL.js';
3
3
  import { useTranslation } from './chunk-TYNZ5B2B.js';
4
4
  import { useTwilight } from './chunk-DF6FBKDN.js';
5
5
  import { useState } from 'react';
@@ -54,5 +54,5 @@ function StoreClosedNotification(_props) {
54
54
  }
55
55
 
56
56
  export { StoreClosedNotification };
57
- //# sourceMappingURL=chunk-5VG3PFTB.js.map
58
- //# sourceMappingURL=chunk-5VG3PFTB.js.map
57
+ //# sourceMappingURL=chunk-7YULQON5.js.map
58
+ //# sourceMappingURL=chunk-7YULQON5.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/store/StoreClosedNotification.tsx"],"names":[],"mappings":";;;;;;;AAsBO,SAAS,wBAAwB,MAAA,EAAsC;AAC5E,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,WAAA,EAAY;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,EAAE,QAAQ,SAAA,EAAW,iBAAA,KAAsB,eAAA,CAAgB,KAAA,CAAM,UAAU,aAAa,CAAA;AAC9F,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,SAAS,KAAK,CAAA;AAGhD,EAAA,MAAM,gBAAgB,YAAA,EAAa;AAGnC,EAAA,IAAI,CAAC,aAAA,IAAiB,CAAC,aAAa,MAAA,IAAU,SAAA,IAAa,CAAC,iBAAA,EAAmB;AAC7E,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,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","sourcesContent":["import { useState } from 'react';\nimport { useIsProduct } from '../../providers/NavigationProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useOpeningHours } from '../../hooks/useOpeningHours';\nimport { useTranslation } from '../../providers/I18nProvider';\n\nexport interface StoreClosedNotificationProps {\n /** Whether to show the notification (defaults to true when store is closed on product page) */\n show?: boolean;\n}\n\n/**\n * StoreClosedNotification - Shows a notification bar when the store is closed.\n *\n * Mirrors PHP ReceivingOrdersTimesWidget:\n * - Only shows on product pages\n * - Only shows when store is closed for receiving orders\n * - Displays when the store will open next\n * - Has a close button to dismiss\n *\n * Injected via hook registry at body:start.\n */\nexport function StoreClosedNotification(_props: StoreClosedNotificationProps) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const { isOpen, isEnabled, nextOpenFormatted } = useOpeningHours(store.settings?.opening_hours);\n const [dismissed, setDismissed] = useState(false);\n\n // Check if we're on a product page\n const isProductPage = useIsProduct();\n\n // Conditions: product page, opening hours enabled, store closed, not dismissed\n if (!isProductPage || !isEnabled || isOpen || dismissed || !nextOpenFormatted) {\n return null;\n }\n\n const handleClose = (e: React.MouseEvent) => {\n e.preventDefault();\n setDismissed(true);\n };\n\n return (\n <div\n className=\"store-notify\"\n id=\"store-closed-notification\"\n data-testid=\"store-closed-notification\"\n style={{\n backgroundColor: '#d63031',\n color: '#fff',\n padding: '10px 15px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'relative',\n }}\n >\n <a\n href=\"#\"\n id=\"notify-close\"\n onClick={handleClose}\n style={{ position: 'absolute', left: 15, color: '#fff', textDecoration: 'none' }}\n >\n <i className=\"sicon-cancel\" />\n </a>\n <p style={{ margin: 0, textAlign: 'center', flex: 1 }}>\n {t('store.closed_notification', {\n defaultValue: `المتجر حاليا مغلق لاستقبال الطلبات وسيتم فتحه (${nextOpenFormatted})`,\n nextOpen: nextOpenFormatted,\n })}\n </p>\n </div>\n );\n}\n"]}
1
+ {"version":3,"sources":["../src/components/store/Sto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,EAAE,QAAA,EAAU,UAAA,EAAY,MAAM,EAAA,EAAI,KAAA,EAAO,MAAA,EAAQ,cAAA,EAAgB,MAAA,EAAO;AAAA,YAE/E,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,cAAA,EAAe;AAAA;AAAA,SAC9B;AAAA,wBACA,GAAA,CAAC,GAAA,EAAA,EAAE,KAAA,EAAO,EAAE,MAAA,EAAQ,CAAA,EAAG,SAAA,EAAW,QAAA,EAAU,IAAA,EAAM,CAAA,EAAE,EACjD,QAAA,EAAA,CAAA,CAAE,2BAAA,EAA6B;AAAA,UAC9B,YAAA,EAAc,qPAAkD,iBAAiB,CAAA,CAAA,CAAA;AAAA,UACjF,QAAA,EAAU;AAAA,SACX,CAAA,EACH;AAAA;AAAA;AAAA,GACF;AAEJ","file":"chunk-7YULQON5.js","sourcesContent":["import { useState } from 'react';\nimport { useIsProduct } from '../../providers/NavigationProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useOpeningHours } from '../../hooks/useOpeningHours';\nimport { useTranslation } from '../../providers/I18nProvider';\n\nexport interface StoreClosedNotificationProps {\n /** Whether to show the notification (defaults to true when store is closed on product page) */\n show?: boolean;\n}\n\n/**\n * StoreClosedNotification - Shows a notification bar when the store is closed.\n *\n * Mirrors PHP ReceivingOrdersTimesWidget:\n * - Only shows on product pages\n * - Only shows when store is closed for receiving orders\n * - Displays when the store will open next\n * - Has a close button to dismiss\n *\n * Injected via hook registry at body:start.\n */\nexport function StoreClosedNotification(_props: StoreClosedNotificationProps) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const { isOpen, isEnabled, nextOpenFormatted } = useOpeningHours(store.settings?.opening_hours);\n const [dismissed, setDismissed] = useState(false);\n\n // Check if we're on a product page\n const isProductPage = useIsProduct();\n\n // Conditions: product page, opening hours enabled, store closed, not dismissed\n if (!isProductPage || !isEnabled || isOpen || dismissed || !nextOpenFormatted) {\n return null;\n }\n\n const handleClose = (e: React.MouseEvent) => {\n e.preventDefault();\n setDismissed(true);\n };\n\n return (\n <div\n className=\"store-notify\"\n id=\"store-closed-notification\"\n data-testid=\"store-closed-notification\"\n style={{\n backgroundColor: '#d63031',\n color: '#fff',\n padding: '10px 15px',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n position: 'relative',\n }}\n >\n <a\n href=\"#\"\n id=\"notify-close\"\n onClick={handleClose}\n style={{ position: 'absolute', left: 15, color: '#fff', textDecoration: 'none' }}\n >\n <i className=\"sicon-cancel\" />\n </a>\n <p style={{ margin: 0, textAlign: 'center', flex: 1 }}>\n {t('store.closed_notification', {\n defaultValue: `المتجر حاليا مغلق لاستقبال الطلبات وسيتم فتحه (${nextOpenFormatted})`,\n nextOpen: nextOpenFormatted,\n })}\n </p>\n </div>\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { api } from './chunk-FYCIDZJW.js';
2
- import { getTwilightContext } from './chunk-6K34BCUP.js';
1
+ import { api } from './chunk-P62RTWYQ.js';
2
+ import { getTwilightContext } from './chunk-AWV3WEKH.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
5
5
  var menu = {
@@ -23,5 +23,5 @@ var menu = {
23
23
  };
24
24
 
25
25
  export { menu };
26
- //# sourceMappingURL=chunk-EZ7U2LSG.js.map
27
- //# sourceMappingURL=chunk-EZ7U2LSG.js.map
26
+ //# sourceMappingURL=chunk-ADILJ36S.js.map
27
+ //# sourceMappingURL=chunk-ADILJ36S.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-EZ7U2LSG.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-ADILJ36S.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,4 +1,4 @@
1
- import { isNativeApp } from './chunk-UB22F4FC.js';
1
+ import { isNativeApp } from './chunk-ULGMHZXV.js';
2
2
  import { useTwilight } from './chunk-DF6FBKDN.js';
3
3
  import { useRef, useState, useEffect } from 'react';
4
4
  import { toast, Toaster as Toaster$1 } from 'sonner';
@@ -137,5 +137,5 @@ function Toaster({
137
137
  }
138
138
 
139
139
  export { Toaster };
140
- //# sourceMappingURL=chunk-3VII4U2I.js.map
141
- //# sourceMappingURL=chunk-3VII4U2I.js.map
140
+ //# sourceMappingURL=chunk-AN75QHVE.js.map
141
+ //# sourceMappingURL=chunk-AN75QHVE.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/toast/Toaster.tsx"],"names":["SonnerToaster"],"mappings":";;;;;;AAMA,IAAM,eAAA,GAAkB;AAAA,EACtB,KAAA,EAAO,gEAAA;AAAA,EACP,KAAA,EAAO,qBAAA;AAAA,EACP,WAAA,EAAa,4BAAA;AAAA,EACb,YAAA,EAAc,yCAAA;AAAA,EACd,YAAA,EAAc,+BAAA;AAAA,EACd,OAAA,EAAS,kEAAA;AAAA,EACT,KAAA,EAAO,4DAAA;AAAA,EACP,OAAA,EAAS,qEAAA;AAAA,EACT,IAAA,EAAM,+DAAA;AAAA,EACN,OAAA,EAAS;AACX,CAAA;AAKA,IAAM,iBAAA,GAAoB,GAAA;AAC1B,IAAM,kBAAA,GAAqB,WAAA;AAE3B,SAAS,mBAAA,CAAoB,IAAA,EAAoB,OAAA,EAAiB,KAAA,EAAgB;AAChF,EAAA,MAAM,QAAQ,MAAA,CAAO,KAAA;AACrB,EAAA,IAAI,CAAC,WAAA,EAAY,IAAK,CAAC,KAAA,EAAO,KAAA,EAAO,UAAU,OAAO,KAAA;AAEtD,EAAA,KAAA,CAAM,KAAA,CAAM,SAAS,kBAAA,EAAoB;AAAA,IACvC,IAAA;AAAA,IACA,OAAA;AAAA,IACA,GAAwB;AAAC,GAC1B,CAAA;AACD,EAAA,OAAO,IAAA;AACT;AAEO,SAAS,OAAA,CAAQ;AAAA,EACtB,cAAA,GAAiB,eAAA;AAAA,EACjB,cAAA,GAAiB;AACnB,CAAA,EAIG;AAC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AA,CAAQ,OAAA,EAAS,EAAE,QAAA,EAAU,KAAM,CAAA;AAAA,MAC3C,CAAA,MAAO;AACL,QAAA,KAAA,CAAM,KAAA,CAAM,OAAA,EAAS,EAAE,QAAA,EAAU,KAAM,CAAA;AAAA,MACzC;AAAA,IACF,GAAG,GAAG,CAAA;AAEN,IAAA,OAAO,MAAM,aAAa,KAAK,CAAA;AAAA,EACjC,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,uBACE,GAAA;AAAA,IAACA,SAAA;AAAA,IAAA;AAAA,MACC,QAAA;AAAA,MAIA,MAAA,EAAQ,EAAE,GAAA,EAAK,4CAAA,EAA6C;AAAA,MAC5D,YAAA,EAAc,EAAE,GAAA,EAAK,4CAAA,EAA6C;AAAA,MAClE,YAAA,EAAc;AAAA,QACZ,UAAA,EAAY,eAAA;AAAA,QACZ,KAAA,EAAO;AAAA,UACL,UAAA,EAAY;AAAA;AACd,OACF;AAAA,MACA,KAAA,EAAO;AAAA,QACL,UAAA,EAAY;AAAA;AACd;AAAA,GACF;AAEJ","file":"chunk-3VII4U2I.js","sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { Toaster as SonnerToaster, toast } from 'sonner';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { isNativeApp } from '../../native-app';\nimport type { ToastPosition } from './types';\n\nconst toastClassNames = {\n toast: 'group bg-white border-2 rounded-xl shadow-2xl p-4 font-primary',\n title: 'text-base font-bold',\n description: 'text-sm mt-1 text-gray-600',\n actionButton: 'bg-primary text-white px-3 py-1 rounded',\n cancelButton: 'bg-gray-100 px-3 py-1 rounded',\n success: 'border-green-500 [&_svg]:text-green-500 [&_aside]:text-green-700',\n error: 'border-red-500 [&_svg]:text-red-500 [&_aside]:text-red-700',\n warning: 'border-yellow-500 [&_svg]:text-yellow-500 [&_aside]:text-yellow-700',\n info: 'border-blue-500 [&_svg]:text-blue-500 [&_aside]:text-blue-700',\n loading: 'border-gray-400',\n};\n\ntype RawMessage = string | { title?: string; text?: string; icon?: string };\ntype ToastVariant = 'success' | 'error' | 'warning' | 'info';\n\nconst MOBILE_BREAKPOINT = 768;\nconst NATIVE_ALERT_EVENT = 'ui::alert';\n\nfunction dispatchNativeAlert(type: ToastVariant, message: string, title?: string) {\n const salla = window.salla;\n if (!isNativeApp() || !salla?.event?.dispatch) return false;\n\n salla.event.dispatch(NATIVE_ALERT_EVENT, {\n type,\n message,\n ...(title ? { title } : {}),\n });\n return true;\n}\n\nexport function Toaster({\n mobilePosition = 'bottom-center',\n addToCartToast = true,\n}: {\n mobilePosition?: ToastPosition;\n /** Show the default add-to-cart toast. Themes whose cart badge is the feedback can turn it off. */\n addToCartToast?: boolean;\n}) {\n const { theme } = useTwilight();\n const themeRef = useRef(theme);\n themeRef.current = theme;\n const flashShownRef = useRef(false);\n\n const isRtl = theme.is_rtl;\n const desktopPosition: ToastPosition = isRtl ? 'top-left' : 'top-right';\n\n const [position, setPosition] = useState<ToastPosition>(() => {\n if (typeof window === 'undefined') return desktopPosition;\n return window.innerWidth < MOBILE_BREAKPOINT ? mobilePosition : desktopPosition;\n });\n\n useEffect(() => {\n const handleResize = () => {\n setPosition(window.innerWidth < MOBILE_BREAKPOINT ? mobilePosition : desktopPosition);\n };\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [desktopPosition, mobilePosition]);\n\n useEffect(() => {\n const salla = window.salla;\n if (!salla) return;\n let active = true;\n\n const handleNotify = (message: RawMessage, type: string, data?: unknown) => {\n const eventData = data as { data?: { googleTags?: { event?: string } } } | undefined;\n const shouldSuppressAddToCartToast =\n (!addToCartToast || themeRef.current.settings?.enable_add_product_toast) &&\n eventData?.data?.googleTags?.event === 'addToCart';\n let title: string;\n let toastType: ToastVariant;\n\n if (typeof message === 'object' && message !== null) {\n title = message.title || message.text || '';\n toastType = (message.icon || type || 'info') as ToastVariant;\n } else {\n title = message;\n toastType = (type || 'info') as ToastVariant;\n }\n\n // Suppress the default addToCart toast when the theme opted out (addToCartToast=false)\n // or renders its own rich toast (enable_add_product_toast) so they don't double up.\n if (shouldSuppressAddToCartToast) {\n return;\n }\n\n if (dispatchNativeAlert(toastType, title)) {\n return;\n }\n\n if (toastType === 'success') {\n toast.success(title, { duration: 3000 });\n } else if (toastType === 'error') {\n toast.error(title, { duration: 3000 });\n } else if (toastType === 'warning') {\n toast.warning(title, { duration: 3000 });\n } else {\n toast.info(title, { duration: 3000 });\n }\n };\n\n // Before the SDK loads `salla` is the head stub, and the SDK's default notifier is alert().\n void (async () => {\n try {\n await salla.onReady?.();\n } catch {\n // onReady() may fail during partial initialization; the toast still beats alert().\n }\n if (active) salla.notify?.setNotifier?.(handleNotify);\n })();\n return () => {\n active = false;\n salla.notify?.setNotifier?.(() => {});\n };\n }, [addToCartToast]);\n\n useEffect(() => {\n if (flashShownRef.current || typeof window === 'undefined') return;\n\n const params = new URLSearchParams(window.location.search);\n const successMsg = params.get('success');\n const dangerMsg = params.get('danger');\n\n if (!successMsg && !dangerMsg) return;\n\n flashShownRef.current = true;\n\n const message = successMsg || dangerMsg || '';\n const toastType = dangerMsg ? 'error' : 'success';\n\n const url = new URL(window.location.href);\n url.searchParams.delete('success');\n url.searchParams.delete('danger');\n window.history.replaceState({}, '', url.toString());\n\n const timer = setTimeout(() => {\n if (dispatchNativeAlert(toastType, message)) return;\n\n if (toastType === 'success') {\n toast.success(message, { duration: 3000 });\n } else {\n toast.error(message, { duration: 3000 });\n }\n }, 100);\n\n return () => clearTimeout(timer);\n }, []);\n\n return (\n <SonnerToaster\n position={position}\n // Keep sonner's default gaps (24px desktop / 16px mobile) but clear the\n // native status bar inset (--app-safe-area-top, set by useSafeAreaInset)\n // so top-positioned toasts aren't covered in the app webview.\n offset={{ top: 'calc(var(--app-safe-area-top, 0px) + 24px)' }}\n mobileOffset={{ top: 'calc(var(--app-safe-area-top, 0px) + 16px)' }}\n toastOptions={{\n classNames: toastClassNames,\n style: {\n fontFamily: 'var(--font-main, inherit)',\n },\n }}\n style={{\n fontFamily: 'var(--font-main, inherit)',\n }}\n />\n );\n}\n\nexport type { ToasterProps } from 'sonner';\n"]}
1
+ {"version":3,"sources":["../src/components/toast/Toaster.tsx"],"names":["SonnerToaster"],"mappings":";;;;;;AAMA,IAAM,eAAA,GAAkB;AAAA,EACtB,KAAA,EAAO,gEAAA;AAAA,EACP,KAAA,EAAO,qBAAA;AAAA,EACP,WAAA,EAAa,4BAAA;AAAA,EACb,YAAA,EAAc,yCAAA;AAAA,EACd,YAAA,EAAc,+BAAA;AAAA,EACd,OAAA,EAAS,kEAAA;AAAA,EACT,KAAA,EAAO,4DAAA;AAAA,EACP,OAAA,EAAS,qEAAA;AAAA,EACT,IAAA,EAAM,+DAAA;AAAA,EACN,OAAA,EAAS;AACX,CAAA;AAKA,IAAM,iBAAA,GAAoB,GAAA;AAC1B,IAAM,kBAAA,GAAqB,WAAA;AAE3B,SAAS,mBAAA,CAAoB,IAAA,EAAoB,OAAA,EAAiB,KAAA,EAAgB;AAChF,EAAA,MAAM,QAAQ,MAAA,CAAO,KAAA;AACrB,EAAA,IAAI,CAAC,WAAA,EAAY,IAAK,CAAC,KAAA,EAAO,KAAA,EAAO,UAAU,OAAO,KAAA;AAEtD,EAAA,KAAA,CAAM,KAAA,CAAM,SAAS,kBAAA,EAAoB;AAAA,IACvC,IAAA;AAAA,IACA,OAAA;AAAA,IACA,GAAwB;AAAC,GAC1B,CAAA;AACD,EAAA,OAAO,IAAA;AACT;AAEO,SAAS,OAAA,CAAQ;AAAA,EACtB,cAAA,GAAiB,eAAA;AAAA,EACjB,cAAA,GAAiB;AACnB,CAAA,EAIG;AACD,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,WAAA,EAAY;AAC9B,EAAA,MAAM,QAAA,GAAW,OAAO,KAAK,CAAA;AAC7B,EAAA,QAAA,CAAS,OAAA,GAAU,KAAA;AACnB,EAAA,MAAM,aAAA,GAAgB,OAAO,KAAK,CAAA;AAElC,EAAA,MAAM,QAAQ,KAAA,CAAM,MAAA;AACpB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AA,EACjC,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,uBACE,GAAA;AAAA,IAACA,SAAA;AAAA,IAAA;AAAA,MACC,QAAA;AAAA,MAIA,MAAA,EAAQ,EAAE,GAAA,EAAK,4CAAA,EAA6C;AAAA,MAC5D,YAAA,EAAc,EAAE,GAAA,EAAK,4CAAA,EAA6C;AAAA,MAClE,YAAA,EAAc;AAAA,QACZ,UAAA,EAAY,eAAA;AAAA,QACZ,KAAA,EAAO;AAAA,UACL,UAAA,EAAY;AAAA;AACd,OACF;AAAA,MACA,KAAA,EAAO;AAAA,QACL,UAAA,EAAY;AAAA;AACd;AAAA,GACF;AAEJ","file":"chunk-AN75QHVE.js","sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { Toaster as SonnerToaster, toast } from 'sonner';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { isNativeApp } from '../../native-app';\nimport type { ToastPosition } from './types';\n\nconst toastClassNames = {\n toast: 'group bg-white border-2 rounded-xl shadow-2xl p-4 font-primary',\n title: 'text-base font-bold',\n description: 'text-sm mt-1 text-gray-600',\n actionButton: 'bg-primary text-white px-3 py-1 rounded',\n cancelButton: 'bg-gray-100 px-3 py-1 rounded',\n success: 'border-green-500 [&_svg]:text-green-500 [&_aside]:text-green-700',\n error: 'border-red-500 [&_svg]:text-red-500 [&_aside]:text-red-700',\n warning: 'border-yellow-500 [&_svg]:text-yellow-500 [&_aside]:text-yellow-700',\n info: 'border-blue-500 [&_svg]:text-blue-500 [&_aside]:text-blue-700',\n loading: 'border-gray-400',\n};\n\ntype RawMessage = string | { title?: string; text?: string; icon?: string };\ntype ToastVariant = 'success' | 'error' | 'warning' | 'info';\n\nconst MOBILE_BREAKPOINT = 768;\nconst NATIVE_ALERT_EVENT = 'ui::alert';\n\nfunction dispatchNativeAlert(type: ToastVariant, message: string, title?: string) {\n const salla = window.salla;\n if (!isNativeApp() || !salla?.event?.dispatch) return false;\n\n salla.event.dispatch(NATIVE_ALERT_EVENT, {\n type,\n message,\n ...(title ? { title } : {}),\n });\n return true;\n}\n\nexport function Toaster({\n mobilePosition = 'bottom-center',\n addToCartToast = true,\n}: {\n mobilePosition?: ToastPosition;\n /** Show the default add-to-cart toast. Themes whose cart badge is the feedback can turn it off. */\n addToCartToast?: boolean;\n}) {\n const { theme } = useTwilight();\n const themeRef = useRef(theme);\n themeRef.current = theme;\n const flashShownRef = useRef(false);\n\n const isRtl = theme.is_rtl;\n const desktopPosition: ToastPosition = isRtl ? 'top-left' : 'top-right';\n\n const [position, setPosition] = useState<ToastPosition>(() => {\n if (typeof window === 'undefined') return desktopPosition;\n return window.innerWidth < MOBILE_BREAKPOINT ? mobilePosition : desktopPosition;\n });\n\n useEffect(() => {\n const handleResize = () => {\n setPosition(window.innerWidth < MOBILE_BREAKPOINT ? mobilePosition : desktopPosition);\n };\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [desktopPosition, mobilePosition]);\n\n useEffect(() => {\n const salla = window.salla;\n if (!salla) return;\n let active = true;\n\n const handleNotify = (message: RawMessage, type: string, data?: unknown) => {\n const eventData = data as { data?: { googleTags?: { event?: string } } } | undefined;\n const shouldSuppressAddToCartToast =\n (!addToCartToast || themeRef.current.settings?.enable_add_product_toast) &&\n eventData?.data?.googleTags?.event === 'addToCart';\n let title: string;\n let toastType: ToastVariant;\n\n if (typeof message === 'object' && message !== null) {\n title = message.title || message.text || '';\n toastType = (message.icon || type || 'info') as ToastVariant;\n } else {\n title = message;\n toastType = (type || 'info') as ToastVariant;\n }\n\n // Suppress the default addToCart toast when the theme opted out (addToCartToast=false)\n // or renders its own rich toast (enable_add_product_toast) so they don't double up.\n if (shouldSuppressAddToCartToast) {\n return;\n }\n\n if (dispatchNativeAlert(toastType, title)) {\n return;\n }\n\n if (toastType === 'success') {\n toast.success(title, { duration: 3000 });\n } else if (toastType === 'error') {\n toast.error(title, { duration: 3000 });\n } else if (toastType === 'warning') {\n toast.warning(title, { duration: 3000 });\n } else {\n toast.info(title, { duration: 3000 });\n }\n };\n\n // Before the SDK loads `salla` is the head stub, and the SDK's default notifier is alert().\n void (async () => {\n try {\n await salla.onReady?.();\n } catch {\n // onReady() may fail during partial initialization; the toast still beats alert().\n }\n if (active) salla.notify?.setNotifier?.(handleNotify);\n })();\n return () => {\n active = false;\n salla.notify?.setNotifier?.(() => {});\n };\n }, [addToCartToast]);\n\n useEffect(() => {\n if (flashShownRef.current || typeof window === 'undefined') return;\n\n const params = new URLSearchParams(window.location.search);\n const successMsg = params.get('success');\n const dangerMsg = params.get('danger');\n\n if (!successMsg && !dangerMsg) return;\n\n flashShownRef.current = true;\n\n const message = successMsg || dangerMsg || '';\n const toastType = dangerMsg ? 'error' : 'success';\n\n const url = new URL(window.location.href);\n url.searchParams.delete('success');\n url.searchParams.delete('danger');\n window.history.replaceState({}, '', url.toString());\n\n const timer = setTimeout(() => {\n if (dispatchNativeAlert(toastType, message)) return;\n\n if (toastType === 'success') {\n toast.success(message, { duration: 3000 });\n } else {\n toast.error(message, { duration: 3000 });\n }\n }, 100);\n\n return () => clearTimeout(timer);\n }, []);\n\n return (\n <SonnerToaster\n position={position}\n // Keep sonner's default gaps (24px desktop / 16px mobile) but clear the\n // native status bar inset (--app-safe-area-top, set by useSafeAreaInset)\n // so top-positioned toasts aren't covered in the app webview.\n offset={{ top: 'calc(var(--app-safe-area-top, 0px) + 24px)' }}\n mobileOffset={{ top: 'calc(var(--app-safe-area-top, 0px) + 16px)' }}\n toastOptions={{\n classNames: toastClassNames,\n style: {\n fontFamily: 'var(--font-main, inherit)',\n },\n }}\n style={{\n fontFamily: 'var(--font-main, inherit)',\n }}\n />\n );\n}\n\nexport type { ToasterProps } from 'sonner';\n"]}
@@ -1,10 +1,10 @@
1
- import { ensureTwilightContextFromMatches } from './chunk-X55R4VVK.js';
2
- import { renderThemeHookSlotsScript, renderAppScopeInstallScript } from './chunk-SY7ESZ44.js';
1
+ import { ensureTwilightContextFromMatches } from './chunk-PZ4ARDUK.js';
2
+ import { renderThemeHookSlotsScript, renderAppScopeInstallScript } from './chunk-IPW4JC7Z.js';
3
3
  import { resolveHead, mergeHead } from './chunk-GD26FI4J.js';
4
- import { buildBaseHead } from './chunk-IXUYCRYA.js';
5
- import { gtmEnabled, DATA_LAYER_PROXY_SCRIPT } from './chunk-M54B252W.js';
6
- import { readEnv, renderRuntimeEnvScript, escapeForInlineScript } from './chunk-3Y6HAX72.js';
7
- import { getTwilightContext, SettingsError } from './chunk-6K34BCUP.js';
4
+ import { buildBaseHead } from './chunk-RRCEFLFD.js';
5
+ import { gtmEnabled, DATA_LAYER_PROXY_SCRIPT } from './chunk-7XV65HOU.js';
6
+ import { readEnv, renderRuntimeEnvScript, escapeForInlineScript } from './chunk-PQR776WF.js';
7
+ import { getTwilightContext, SettingsError } from './chunk-AWV3WEKH.js';
8
8
  import { FALLBACK_LOCALE } from './chunk-T72DAX7R.js';
9
9
 
10
10
  // src/routes/root/head.ts
@@ -301,5 +301,5 @@ function buildCustomJsScript(customJs, isUrl) {
301
301
  }
302
302
 
303
303
  export { TICKETING_SCRIPT_URL, resolveTwilightSdkUrl, rootHead };
304
- //# sourceMappingURL=chunk-LRJFPMD2.js.map
305
- //# sourceMappingURL=chunk-LRJFPMD2.js.map
304
+ //# sourceMappingURL=chunk-ASIK6ELH.js.map
305
+ //# sourceMappingURL=chunk-ASIK6ELH.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/routes/root/head.ts"],"names":[],"mappings":";;;;;;;;;;AAgBA,IAAM,mBAAA,GAAsB,sEAAA;AAC5B,IAAM,WAAA,GAAc,OAAA;AACpB,IAAM,YAAA,GAAe,+CAA+C,WAAW,CAAA,CAAA;AAG/E,IAAM,WAAA,GAAsC;AAAA,EAC1C,GAAA,EAAK,GAAG,YAAY,CAAA,OAAA,CAAA;AAAA,EACpB,MAAA,EAAQ,GAAG,YAAY,CAAA,CAAA,CAAA;AAAA,EACvB,UAAA,EAAY,GAAG,YAAY,CAAA,qBAAA,CAAA;AA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B,QAAA,EAAU,EAAE,qBAAA,EAAsB;AAAA;AAAA;AAAA,IAG3D,GAAI,CAAA,CAAE,oBAAA,GACF,CAAC,EAAE,EAAA,EAAI,wBAAA,EAA0B,QAAA,EAAU,CAAA,CAAE,oBAAA,EAAsB,CAAA,GACnE,EAAC;AAAA,IACL,EAAE,EAAA,EAAI,iBAAA,EAAmB,QAAA,EAAU,iBAAA,EAAkB;AAAA;AAAA,IAErD,GAAI,CAAA,CAAE,QAAA,GAAW,CAAC,mBAAA,CAAoB,CAAA,CAAE,QAAA,EAAU,OAAA,CAAQ,CAAA,CAAE,aAAa,CAAC,CAAC,IAAI;AAAC,GAClF;AACF;AAIA,SAAS,mBAAA,CAAoB,UAAkB,KAAA,EAAgB;AAC7D,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,iBAAA;AAAA,IACJ,QAAA,EAAU,KAAA,GACN,CAAA,sGAAA,EAAyG,qBAAA,CAAsB,IAAA,CAAK,SAAA,CAAU,QAAQ,CAAC,CAAC,CAAA,yDAAA,CAAA,GACxJ,CAAA,MAAA,EAAS,QAAQ,CAAA,yEAAA;AAAA,GACvB;AACF","file":"chunk-LRJFPMD2.js","sourcesContent":["import type { HeadDescriptor, HeadResult } from '../../utils/head';\nimport { mergeHead, resolveHead } from '../../utils/head';\nimport { buildBaseHead } from '../../utils/baseHead';\nimport { FALLBACK_LOCALE } from '../../providers/locale-constants';\nimport { getTwilightContext } from '../../twilight/context';\nimport type { TwilightContextMatch } from '../../twilight/ensure-context';\nimport { ensureTwilightContextFromMatches } from '../../twilight/ensure-context';\nimport type { StoreContext } from '../../api/store';\nimport type { AppSnippet } from '../../api/apps';\nimport { SettingsError } from '../../utils/errors';\nimport { renderAppScopeInstallScript } from '../../utils/app-scope';\nimport { renderThemeHookSlotsScript } from '../../utils/theme-hook-slots';\nimport { escapeForInlineScript } from '../../utils/inline-script';\nimport { readEnv, renderRuntimeEnvScript } from '../../utils/runtime-env';\nimport { DATA_LAYER_PROXY_SCRIPT, gtmEnabled } from '../../lib/analytics/gtm';\n\nconst SALLA_ICONS_CSS_URL = 'https://cdn.assets.salla.network/static/fonts/sallaicons.css?v=2.0.5';\nconst LIT_VERSION = '3.3.3';\nconst LIT_CDN_BASE = `https://cdn.assets.salla.network/static/lit/${LIT_VERSION}`;\n\n/** Bare-specifier map for the lit build the engine's `<salla-*>` web components resolve against. */\nconst LIT_IMPORTS: Record<string, string> = {\n lit: `${LIT_CDN_BASE}/lit.js`,\n 'lit/': `${LIT_CDN_BASE}/`,\n 'lit-html': `${LIT_CDN_BASE}/lit-html/lit-html.js`,\n 'lit-html/': `${LIT_CDN_BASE}/lit-html/`,\n 'lit-element': `${LIT_CDN_BASE}/lit-element/lit-element.js`,\n 'lit-element/': `${LIT_CDN_BASE}/lit-element/`,\n '@lit/reactive-element': `${LIT_CDN_BASE}/reactive-element/reactive-element.js`,\n '@lit/reactive-element/': `${LIT_CDN_BASE}/reactive-element/`,\n};\n\nexport const TICKETING_SCRIPT_URL =\n 'https://cdn.assets.salla.network/latest/@salla.sa/ui-store-ticketing-system/ticketing-system.es.js';\n\nconst TWILIGHT_RELEASE_CDN = 'https://cdn.salla.network/js/twilight';\nconst TWILIGHT_DEV_CDN = 'https://cdn.assets.salla.network/dev/@salla.sa/twilight';\n// The oldest Twilight release this engine works with. Raise it whenever the engine\n// starts relying on something newer; the reason lives in that commit. Today's floor:\n// components ship their own CSS, which themes no longer compile (SallaApp/twilight#2107).\nconst MIN_TWILIGHT_VERSION = '2.14.538';\n// Last resort when no override and no platform pin, and the substitute for a pin below the floor.\nconst DEFAULT_TWILIGHT_VERSION = '2.14.584';\nconst releaseUrl = (version: string): string =>\n `${TWILIGHT_RELEASE_CDN}/${version}/twilight.esm.js`;\n// The head is built more than once per request (early hints, then the page); say it once.\nconst warnedPins = new Set<string>();\n\n/** `x.y.z` release pins only; dev shas and other strings are loaded as given. */\nfunction belowMinimum(version: string): boolean {\n return (\n /^\\d+\\.\\d+\\.\\d+$/.test(version) &&\n version.localeCompare(MIN_TWILIGHT_VERSION, undefined, { numeric: true }) < 0\n );\n}\n\n/** The `x.y.z` release segment of a release-CDN `.../twilight.esm.js` URL, if present. */\nfunction releaseVersionInUrl(url: string): string | null {\n const match = url.match(/\\/(\\d+\\.\\d+\\.\\d+)\\/twilight\\.esm\\.js(?:[?#]|$)/);\n return match ? match[1] : null;\n}\n\n/**\n * `VITE_TWILIGHT_URL`/`VITE_TWILIGHT_VERSION` outrank everything below, including\n * `theme.twilight.version`'s own `belowMinimum` guard — a stale override wins\n * silently otherwise (TD-16375: a scaffold-time pin outlived the engine raising\n * MIN_TWILIGHT_VERSION, so every new theme rendered without component CSS and\n * nothing said why). Only a dev-mode nudge, not a swap: an env override is a\n * deliberate choice, so unlike the settings-pin path below this never substitutes\n * the engine default underneath the developer.\n */\nfunction warnIfOverrideBelowMinimum(source: string, version: string): void {\n // Worker logs in production should stay quiet -- this is a developer-directed nudge,\n // not a user-facing or production-monitored signal. import.meta.env.DEV is a static\n // false in production builds, so this branch (and the console.warn below) is\n // tree-shaken out entirely, same as DevSettingsWidget / dev-settings-store.ts.\n if (!import.meta.env.DEV) return;\n if (!belowMinimum(version)) return;\n const key = `${source}:${version}`;\n if (warnedPins.has(key)) return;\n warnedPins.add(key);\n console.warn(\n `[twilight] ${source}=${version} is below the engine minimum ${MIN_TWILIGHT_VERSION} — components may load without their CSS (SallaApp/twilight#2107). Unset it or bump it to ${MIN_TWILIGHT_VERSION}+.`\n );\n}\n\n/**\n * Which twilight.esm.js the storefront loads, in priority order:\n * 1. `VITE_TWILIGHT_URL` — full local/deployment override.\n * 2. `VITE_TWILIGHT_VERSION` — dev-CDN build override.\n * 3. `theme.twilight.version` from the settings endpoint — the platform-pinned\n * release used when no environment override is configured.\n * 4. The engine's default release, also used when the pin is below the engine minimum.\n */\nexport function resolveTwilightSdkUrl(settings?: StoreContext): string {\n const urlOverride = readEnv('VITE_TWILIGHT_URL');\n if (urlOverride) {\n const version = releaseVersionInUrl(urlOverride);\n if (version) warnIfOverrideBelowMinimum('VITE_TWILIGHT_URL', version);\n return urlOverride;\n }\n\n const versionOverride = readEnv('VITE_TWILIGHT_VERSION');\n if (versionOverride) {\n warnIfOverrideBelowMinimum('VITE_TWILIGHT_VERSION', versionOverride);\n return `${TWILIGHT_DEV_CDN}/${versionOverride}/twilight.esm.js`;\n }\n\n const pinnedVersion = settings?.theme?.twilight?.version;\n if (pinnedVersion && belowMinimum(pinnedVersion)) {\n if (!warnedPins.has(pinnedVersion)) {\n warnedPins.add(pinnedVersion);\n console.warn(\n `[twilight] theme.twilight.version ${pinnedVersion} is below the engine minimum ${MIN_TWILIGHT_VERSION}; loading ${DEFAULT_TWILIGHT_VERSION} instead`\n );\n }\n return releaseUrl(DEFAULT_TWILIGHT_VERSION);\n }\n if (pinnedVersion) return releaseUrl(pinnedVersion);\n\n return releaseUrl(DEFAULT_TWILIGHT_VERSION);\n}\n\n// On a page that preloads its LCP image, the icon font (~270 KB) applies once the first screen's\n// priority images have painted, so it doesn't compete with them; other pages swap on load.\nconst MEDIA_SWAP_SCRIPT = `\n(function(){var d=document,s=function(l){if(l.sheet||\"all\"===l.media)l.media=\"all\";else l.onload=function(){this.media=\"all\"}},f=d.getElementById(\"salla-theme-font\"),i=d.getElementById(\"salla-icons-css\");f&&s(f);if(!i)return;if(!d.querySelector('link[rel=\"preload\"][as=\"image\"]'))return s(i);var g=function(){g=function(){};s(i)},p=function(){requestAnimationFrame(function(){setTimeout(function(){g()})});setTimeout(function(){g()},100)};d.addEventListener(\"DOMContentLoaded\",function(){var m=[].filter.call(d.querySelectorAll('img[fetchpriority=\"high\"]'),function(x){return!x.complete}),n=m.length;if(!n)return p();m.forEach(function(x){var o=function(){--n||p()};x.addEventListener(\"load\",o,{once:!0});x.addEventListener(\"error\",o,{once:!0})});setTimeout(function(){g()},2500)})})();\n`.trim();\n\nconst LOADING_CSS = `\n.loading-overlay{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#fff;z-index:9999}\n.loading-spinner{animation:spin 1s linear infinite;border-radius:9999px;height:3rem;width:3rem;border-bottom:2px solid var(--color-primary,#000)}\n@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}\nhtml,body{margin:0;padding:0;height:100%}\n`.trim();\n\nconst SALLA_INIT_SCRIPT = `\nwindow.salla = window.Salla = window.Salla || window.salla || {};\nwindow.Salla.onReady = window.Salla.onReady || function(callback) {\n return new Promise(function(resolve) {\n if (window.Salla.status === 'ready') {\n var config = window.salla && window.salla.config && window.salla.config.all();\n resolve(callback ? callback(config) : config);\n } else {\n window.addEventListener('twilight::initiated', function(event) {\n resolve(callback ? callback(event.detail) : event.detail);\n }, { once: true });\n }\n });\n};\n`.trim();\n\n/**\n * Distinct snippet-host origins to `preconnect` (warm DNS/TCP/TLS during parse). From the real\n * URLs (dev/prod-correct), deduped and capped at 4. No `crossOrigin`: snippets are no-cors fetches.\n */\nexport function snippetPreconnectOrigins(snippets: readonly AppSnippet[] | undefined): string[] {\n if (!snippets?.length) return [];\n const origins = new Set<string>();\n for (const app of snippets) {\n if (app.status !== 'enabled') continue;\n for (const s of app.snippets) {\n if (!s.url) continue;\n try {\n origins.add(new URL(s.url).origin);\n } catch {\n /* skip a malformed snippet url rather than breaking the head */\n }\n if (origins.size >= 4) return [...origins];\n }\n }\n return [...origins];\n}\n\nexport function rootHead(ctx: {\n params: Record<string, string>;\n matches?: readonly TwilightContextMatch[];\n}): HeadResult {\n // Re-run on the client during hydration, where the twilight module store may\n // still be empty. Recover it from the resolved match context so the head is\n // built from real settings instead of falling through to 'Store Unavailable'.\n ensureTwilightContextFromMatches(ctx.matches);\n\n let settings: StoreContext | undefined;\n try {\n settings = getTwilightContext().settings;\n } catch (e) {\n if (e instanceof SettingsError) {\n return resolveHead({\n title: 'Store Unavailable',\n });\n }\n throw e;\n }\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n const parts = deriveHeadParts(settings);\n\n return resolveHead(\n mergeHead(buildBaseHead(settings, locale), {\n meta: buildRootMeta(parts),\n links: buildRootLinks(parts),\n styles: buildRootStyles(parts),\n importMap: [{ imports: LIT_IMPORTS }],\n scripts: buildRootScripts(parts),\n })\n );\n}\n\n/** Everything the root head's tag builders read, derived once from the store settings. */\ninterface RootHeadParts {\n store: StoreContext['store'] | undefined;\n favicon?: string;\n primaryColor?: string;\n fontUrl?: string;\n fontUrlWithDisplay?: string;\n isGoogleFont?: boolean;\n fontFamilyName?: string;\n customJs?: string;\n customCss?: string;\n isCustomCssUrl?: boolean;\n isCustomJsUrl?: boolean;\n twilightSdkUrl: string;\n /** The visitor gets the maintenance page, which loads no SDK and no app snippets. */\n maintenance: boolean;\n /** The store loads a Tag Manager container. */\n gtm: boolean;\n snippetPreconnects: Array<{ rel: 'preconnect'; href: string }>;\n appScopeInstallScript: string;\n themeHookSlotsScript: string | null;\n runtimeEnvScript: string | null;\n}\n\n/** Google Fonts only honours `display=swap` as a query param; other hosts get the @font-face\n * override instead (see buildRootStyles). */\nfunction deriveFontParts(theme?: StoreContext['theme']) {\n const font = theme?.font;\n const fontUrl = font?.url || font?.path;\n const isGoogleFont = fontUrl?.includes('fonts.googleapis.com');\n const needsDisplay = Boolean(isGoogleFont && fontUrl && !fontUrl.includes('display='));\n const separator = fontUrl?.includes('?') ? '&' : '?';\n\n return {\n fontUrl,\n isGoogleFont,\n fontFamilyName: font?.family_name,\n fontUrlWithDisplay: needsDisplay ? `${fontUrl}${separator}display=swap` : fontUrl,\n };\n}\n\n/** Theme customization JS/CSS, each either a URL to load or an inline blob to embed. */\nfunction deriveCustomizationParts(theme?: StoreContext['theme']) {\n const customization = theme?.customization;\n const customJs = customization?.js?.trim();\n const customCss = customization?.css?.trim();\n const isUrl = (value?: string): boolean =>\n Boolean(value?.startsWith('http') || value?.startsWith('//'));\n\n return {\n customJs,\n customCss,\n isCustomCssUrl: isUrl(customCss),\n isCustomJsUrl: isUrl(customJs),\n };\n}\n\nfunction deriveHeadParts(settings?: StoreContext): RootHeadParts {\n const store = settings?.store;\n\n return {\n store,\n favicon: store?.icon,\n primaryColor: settings?.theme?.color?.primary,\n ...deriveFontParts(settings?.theme),\n ...deriveCustomizationParts(settings?.theme),\n twilightSdkUrl: resolveTwilightSdkUrl(settings),\n maintenance: getTwilightContext().maintenance,\n gtm: gtmEnabled(settings),\n // Warm the connection to the snippet host(s) during head parse, so the body's deferred\n // `<script src>` snippet tags fetch off an already-open socket instead of DNS+TCP+TLS.\n snippetPreconnects: snippetPreconnectOrigins(getTwilightContext().appsSnippets).map((href) => ({\n rel: 'preconnect' as const,\n href,\n })),\n // Install `Salla.appScope` inline at parse time, before the SDK is ready — else a snippet's\n // onReady callback calls it too early and throws. Always emitted, even when the settings\n // prefetch failed: the CDN snippet tags ship regardless (they come from the *snippets*\n // endpoint), so the factory has to exist for them. `installAppScope` then seeds the real\n // buckets into this install once the client query resolves.\n appScopeInstallScript: renderAppScopeInstallScript(\n getTwilightContext().appsSettings ?? { apps: {} }\n ),\n // Whitelist the theme's own hook slots at parse time too, for the same reason: apps register\n // their `onReady` callbacks from parser-inserted snippet tags, long before React hydrates.\n themeHookSlotsScript: renderThemeHookSlotsScript(),\n // Env this render resolved (worker `vars` live in server-only `process.env`), handed to the\n // client so it doesn't silently fall back to the production defaults. Re-rendered on the\n // client during hydration, where it resolves to the same values or to nothing.\n runtimeEnvScript: renderRuntimeEnvScript(),\n };\n}\n\nfunction buildRootMeta(p: RootHeadParts): NonNullable<HeadDescriptor['meta']> {\n return [\n { name: 'robots', content: 'index, follow' },\n { name: 'msapplication-TileColor', content: '#ffffff' },\n ...(p.favicon ? [{ name: 'msapplication-TileImage', content: p.favicon }] : []),\n ...(p.primaryColor\n ? [\n { name: 'theme-color', content: p.primaryColor },\n { name: 'msapplication-navbutton-color', content: p.primaryColor },\n { name: 'apple-mobile-web-app-status-bar-style', content: p.primaryColor },\n ]\n : []),\n ];\n}\n\nfunction buildRootLinks(p: RootHeadParts): NonNullable<HeadDescriptor['links']> {\n return [\n { rel: 'preconnect', href: 'https://api.salla.dev' },\n { rel: 'preconnect', href: 'https://cdn.salla.sa' },\n { rel: 'preconnect', href: 'https://cdn.assets.salla.network', crossOrigin: 'anonymous' },\n // Warm the installed apps' CDN snippet host(s) — see snippetPreconnectOrigins.\n // Not on the maintenance page: it renders neither the snippets nor the SDK.\n ...(p.maintenance ? [] : p.snippetPreconnects),\n ...(p.isGoogleFont\n ? [\n {\n rel: 'preconnect' as const,\n href: 'https://fonts.gstatic.com',\n crossOrigin: 'anonymous' as const,\n },\n ]\n : []),\n ...(p.maintenance ? [] : [{ rel: 'modulepreload' as const, href: p.twilightSdkUrl }]),\n ...(p.fontUrlWithDisplay\n ? [\n {\n id: 'salla-theme-font',\n rel: 'stylesheet',\n href: p.fontUrlWithDisplay,\n media: 'print',\n },\n ]\n : []),\n ...(p.fontUrlWithDisplay && !p.isGoogleFont && p.fontFamilyName\n ? [\n {\n id: 'salla-font-display-override',\n rel: 'preload',\n as: 'style',\n href: p.fontUrlWithDisplay,\n },\n ]\n : []),\n ...(p.favicon ? [{ rel: 'icon', href: p.favicon }] : []),\n ...(p.favicon\n ? [{ id: 'salla-apple-icon', rel: 'apple-touch-icon-precomposed', href: p.favicon }]\n : []),\n ...(p.isCustomCssUrl && p.customCss\n ? [{ id: 'salla-custom-css', rel: 'stylesheet', href: p.customCss }]\n : []),\n {\n id: 'salla-icons-css',\n rel: 'stylesheet',\n href: SALLA_ICONS_CSS_URL,\n media: 'print',\n },\n // {\n // id: 'intl-tel-input-css',\n // rel: 'stylesheet',\n // href: 'https://cdn.jsdelivr.net/npm/intl-tel-input@26.8.0/build/css/intlTelInput.css',\n // },\n ...(p.isCustomJsUrl && p.customJs\n ? [{ id: 'salla-custom-js-preload', rel: 'preload', as: 'script', href: p.customJs }]\n : []),\n ];\n}\n\n// Hoistable (href + precedence): the web components insert their own <style> near the top of\n// <head> before hydration, which a positionally hydrated <style> would be matched against.\nconst hoisted = (id: string, children: string) => ({\n id,\n href: id,\n precedence: 'default',\n children,\n});\n\nfunction buildRootStyles(p: RootHeadParts): NonNullable<HeadDescriptor['styles']> {\n return [\n hoisted('twilight-loading', LOADING_CSS),\n ...(!p.isGoogleFont && p.fontFamilyName\n ? [\n hoisted(\n 'salla-font-display-swap',\n `@font-face{font-family:\"${p.fontFamilyName}\";font-display:swap;src:local(\"${p.fontFamilyName}\")}`\n ),\n ]\n : []),\n ...(!p.isCustomCssUrl && p.customCss ? [hoisted('salla-custom-css', p.customCss)] : []),\n ];\n}\n\nfunction buildRootScripts(p: RootHeadParts): NonNullable<HeadDescriptor['scripts']> {\n return [\n // First: the API base / store identifier this render used, so the hydrated client\n // resolves the same ones (worker `vars` never reach the browser bundle on their own).\n ...(p.runtimeEnvScript ? [{ id: 'salla-runtime-env', children: p.runtimeEnvScript }] : []),\n { id: 'twilight-init', children: SALLA_INIT_SCRIPT },\n // Before the SDK and every push, as Twig's head installs it: GTM loads late, and what was\n // pushed before its proxy kept the request and form fields it strips.\n ...(p.gtm ? [{ id: 'salla-datalayer', children: DATA_LAYER_PROXY_SCRIPT }] : []),\n // After twilight-init (which defines window.Salla) and before the SDK module, so the\n // appScope factory exists ahead of any snippet's onReady callback firing.\n { id: 'salla-app-scope', children: p.appScopeInstallScript },\n // Arms the hook-slot whitelist push here, so its `twilight::initiated` listener is\n // registered before any app snippet's — listeners fire in registration order.\n ...(p.themeHookSlotsScript\n ? [{ id: 'salla-theme-hook-slots', children: p.themeHookSlotsScript }]\n : []),\n { id: 'salla-async-css', children: MEDIA_SWAP_SCRIPT },\n // The SDK and ticketing modules are rendered at the end of <body> (SallaSdkScripts).\n ...(p.customJs ? [buildCustomJsScript(p.customJs, Boolean(p.isCustomJsUrl))] : []),\n ];\n}\n\n/** A URL customization is loaded after SDK init; an inline one is wrapped so a syntax/runtime\n * error in partner JS warns instead of taking the page down. */\nfunction buildCustomJsScript(customJs: string, isUrl: boolean) {\n return {\n id: 'salla-custom-js',\n children: isUrl\n ? `window.addEventListener('twilight::initiated',function(){var s=document.createElement('script');s.src=${escapeForInlineScript(JSON.stringify(customJs))};s.async=true;document.head.appendChild(s)},{once:true});`\n : `try { ${customJs} } catch(e) { console.warn(\"[ThemeCustomization] Custom JS error:\", e); }`,\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/routes/root/head.ts"],"names":[],"mappings":";;;;;;;;;;AAgBA,IAAM,mBAAA,GAAsB,sEAAA;AAC5B,IAAM,WAAA,GAAc,OAAA;AACpB,IAAM,YAAA,GAAe,+CAA+C,WAAW,CAAA,CAAA;AAG/E,IAAM,WAAA,GAAsC;AAAA,EAC1C,GAAA,EAAK,GAAG,YAAY,CAAA,OAAA,CAAA;AAAA,EACpB,MAAA,EAAQ,GAAG,YAAY,CAAA,CAAA,CAAA;AAAA,EACvB,UAAA,EAAY,GAAG,YAAY,CAAA,qBAAA,CAAA;AAAA,EAC3B,WAAA,EAAa,GAAG,YAAY,CAAA,UAAA,CAAA;AAAA,EAC5B,aAAA,EAAe,GAAG,YAAY,CAAA,2BAAA,CAAA;AAAA,EAC9B,cAAA,EAAgB,GAAG,YAAY,CAAA,aAAA,CAAA;AAAA,EAC/B,uBAAA,EAAyB,GAAG,YAAY,CAAA,qCAAA,CAAA;AAAA,EACxC,wBAAA,EAA0B,GAAG,YAAY,CAAA,kBAAA;AAC3C,CAAA;AAEO,IAAM,oBAAA,GACX;AAEF,IAAM,oBAAA,GAAuB,uCAAA;AAC7B,IAAM,gBAAA,GAAmB,yDAAA;AAIzB,IAAM,oBAAA,GAAuB,UAAA;AAE7B,IAAM,wBAAA,GAA2B,UAAA;AACjC,IAAM,aAAa,CAAC,OAAA,KAClB,CAAA,EAAG,oBAAoB,IAAI,OAAO,CAAA,gBAAA,CAAA;AAEpC,IAAM,UAAA,uBAAiB,GAAA,EAAY;AAGnC,SAAS,aAAa,OAAA,EAA0B;AAC9C,EAAA,OACE,iBAAA,CAAkB,IAAA,CAAK,OAAO,CAAA,IAC9B,OAAA,CAAQ,aAAA,CAAc,oBAAA,EAAsB,MAAA,EAAW,E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sourcesContent":["import type { HeadDescriptor, HeadResult } from '../../utils/head';\nimport { mergeHead, resolveHead } from '../../utils/head';\nimport { buildBaseHead } from '../../utils/baseHead';\nimport { FALLBACK_LOCALE } from '../../providers/locale-constants';\nimport { getTwilightContext } from '../../twilight/context';\nimport type { TwilightContextMatch } from '../../twilight/ensure-context';\nimport { ensureTwilightContextFromMatches } from '../../twilight/ensure-context';\nimport type { StoreContext } from '../../api/store';\nimport type { AppSnippet } from '../../api/apps';\nimport { SettingsError } from '../../utils/errors';\nimport { renderAppScopeInstallScript } from '../../utils/app-scope';\nimport { renderThemeHookSlotsScript } from '../../utils/theme-hook-slots';\nimport { escapeForInlineScript } from '../../utils/inline-script';\nimport { readEnv, renderRuntimeEnvScript } from '../../utils/runtime-env';\nimport { DATA_LAYER_PROXY_SCRIPT, gtmEnabled } from '../../lib/analytics/gtm';\n\nconst SALLA_ICONS_CSS_URL = 'https://cdn.assets.salla.network/static/fonts/sallaicons.css?v=2.0.5';\nconst LIT_VERSION = '3.3.3';\nconst LIT_CDN_BASE = `https://cdn.assets.salla.network/static/lit/${LIT_VERSION}`;\n\n/** Bare-specifier map for the lit build the engine's `<salla-*>` web components resolve against. */\nconst LIT_IMPORTS: Record<string, string> = {\n lit: `${LIT_CDN_BASE}/lit.js`,\n 'lit/': `${LIT_CDN_BASE}/`,\n 'lit-html': `${LIT_CDN_BASE}/lit-html/lit-html.js`,\n 'lit-html/': `${LIT_CDN_BASE}/lit-html/`,\n 'lit-element': `${LIT_CDN_BASE}/lit-element/lit-element.js`,\n 'lit-element/': `${LIT_CDN_BASE}/lit-element/`,\n '@lit/reactive-element': `${LIT_CDN_BASE}/reactive-element/reactive-element.js`,\n '@lit/reactive-element/': `${LIT_CDN_BASE}/reactive-element/`,\n};\n\nexport const TICKETING_SCRIPT_URL =\n 'https://cdn.assets.salla.network/latest/@salla.sa/ui-store-ticketing-system/ticketing-system.es.js';\n\nconst TWILIGHT_RELEASE_CDN = 'https://cdn.salla.network/js/twilight';\nconst TWILIGHT_DEV_CDN = 'https://cdn.assets.salla.network/dev/@salla.sa/twilight';\n// The oldest Twilight release this engine works with. Raise it whenever the engine\n// starts relying on something newer; the reason lives in that commit. Today's floor:\n// components ship their own CSS, which themes no longer compile (SallaApp/twilight#2107).\nconst MIN_TWILIGHT_VERSION = '2.14.538';\n// Last resort when no override and no platform pin, and the substitute for a pin below the floor.\nconst DEFAULT_TWILIGHT_VERSION = '2.14.584';\nconst releaseUrl = (version: string): string =>\n `${TWILIGHT_RELEASE_CDN}/${version}/twilight.esm.js`;\n// The head is built more than once per request (early hints, then the page); say it once.\nconst warnedPins = new Set<string>();\n\n/** `x.y.z` release pins only; dev shas and other strings are loaded as given. */\nfunction belowMinimum(version: string): boolean {\n return (\n /^\\d+\\.\\d+\\.\\d+$/.test(version) &&\n version.localeCompare(MIN_TWILIGHT_VERSION, undefined, { numeric: true }) < 0\n );\n}\n\n/** The `x.y.z` release segment of a release-CDN `.../twilight.esm.js` URL, if present. */\nfunction releaseVersionInUrl(url: string): string | null {\n const match = url.match(/\\/(\\d+\\.\\d+\\.\\d+)\\/twilight\\.esm\\.js(?:[?#]|$)/);\n return match ? match[1] : null;\n}\n\n/**\n * `VITE_TWILIGHT_URL`/`VITE_TWILIGHT_VERSION` outrank everything below, including\n * `theme.twilight.version`'s own `belowMinimum` guard — a stale override wins\n * silently otherwise (TD-16375: a scaffold-time pin outlived the engine raising\n * MIN_TWILIGHT_VERSION, so every new theme rendered without component CSS and\n * nothing said why). Only a dev-mode nudge, not a swap: an env override is a\n * deliberate choice, so unlike the settings-pin path below this never substitutes\n * the engine default underneath the developer.\n */\nfunction warnIfOverrideBelowMinimum(source: string, version: string): void {\n // Worker logs in production should stay quiet -- this is a developer-directed nudge,\n // not a user-facing or production-monitored signal. import.meta.env.DEV is a static\n // false in production builds, so this branch (and the console.warn below) is\n // tree-shaken out entirely, same as DevSettingsWidget / dev-settings-store.ts.\n if (!import.meta.env.DEV) return;\n if (!belowMinimum(version)) return;\n const key = `${source}:${version}`;\n if (warnedPins.has(key)) return;\n warnedPins.add(key);\n console.warn(\n `[twilight] ${source}=${version} is below the engine minimum ${MIN_TWILIGHT_VERSION} — components may load without their CSS (SallaApp/twilight#2107). Unset it or bump it to ${MIN_TWILIGHT_VERSION}+.`\n );\n}\n\n/**\n * Which twilight.esm.js the storefront loads, in priority order:\n * 1. `VITE_TWILIGHT_URL` — full local/deployment override.\n * 2. `VITE_TWILIGHT_VERSION` — dev-CDN build override.\n * 3. `theme.twilight.version` from the settings endpoint — the platform-pinned\n * release used when no environment override is configured.\n * 4. The engine's default release, also used when the pin is below the engine minimum.\n */\nexport function resolveTwilightSdkUrl(settings?: StoreContext): string {\n const urlOverride = readEnv('VITE_TWILIGHT_URL');\n if (urlOverride) {\n const version = releaseVersionInUrl(urlOverride);\n if (version) warnIfOverrideBelowMinimum('VITE_TWILIGHT_URL', version);\n return urlOverride;\n }\n\n const versionOverride = readEnv('VITE_TWILIGHT_VERSION');\n if (versionOverride) {\n warnIfOverrideBelowMinimum('VITE_TWILIGHT_VERSION', versionOverride);\n return `${TWILIGHT_DEV_CDN}/${versionOverride}/twilight.esm.js`;\n }\n\n const pinnedVersion = settings?.theme?.twilight?.version;\n if (pinnedVersion && belowMinimum(pinnedVersion)) {\n if (!warnedPins.has(pinnedVersion)) {\n warnedPins.add(pinnedVersion);\n console.warn(\n `[twilight] theme.twilight.version ${pinnedVersion} is below the engine minimum ${MIN_TWILIGHT_VERSION}; loading ${DEFAULT_TWILIGHT_VERSION} instead`\n );\n }\n return releaseUrl(DEFAULT_TWILIGHT_VERSION);\n }\n if (pinnedVersion) return releaseUrl(pinnedVersion);\n\n return releaseUrl(DEFAULT_TWILIGHT_VERSION);\n}\n\n// On a page that preloads its LCP image, the icon font (~270 KB) applies once the first screen's\n// priority images have painted, so it doesn't compete with them; other pages swap on load.\nconst MEDIA_SWAP_SCRIPT = `\n(function(){var d=document,s=function(l){if(l.sheet||\"all\"===l.media)l.media=\"all\";else l.onload=function(){this.media=\"all\"}},f=d.getElementById(\"salla-theme-font\"),i=d.getElementById(\"salla-icons-css\");f&&s(f);if(!i)return;if(!d.querySelector('link[rel=\"preload\"][as=\"image\"]'))return s(i);var g=function(){g=function(){};s(i)},p=function(){requestAnimationFrame(function(){setTimeout(function(){g()})});setTimeout(function(){g()},100)};d.addEventListener(\"DOMContentLoaded\",function(){var m=[].filter.call(d.querySelectorAll('img[fetchpriority=\"high\"]'),function(x){return!x.complete}),n=m.length;if(!n)return p();m.forEach(function(x){var o=function(){--n||p()};x.addEventListener(\"load\",o,{once:!0});x.addEventListener(\"error\",o,{once:!0})});setTimeout(function(){g()},2500)})})();\n`.trim();\n\nconst LOADING_CSS = `\n.loading-overlay{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#fff;z-index:9999}\n.loading-spinner{animation:spin 1s linear infinite;border-radius:9999px;height:3rem;width:3rem;border-bottom:2px solid var(--color-primary,#000)}\n@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}\nhtml,body{margin:0;padding:0;height:100%}\n`.trim();\n\nconst SALLA_INIT_SCRIPT = `\nwindow.salla = window.Salla = window.Salla || window.salla || {};\nwindow.Salla.onReady = window.Salla.onReady || function(callback) {\n return new Promise(function(resolve) {\n if (window.Salla.status === 'ready') {\n var config = window.salla && window.salla.config && window.salla.config.all();\n resolve(callback ? callback(config) : config);\n } else {\n window.addEventListener('twilight::initiated', function(event) {\n resolve(callback ? callback(event.detail) : event.detail);\n }, { once: true });\n }\n });\n};\n`.trim();\n\n/**\n * Distinct snippet-host origins to `preconnect` (warm DNS/TCP/TLS during parse). From the real\n * URLs (dev/prod-correct), deduped and capped at 4. No `crossOrigin`: snippets are no-cors fetches.\n */\nexport function snippetPreconnectOrigins(snippets: readonly AppSnippet[] | undefined): string[] {\n if (!snippets?.length) return [];\n const origins = new Set<string>();\n for (const app of snippets) {\n if (app.status !== 'enabled') continue;\n for (const s of app.snippets) {\n if (!s.url) continue;\n try {\n origins.add(new URL(s.url).origin);\n } catch {\n /* skip a malformed snippet url rather than breaking the head */\n }\n if (origins.size >= 4) return [...origins];\n }\n }\n return [...origins];\n}\n\nexport function rootHead(ctx: {\n params: Record<string, string>;\n matches?: readonly TwilightContextMatch[];\n}): HeadResult {\n // Re-run on the client during hydration, where the twilight module store may\n // still be empty. Recover it from the resolved match context so the head is\n // built from real settings instead of falling through to 'Store Unavailable'.\n ensureTwilightContextFromMatches(ctx.matches);\n\n let settings: StoreContext | undefined;\n try {\n settings = getTwilightContext().settings;\n } catch (e) {\n if (e instanceof SettingsError) {\n return resolveHead({\n title: 'Store Unavailable',\n });\n }\n throw e;\n }\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n const parts = deriveHeadParts(settings);\n\n return resolveHead(\n mergeHead(buildBaseHead(settings, locale), {\n meta: buildRootMeta(parts),\n links: buildRootLinks(parts),\n styles: buildRootStyles(parts),\n importMap: [{ imports: LIT_IMPORTS }],\n scripts: buildRootScripts(parts),\n })\n );\n}\n\n/** Everything the root head's tag builders read, derived once from the store settings. */\ninterface RootHeadParts {\n store: StoreContext['store'] | undefined;\n favicon?: string;\n primaryColor?: string;\n fontUrl?: string;\n fontUrlWithDisplay?: string;\n isGoogleFont?: boolean;\n fontFamilyName?: string;\n customJs?: string;\n customCss?: string;\n isCustomCssUrl?: boolean;\n isCustomJsUrl?: boolean;\n twilightSdkUrl: string;\n /** The visitor gets the maintenance page, which loads no SDK and no app snippets. */\n maintenance: boolean;\n /** The store loads a Tag Manager container. */\n gtm: boolean;\n snippetPreconnects: Array<{ rel: 'preconnect'; href: string }>;\n appScopeInstallScript: string;\n themeHookSlotsScript: string | null;\n runtimeEnvScript: string | null;\n}\n\n/** Google Fonts only honours `display=swap` as a query param; other hosts get the @font-face\n * override instead (see buildRootStyles). */\nfunction deriveFontParts(theme?: StoreContext['theme']) {\n const font = theme?.font;\n const fontUrl = font?.url || font?.path;\n const isGoogleFont = fontUrl?.includes('fonts.googleapis.com');\n const needsDisplay = Boolean(isGoogleFont && fontUrl && !fontUrl.includes('display='));\n const separator = fontUrl?.includes('?') ? '&' : '?';\n\n return {\n fontUrl,\n isGoogleFont,\n fontFamilyName: font?.family_name,\n fontUrlWithDisplay: needsDisplay ? `${fontUrl}${separator}display=swap` : fontUrl,\n };\n}\n\n/** Theme customization JS/CSS, each either a URL to load or an inline blob to embed. */\nfunction deriveCustomizationParts(theme?: StoreContext['theme']) {\n const customization = theme?.customization;\n const customJs = customization?.js?.trim();\n const customCss = customization?.css?.trim();\n const isUrl = (value?: string): boolean =>\n Boolean(value?.startsWith('http') || value?.startsWith('//'));\n\n return {\n customJs,\n customCss,\n isCustomCssUrl: isUrl(customCss),\n isCustomJsUrl: isUrl(customJs),\n };\n}\n\nfunction deriveHeadParts(settings?: StoreContext): RootHeadParts {\n const store = settings?.store;\n\n return {\n store,\n favicon: store?.icon,\n primaryColor: settings?.theme?.color?.primary,\n ...deriveFontParts(settings?.theme),\n ...deriveCustomizationParts(settings?.theme),\n twilightSdkUrl: resolveTwilightSdkUrl(settings),\n maintenance: getTwilightContext().maintenance,\n gtm: gtmEnabled(settings),\n // Warm the connection to the snippet host(s) during head parse, so the body's deferred\n // `<script src>` snippet tags fetch off an already-open socket instead of DNS+TCP+TLS.\n snippetPreconnects: snippetPreconnectOrigins(getTwilightContext().appsSnippets).map((href) => ({\n rel: 'preconnect' as const,\n href,\n })),\n // Install `Salla.appScope` inline at parse time, before the SDK is ready — else a snippet's\n // onReady callback calls it too early and throws. Always emitted, even when the settings\n // prefetch failed: the CDN snippet tags ship regardless (they come from the *snippets*\n // endpoint), so the factory has to exist for them. `installAppScope` then seeds the real\n // buckets into this install once the client query resolves.\n appScopeInstallScript: renderAppScopeInstallScript(\n getTwilightContext().appsSettings ?? { apps: {} }\n ),\n // Whitelist the theme's own hook slots at parse time too, for the same reason: apps register\n // their `onReady` callbacks from parser-inserted snippet tags, long before React hydrates.\n themeHookSlotsScript: renderThemeHookSlotsScript(),\n // Env this render resolved (worker `vars` live in server-only `process.env`), handed to the\n // client so it doesn't silently fall back to the production defaults. Re-rendered on the\n // client during hydration, where it resolves to the same values or to nothing.\n runtimeEnvScript: renderRuntimeEnvScript(),\n };\n}\n\nfunction buildRootMeta(p: RootHeadParts): NonNullable<HeadDescriptor['meta']> {\n return [\n { name: 'robots', content: 'index, follow' },\n { name: 'msapplication-TileColor', content: '#ffffff' },\n ...(p.favicon ? [{ name: 'msapplication-TileImage', content: p.favicon }] : []),\n ...(p.primaryColor\n ? [\n { name: 'theme-color', content: p.primaryColor },\n { name: 'msapplication-navbutton-color', content: p.primaryColor },\n { name: 'apple-mobile-web-app-status-bar-style', content: p.primaryColor },\n ]\n : []),\n ];\n}\n\nfunction buildRootLinks(p: RootHeadParts): NonNullable<HeadDescriptor['links']> {\n return [\n { rel: 'preconnect', href: 'https://api.salla.dev' },\n { rel: 'preconnect', href: 'https://cdn.salla.sa' },\n { rel: 'preconnect', href: 'https://cdn.assets.salla.network', crossOrigin: 'anonymous' },\n // Warm the installed apps' CDN snippet host(s) — see snippetPreconnectOrigins.\n // Not on the maintenance page: it renders neither the snippets nor the SDK.\n ...(p.maintenance ? [] : p.snippetPreconnects),\n ...(p.isGoogleFont\n ? [\n {\n rel: 'preconnect' as const,\n href: 'https://fonts.gstatic.com',\n crossOrigin: 'anonymous' as const,\n },\n ]\n : []),\n ...(p.maintenance ? [] : [{ rel: 'modulepreload' as const, href: p.twilightSdkUrl }]),\n ...(p.fontUrlWithDisplay\n ? [\n {\n id: 'salla-theme-font',\n rel: 'stylesheet',\n href: p.fontUrlWithDisplay,\n media: 'print',\n },\n ]\n : []),\n ...(p.fontUrlWithDisplay && !p.isGoogleFont && p.fontFamilyName\n ? [\n {\n id: 'salla-font-display-override',\n rel: 'preload',\n as: 'style',\n href: p.fontUrlWithDisplay,\n },\n ]\n : []),\n ...(p.favicon ? [{ rel: 'icon', href: p.favicon }] : []),\n ...(p.favicon\n ? [{ id: 'salla-apple-icon', rel: 'apple-touch-icon-precomposed', href: p.favicon }]\n : []),\n ...(p.isCustomCssUrl && p.customCss\n ? [{ id: 'salla-custom-css', rel: 'stylesheet', href: p.customCss }]\n : []),\n {\n id: 'salla-icons-css',\n rel: 'stylesheet',\n href: SALLA_ICONS_CSS_URL,\n media: 'print',\n },\n // {\n // id: 'intl-tel-input-css',\n // rel: 'stylesheet',\n // href: 'https://cdn.jsdelivr.net/npm/intl-tel-input@26.8.0/build/css/intlTelInput.css',\n // },\n ...(p.isCustomJsUrl && p.customJs\n ? [{ id: 'salla-custom-js-preload', rel: 'preload', as: 'script', href: p.customJs }]\n : []),\n ];\n}\n\n// Hoistable (href + precedence): the web components insert their own <style> near the top of\n// <head> before hydration, which a positionally hydrated <style> would be matched against.\nconst hoisted = (id: string, children: string) => ({\n id,\n href: id,\n precedence: 'default',\n children,\n});\n\nfunction buildRootStyles(p: RootHeadParts): NonNullable<HeadDescriptor['styles']> {\n return [\n hoisted('twilight-loading', LOADING_CSS),\n ...(!p.isGoogleFont && p.fontFamilyName\n ? [\n hoisted(\n 'salla-font-display-swap',\n `@font-face{font-family:\"${p.fontFamilyName}\";font-display:swap;src:local(\"${p.fontFamilyName}\")}`\n ),\n ]\n : []),\n ...(!p.isCustomCssUrl && p.customCss ? [hoisted('salla-custom-css', p.customCss)] : []),\n ];\n}\n\nfunction buildRootScripts(p: RootHeadParts): NonNullable<HeadDescriptor['scripts']> {\n return [\n // First: the API base / store identifier this render used, so the hydrated client\n // resolves the same ones (worker `vars` never reach the browser bundle on their own).\n ...(p.runtimeEnvScript ? [{ id: 'salla-runtime-env', children: p.runtimeEnvScript }] : []),\n { id: 'twilight-init', children: SALLA_INIT_SCRIPT },\n // Before the SDK and every push, as Twig's head installs it: GTM loads late, and what was\n // pushed before its proxy kept the request and form fields it strips.\n ...(p.gtm ? [{ id: 'salla-datalayer', children: DATA_LAYER_PROXY_SCRIPT }] : []),\n // After twilight-init (which defines window.Salla) and before the SDK module, so the\n // appScope factory exists ahead of any snippet's onReady callback firing.\n { id: 'salla-app-scope', children: p.appScopeInstallScript },\n // Arms the hook-slot whitelist push here, so its `twilight::initiated` listener is\n // registered before any app snippet's — listeners fire in registration order.\n ...(p.themeHookSlotsScript\n ? [{ id: 'salla-theme-hook-slots', children: p.themeHookSlotsScript }]\n : []),\n { id: 'salla-async-css', children: MEDIA_SWAP_SCRIPT },\n // The SDK and ticketing modules are rendered at the end of <body> (SallaSdkScripts).\n ...(p.customJs ? [buildCustomJsScript(p.customJs, Boolean(p.isCustomJsUrl))] : []),\n ];\n}\n\n/** A URL customization is loaded after SDK init; an inline one is wrapped so a syntax/runtime\n * error in partner JS warns instead of taking the page down. */\nfunction buildCustomJsScript(customJs: string, isUrl: boolean) {\n return {\n id: 'salla-custom-js',\n children: isUrl\n ? `window.addEventListener('twilight::initiated',function(){var s=document.createElement('script');s.src=${escapeForInlineScript(JSON.stringify(customJs))};s.async=true;document.head.appendChild(s)},{once:true});`\n : `try { ${customJs} } catch(e) { console.warn(\"[ThemeCustomization] Custom JS error:\", e); }`,\n };\n}\n"]}
@@ -99,6 +99,7 @@ var DEFAULT_DATA = {
99
99
  storeBaseFollowsLocale: false,
100
100
  versionId: null,
101
101
  requestHost: null,
102
+ apiBase: null,
102
103
  nativeAppHeaders: null,
103
104
  i18n: void 0,
104
105
  page: void 0,
@@ -173,6 +174,8 @@ function mergeIntoStore(store, partial) {
173
174
  store.versionId = partial.versionId ?? null;
174
175
  if ("requestHost" in partial && partial.requestHost !== void 0)
175
176
  store.requestHost = partial.requestHost ?? null;
177
+ if ("apiBase" in partial && partial.apiBase !== void 0)
178
+ store.apiBase = partial.apiBase ?? null;
176
179
  if ("nativeAppHeaders" in partial && partial.nativeAppHeaders !== void 0)
177
180
  store.nativeAppHeaders = partial.nativeAppHeaders ?? null;
178
181
  if ("i18n" in partial && partial.i18n != null) store.i18n = partial.i18n;
@@ -221,7 +224,8 @@ function getRequestStore() {
221
224
  storeBase: data.storeBase,
222
225
  storeBaseFollowsLocale: data.storeBaseFollowsLocale,
223
226
  versionId: data.versionId,
224
- requestHost: data.requestHost
227
+ requestHost: data.requestHost,
228
+ apiBase: data.apiBase
225
229
  };
226
230
  } catch {
227
231
  return {
@@ -229,7 +233,8 @@ function getRequestStore() {
229
233
  storeBase: null,
230
234
  storeBaseFollowsLocale: false,
231
235
  versionId: null,
232
- requestHost: null
236
+ requestHost: null,
237
+ apiBase: null
233
238
  };
234
239
  }
235
240
  }
@@ -276,6 +281,9 @@ function getTwilightContext() {
276
281
  get requestHost() {
277
282
  return data.requestHost;
278
283
  },
284
+ get apiBase() {
285
+ return data.apiBase;
286
+ },
279
287
  get nativeAppHeaders() {
280
288
  return data.nativeAppHeaders;
281
289
  },
@@ -313,5 +321,5 @@ function getTwilightContext() {
313
321
  }
314
322
 
315
323
  export { SettingsError, composeMessages, createI18nInstance, getRequestStore, getTwilightContext, hasTwilightSettings, isPlainObject, messagesForLocale, runWithTwilightContext, storeTranslationsQueryKey, subscribeTwilight, translationsQueryKey, updateTwilightContext };
316
- //# sourceMappingURL=chunk-6K34BCUP.js.map
317
- //# sourceMappingURL=chunk-6K34BCUP.js.map
324
+ //# sourceMappingURL=chunk-AWV3WEKH.js.map
325
+ //# sourceMappingURL=chunk-AWV3WEKH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/api/translations-key.ts","../src/api/messages.ts","../src/utils/errors.ts","../src/providers/i18n-factory.ts","../src/twilight/context.ts"],"names":[],"mappings":";;;;;;AAwBO,SAAS,qBAAqB,MAAA,EAAkC;AACrE,EAAA,OAAO,CAAC,gBAAgB,MAAM,CAAA;AAChC;AAkBO,SAAS,yBAAA,CACd,SACA,MAAA,EAC0B;AAC1B,EAAA,OAAO,CAAC,cAAA,EAAgB,MAAA,CAAO,OAAO,GAAG,MAAM,CAAA;AACjD;;;ACrBO,SAAS,cAAc,KAAA,EAAmC;AAC/D,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,C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ACd,CAAA;AAAA,IACA,IAAI,YAAA,GAAe;AACjB,MAAA,OAAO,IAAA,CAAK,YAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,WAAA,GAAc;AAChB,MAAA,OAAO,IAAA,CAAK,WAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,aAAA,GAAgB;AAClB,MAAA,OAAO,IAAA,CAAK,aAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,MAAA,GAAS;AACX,MAAA,OAAO,IAAA,CAAK,MAAA;AAAA,IACd;AAAA,GACF;AACF","file":"chunk-AWV3WEKH.js","sourcesContent":["/**\n * @fileoverview The translations query key, on its own, importing nothing.\n *\n * Three places read the cached translations — `rootBeforeLoad`, the hydration\n * path in `tanstack/router.tsx`, and the lazy `i18n` accessor in\n * `twilight/context.ts` — and all three have to agree on the key or the\n * hydrated page misses the entry it was just handed and refetches. One\n * definition is the only way to keep that true.\n *\n * It lives here rather than in `api/translations.ts`, where it would naturally\n * sit, because **`twilight/context.ts` cannot afford that module's imports**.\n * `api/translations` pulls in `api/client`, which pulls in `ky`; `context.ts`\n * is imported directly by tests that mock `ky`, and adding that edge made six\n * of them stop being mocked and start issuing real requests to `api.salla.dev`\n * (`tests/routes/rootBeforeLoad.test.ts`, bisected to exactly this import). A\n * leaf module with no imports of its own cannot do that to anyone.\n */\n\n/**\n * @param locale is part of the key because each file on the CDN holds one\n * language. The global file this replaced carried every language and was\n * sliced after the cache, so a key without the locale was correct then and is\n * a wrong-language bug now: `/ar` → `/en` would reuse the Arabic entry.\n */\nexport function translationsQueryKey(locale: string): [string, string] {\n return ['translations', locale];\n}\n\n/**\n * The merchant's own wording for one store and one language.\n *\n * Separate from {@link translationsQueryKey} rather than folded into it,\n * because the two files have different lifetimes and different audiences: the\n * platform's copy is the same object for every store on the CDN, and this one\n * is a single merchant's overrides. Keeping them apart means a store with no\n * overrides never invalidates, refetches or dehydrates anything on its account.\n *\n * @param storeId is `settings.store.id` — the Optimus-encoded numeric id, which\n * is what names the object. It is safe in a key even though the locale-only key\n * deliberately avoids naming a store: that warning is about a store *resolved\n * from the request*, which differs between server and client. This one is read\n * out of the settings payload, so both sides compute it from the same\n * dehydrated data and agree.\n */\nexport function storeTranslationsQueryKey(\n storeId: string | number,\n locale: string\n): [string, string, string] {\n return ['translations', String(storeId), locale];\n}\n","/**\n * @fileoverview Composing one language's messages out of the query cache.\n *\n * **There are three places that build an i18n instance**, and they have to\n * agree on more than the key: `rootBeforeLoad`, the hydration path in\n * `tanstack/router.tsx`, and the lazy `i18n` accessor in `twilight/context.ts`.\n * When the platform's copy was the only source, agreeing on\n * `translationsQueryKey` was enough. It is not any more — a merchant's own\n * wording is a second cache entry, and a reader that knows about one and not\n * the other renders different text from the page beside it.\n *\n * That is exactly what shipped in #366: the server rendered the merchant's\n * words and hydration replaced them with the platform's, because only\n * `rootBeforeLoad` had been taught to merge. Greptile caught it. This module is\n * the single answer to \"what are the messages for this locale\", so the next\n * source cannot be added to one reader and forgotten in two.\n *\n * It lives beside `translations-key.ts` and imports nothing at runtime for the\n * same reason that file does: `twilight/context.ts` cannot afford\n * `api/translations`, which pulls in `api/client` and therefore `ky`, and tests\n * that mock `ky` stop being mocked the moment that edge exists.\n */\nimport type { QueryClient } from '@tanstack/react-query';\nimport { translationsQueryKey } from './translations-key';\nimport type { TranslationMessages } from '../providers/I18nProvider';\n\nexport type Messages = Record<string, unknown>;\n\nexport function isPlainObject(value: unknown): value is Messages {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * `overrides` laid over `base`, one leaf at a time.\n *\n * Recursive rather than a spread, because both files are nested by group\n * (`common.errors.500`) and a top-level spread would make a merchant who\n * overrode one string inside `common` lose every other string in it. The\n * merchant's value wins at the leaf, and a group they never touched is left\n * exactly as the platform sent it.\n *\n * A type conflict — one side an object where the other is a string — resolves\n * to the merchant's value. It is the more specific of the two and there is no\n * sensible way to merge a string into a group; the alternative, keeping the\n * platform's, would mean a merchant's edit silently doing nothing.\n */\nexport function mergeMessages(base: Messages, overrides: Messages): Messages {\n const merged: Messages = { ...base };\n\n for (const [key, value] of Object.entries(overrides)) {\n const existing = merged[key];\n merged[key] =\n isPlainObject(existing) && isPlainObject(value) ? mergeMessages(existing, value) : value;\n }\n\n return merged;\n}\n\n/**\n * This store's overrides for `locale`, if any were fetched into the cache.\n *\n * Found by **shape** rather than by asking the settings for a store id, and\n * that is deliberate: the two readers that were missing the merge have a\n * `queryClient` and a locale between them and nothing else, and reaching for\n * `api/store` from `twilight/context.ts` would drag `ky` in through the back\n * door. One document serves one store — a request naming a different one is\n * redirected with `reloadDocument` — so at most one such entry per locale\n * exists, and matching `['translations', <anything>, <locale>]` cannot pick up\n * somebody else's.\n */\nfunction cachedOverrides(queryClient: QueryClient, locale: string): Messages | undefined {\n const entries = queryClient.getQueriesData<Messages>({ queryKey: ['translations'] });\n\n for (const [key, data] of entries) {\n if (key.length === 3 && key[2] === locale && isPlainObject(data)) {\n return data;\n }\n }\n\n return undefined;\n}\n\n/**\n * The messages for `locale`: the platform's copy with this merchant's over it.\n *\n * Reads only — whoever wants the merchant's file in the cache has to have put\n * it there, which `rootBeforeLoad` does and only when the settings say there is\n * one. A reader that runs without it simply gets the platform's copy, which is\n * the same thing it got before any of this existed.\n */\nexport function messagesForLocale(\n queryClient: QueryClient | undefined,\n locale: string\n): TranslationMessages | undefined {\n const common = queryClient?.getQueryData<TranslationMessages>(translationsQueryKey(locale));\n const overrides = queryClient ? cachedOverrides(queryClient, locale) : undefined;\n\n return composeMessages(common, overrides, locale);\n}\n\n/**\n * The same composition from values rather than from the cache.\n *\n * `rootBeforeLoad` has both in hand already — it just awaited them — so it\n * composes directly instead of reading back what it put in.\n */\nexport function composeMessages(\n common: TranslationMessages | null | undefined,\n overrides: Messages | null | undefined,\n locale: string\n): TranslationMessages | undefined {\n if (!overrides || Object.keys(overrides).length === 0) return common ?? undefined;\n\n const base = common?.[`${locale}.trans`];\n\n return {\n [`${locale}.trans`]: mergeMessages(isPlainObject(base) ? base : {}, overrides) as Record<\n string,\n string\n >,\n };\n}\n","/**\n * Why a store's settings did not load:\n * - `no-store`: nothing named a store for this request;\n * - `timeout`: the Salla API did not answer in time;\n * - `not-found`: it answered that no store has that identifier;\n * - `http`: it answered with another error status;\n * - `network`: no answer arrived at all;\n * - `empty`: it answered without settings.\n */\nexport type SettingsErrorReason =\n 'no-store' | 'timeout' | 'not-found' | 'http' | 'network' | 'empty';\n\nexport interface SettingsErrorDetails {\n reason?: SettingsErrorReason;\n /** The API's status, when `reason` is `'http'` or `'not-found'`. */\n status?: number;\n}\n\nexport class SettingsError extends Error {\n /** Absent when nothing said why, e.g. `getTwilightContext().settings` read before they loaded. */\n readonly reason?: SettingsErrorReason;\n readonly status?: number;\n\n constructor(message?: string, details?: SettingsErrorDetails) {\n super(message ?? 'Store settings could not be loaded.');\n this.name = 'SettingsError';\n this.reason = details?.reason;\n this.status = details?.status;\n }\n}\n","import { createInstance, type i18n as I18nInstance } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nexport type TranslationMessages = Record<string, Record<string, string>>;\n\n/**\n * Creates a new i18next instance for the given locale.\n *\n * @param locale - Active locale code, e.g. `'ar'`\n * @param translations - App translations from the Salla API (store-specific)\n * @param themeTranslations - Bundled theme translations (static defaults)\n */\nexport function createI18nInstance(\n locale: string,\n translations?: TranslationMessages,\n themeTranslations?: TranslationMessages\n): I18nInstance {\n const instance = createInstance();\n const transKey = `${locale}.trans`;\n\n instance.use(initReactI18next).init({\n lng: locale,\n fallbackLng: locale,\n ns: ['app', 'theme'],\n defaultNS: 'app',\n fallbackNS: 'theme',\n resources: {\n [locale]: {\n app: translations?.[transKey] ?? {},\n theme: themeTranslations?.[transKey] ?? {},\n },\n },\n interpolation: { escapeValue: false },\n react: { useSuspense: false },\n keySeparator: '.',\n nsSeparator: false,\n });\n\n return instance;\n}\n\n/**\n * Creates i18n instance for testing\n * @param locale - Locale code (default: 'ar')\n * @param translations - Optional translations\n */\nexport function createTestI18n(locale = 'ar', translations?: TranslationMessages): I18nInstance {\n return createI18nInstance(locale, translations);\n}\n","import type { QueryClient } from '@tanstack/react-query';\nimport type { i18n } from 'i18next';\nimport type { StoreContext } from '../api/store';\nimport type { AppSnippet, AppSettings } from '../api/apps';\nimport { FALLBACK_LOCALE, getLanguageInfo } from '../providers/locale-constants';\nimport { createI18nInstance } from '../providers/i18n-factory';\nimport { messagesForLocale } from '../api/messages';\nimport { SettingsError } from '../utils/errors';\nimport type { ActiveScope } from '../utils/cookies';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface TwilightLocation<TSearch = Record<string, unknown>> {\n href: string;\n pathname: string;\n search: TSearch;\n searchStr: string;\n state: Record<string, unknown>;\n hash: string;\n}\n\nexport interface PageContext {\n slug: string;\n id?: string | number;\n title: string;\n url?: string;\n parent?: { id: string | number; name: string; url: string } | null;\n breadcrumbs?: { name: string; url: string }[];\n}\n\nexport interface TwilightContext {\n queryClient: QueryClient;\n settings: StoreContext;\n locale: string;\n routeId: string;\n location: TwilightLocation;\n authToken: string | null;\n /**\n * The selected market and, once bullet delivery confirmed one, its branch\n * allocation — the full object the SDK sends as `s-scope-*` headers. Seeded from\n * the `scope` cookie on the server; see {@link ActiveScope}.\n */\n scope: ActiveScope | null;\n /** `scope.id`, kept for callers that only need the market. */\n scopeId: string | null;\n /**\n * Which store this request is for, when something other than the hostname says\n * so — the `?storeId=` a preview was opened with, or the cookie remembering it.\n *\n * Null on a live storefront, where the hostname is the answer and there is\n * nothing to carry. See {@link resolveRequestStoreId}.\n */\n storeId: string | null;\n /**\n * Which store the first segment of this request's path named, on a host where\n * the store is the root of every URL: `mtgr-alaatr-2` for\n * `https://preview.salla.design/mtgr-alaatr-2/cart`.\n *\n * Null whenever something else named the store, and on every merchant domain.\n * See {@link resolveRequestStoreBase}.\n */\n storeBase: string | null;\n /**\n * Where {@link storeBase} sits in this request's paths: behind the locale on a\n * Salla shared host (`/ar/dev-x/cart`, named by the dispatcher), in front of it\n * everywhere else. See {@link resolveAddressedStore}.\n */\n storeBaseFollowsLocale: boolean;\n /**\n * Which version of the theme's settings this request asked for — the\n * `?versionId=` an editor preview or a local dev session was opened with, or\n * the cookie remembering it.\n *\n * Null on an ordinary storefront visit, which is the common case: nothing\n * named a version, so the store's live one is what the API answers with. See\n * {@link resolveRequestVersionId}.\n */\n versionId: string | null;\n /**\n * The host this request arrived on, captured server-side.\n *\n * A theme worker is deployed with no vars and no bindings, so the request is\n * the only thing that knows which storefront it is serving. Null in the browser,\n * where nothing sets it: read {@link currentHost}, which falls back to\n * `window.location.host`, rather than this.\n */\n requestHost: string | null;\n /**\n * The Store API base the dispatcher named for this request (`x-salla-api-base`),\n * captured server-side, or null for the build's default. Set only on the beta and\n * PR preview storefronts; see `utils/api-base.ts`.\n */\n apiBase: string | null;\n /** The native app's `s-app-*` headers when the request came from its webview; see {@link readNativeAppHeaders}. */\n nativeAppHeaders: Record<string, string> | null;\n i18n: i18n;\n dir: 'ltr' | 'rtl';\n page?: PageContext;\n /** Installed apps' snippets, fetched in rootBeforeLoad so AppsSnippets can render CDN\n * <script> tags during SSR (React Query isn't dehydrated here, so useQuery has no SSR data). */\n appsSnippets?: AppSnippet[];\n /** Per-app public `app.*` buckets, fetched in rootBeforeLoad so rootHead can install the\n * `Salla.appScope` factory inline at parse time — ahead of the snippets' onReady callbacks. */\n appsSettings?: AppSettings;\n /**\n * This visitor sees the maintenance page, not the store. Decided in rootBeforeLoad\n * from `settings.maintenance` and the merchant's owner view; see `utils/maintenance`.\n */\n maintenance: boolean;\n /**\n * The Salla API answered that no store has the identifier this request named. Set by\n * rootBeforeLoad; `twilightMiddleware` answers with Twig's 410 page instead of the render.\n */\n storeNotFound: boolean;\n extras?: Record<string, unknown>;\n}\n\n// ============================================================================\n// Internal Store\n// ============================================================================\n\nconst DEFAULT_LOCATION: TwilightLocation = {\n href: '',\n pathname: '',\n search: {},\n searchStr: '',\n state: {},\n hash: '',\n};\n\ninterface ContextData {\n queryClient: QueryClient;\n settings: StoreContext | null;\n locale: string;\n routeId: string;\n location: TwilightLocation;\n authToken: string | null;\n scope: ActiveScope | null;\n storeId: string | null;\n storeBase: string | null;\n storeBaseFollowsLocale: boolean;\n versionId: string | null;\n requestHost: string | null;\n apiBase: string | null;\n nativeAppHeaders: Record<string, string> | null;\n i18n?: i18n;\n page?: PageContext;\n appsSnippets?: AppSnippet[];\n appsSettings?: AppSettings;\n maintenance: boolean;\n storeNotFound: boolean;\n extras?: Record<string, unknown>;\n}\n\nconst DEFAULT_DATA: ContextData = {\n queryClient: null as unknown as QueryClient,\n settings: null,\n locale: FALLBACK_LOCALE,\n routeId: '',\n location: { ...DEFAULT_LOCATION },\n authToken: null,\n scope: null,\n storeId: null,\n storeBase: null,\n storeBaseFollowsLocale: false,\n versionId: null,\n requestHost: null,\n apiBase: null,\n nativeAppHeaders: null,\n i18n: undefined,\n page: undefined,\n maintenance: false,\n storeNotFound: false,\n};\n\n// ============================================================================\n// Storage: AsyncLocalStorage (server) or module-level store (client)\n// ============================================================================\n\ntype AsyncLocalStore<T> = { getStore(): T | undefined; run(val: T, fn: () => unknown): unknown };\n\n// Initialize ALS at module load time for SSR — no race condition\ntype AsyncHooks = { AsyncLocalStorage: new <T>() => AsyncLocalStore<T> };\n\n// workerd has no global `require`, so a bundled `require()` throws there; it does have\n// `process.getBuiltinModule` (so does Node >= 20.16), which keeps this out of the browser bundle.\nfunction loadAsyncHooks(): AsyncHooks | null {\n const proc = (globalThis as { process?: { getBuiltinModule?: (id: string) => unknown } }).process;\n try {\n const builtin = proc?.getBuiltinModule?.('node:async_hooks') as AsyncHooks | undefined;\n if (builtin?.AsyncLocalStorage) return builtin;\n } catch {\n /* fall through to require */\n }\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require('node:async_hooks') as AsyncHooks;\n } catch {\n return null;\n }\n}\n\nconst isServer = typeof window === 'undefined';\n// One instance per isolate, so a re-evaluated or duplicated copy of this module (dev\n// reloads, src next to dist) reads the scope the request middleware opened.\nconst ALS_KEY = Symbol.for('salla.twilight.context.als');\nlet _als: AsyncLocalStore<ContextData> | null = null;\nif (isServer) {\n const registry = globalThis as { [ALS_KEY]?: AsyncLocalStore<ContextData> };\n const hooks = registry[ALS_KEY] ? null : loadAsyncHooks();\n if (hooks) registry[ALS_KEY] = new hooks.AsyncLocalStorage<ContextData>();\n _als = registry[ALS_KEY] ?? null;\n}\n\n// Without request isolation every request would share `clientStore`: one visitor's\n// auth token and store settings rendered into another's page.\nfunction assertRequestIsolation(): void {\n if (isServer && !_als) {\n throw new Error(\n '[Twilight] AsyncLocalStorage is unavailable; refusing to share request state.'\n );\n }\n}\n\n// The browser's store, shared by every copy of this module on the page like the ALS above,\n// so a loader in one copy reads the location and token the router wrote through another.\nconst CLIENT_KEY = Symbol.for('salla.twilight.context.client');\nconst clientRegistry = globalThis as {\n [CLIENT_KEY]?: { store: ContextData; listeners: Set<() => void> };\n};\nconst clientShared = (clientRegistry[CLIENT_KEY] ??= {\n store: { ...DEFAULT_DATA },\n listeners: new Set<() => void>(),\n});\nconst clientStore: ContextData = clientShared.store;\n\nfunction getTwilightStore(): ContextData {\n assertRequestIsolation();\n if (_als) {\n const store = _als.getStore();\n if (!store)\n throw new Error('[Twilight] No request context. Wrap with runWithTwilightContext().');\n return store;\n }\n return clientStore;\n}\n\nfunction writableStore(): ContextData {\n if (_als) {\n const store = _als.getStore();\n if (store) return store;\n }\n return clientStore;\n}\n\nfunction mergeIntoStore(store: ContextData, partial: Partial<TwilightContext>): void {\n if ('queryClient' in partial && partial.queryClient) store.queryClient = partial.queryClient;\n if ('settings' in partial && partial.settings != null) store.settings = partial.settings;\n if ('locale' in partial && partial.locale != null) store.locale = partial.locale;\n if ('routeId' in partial && partial.routeId != null) store.routeId = partial.routeId;\n if ('location' in partial && partial.location != null)\n store.location = { ...store.location, ...partial.location };\n if ('authToken' in partial && partial.authToken !== undefined)\n store.authToken = partial.authToken ?? null;\n if ('scope' in partial && partial.scope !== undefined) store.scope = partial.scope ?? null;\n else if ('scopeId' in partial && partial.scopeId !== undefined)\n store.scope = partial.scopeId == null ? null : { id: partial.scopeId };\n if ('storeId' in partial && partial.storeId !== undefined)\n store.storeId = partial.storeId ?? null;\n if ('storeBase' in partial && partial.storeBase !== undefined)\n store.storeBase = partial.storeBase ?? null;\n if ('storeBaseFollowsLocale' in partial && partial.storeBaseFollowsLocale !== undefined)\n store.storeBaseFollowsLocale = partial.storeBaseFollowsLocale === true;\n if ('versionId' in partial && partial.versionId !== undefined)\n store.versionId = partial.versionId ?? null;\n if ('requestHost' in partial && partial.requestHost !== undefined)\n store.requestHost = partial.requestHost ?? null;\n if ('apiBase' in partial && partial.apiBase !== undefined)\n store.apiBase = partial.apiBase ?? null;\n if ('nativeAppHeaders' in partial && partial.nativeAppHeaders !== undefined)\n store.nativeAppHeaders = partial.nativeAppHeaders ?? null;\n if ('i18n' in partial && partial.i18n != null) store.i18n = partial.i18n;\n if ('page' in partial) store.page = partial.page;\n if ('appsSnippets' in partial) store.appsSnippets = partial.appsSnippets;\n if ('appsSettings' in partial) store.appsSettings = partial.appsSettings;\n if ('maintenance' in partial) store.maintenance = partial.maintenance === true;\n if ('storeNotFound' in partial) store.storeNotFound = partial.storeNotFound === true;\n if ('extras' in partial) store.extras = partial.extras;\n}\n\n// ============================================================================\n// Public API\n// ============================================================================\n\nexport function runWithTwilightContext<T>(partial: Partial<TwilightContext>, fn: () => T): T {\n assertRequestIsolation();\n if (_als) {\n const data: ContextData = { ...DEFAULT_DATA };\n mergeIntoStore(data, partial);\n return _als.run(data, fn) as T;\n }\n mergeIntoStore(clientStore, partial);\n return fn();\n}\n\n// Client-only subscription so React consumers (useRouteId/useIsHome/…) re-render\n// when navigation mutates the module store. Mirrors hooks/useWishlist.ts.\nconst listeners = clientShared.listeners;\n\nexport function subscribeTwilight(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\nexport function updateTwilightContext(partial: Partial<TwilightContext>): void {\n mergeIntoStore(getTwilightStore(), partial);\n // Server uses AsyncLocalStorage and has no React subscribers; notify on client only.\n if (typeof window !== 'undefined') {\n for (const listener of listeners) listener();\n }\n}\n\n/**\n * Whether store settings are available, without throwing.\n *\n * `getTwilightContext().settings` throws a `SettingsError` when the store is\n * empty, which is fatal inside a head function during hydration. Callers that\n * need to *test* availability must use this instead of a try/catch around the\n * getter. Returns false when there is no request context at all (server-side\n * calls outside `runWithTwilightContext`).\n */\nexport function hasTwilightSettings(): boolean {\n try {\n return getTwilightStore().settings != null;\n } catch {\n return false;\n }\n}\n\n/** What a request addressed, as opposed to what it is. */\nexport interface RequestAddressing {\n storeId: string | null;\n storeBase: string | null;\n storeBaseFollowsLocale: boolean;\n versionId: string | null;\n requestHost: string | null;\n apiBase: string | null;\n}\n\n/**\n * What this request named and the host it arrived on, without throwing.\n *\n * Separate from {@link getTwilightContext} because store identity is read while\n * deciding *what to fetch* — before there is a context worth having — and on the\n * server outside a request the getter throws. A caller asking \"which store?\" has\n * a sane answer for \"none named\"; it has none for an exception.\n *\n * The version rides along rather than getting an accessor of its own: it is read\n * at the same moment, for the same reason, and by the same callers, and a second\n * copy of this try/catch would be a second thing to remember to widen.\n */\nexport function getRequestStore(): RequestAddressing {\n try {\n const data = getTwilightStore();\n return {\n storeId: data.storeId,\n storeBase: data.storeBase,\n storeBaseFollowsLocale: data.storeBaseFollowsLocale,\n versionId: data.versionId,\n requestHost: data.requestHost,\n apiBase: data.apiBase,\n };\n } catch {\n return {\n storeId: null,\n storeBase: null,\n storeBaseFollowsLocale: false,\n versionId: null,\n requestHost: null,\n apiBase: null,\n };\n }\n}\n\nexport function getTwilightContext(): TwilightContext {\n const data = getTwilightStore();\n return {\n get queryClient() {\n return data.queryClient;\n },\n get settings() {\n if (!data.settings) throw new SettingsError();\n return data.settings;\n },\n get locale() {\n return data.locale;\n },\n get routeId() {\n return data.routeId;\n },\n get location() {\n return data.location;\n },\n get authToken() {\n return data.authToken;\n },\n get scope() {\n return data.scope;\n },\n get scopeId() {\n return data.scope?.id ?? null;\n },\n get storeId() {\n return data.storeId;\n },\n get storeBase() {\n return data.storeBase;\n },\n get storeBaseFollowsLocale() {\n return data.storeBaseFollowsLocale;\n },\n get versionId() {\n return data.versionId;\n },\n get requestHost() {\n return data.requestHost;\n },\n get apiBase() {\n return data.apiBase;\n },\n get nativeAppHeaders() {\n return data.nativeAppHeaders;\n },\n get i18n() {\n if (!data.i18n) {\n // Composed the same way as `rootBeforeLoad` and the hydration path —\n // the platform's copy with this merchant's over it. See\n // `api/messages.ts`: this accessor reading one entry while the others\n // read two is precisely the drift that module exists to stop.\n data.i18n = createI18nInstance(\n data.locale,\n messagesForLocale(data.queryClient, data.locale)\n );\n }\n return data.i18n;\n },\n get dir() {\n return getLanguageInfo(data.locale).dir;\n },\n get page() {\n return data.page;\n },\n get appsSnippets() {\n return data.appsSnippets;\n },\n get appsSettings() {\n return data.appsSettings;\n },\n get maintenance() {\n return data.maintenance;\n },\n get storeNotFound() {\n return data.storeNotFound;\n },\n get extras() {\n return data.extras;\n },\n };\n}\n\n/** @internal Reset store for testing */\nexport function resetForTesting(): void {\n Object.assign(writableStore(), { ...DEFAULT_DATA });\n}\n"]}