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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (367) hide show
  1. package/dist/{AddToCartForm-KIQ3YVC7.js → AddToCartForm-INTHBVVX.js} +5 -4
  2. package/dist/AddToCartForm-INTHBVVX.js.map +1 -0
  3. package/dist/{BlogAuthorPage-YNCYWLVN.js → BlogAuthorPage-H5H7TVSK.js} +32 -31
  4. package/dist/BlogAuthorPage-H5H7TVSK.js.map +1 -0
  5. package/dist/{BlogCategoryPage-IGIRJONV.js → BlogCategoryPage-LJOEQNGO.js} +32 -31
  6. package/dist/BlogCategoryPage-LJOEQNGO.js.map +1 -0
  7. package/dist/{BlogPage-RLY6E4E5.js → BlogPage-RLKZKLOB.js} +30 -29
  8. package/dist/BlogPage-RLKZKLOB.js.map +1 -0
  9. package/dist/{BlogSinglePage-7WB3VBNN.js → BlogSinglePage-7MWTO32X.js} +30 -29
  10. package/dist/BlogSinglePage-7MWTO32X.js.map +1 -0
  11. package/dist/{BlogTagPage-UIWFQX3P.js → BlogTagPage-OCCQVZWT.js} +32 -31
  12. package/dist/BlogTagPage-OCCQVZWT.js.map +1 -0
  13. package/dist/{BrandsPage-LY2PLW4S.js → BrandsPage-2YUNURJL.js} +31 -30
  14. package/dist/BrandsPage-2YUNURJL.js.map +1 -0
  15. package/dist/{Breadcrumb-IXERIJBI.js → Breadcrumb-XCIWXGZ2.js} +30 -29
  16. package/dist/Breadcrumb-XCIWXGZ2.js.map +1 -0
  17. package/dist/{CanvasOverlay-2WJ4QER3.js → CanvasOverlay-L2SE4YNF.js} +4 -4
  18. package/dist/{CanvasOverlay-2WJ4QER3.js.map → CanvasOverlay-L2SE4YNF.js.map} +1 -1
  19. package/dist/{CartItem-32Y2BVCY.js → CartItem-KGBPLEKI.js} +30 -29
  20. package/dist/CartItem-KGBPLEKI.js.map +1 -0
  21. package/dist/{CartSummary-XR52UPHU.js → CartSummary-UI26T2XZ.js} +30 -29
  22. package/dist/CartSummary-UI26T2XZ.js.map +1 -0
  23. package/dist/{Copyright-UHXO2XAS.js → Copyright-LERJ2GQG.js} +5 -4
  24. package/dist/Copyright-LERJ2GQG.js.map +1 -0
  25. package/dist/{CustomerLayout-CD3N3YVA.js → CustomerLayout-NBVNSACY.js} +30 -29
  26. package/dist/CustomerLayout-NBVNSACY.js.map +1 -0
  27. package/dist/Footer-N2IHHIYP.js +19 -0
  28. package/dist/{Footer-VDXJFLKM.js.map → Footer-N2IHHIYP.js.map} +1 -1
  29. package/dist/GoogleTag-MCDINMLU.js +15 -0
  30. package/dist/{GoogleTag-UDEQTF5G.js.map → GoogleTag-MCDINMLU.js.map} +1 -1
  31. package/dist/{Header-DMK4INZE.js → Header-3ZIJWLWT.js} +12 -11
  32. package/dist/{Header-DMK4INZE.js.map → Header-3ZIJWLWT.js.map} +1 -1
  33. package/dist/{LatestProducts-7KWFHGC5.js → LatestProducts-JSPMCNBR.js} +32 -31
  34. package/dist/LatestProducts-JSPMCNBR.js.map +1 -0
  35. package/dist/{LiveEditorBar-4C7Z7K3M.js → LiveEditorBar-BSCHU7WO.js} +3 -3
  36. package/dist/{LiveEditorBar-4C7Z7K3M.js.map → LiveEditorBar-BSCHU7WO.js.map} +1 -1
  37. package/dist/{LoyaltyPage-NKAAAGCX.js → LoyaltyPage-4FCXNGJU.js} +30 -29
  38. package/dist/LoyaltyPage-4FCXNGJU.js.map +1 -0
  39. package/dist/{LoyaltyPointsPage-RRAYL237.js → LoyaltyPointsPage-BVRMRPQP.js} +12 -11
  40. package/dist/LoyaltyPointsPage-BVRMRPQP.js.map +1 -0
  41. package/dist/{MainMenu-WJOVBJVW.js → MainMenu-ERTVTNVE.js} +8 -7
  42. package/dist/MainMenu-ERTVTNVE.js.map +1 -0
  43. package/dist/{MasterLayout-ORV7VBB4.js → MasterLayout-O7F5TP2X.js} +30 -29
  44. package/dist/{MasterLayout-ORV7VBB4.js.map → MasterLayout-O7F5TP2X.js.map} +1 -1
  45. package/dist/{MobileMenu-OS4IQUXT.js → MobileMenu-XLDU76UD.js} +32 -31
  46. package/dist/MobileMenu-XLDU76UD.js.map +1 -0
  47. package/dist/{NotificationsPage-2XF37NBH.js → NotificationsPage-PV3BZDDN.js} +30 -29
  48. package/dist/NotificationsPage-PV3BZDDN.js.map +1 -0
  49. package/dist/{OrderSinglePage-RU3ZWJNH.js → OrderSinglePage-N27RQCWW.js} +31 -30
  50. package/dist/OrderSinglePage-N27RQCWW.js.map +1 -0
  51. package/dist/{OrdersPage-NTQTWL72.js → OrdersPage-VAF25LAZ.js} +30 -29
  52. package/dist/OrdersPage-VAF25LAZ.js.map +1 -0
  53. package/dist/{PageSingle-PGV2RTUR.js → PageSingle-6DZL7G7F.js} +6 -5
  54. package/dist/PageSingle-6DZL7G7F.js.map +1 -0
  55. package/dist/{ProductDetails-ZY7J7RMY.js → ProductDetails-JELMTMQY.js} +9 -8
  56. package/dist/{ProductDetails-ZY7J7RMY.js.map → ProductDetails-JELMTMQY.js.map} +1 -1
  57. package/dist/{ProfilePage-VFI5XWAT.js → ProfilePage-7WPASJD3.js} +30 -29
  58. package/dist/ProfilePage-7WPASJD3.js.map +1 -0
  59. package/dist/{RenderWhenVisible-BQ7KVPHK.js → RenderWhenVisible-KNNLS5N2.js} +4 -2
  60. package/dist/RenderWhenVisible-KNNLS5N2.js.map +1 -0
  61. package/dist/{ReviewsPage-6AE54WFQ.js → ReviewsPage-OGU4HCDP.js} +5 -4
  62. package/dist/ReviewsPage-OGU4HCDP.js.map +1 -0
  63. package/dist/{SeoCartWidget-E2AWNOYU.js → SeoCartWidget-NF5S4KFI.js} +30 -29
  64. package/dist/SeoCartWidget-NF5S4KFI.js.map +1 -0
  65. package/dist/{SettingsPage-XHTIFJDC.js → SettingsPage-ZGQN6HZS.js} +30 -29
  66. package/dist/SettingsPage-ZGQN6HZS.js.map +1 -0
  67. package/dist/{StoreClosedNotification-QBKQZUYZ.js → StoreClosedNotification-RUNFBE3K.js} +31 -30
  68. package/dist/{StoreClosedNotification-QBKQZUYZ.js.map → StoreClosedNotification-RUNFBE3K.js.map} +1 -1
  69. package/dist/{TestimonialsPage-T3FE36LX.js → TestimonialsPage-RYT6EWHH.js} +6 -5
  70. package/dist/TestimonialsPage-RYT6EWHH.js.map +1 -0
  71. package/dist/{ThankYouPage-3MOKMZF5.js → ThankYouPage-G62URSEM.js} +30 -29
  72. package/dist/ThankYouPage-G62URSEM.js.map +1 -0
  73. package/dist/{WalletPage-QYU237QZ.js → WalletPage-V6EKL76S.js} +31 -30
  74. package/dist/WalletPage-V6EKL76S.js.map +1 -0
  75. package/dist/{WebMcpTools-B255SPSA.js → WebMcpTools-WSQQXYZF.js} +7 -6
  76. package/dist/WebMcpTools-WSQQXYZF.js.map +1 -0
  77. package/dist/WidgetHead-3NUEKRIE.js +8 -0
  78. package/dist/{WidgetHead-BCRIXIJQ.js.map → WidgetHead-3NUEKRIE.js.map} +1 -1
  79. package/dist/{WishlistPage-QQLWTHU2.js → WishlistPage-N7J54KUD.js} +32 -31
  80. package/dist/WishlistPage-N7J54KUD.js.map +1 -0
  81. package/dist/api/advertisement.js +2 -2
  82. package/dist/api/apps.js +2 -2
  83. package/dist/api/blog.js +5 -4
  84. package/dist/api/brands.js +5 -4
  85. package/dist/api/cart.js +5 -4
  86. package/dist/api/category.js +5 -4
  87. package/dist/api/client.js +1 -1
  88. package/dist/api/custom-url.js +2 -2
  89. package/dist/api/home.js +2 -2
  90. package/dist/api/loyalty.js +5 -4
  91. package/dist/api/menu.js +2 -2
  92. package/dist/api/notification.js +2 -2
  93. package/dist/api/order.js +5 -4
  94. package/dist/api/page.js +5 -4
  95. package/dist/api/product.js +5 -4
  96. package/dist/api/profile.js +1 -1
  97. package/dist/api/store.js +2 -2
  98. package/dist/api/translations.js +2 -2
  99. package/dist/api/user.js +2 -2
  100. package/dist/api/wallet.js +2 -2
  101. package/dist/api/wishlist.js +6 -5
  102. package/dist/{chunk-AXX7A2JJ.js → chunk-2QDPVKV3.js} +3 -3
  103. package/dist/{chunk-AXX7A2JJ.js.map → chunk-2QDPVKV3.js.map} +1 -1
  104. package/dist/{chunk-LDZJIVNG.js → chunk-3H6CED6M.js} +12 -10
  105. package/dist/chunk-3H6CED6M.js.map +1 -0
  106. package/dist/{chunk-DF6FBKDN.js → chunk-3VFOVWOE.js} +4 -3
  107. package/dist/chunk-3VFOVWOE.js.map +1 -0
  108. package/dist/{chunk-6R4ONYWT.js → chunk-5JEGXLR3.js} +9 -9
  109. package/dist/{chunk-6R4ONYWT.js.map → chunk-5JEGXLR3.js.map} +1 -1
  110. package/dist/{chunk-ZJYS5SJV.js → chunk-5LCLA2ER.js} +4 -4
  111. package/dist/{chunk-ZJYS5SJV.js.map → chunk-5LCLA2ER.js.map} +1 -1
  112. package/dist/chunk-6DHU2JNP.js +16 -0
  113. package/dist/{chunk-427CGPGK.js.map → chunk-6DHU2JNP.js.map} +1 -1
  114. package/dist/{chunk-ON7IFLME.js → chunk-6DVPJV53.js} +4 -4
  115. package/dist/{chunk-ON7IFLME.js.map → chunk-6DVPJV53.js.map} +1 -1
  116. package/dist/{chunk-4BDLDIHM.js → chunk-7DOPO5Y5.js} +4 -4
  117. package/dist/{chunk-4BDLDIHM.js.map → chunk-7DOPO5Y5.js.map} +1 -1
  118. package/dist/{chunk-44CLNMNF.js → chunk-7PLRJOAQ.js} +4 -4
  119. package/dist/{chunk-44CLNMNF.js.map → chunk-7PLRJOAQ.js.map} +1 -1
  120. package/dist/{chunk-DHSCGEZG.js → chunk-A3CRAPYV.js} +3 -3
  121. package/dist/{chunk-DHSCGEZG.js.map → chunk-A3CRAPYV.js.map} +1 -1
  122. package/dist/{chunk-62QKV5MR.js → chunk-A4FUMTWR.js} +3 -3
  123. package/dist/{chunk-62QKV5MR.js.map → chunk-A4FUMTWR.js.map} +1 -1
  124. package/dist/{chunk-TYMQSUHJ.js → chunk-ACUIK2FS.js} +3 -3
  125. package/dist/{chunk-TYMQSUHJ.js.map → chunk-ACUIK2FS.js.map} +1 -1
  126. package/dist/{chunk-YVCY6KOT.js → chunk-ANRVEE4Q.js} +4 -4
  127. package/dist/{chunk-YVCY6KOT.js.map → chunk-ANRVEE4Q.js.map} +1 -1
  128. package/dist/{chunk-3GIV335V.js → chunk-AQM3T2VJ.js} +3 -3
  129. package/dist/{chunk-3GIV335V.js.map → chunk-AQM3T2VJ.js.map} +1 -1
  130. package/dist/{chunk-7W43AJMQ.js → chunk-BB2HK4XJ.js} +3 -3
  131. package/dist/{chunk-7W43AJMQ.js.map → chunk-BB2HK4XJ.js.map} +1 -1
  132. package/dist/{chunk-NARBS52P.js → chunk-BLBWBTFO.js} +5 -5
  133. package/dist/{chunk-NARBS52P.js.map → chunk-BLBWBTFO.js.map} +1 -1
  134. package/dist/{chunk-OQIIJRAS.js → chunk-CBP4AT5U.js} +3 -3
  135. package/dist/{chunk-OQIIJRAS.js.map → chunk-CBP4AT5U.js.map} +1 -1
  136. package/dist/{chunk-H34NG4MP.js → chunk-CBRRRKGQ.js} +9 -7
  137. package/dist/chunk-CBRRRKGQ.js.map +1 -0
  138. package/dist/chunk-CFDSLP3D.js +25 -0
  139. package/dist/{chunk-NX2C7X4T.js.map → chunk-CFDSLP3D.js.map} +1 -1
  140. package/dist/{chunk-OA7ANM26.js → chunk-ENMUBWTR.js} +4 -4
  141. package/dist/{chunk-OA7ANM26.js.map → chunk-ENMUBWTR.js.map} +1 -1
  142. package/dist/{chunk-N4QBHMSZ.js → chunk-F5I7BANX.js} +5 -5
  143. package/dist/{chunk-N4QBHMSZ.js.map → chunk-F5I7BANX.js.map} +1 -1
  144. package/dist/{chunk-MAQQHQJX.js → chunk-FU2LJG5L.js} +4 -4
  145. package/dist/{chunk-MAQQHQJX.js.map → chunk-FU2LJG5L.js.map} +1 -1
  146. package/dist/{chunk-V2ZDTY6H.js → chunk-FWNSNBLY.js} +4 -4
  147. package/dist/{chunk-V2ZDTY6H.js.map → chunk-FWNSNBLY.js.map} +1 -1
  148. package/dist/{chunk-LDOFRMKE.js → chunk-FYE5XYLV.js} +4 -4
  149. package/dist/{chunk-LDOFRMKE.js.map → chunk-FYE5XYLV.js.map} +1 -1
  150. package/dist/{chunk-NQ6JUQHV.js → chunk-G7AL4NFZ.js} +3 -3
  151. package/dist/{chunk-NQ6JUQHV.js.map → chunk-G7AL4NFZ.js.map} +1 -1
  152. package/dist/{chunk-FZKRSGLP.js → chunk-GIMXGRBB.js} +3 -3
  153. package/dist/{chunk-FZKRSGLP.js.map → chunk-GIMXGRBB.js.map} +1 -1
  154. package/dist/{chunk-W4XBIDUP.js → chunk-GNC3U6G3.js} +4 -4
  155. package/dist/{chunk-W4XBIDUP.js.map → chunk-GNC3U6G3.js.map} +1 -1
  156. package/dist/{chunk-VPDADIS7.js → chunk-HYZXDMLX.js} +8 -8
  157. package/dist/{chunk-VPDADIS7.js.map → chunk-HYZXDMLX.js.map} +1 -1
  158. package/dist/{chunk-XQEWBUQ2.js → chunk-ID2UT4AE.js} +3 -3
  159. package/dist/{chunk-XQEWBUQ2.js.map → chunk-ID2UT4AE.js.map} +1 -1
  160. package/dist/{chunk-AA3PV6UD.js → chunk-JCI3IQJV.js} +4 -4
  161. package/dist/{chunk-AA3PV6UD.js.map → chunk-JCI3IQJV.js.map} +1 -1
  162. package/dist/{chunk-QT2D7JMW.js → chunk-K4HCMVAQ.js} +6 -6
  163. package/dist/{chunk-QT2D7JMW.js.map → chunk-K4HCMVAQ.js.map} +1 -1
  164. package/dist/{chunk-ELGZOQEY.js → chunk-K4QQRA6L.js} +4 -3
  165. package/dist/chunk-K4QQRA6L.js.map +1 -0
  166. package/dist/{chunk-KHK4UPEO.js → chunk-KNOIQCGE.js} +3 -3
  167. package/dist/{chunk-KHK4UPEO.js.map → chunk-KNOIQCGE.js.map} +1 -1
  168. package/dist/{chunk-QRAYSZPX.js → chunk-M4MMTQ75.js} +3 -3
  169. package/dist/{chunk-QRAYSZPX.js.map → chunk-M4MMTQ75.js.map} +1 -1
  170. package/dist/{chunk-4ZZKONOP.js → chunk-NDFBNHC4.js} +4 -4
  171. package/dist/{chunk-4ZZKONOP.js.map → chunk-NDFBNHC4.js.map} +1 -1
  172. package/dist/{chunk-MAT72BLA.js → chunk-NLH6ZEZ3.js} +3 -3
  173. package/dist/{chunk-MAT72BLA.js.map → chunk-NLH6ZEZ3.js.map} +1 -1
  174. package/dist/{chunk-G7WZ36MV.js → chunk-NXBYMNTS.js} +3 -3
  175. package/dist/{chunk-G7WZ36MV.js.map → chunk-NXBYMNTS.js.map} +1 -1
  176. package/dist/{chunk-Q4BL374L.js → chunk-OJA5QF6U.js} +15 -15
  177. package/dist/{chunk-Q4BL374L.js.map → chunk-OJA5QF6U.js.map} +1 -1
  178. package/dist/{chunk-LWI6MK3W.js → chunk-OKE2NZDI.js} +5 -3
  179. package/dist/chunk-OKE2NZDI.js.map +1 -0
  180. package/dist/{chunk-6TKIUG5C.js → chunk-OLN2QRGA.js} +3 -3
  181. package/dist/{chunk-6TKIUG5C.js.map → chunk-OLN2QRGA.js.map} +1 -1
  182. package/dist/{chunk-FFRTTMJN.js → chunk-OU55CVZI.js} +3 -3
  183. package/dist/{chunk-FFRTTMJN.js.map → chunk-OU55CVZI.js.map} +1 -1
  184. package/dist/{chunk-Q2D7CVAM.js → chunk-POSA5IOU.js} +3 -3
  185. package/dist/{chunk-Q2D7CVAM.js.map → chunk-POSA5IOU.js.map} +1 -1
  186. package/dist/{chunk-R6PS4MUD.js → chunk-PVKCR63Z.js} +4 -4
  187. package/dist/{chunk-R6PS4MUD.js.map → chunk-PVKCR63Z.js.map} +1 -1
  188. package/dist/{chunk-EUUIQ2RK.js → chunk-PZWVE7G6.js} +5 -5
  189. package/dist/{chunk-EUUIQ2RK.js.map → chunk-PZWVE7G6.js.map} +1 -1
  190. package/dist/{chunk-F5EDBW5Q.js → chunk-Q2VP3J4X.js} +6 -6
  191. package/dist/{chunk-F5EDBW5Q.js.map → chunk-Q2VP3J4X.js.map} +1 -1
  192. package/dist/{chunk-HHAR2YJN.js → chunk-R3FQW5X3.js} +4 -2
  193. package/dist/chunk-R3FQW5X3.js.map +1 -0
  194. package/dist/{chunk-FOSFAMZY.js → chunk-RBALJL3B.js} +4 -4
  195. package/dist/{chunk-FOSFAMZY.js.map → chunk-RBALJL3B.js.map} +1 -1
  196. package/dist/{chunk-Z7D36OEF.js → chunk-RBOZRX5Q.js} +4 -4
  197. package/dist/{chunk-Z7D36OEF.js.map → chunk-RBOZRX5Q.js.map} +1 -1
  198. package/dist/{chunk-7CQGFKKW.js → chunk-SG2B3Z7C.js} +4 -4
  199. package/dist/{chunk-7CQGFKKW.js.map → chunk-SG2B3Z7C.js.map} +1 -1
  200. package/dist/{chunk-PNJFMMPV.js → chunk-SM35CH2U.js} +3 -3
  201. package/dist/{chunk-PNJFMMPV.js.map → chunk-SM35CH2U.js.map} +1 -1
  202. package/dist/{chunk-NFD5EJ7W.js → chunk-SSMM6ZEQ.js} +3 -3
  203. package/dist/{chunk-NFD5EJ7W.js.map → chunk-SSMM6ZEQ.js.map} +1 -1
  204. package/dist/chunk-T43GL7UN.js +36 -0
  205. package/dist/chunk-T43GL7UN.js.map +1 -0
  206. package/dist/{chunk-VYGA5AT5.js → chunk-TLHZBTPZ.js} +8 -3
  207. package/dist/chunk-TLHZBTPZ.js.map +1 -0
  208. package/dist/{chunk-KYMWEUN2.js → chunk-TVL6UBN2.js} +3 -3
  209. package/dist/{chunk-KYMWEUN2.js.map → chunk-TVL6UBN2.js.map} +1 -1
  210. package/dist/{chunk-64BWBCE7.js → chunk-UY4VIWNH.js} +4 -2
  211. package/dist/chunk-UY4VIWNH.js.map +1 -0
  212. package/dist/{chunk-I3RQO6LI.js → chunk-V5DQMUSV.js} +4 -4
  213. package/dist/{chunk-I3RQO6LI.js.map → chunk-V5DQMUSV.js.map} +1 -1
  214. package/dist/{chunk-XGNKN4K5.js → chunk-VBMD3J7W.js} +5 -5
  215. package/dist/{chunk-XGNKN4K5.js.map → chunk-VBMD3J7W.js.map} +1 -1
  216. package/dist/{chunk-L5JO3H2U.js → chunk-WHGEXTQR.js} +40 -28
  217. package/dist/chunk-WHGEXTQR.js.map +1 -0
  218. package/dist/{chunk-XGOTO6VJ.js → chunk-X2QKWMWJ.js} +3 -3
  219. package/dist/{chunk-XGOTO6VJ.js.map → chunk-X2QKWMWJ.js.map} +1 -1
  220. package/dist/{chunk-5XDPAKF5.js → chunk-XZFWBF3P.js} +5 -3
  221. package/dist/chunk-XZFWBF3P.js.map +1 -0
  222. package/dist/{chunk-QANZP6LR.js → chunk-Y2YNVU6U.js} +3 -3
  223. package/dist/{chunk-QANZP6LR.js.map → chunk-Y2YNVU6U.js.map} +1 -1
  224. package/dist/{chunk-42N3PTIX.js → chunk-Y4WL6IRA.js} +3 -3
  225. package/dist/{chunk-42N3PTIX.js.map → chunk-Y4WL6IRA.js.map} +1 -1
  226. package/dist/{chunk-UJBNYOBE.js → chunk-ZCE3SGDY.js} +5 -5
  227. package/dist/{chunk-UJBNYOBE.js.map → chunk-ZCE3SGDY.js.map} +1 -1
  228. package/dist/{chunk-VTBDEJYJ.js → chunk-ZR6TA5TS.js} +4 -4
  229. package/dist/{chunk-VTBDEJYJ.js.map → chunk-ZR6TA5TS.js.map} +1 -1
  230. package/dist/components/cart/index.js +3 -2
  231. package/dist/components/common/RenderWhenVisible.d.ts.map +1 -1
  232. package/dist/components/common/index.js +3 -2
  233. package/dist/components/drawer/index.js +29 -28
  234. package/dist/components/home/ProductsSlider.d.ts.map +1 -1
  235. package/dist/components/home/index.js +33 -32
  236. package/dist/components/layout/index.js +10 -9
  237. package/dist/components/live-editor/frame.d.ts +5 -0
  238. package/dist/components/live-editor/frame.d.ts.map +1 -1
  239. package/dist/components/live-editor/index.d.ts.map +1 -1
  240. package/dist/components/modal/index.js +3 -2
  241. package/dist/components/product/ProductGallery.d.ts.map +1 -1
  242. package/dist/components/product/index.js +30 -29
  243. package/dist/components/store/index.js +29 -28
  244. package/dist/components/toast/index.js +3 -2
  245. package/dist/components/toast/index.js.map +1 -1
  246. package/dist/components/tracking/index.js +8 -7
  247. package/dist/components/tracking/index.js.map +1 -1
  248. package/dist/{custom-urls-NOM56TUW.js → custom-urls-3G5KPPAY.js} +9 -8
  249. package/dist/{custom-urls-NOM56TUW.js.map → custom-urls-3G5KPPAY.js.map} +1 -1
  250. package/dist/dev/editor/index.js +2 -2
  251. package/dist/dev/index.js +1 -1
  252. package/dist/{document-class-B6SA3O2R.js → document-class-LYNTNC52.js} +20 -19
  253. package/dist/{document-class-B6SA3O2R.js.map → document-class-LYNTNC52.js.map} +1 -1
  254. package/dist/hooks/HookSlot.d.ts.map +1 -1
  255. package/dist/hooks/HookSlot.js +3 -2
  256. package/dist/hooks/index.js +28 -27
  257. package/dist/hooks/useComments.d.ts.map +1 -1
  258. package/dist/hooks/useComments.js +2 -1
  259. package/dist/hooks/useGtm.js +28 -27
  260. package/dist/hooks/useMoney.js +28 -27
  261. package/dist/hooks/useProduct.d.ts.map +1 -1
  262. package/dist/hooks/useProduct.js +2 -1
  263. package/dist/hooks/useStore.js +28 -27
  264. package/dist/hooks/useTheme.js +3 -2
  265. package/dist/hooks/useUser.d.ts.map +1 -1
  266. package/dist/hooks/useUser.js +4 -3
  267. package/dist/index.js +28 -27
  268. package/dist/index.js.map +1 -1
  269. package/dist/{navigation-WSK4ESIY.js → navigation-AHHVAUWR.js} +7 -6
  270. package/dist/{navigation-WSK4ESIY.js.map → navigation-AHHVAUWR.js.map} +1 -1
  271. package/dist/{navigation-CVWUS27U.js → navigation-MRUGGEGM.js} +6 -5
  272. package/dist/navigation-MRUGGEGM.js.map +1 -0
  273. package/dist/{not-found-FHZ2IBEK.js → not-found-6EKRK524.js} +31 -30
  274. package/dist/not-found-6EKRK524.js.map +1 -0
  275. package/dist/providers/index.js +28 -27
  276. package/dist/providers/twilight-context.d.ts.map +1 -1
  277. package/dist/routes/account/orders.js +7 -6
  278. package/dist/routes/account.js +16 -15
  279. package/dist/routes/account.js.map +1 -1
  280. package/dist/routes/blog.js +11 -10
  281. package/dist/routes/blog.js.map +1 -1
  282. package/dist/routes/brands.js +7 -6
  283. package/dist/routes/brands.js.map +1 -1
  284. package/dist/routes/cart.js +38 -37
  285. package/dist/routes/cart.js.map +1 -1
  286. package/dist/routes/home.js +34 -33
  287. package/dist/routes/index.js +10 -9
  288. package/dist/routes/loyalty.js +8 -7
  289. package/dist/routes/loyalty.js.map +1 -1
  290. package/dist/routes/page.js +7 -6
  291. package/dist/routes/page.js.map +1 -1
  292. package/dist/routes/product-listing.js +39 -38
  293. package/dist/routes/product-listing.js.map +1 -1
  294. package/dist/routes/product.js +37 -36
  295. package/dist/routes/product.js.map +1 -1
  296. package/dist/routes/seo-redirects.js +10 -9
  297. package/dist/routes/testimonials.js +4 -3
  298. package/dist/routes/testimonials.js.map +1 -1
  299. package/dist/routes/thank-you.js +7 -6
  300. package/dist/routes/thank-you.js.map +1 -1
  301. package/dist/server/entry.js +24 -11
  302. package/dist/server/entry.js.map +1 -1
  303. package/dist/server/stream-handler.d.ts.map +1 -1
  304. package/dist/skeleton.js +36 -35
  305. package/dist/{store-lookup-ER67ZNEB.js → store-lookup-NRR66HZ7.js} +10 -9
  306. package/dist/store-lookup-NRR66HZ7.js.map +1 -0
  307. package/dist/tanstack.js +20 -19
  308. package/dist/tanstack.js.map +1 -1
  309. package/dist/utils/index.js +2 -2
  310. package/dist/utils/lazy-component.d.ts.map +1 -1
  311. package/dist/utils/render-probe.d.ts +31 -0
  312. package/dist/utils/render-probe.d.ts.map +1 -0
  313. package/package.json +1 -1
  314. package/tailwind/components/common/RenderWhenVisible.tsx.txt +2 -0
  315. package/tailwind/components/home/ProductsSlider.tsx.txt +2 -0
  316. package/tailwind/components/live-editor/frame.ts.txt +6 -0
  317. package/tailwind/components/live-editor/index.tsx.txt +22 -2
  318. package/tailwind/components/product/ProductGallery.tsx.txt +2 -0
  319. package/dist/AddToCartForm-KIQ3YVC7.js.map +0 -1
  320. package/dist/BlogAuthorPage-YNCYWLVN.js.map +0 -1
  321. package/dist/BlogCategoryPage-IGIRJONV.js.map +0 -1
  322. package/dist/BlogPage-RLY6E4E5.js.map +0 -1
  323. package/dist/BlogSinglePage-7WB3VBNN.js.map +0 -1
  324. package/dist/BlogTagPage-UIWFQX3P.js.map +0 -1
  325. package/dist/BrandsPage-LY2PLW4S.js.map +0 -1
  326. package/dist/Breadcrumb-IXERIJBI.js.map +0 -1
  327. package/dist/CartItem-32Y2BVCY.js.map +0 -1
  328. package/dist/CartSummary-XR52UPHU.js.map +0 -1
  329. package/dist/Copyright-UHXO2XAS.js.map +0 -1
  330. package/dist/CustomerLayout-CD3N3YVA.js.map +0 -1
  331. package/dist/Footer-VDXJFLKM.js +0 -18
  332. package/dist/GoogleTag-UDEQTF5G.js +0 -15
  333. package/dist/LatestProducts-7KWFHGC5.js.map +0 -1
  334. package/dist/LoyaltyPage-NKAAAGCX.js.map +0 -1
  335. package/dist/LoyaltyPointsPage-RRAYL237.js.map +0 -1
  336. package/dist/MainMenu-WJOVBJVW.js.map +0 -1
  337. package/dist/MobileMenu-OS4IQUXT.js.map +0 -1
  338. package/dist/NotificationsPage-2XF37NBH.js.map +0 -1
  339. package/dist/OrderSinglePage-RU3ZWJNH.js.map +0 -1
  340. package/dist/OrdersPage-NTQTWL72.js.map +0 -1
  341. package/dist/PageSingle-PGV2RTUR.js.map +0 -1
  342. package/dist/ProfilePage-VFI5XWAT.js.map +0 -1
  343. package/dist/RenderWhenVisible-BQ7KVPHK.js.map +0 -1
  344. package/dist/ReviewsPage-6AE54WFQ.js.map +0 -1
  345. package/dist/SeoCartWidget-E2AWNOYU.js.map +0 -1
  346. package/dist/SettingsPage-XHTIFJDC.js.map +0 -1
  347. package/dist/TestimonialsPage-T3FE36LX.js.map +0 -1
  348. package/dist/ThankYouPage-3MOKMZF5.js.map +0 -1
  349. package/dist/WalletPage-QYU237QZ.js.map +0 -1
  350. package/dist/WebMcpTools-B255SPSA.js.map +0 -1
  351. package/dist/WidgetHead-BCRIXIJQ.js +0 -7
  352. package/dist/WishlistPage-QQLWTHU2.js.map +0 -1
  353. package/dist/chunk-427CGPGK.js +0 -16
  354. package/dist/chunk-5XDPAKF5.js.map +0 -1
  355. package/dist/chunk-64BWBCE7.js.map +0 -1
  356. package/dist/chunk-DF6FBKDN.js.map +0 -1
  357. package/dist/chunk-ELGZOQEY.js.map +0 -1
  358. package/dist/chunk-H34NG4MP.js.map +0 -1
  359. package/dist/chunk-HHAR2YJN.js.map +0 -1
  360. package/dist/chunk-L5JO3H2U.js.map +0 -1
  361. package/dist/chunk-LDZJIVNG.js.map +0 -1
  362. package/dist/chunk-LWI6MK3W.js.map +0 -1
  363. package/dist/chunk-NX2C7X4T.js +0 -25
  364. package/dist/chunk-VYGA5AT5.js.map +0 -1
  365. package/dist/navigation-CVWUS27U.js.map +0 -1
  366. package/dist/not-found-FHZ2IBEK.js.map +0 -1
  367. package/dist/store-lookup-ER67ZNEB.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/lib/analytics/gtm-page.ts"],"names":["user"],"mappings":";;;;;;;;AAuCO,IAAM,qBAAA,GAAwB;AAErC,IAAI,KAAA,GAAuB,QAAQ,OAAA,EAAQ;AAC3C,IAAI,iBAAA,GAAoB,KAAA;AACxB,IAAI,WAAA,GAA6B,IAAA;AACjC,IAAI,oBAAgC,MAAM;AAAC,CAAA;AAC3C,IAAI,gBAAgB,IAAI,OAAA,CAAc,CAAC,OAAA,KAAa,oBAAoB,OAAQ,CAAA;AAChF,IAAI,eAAA,GAAuC,IAAA;AAE3C,IAAI,eAAA,uBAAsB,GAAA,EAAY;AAG/B,SAAS,eAAA,GAAiC;AAC/C,EAAA,OAAO,aAAA;AACT;AAEA,SAAS,mBAAA,GAAgD;AACvD,EAAA,IAAI;AACF,IAAA,OAAO,oBAAmB,CAAE,QAAA;AAAA,EAC9B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAEA,SAAS,QAAQ,IAAA,EAA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AAA,EAAS,IAAI,CAAA,IAAK,OAAO,OAAA,CAAQ,OAAA,KAAY,SAAA,EAAW;AAC3E,IAAA,MAAM,WAAW,OAAA,CAAQ,IAAA;AACzB,IAAA,MAAM,WAAW,mBAAA,EAAoB;AACrC,IAAA,IAAI,CAAC,QAAA,CAAS,MAAA,IAAU,CAAC,UAAA,CAAW,QAAQ,CAAA,EAAG;AAE/C,IAAA,MAAM,cAAc,cAAA,CAAe,QAAA,EAAU,oBAAmB,CAAE,IAAA,IAAQ,QAAW,QAAQ,CAAA;AAC7F,IAAA,OAAA,CAAQ,MAAM;AACZ,MAAA,eAAA,CAAgB,EAAE,SAAA,EAAW,EAAE,WAAA,EAAa,IAAA,IAAQ,CAAA;AACpD,MAAA,eAAA,CAAgB,WAAW,CAAA;AAAA,IAC7B,CAAC,CAAA;AAAA,EACH,CAAC,CAAA;AACH","file":"chunk-7CQGFKKW.js","sourcesContent":["/**\n * The order a Twig page fills the data layer in, for a storefront that loads once.\n *\n * A Twig page opens with its own data (`page`, `store`, `customer`, and the page's ecommerce\n * block), then loads the containers, then hands the SDK `twilight::init` and each\n * `services::<name>.init`, which the SDK copies into the data layer. Tags fire on those events\n * and read the data pushed before them, so the order is the contract.\n *\n * Here the first page is pushed once its customer is known (the signed-in one loads in the\n * browser) and, on the cart, once the cart has; GTM waits for that push ({@link whenGtmPageData}).\n * Every later page pushes its own `page` and ecommerce block too, after clearing the previous\n * page's ecommerce (GTM merges objects into what it holds, arrays index by index). Those pages\n * load nothing, so they announce no services again: Salla's container would load its Google\n * tags and Clarity a second time. Every push the engine makes goes through one queue, so a\n * page's data is always in before its events.\n */\nimport type { Cart, Product, User } from '../../types';\nimport type { Order } from '../../routes/account/types';\nimport { user as userApi } from '../../api/user';\nimport type { StoreContext } from '../../api/store';\nimport { getTwilightContext, type PageContext } from '../../twilight/context';\nimport { isNativeApp } from '../../native-app';\nimport { RouteId } from '../../router/route-ids';\nimport { onSallaEvent, whenSallaLoaded } from '../../utils/sdk-helpers';\nimport {\n gtmCartCheckout,\n gtmCustomer,\n gtmDetail,\n gtmEnabled,\n gtmImpressions,\n gtmPage,\n gtmPurchase,\n gtmStore,\n pushToDataLayer,\n servicesInitEvents,\n type DataLayerEntry,\n} from './gtm';\n\n/** How long the first page waits for its customer or its cart before it is pushed without. */\nexport const GTM_PAGE_DATA_WAIT_MS = 3000;\n\nlet queue: Promise<void> = Promise.resolve();\nlet firstPageReported = false;\nlet previousUrl: string | null = null;\nlet markPageDataReady: () => void = () => {};\nlet pageDataReady = new Promise<void>((resolve) => (markPageDataReady = resolve));\nlet stopImpressions: (() => void) | null = null;\n/** Orders this document has pushed a `purchase` for, whether or not GTM has taken it yet. */\nlet purchasesPushed = new Set<string>();\n\n/** Resolves once the first page's data is in the data layer, as Twig's head pushes it before GTM. */\nexport function whenGtmPageData(): Promise<void> {\n return pageDataReady;\n}\n\nfunction settingsOrUndefined(): StoreContext | undefined {\n try {\n return getTwilightContext().settings;\n } catch {\n return undefined;\n }\n}\n\nfunction enqueue(task: () => void | Promise<void>): void {\n queue = queue.then(task).catch((error: unknown) => {\n console.warn('[gtm] Could not push to the data layer:', error);\n });\n}\n\nfunction withDeadline<T>(value: T | Promise<T>, fallback: T): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const deadline = new Promise<T>((resolve) => {\n timer = setTimeout(() => resolve(fallback), GTM_PAGE_DATA_WAIT_MS);\n });\n return Promise.race([Promise.resolve(value), deadline])\n .catch(() => fallback)\n .finally(() => clearTimeout(timer));\n}\n\n/** The signed-in customer, from the query `useUser` already loads; a guest has no token. */\nasync function currentUser(): Promise<User | null> {\n const { authToken, queryClient } = getTwilightContext();\n if (!authToken || !queryClient) return null;\n return withDeadline(\n queryClient.ensureQueryData(userApi.queries.current()).catch(() => null),\n null\n );\n}\n\n/** The Salla app's webview: the SDK knows once loaded, the settings carry the app's headers before. */\nfunction inNativeApp(settings: StoreContext | undefined): boolean {\n const os = settings?.jitsu?.context?.extra?.headers?.['s-app-os']?.toLowerCase();\n return os === 'ios' || os === 'android' || isNativeApp();\n}\n\n/**\n * The `user` Twig's `twilight::init` carries (the SDK's own config), as far as tags read it:\n * Salla's container identifies the customer to a chat service from `user.id` when that\n * service's `services::<name>.init` arrives, which is before the SDK pushes a user of its own.\n */\nfunction initUser(settings: StoreContext | undefined, user: User | null): DataLayerEntry {\n const visitor = settings?.user;\n return {\n id: user ? (user.id ?? null) : (visitor?.id ?? null),\n type: user ? 'user' : (visitor?.type ?? 'guest'),\n country_code: user?.country_code ?? visitor?.country_code,\n language_code: visitor?.language_code,\n currency_code: visitor?.currency_code,\n };\n}\n\n/** `twilight::init`, then each `services::<name>.init`, once per document, as Twig's page does. */\nfunction announceServices(settings: StoreContext | undefined, user: User | null): void {\n const snippetServices = (getTwilightContext().appsSnippets ?? []).map((app) => app.service);\n const events = servicesInitEvents(settings?.external_services, snippetServices);\n whenSallaLoaded((sdk) => {\n // The engine calls `salla.init` itself; Twig hands it the event, which the SDK records.\n pushToDataLayer({ event: 'twilight::init', user: initUser(settings, user) });\n for (const [name, payload] of events) sdk.event.dispatch(name, payload);\n });\n}\n\nexport interface GtmPageView {\n page: PageContext;\n /** The page's ecommerce block, or a promise of it: the cart loads in the browser. */\n ecommerce?: DataLayerEntry | Promise<DataLayerEntry | null> | null;\n}\n\n/** Push a page's data, once per page view: the first opens the document's data layer. */\nexport function reportGtmPageView(view: GtmPageView): void {\n if (typeof window === 'undefined') return;\n const settings = settingsOrUndefined();\n if (!gtmEnabled(settings)) {\n markPageDataReady();\n return;\n }\n watchListImpressions();\n\n const first = !firstPageReported;\n firstPageReported = true;\n // `url()->previous()`: the page before, or the store itself when the visitor came from nowhere.\n const referrer = (first ? document.referrer : previousUrl) || window.location.origin;\n previousUrl = window.location.href;\n\n enqueue(async () => {\n const [user, ecommerce] = await Promise.all([\n currentUser(),\n withDeadline(view.ecommerce ?? null, null),\n ]);\n const customer = await gtmCustomer(user, settings);\n const page = gtmPage(\n { slug: view.page.slug, referrer, mobileApp: inNativeApp(settings) },\n settings\n );\n if (first) {\n const entry = { ...ecommerce, page, store: gtmStore(settings), customer };\n pushToDataLayer(entry);\n rememberPurchaseOnceReceived(entry);\n announceServices(settings, user);\n markPageDataReady();\n return;\n }\n // GTM merges each push into what it holds: a guest's `{ isGuest: true }` would keep the\n // signed-out customer's details, and a shorter product list the last page's extra lines.\n pushToDataLayer({ customer: null, ecommerce: null });\n pushToDataLayer({ page, customer });\n if (ecommerce) {\n pushToDataLayer(ecommerce);\n rememberPurchaseOnceReceived(ecommerce);\n }\n });\n}\n\n/** How long a browser remembers an order it reported, as `SeoThankYouWidget` caches it. */\nconst PURCHASE_REMEMBERED_MS = 24 * 60 * 60 * 1000;\n/** How often, and for how long, a pushed purchase is checked for GTM having taken it. */\nexport const PURCHASE_RECEIVED_POLL_MS = 500;\nconst PURCHASE_RECEIVED_WAIT_MS = 60_000;\nconst purchaseKey = (orderId: unknown) => `google_tagged_order_${String(orderId)}`;\n\nfunction reportedRecently(orderId: unknown): boolean {\n try {\n const at = Number(window.localStorage.getItem(purchaseKey(orderId)));\n return Boolean(at) && Date.now() - at < PURCHASE_REMEMBERED_MS;\n } catch {\n // No storage (a private window): report it, as a Twig page would the first time.\n return false;\n }\n}\n\n/**\n * Remember a pushed `purchase` once GTM has taken it (GTM stamps `gtm.uniqueEventId` on each\n * message it handles). GTM loads seconds after the page here, so a shopper who leaves before\n * then has reported nothing, and the next visit reports it. Twig renders the push and its\n * container together, so it remembers the order as it renders the page.\n */\nfunction rememberPurchaseOnceReceived(entry: DataLayerEntry): void {\n if (entry.event !== 'purchase') return;\n const orderId = (entry.ecommerce as { event_id?: unknown } | undefined)?.event_id;\n const started = Date.now();\n const check = () => {\n if ('gtm.uniqueEventId' in entry) {\n try {\n window.localStorage.setItem(purchaseKey(orderId), String(Date.now()));\n } catch {\n // No storage: nothing to remember it in.\n }\n } else if (Date.now() - started < PURCHASE_RECEIVED_WAIT_MS) {\n setTimeout(check, PURCHASE_RECEIVED_POLL_MS);\n }\n };\n check();\n}\n\n/**\n * An order's `purchase`, once: Twig caches each order it reported for a day, so a reload of\n * the thank-you page counts nothing. Not inside the Salla app, which logs the order itself.\n */\nfunction purchaseOnce(order: Order, settings: StoreContext | undefined): DataLayerEntry | null {\n const id = String(order.id);\n // A return to the page in this document waits on the first push; only a new load retries.\n if (inNativeApp(settings) || purchasesPushed.has(id) || reportedRecently(order.id)) return null;\n purchasesPushed.add(id);\n return gtmPurchase(order, settings);\n}\n\nexport interface GtmPageEcommerceInput {\n slug: string;\n product?: Product;\n order?: Order;\n /** The cart page's cart, once the page has loaded it. */\n cart?: Promise<Cart | null> | null;\n}\n\n/** A page's own ecommerce block: a product's `detail`, the cart's `checkout`, an order's `purchase`. */\nexport function gtmPageEcommerce(input: GtmPageEcommerceInput): GtmPageView['ecommerce'] {\n if (typeof window === 'undefined') return null;\n const settings = settingsOrUndefined();\n if (!gtmEnabled(settings)) return null;\n if (input.slug === RouteId.PRODUCT_SINGLE && input.product)\n return gtmDetail(input.product, settings);\n if (input.slug === RouteId.CART && input.cart)\n return input.cart.then((cart) => (cart ? gtmCartCheckout(cart, settings) : null));\n if (input.slug === RouteId.THANK_YOU && input.order) return purchaseOnce(input.order, settings);\n return null;\n}\n\n/**\n * `impressions` for each page of a product listing the engine or the theme reports through\n * `salla-products-list::products.fetched`, as `<salla-products-list>` pushes on Twig. That\n * component pushes its own before it emits the API's answer (`success`), so those are skipped.\n * Each batch first clears the last one's list (GTM merges arrays index by index), and only that:\n * the page's own block, such as the cart's `checkout`, stays for the tags still to read it.\n */\nfunction watchListImpressions(): void {\n if (stopImpressions) return;\n stopImpressions = onSallaEvent('salla-products-list::products.fetched', (payload) => {\n const fetched = payload as { data?: unknown; success?: unknown } | undefined;\n if (!Array.isArray(fetched?.data) || typeof fetched.success === 'boolean') return;\n const products = fetched.data as Product[];\n const settings = settingsOrUndefined();\n if (!products.length || !gtmEnabled(settings)) return;\n // The page the products were fetched for, not the one the queue gets to them on.\n const impressions = gtmImpressions(products, getTwilightContext().page ?? undefined, settings);\n enqueue(() => {\n pushToDataLayer({ ecommerce: { impressions: null } });\n pushToDataLayer(impressions);\n });\n });\n}\n\n/** Test seam: forget the document's first page and every listener. */\nexport function resetGtmPageTracking(): void {\n stopImpressions?.();\n stopImpressions = null;\n queue = Promise.resolve();\n firstPageReported = false;\n previousUrl = null;\n purchasesPushed = new Set();\n pageDataReady = new Promise<void>((resolve) => (markPageDataReady = resolve));\n}\n\n/** Test seam: settle every push queued so far. */\nexport function flushGtmQueue(): Promise<void> {\n return queue;\n}\n"]}
1
+ {"version":3,"sources":["../src/lib/analytics/gtm-page.ts"],"names":["user"],"mappings":";;;;;;;;AAuCO,IAAM,qBAAA,GAAwB;AAErC,IAAI,KAAA,GAAuB,QAAQ,OAAA,EAAQ;AAC3C,IAAI,iBAAA,GAAoB,KAAA;AACxB,IAAI,WAAA,GAA6B,IAAA;AACjC,IAAI,oBAAgC,MAAM;AAAC,CAAA;AAC3C,IAAI,gBAAgB,IAAI,OAAA,CAAc,CAAC,OAAA,KAAa,oBAAoB,OAAQ,CAAA;AAChF,IAAI,eAAA,GAAuC,IAAA;AAE3C,IAAI,eAAA,uBAAsB,GAAA,EAAY;AAG/B,SAAS,eAAA,GAAiC;AAC/C,EAAA,OAAO,aAAA;AACT;AAEA,SAAS,mBAAA,GAAgD;AACvD,EAAA,IAAI;AACF,IAAA,OAAO,oBAAmB,CAAE,QAAA;AAAA,EAC9B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,MAAA;AAAA,EACT;AACF;AAEA,SAAS,QAAQ,IAAA,EAAwC;AACvD,EAAA,KAAA,GAAQ,MAAM,IAAA,CAAK,IAAI,CAAA,CAAE,KAAA,CAAM,CAAC,KAAA,KAAmB;AACjD,IAAA,OAAA,CAAQ,IAAA,CAAK,2CAA2C,KAAK,CAAA;AAAA,EAC/D,CAAC,CAAA;AACH;AAEA,SAAS,YAAA,CAAgB,OAAuB,QAAA,EAAyB;AACvE,E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AG;AAE/C,IAAA,MAAM,cAAc,cAAA,CAAe,QAAA,EAAU,oBAAmB,CAAE,IAAA,IAAQ,QAAW,QAAQ,CAAA;AAC7F,IAAA,OAAA,CAAQ,MAAM;AACZ,MAAA,eAAA,CAAgB,EAAE,SAAA,EAAW,EAAE,WAAA,EAAa,IAAA,IAAQ,CAAA;AACpD,MAAA,eAAA,CAAgB,WAAW,CAAA;AAAA,IAC7B,CAAC,CAAA;AAAA,EACH,CAAC,CAAA;AACH","file":"chunk-SG2B3Z7C.js","sourcesContent":["/**\n * The order a Twig page fills the data layer in, for a storefront that loads once.\n *\n * A Twig page opens with its own data (`page`, `store`, `customer`, and the page's ecommerce\n * block), then loads the containers, then hands the SDK `twilight::init` and each\n * `services::<name>.init`, which the SDK copies into the data layer. Tags fire on those events\n * and read the data pushed before them, so the order is the contract.\n *\n * Here the first page is pushed once its customer is known (the signed-in one loads in the\n * browser) and, on the cart, once the cart has; GTM waits for that push ({@link whenGtmPageData}).\n * Every later page pushes its own `page` and ecommerce block too, after clearing the previous\n * page's ecommerce (GTM merges objects into what it holds, arrays index by index). Those pages\n * load nothing, so they announce no services again: Salla's container would load its Google\n * tags and Clarity a second time. Every push the engine makes goes through one queue, so a\n * page's data is always in before its events.\n */\nimport type { Cart, Product, User } from '../../types';\nimport type { Order } from '../../routes/account/types';\nimport { user as userApi } from '../../api/user';\nimport type { StoreContext } from '../../api/store';\nimport { getTwilightContext, type PageContext } from '../../twilight/context';\nimport { isNativeApp } from '../../native-app';\nimport { RouteId } from '../../router/route-ids';\nimport { onSallaEvent, whenSallaLoaded } from '../../utils/sdk-helpers';\nimport {\n gtmCartCheckout,\n gtmCustomer,\n gtmDetail,\n gtmEnabled,\n gtmImpressions,\n gtmPage,\n gtmPurchase,\n gtmStore,\n pushToDataLayer,\n servicesInitEvents,\n type DataLayerEntry,\n} from './gtm';\n\n/** How long the first page waits for its customer or its cart before it is pushed without. */\nexport const GTM_PAGE_DATA_WAIT_MS = 3000;\n\nlet queue: Promise<void> = Promise.resolve();\nlet firstPageReported = false;\nlet previousUrl: string | null = null;\nlet markPageDataReady: () => void = () => {};\nlet pageDataReady = new Promise<void>((resolve) => (markPageDataReady = resolve));\nlet stopImpressions: (() => void) | null = null;\n/** Orders this document has pushed a `purchase` for, whether or not GTM has taken it yet. */\nlet purchasesPushed = new Set<string>();\n\n/** Resolves once the first page's data is in the data layer, as Twig's head pushes it before GTM. */\nexport function whenGtmPageData(): Promise<void> {\n return pageDataReady;\n}\n\nfunction settingsOrUndefined(): StoreContext | undefined {\n try {\n return getTwilightContext().settings;\n } catch {\n return undefined;\n }\n}\n\nfunction enqueue(task: () => void | Promise<void>): void {\n queue = queue.then(task).catch((error: unknown) => {\n console.warn('[gtm] Could not push to the data layer:', error);\n });\n}\n\nfunction withDeadline<T>(value: T | Promise<T>, fallback: T): Promise<T> {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const deadline = new Promise<T>((resolve) => {\n timer = setTimeout(() => resolve(fallback), GTM_PAGE_DATA_WAIT_MS);\n });\n return Promise.race([Promise.resolve(value), deadline])\n .catch(() => fallback)\n .finally(() => clearTimeout(timer));\n}\n\n/** The signed-in customer, from the query `useUser` already loads; a guest has no token. */\nasync function currentUser(): Promise<User | null> {\n const { authToken, queryClient } = getTwilightContext();\n if (!authToken || !queryClient) return null;\n return withDeadline(\n queryClient.ensureQueryData(userApi.queries.current()).catch(() => null),\n null\n );\n}\n\n/** The Salla app's webview: the SDK knows once loaded, the settings carry the app's headers before. */\nfunction inNativeApp(settings: StoreContext | undefined): boolean {\n const os = settings?.jitsu?.context?.extra?.headers?.['s-app-os']?.toLowerCase();\n return os === 'ios' || os === 'android' || isNativeApp();\n}\n\n/**\n * The `user` Twig's `twilight::init` carries (the SDK's own config), as far as tags read it:\n * Salla's container identifies the customer to a chat service from `user.id` when that\n * service's `services::<name>.init` arrives, which is before the SDK pushes a user of its own.\n */\nfunction initUser(settings: StoreContext | undefined, user: User | null): DataLayerEntry {\n const visitor = settings?.user;\n return {\n id: user ? (user.id ?? null) : (visitor?.id ?? null),\n type: user ? 'user' : (visitor?.type ?? 'guest'),\n country_code: user?.country_code ?? visitor?.country_code,\n language_code: visitor?.language_code,\n currency_code: visitor?.currency_code,\n };\n}\n\n/** `twilight::init`, then each `services::<name>.init`, once per document, as Twig's page does. */\nfunction announceServices(settings: StoreContext | undefined, user: User | null): void {\n const snippetServices = (getTwilightContext().appsSnippets ?? []).map((app) => app.service);\n const events = servicesInitEvents(settings?.external_services, snippetServices);\n whenSallaLoaded((sdk) => {\n // The engine calls `salla.init` itself; Twig hands it the event, which the SDK records.\n pushToDataLayer({ event: 'twilight::init', user: initUser(settings, user) });\n for (const [name, payload] of events) sdk.event.dispatch(name, payload);\n });\n}\n\nexport interface GtmPageView {\n page: PageContext;\n /** The page's ecommerce block, or a promise of it: the cart loads in the browser. */\n ecommerce?: DataLayerEntry | Promise<DataLayerEntry | null> | null;\n}\n\n/** Push a page's data, once per page view: the first opens the document's data layer. */\nexport function reportGtmPageView(view: GtmPageView): void {\n if (typeof window === 'undefined') return;\n const settings = settingsOrUndefined();\n if (!gtmEnabled(settings)) {\n markPageDataReady();\n return;\n }\n watchListImpressions();\n\n const first = !firstPageReported;\n firstPageReported = true;\n // `url()->previous()`: the page before, or the store itself when the visitor came from nowhere.\n const referrer = (first ? document.referrer : previousUrl) || window.location.origin;\n previousUrl = window.location.href;\n\n enqueue(async () => {\n const [user, ecommerce] = await Promise.all([\n currentUser(),\n withDeadline(view.ecommerce ?? null, null),\n ]);\n const customer = await gtmCustomer(user, settings);\n const page = gtmPage(\n { slug: view.page.slug, referrer, mobileApp: inNativeApp(settings) },\n settings\n );\n if (first) {\n const entry = { ...ecommerce, page, store: gtmStore(settings), customer };\n pushToDataLayer(entry);\n rememberPurchaseOnceReceived(entry);\n announceServices(settings, user);\n markPageDataReady();\n return;\n }\n // GTM merges each push into what it holds: a guest's `{ isGuest: true }` would keep the\n // signed-out customer's details, and a shorter product list the last page's extra lines.\n pushToDataLayer({ customer: null, ecommerce: null });\n pushToDataLayer({ page, customer });\n if (ecommerce) {\n pushToDataLayer(ecommerce);\n rememberPurchaseOnceReceived(ecommerce);\n }\n });\n}\n\n/** How long a browser remembers an order it reported, as `SeoThankYouWidget` caches it. */\nconst PURCHASE_REMEMBERED_MS = 24 * 60 * 60 * 1000;\n/** How often, and for how long, a pushed purchase is checked for GTM having taken it. */\nexport const PURCHASE_RECEIVED_POLL_MS = 500;\nconst PURCHASE_RECEIVED_WAIT_MS = 60_000;\nconst purchaseKey = (orderId: unknown) => `google_tagged_order_${String(orderId)}`;\n\nfunction reportedRecently(orderId: unknown): boolean {\n try {\n const at = Number(window.localStorage.getItem(purchaseKey(orderId)));\n return Boolean(at) && Date.now() - at < PURCHASE_REMEMBERED_MS;\n } catch {\n // No storage (a private window): report it, as a Twig page would the first time.\n return false;\n }\n}\n\n/**\n * Remember a pushed `purchase` once GTM has taken it (GTM stamps `gtm.uniqueEventId` on each\n * message it handles). GTM loads seconds after the page here, so a shopper who leaves before\n * then has reported nothing, and the next visit reports it. Twig renders the push and its\n * container together, so it remembers the order as it renders the page.\n */\nfunction rememberPurchaseOnceReceived(entry: DataLayerEntry): void {\n if (entry.event !== 'purchase') return;\n const orderId = (entry.ecommerce as { event_id?: unknown } | undefined)?.event_id;\n const started = Date.now();\n const check = () => {\n if ('gtm.uniqueEventId' in entry) {\n try {\n window.localStorage.setItem(purchaseKey(orderId), String(Date.now()));\n } catch {\n // No storage: nothing to remember it in.\n }\n } else if (Date.now() - started < PURCHASE_RECEIVED_WAIT_MS) {\n setTimeout(check, PURCHASE_RECEIVED_POLL_MS);\n }\n };\n check();\n}\n\n/**\n * An order's `purchase`, once: Twig caches each order it reported for a day, so a reload of\n * the thank-you page counts nothing. Not inside the Salla app, which logs the order itself.\n */\nfunction purchaseOnce(order: Order, settings: StoreContext | undefined): DataLayerEntry | null {\n const id = String(order.id);\n // A return to the page in this document waits on the first push; only a new load retries.\n if (inNativeApp(settings) || purchasesPushed.has(id) || reportedRecently(order.id)) return null;\n purchasesPushed.add(id);\n return gtmPurchase(order, settings);\n}\n\nexport interface GtmPageEcommerceInput {\n slug: string;\n product?: Product;\n order?: Order;\n /** The cart page's cart, once the page has loaded it. */\n cart?: Promise<Cart | null> | null;\n}\n\n/** A page's own ecommerce block: a product's `detail`, the cart's `checkout`, an order's `purchase`. */\nexport function gtmPageEcommerce(input: GtmPageEcommerceInput): GtmPageView['ecommerce'] {\n if (typeof window === 'undefined') return null;\n const settings = settingsOrUndefined();\n if (!gtmEnabled(settings)) return null;\n if (input.slug === RouteId.PRODUCT_SINGLE && input.product)\n return gtmDetail(input.product, settings);\n if (input.slug === RouteId.CART && input.cart)\n return input.cart.then((cart) => (cart ? gtmCartCheckout(cart, settings) : null));\n if (input.slug === RouteId.THANK_YOU && input.order) return purchaseOnce(input.order, settings);\n return null;\n}\n\n/**\n * `impressions` for each page of a product listing the engine or the theme reports through\n * `salla-products-list::products.fetched`, as `<salla-products-list>` pushes on Twig. That\n * component pushes its own before it emits the API's answer (`success`), so those are skipped.\n * Each batch first clears the last one's list (GTM merges arrays index by index), and only that:\n * the page's own block, such as the cart's `checkout`, stays for the tags still to read it.\n */\nfunction watchListImpressions(): void {\n if (stopImpressions) return;\n stopImpressions = onSallaEvent('salla-products-list::products.fetched', (payload) => {\n const fetched = payload as { data?: unknown; success?: unknown } | undefined;\n if (!Array.isArray(fetched?.data) || typeof fetched.success === 'boolean') return;\n const products = fetched.data as Product[];\n const settings = settingsOrUndefined();\n if (!products.length || !gtmEnabled(settings)) return;\n // The page the products were fetched for, not the one the queue gets to them on.\n const impressions = gtmImpressions(products, getTwilightContext().page ?? undefined, settings);\n enqueue(() => {\n pushToDataLayer({ ecommerce: { impressions: null } });\n pushToDataLayer(impressions);\n });\n });\n}\n\n/** Test seam: forget the document's first page and every listener. */\nexport function resetGtmPageTracking(): void {\n stopImpressions?.();\n stopImpressions = null;\n queue = Promise.resolve();\n firstPageReported = false;\n previousUrl = null;\n purchasesPushed = new Set();\n pageDataReady = new Promise<void>((resolve) => (markPageDataReady = resolve));\n}\n\n/** Test seam: settle every push queued so far. */\nexport function flushGtmQueue(): Promise<void> {\n return queue;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { getActiveScope, api } from './chunk-XQEWBUQ2.js';
1
+ import { getActiveScope, api } from './chunk-ID2UT4AE.js';
2
2
  import { queryOptions } from '@tanstack/react-query';
3
3
 
4
4
  async function list(params) {
@@ -45,5 +45,5 @@ var home = {
45
45
  };
46
46
 
47
47
  export { home };
48
- //# sourceMappingURL=chunk-PNJFMMPV.js.map
49
- //# sourceMappingURL=chunk-PNJFMMPV.js.map
48
+ //# sourceMappingURL=chunk-SM35CH2U.js.map
49
+ //# sourceMappingURL=chunk-SM35CH2U.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/home.ts"],"names":[],"mappings":";;;AAQA,eAAe,KAAK,MAAA,EAA+D;AACjF,EAAA,MAAM,KAAA,GAAQ,SAAS,CAAA,CAAA,EAAI,IAAI,gBAAgB,MAAM,CAAA,CAAE,QAAA,EAAU,CAAA,CAAA,GAAK,EAAA;AACtE,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,cAAA,EAAiB,KAAK,CAAA,CAAE,CAAA,CAAE,IAAA,EAAoC;AAC7F,EAAA,OAAO,QAAQ,EAAC;AAClB;AAGA,SAAS,OAAA,CAAQ,QAA6B,QAAA,EAAoD;AAChG,EAAA,IAAI,CAAC,QAAA,CAAS,MAAA,EAAQ,OAAO,MAAA;AAC7B,EAAA,MAAM,KAAA,GAAQ,IAAI,GAAA,CAAI,QAAA,CAAS,IAAI,CAAC,KAAA,KAAU,KAAA,CAAM,IAAI,CAAC,CAAA;AACzD,EAAA,MAAM,IAAA,GAAO,SAAS,GAAA,CAAI,CAAC,UAAU,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAA;AAC1D,EAAA,OAAO,MAAA,CAAO,MAAA,CAA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Aa;AAAA;AAAA,MAEX,QAAA,EAAU,CAAC,MAAA,EAAQ,YAAA,EAAc,EAAE,KAAA,EAAO,cAAA,IAAkB,CAAA;AAAA,MAC5D,OAAA,EAAS,MAAM,IAAA,CAAK,UAAA;AAAW,KAChC,CAAA;AAAA,IAEH,MAAA,EAAQ,CAAC,IAAA,EAAc,KAAA,KACrB,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,QAAA,EAAU,MAAM,KAAK,CAAA;AAAA,MACxC,OAAA,EAAS,MAAM,IAAA,CAAK,MAAA,CAAO,MAAM,KAAK;AAAA,KACvC;AAAA;AAEP","file":"chunk-PNJFMMPV.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport type { HomeComponentData } from '../types';\n\n/** The page a hook's blocks render on; blocks can target specific products, categories or pages. */\nexport type BlockScope =\n { product_id: number | string } | { category_id: number | string } | { page_id: number | string };\n\nasync function list(params?: Record<string, string>): Promise<HomeComponentData[]> {\n const query = params ? `?${new URLSearchParams(params).toString()}` : '';\n const { data } = await api.get(`component/list${query}`).json<{ data: HomeComponentData[] }>();\n return data ?? [];\n}\n\n/** `blocks` minus each of `excluded`, matched by content: the API sends no id or order to match on. */\nfunction without(blocks: HomeComponentData[], excluded: HomeComponentData[]): HomeComponentData[] {\n if (!excluded.length) return blocks;\n const paths = new Set(excluded.map((block) => block.path));\n const left = excluded.map((block) => JSON.stringify(block));\n return blocks.filter((block) => {\n if (!paths.has(block.path)) return true;\n const index = left.indexOf(JSON.stringify(block));\n if (index === -1) return true;\n left.splice(index, 1);\n return false;\n });\n}\n\nexport const home = {\n components: async (): Promise<HomeComponentData[]> => {\n // The unfiltered list also has the product, category and page blocks, which the home leaves out.\n const [blocks, pageBlocks] = await Promise.all([list(), list({ show_in: 'pages' })]);\n return without(blocks, pageBlocks);\n },\n\n /** The blocks the merchant placed at `hook` on a product, category or page. */\n blocks: async (hook: string, scope: BlockScope): Promise<HomeComponentData[]> => {\n const scopeParams = Object.fromEntries(\n Object.entries(scope).map(([key, id]) => [key, String(id)])\n );\n const blocks = await list({ hooks: hook, ...scopeParams });\n return blocks.map((block) => ({ ...block, path: block.path.replace('home.', '') }));\n },\n\n queries: {\n components: () =>\n queryOptions({\n // Each market (scope) has its own theme version, and its own home page with it.\n queryKey: ['home', 'components', { scope: getActiveScope() }],\n queryFn: () => home.components(),\n }),\n\n blocks: (hook: string, scope: BlockScope) =>\n queryOptions({\n queryKey: ['home', 'blocks', hook, scope],\n queryFn: () => home.blocks(hook, scope),\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/home.ts"],"names":[],"mappings":";;;AAQA,eAAe,KAAK,MAAA,EAA+D;AACjF,EAAA,MAAM,KAAA,GAAQ,SAAS,CAAA,CAAA,EAAI,IAAI,gBAAgB,MAAM,CAAA,CAAE,QAAA,EAAU,CAAA,CAAA,GAAK,EAAA;AACtE,EAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,cAAA,EAAiB,KAAK,CAAA,CAAE,CAAA,CAAE,IAAA,EAAoC;AAC7F,EAAA,OAAO,QAAQ,EAAC;AAClB;AAGA,SAAS,OAAA,CAAQ,QAA6B,QAAA,EAAoD;AAChG,EAAA,IAAI,CAAC,QAAA,CAAS,MAAA,EAAQ,OAAO,MAAA;AAC7B,EAAA,MAAM,KAAA,GAAQ,IAAI,GAAA,CAAI,QAAA,CAAS,IAAI,CAAC,KAAA,KAAU,KAAA,CAAM,IAAI,CAAC,CAAA;AACzD,EAAA,MAAM,IAAA,GAAO,SAAS,GAAA,CAAI,CAAC,UAAU,IAAA,CAAK,SAAA,CAAU,KAAK,CAAC,CAAA;AAC1D,EAAA,OAAO,MAAA,CAAO,MAAA,CAAO,CAAC,KAAA,KAAU;AAC9B,IAAA,IAAI,CAAC,KAAA,CAAM,GAAA,CAAI,KAAA,CAAM,IAAI,GAAG,OAAO,IAAA;AACnC,IAAA,MAAM,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AS,MAAM,IAAA,CAAK,UAAA;AAAW,KAChC,CAAA;AAAA,IAEH,MAAA,EAAQ,CAAC,IAAA,EAAc,KAAA,KACrB,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,QAAA,EAAU,MAAM,KAAK,CAAA;AAAA,MACxC,OAAA,EAAS,MAAM,IAAA,CAAK,MAAA,CAAO,MAAM,KAAK;AAAA,KACvC;AAAA;AAEP","file":"chunk-SM35CH2U.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport type { HomeComponentData } from '../types';\n\n/** The page a hook's blocks render on; blocks can target specific products, categories or pages. */\nexport type BlockScope =\n { product_id: number | string } | { category_id: number | string } | { page_id: number | string };\n\nasync function list(params?: Record<string, string>): Promise<HomeComponentData[]> {\n const query = params ? `?${new URLSearchParams(params).toString()}` : '';\n const { data } = await api.get(`component/list${query}`).json<{ data: HomeComponentData[] }>();\n return data ?? [];\n}\n\n/** `blocks` minus each of `excluded`, matched by content: the API sends no id or order to match on. */\nfunction without(blocks: HomeComponentData[], excluded: HomeComponentData[]): HomeComponentData[] {\n if (!excluded.length) return blocks;\n const paths = new Set(excluded.map((block) => block.path));\n const left = excluded.map((block) => JSON.stringify(block));\n return blocks.filter((block) => {\n if (!paths.has(block.path)) return true;\n const index = left.indexOf(JSON.stringify(block));\n if (index === -1) return true;\n left.splice(index, 1);\n return false;\n });\n}\n\nexport const home = {\n components: async (): Promise<HomeComponentData[]> => {\n // The unfiltered list also has the product, category and page blocks, which the home leaves out.\n const [blocks, pageBlocks] = await Promise.all([list(), list({ show_in: 'pages' })]);\n return without(blocks, pageBlocks);\n },\n\n /** The blocks the merchant placed at `hook` on a product, category or page. */\n blocks: async (hook: string, scope: BlockScope): Promise<HomeComponentData[]> => {\n const scopeParams = Object.fromEntries(\n Object.entries(scope).map(([key, id]) => [key, String(id)])\n );\n const blocks = await list({ hooks: hook, ...scopeParams });\n return blocks.map((block) => ({ ...block, path: block.path.replace('home.', '') }));\n },\n\n queries: {\n components: () =>\n queryOptions({\n // Each market (scope) has its own theme version, and its own home page with it.\n queryKey: ['home', 'components', { scope: getActiveScope() }],\n queryFn: () => home.components(),\n }),\n\n blocks: (hook: string, scope: BlockScope) =>\n queryOptions({\n queryKey: ['home', 'blocks', hook, scope],\n queryFn: () => home.blocks(hook, scope),\n }),\n },\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { api } from './chunk-XQEWBUQ2.js';
1
+ import { api } from './chunk-ID2UT4AE.js';
2
2
  import { queryOptions } from '@tanstack/react-query';
3
3
 
4
4
  var apps = {
@@ -40,5 +40,5 @@ var apps = {
40
40
  };
41
41
 
42
42
  export { apps };
43
- //# sourceMappingURL=chunk-NFD5EJ7W.js.map
44
- //# sourceMappingURL=chunk-NFD5EJ7W.js.map
43
+ //# sourceMappingURL=chunk-SSMM6ZEQ.js.map
44
+ //# sourceMappingURL=chunk-SSMM6ZEQ.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/apps.ts"],"names":[],"mappings":";;;AAmCO,IAAM,IAAA,GAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlB,UAAU,YAAmC;AAC3C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,eAAA,EAAiB,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA,CACtC,IAAA,EAA8B;AACjC,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU,YAAkC;AAC1C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,wBAAA,EAA0B,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA,CAC/C,IAAA,EAAsC;AACzC,IAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,IAAQ,EAAC,EAAE;AAAA,EAClC,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,QAAA,EAAU,MACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC7B,OAAA,EAAS,MAAM,IAAA,CAAK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA;AAAA;AAAA;AAAA,MAIX,KAAA,EAAO;AAAA,KACR,CAAA;AAAA,IAEH,QAAA,EAAU,MACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC7B,OAAA,EAAS,MAAM,IAAA,CAAK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA,MACX,KAAA,EAAO;AAAA,KACR;AAAA;AAEP","file":"chunk-NFD5EJ7W.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\n\nexport interface AppSnippetRow {\n place: string;\n content: string;\n url?: string | null;\n /**\n * Raw snippet id, emitted as `data-snippet-id`. Present only on CDN rows — the\n * inline branch of the backend's snippet parser omits the key entirely.\n */\n id?: number;\n /** `{{customer.x}}` placeholders in `content` to substitute from SDK config `user.*` keys. */\n customer_parameters?: string[];\n}\n\nexport interface AppSnippet {\n service: string;\n app_id: string;\n /** Encoded app id (`getRouteKey()`): the scope id its snippets bind to via `data-scope-id`,\n * and its settings-bucket key. Absent on payloads predating the settings API. */\n id?: string;\n app_slug: string;\n status: string;\n snippets: AppSnippetRow[];\n}\n\n/**\n * Per-app public `app.*` buckets for CDN snippets, keyed by encoded app id (== `AppSnippet.id`,\n * the `Salla.appScope` scope id). One isolated bucket per app; reads within a scope are bare `app.*`.\n */\nexport interface AppSettings {\n apps: Record<string, Record<string, unknown>>;\n}\n\nexport const apps = {\n /**\n * Installed apps' snippets (scripts/HTML to inject). Timeout-bounded because it's awaited in\n * rootBeforeLoad (SSR/TTFB): a slow response degrades to no CDN tags, never stalls the page.\n */\n snippets: async (): Promise<AppSnippet[]> => {\n const { data } = await api\n .get('apps/snippets', { timeout: 2500 })\n .json<{ data?: AppSnippet[] }>();\n return data ?? [];\n },\n\n /**\n * Per-app public `app.*` buckets, keyed by encoded app id. Timeout-bounded (SSR-awaited):\n * a slow response degrades to empty buckets (fail-open), never strands injection.\n */\n settings: async (): Promise<AppSettings> => {\n const { data } = await api\n .get('apps/snippets/settings', { timeout: 2500 })\n .json<{ data?: Partial<AppSettings> }>();\n return { apps: data?.apps ?? {} };\n },\n\n queries: {\n snippets: () =>\n queryOptions({\n queryKey: ['apps', 'snippets'],\n queryFn: () => apps.snippets(),\n // Snippets are static per session; one fetch per page load is enough.\n staleTime: Infinity,\n // No retry: this is awaited in rootBeforeLoad, so the router's default `retry: 1` would\n // make the SSR wait 2 x the 2500ms timeout (plus backoff) before failing open. The\n // 2500ms timeout must be the whole budget; the client fallback query does the retrying.\n retry: 0,\n }),\n\n settings: () =>\n queryOptions({\n queryKey: ['apps', 'settings'],\n queryFn: () => apps.settings(),\n // Encoded app ids and their buckets are stable per page; one fetch is enough.\n staleTime: Infinity,\n retry: 0,\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/apps.ts"],"names":[],"mappings":";;;AAmCO,IAAM,IAAA,GAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlB,UAAU,YAAmC;AAC3C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,eAAA,EAAiB,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA,CACtC,IAAA,EAA8B;AACjC,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU,YAAkC;AAC1C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,wBAAA,EAA0B,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA,CAC/C,IAAA,EAAsC;AACzC,IAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,IAAQ,EAAC,EAAE;AAAA,EAClC,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,QAAA,EAAU,MACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC7B,OAAA,EAAS,MAAM,IAAA,CAAK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA;AAAA;AAAA;AAAA,MAIX,KAAA,EAAO;AAAA,KACR,CAAA;AAAA,IAEH,QAAA,EAAU,MACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC7B,OAAA,EAAS,MAAM,IAAA,CAAK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA,MACX,KAAA,EAAO;AAAA,KACR;AAAA;AAEP","file":"chunk-SSMM6ZEQ.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\n\nexport interface AppSnippetRow {\n place: string;\n content: string;\n url?: string | null;\n /**\n * Raw snippet id, emitted as `data-snippet-id`. Present only on CDN rows — the\n * inline branch of the backend's snippet parser omits the key entirely.\n */\n id?: number;\n /** `{{customer.x}}` placeholders in `content` to substitute from SDK config `user.*` keys. */\n customer_parameters?: string[];\n}\n\nexport interface AppSnippet {\n service: string;\n app_id: string;\n /** Encoded app id (`getRouteKey()`): the scope id its snippets bind to via `data-scope-id`,\n * and its settings-bucket key. Absent on payloads predating the settings API. */\n id?: string;\n app_slug: string;\n status: string;\n snippets: AppSnippetRow[];\n}\n\n/**\n * Per-app public `app.*` buckets for CDN snippets, keyed by encoded app id (== `AppSnippet.id`,\n * the `Salla.appScope` scope id). One isolated bucket per app; reads within a scope are bare `app.*`.\n */\nexport interface AppSettings {\n apps: Record<string, Record<string, unknown>>;\n}\n\nexport const apps = {\n /**\n * Installed apps' snippets (scripts/HTML to inject). Timeout-bounded because it's awaited in\n * rootBeforeLoad (SSR/TTFB): a slow response degrades to no CDN tags, never stalls the page.\n */\n snippets: async (): Promise<AppSnippet[]> => {\n const { data } = await api\n .get('apps/snippets', { timeout: 2500 })\n .json<{ data?: AppSnippet[] }>();\n return data ?? [];\n },\n\n /**\n * Per-app public `app.*` buckets, keyed by encoded app id. Timeout-bounded (SSR-awaited):\n * a slow response degrades to empty buckets (fail-open), never strands injection.\n */\n settings: async (): Promise<AppSettings> => {\n const { data } = await api\n .get('apps/snippets/settings', { timeout: 2500 })\n .json<{ data?: Partial<AppSettings> }>();\n return { apps: data?.apps ?? {} };\n },\n\n queries: {\n snippets: () =>\n queryOptions({\n queryKey: ['apps', 'snippets'],\n queryFn: () => apps.snippets(),\n // Snippets are static per session; one fetch per page load is enough.\n staleTime: Infinity,\n // No retry: this is awaited in rootBeforeLoad, so the router's default `retry: 1` would\n // make the SSR wait 2 x the 2500ms timeout (plus backoff) before failing open. The\n // 2500ms timeout must be the whole budget; the client fallback query does the retrying.\n retry: 0,\n }),\n\n settings: () =>\n queryOptions({\n queryKey: ['apps', 'settings'],\n queryFn: () => apps.settings(),\n // Encoded app ids and their buckets are stable per page; one fetch is enough.\n staleTime: Infinity,\n retry: 0,\n }),\n },\n};\n"]}
@@ -0,0 +1,36 @@
1
+ import { createContext, useContext } from 'react';
2
+
3
+ // src/utils/render-probe.ts
4
+ var RENDER_LOOP_MESSAGE = "[twilight] SSR render loop";
5
+ var RENDER_LOOP_THRESHOLD = 500;
6
+ var MAX_REPORTS = 3;
7
+ var TOP_COUNTS = 8;
8
+ function createRenderProbe(report, threshold = RENDER_LOOP_THRESHOLD) {
9
+ const counts = /* @__PURE__ */ new Map();
10
+ let total = 0;
11
+ let next = threshold;
12
+ let reports = 0;
13
+ return {
14
+ hit(name) {
15
+ total += 1;
16
+ const count = (counts.get(name) ?? 0) + 1;
17
+ counts.set(name, count);
18
+ if (count < next || reports >= MAX_REPORTS) return;
19
+ reports += 1;
20
+ next *= 10;
21
+ report({
22
+ total,
23
+ last: name,
24
+ top: [...counts].sort((a, b) => b[1] - a[1]).slice(0, TOP_COUNTS).map(([key, value]) => `${key}: ${value}`)
25
+ });
26
+ }
27
+ };
28
+ }
29
+ var RenderProbeContext = createContext(null);
30
+ function useRenderProbe(name) {
31
+ useContext(RenderProbeContext)?.hit(name);
32
+ }
33
+
34
+ export { RENDER_LOOP_MESSAGE, RenderProbeContext, createRenderProbe, useRenderProbe };
35
+ //# sourceMappingURL=chunk-T43GL7UN.js.map
36
+ //# sourceMappingURL=chunk-T43GL7UN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/render-probe.ts"],"names":[],"mappings":";;;AAqBO,IAAM,mBAAA,GAAsB;AAG5B,IAAM,qBAAA,GAAwB,GAAA;AAGrC,IAAM,WAAA,GAAc,CAAA;AAGpB,IAAM,UAAA,GAAa,CAAA;AAqBZ,SAAS,iBAAA,CACd,MAAA,EACA,SAAA,GAAoB,qBAAA,EACP;AACb,EAAA,MAAM,MAAA,uBAAa,GAAA,EAAoB;AACvC,EAAA,IAAI,KAAA,GAAQ,CAAA;AACZ,EAAA,IAAI,IAAA,GAAO,SAAA;AACX,EAAA,IAAI,OAAA,GAAU,CAAA;AAEd,EAAA,OAAO;AAAA,IACL,IAAI,IAAA,EAAM;AACR,MAAA,KAAA,IAAS,CAAA;AACT,MAAA,MAAM,KAAA,GAAA,CAAS,MAAA,CAAO,GAAA,CAAI,IAAI,KAAK,CAAA,IAAK,CAAA;AACxC,MAAA,MAAA,CAAO,GAAA,CAAI,MAAM,KAAK,CAAA;AACtB,MAAA,IAAI,KAAA,GAAQ,IAAA,IAAQ,OAAA,IAAW,WAAA,EAAa;AAC5C,MAAA,OAAA,IAAW,CAAA;AACX,MAAA,IAAA,IAAQ,EAAA;AACR,MAAA,MAAA,CAAO;AAAA,QACL,KAAA;AAAA,QACA,IAAA,EAAM,IAAA;AAAA,QACN,GAAA,EAAK,CAAC,GAAG,MAAM,CAAA,CACZ,IAAA,CAAK,CAAC,CAAA,EAAG,CAAA,KAAM,CAAA,CAAE,CAAC,CAAA,GAAI,EAAE,CAAC,CAAC,CAAA,CAC1B,KAAA,CAAM,CAAA,EAAG,UAAU,CAAA,CACnB,GAAA,CAAI,CAAC,CAAC,GAAA,EAAK,KAAK,CAAA,KAAM,CAAA,EAAG,GAAG,CAAA,EAAA,EAAK,KAAK,CAAA,CAAE;AAAA,OAC5C,CAAA;AAAA,IACH;AAAA,GACF;AACF;AAGO,IAAM,kBAAA,GAAqB,cAAkC,IAAI;AAOjE,SAAS,eAAe,IAAA,EAAoB;AACjD,EAAA,UAAA,CAAW,kBAAkB,CAAA,EAAG,GAAA,CAAI,IAAI,CAAA;AAC1C","file":"chunk-T43GL7UN.js","sourcesContent":["/**\n * @fileoverview A render counter for one server render, to name what spins when a theme\n * worker hits Cloudflare's CPU limit (TD-17779).\n *\n * The render phase log (`server/stream-handler.tsx`) shows those renders stop after `shell`: React\n * sent the document's first part and then never settled the boundaries left. A CPU-bound\n * loop never yields to timers, so the render deadline cannot fire and React never reports a\n * boundary; the worker is killed with nothing said about what it was doing. A loop in React\n * re-renders the same components over and over, though, so each component that records a\n * hit here is counted, and the first count to pass {@link RENDER_LOOP_THRESHOLD} writes one\n * line naming the busiest components. Workers Logs keeps lines written before the kill.\n *\n * A normal page renders each probed component a handful of times, so the threshold is never\n * reached and the cost is one map increment per probed render. In the browser, and on the\n * server outside {@link renderRouterWithDeadline}, there is no probe and nothing is counted.\n *\n * TODO(TD-17779): temporary. Remove with its call sites once the loop is found.\n */\nimport { createContext, useContext } from 'react';\n\n/** Logged when a render's counts pass the threshold; the message stays fixed. */\nexport const RENDER_LOOP_MESSAGE = '[twilight] SSR render loop';\n\n/** Renders of one component in one page past which it is looping, not rendering. */\nexport const RENDER_LOOP_THRESHOLD = 500;\n\n/** How many reports one render may write: at the threshold, then at each tenfold of it. */\nconst MAX_REPORTS = 3;\n\n/** The busiest components each report names. */\nconst TOP_COUNTS = 8;\n\nexport interface RenderLoopReport {\n /** Hits across every probed component so far. */\n total: number;\n /** The component whose hit wrote this report. */\n last: string;\n /** The busiest components, `name: count`, busiest first. */\n top: string[];\n}\n\nexport interface RenderProbe {\n /** Counts one render of `name`. */\n hit(name: string): void;\n}\n\n/**\n * A probe for one render. `report` is called when the busiest component first passes\n * `threshold`, and again at ten and a hundred times it, so a loop that keeps going says\n * so, and how fast it is growing, without writing a line per render.\n */\nexport function createRenderProbe(\n report: (details: RenderLoopReport) => void,\n threshold: number = RENDER_LOOP_THRESHOLD\n): RenderProbe {\n const counts = new Map<string, number>();\n let total = 0;\n let next = threshold;\n let reports = 0;\n\n return {\n hit(name) {\n total += 1;\n const count = (counts.get(name) ?? 0) + 1;\n counts.set(name, count);\n if (count < next || reports >= MAX_REPORTS) return;\n reports += 1;\n next *= 10;\n report({\n total,\n last: name,\n top: [...counts]\n .sort((a, b) => b[1] - a[1])\n .slice(0, TOP_COUNTS)\n .map(([key, value]) => `${key}: ${value}`),\n });\n },\n };\n}\n\n/** The probe of the render in progress; none in the browser. */\nexport const RenderProbeContext = createContext<RenderProbe | null>(null);\n\n/**\n * Counts this render of `name` toward the server render's loop report. Call it at the top\n * of a component, before anything that can suspend, so a component that suspends again on\n * every retry is still counted. Does nothing in the browser.\n */\nexport function useRenderProbe(name: string): void {\n useContext(RenderProbeContext)?.hit(name);\n}\n"]}
@@ -1,6 +1,10 @@
1
+ import { useRenderProbe } from './chunk-T43GL7UN.js';
1
2
  import { lazy, useState, createElement } from 'react';
2
3
 
3
- // src/utils/lazy-component.ts
4
+ function probeName(component) {
5
+ if (!component) return "pending";
6
+ return component.displayName || component.name || "anonymous";
7
+ }
4
8
  var serverLoads = /* @__PURE__ */ new Set();
5
9
  function lazyComponent(load) {
6
10
  let component;
@@ -10,6 +14,7 @@ function lazyComponent(load) {
10
14
  });
11
15
  const OnDemand = lazy(() => preload().then(() => ({ default: component })));
12
16
  const Lazy = ((props) => {
17
+ useRenderProbe(`lazy:${probeName(component)}`);
13
18
  const [loaded] = useState(() => component);
14
19
  return createElement(loaded ?? OnDemand, props);
15
20
  });
@@ -23,5 +28,5 @@ async function preloadServerComponents() {
23
28
  }
24
29
 
25
30
  export { lazyComponent, preloadServerComponents };
26
- //# sourceMappingURL=chunk-VYGA5AT5.js.map
27
- //# sourceMappingURL=chunk-VYGA5AT5.js.map
31
+ //# sourceMappingURL=chunk-TLHZBTPZ.js.map
32
+ //# sourceMappingURL=chunk-TLHZBTPZ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/lazy-component.ts"],"names":[],"mappings":";;;AAWA,SAAS,UAAU,SAAA,EAAwE;AACzF,EAAA,IAAI,CAAC,WAAW,OAAO,SAAA;AACvB,EAAA,OAAO,SAAA,CAAU,WAAA,IAAe,SAAA,CAAU,IAAA,IAAQ,WAAA;AACpD;AAGA,IAAM,WAAA,uBAAkB,GAAA,EAAyB;AAY1C,SAAS,cACd,IAAA,EACkB;AAClB,EAAA,IAAI,SAAA;AACJ,EAAA,IAAI,OAAA;AACJ,EAAA,MAAM,UAAU,MACb,OAAA,KAAY,MAAK,CAAE,IAAA,CAAK,CAAC,MAAA,KAAW;AACnC,IAAA,SAAA,GAAY,MAAA,CAAO,OAAA;AAAA,EACrB,CAAC,CAAA;AAEH,EAAA,MAAM,QAAA,GAAW,IAAA,CAAK,MAAM,OAAA,EAAQ,CAAE,IAAA,CAAK,OAAO,EAAE,OAAA,EAAS,SAAA,EAAe,CAAE,CAAC,CAAA;AAE/E,EAAA,MAAM,IAAA,IAAQ,CAAC,KAAA,KAA6B;AAC1C,IAAA,cAAA,CAAe,CAAA,KAAA,EAAQ,SAAA,CAAU,SAAS,CAAC,CAAA,CAAE,CAAA;AAE7C,IAAA,MAAM,CAAC,MAAM,CAAA,GAAI,QAAA,CAAS,MAAM,SAAS,CAAA;AACzC,IAAA,OAAO,aAAA,CAAc,MAAA,IAAU,QAAA,EAAU,KAAK,CAAA;AAAA,EAChD,CAAA,CAAA;AACA,EAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AAEf,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,WAAA,CAAY,IAAI,OAAO,CAAA;AAC1D,EAAA,OAAO,IAAA;AACT;AAQA,eAAsB,uBAAA,GAAyC;AAC7D,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,EAAA,MAAM,OAAA,CAAQ,UAAA,CAAW,CAAC,GAAG,WAAW,CAAA,CAAE,GAAA,CAAI,CAAC,OAAA,KAAY,OAAA,EAAS,CAAC,CAAA;AACvE","file":"chunk-TLHZBTPZ.js","sourcesContent":["import { createElement, lazy, useState, type ComponentProps, type ComponentType } from 'react';\nimport { useRenderProbe } from './render-probe';\n\n/** A component that loads its module on first render, like `React.lazy`, and can load it ahead. */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- the same bound as React.lazy\nexport type LazyComponent<T extends ComponentType<any>> = T & {\n /** Loads the module; the same promise on every call. */\n preload: () => Promise<void>;\n};\n\n/** The loaded component's name for the render loop report, or `pending` before it loads. */\nfunction probeName(component: { displayName?: string; name?: string } | undefined): string {\n if (!component) return 'pending';\n return component.displayName || component.name || 'anonymous';\n}\n\n/** Every lazy component's loader on the server, run before its first render. */\nconst serverLoads = new Set<() => Promise<void>>();\n\n/**\n * `React.lazy` with a `preload`. A `React.lazy` suspends the first time it renders in a\n * server isolate even when its module is in the worker bundle: its import settles a tick\n * later. Every suspended boundary then streams after the shell and the router's data,\n * which put the home page's blocks, and their LCP image preload, at the end of the\n * document whenever an isolate was fresh. This one renders its component directly once\n * the module has loaded, and `preloadServerComponents` loads them all before the first\n * render. Mounted before then, it is a plain `React.lazy`.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any -- the same bound as React.lazy\nexport function lazyComponent<T extends ComponentType<any>>(\n load: () => Promise<{ default: T }>\n): LazyComponent<T> {\n let component: T | undefined;\n let loading: Promise<void> | undefined;\n const preload = () =>\n (loading ??= load().then((module) => {\n component = module.default;\n }));\n // Not loaded yet when mounted (the browser's first render): load as React.lazy does.\n const OnDemand = lazy(() => preload().then(() => ({ default: component as T })));\n\n const Lazy = ((props: ComponentProps<T>) => {\n useRenderProbe(`lazy:${probeName(component)}`);\n // Picked once per mount, so a loaded module never swaps the element type under its state.\n const [loaded] = useState(() => component);\n return createElement(loaded ?? OnDemand, props);\n }) as LazyComponent<T>;\n Lazy.preload = preload;\n\n if (typeof window === 'undefined') serverLoads.add(preload);\n return Lazy;\n}\n\n/**\n * Loads every lazy component on the server so none suspends while the page renders. Each\n * module loads once per isolate; later calls also pick up components defined since, such\n * as a route chunk's. Resolves at once in the browser, where they load on demand. A module\n * that fails to load is left to fail where it renders, as before.\n */\nexport async function preloadServerComponents(): Promise<void> {\n if (typeof window !== 'undefined') return;\n await Promise.allSettled([...serverLoads].map((preload) => preload()));\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { lazyComponent } from './chunk-VYGA5AT5.js';
1
+ import { lazyComponent } from './chunk-TLHZBTPZ.js';
2
2
 
3
3
  // src/components/modal/lazy.ts
4
4
  var LazyImageModal = lazyComponent(
@@ -6,5 +6,5 @@ var LazyImageModal = lazyComponent(
6
6
  );
7
7
 
8
8
  export { LazyImageModal };
9
- //# sourceMappingURL=chunk-KYMWEUN2.js.map
10
- //# sourceMappingURL=chunk-KYMWEUN2.js.map
9
+ //# sourceMappingURL=chunk-TVL6UBN2.js.map
10
+ //# sourceMappingURL=chunk-TVL6UBN2.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/modal/lazy.ts"],"names":[],"mappings":";;;AAOO,IAAM,cAAA,GAAiB,aAAA;AAAA,EAAc,MAC1C,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW,CAAE;AAChE","file":"chunk-KYMWEUN2.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\n/**\n * Lazy-loaded modal components\n * ImageModal is lazy-loaded since it's a standalone component.\n * Modal is kept eager because it uses compound component pattern.\n */\nexport const LazyImageModal = lazyComponent(() =>\n import('./ImageModal').then((m) => ({ default: m.ImageModal }))\n);\n"]}
1
+ {"version":3,"sources":["../src/components/modal/lazy.ts"],"names":[],"mappings":";;;AAOO,IAAM,cAAA,GAAiB,aAAA;AAAA,EAAc,MAC1C,OAAO,0BAAc,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,UAAA,EAAW,CAAE;AAChE","file":"chunk-TVL6UBN2.js","sourcesContent":["import { lazyComponent } from '../../utils/lazy-component';\n\n/**\n * Lazy-loaded modal components\n * ImageModal is lazy-loaded since it's a standalone component.\n * Modal is kept eager because it uses compound component pattern.\n */\nexport const LazyImageModal = lazyComponent(() =>\n import('./ImageModal').then((m) => ({ default: m.ImageModal }))\n);\n"]}
@@ -1,7 +1,9 @@
1
1
  import { onSallaEvent } from './chunk-MZPX4EPS.js';
2
+ import { useRenderProbe } from './chunk-T43GL7UN.js';
2
3
  import { useState, useCallback, useEffect } from 'react';
3
4
 
4
5
  function useComments() {
6
+ useRenderProbe("useComments");
5
7
  const [commentsKey, setCommentsKey] = useState(0);
6
8
  const refresh = useCallback(() => {
7
9
  setCommentsKey((prev) => prev + 1);
@@ -16,5 +18,5 @@ function useComments() {
16
18
  }
17
19
 
18
20
  export { useComments };
19
- //# sourceMappingURL=chunk-64BWBCE7.js.map
20
- //# sourceMappingURL=chunk-64BWBCE7.js.map
21
+ //# sourceMappingURL=chunk-UY4VIWNH.js.map
22
+ //# sourceMappingURL=chunk-UY4VIWNH.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/hooks/useComments.ts"],"names":[],"mappings":";;;;AAwCO,SAAS,WAAA,GAAiC;AAC/C,EAAA,cAAA,CAAe,aAAa,CAAA;AAC5B,EAAA,MAAM,CAAC,WAAA,EAAa,cAAc,CAAA,GAAI,SAAS,CAAC,CAAA;AAEhD,EAAA,MAAM,OAAA,GAAU,YAAY,MAAM;AAChC,IAAA,cAAA,CAAe,CAAC,IAAA,KAAS,IAAA,GAAO,CAAC,CAAA;AAAA,EACnC,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,MAAM,qBAAqB,MAAM;AAC/B,MAAA,cAAA,CAAe,CAAC,IAAA,KAAS,IAAA,GAAO,CAAC,CAAA;AAAA,IACnC,CAAA;AAEA,IAAA,OAAO,YAAA,CAAa,kBAAkB,kBAAkB,CAAA;AAAA,EAC1D,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,EAAE,aAAa,OAAA,EAAQ;AAChC","file":"chunk-UY4VIWNH.js","sourcesContent":["import { useState, useEffect, useCallback } from 'react';\nimport { onSallaEvent } from '../utils/sdk-helpers';\nimport { useRenderProbe } from '../utils/render-probe';\n\n/**\n * UseCommentsResult - Return type for useComments hook\n *\n * @property commentsKey - Key to pass to salla-comments component for re-render\n * @property refresh - Function to manually trigger a comments refresh\n */\nexport interface UseCommentsResult {\n commentsKey: number;\n refresh: () => void;\n}\n\n/**\n * useComments - Hook for managing salla-comments web component re-renders\n *\n * Listens to the Salla SDK's comment added events and automatically\n * increments a re-render key for the salla-comments component. This\n * eliminates the need for full page reloads when comments are added.\n *\n * @returns Object with comments key for component re-rendering and manual refresh function\n *\n * @example\n * ```tsx\n * function ProductPage({ product }) {\n * const { commentsKey } = useComments();\n *\n * return (\n * <salla-comments\n * key={commentsKey}\n * item-id={product.id}\n * type=\"product\"\n * />\n * );\n * }\n * ```\n */\n\nexport function useComments(): UseCommentsResult {\n useRenderProbe('useComments');\n const [commentsKey, setCommentsKey] = useState(0);\n\n const refresh = useCallback(() => {\n setCommentsKey((prev) => prev + 1);\n }, []);\n\n useEffect(() => {\n const handleCommentAdded = () => {\n setCommentsKey((prev) => prev + 1);\n };\n\n return onSallaEvent('comment::added', handleCommentAdded);\n }, []);\n\n return { commentsKey, refresh };\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  import { parseShortLinkPath } from './chunk-6T7N5FOL.js';
2
2
  import { PRODUCT_SLUG_ROUTE_ID, CATEGORY_SLUG_ROUTE_ID } from './chunk-NV4PF3O3.js';
3
3
  import { productKeyOfId } from './chunk-SDBR4X3K.js';
4
- import { redirect, isMissingResource } from './chunk-MAQQHQJX.js';
4
+ import { redirect, isMissingResource } from './chunk-FU2LJG5L.js';
5
5
  import { clearAuthTokenCookie } from './chunk-4OZIBANF.js';
6
6
  import { FALLBACK_LOCALE, isLocale } from './chunk-T72DAX7R.js';
7
7
  import { useEffect } from 'react';
@@ -91,7 +91,7 @@ async function twigUrlRedirect(pathname, search, page, options = {}) {
91
91
  throw redirect(`${locale ? `/${locale}` : ""}${target.path}${search}`, { statusCode: 301 });
92
92
  }
93
93
  if (!options.queryClient || twigPageUrl(pathname)) return;
94
- const { customUrlRedirect } = await import('./custom-urls-NOM56TUW.js');
94
+ const { customUrlRedirect } = await import('./custom-urls-3G5KPPAY.js');
95
95
  await customUrlRedirect(pathname, search, {
96
96
  queryClient: options.queryClient,
97
97
  targetLocale: options.targetLocale
@@ -106,5 +106,5 @@ function LogoutRedirect() {
106
106
  }
107
107
 
108
108
  export { LogoutRedirect, accountRedirectLoader, orderRatingRedirectLoader, pendingOrdersRedirectLoader, productsSourceRedirectLoader, ratingRedirectLoader, slugBrandRedirectLoader, twigUrlRedirect };
109
- //# sourceMappingURL=chunk-I3RQO6LI.js.map
110
- //# sourceMappingURL=chunk-I3RQO6LI.js.map
109
+ //# sourceMappingURL=chunk-V5DQMUSV.js.map
110
+ //# sourceMappingURL=chunk-V5DQMUSV.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/routes/seo-redirects.ts"],"names":["id"],"mappings":";;;;;;;;AAkBA,eAAsB,wBAAwB,GAAA,EAAkD;AAC9F,EAAA,MAAM,MAAA,GAAS,GAAA,CAAI,MAAA,CAAO,MAAA,IAAU,eAAA;AACpC,EAAA,MAAM,SAAS,CAAA,CAAA,EAAI,MAAM,WAAW,GAA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,CAAA,EAAG;AACnC,EAAA,MAAM,MAAA,GAAS,MAAM,UAAA,CAAW,QAAA,EAAU,QAAQ,WAAW,CAAA;AAC7D,EAAA,IAAI,MAAA,EAAQ;AACV,IAAA,MAAM,MAAA,GAAS,QAAQ,YAAA,GAAe,MAAM,QAAQ,YAAA,CAAa,MAAA,CAAO,MAAM,CAAA,GAAI,MAAA,CAAO,MAAA;AACzF,IAAA,MAAM,SAAS,CAAA,EAAG,MAAA,GAAS,CAAA,CAAA,EAAI,MAAM,KAAK,EAAE,CAAA,EAAG,MAAA,CAAO,IAAI,GAAG,MAAM,CAAA,CAAA,EAAI,EAAE,UAAA,EAAY,KAAK,CAAA;AAAA,EAC5F;AACA,EAAA,IAAI,CAAC,OAAA,CAAQ,WAAA,IAAe,WAAA,CAAY,QAAQ,CAAA,EAAG;AACnD,EAAA,MAAM,EAAE,iBAAA,EAAkB,GAAI,MAAM,OAAO,2BAAe,CAAA;AAC1D,EAAA,MAAM,iBAAA,CAAkB,UAAU,MAAA,EAAQ;AAAA,IACxC,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,cAAc,OAAA,CAAQ;AAAA,GACvB,CAAA;AACH;AAUO,SAAS,cAAA,GAAuB;AACrC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,oBAAA,EAAqB;AAErB,IAAA,MAAA,CAAO,QAAA,CAAS,QAAQ,MAAA,CAAO,QAAA,CAAS,KAAK,OAAA,CAAQ,8BAAA,EAAgC,EAAE,CAAC,CAAA;AAAA,EAC1F,CAAA,EAAG,EAAE,CAAA;AACL,EAAA,OAAO,IAAA;AACT","file":"chunk-I3RQO6LI.js","sourcesContent":["import { useEffect } from 'react';\nimport type { QueryClient } from '@tanstack/react-query';\nimport { isMissingResource, redirect } from '../providers/NavigationProvider';\nimport { FALLBACK_LOCALE, isLocale } from '../providers/locale-constants';\nimport { productKeyOfId } from '../router/product-key-urls';\nimport { CATEGORY_SLUG_ROUTE_ID, PRODUCT_SLUG_ROUTE_ID } from '../router/slug-routes';\nimport { clearAuthTokenCookie } from '../utils/cookies';\nimport { parseShortLinkPath } from './short-link-path';\n\nexport interface SlugBrandParams {\n /** SEO slug segment (ignored — only here to match the route pattern). */\n slug: string;\n /** Brand numeric ID to redirect to. */\n id: string;\n /** Active locale from the `/$locale` parent layout (e.g. `'ar'`, `'en'`). */\n locale?: string;\n}\n\nexport async function slugBrandRedirectLoader(ctx: { params: SlugBrandParams }): Promise<never> {\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n throw redirect(`/${locale}/brands/${ctx.params.id}`);\n}\n\nexport interface PendingOrdersRedirectParams {\n /** Active locale from the `/$locale` parent layout (e.g. `'ar'`, `'en'`). */\n locale?: string;\n}\n\nexport async function pendingOrdersRedirectLoader(\n ctx: { params: PendingOrdersRedirectParams } = { params: {} }\n): Promise<never> {\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n throw redirect(`/${locale}/account/orders?status=pending`);\n}\n\n/** `/account/rating`: the loyalty \"rate your orders\" link. Twig Raed has no rating page and sends it to the orders list. */\nexport async function ratingRedirectLoader(\n ctx: { params: PendingOrdersRedirectParams } = { params: {} }\n): Promise<never> {\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n throw redirect(`/${locale}/account/orders`);\n}\n\n/**\n * `/rating/{id}` and `/account/rating/{id}`: the rate-your-order link in the order email and SMS,\n * sent like Twig to the order with its rating popup. The id goes as it came: the orders API\n * decodes it the way Store's `rateOrder` does (optimus when numeric, else the hash).\n */\nexport async function orderRatingRedirectLoader(ctx: {\n params: PendingOrdersRedirectParams & { id: string };\n /** The incoming query string, `token` included: the SDK signs the visitor in with it. */\n search?: string;\n}): Promise<never> {\n const prefix = ctx.params.locale ? `/${ctx.params.locale}` : '';\n const query = new URLSearchParams(ctx.search);\n query.set('show-rating-popup', 'true');\n throw redirect(`${prefix}/account/orders/${encodeURIComponent(ctx.params.id)}?${query}`);\n}\n\n/** A Twig customer URL (`/profile`, `/orders`, …) kept working as its `/account/…` page. */\nexport async function accountRedirectLoader(ctx: {\n params: PendingOrdersRedirectParams;\n page: string;\n /** The incoming query string (`?status=pending`), kept on the account page. */\n search?: string;\n}): Promise<never> {\n // No locale in the URL stays without one: the locale layout adds it only where the store has several.\n const prefix = ctx.params.locale ? `/${ctx.params.locale}` : '';\n throw redirect(`${prefix}/account/${ctx.page}${ctx.search ?? ''}`, { statusCode: 301 });\n}\n\n/** `/latest-products`, `/most-sales-products` and `/offers` now live at `/products?source=`. */\nexport async function productsSourceRedirectLoader(ctx: {\n params: PendingOrdersRedirectParams;\n source: 'latest' | 'sales' | 'offers';\n search?: string;\n}): Promise<never> {\n const prefix = ctx.params.locale ? `/${ctx.params.locale}` : '';\n const query = new URLSearchParams(ctx.search);\n query.delete('source');\n const rest = query.toString();\n throw redirect(`${prefix}/products?source=${ctx.source}${rest ? `&${rest}` : ''}`, {\n statusCode: 301,\n });\n}\n\nexport { resolveProductKeyPage } from './product/key';\nexport { publicProductKeyPath } from '../router/product-key-urls';\n\n/** Routes a Twig URL lands on by accident: a locale bound as `$slug`, or an id that is no number. */\nconst SLUG_ROUTES = new Set([PRODUCT_SLUG_ROUTE_ID, CATEGORY_SLUG_ROUTE_ID]);\n\n/** `/p{id}` or `/p{id}-{name}`, with or without a leading segment; the id capped as in `./product/id`. */\nconst TWIG_PRODUCT_URL = /^(?:\\/([^/]+))?\\/p(\\d{1,18})(?:-[^/]*)?\\/?$/;\n/** `/category/{hash}`, with or without a leading segment. */\nconst TWIG_CATEGORY_URL = /^(?:\\/([^/]+))?\\/category\\/([A-Za-z0-9]+)\\/?$/;\n\n/** The page the router matched, as the locale layout's `beforeLoad` sees it. */\nexport interface MatchedPage {\n routeId: string;\n params: Record<string, string | undefined>;\n}\n\nfunction rendersNoPage({ routeId, params }: MatchedPage): boolean {\n // A first segment that is no language binds as the locale, of the layout or of the home page.\n if (routeId === '/{-$locale}' || (params.locale && !isLocale(params.locale))) return true;\n if (!SLUG_ROUTES.has(routeId)) return false;\n // A SKU-link address the router's rewrite gave the product route (`router/product-key-urls`).\n if (productKeyOfId(params.id)) return false;\n return (!params.locale && isLocale(params.slug)) || !/^\\d+$/.test(params.id ?? '');\n}\n\nexport interface TwigUrlRedirectOptions {\n /**\n * The language segment the target takes, given the one the address had. The locale layout\n * knows how the store addresses its pages, so the redirect lands there in one hop: `/-/p1`\n * on a store with several languages was sent on again to `/ar/-/p1`, and that second request\n * also fetched the product, because the server starts every loader at once. Without it the\n * address's own segment is kept.\n */\n targetLocale?: (addressLocale: string | undefined) => Promise<string | undefined>;\n /**\n * The request's query client. The category lookup is then shared between a hover preload and\n * the click.\n */\n queryClient?: QueryClient;\n}\n\n/** The category's numeric id for its Twig hash, or `undefined` when the API has no such category. */\nasync function categoryIdOf(hash: string, queryClient?: QueryClient): Promise<string | undefined> {\n const { category } = await import('../api/category');\n try {\n const found = queryClient\n ? await queryClient.ensureQueryData(category.queries.detail(hash))\n : await category.find(hash);\n // Only the id is taken. The category is never filed under its id for the category page:\n // this lookup ran in the address's language (Arabic when it has none, the fallback), and\n // the page may be in another (`/en/-/c…` on an English-only store), while a category's\n // cache key carries no language.\n return String(found.id_ ?? found.id);\n } catch (error) {\n if (isMissingResource(error)) return undefined;\n throw error;\n }\n}\n\n/**\n * The product id behind a short link (`/KjQrpE`). A store without SEO URLs gives every product\n * that address, in its sitemap and in the API's `url`, and the API takes the code in place of\n * the id. Any failure counts as \"no such product\": a bare `/{code}` is also every scanner's\n * `/admin`, so an API error must not turn those into 500s. The not-found page's\n * `useProductShortLink` asks again from the browser, as it did before.\n */\nasync function shortLinkProductId(\n code: string,\n queryClient?: QueryClient\n): Promise<string | undefined> {\n const { product } = await import('../api/product');\n try {\n const found = queryClient\n ? await queryClient.ensureQueryData(product.queries.detail(code))\n : await product.find(code);\n return found?.id ? String(found.id) : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** Where a Twig URL's page is now, and the language its address carried. */\n/**\n * A Twig product or category URL: `/p{id}…` or `/category/{hash}`, bare or under a language. Under\n * any other first segment it is no Twig route, so the Store's catch-all would have it.\n */\nfunction twigPageUrl(\n pathname: string\n): { kind: 'p' | 'c'; ref: string; locale?: string } | undefined {\n const productUrl = TWIG_PRODUCT_URL.exec(pathname);\n const match = productUrl ?? TWIG_CATEGORY_URL.exec(pathname);\n if (!match || (match[1] && !isLocale(match[1]))) return undefined;\n return { kind: productUrl ? 'p' : 'c', ref: match[2], locale: match[1] };\n}\n\nasync function twigTarget(\n pathname: string,\n queryClient?: QueryClient\n): Promise<{ path: string; locale?: string } | undefined> {\n const pageUrl = twigPageUrl(pathname);\n if (pageUrl) {\n if (pageUrl.kind === 'p') return { path: `/-/p${pageUrl.ref}`, locale: pageUrl.locale };\n const id = await categoryIdOf(pageUrl.ref, queryClient);\n return id ? { path: `/-/c${id}`, locale: pageUrl.locale } : undefined;\n }\n const shortLink = parseShortLinkPath(pathname);\n if (!shortLink) return undefined;\n const id = await shortLinkProductId(shortLink.code, queryClient);\n return id ? { path: `/-/p${id}`, locale: shortLink.locale } : undefined;\n}\n\n/**\n * Twig's product and category URLs, each with or without a locale, sent to the page that has\n * them now: `/p{id}`, `/p{id}-{name}`, `/category/{hash}` and the product short link `/{code}`.\n * Run by the locale layout's `beforeLoad`, only for an address no page answers: the router binds\n * `/ar/p1` to `$slug/p{$id}` (slug `ar`) and `/p1` to the locale.\n *\n * A product URL carries its id, so it is redirected without asking the API: a product that is\n * gone is the product page's not-found, one hop on. A category hash or a short code only the API\n * can turn into the id; one that is gone stays the not-found page at its address.\n *\n * Any other address no page answers, a short code that names no product included, may be one of\n * the merchant's custom URLs, which Twig's catch-all answers last (`./custom-urls`). A gone\n * category's Twig URL is not: Twig's category route answers it.\n */\nexport async function twigUrlRedirect(\n pathname: string,\n search: string,\n page: MatchedPage | undefined,\n options: TwigUrlRedirectOptions = {}\n): Promise<void> {\n if (!page || !rendersNoPage(page)) return;\n const target = await twigTarget(pathname, options.queryClient);\n if (target) {\n const locale = options.targetLocale ? await options.targetLocale(target.locale) : target.locale;\n throw redirect(`${locale ? `/${locale}` : ''}${target.path}${search}`, { statusCode: 301 });\n }\n if (!options.queryClient || twigPageUrl(pathname)) return;\n const { customUrlRedirect } = await import('./custom-urls');\n await customUrlRedirect(pathname, search, {\n queryClient: options.queryClient,\n targetLocale: options.targetLocale,\n });\n}\n\n/**\n * `/logout` — where the SDK sends the browser once `salla.auth.logout()` has run\n * (`salla.url.get('logout?from=…')`). The Twig storefront serves that URL server-side. Here\n * it renders nothing and, in the browser, removes the theme's own `token` cookie (the SDK's\n * `cookie.clearAll()` leaves it) and then does a full navigation home. It has to be a\n * component, not a loader redirect: a loader runs during server rendering, where the cookie\n * can't be cleared, so the redirect would leave the visitor signed in on the next request.\n */\nexport function LogoutRedirect(): null {\n useEffect(() => {\n clearAuthTokenCookie();\n // `/{store base}/{locale}/logout?from=…` → `/{store base}/{locale}`\n window.location.replace(window.location.href.replace(/\\/logout\\/?(\\?[^#]*)?(#.*)?$/, ''));\n }, []);\n return null;\n}\n"]}
1
+ {"version":3,"sources":["../src/routes/seo-redirects.ts"],"names":["id"],"mappings":";;;;;;;;AAkBA,eAAsB,wBAAwB,GAAA,EAAkD;AAC9F,EAAA,MAAM,MAAA,GAAS,GAAA,CAAI,MAAA,CAAO,MAAA,IAAU,eAAA;AACpC,EAAA,MAAM,SAAS,CAAA,CAAA,EAAI,MAAM,WAAW,GAAA,CAAI,MAAA,CAAO,EAAE,CAAA,CAAE,CAAA;AACrD;AAOA,eAAsB,4BACpB,GAAA,GAA+C,EAAE,MAAA,EAAQ,IAAG,EAC5C;AAChB,EAAA,MAAM,MAAA,GAAS,GAAA,CAAI,MAAA,CAAO,MAAA,IAAU,eAAA;AACpC,EAAA,MAAM,QAAA,CAAS,CAAA,CAAA,EAAI,MAAM,CAAA,8BAAA,CAAgC,CAAA;AAC3D;AAGA,eAAsB,qBACpB,GAAA,GAA+C,EAAE,MAAA,EAAQ,IAAG,EAC5C;AAChB,EAAA,MAAM,MAAA,GAAS,GAAA,CAAI,MAAA,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EAAE,UAAA,EAAY,KAAK,CAAA;AAAA,EAC5F;AACA,EAAA,IAAI,CAAC,OAAA,CAAQ,WAAA,IAAe,WAAA,CAAY,QAAQ,CAAA,EAAG;AACnD,EAAA,MAAM,EAAE,iBAAA,EAAkB,GAAI,MAAM,OAAO,2BAAe,CAAA;AAC1D,EAAA,MAAM,iBAAA,CAAkB,UAAU,MAAA,EAAQ;AAAA,IACxC,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,cAAc,OAAA,CAAQ;AAAA,GACvB,CAAA;AACH;AAUO,SAAS,cAAA,GAAuB;AACrC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,oBAAA,EAAqB;AAErB,IAAA,MAAA,CAAO,QAAA,CAAS,QAAQ,MAAA,CAAO,QAAA,CAAS,KAAK,OAAA,CAAQ,8BAAA,EAAgC,EAAE,CAAC,CAAA;AAAA,EAC1F,CAAA,EAAG,EAAE,CAAA;AACL,EAAA,OAAO,IAAA;AACT","file":"chunk-V5DQMUSV.js","sourcesContent":["import { useEffect } from 'react';\nimport type { QueryClient } from '@tanstack/react-query';\nimport { isMissingResource, redirect } from '../providers/NavigationProvider';\nimport { FALLBACK_LOCALE, isLocale } from '../providers/locale-constants';\nimport { productKeyOfId } from '../router/product-key-urls';\nimport { CATEGORY_SLUG_ROUTE_ID, PRODUCT_SLUG_ROUTE_ID } from '../router/slug-routes';\nimport { clearAuthTokenCookie } from '../utils/cookies';\nimport { parseShortLinkPath } from './short-link-path';\n\nexport interface SlugBrandParams {\n /** SEO slug segment (ignored — only here to match the route pattern). */\n slug: string;\n /** Brand numeric ID to redirect to. */\n id: string;\n /** Active locale from the `/$locale` parent layout (e.g. `'ar'`, `'en'`). */\n locale?: string;\n}\n\nexport async function slugBrandRedirectLoader(ctx: { params: SlugBrandParams }): Promise<never> {\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n throw redirect(`/${locale}/brands/${ctx.params.id}`);\n}\n\nexport interface PendingOrdersRedirectParams {\n /** Active locale from the `/$locale` parent layout (e.g. `'ar'`, `'en'`). */\n locale?: string;\n}\n\nexport async function pendingOrdersRedirectLoader(\n ctx: { params: PendingOrdersRedirectParams } = { params: {} }\n): Promise<never> {\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n throw redirect(`/${locale}/account/orders?status=pending`);\n}\n\n/** `/account/rating`: the loyalty \"rate your orders\" link. Twig Raed has no rating page and sends it to the orders list. */\nexport async function ratingRedirectLoader(\n ctx: { params: PendingOrdersRedirectParams } = { params: {} }\n): Promise<never> {\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n throw redirect(`/${locale}/account/orders`);\n}\n\n/**\n * `/rating/{id}` and `/account/rating/{id}`: the rate-your-order link in the order email and SMS,\n * sent like Twig to the order with its rating popup. The id goes as it came: the orders API\n * decodes it the way Store's `rateOrder` does (optimus when numeric, else the hash).\n */\nexport async function orderRatingRedirectLoader(ctx: {\n params: PendingOrdersRedirectParams & { id: string };\n /** The incoming query string, `token` included: the SDK signs the visitor in with it. */\n search?: string;\n}): Promise<never> {\n const prefix = ctx.params.locale ? `/${ctx.params.locale}` : '';\n const query = new URLSearchParams(ctx.search);\n query.set('show-rating-popup', 'true');\n throw redirect(`${prefix}/account/orders/${encodeURIComponent(ctx.params.id)}?${query}`);\n}\n\n/** A Twig customer URL (`/profile`, `/orders`, …) kept working as its `/account/…` page. */\nexport async function accountRedirectLoader(ctx: {\n params: PendingOrdersRedirectParams;\n page: string;\n /** The incoming query string (`?status=pending`), kept on the account page. */\n search?: string;\n}): Promise<never> {\n // No locale in the URL stays without one: the locale layout adds it only where the store has several.\n const prefix = ctx.params.locale ? `/${ctx.params.locale}` : '';\n throw redirect(`${prefix}/account/${ctx.page}${ctx.search ?? ''}`, { statusCode: 301 });\n}\n\n/** `/latest-products`, `/most-sales-products` and `/offers` now live at `/products?source=`. */\nexport async function productsSourceRedirectLoader(ctx: {\n params: PendingOrdersRedirectParams;\n source: 'latest' | 'sales' | 'offers';\n search?: string;\n}): Promise<never> {\n const prefix = ctx.params.locale ? `/${ctx.params.locale}` : '';\n const query = new URLSearchParams(ctx.search);\n query.delete('source');\n const rest = query.toString();\n throw redirect(`${prefix}/products?source=${ctx.source}${rest ? `&${rest}` : ''}`, {\n statusCode: 301,\n });\n}\n\nexport { resolveProductKeyPage } from './product/key';\nexport { publicProductKeyPath } from '../router/product-key-urls';\n\n/** Routes a Twig URL lands on by accident: a locale bound as `$slug`, or an id that is no number. */\nconst SLUG_ROUTES = new Set([PRODUCT_SLUG_ROUTE_ID, CATEGORY_SLUG_ROUTE_ID]);\n\n/** `/p{id}` or `/p{id}-{name}`, with or without a leading segment; the id capped as in `./product/id`. */\nconst TWIG_PRODUCT_URL = /^(?:\\/([^/]+))?\\/p(\\d{1,18})(?:-[^/]*)?\\/?$/;\n/** `/category/{hash}`, with or without a leading segment. */\nconst TWIG_CATEGORY_URL = /^(?:\\/([^/]+))?\\/category\\/([A-Za-z0-9]+)\\/?$/;\n\n/** The page the router matched, as the locale layout's `beforeLoad` sees it. */\nexport interface MatchedPage {\n routeId: string;\n params: Record<string, string | undefined>;\n}\n\nfunction rendersNoPage({ routeId, params }: MatchedPage): boolean {\n // A first segment that is no language binds as the locale, of the layout or of the home page.\n if (routeId === '/{-$locale}' || (params.locale && !isLocale(params.locale))) return true;\n if (!SLUG_ROUTES.has(routeId)) return false;\n // A SKU-link address the router's rewrite gave the product route (`router/product-key-urls`).\n if (productKeyOfId(params.id)) return false;\n return (!params.locale && isLocale(params.slug)) || !/^\\d+$/.test(params.id ?? '');\n}\n\nexport interface TwigUrlRedirectOptions {\n /**\n * The language segment the target takes, given the one the address had. The locale layout\n * knows how the store addresses its pages, so the redirect lands there in one hop: `/-/p1`\n * on a store with several languages was sent on again to `/ar/-/p1`, and that second request\n * also fetched the product, because the server starts every loader at once. Without it the\n * address's own segment is kept.\n */\n targetLocale?: (addressLocale: string | undefined) => Promise<string | undefined>;\n /**\n * The request's query client. The category lookup is then shared between a hover preload and\n * the click.\n */\n queryClient?: QueryClient;\n}\n\n/** The category's numeric id for its Twig hash, or `undefined` when the API has no such category. */\nasync function categoryIdOf(hash: string, queryClient?: QueryClient): Promise<string | undefined> {\n const { category } = await import('../api/category');\n try {\n const found = queryClient\n ? await queryClient.ensureQueryData(category.queries.detail(hash))\n : await category.find(hash);\n // Only the id is taken. The category is never filed under its id for the category page:\n // this lookup ran in the address's language (Arabic when it has none, the fallback), and\n // the page may be in another (`/en/-/c…` on an English-only store), while a category's\n // cache key carries no language.\n return String(found.id_ ?? found.id);\n } catch (error) {\n if (isMissingResource(error)) return undefined;\n throw error;\n }\n}\n\n/**\n * The product id behind a short link (`/KjQrpE`). A store without SEO URLs gives every product\n * that address, in its sitemap and in the API's `url`, and the API takes the code in place of\n * the id. Any failure counts as \"no such product\": a bare `/{code}` is also every scanner's\n * `/admin`, so an API error must not turn those into 500s. The not-found page's\n * `useProductShortLink` asks again from the browser, as it did before.\n */\nasync function shortLinkProductId(\n code: string,\n queryClient?: QueryClient\n): Promise<string | undefined> {\n const { product } = await import('../api/product');\n try {\n const found = queryClient\n ? await queryClient.ensureQueryData(product.queries.detail(code))\n : await product.find(code);\n return found?.id ? String(found.id) : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** Where a Twig URL's page is now, and the language its address carried. */\n/**\n * A Twig product or category URL: `/p{id}…` or `/category/{hash}`, bare or under a language. Under\n * any other first segment it is no Twig route, so the Store's catch-all would have it.\n */\nfunction twigPageUrl(\n pathname: string\n): { kind: 'p' | 'c'; ref: string; locale?: string } | undefined {\n const productUrl = TWIG_PRODUCT_URL.exec(pathname);\n const match = productUrl ?? TWIG_CATEGORY_URL.exec(pathname);\n if (!match || (match[1] && !isLocale(match[1]))) return undefined;\n return { kind: productUrl ? 'p' : 'c', ref: match[2], locale: match[1] };\n}\n\nasync function twigTarget(\n pathname: string,\n queryClient?: QueryClient\n): Promise<{ path: string; locale?: string } | undefined> {\n const pageUrl = twigPageUrl(pathname);\n if (pageUrl) {\n if (pageUrl.kind === 'p') return { path: `/-/p${pageUrl.ref}`, locale: pageUrl.locale };\n const id = await categoryIdOf(pageUrl.ref, queryClient);\n return id ? { path: `/-/c${id}`, locale: pageUrl.locale } : undefined;\n }\n const shortLink = parseShortLinkPath(pathname);\n if (!shortLink) return undefined;\n const id = await shortLinkProductId(shortLink.code, queryClient);\n return id ? { path: `/-/p${id}`, locale: shortLink.locale } : undefined;\n}\n\n/**\n * Twig's product and category URLs, each with or without a locale, sent to the page that has\n * them now: `/p{id}`, `/p{id}-{name}`, `/category/{hash}` and the product short link `/{code}`.\n * Run by the locale layout's `beforeLoad`, only for an address no page answers: the router binds\n * `/ar/p1` to `$slug/p{$id}` (slug `ar`) and `/p1` to the locale.\n *\n * A product URL carries its id, so it is redirected without asking the API: a product that is\n * gone is the product page's not-found, one hop on. A category hash or a short code only the API\n * can turn into the id; one that is gone stays the not-found page at its address.\n *\n * Any other address no page answers, a short code that names no product included, may be one of\n * the merchant's custom URLs, which Twig's catch-all answers last (`./custom-urls`). A gone\n * category's Twig URL is not: Twig's category route answers it.\n */\nexport async function twigUrlRedirect(\n pathname: string,\n search: string,\n page: MatchedPage | undefined,\n options: TwigUrlRedirectOptions = {}\n): Promise<void> {\n if (!page || !rendersNoPage(page)) return;\n const target = await twigTarget(pathname, options.queryClient);\n if (target) {\n const locale = options.targetLocale ? await options.targetLocale(target.locale) : target.locale;\n throw redirect(`${locale ? `/${locale}` : ''}${target.path}${search}`, { statusCode: 301 });\n }\n if (!options.queryClient || twigPageUrl(pathname)) return;\n const { customUrlRedirect } = await import('./custom-urls');\n await customUrlRedirect(pathname, search, {\n queryClient: options.queryClient,\n targetLocale: options.targetLocale,\n });\n}\n\n/**\n * `/logout` — where the SDK sends the browser once `salla.auth.logout()` has run\n * (`salla.url.get('logout?from=…')`). The Twig storefront serves that URL server-side. Here\n * it renders nothing and, in the browser, removes the theme's own `token` cookie (the SDK's\n * `cookie.clearAll()` leaves it) and then does a full navigation home. It has to be a\n * component, not a loader redirect: a loader runs during server rendering, where the cookie\n * can't be cleared, so the redirect would leave the visitor signed in on the next request.\n */\nexport function LogoutRedirect(): null {\n useEffect(() => {\n clearAuthTokenCookie();\n // `/{store base}/{locale}/logout?from=…` → `/{store base}/{locale}`\n window.location.replace(window.location.href.replace(/\\/logout\\/?(\\?[^#]*)?(#.*)?$/, ''));\n }, []);\n return null;\n}\n"]}
@@ -1,7 +1,7 @@
1
- import { useOpeningHours } from './chunk-L5JO3H2U.js';
2
- import { useIsProduct } from './chunk-MAQQHQJX.js';
1
+ import { useOpeningHours } from './chunk-WHGEXTQR.js';
2
+ import { useIsProduct } from './chunk-FU2LJG5L.js';
3
3
  import { useTranslation } from './chunk-TYNZ5B2B.js';
4
- import { useTwilight } from './chunk-DF6FBKDN.js';
4
+ import { useTwilight } from './chunk-3VFOVWOE.js';
5
5
  import { useState } from 'react';
6
6
  import { jsxs, jsx } from 'react/jsx-runtime';
7
7
 
@@ -54,5 +54,5 @@ function StoreClosedNotification(_props) {
54
54
  }
55
55
 
56
56
  export { StoreClosedNotification };
57
- //# sourceMappingURL=chunk-XGNKN4K5.js.map
58
- //# sourceMappingURL=chunk-XGNKN4K5.js.map
57
+ //# sourceMappingURL=chunk-VBMD3J7W.js.map
58
+ //# sourceMappingURL=chunk-VBMD3J7W.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;AAGn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,qPAAkD,iBAAiB,CAAA,CAAA,CAAA;AAAA,UACjF,QAAA,EAAU;AAAA,SACX,CAAA,EACH;AAAA;AAAA;AAAA,GACF;AAEJ","file":"chunk-XGNKN4K5.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
+ {"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,EAAA,MAAM,WAAA,GAAc,CAAC,CAAA,KAAwB;AAC3C,IAAA,CAAA,CAAE,cAAA,EAAe;AACjB,IAAA,YAAA,CAAa,IAAI,CAAA;AAAA,EACnB,CAAA;AAEA,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAU,cAAA;AAAA,MACV,EAAA,EAAG,2BAAA;AAAA,MACH,aAAA,EAAY,2BAAA;AAAA,MACZ,KAAA,EAAO;AAAA,QACL,eAAA,EAAiB,SAAA;AAAA,QACjB,KAAA,EAAO,MAAA;AAAA,QACP,OAAA,EAAS,WAAA;AAAA,QACT,OAAA,EAAS,MAAA;AAAA,QACT,UAAA,EAAY,QAAA;AAAA,QACZ,cAAA,EAAgB,QAAA;AAAA,QAChB,QAAA,EAAU;AAAA,OACZ;AAAA,MAEA,QAAA,EAAA;AAAA,wBAAA,GAAA;AAAA,UAAC,GAAA;AAAA,UAAA;AAAA,YACC,IAAA,EAAK,GAAA;AAAA,YACL,EAAA,EAAG,cAAA;AAAA,YACH,OAAA,EAAS,WAAA;AAAA,YACT,KAAA,EAAO,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-VBMD3J7W.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,31 +1,31 @@
1
- import { Footer } from './chunk-QT2D7JMW.js';
2
- import { useCanvasHost } from './chunk-XGOTO6VJ.js';
1
+ import { Footer } from './chunk-K4HCMVAQ.js';
2
+ import { useCanvasHost } from './chunk-X2QKWMWJ.js';
3
3
  import { getModelContext } from './chunk-Q77J3D2W.js';
4
- import { Header } from './chunk-6R4ONYWT.js';
5
- import { editorFrame, previewTheme, postToEditor, FRAME_LOADED_ACTION } from './chunk-ELGZOQEY.js';
6
- import { useDevSettingsOverrides, useDevReportSettingsFetchedAt } from './chunk-QRAYSZPX.js';
7
- import { resolveTwilightSdkUrl, TICKETING_SCRIPT_URL } from './chunk-G7WZ36MV.js';
4
+ import { Header } from './chunk-5JEGXLR3.js';
5
+ import { editorFrame, previewTheme, LIVE_EDITOR_DISABLE_ACTION, postToEditor, FRAME_LOADED_ACTION } from './chunk-K4QQRA6L.js';
6
+ import { useDevSettingsOverrides, useDevReportSettingsFetchedAt } from './chunk-M4MMTQ75.js';
7
+ import { resolveTwilightSdkUrl, TICKETING_SCRIPT_URL } from './chunk-NXBYMNTS.js';
8
8
  import { color } from './chunk-VVZNW5CB.js';
9
9
  import { applyThemeHookSlots, installAppScope } from './chunk-QJOTD2GJ.js';
10
- import { apps } from './chunk-NFD5EJ7W.js';
11
- import { cart, replaceSdkCart } from './chunk-AA3PV6UD.js';
10
+ import { apps } from './chunk-SSMM6ZEQ.js';
11
+ import { cart, replaceSdkCart } from './chunk-JCI3IQJV.js';
12
12
  import { withOwnerMaintenanceButton, withoutMaintenanceOnPreviewHost } from './chunk-O7JTXTGP.js';
13
- import { useLocation, useIsHome, NavigationInterceptor } from './chunk-MAQQHQJX.js';
14
- import { useUser } from './chunk-LWI6MK3W.js';
13
+ import { useLocation, useIsHome, NavigationInterceptor } from './chunk-FU2LJG5L.js';
14
+ import { useUser } from './chunk-OKE2NZDI.js';
15
15
  import { DocumentClassProvider, useDocumentClass } from './chunk-JWXJPJBO.js';
16
- import { WidgetHead } from './chunk-V2ZDTY6H.js';
17
- import { HookSlot } from './chunk-5XDPAKF5.js';
16
+ import { WidgetHead } from './chunk-FWNSNBLY.js';
17
+ import { HookSlot } from './chunk-XZFWBF3P.js';
18
18
  import { hookRegistry } from './chunk-GCPEMNSU.js';
19
- import { getActiveCurrency, ENGINE_VERSION } from './chunk-XQEWBUQ2.js';
19
+ import { getActiveCurrency, ENGINE_VERSION } from './chunk-ID2UT4AE.js';
20
20
  import { useTranslation, I18nProvider } from './chunk-TYNZ5B2B.js';
21
- import { Toaster } from './chunk-AXX7A2JJ.js';
21
+ import { Toaster } from './chunk-2QDPVKV3.js';
22
22
  import { isNativeApp } from './chunk-BZ2QSBXM.js';
23
23
  import { whenSallaLoaded, whenSallaReady, onSallaEvent, getSallaSDK, syncSdkLocale, withSdkThemeVersion } from './chunk-MZPX4EPS.js';
24
24
  import { AUTH_TOKEN_COOKIE_NAME, rememberDevStoreId, clearAuthTokenCookie, currentHost, syncScopeCookie, escapeForInlineScript } from './chunk-4OZIBANF.js';
25
25
  import { getTwilightContext, subscribeTwilight, updateTwilightContext, hasTwilightSettings } from './chunk-MWUAHDQL.js';
26
26
  import { FALLBACK_LOCALE, getLanguageInfo } from './chunk-T72DAX7R.js';
27
- import { useTwilight, TwilightContext } from './chunk-DF6FBKDN.js';
28
- import { lazyComponent } from './chunk-VYGA5AT5.js';
27
+ import { useTwilight, TwilightContext } from './chunk-3VFOVWOE.js';
28
+ import { lazyComponent } from './chunk-TLHZBTPZ.js';
29
29
  import React2, { lazy, Suspense, useEffect, useCallback, useMemo, useRef, useState, useSyncExternalStore, createElement } from 'react';
30
30
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
31
31
  import { useQuery } from '@tanstack/react-query';
@@ -390,16 +390,16 @@ function useWebMcpSupported() {
390
390
  }
391
391
  var navigationSetups = {
392
392
  tanstack: lazyComponent(
393
- () => import('./navigation-WSK4ESIY.js').then((m) => ({ default: m.NavigationSetup }))
393
+ () => import('./navigation-AHHVAUWR.js').then((m) => ({ default: m.NavigationSetup }))
394
394
  ),
395
395
  // Not preloaded with the rest: a TanStack worker would load Next.js code it never runs.
396
- nextjs: lazy(() => import('./navigation-CVWUS27U.js').then((m) => ({ default: m.NavigationSetup })))
396
+ nextjs: lazy(() => import('./navigation-MRUGGEGM.js').then((m) => ({ default: m.NavigationSetup })))
397
397
  };
398
398
 
399
399
  // src/providers/DocumentSyncRegistry.ts
400
400
  var routeDocumentSyncs = {
401
401
  tanstack: lazyComponent(
402
- () => import('./document-class-B6SA3O2R.js').then((m) => ({
402
+ () => import('./document-class-LYNTNC52.js').then((m) => ({
403
403
  default: m.TanStackDocumentSync
404
404
  }))
405
405
  )
@@ -912,7 +912,7 @@ function injectFastCheckoutScript() {
912
912
  document.head.appendChild(s);
913
913
  }
914
914
  var GoogleTagBody = lazyComponent(
915
- () => import('./GoogleTag-UDEQTF5G.js').then((m) => ({ default: m.GoogleTagBody }))
915
+ () => import('./GoogleTag-MCDINMLU.js').then((m) => ({ default: m.GoogleTagBody }))
916
916
  );
917
917
  var TwilightBundles = lazyComponent(
918
918
  () => import('./TwilightBundles-G6GHWBID.js').then((m) => ({ default: m.TwilightBundles }))
@@ -921,7 +921,7 @@ var LazySiftSnippet = lazyComponent(
921
921
  () => import('./SiftSnippet-5FCU6TR6.js').then((m) => ({ default: m.SiftSnippet }))
922
922
  );
923
923
  var LazyStoreClosedNotification = lazyComponent(
924
- () => import('./StoreClosedNotification-QBKQZUYZ.js').then((m) => ({
924
+ () => import('./StoreClosedNotification-RUNFBE3K.js').then((m) => ({
925
925
  default: m.StoreClosedNotification
926
926
  }))
927
927
  );
@@ -1167,7 +1167,7 @@ function SallaSdkScripts({ settings }) {
1167
1167
 
1168
1168
  // src/components/store/lazy.ts
1169
1169
  var LazyStoreClosedNotification2 = lazyComponent(
1170
- () => import('./StoreClosedNotification-QBKQZUYZ.js').then((m) => ({
1170
+ () => import('./StoreClosedNotification-RUNFBE3K.js').then((m) => ({
1171
1171
  default: m.StoreClosedNotification
1172
1172
  }))
1173
1173
  );
@@ -1217,14 +1217,26 @@ function MaintenanceDevBar() {
1217
1217
  ] });
1218
1218
  }
1219
1219
  var LazyLiveEditorBar = lazyComponent(
1220
- () => import('./LiveEditorBar-4C7Z7K3M.js').then((m) => ({ default: m.LiveEditorBar }))
1220
+ () => import('./LiveEditorBar-BSCHU7WO.js').then((m) => ({ default: m.LiveEditorBar }))
1221
1221
  );
1222
1222
  var LazyCanvasOverlay = lazyComponent(
1223
- () => import('./CanvasOverlay-2WJ4QER3.js').then((m) => ({ default: m.CanvasOverlay }))
1223
+ () => import('./CanvasOverlay-L2SE4YNF.js').then((m) => ({ default: m.CanvasOverlay }))
1224
1224
  );
1225
1225
  function LiveEditor() {
1226
1226
  const [frame, setFrame] = useState(null);
1227
+ const [disabled, setDisabled] = useState(false);
1227
1228
  const canvas = useCanvasHost();
1229
+ useEffect(() => {
1230
+ if (!frame || frame.dev) return;
1231
+ const onMessage = (event) => {
1232
+ if (event.origin !== frame.origin || event.source !== window.parent) return;
1233
+ if (event.data?.action === LIVE_EDITOR_DISABLE_ACTION) {
1234
+ setDisabled(true);
1235
+ }
1236
+ };
1237
+ window.addEventListener("message", onMessage);
1238
+ return () => window.removeEventListener("message", onMessage);
1239
+ }, [frame]);
1228
1240
  useEffect(() => {
1229
1241
  const found = editorFrame();
1230
1242
  if (!found) return;
@@ -1242,10 +1254,10 @@ function LiveEditor() {
1242
1254
  if (!canvas.enabled) return null;
1243
1255
  return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyCanvasOverlay, { origin: canvas.origin, blocks: canvas.blocks }) });
1244
1256
  }
1245
- if (!frame) return null;
1257
+ if (!frame || disabled) return null;
1246
1258
  return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyLiveEditorBar, { origin: frame.origin, dev: frame.dev }) });
1247
1259
  }
1248
- var LazyWebMcpTools = React2.lazy(() => import('./WebMcpTools-B255SPSA.js'));
1260
+ var LazyWebMcpTools = React2.lazy(() => import('./WebMcpTools-WSQQXYZF.js'));
1249
1261
  function WebMcpMount() {
1250
1262
  if (!useWebMcpSupported()) return null;
1251
1263
  return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyWebMcpTools, {}) });
@@ -1537,5 +1549,5 @@ function useStore() {
1537
1549
  }
1538
1550
 
1539
1551
  export { LazyMaintenancePage, LazyStoreClosedNotification2 as LazyStoreClosedNotification, MasterLayout, TwilightProvider, fastCheckoutScript, registerDefaultHooks, registerDocumentSync, routeDocumentSyncs, useBreadcrumbs, useDate, useGtm, useMoney, useNumber, useOpeningHours, usePageConfig, useStore };
1540
- //# sourceMappingURL=chunk-L5JO3H2U.js.map
1541
- //# sourceMappingURL=chunk-L5JO3H2U.js.map
1552
+ //# sourceMappingURL=chunk-WHGEXTQR.js.map
1553
+ //# sourceMappingURL=chunk-WHGEXTQR.js.map