@salla.sa/twilight-theme-engine 1.0.188 → 1.0.189

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 (247) hide show
  1. package/dist/{AddToCartForm-3STDRYGB.js → AddToCartForm-BWFPHUHX.js} +3 -3
  2. package/dist/{AddToCartForm-3STDRYGB.js.map → AddToCartForm-BWFPHUHX.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-Q7FTVCGB.js → BlogAuthorPage-VNRW7X2Y.js} +19 -19
  4. package/dist/{BlogAuthorPage-Q7FTVCGB.js.map → BlogAuthorPage-VNRW7X2Y.js.map} +1 -1
  5. package/dist/{BlogCategoryPage-IWZPMWUP.js → BlogCategoryPage-C36ICGKN.js} +19 -19
  6. package/dist/{BlogCategoryPage-IWZPMWUP.js.map → BlogCategoryPage-C36ICGKN.js.map} +1 -1
  7. package/dist/{BlogPage-XZ47JZLY.js → BlogPage-4FADHN2F.js} +17 -17
  8. package/dist/{BlogPage-XZ47JZLY.js.map → BlogPage-4FADHN2F.js.map} +1 -1
  9. package/dist/{BlogSinglePage-HMJDK2RC.js → BlogSinglePage-IME2E4GJ.js} +17 -17
  10. package/dist/{BlogSinglePage-HMJDK2RC.js.map → BlogSinglePage-IME2E4GJ.js.map} +1 -1
  11. package/dist/{BlogTagPage-ZZ23AZOY.js → BlogTagPage-CD5AL2XW.js} +19 -19
  12. package/dist/{BlogTagPage-ZZ23AZOY.js.map → BlogTagPage-CD5AL2XW.js.map} +1 -1
  13. package/dist/{BrandsPage-U7M56AKW.js → BrandsPage-CEST6CGM.js} +18 -18
  14. package/dist/{BrandsPage-U7M56AKW.js.map → BrandsPage-CEST6CGM.js.map} +1 -1
  15. package/dist/{Breadcrumb-XA7NJB3I.js → Breadcrumb-OHEBG52R.js} +17 -17
  16. package/dist/{Breadcrumb-XA7NJB3I.js.map → Breadcrumb-OHEBG52R.js.map} +1 -1
  17. package/dist/{CanvasOverlay-FLWFB5TF.js → CanvasOverlay-76UNNNJB.js} +3 -3
  18. package/dist/{CanvasOverlay-FLWFB5TF.js.map → CanvasOverlay-76UNNNJB.js.map} +1 -1
  19. package/dist/{CartItem-MJZICIQM.js → CartItem-NS3NDDFL.js} +17 -17
  20. package/dist/{CartItem-MJZICIQM.js.map → CartItem-NS3NDDFL.js.map} +1 -1
  21. package/dist/{CartSummary-APN6RTOS.js → CartSummary-V4WNFZ24.js} +17 -17
  22. package/dist/{CartSummary-APN6RTOS.js.map → CartSummary-V4WNFZ24.js.map} +1 -1
  23. package/dist/{Copyright-U6U5KPNW.js → Copyright-53LMJ65T.js} +3 -3
  24. package/dist/{Copyright-U6U5KPNW.js.map → Copyright-53LMJ65T.js.map} +1 -1
  25. package/dist/{CustomerLayout-CH5D5TNX.js → CustomerLayout-P242XSMS.js} +17 -17
  26. package/dist/{CustomerLayout-CH5D5TNX.js.map → CustomerLayout-P242XSMS.js.map} +1 -1
  27. package/dist/{Footer-T3RCIAQT.js → Footer-ZCA4FBVY.js} +3 -3
  28. package/dist/{Footer-T3RCIAQT.js.map → Footer-ZCA4FBVY.js.map} +1 -1
  29. package/dist/GoogleTag-7GT3QOSS.js +15 -0
  30. package/dist/{GoogleTag-VD4JMT3L.js.map → GoogleTag-7GT3QOSS.js.map} +1 -1
  31. package/dist/{Header-7L6OXYSP.js → Header-76K42Z67.js} +8 -8
  32. package/dist/{Header-7L6OXYSP.js.map → Header-76K42Z67.js.map} +1 -1
  33. package/dist/{LatestProducts-XE7IRB5G.js → LatestProducts-O2JEC2KM.js} +19 -19
  34. package/dist/{LatestProducts-XE7IRB5G.js.map → LatestProducts-O2JEC2KM.js.map} +1 -1
  35. package/dist/{LoyaltyPage-P7CY3NDD.js → LoyaltyPage-ZRNDDTLO.js} +17 -17
  36. package/dist/{LoyaltyPage-P7CY3NDD.js.map → LoyaltyPage-ZRNDDTLO.js.map} +1 -1
  37. package/dist/{LoyaltyPointsPage-ONKOWZG3.js → LoyaltyPointsPage-7KZPWPSL.js} +6 -6
  38. package/dist/{LoyaltyPointsPage-ONKOWZG3.js.map → LoyaltyPointsPage-7KZPWPSL.js.map} +1 -1
  39. package/dist/{MainMenu-TDEMIAVE.js → MainMenu-TLPXXM7G.js} +5 -5
  40. package/dist/{MainMenu-TDEMIAVE.js.map → MainMenu-TLPXXM7G.js.map} +1 -1
  41. package/dist/{MasterLayout-HTDOBN3V.js → MasterLayout-5EKKDTNV.js} +17 -17
  42. package/dist/{MasterLayout-HTDOBN3V.js.map → MasterLayout-5EKKDTNV.js.map} +1 -1
  43. package/dist/{MobileMenu-E2Q4NACS.js → MobileMenu-B4YH7I5I.js} +18 -18
  44. package/dist/{MobileMenu-E2Q4NACS.js.map → MobileMenu-B4YH7I5I.js.map} +1 -1
  45. package/dist/{NotificationsPage-7PCULMIT.js → NotificationsPage-7MOC7QJV.js} +17 -17
  46. package/dist/{NotificationsPage-7PCULMIT.js.map → NotificationsPage-7MOC7QJV.js.map} +1 -1
  47. package/dist/{OrderSinglePage-Z26AYA2A.js → OrderSinglePage-4IEFMNCB.js} +18 -18
  48. package/dist/{OrderSinglePage-Z26AYA2A.js.map → OrderSinglePage-4IEFMNCB.js.map} +1 -1
  49. package/dist/{OrdersPage-KVFEL4GF.js → OrdersPage-MXSRURTW.js} +17 -17
  50. package/dist/{OrdersPage-KVFEL4GF.js.map → OrdersPage-MXSRURTW.js.map} +1 -1
  51. package/dist/{PageSingle-4BOTNKBG.js → PageSingle-ZABEKG66.js} +3 -3
  52. package/dist/{PageSingle-4BOTNKBG.js.map → PageSingle-ZABEKG66.js.map} +1 -1
  53. package/dist/{ProductDetails-U3JJQ3QA.js → ProductDetails-LBBONHCT.js} +5 -5
  54. package/dist/{ProductDetails-U3JJQ3QA.js.map → ProductDetails-LBBONHCT.js.map} +1 -1
  55. package/dist/{ProfilePage-PVV5HUN7.js → ProfilePage-ZAVX7QGJ.js} +17 -17
  56. package/dist/{ProfilePage-PVV5HUN7.js.map → ProfilePage-ZAVX7QGJ.js.map} +1 -1
  57. package/dist/{ReviewsPage-P7C2DYNY.js → ReviewsPage-JSJLJ64A.js} +3 -3
  58. package/dist/{ReviewsPage-P7C2DYNY.js.map → ReviewsPage-JSJLJ64A.js.map} +1 -1
  59. package/dist/{SeoCartWidget-CH6ZDLJF.js → SeoCartWidget-6IIHJ3W4.js} +17 -17
  60. package/dist/{SeoCartWidget-CH6ZDLJF.js.map → SeoCartWidget-6IIHJ3W4.js.map} +1 -1
  61. package/dist/{SettingsPage-J3CFXCXM.js → SettingsPage-SFYQLYIE.js} +17 -17
  62. package/dist/{SettingsPage-J3CFXCXM.js.map → SettingsPage-SFYQLYIE.js.map} +1 -1
  63. package/dist/{StoreClosedNotification-JD52A2L7.js → StoreClosedNotification-GFSUE6V2.js} +18 -18
  64. package/dist/{StoreClosedNotification-JD52A2L7.js.map → StoreClosedNotification-GFSUE6V2.js.map} +1 -1
  65. package/dist/{TestimonialsPage-YVNTJCVN.js → TestimonialsPage-RXPSVE5R.js} +3 -3
  66. package/dist/{TestimonialsPage-YVNTJCVN.js.map → TestimonialsPage-RXPSVE5R.js.map} +1 -1
  67. package/dist/{ThankYouPage-L3VVD4L4.js → ThankYouPage-WBXUOEFT.js} +17 -17
  68. package/dist/{ThankYouPage-L3VVD4L4.js.map → ThankYouPage-WBXUOEFT.js.map} +1 -1
  69. package/dist/{WalletPage-VQRX53I7.js → WalletPage-75H3YA2Y.js} +18 -18
  70. package/dist/{WalletPage-VQRX53I7.js.map → WalletPage-75H3YA2Y.js.map} +1 -1
  71. package/dist/{WebMcpTools-5ZOYZK6M.js → WebMcpTools-4H7PUDZH.js} +5 -5
  72. package/dist/{WebMcpTools-5ZOYZK6M.js.map → WebMcpTools-4H7PUDZH.js.map} +1 -1
  73. package/dist/{WishlistPage-INPQNNN6.js → WishlistPage-6GNC53MS.js} +19 -19
  74. package/dist/{WishlistPage-INPQNNN6.js.map → WishlistPage-6GNC53MS.js.map} +1 -1
  75. package/dist/api/advertisement.js +2 -2
  76. package/dist/api/apps.js +2 -2
  77. package/dist/api/blog.js +3 -3
  78. package/dist/api/brands.js +3 -3
  79. package/dist/api/cart.js +3 -3
  80. package/dist/api/category.js +3 -3
  81. package/dist/api/client.js +1 -1
  82. package/dist/api/custom-url.js +2 -2
  83. package/dist/api/home.js +2 -2
  84. package/dist/api/loyalty.js +3 -3
  85. package/dist/api/menu.js +2 -2
  86. package/dist/api/notification.js +2 -2
  87. package/dist/api/order.js +3 -3
  88. package/dist/api/page.js +3 -3
  89. package/dist/api/product.js +3 -3
  90. package/dist/api/profile.js +1 -1
  91. package/dist/api/store.js +2 -2
  92. package/dist/api/translations.js +2 -2
  93. package/dist/api/user.js +2 -2
  94. package/dist/api/wallet.js +2 -2
  95. package/dist/api/wishlist.js +4 -4
  96. package/dist/{chunk-X2SIGWUY.js → chunk-4CLP7VQN.js} +3 -3
  97. package/dist/{chunk-X2SIGWUY.js.map → chunk-4CLP7VQN.js.map} +1 -1
  98. package/dist/{chunk-BWL3QXOS.js → chunk-5A5FYUZQ.js} +4 -4
  99. package/dist/{chunk-BWL3QXOS.js.map → chunk-5A5FYUZQ.js.map} +1 -1
  100. package/dist/{chunk-VBZIFYQ7.js → chunk-5QLEAUQ6.js} +3 -3
  101. package/dist/{chunk-VBZIFYQ7.js.map → chunk-5QLEAUQ6.js.map} +1 -1
  102. package/dist/{chunk-4CEURRWI.js → chunk-5RTPNCH3.js} +4 -4
  103. package/dist/{chunk-4CEURRWI.js.map → chunk-5RTPNCH3.js.map} +1 -1
  104. package/dist/{chunk-7BSJCVUD.js → chunk-6G5EAXGA.js} +5 -5
  105. package/dist/{chunk-7BSJCVUD.js.map → chunk-6G5EAXGA.js.map} +1 -1
  106. package/dist/{chunk-PJJQV3GW.js → chunk-7AROYBE2.js} +6 -6
  107. package/dist/{chunk-PJJQV3GW.js.map → chunk-7AROYBE2.js.map} +1 -1
  108. package/dist/{chunk-YJROW2HU.js → chunk-7FUP3FET.js} +4 -4
  109. package/dist/{chunk-YJROW2HU.js.map → chunk-7FUP3FET.js.map} +1 -1
  110. package/dist/{chunk-KF7UMG3F.js → chunk-ACQUG3H4.js} +3 -3
  111. package/dist/{chunk-KF7UMG3F.js.map → chunk-ACQUG3H4.js.map} +1 -1
  112. package/dist/{chunk-E2HCPUBR.js → chunk-BYP5CQ57.js} +3 -3
  113. package/dist/{chunk-E2HCPUBR.js.map → chunk-BYP5CQ57.js.map} +1 -1
  114. package/dist/{chunk-UKLMGZZ2.js → chunk-DFPTSQ7E.js} +3 -3
  115. package/dist/{chunk-UKLMGZZ2.js.map → chunk-DFPTSQ7E.js.map} +1 -1
  116. package/dist/{chunk-6SD5P2T5.js → chunk-ELV6T6VA.js} +5 -5
  117. package/dist/{chunk-6SD5P2T5.js.map → chunk-ELV6T6VA.js.map} +1 -1
  118. package/dist/{chunk-T4PRV2MJ.js → chunk-EY5WH7BT.js} +3 -3
  119. package/dist/{chunk-T4PRV2MJ.js.map → chunk-EY5WH7BT.js.map} +1 -1
  120. package/dist/{chunk-2TRSXLGJ.js → chunk-G3YKFVXS.js} +5 -5
  121. package/dist/{chunk-2TRSXLGJ.js.map → chunk-G3YKFVXS.js.map} +1 -1
  122. package/dist/{chunk-NEMLRRIS.js → chunk-G4CSD4PD.js} +3 -3
  123. package/dist/{chunk-NEMLRRIS.js.map → chunk-G4CSD4PD.js.map} +1 -1
  124. package/dist/{chunk-7J52H4P2.js → chunk-G4ZPIYXS.js} +7 -7
  125. package/dist/{chunk-7J52H4P2.js.map → chunk-G4ZPIYXS.js.map} +1 -1
  126. package/dist/{chunk-JPMQPU72.js → chunk-GHBUMBGM.js} +3 -3
  127. package/dist/{chunk-JPMQPU72.js.map → chunk-GHBUMBGM.js.map} +1 -1
  128. package/dist/{chunk-2KDWKQTC.js → chunk-GKVDCDJZ.js} +3 -3
  129. package/dist/{chunk-2KDWKQTC.js.map → chunk-GKVDCDJZ.js.map} +1 -1
  130. package/dist/{chunk-NWMTGBCN.js → chunk-I7S6WWHW.js} +3 -3
  131. package/dist/{chunk-NWMTGBCN.js.map → chunk-I7S6WWHW.js.map} +1 -1
  132. package/dist/{chunk-36DUIP2H.js → chunk-IMXX46KD.js} +4 -4
  133. package/dist/{chunk-36DUIP2H.js.map → chunk-IMXX46KD.js.map} +1 -1
  134. package/dist/{chunk-SR4YSJAF.js → chunk-JRM7WGZ7.js} +3 -3
  135. package/dist/{chunk-SR4YSJAF.js.map → chunk-JRM7WGZ7.js.map} +1 -1
  136. package/dist/{chunk-C42YDY5K.js → chunk-K7F7ATZO.js} +2 -2
  137. package/dist/{chunk-C42YDY5K.js.map → chunk-K7F7ATZO.js.map} +1 -1
  138. package/dist/{chunk-NWT2ZWNM.js → chunk-KAB5TEFM.js} +3 -3
  139. package/dist/{chunk-NWT2ZWNM.js.map → chunk-KAB5TEFM.js.map} +1 -1
  140. package/dist/{chunk-JPZTLP7F.js → chunk-L7B7TS4R.js} +3 -3
  141. package/dist/{chunk-JPZTLP7F.js.map → chunk-L7B7TS4R.js.map} +1 -1
  142. package/dist/{chunk-Z4D5KQK5.js → chunk-M6ASPT2Y.js} +3 -3
  143. package/dist/{chunk-Z4D5KQK5.js.map → chunk-M6ASPT2Y.js.map} +1 -1
  144. package/dist/{chunk-V2OR5VQ2.js → chunk-MI4DFSQ3.js} +3 -3
  145. package/dist/{chunk-V2OR5VQ2.js.map → chunk-MI4DFSQ3.js.map} +1 -1
  146. package/dist/{chunk-YMNCGXFV.js → chunk-MY2DW3E6.js} +3 -3
  147. package/dist/{chunk-YMNCGXFV.js.map → chunk-MY2DW3E6.js.map} +1 -1
  148. package/dist/{chunk-VPGGPNSL.js → chunk-N5EFDFMY.js} +3 -3
  149. package/dist/{chunk-VPGGPNSL.js.map → chunk-N5EFDFMY.js.map} +1 -1
  150. package/dist/{chunk-MBXI7567.js → chunk-NIJLJAKS.js} +3 -3
  151. package/dist/{chunk-MBXI7567.js.map → chunk-NIJLJAKS.js.map} +1 -1
  152. package/dist/{chunk-PLDWDVOP.js → chunk-O3ZL24KN.js} +3 -3
  153. package/dist/{chunk-PLDWDVOP.js.map → chunk-O3ZL24KN.js.map} +1 -1
  154. package/dist/{chunk-V5AMXA5A.js → chunk-O4LQHEW2.js} +4 -4
  155. package/dist/{chunk-V5AMXA5A.js.map → chunk-O4LQHEW2.js.map} +1 -1
  156. package/dist/{chunk-GSS3JLFP.js → chunk-OHK7OO4L.js} +4 -4
  157. package/dist/{chunk-GSS3JLFP.js.map → chunk-OHK7OO4L.js.map} +1 -1
  158. package/dist/{chunk-QDE37XJB.js → chunk-P75KDTGI.js} +4 -4
  159. package/dist/{chunk-QDE37XJB.js.map → chunk-P75KDTGI.js.map} +1 -1
  160. package/dist/{chunk-3UZXUVVO.js → chunk-QCGHFFS6.js} +4 -4
  161. package/dist/{chunk-3UZXUVVO.js.map → chunk-QCGHFFS6.js.map} +1 -1
  162. package/dist/{chunk-BGB557LQ.js → chunk-QGQJI25U.js} +14 -14
  163. package/dist/{chunk-BGB557LQ.js.map → chunk-QGQJI25U.js.map} +1 -1
  164. package/dist/{chunk-2H74264G.js → chunk-QMKPBCLM.js} +5 -5
  165. package/dist/{chunk-2H74264G.js.map → chunk-QMKPBCLM.js.map} +1 -1
  166. package/dist/{chunk-GEB5BQHO.js → chunk-QZU3SW5N.js} +4 -4
  167. package/dist/{chunk-GEB5BQHO.js.map → chunk-QZU3SW5N.js.map} +1 -1
  168. package/dist/{chunk-I6EEFDD2.js → chunk-RZNFP6GR.js} +19 -19
  169. package/dist/{chunk-I6EEFDD2.js.map → chunk-RZNFP6GR.js.map} +1 -1
  170. package/dist/{chunk-BHPDI7AZ.js → chunk-T3ZC6QJT.js} +4 -4
  171. package/dist/{chunk-BHPDI7AZ.js.map → chunk-T3ZC6QJT.js.map} +1 -1
  172. package/dist/{chunk-A563ZHY5.js → chunk-UO4TOXPT.js} +3 -3
  173. package/dist/{chunk-A563ZHY5.js.map → chunk-UO4TOXPT.js.map} +1 -1
  174. package/dist/{chunk-5PEBHTHI.js → chunk-UQK6WVCM.js} +7 -7
  175. package/dist/{chunk-5PEBHTHI.js.map → chunk-UQK6WVCM.js.map} +1 -1
  176. package/dist/{chunk-M5TB3ZJ4.js → chunk-V4CHJEOW.js} +4 -4
  177. package/dist/{chunk-M5TB3ZJ4.js.map → chunk-V4CHJEOW.js.map} +1 -1
  178. package/dist/{chunk-SNTUACTC.js → chunk-VU6H32IM.js} +4 -4
  179. package/dist/{chunk-SNTUACTC.js.map → chunk-VU6H32IM.js.map} +1 -1
  180. package/dist/{chunk-VGJMO6QS.js → chunk-WGUKNVWJ.js} +4 -4
  181. package/dist/{chunk-VGJMO6QS.js.map → chunk-WGUKNVWJ.js.map} +1 -1
  182. package/dist/{chunk-RBGCTWGJ.js → chunk-XN47C7SG.js} +4 -4
  183. package/dist/{chunk-RBGCTWGJ.js.map → chunk-XN47C7SG.js.map} +1 -1
  184. package/dist/{chunk-CNN757MD.js → chunk-XQFFFNJ4.js} +4 -4
  185. package/dist/{chunk-CNN757MD.js.map → chunk-XQFFFNJ4.js.map} +1 -1
  186. package/dist/{chunk-4DEJOPG6.js → chunk-XX26RQCL.js} +3 -3
  187. package/dist/{chunk-4DEJOPG6.js.map → chunk-XX26RQCL.js.map} +1 -1
  188. package/dist/{chunk-54DG7FCT.js → chunk-XXWYFOZ7.js} +7 -7
  189. package/dist/{chunk-54DG7FCT.js.map → chunk-XXWYFOZ7.js.map} +1 -1
  190. package/dist/{chunk-X3GAERFK.js → chunk-YC5OTW4F.js} +3 -3
  191. package/dist/{chunk-X3GAERFK.js.map → chunk-YC5OTW4F.js.map} +1 -1
  192. package/dist/{chunk-PLJ4L2KC.js → chunk-YZOYXYGO.js} +4 -4
  193. package/dist/{chunk-PLJ4L2KC.js.map → chunk-YZOYXYGO.js.map} +1 -1
  194. package/dist/{chunk-SFXQMG3D.js → chunk-Z4VXLTDZ.js} +4 -4
  195. package/dist/{chunk-SFXQMG3D.js.map → chunk-Z4VXLTDZ.js.map} +1 -1
  196. package/dist/components/cart/index.js +1 -1
  197. package/dist/components/common/index.js +1 -1
  198. package/dist/components/drawer/index.js +15 -15
  199. package/dist/components/home/index.js +20 -20
  200. package/dist/components/layout/index.js +4 -4
  201. package/dist/components/product/index.js +17 -17
  202. package/dist/components/store/index.js +16 -16
  203. package/dist/components/tracking/index.js +6 -6
  204. package/dist/{custom-urls-2P3OJVMY.js → custom-urls-KEFBDGXJ.js} +7 -7
  205. package/dist/{custom-urls-2P3OJVMY.js.map → custom-urls-KEFBDGXJ.js.map} +1 -1
  206. package/dist/dev/editor/index.js +1 -1
  207. package/dist/dev/index.js +1 -1
  208. package/dist/{document-class-ERIBJEGK.js → document-class-K6N7E4YJ.js} +17 -17
  209. package/dist/{document-class-ERIBJEGK.js.map → document-class-K6N7E4YJ.js.map} +1 -1
  210. package/dist/hooks/index.js +15 -15
  211. package/dist/hooks/useGtm.js +15 -15
  212. package/dist/hooks/useMoney.js +15 -15
  213. package/dist/hooks/useStore.js +15 -15
  214. package/dist/hooks/useUser.js +3 -3
  215. package/dist/index.js +15 -15
  216. package/dist/{navigation-O6I4V3JY.js → navigation-HB6EQOHP.js} +4 -4
  217. package/dist/{navigation-O6I4V3JY.js.map → navigation-HB6EQOHP.js.map} +1 -1
  218. package/dist/{navigation-HP5LIBNV.js → navigation-V63GDB47.js} +5 -5
  219. package/dist/{navigation-HP5LIBNV.js.map → navigation-V63GDB47.js.map} +1 -1
  220. package/dist/{not-found-EVMN6AEW.js → not-found-6SFVCMIP.js} +18 -18
  221. package/dist/{not-found-EVMN6AEW.js.map → not-found-6SFVCMIP.js.map} +1 -1
  222. package/dist/providers/index.js +15 -15
  223. package/dist/routes/account/orders.js +4 -4
  224. package/dist/routes/account.js +13 -13
  225. package/dist/routes/blog.js +8 -8
  226. package/dist/routes/brands.js +4 -4
  227. package/dist/routes/cart.js +25 -25
  228. package/dist/routes/home.js +21 -21
  229. package/dist/routes/index.js +8 -8
  230. package/dist/routes/loyalty.js +5 -5
  231. package/dist/routes/page.js +4 -4
  232. package/dist/routes/product-listing.js +25 -25
  233. package/dist/routes/product.js +24 -24
  234. package/dist/routes/seo-redirects.js +8 -8
  235. package/dist/routes/testimonials.js +2 -2
  236. package/dist/routes/thank-you.js +4 -4
  237. package/dist/server/entry.js +10 -1
  238. package/dist/server/entry.js.map +1 -1
  239. package/dist/server/stream-handler.d.ts +13 -0
  240. package/dist/server/stream-handler.d.ts.map +1 -1
  241. package/dist/skeleton.js +23 -23
  242. package/dist/{store-lookup-RAKQFOTD.js → store-lookup-6UAAG4BA.js} +8 -8
  243. package/dist/{store-lookup-RAKQFOTD.js.map → store-lookup-6UAAG4BA.js.map} +1 -1
  244. package/dist/tanstack.js +17 -17
  245. package/dist/utils/index.js +2 -2
  246. package/package.json +1 -1
  247. package/dist/GoogleTag-VD4JMT3L.js +0 -15
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/api-base.ts","../src/utils/engine-version.ts","../src/api/dev-settings-cache.ts","../src/api/client.ts"],"names":["entry","createIsomorphicFn","getCookie"],"mappings":";;;;;;;;;AAWO,IAAM,eAAA,GAAkB;AAG/B,IAAM,aAAA,GAAgB,SAAA;AAQf,SAAS,qBAAA,CACd,QACA,WAAA,EACe;AACf,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,WAAA,EAAa,OAAO,IAAA;AACpC,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,IAAA,EAAM,CAAA;AAAA,EAC7B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,IAAI,GAAA,CAAI,QAAA,KAAa,QAAA,EAAU,OAAO,IAAA;AACtC,EAAA,IAAI,IAAI,IAAA,CAAK,WAAA,OAAkB,WAAA,CAAY,WAAA,IAAe,OAAO,IAAA;AACjE,EAAA,IAAI,GAAA,CAAI,YAAY,GAAA,CAAI,QAAA,IAAY,IAAI,MAAA,IAAU,GAAA,CAAI,MAAM,OAAO,IAAA;AACnE,EAAA,IA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AO;AAAA,EAC3B,MAAA,EAAQ,2BAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAC;AAUM,IAAM,QAAA,GAAW,GAAG,MAAA,CAAO;AAAA,EAChC,MAAA,EAAQ,iCAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAC","file":"chunk-NWMTGBCN.js","sourcesContent":["/**\n * The header the storefront dispatcher names the Store API base in, on the\n * storefronts that must not call production: the beta storefront and its per-PR\n * previews (`web.beta.salla.group`, `web-<hash>.beta.salla.group`). There the\n * Store serves the storefront API under its own address, `https://<host>/api/v1`.\n *\n * Trusted for the same reason `x-salla-store-base` is: the dispatcher sets it\n * after dropping everything off its allowlist, so a visitor's copy never arrives.\n * It is still checked against the request's own host, so even a forged one could\n * only point the theme back at the storefront it is already serving.\n */\nexport const API_BASE_HEADER = 'x-salla-api-base';\n\n/** The one path the dispatcher names: the Store's storefront API under its own host. */\nconst API_BASE_PATH = '/api/v1';\n\n/**\n * The API base this request was told to use, or null for the build's default.\n *\n * Accepted only as `https://<the request's own host>/api/v1` (a trailing slash\n * allowed), with no credentials, query or fragment; returned without the slash.\n */\nexport function resolveRequestApiBase(\n header: string | null | undefined,\n requestHost: string | null\n): string | null {\n if (!header || !requestHost) return null;\n let url: URL;\n try {\n url = new URL(header.trim());\n } catch {\n return null;\n }\n if (url.protocol !== 'https:') return null;\n if (url.host.toLowerCase() !== requestHost.toLowerCase()) return null;\n if (url.username || url.password || url.search || url.hash) return null;\n if (url.pathname.replace(/\\/+$/, '') !== API_BASE_PATH) return null;\n return `${url.origin}${API_BASE_PATH}`;\n}\n\n/**\n * `url` moved from one API base to another: `https://api.salla.dev/store/v1/cart/1`\n * under `https://web.beta.salla.group/api/v1` is `https://web.beta.salla.group/api/v1/cart/1`.\n * Null when `url` is not under `from`, which leaves the request as it was.\n */\nexport function rebaseApiUrl(url: string, from: string, to: string): string | null {\n const base = from.replace(/\\/+$/, '');\n if (url !== base && !url.startsWith(`${base}/`) && !url.startsWith(`${base}?`)) return null;\n return to.replace(/\\/+$/, '') + url.slice(base.length);\n}\n","/**\n * The engine's own build version, injected by tsup `define` when dist is\n * built. Falls back to 'dev' when the source runs unbundled (vitest, direct\n * src imports in the monorepo).\n *\n * Exposed at runtime as `salla.versions.engine` by `useTwilightInit` so a\n * storefront can always be asked which engine build rendered it.\n */\nexport const ENGINE_VERSION: string =\n typeof __TWILIGHT_ENGINE_VERSION__ !== 'undefined' ? __TWILIGHT_ENGINE_VERSION__ : 'dev';\n","import type { AfterResponseHook, BeforeRequestHook } from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { DEV_SETTINGS_REFRESH_COOKIE } from '../utils/dev-settings-refresh';\n\n/**\n * A dev server reuses a store's settings for up to an hour.\n *\n * Every server render asks the API for `store/settings`, and a developer clicking\n * around a theme renders dozens of pages a minute. The API answers a burst of\n * settings requests for one store from one address with a challenge, which a\n * server-side fetch cannot pass, so the dev server rendered \"Store Unavailable\"\n * (6.05k challenged `(development; ssr)` calls in the 7 days to 2026-10-25). In\n * development, on the server, the same request within {@link DEV_SETTINGS_TTL_MS}\n * is answered from memory instead. An hour because the API counts settings\n * requests per hour, so one fetch an hour can never reach its limit; the theme\n * editor's \"Fetch fresh store data\" fetches sooner, and says how old the settings\n * are. A production build never runs it: `import.meta.env.DEV` is statically\n * false there.\n */\nexport const DEV_SETTINGS_TTL_MS = 60 * 60_000;\n\n/** Marks an answer from memory, so the store step does not file it again. */\nconst HIT_HEADER = 'x-twilight-dev-cache';\n\n/** When the answer was really fetched from the API (epoch ms), on fresh answers and reused ones alike. */\nconst FETCHED_AT_HEADER = 'x-twilight-dev-fetched-at';\n\n/**\n * When the dev server fetched these settings from the API, read off the answer the\n * cache handed back; `undefined` when the cache did not handle the call (a\n * production build, the browser, a test), so nothing new reaches the settings there.\n */\nexport function devSettingsFetchedAt(headers: Headers | undefined): number | undefined {\n const at = Number(headers?.get(FETCHED_AT_HEADER));\n return Number.isFinite(at) && at > 0 ? at : undefined;\n}\n\n/**\n * Not carried over to an answer from memory: the body is stored decoded, so its\n * original encoding and length no longer describe it.\n */\nconst DROPPED_HEADERS = new Set(['content-encoding', 'content-length']);\n\ninterface Entry {\n body: string;\n status: number;\n statusText: string;\n headers: [string, string][];\n fetchedAt: number;\n /** The refresh cookie's value when this answer was fetched. */\n refresh: string | null;\n}\n\nexport interface DevSettingsCacheOptions {\n /** Whether this call may use the cache at all. */\n enabled: () => boolean;\n /** The current value of {@link DEV_SETTINGS_REFRESH_COOKIE}, or null. */\n refreshToken: () => string | null;\n now?: () => number;\n ttlMs?: number;\n /** Called the first time an answer comes from memory. */\n onFirstHit?: () => void;\n}\n\nfunction isSettingsRequest(request: Request): boolean {\n if (request.method !== 'GET') return false;\n try {\n return new URL(request.url).pathname.endsWith('/store/settings');\n } catch {\n return false;\n }\n}\n\n/**\n * An answer `requestSettings` accepts: JSON carrying `data`. A 200 without it is\n * refused there as \"Store Unavailable\"; kept here, it would be refused for the next\n * hour too, after the API had recovered.\n */\nfunction hasSettings(body: string): boolean {\n try {\n return Boolean((JSON.parse(body) as { data?: unknown } | null)?.data);\n } catch {\n return false;\n }\n}\n\n/**\n * The request as the API receives it: method, URL and every header the client's\n * hooks set. Keyed on the request itself rather than on the inputs that build it,\n * so a header added to the client later cannot be missing from the key.\n */\nfunction keyOf(request: Request): string {\n const headers = [...request.headers].map(([name, value]) => `${name}: ${value}`).join('\\n');\n return `${request.method} ${request.url}\\n${headers}`;\n}\n\n/**\n * The two ky hooks behind the cache: `lookup` runs last among `beforeRequest`, once\n * every header is set, and `store` among `afterResponse`. Only an answer with\n * settings in it is kept, so a timeout, a 429, a challenge or an empty 200 is asked\n * again on the next render.\n */\nexport function createDevSettingsCache(options: DevSettingsCacheOptions) {\n const {\n enabled,\n refreshToken,\n now = Date.now,\n ttlMs = DEV_SETTINGS_TTL_MS,\n onFirstHit,\n } = options;\n const entries = new Map<string, Entry>();\n let announced = false;\n\n const isFresh = (entry: Entry): boolean =>\n now() - entry.fetchedAt < ttlMs && entry.refresh === refreshToken();\n\n const answerOf = (entry: Entry, hit: boolean): Response => {\n const headers = new Headers(entry.headers);\n headers.set(FETCHED_AT_HEADER, String(entry.fetchedAt));\n if (hit) headers.set(HIT_HEADER, 'hit');\n return new Response(entry.body, {\n status: entry.status,\n statusText: entry.statusText,\n headers,\n });\n };\n\n const lookup: BeforeRequestHook = ({ request }) => {\n if (!enabled() || !isSettingsRequest(request)) return;\n const key = keyOf(request);\n const entry = entries.get(key);\n if (!entry) return;\n if (!isFresh(entry)) {\n entries.delete(key);\n return;\n }\n if (!announced) {\n announced = true;\n onFirstHit?.();\n }\n return answerOf(entry, true);\n };\n\n const store: AfterResponseHook = async ({ request, response }) => {\n if (!enabled() || !isSettingsRequest(request) || !response.ok) return;\n if (response.headers.has(HIT_HEADER)) return;\n // ky hands each hook a clone, so reading it leaves the answer it returns intact.\n const body = await response.text();\n if (!hasSettings(body)) return;\n for (const [key, entry] of entries) {\n if (now() - entry.fetchedAt >= ttlMs) entries.delete(key);\n }\n const entry: Entry = {\n body,\n status: response.status,\n statusText: response.statusText,\n headers: [...response.headers].filter(([name]) => !DROPPED_HEADERS.has(name)),\n fetchedAt: now(),\n refresh: refreshToken(),\n };\n entries.set(keyOf(request), entry);\n // Handed on in place of the API's own answer, so it carries its fetch time too.\n return answerOf(entry, false);\n };\n\n return { lookup, store, clear: () => entries.clear() };\n}\n\nconst readRefreshCookie = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(DEV_SETTINGS_REFRESH_COOKIE) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\nexport const devSettingsCache = createDevSettingsCache({\n // A dev server's render only. A production build has `DEV` statically false,\n // the browser keeps the settings it was handed in its query cache, and vitest\n // runs in `test` mode, where every test wants the request it mocked.\n enabled: () =>\n import.meta.env.DEV && import.meta.env.MODE !== 'test' && typeof document === 'undefined',\n refreshToken: readRefreshCookie,\n onFirstHit: () =>\n console.warn(\n `[twilight] Store settings are reused for up to ${DEV_SETTINGS_TTL_MS / 60_000} minutes while you develop, to stay under the Salla API's rate limit. To see a change you made in the dashboard, press \"Fetch fresh store data\" in the theme editor's side panel: it also says when they were last fetched.`\n ),\n});\n","import ky from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { getStoreIdentifier } from '../utils/sdk-helpers';\nimport { requestedDraftThemeName, resolveThemeVersionId } from '../utils/theme-version';\nimport { getInjectedRuntimeEnv, readEnv } from '../utils/runtime-env';\nimport { getRequestStore, getTwilightContext, isAuthTokenRevoked } from '../twilight/context';\nimport { rebaseApiUrl } from '../utils/api-base';\nimport { ENGINE_VERSION } from '../utils/engine-version';\nimport { devSettingsCache } from './dev-settings-cache';\nimport {\n AUTH_TOKEN_COOKIE_NAME,\n CURRENCY_COOKIE_NAME,\n extractCurrencyFromCookies,\n extractScopeFromCookies,\n toCurrencyCode,\n extractTokenFromCookies,\n readSdkScope,\n type ActiveScope,\n} from '../utils/cookies';\n\n// The twilight module store doesn't reliably carry authToken into every scope: on the\n// SERVER workerd has no AsyncLocalStorage, and on BOTH sides this api client can live in a\n// different module instance than the one rootBeforeLoad populates (engine subpath import vs\n// engine-internal relative import). So `getTwilightContext().authToken` is often null even\n// for logged-in users → API calls (orders/customer/…) return `token_not_provided` (400).\n// Read the token directly from the request cookie (server) or document.cookie / salla.storage\n// (client) as a fallback. The server-only import is stripped from the client bundle by\n// createIsomorphicFn.\nconst readFallbackToken = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(AUTH_TOKEN_COOKIE_NAME) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => {\n const fromCookie =\n typeof document !== 'undefined'\n ? extractTokenFromCookies(document.cookie, AUTH_TOKEN_COOKIE_NAME)\n : null;\n if (fromCookie) return fromCookie;\n const storage = typeof window !== 'undefined' ? window.salla?.storage : undefined;\n const fromStorage =\n typeof storage?.get === 'function' ? storage.get(AUTH_TOKEN_COOKIE_NAME) : null;\n if (typeof fromStorage === 'string' && fromStorage) return fromStorage;\n // `?token=` webview injection lands only on the SDK's axios instance\n const fromSdkApi = typeof window !== 'undefined' ? window.salla?.api?.token : undefined;\n return typeof fromSdkApi === 'string' && fromSdkApi ? fromSdkApi : null;\n });\n\n/**\n * The auth token as the api client sees it: twilight context first, cookie/storage fallback.\n * Use this (not `getTwilightContext().authToken`, which is often null for logged-in users —\n * see the note above) to decide whether an authenticated-only query should run.\n */\nexport const getAuthToken = (): string | null =>\n isAuthTokenRevoked() ? null : (getTwilightContext().authToken ?? readFallbackToken());\n\nconst readRequestCurrency = createIsomorphicFn()\n .server((): string | null => {\n try {\n return toCurrencyCode(getCookie(CURRENCY_COOKIE_NAME));\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\n/**\n * The currency the visitor chose, from the `s-curr` cookie the SDK writes: the API\n * answers in the store's own currency unless the request names one.\n */\nexport function getActiveCurrency(): string | null;\nexport function getActiveCurrency(fallback: string): string;\nexport function getActiveCurrency(fallback: string | null = null): string | null {\n const chosen =\n typeof document !== 'undefined'\n ? extractCurrencyFromCookies(document.cookie)\n : readRequestCurrency();\n return chosen ?? fallback;\n}\n\nconst API_HEADERS = {\n ACCEPT: 'accept',\n ACCEPT_LANGUAGE: 'accept-language',\n APP_OS: 's-app-os',\n APP_VERSION: 's-app-version',\n RAY: 's-ray',\n SOURCE: 's-source',\n THEME_TYPE: 's-theme-type',\n REQUESTED_WITH: 'x-requested-with',\n CF_PROXY_WHITELIST: 's-cf-proxy-whitelist-id',\n STORE_IDENTIFIER: 'store-identifier',\n CURRENCY: 'currency',\n AUTHORIZATION: 'Authorization',\n VERSION_ID: 's-version-id',\n THEME_NAME: 's-theme-name',\n SCOPE_ID: 's-scope-id',\n SCOPE_TYPE: 's-scope-type',\n SCOPE_ALLOCATION_TYPE: 's-scope-allocation-type',\n SCOPE_ALLOCATION_ID: 's-scope-allocation-id',\n USER_AGENT: 'user-agent',\n} as const;\n\n/**\n * The header every Salla API call is answered by store.\n *\n * Exported because a caller that already knows which store it is asking about\n * must be able to say so on the request itself — see `store.settings`. Without\n * it the only way to name a store is the ambient resolver, and \"the identifier\n * I checked\" and \"the identifier that was sent\" become two different things.\n */\nexport const STORE_IDENTIFIER_HEADER = API_HEADERS.STORE_IDENTIFIER;\n\n/**\n * Active scope: the market plus its branch allocation, as the SDK stores it. On the\n * client it comes from `salla.storage.get('scope')`; before the SDK hydrates storage\n * it falls back to the `scope` cookie the theme mirrors that selection into (see\n * writeScopeCookie), then to the scope twilightMiddleware seeded from the same\n * cookie on the server. Requests vary by the `s-scope-*` headers, so React Query\n * keys must include this to avoid serving another branch's cached categories/products.\n *\n * The cookie step matters for hydration: the SDK is not guaranteed to have\n * populated `salla.storage` by the time the client rebuilds a dehydrated query\n * key, and without it the client would compute null against a scoped SSR key.\n */\nexport const getActiveScope = (): ActiveScope | null => {\n // `!== undefined`, not `!= null`: a null here is the SDK authoritatively saying \"no branch\n // selected\", which must beat a cookie left over from the previous selection. Only a\n // not-yet-ready storage API (undefined) falls through to the cookie.\n const fromStorage = readSdkScope();\n if (fromStorage !== undefined) return fromStorage;\n\n if (typeof document !== 'undefined') {\n const fromCookie = extractScopeFromCookies(document.cookie);\n if (fromCookie != null) return fromCookie;\n }\n\n try {\n return getTwilightContext().scope;\n } catch {\n return null;\n }\n};\n\n/** {@link getActiveScope} reduced to the market id. */\nexport const getActiveScopeId = (): string | null => getActiveScope()?.id ?? null;\n\n// No `s-store-api-version`: a Cloudflare rule on api.salla.dev adds it to the paths the\n// Swoole pool serves. Sent from here, it put every call there, `cart/{id}` among them.\nconst sharedHeaders = (locale: string) => ({\n [API_HEADERS.ACCEPT]: 'application/json' as const,\n [API_HEADERS.ACCEPT_LANGUAGE]: locale,\n [API_HEADERS.APP_OS]: 'browser',\n [API_HEADERS.APP_VERSION]: '2.14.363',\n [API_HEADERS.RAY]: '50',\n [API_HEADERS.SOURCE]: 'twilight',\n [API_HEADERS.THEME_TYPE]: 'react',\n [API_HEADERS.REQUESTED_WITH]: 'XMLHttpRequest',\n [API_HEADERS.CF_PROXY_WHITELIST]: '019a2f78-a64c-7edb-proxy-whitelist-id-9a3a-17afda90f03a',\n});\n\n/**\n * Who a server-rendered call says it is.\n *\n * Every theme worker reaches api.salla.dev from Cloudflare's one Workers address, so\n * salla.dev's per-IP rate limits counted every React store as a single client and\n * refused the calls each page makes (`store/settings` among them: \"Store Unavailable\").\n * The zone skips rate limiting for a User-Agent shaped `Salla-<Name>/<N.N.N> (<env>; <meta>)`\n * from Cloudflare's or AWS's networks, the convention Salla's other services already send.\n *\n * Built from fixed parts: the zone's pattern takes only digits and dots for the version,\n * so a prerelease suffix is dropped, and an unbundled engine (`dev`) reads as `0.0.0`.\n */\nconst SERVER_USER_AGENT = `Salla-TwilightReact/${\n /^\\d+(?:\\.\\d+)*/.exec(ENGINE_VERSION)?.[0] ?? '0.0.0'\n} (${import.meta.env.DEV ? 'development' : 'production'}; ssr)`;\n\n/**\n * Store API base. `VITE_API_URL` override points a preview at a branch backend; unset → prod\n * `api.salla.dev`. Resolution order matters: the value the SSR worker resolved (published into\n * the head, since worker `vars` are server-only `process.env` and never reach the browser\n * bundle) wins, so the hydrated client keeps talking to the backend that rendered the page.\n */\n\nconst STORE_API_BASE =\n getInjectedRuntimeEnv().apiBase || readEnv('VITE_API_URL') || 'https://api.salla.dev/store/v1';\n\n/**\n * Moves a call onto the API base this request was told to use, when it has one.\n *\n * `STORE_API_BASE` is read once per isolate, and one theme worker serves every\n * storefront the dispatcher sends it: production, and the beta and PR preview\n * storefronts (`web[-<hash>].beta.salla.group`), whose Store API is on their own\n * host (`x-salla-api-base`, see `utils/api-base.ts`). So SSR rebases each call per\n * request. In the browser the request store is empty and `STORE_API_BASE` is\n * already the published per-page value, so this does nothing there.\n *\n * After every hook that sets a header, so the request it copies carries them all.\n * It runs only where the dispatcher named a base (beta), and the dev settings cache\n * after it only in a dev build, which never gets that header.\n */\nfunction toRequestApiBase({ request }: { request: Request }): Request | undefined {\n const { apiBase } = getRequestStore();\n if (!apiBase || apiBase === STORE_API_BASE) return undefined;\n const url = rebaseApiUrl(request.url, STORE_API_BASE, apiBase);\n return url ? new Request(url, request) : undefined;\n}\n\nexport const api = ky.extend({\n prefix: STORE_API_BASE,\n timeout: 8000,\n hooks: {\n beforeRequest: [\n ({ request }) => {\n const { locale } = getTwilightContext();\n const headers = sharedHeaders(locale);\n for (const [key, value] of Object.entries(headers)) {\n request.headers.set(key, value);\n }\n // Only when the caller did not say. `headers.set` here would otherwise\n // overwrite a per-request identifier with the ambient one, which is a\n // silent way to answer a question about one store with another's data.\n if (!request.headers.get(API_HEADERS.STORE_IDENTIFIER)) {\n request.headers.set(API_HEADERS.STORE_IDENTIFIER, getStoreIdentifier());\n }\n\n // Server only. A browser call comes from the shopper's own address and is\n // counted against it, which is what the zone's limits are for.\n if (typeof document === 'undefined') {\n request.headers.set(API_HEADERS.USER_AGENT, SERVER_USER_AGENT);\n }\n\n const scope = getActiveScope();\n\n // The version the request asked for, else the one the settings named for\n // this scope. Absent means \"whatever is live\", which is what an ordinary\n // storefront visit wants — so a null is left off rather than sent empty.\n const versionId = resolveThemeVersionId(scope?.id ?? null);\n if (versionId) {\n request.headers.set(API_HEADERS.VERSION_ID, versionId);\n }\n\n // The draft theme a preview renders, by the name the Store knows drafts\n // by. Without it the Store answers the draft's version as the store's own\n // theme, and checks the draft's components against that one. Absent on\n // every other call, so an ordinary storefront request is unchanged.\n const draftThemeName = requestedDraftThemeName();\n if (draftThemeName) {\n request.headers.set(API_HEADERS.THEME_NAME, draftThemeName);\n }\n\n const currency = getActiveCurrency();\n if (currency) request.headers.set(API_HEADERS.CURRENCY, currency);\n\n const token = getAuthToken();\n if (token) {\n request.headers.set(API_HEADERS.AUTHORIZATION, `Bearer ${token}`);\n }\n\n // The same four the SDK's own client sends. The API resolves stock per\n // allocation: id alone asks about the market, not the branch the shopper chose.\n if (scope) {\n request.headers.set(API_HEADERS.SCOPE_ID, scope.id);\n if (scope.type) request.headers.set(API_HEADERS.SCOPE_TYPE, scope.type);\n if (scope.allocation_type)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_TYPE, scope.allocation_type);\n if (scope.allocation_id)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_ID, scope.allocation_id);\n }\n },\n toRequestApiBase,\n // Last, so it keys on the request with every header above set.\n devSettingsCache.lookup,\n ],\n afterResponse: [devSettingsCache.store],\n },\n});\n\nexport const cdn = ky.extend({\n prefix: 'https://cdn.salla.network',\n timeout: 5000,\n});\n\n/**\n * The merchant uploader's public bucket, `admin-uploader-prod`.\n *\n * A different host from {@link cdn} and a different thing behind it: this one\n * is an R2 custom domain, so a read never passes through a worker. Storefront\n * translations live here, per language, under `translations/` — see\n * `api/translations.ts`.\n */\nexport const filesCdn = ky.extend({\n prefix: 'https://cdn.files.salla.network',\n timeout: 5000,\n});\n"]}
1
+ {"version":3,"sources":["../src/utils/api-base.ts","../src/utils/engine-version.ts","../src/api/dev-settings-cache.ts","../src/api/client.ts"],"names":["entry","createIsomorphicFn","getCookie"],"mappings":";;;;;;;;;AAWO,IAAM,eAAA,GAAkB;AAG/B,IAAM,aAAA,GAAgB,SAAA;AAQf,SAAS,qBAAA,CACd,QACA,WAAA,EACe;AACf,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,WAAA,EAAa,OAAO,IAAA;AACpC,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,IAAA,EAAM,CAAA;AAAA,EAC7B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,IAAI,GAAA,CAAI,QAAA,KAAa,QAAA,EAAU,OAAO,IAAA;AACtC,EAAA,IAAI,IAAI,IAAA,CAAK,WAAA,OAAkB,WAAA,CAAY,WAAA,IAAe,OAAO,IAAA;AACjE,EAAA,IAAI,GAAA,CAAI,YAAY,GAAA,CA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gBAAA,CAAiB,KAAK;AAAA;AAE1C,CAAC;AAEM,IAAM,GAAA,GAAM,GAAG,MAAA,CAAO;AAAA,EAC3B,MAAA,EAAQ,2BAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAC;AAUM,IAAM,QAAA,GAAW,GAAG,MAAA,CAAO;AAAA,EAChC,MAAA,EAAQ,iCAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAC","file":"chunk-I7S6WWHW.js","sourcesContent":["/**\n * The header the storefront dispatcher names the Store API base in, on the\n * storefronts that must not call production: the beta storefront and its per-PR\n * previews (`web.beta.salla.group`, `web-<hash>.beta.salla.group`). There the\n * Store serves the storefront API under its own address, `https://<host>/api/v1`.\n *\n * Trusted for the same reason `x-salla-store-base` is: the dispatcher sets it\n * after dropping everything off its allowlist, so a visitor's copy never arrives.\n * It is still checked against the request's own host, so even a forged one could\n * only point the theme back at the storefront it is already serving.\n */\nexport const API_BASE_HEADER = 'x-salla-api-base';\n\n/** The one path the dispatcher names: the Store's storefront API under its own host. */\nconst API_BASE_PATH = '/api/v1';\n\n/**\n * The API base this request was told to use, or null for the build's default.\n *\n * Accepted only as `https://<the request's own host>/api/v1` (a trailing slash\n * allowed), with no credentials, query or fragment; returned without the slash.\n */\nexport function resolveRequestApiBase(\n header: string | null | undefined,\n requestHost: string | null\n): string | null {\n if (!header || !requestHost) return null;\n let url: URL;\n try {\n url = new URL(header.trim());\n } catch {\n return null;\n }\n if (url.protocol !== 'https:') return null;\n if (url.host.toLowerCase() !== requestHost.toLowerCase()) return null;\n if (url.username || url.password || url.search || url.hash) return null;\n if (url.pathname.replace(/\\/+$/, '') !== API_BASE_PATH) return null;\n return `${url.origin}${API_BASE_PATH}`;\n}\n\n/**\n * `url` moved from one API base to another: `https://api.salla.dev/store/v1/cart/1`\n * under `https://web.beta.salla.group/api/v1` is `https://web.beta.salla.group/api/v1/cart/1`.\n * Null when `url` is not under `from`, which leaves the request as it was.\n */\nexport function rebaseApiUrl(url: string, from: string, to: string): string | null {\n const base = from.replace(/\\/+$/, '');\n if (url !== base && !url.startsWith(`${base}/`) && !url.startsWith(`${base}?`)) return null;\n return to.replace(/\\/+$/, '') + url.slice(base.length);\n}\n","/**\n * The engine's own build version, injected by tsup `define` when dist is\n * built. Falls back to 'dev' when the source runs unbundled (vitest, direct\n * src imports in the monorepo).\n *\n * Exposed at runtime as `salla.versions.engine` by `useTwilightInit` so a\n * storefront can always be asked which engine build rendered it.\n */\nexport const ENGINE_VERSION: string =\n typeof __TWILIGHT_ENGINE_VERSION__ !== 'undefined' ? __TWILIGHT_ENGINE_VERSION__ : 'dev';\n","import type { AfterResponseHook, BeforeRequestHook } from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { DEV_SETTINGS_REFRESH_COOKIE } from '../utils/dev-settings-refresh';\n\n/**\n * A dev server reuses a store's settings for up to an hour.\n *\n * Every server render asks the API for `store/settings`, and a developer clicking\n * around a theme renders dozens of pages a minute. The API answers a burst of\n * settings requests for one store from one address with a challenge, which a\n * server-side fetch cannot pass, so the dev server rendered \"Store Unavailable\"\n * (6.05k challenged `(development; ssr)` calls in the 7 days to 2026-10-25). In\n * development, on the server, the same request within {@link DEV_SETTINGS_TTL_MS}\n * is answered from memory instead. An hour because the API counts settings\n * requests per hour, so one fetch an hour can never reach its limit; the theme\n * editor's \"Fetch fresh store data\" fetches sooner, and says how old the settings\n * are. A production build never runs it: `import.meta.env.DEV` is statically\n * false there.\n */\nexport const DEV_SETTINGS_TTL_MS = 60 * 60_000;\n\n/** Marks an answer from memory, so the store step does not file it again. */\nconst HIT_HEADER = 'x-twilight-dev-cache';\n\n/** When the answer was really fetched from the API (epoch ms), on fresh answers and reused ones alike. */\nconst FETCHED_AT_HEADER = 'x-twilight-dev-fetched-at';\n\n/**\n * When the dev server fetched these settings from the API, read off the answer the\n * cache handed back; `undefined` when the cache did not handle the call (a\n * production build, the browser, a test), so nothing new reaches the settings there.\n */\nexport function devSettingsFetchedAt(headers: Headers | undefined): number | undefined {\n const at = Number(headers?.get(FETCHED_AT_HEADER));\n return Number.isFinite(at) && at > 0 ? at : undefined;\n}\n\n/**\n * Not carried over to an answer from memory: the body is stored decoded, so its\n * original encoding and length no longer describe it.\n */\nconst DROPPED_HEADERS = new Set(['content-encoding', 'content-length']);\n\ninterface Entry {\n body: string;\n status: number;\n statusText: string;\n headers: [string, string][];\n fetchedAt: number;\n /** The refresh cookie's value when this answer was fetched. */\n refresh: string | null;\n}\n\nexport interface DevSettingsCacheOptions {\n /** Whether this call may use the cache at all. */\n enabled: () => boolean;\n /** The current value of {@link DEV_SETTINGS_REFRESH_COOKIE}, or null. */\n refreshToken: () => string | null;\n now?: () => number;\n ttlMs?: number;\n /** Called the first time an answer comes from memory. */\n onFirstHit?: () => void;\n}\n\nfunction isSettingsRequest(request: Request): boolean {\n if (request.method !== 'GET') return false;\n try {\n return new URL(request.url).pathname.endsWith('/store/settings');\n } catch {\n return false;\n }\n}\n\n/**\n * An answer `requestSettings` accepts: JSON carrying `data`. A 200 without it is\n * refused there as \"Store Unavailable\"; kept here, it would be refused for the next\n * hour too, after the API had recovered.\n */\nfunction hasSettings(body: string): boolean {\n try {\n return Boolean((JSON.parse(body) as { data?: unknown } | null)?.data);\n } catch {\n return false;\n }\n}\n\n/**\n * The request as the API receives it: method, URL and every header the client's\n * hooks set. Keyed on the request itself rather than on the inputs that build it,\n * so a header added to the client later cannot be missing from the key.\n */\nfunction keyOf(request: Request): string {\n const headers = [...request.headers].map(([name, value]) => `${name}: ${value}`).join('\\n');\n return `${request.method} ${request.url}\\n${headers}`;\n}\n\n/**\n * The two ky hooks behind the cache: `lookup` runs last among `beforeRequest`, once\n * every header is set, and `store` among `afterResponse`. Only an answer with\n * settings in it is kept, so a timeout, a 429, a challenge or an empty 200 is asked\n * again on the next render.\n */\nexport function createDevSettingsCache(options: DevSettingsCacheOptions) {\n const {\n enabled,\n refreshToken,\n now = Date.now,\n ttlMs = DEV_SETTINGS_TTL_MS,\n onFirstHit,\n } = options;\n const entries = new Map<string, Entry>();\n let announced = false;\n\n const isFresh = (entry: Entry): boolean =>\n now() - entry.fetchedAt < ttlMs && entry.refresh === refreshToken();\n\n const answerOf = (entry: Entry, hit: boolean): Response => {\n const headers = new Headers(entry.headers);\n headers.set(FETCHED_AT_HEADER, String(entry.fetchedAt));\n if (hit) headers.set(HIT_HEADER, 'hit');\n return new Response(entry.body, {\n status: entry.status,\n statusText: entry.statusText,\n headers,\n });\n };\n\n const lookup: BeforeRequestHook = ({ request }) => {\n if (!enabled() || !isSettingsRequest(request)) return;\n const key = keyOf(request);\n const entry = entries.get(key);\n if (!entry) return;\n if (!isFresh(entry)) {\n entries.delete(key);\n return;\n }\n if (!announced) {\n announced = true;\n onFirstHit?.();\n }\n return answerOf(entry, true);\n };\n\n const store: AfterResponseHook = async ({ request, response }) => {\n if (!enabled() || !isSettingsRequest(request) || !response.ok) return;\n if (response.headers.has(HIT_HEADER)) return;\n // ky hands each hook a clone, so reading it leaves the answer it returns intact.\n const body = await response.text();\n if (!hasSettings(body)) return;\n for (const [key, entry] of entries) {\n if (now() - entry.fetchedAt >= ttlMs) entries.delete(key);\n }\n const entry: Entry = {\n body,\n status: response.status,\n statusText: response.statusText,\n headers: [...response.headers].filter(([name]) => !DROPPED_HEADERS.has(name)),\n fetchedAt: now(),\n refresh: refreshToken(),\n };\n entries.set(keyOf(request), entry);\n // Handed on in place of the API's own answer, so it carries its fetch time too.\n return answerOf(entry, false);\n };\n\n return { lookup, store, clear: () => entries.clear() };\n}\n\nconst readRefreshCookie = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(DEV_SETTINGS_REFRESH_COOKIE) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\nexport const devSettingsCache = createDevSettingsCache({\n // A dev server's render only. A production build has `DEV` statically false,\n // the browser keeps the settings it was handed in its query cache, and vitest\n // runs in `test` mode, where every test wants the request it mocked.\n enabled: () =>\n import.meta.env.DEV && import.meta.env.MODE !== 'test' && typeof document === 'undefined',\n refreshToken: readRefreshCookie,\n onFirstHit: () =>\n console.warn(\n `[twilight] Store settings are reused for up to ${DEV_SETTINGS_TTL_MS / 60_000} minutes while you develop, to stay under the Salla API's rate limit. To see a change you made in the dashboard, press \"Fetch fresh store data\" in the theme editor's side panel: it also says when they were last fetched.`\n ),\n});\n","import ky from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { getStoreIdentifier } from '../utils/sdk-helpers';\nimport { requestedDraftThemeName, resolveThemeVersionId } from '../utils/theme-version';\nimport { getInjectedRuntimeEnv, readEnv } from '../utils/runtime-env';\nimport { getRequestStore, getTwilightContext, isAuthTokenRevoked } from '../twilight/context';\nimport { rebaseApiUrl } from '../utils/api-base';\nimport { ENGINE_VERSION } from '../utils/engine-version';\nimport { devSettingsCache } from './dev-settings-cache';\nimport {\n AUTH_TOKEN_COOKIE_NAME,\n CURRENCY_COOKIE_NAME,\n extractCurrencyFromCookies,\n extractScopeFromCookies,\n toCurrencyCode,\n extractTokenFromCookies,\n readSdkScope,\n type ActiveScope,\n} from '../utils/cookies';\n\n// The twilight module store doesn't reliably carry authToken into every scope: on the\n// SERVER workerd has no AsyncLocalStorage, and on BOTH sides this api client can live in a\n// different module instance than the one rootBeforeLoad populates (engine subpath import vs\n// engine-internal relative import). So `getTwilightContext().authToken` is often null even\n// for logged-in users → API calls (orders/customer/…) return `token_not_provided` (400).\n// Read the token directly from the request cookie (server) or document.cookie / salla.storage\n// (client) as a fallback. The server-only import is stripped from the client bundle by\n// createIsomorphicFn.\nconst readFallbackToken = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(AUTH_TOKEN_COOKIE_NAME) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => {\n const fromCookie =\n typeof document !== 'undefined'\n ? extractTokenFromCookies(document.cookie, AUTH_TOKEN_COOKIE_NAME)\n : null;\n if (fromCookie) return fromCookie;\n const storage = typeof window !== 'undefined' ? window.salla?.storage : undefined;\n const fromStorage =\n typeof storage?.get === 'function' ? storage.get(AUTH_TOKEN_COOKIE_NAME) : null;\n if (typeof fromStorage === 'string' && fromStorage) return fromStorage;\n // `?token=` webview injection lands only on the SDK's axios instance\n const fromSdkApi = typeof window !== 'undefined' ? window.salla?.api?.token : undefined;\n return typeof fromSdkApi === 'string' && fromSdkApi ? fromSdkApi : null;\n });\n\n/**\n * The auth token as the api client sees it: twilight context first, cookie/storage fallback.\n * Use this (not `getTwilightContext().authToken`, which is often null for logged-in users —\n * see the note above) to decide whether an authenticated-only query should run.\n */\nexport const getAuthToken = (): string | null =>\n isAuthTokenRevoked() ? null : (getTwilightContext().authToken ?? readFallbackToken());\n\nconst readRequestCurrency = createIsomorphicFn()\n .server((): string | null => {\n try {\n return toCurrencyCode(getCookie(CURRENCY_COOKIE_NAME));\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\n/**\n * The currency the visitor chose, from the `s-curr` cookie the SDK writes: the API\n * answers in the store's own currency unless the request names one.\n */\nexport function getActiveCurrency(): string | null;\nexport function getActiveCurrency(fallback: string): string;\nexport function getActiveCurrency(fallback: string | null = null): string | null {\n const chosen =\n typeof document !== 'undefined'\n ? extractCurrencyFromCookies(document.cookie)\n : readRequestCurrency();\n return chosen ?? fallback;\n}\n\nconst API_HEADERS = {\n ACCEPT: 'accept',\n ACCEPT_LANGUAGE: 'accept-language',\n APP_OS: 's-app-os',\n APP_VERSION: 's-app-version',\n RAY: 's-ray',\n SOURCE: 's-source',\n THEME_TYPE: 's-theme-type',\n REQUESTED_WITH: 'x-requested-with',\n CF_PROXY_WHITELIST: 's-cf-proxy-whitelist-id',\n STORE_IDENTIFIER: 'store-identifier',\n CURRENCY: 'currency',\n AUTHORIZATION: 'Authorization',\n VERSION_ID: 's-version-id',\n THEME_NAME: 's-theme-name',\n SCOPE_ID: 's-scope-id',\n SCOPE_TYPE: 's-scope-type',\n SCOPE_ALLOCATION_TYPE: 's-scope-allocation-type',\n SCOPE_ALLOCATION_ID: 's-scope-allocation-id',\n USER_AGENT: 'user-agent',\n} as const;\n\n/**\n * The header every Salla API call is answered by store.\n *\n * Exported because a caller that already knows which store it is asking about\n * must be able to say so on the request itself — see `store.settings`. Without\n * it the only way to name a store is the ambient resolver, and \"the identifier\n * I checked\" and \"the identifier that was sent\" become two different things.\n */\nexport const STORE_IDENTIFIER_HEADER = API_HEADERS.STORE_IDENTIFIER;\n\n/**\n * Active scope: the market plus its branch allocation, as the SDK stores it. On the\n * client it comes from `salla.storage.get('scope')`; before the SDK hydrates storage\n * it falls back to the `scope` cookie the theme mirrors that selection into (see\n * writeScopeCookie), then to the scope twilightMiddleware seeded from the same\n * cookie on the server. Requests vary by the `s-scope-*` headers, so React Query\n * keys must include this to avoid serving another branch's cached categories/products.\n *\n * The cookie step matters for hydration: the SDK is not guaranteed to have\n * populated `salla.storage` by the time the client rebuilds a dehydrated query\n * key, and without it the client would compute null against a scoped SSR key.\n */\nexport const getActiveScope = (): ActiveScope | null => {\n // `!== undefined`, not `!= null`: a null here is the SDK authoritatively saying \"no branch\n // selected\", which must beat a cookie left over from the previous selection. Only a\n // not-yet-ready storage API (undefined) falls through to the cookie.\n const fromStorage = readSdkScope();\n if (fromStorage !== undefined) return fromStorage;\n\n if (typeof document !== 'undefined') {\n const fromCookie = extractScopeFromCookies(document.cookie);\n if (fromCookie != null) return fromCookie;\n }\n\n try {\n return getTwilightContext().scope;\n } catch {\n return null;\n }\n};\n\n/** {@link getActiveScope} reduced to the market id. */\nexport const getActiveScopeId = (): string | null => getActiveScope()?.id ?? null;\n\n// No `s-store-api-version`: a Cloudflare rule on api.salla.dev adds it to the paths the\n// Swoole pool serves. Sent from here, it put every call there, `cart/{id}` among them.\nconst sharedHeaders = (locale: string) => ({\n [API_HEADERS.ACCEPT]: 'application/json' as const,\n [API_HEADERS.ACCEPT_LANGUAGE]: locale,\n [API_HEADERS.APP_OS]: 'browser',\n [API_HEADERS.APP_VERSION]: '2.14.363',\n [API_HEADERS.RAY]: '50',\n [API_HEADERS.SOURCE]: 'twilight',\n [API_HEADERS.THEME_TYPE]: 'react',\n [API_HEADERS.REQUESTED_WITH]: 'XMLHttpRequest',\n [API_HEADERS.CF_PROXY_WHITELIST]: '019a2f78-a64c-7edb-proxy-whitelist-id-9a3a-17afda90f03a',\n});\n\n/**\n * Who a server-rendered call says it is.\n *\n * Every theme worker reaches api.salla.dev from Cloudflare's one Workers address, so\n * salla.dev's per-IP rate limits counted every React store as a single client and\n * refused the calls each page makes (`store/settings` among them: \"Store Unavailable\").\n * The zone skips rate limiting for a User-Agent shaped `Salla-<Name>/<N.N.N> (<env>; <meta>)`\n * from Cloudflare's or AWS's networks, the convention Salla's other services already send.\n *\n * Built from fixed parts: the zone's pattern takes only digits and dots for the version,\n * so a prerelease suffix is dropped, and an unbundled engine (`dev`) reads as `0.0.0`.\n */\nconst SERVER_USER_AGENT = `Salla-TwilightReact/${\n /^\\d+(?:\\.\\d+)*/.exec(ENGINE_VERSION)?.[0] ?? '0.0.0'\n} (${import.meta.env.DEV ? 'development' : 'production'}; ssr)`;\n\n/**\n * Store API base. `VITE_API_URL` override points a preview at a branch backend; unset → prod\n * `api.salla.dev`. Resolution order matters: the value the SSR worker resolved (published into\n * the head, since worker `vars` are server-only `process.env` and never reach the browser\n * bundle) wins, so the hydrated client keeps talking to the backend that rendered the page.\n */\n\nconst STORE_API_BASE =\n getInjectedRuntimeEnv().apiBase || readEnv('VITE_API_URL') || 'https://api.salla.dev/store/v1';\n\n/**\n * Moves a call onto the API base this request was told to use, when it has one.\n *\n * `STORE_API_BASE` is read once per isolate, and one theme worker serves every\n * storefront the dispatcher sends it: production, and the beta and PR preview\n * storefronts (`web[-<hash>].beta.salla.group`), whose Store API is on their own\n * host (`x-salla-api-base`, see `utils/api-base.ts`). So SSR rebases each call per\n * request. In the browser the request store is empty and `STORE_API_BASE` is\n * already the published per-page value, so this does nothing there.\n *\n * After every hook that sets a header, so the request it copies carries them all.\n * It runs only where the dispatcher named a base (beta), and the dev settings cache\n * after it only in a dev build, which never gets that header.\n */\nfunction toRequestApiBase({ request }: { request: Request }): Request | undefined {\n const { apiBase } = getRequestStore();\n if (!apiBase || apiBase === STORE_API_BASE) return undefined;\n const url = rebaseApiUrl(request.url, STORE_API_BASE, apiBase);\n return url ? new Request(url, request) : undefined;\n}\n\nexport const api = ky.extend({\n prefix: STORE_API_BASE,\n timeout: 8000,\n hooks: {\n beforeRequest: [\n ({ request }) => {\n const { locale } = getTwilightContext();\n const headers = sharedHeaders(locale);\n for (const [key, value] of Object.entries(headers)) {\n request.headers.set(key, value);\n }\n // Only when the caller did not say. `headers.set` here would otherwise\n // overwrite a per-request identifier with the ambient one, which is a\n // silent way to answer a question about one store with another's data.\n if (!request.headers.get(API_HEADERS.STORE_IDENTIFIER)) {\n request.headers.set(API_HEADERS.STORE_IDENTIFIER, getStoreIdentifier());\n }\n\n // Server only. A browser call comes from the shopper's own address and is\n // counted against it, which is what the zone's limits are for.\n if (typeof document === 'undefined') {\n request.headers.set(API_HEADERS.USER_AGENT, SERVER_USER_AGENT);\n }\n\n const scope = getActiveScope();\n\n // The version the request asked for, else the one the settings named for\n // this scope. Absent means \"whatever is live\", which is what an ordinary\n // storefront visit wants — so a null is left off rather than sent empty.\n const versionId = resolveThemeVersionId(scope?.id ?? null);\n if (versionId) {\n request.headers.set(API_HEADERS.VERSION_ID, versionId);\n }\n\n // The draft theme a preview renders, by the name the Store knows drafts\n // by. Without it the Store answers the draft's version as the store's own\n // theme, and checks the draft's components against that one. Absent on\n // every other call, so an ordinary storefront request is unchanged.\n const draftThemeName = requestedDraftThemeName();\n if (draftThemeName) {\n request.headers.set(API_HEADERS.THEME_NAME, draftThemeName);\n }\n\n const currency = getActiveCurrency();\n if (currency) request.headers.set(API_HEADERS.CURRENCY, currency);\n\n const token = getAuthToken();\n if (token) {\n request.headers.set(API_HEADERS.AUTHORIZATION, `Bearer ${token}`);\n }\n\n // The same four the SDK's own client sends. The API resolves stock per\n // allocation: id alone asks about the market, not the branch the shopper chose.\n if (scope) {\n request.headers.set(API_HEADERS.SCOPE_ID, scope.id);\n if (scope.type) request.headers.set(API_HEADERS.SCOPE_TYPE, scope.type);\n if (scope.allocation_type)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_TYPE, scope.allocation_type);\n if (scope.allocation_id)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_ID, scope.allocation_id);\n }\n },\n toRequestApiBase,\n // Last, so it keys on the request with every header above set.\n devSettingsCache.lookup,\n ],\n afterResponse: [devSettingsCache.store],\n },\n});\n\nexport const cdn = ky.extend({\n prefix: 'https://cdn.salla.network',\n timeout: 5000,\n});\n\n/**\n * The merchant uploader's public bucket, `admin-uploader-prod`.\n *\n * A different host from {@link cdn} and a different thing behind it: this one\n * is an R2 custom domain, so a read never passes through a worker. Storefront\n * translations live here, per language, under `translations/` — see\n * `api/translations.ts`.\n */\nexport const filesCdn = ky.extend({\n prefix: 'https://cdn.files.salla.network',\n timeout: 5000,\n});\n"]}
@@ -1,5 +1,5 @@
1
- import { orThrow } from './chunk-PLDWDVOP.js';
2
- import { getActiveScope, api } from './chunk-NWMTGBCN.js';
1
+ import { orThrow } from './chunk-O3ZL24KN.js';
2
+ import { getActiveScope, api } from './chunk-I7S6WWHW.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
5
5
  var category = {
@@ -26,5 +26,5 @@ var category = {
26
26
  };
27
27
 
28
28
  export { category };
29
- //# sourceMappingURL=chunk-36DUIP2H.js.map
30
- //# sourceMappingURL=chunk-36DUIP2H.js.map
29
+ //# sourceMappingURL=chunk-IMXX46KD.js.map
30
+ //# sourceMappingURL=chunk-IMXX46KD.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/category.ts"],"names":[],"mappings":";;;;AAKO,IAAM,QAAA,GAAW;AAAA,EACtB,IAAA,EAAM,OAAO,EAAA,KAAkC;AAC7C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,WAAA,EAAc,EAAE,CAAA,CAAE,CAAA,CAAE,IAAA,EAAyB;AAC5E,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,aAAa,CAAC,EAAA,KAAkC,QAAQ,QAAA,CAAS,IAAA,CAAK,EAAE,CAAC,CAAA;AAAA,EAEzE,MAAM,YAAiC;AACrC,IAAA,MAAM,EAAE,MAAK,GAAI,MAAM,IAAI,GAAA,CAAI,YAAY,EAAE,IAAA,EAA2B;AACxE,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,CAAC,EAAA,KACP,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,YAAA,EAAc,QAAA,EAAU,EAAE,CAAA;AAAA,MACrC,OAAA,EAAS,MAAM,QAAA,CAAS,IAAA,CAAK,EAAE;AAAA,KAChC,CAAA;AAAA,IAEH,IAAA,EAAM,MACJ,YAAA,CAAa;AAAA;AAAA,MAEX,QAAA,EAAU,CAAC,YAAA,EAAc,MAAA,EAAQ,EAAE,KAAA,EAAO,cAAA,IAAkB,CAAA;AAAA,MAC5D,OAAA,EAAS,MAAM,QAAA,CAAS,IAAA;AAAK,KAC9B;AAAA;AAEP","file":"chunk-36DUIP2H.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport type { Category } from '../types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const category = {\n find: async (id: string): Promise<Category> => {\n const { data } = await api.get(`categories/${id}`).json<{ data: Category }>();\n return data;\n },\n\n findOrThrow: (id: string): Promise<Category> => orThrow(category.find(id)),\n\n list: async (): Promise<Category[]> => {\n const { data } = await api.get('categories').json<{ data: Category[] }>();\n return data ?? [];\n },\n\n queries: {\n detail: (id: string) =>\n queryOptions({\n queryKey: ['categories', 'detail', id],\n queryFn: () => category.find(id),\n }),\n\n list: () =>\n queryOptions({\n // Scope (branch) varies the API response — key must include it.\n queryKey: ['categories', 'list', { scope: getActiveScope() }],\n queryFn: () => category.list(),\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/category.ts"],"names":[],"mappings":";;;;AAKO,IAAM,QAAA,GAAW;AAAA,EACtB,IAAA,EAAM,OAAO,EAAA,KAAkC;AAC7C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,WAAA,EAAc,EAAE,CAAA,CAAE,CAAA,CAAE,IAAA,EAAyB;AAC5E,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,aAAa,CAAC,EAAA,KAAkC,QAAQ,QAAA,CAAS,IAAA,CAAK,EAAE,CAAC,CAAA;AAAA,EAEzE,MAAM,YAAiC;AACrC,IAAA,MAAM,EAAE,MAAK,GAAI,MAAM,IAAI,GAAA,CAAI,YAAY,EAAE,IAAA,EAA2B;AACxE,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,CAAC,EAAA,KACP,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,YAAA,EAAc,QAAA,EAAU,EAAE,CAAA;AAAA,MACrC,OAAA,EAAS,MAAM,QAAA,CAAS,IAAA,CAAK,EAAE;AAAA,KAChC,CAAA;AAAA,IAEH,IAAA,EAAM,MACJ,YAAA,CAAa;AAAA;AAAA,MAEX,QAAA,EAAU,CAAC,YAAA,EAAc,MAAA,EAAQ,EAAE,KAAA,EAAO,cAAA,IAAkB,CAAA;AAAA,MAC5D,OAAA,EAAS,MAAM,QAAA,CAAS,IAAA;AAAK,KAC9B;AAAA;AAEP","file":"chunk-IMXX46KD.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport type { Category } from '../types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const category = {\n find: async (id: string): Promise<Category> => {\n const { data } = await api.get(`categories/${id}`).json<{ data: Category }>();\n return data;\n },\n\n findOrThrow: (id: string): Promise<Category> => orThrow(category.find(id)),\n\n list: async (): Promise<Category[]> => {\n const { data } = await api.get('categories').json<{ data: Category[] }>();\n return data ?? [];\n },\n\n queries: {\n detail: (id: string) =>\n queryOptions({\n queryKey: ['categories', 'detail', id],\n queryFn: () => category.find(id),\n }),\n\n list: () =>\n queryOptions({\n // Scope (branch) varies the API response — key must include it.\n queryKey: ['categories', 'list', { scope: getActiveScope() }],\n queryFn: () => category.list(),\n }),\n },\n};\n"]}
@@ -1,4 +1,4 @@
1
- import { filesCdn, cdn } from './chunk-NWMTGBCN.js';
1
+ import { filesCdn, cdn } from './chunk-I7S6WWHW.js';
2
2
  import { storeTranslationsQueryKey, translationsQueryKey, composeMessages, isPlainObject } from './chunk-MWUAHDQL.js';
3
3
  import { queryOptions } from '@tanstack/react-query';
4
4
 
@@ -126,5 +126,5 @@ var translations = {
126
126
  };
127
127
 
128
128
  export { commonTranslationsPath, storeTranslationsPath, translations };
129
- //# sourceMappingURL=chunk-SR4YSJAF.js.map
130
- //# sourceMappingURL=chunk-SR4YSJAF.js.map
129
+ //# sourceMappingURL=chunk-JRM7WGZ7.js.map
130
+ //# sourceMappingURL=chunk-JRM7WGZ7.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/translations.ts"],"names":[],"mappings":";;;;AAiEA,IAAM,kBAAA,GAAqB,sBAAA;AAGpB,SAAS,uBAAuB,MAAA,EAAwB;AAC7D,EAAA,OAAO,uBAAuB,MAAM,CAAA,KAAA,CAAA;AACtC;AAWO,SAAS,qBAAA,CAAsB,SAA0B,MAAA,EAAwB;AACtF,EAAA,OAAO,CAAA,aAAA,EAAgB,OAAO,CAAA,CAAA,EAAI,MAAM,CAAA,KAAA,CAAA;AAC1C;AAUA,eAAe,eACb,IAAA,EACA,EAAE,aAAa,KAAA,EAAM,GAA8B,EAAC,EAC1B;AAE1B,EAAA,MAAM,UAAA,GAAa,CAAC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AA;AAAA;AAAA;AAAA,IAgBP,QAAA,EAAU,CAAC,MAAA,KACT,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,qBAAqB,MAAM,CAAA;AAAA,MACrC,OAAA,EAAS,MAAM,YAAA,CAAa,GAAA,CAAI,MAAM;AAAA,KACvC,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAWH,OAAA,EAAS,CAAC,OAAA,EAA0B,MAAA,KAClC,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,yBAAA,CAA0B,OAAA,EAAS,MAAM,CAAA;AAAA,MACnD,OAAA,EAAS,MAAM,YAAA,CAAa,QAAA,CAAS,SAAS,MAAM;AAAA,KACrD;AAAA;AAEP","file":"chunk-SR4YSJAF.js","sourcesContent":["/**\n * @fileoverview Where a storefront's words come from.\n *\n * Two files, merged: the platform's copy for this language, and the merchant's\n * own edits for this language and this store. Both are plain JSON objects on\n * the uploader's CDN, one per language.\n *\n * ```\n * https://cdn.files.salla.network/translations/common/<locale>.json the platform's\n * https://cdn.files.salla.network/translations/<storeId>/<locale>.json the merchant's\n * ```\n *\n * **What this replaces, and why.** Until now the engine read a single global\n * file, `cdn.salla.network/js/translations.json`, holding every language keyed\n * `\"<locale>.trans\"`. Nothing publishes that file: it is an object last written\n * on 2026-03-26, carrying only `ar` and `en` where the platform has 39 locales,\n * 405 keys behind `Languages-Module` and 959 English strings textually\n * different from it. So every React storefront has been serving copy from\n * March, and a key added since has never reached one. It also carried no\n * merchant overrides at all — a merchant editing their theme's wording in the\n * Dashboard changed nothing on a React theme.\n *\n * **Merchant overrides are read, and only when there are any.** Getting here\n * took two corrections worth keeping.\n *\n * The first is the address. A merchant's own wording lives at\n * `translations/<storeId>/<locale>.json`, keyed by `store()->getRouteKey()` —\n * the Optimus-encoded numeric id. An early version addressed it with\n * `resolveStoreIdentifier()`, on the claim that the two are the same string.\n * That is true of the `store-identifier` *header*, which accepts a host, a\n * username or an id, and false of the R2 key: on a custom domain the resolver\n * returns `reefperfumes.com` and on a shared host a username like\n * `mtgr-alaatr-2`. Both 404, both then read as \"this store has no overrides\",\n * and the merchant's wording silently never appears — so the feature would have\n * worked under `?storeId=` alone, which is preview and localhost. It is\n * `settings.store.id` now, which is known only after the settings query.\n *\n * The second is when to ask at all. Most stores have never customised a word,\n * and a miss is an uncached round trip (`cf-cache-status: DYNAMIC` on the 404)\n * on the critical path of every SSR render. So the request is made only when\n * `settings.languages[<ISO>].has_custom_translations` says there is something\n * to get — a flag `Languages-Module` writes when a merchant saves a\n * translation. A store without overrides pays nothing, which is what made this\n * shippable at all.\n *\n * ⚠️ The flag is written on save, so a store whose wording predates it reads as\n * `false` until someone edits a translation or the backfill runs. That is a\n * store keeping today's behaviour, not a regression — React themes have never\n * read merchant overrides — but it does mean the feature is only as complete as\n * the backfill.\n *\n * **Rollout is by fallback, not by flag.** `translations/common/` is written by\n * a sync in the theme build service that may not have run yet, and a hard switch\n * would leave every storefront with no platform strings at all. A missing common\n * file therefore falls back to the old global one, which is exactly today's\n * behaviour — so this is safe to ship before the bucket is populated, and stops\n * using the fallback on its own once it is.\n */\nimport { queryOptions } from '@tanstack/react-query';\nimport { cdn, filesCdn } from './client';\nimport { storeTranslationsQueryKey, translationsQueryKey } from './translations-key';\nimport { composeMessages, isPlainObject, type Messages } from './messages';\nimport type { TranslationMessages } from '../providers/I18nProvider';\n\n/** The global file this used to be the only reader of. See the file comment. */\nconst LEGACY_GLOBAL_FILE = 'js/translations.json';\n\n/** One language of platform copy, shared by every store. */\nexport function commonTranslationsPath(locale: string): string {\n return `translations/common/${locale}.json`;\n}\n\n/**\n * One language of a single merchant's own wording.\n *\n * `storeId` is `settings.store.id`, which is the value `Languages-Module` names\n * the object with (`store()->getRouteKey()`, the Optimus-encoded numeric id).\n * It is **not** `resolveStoreIdentifier()`: that returns a hostname on a custom\n * domain and a username on a shared host, both of which 404 here and would read\n * as \"this merchant has no overrides\" — silently, on every store but a preview.\n */\nexport function storeTranslationsPath(storeId: string | number, locale: string): string {\n return `translations/${storeId}/${locale}.json`;\n}\n\n/**\n * Reads one language file, or `null` when there is nothing to read.\n *\n * A 404 is the ordinary answer, not a failure: most stores have never had a\n * word customised, so their file does not exist. Distinguishing it from a real\n * error matters only for the log — both end in `null` — but a warning on every\n * page load of every uncustomised store is a warning nobody will read.\n */\nasync function readLocaleFile(\n path: string,\n { failLoudly = false }: { failLoudly?: boolean } = {}\n): Promise<Messages | null> {\n /** A 404 always means \"absent\"; everything else is a failure to read. */\n const unreadable = (reason: string, cause?: unknown): null => {\n if (failLoudly) throw new Error(`[translations] ${path}: ${reason}`, { cause });\n console.warn('[translations]', reason, path, cause ?? '');\n return null;\n };\n\n try {\n const response = await filesCdn.get(path, { throwHttpErrors: false, timeout: 5000 });\n if (response.status === 404) return null;\n\n if (!response.ok) {\n return unreadable(`answered ${response.status}`);\n }\n\n const data: unknown = await response.json();\n if (!isPlainObject(data)) {\n return unreadable('is not a JSON object');\n }\n\n return data;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith('[translations]')) throw error;\n return unreadable('could not be read', error);\n }\n}\n\n/**\n * The pre-CDN global file, sliced to one language.\n *\n * Only reached when `translations/common/<locale>.json` is missing, which is\n * the state of the bucket until the sync has run once.\n */\nasync function readLegacyGlobal(locale: string): Promise<Messages | null> {\n try {\n const data = await cdn.get(LEGACY_GLOBAL_FILE, { timeout: 5000 }).json<TranslationMessages>();\n const forLocale = data?.[`${locale}.trans`];\n return isPlainObject(forLocale) ? forLocale : null;\n } catch {\n console.warn('[translations] the legacy global file could not be read either');\n return null;\n }\n}\n\nexport const translations = {\n /**\n * The platform's copy for `locale`.\n *\n * One file, so one request. See the file comment for why the merchant's own\n * wording is not merged in here yet and what it is waiting on.\n */\n get: async (locale: string): Promise<TranslationMessages | null> => {\n const common = await readLocaleFile(commonTranslationsPath(locale));\n const base = common ?? (await readLegacyGlobal(locale));\n if (!base) return null;\n\n // Still wrapped in the `<locale>.trans` shape the rest of the engine reads.\n // `createI18nInstance` slices by that key and so does the SDK bridge in\n // `I18nProvider`; changing the envelope here would be a second change for\n // no gain, since one language is all any of them ever take out of it.\n return { [`${locale}.trans`]: base as Record<string, string> };\n },\n\n /**\n * This merchant's own wording for `locale`, or `null` if they have none.\n *\n * Only worth calling when `settings.languages[<ISO>].has_custom_translations`\n * says there is something to get. Most stores have never customised a word,\n * and a miss here is an uncached round trip — `cf-cache-status: DYNAMIC` on a\n * 404 — on the critical path of an SSR render. The flag is what makes this\n * free for everyone who does not use it.\n *\n * Returned unwrapped, unlike {@link translations.get}: this is merged into\n * that one's messages rather than handed to i18next on its own.\n */\n forStore: async (storeId: string | number, locale: string): Promise<Messages | null> =>\n // `failLoudly`, unlike the platform file: this is only ever called because\n // the settings said overrides exist, so a 500, a timeout or a body that is\n // not JSON is a failure to read them — not a store that has none. Returning\n // `null` there would cache \"no overrides\" as a success, skip the query's\n // retry, and serve Salla's wording in place of the merchant's until the\n // entry expired. A 404 still means absent, and `rootBeforeLoad` catches the\n // throw and keeps the platform copy, so the worst case is unchanged.\n readLocaleFile(storeTranslationsPath(storeId, locale), { failLoudly: true }),\n\n /**\n * The platform's copy for `locale` with this merchant's wording laid over it.\n *\n * Takes the two as values rather than fetching them, so the caller decides\n * whether the second request happens at all and both stay separately cached.\n */\n /**\n * The platform's copy for `locale` with this merchant's wording over it.\n *\n * Delegates to `composeMessages`, which every other reader of these two\n * entries also uses — see `api/messages.ts` for why there is exactly one.\n */\n merge: (\n common: TranslationMessages | null,\n overrides: Messages | null,\n locale: string\n ): TranslationMessages | null => composeMessages(common, overrides, locale) ?? null,\n\n queries: {\n /**\n * @param locale taken as an argument rather than read from the twilight\n * context, and that is load-bearing. This key is built on the server, on\n * hydration, and again lazily from the context accessor; if any of the\n * three read a locale the others had not been given yet, the hydrated page\n * would miss the dehydrated entry and refetch both files it was just\n * handed. Every caller already has the locale in hand.\n *\n * The store is deliberately **not** in the key. One document serves one\n * store — a request that names a different one is redirected with\n * `reloadDocument`, so the client never changes store under a live cache —\n * and adding a value that resolves from the request on the server and from\n * the injected env on the client is how a key stops matching across\n * hydration.\n */\n byLocale: (locale: string) =>\n queryOptions({\n queryKey: translationsQueryKey(locale),\n queryFn: () => translations.get(locale),\n }),\n\n /**\n * This merchant's overrides, cached apart from the platform's copy.\n *\n * Its own entry rather than a wider `byLocale` key, so the common file is\n * fetched and dehydrated once per language whatever the store does, and a\n * store with no overrides never has an entry at all. Both sides compute the\n * key from the settings payload, so the hydrated page finds what the server\n * dehydrated instead of refetching it.\n */\n byStore: (storeId: string | number, locale: string) =>\n queryOptions({\n queryKey: storeTranslationsQueryKey(storeId, locale),\n queryFn: () => translations.forStore(storeId, locale),\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/translations.ts"],"names":[],"mappings":";;;;AAiEA,IAAM,kBAAA,GAAqB,sBAAA;AAGpB,SAAS,uBAAuB,MAAA,EAAwB;AAC7D,EAAA,OAAO,uBAAuB,MAAM,CAAA,KAAA,CAAA;AACtC;AAWO,SAAS,qBAAA,CAAsB,SAA0B,MAAA,EAAwB;AACtF,EAAA,OAAO,CAAA,aAAA,EAAgB,OAAO,CAAA,CAAA,EAAI,MAAM,CAAA,KAAA,CAAA;AAC1C;AAUA,eAAe,eACb,IAAA,EACA,EAAE,aAAa,KAAA,EAAM,GAA8B,EAAC,EAC1B;AAE1B,EAAA,MAAM,UAAA,GAAa,CAAC,MAAA,EAAgB,KAAA,KAA0B;AAC5D,IAAA,IAAI,UAAA,EAAY,MAAM,IAAI,KAAA,CAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,EAAA,EAAK,MAAM,CAAA,CAAA,EAAI,EAAE,KAAA,EAAO,CAAA;AAC9E,IAAA,OAAA,CAAQ,IAAA,CAAK,gBAAA,EAAkB,MAAA,EAAQ,IAAA,EAAM,SAAS,EAAE,CAAA;AACxD,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,QAAA,GAAW,MA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,MAAM,CAAA;AAAA,MACnD,OAAA,EAAS,MAAM,YAAA,CAAa,QAAA,CAAS,SAAS,MAAM;AAAA,KACrD;AAAA;AAEP","file":"chunk-JRM7WGZ7.js","sourcesContent":["/**\n * @fileoverview Where a storefront's words come from.\n *\n * Two files, merged: the platform's copy for this language, and the merchant's\n * own edits for this language and this store. Both are plain JSON objects on\n * the uploader's CDN, one per language.\n *\n * ```\n * https://cdn.files.salla.network/translations/common/<locale>.json the platform's\n * https://cdn.files.salla.network/translations/<storeId>/<locale>.json the merchant's\n * ```\n *\n * **What this replaces, and why.** Until now the engine read a single global\n * file, `cdn.salla.network/js/translations.json`, holding every language keyed\n * `\"<locale>.trans\"`. Nothing publishes that file: it is an object last written\n * on 2026-03-26, carrying only `ar` and `en` where the platform has 39 locales,\n * 405 keys behind `Languages-Module` and 959 English strings textually\n * different from it. So every React storefront has been serving copy from\n * March, and a key added since has never reached one. It also carried no\n * merchant overrides at all — a merchant editing their theme's wording in the\n * Dashboard changed nothing on a React theme.\n *\n * **Merchant overrides are read, and only when there are any.** Getting here\n * took two corrections worth keeping.\n *\n * The first is the address. A merchant's own wording lives at\n * `translations/<storeId>/<locale>.json`, keyed by `store()->getRouteKey()` —\n * the Optimus-encoded numeric id. An early version addressed it with\n * `resolveStoreIdentifier()`, on the claim that the two are the same string.\n * That is true of the `store-identifier` *header*, which accepts a host, a\n * username or an id, and false of the R2 key: on a custom domain the resolver\n * returns `reefperfumes.com` and on a shared host a username like\n * `mtgr-alaatr-2`. Both 404, both then read as \"this store has no overrides\",\n * and the merchant's wording silently never appears — so the feature would have\n * worked under `?storeId=` alone, which is preview and localhost. It is\n * `settings.store.id` now, which is known only after the settings query.\n *\n * The second is when to ask at all. Most stores have never customised a word,\n * and a miss is an uncached round trip (`cf-cache-status: DYNAMIC` on the 404)\n * on the critical path of every SSR render. So the request is made only when\n * `settings.languages[<ISO>].has_custom_translations` says there is something\n * to get — a flag `Languages-Module` writes when a merchant saves a\n * translation. A store without overrides pays nothing, which is what made this\n * shippable at all.\n *\n * ⚠️ The flag is written on save, so a store whose wording predates it reads as\n * `false` until someone edits a translation or the backfill runs. That is a\n * store keeping today's behaviour, not a regression — React themes have never\n * read merchant overrides — but it does mean the feature is only as complete as\n * the backfill.\n *\n * **Rollout is by fallback, not by flag.** `translations/common/` is written by\n * a sync in the theme build service that may not have run yet, and a hard switch\n * would leave every storefront with no platform strings at all. A missing common\n * file therefore falls back to the old global one, which is exactly today's\n * behaviour — so this is safe to ship before the bucket is populated, and stops\n * using the fallback on its own once it is.\n */\nimport { queryOptions } from '@tanstack/react-query';\nimport { cdn, filesCdn } from './client';\nimport { storeTranslationsQueryKey, translationsQueryKey } from './translations-key';\nimport { composeMessages, isPlainObject, type Messages } from './messages';\nimport type { TranslationMessages } from '../providers/I18nProvider';\n\n/** The global file this used to be the only reader of. See the file comment. */\nconst LEGACY_GLOBAL_FILE = 'js/translations.json';\n\n/** One language of platform copy, shared by every store. */\nexport function commonTranslationsPath(locale: string): string {\n return `translations/common/${locale}.json`;\n}\n\n/**\n * One language of a single merchant's own wording.\n *\n * `storeId` is `settings.store.id`, which is the value `Languages-Module` names\n * the object with (`store()->getRouteKey()`, the Optimus-encoded numeric id).\n * It is **not** `resolveStoreIdentifier()`: that returns a hostname on a custom\n * domain and a username on a shared host, both of which 404 here and would read\n * as \"this merchant has no overrides\" — silently, on every store but a preview.\n */\nexport function storeTranslationsPath(storeId: string | number, locale: string): string {\n return `translations/${storeId}/${locale}.json`;\n}\n\n/**\n * Reads one language file, or `null` when there is nothing to read.\n *\n * A 404 is the ordinary answer, not a failure: most stores have never had a\n * word customised, so their file does not exist. Distinguishing it from a real\n * error matters only for the log — both end in `null` — but a warning on every\n * page load of every uncustomised store is a warning nobody will read.\n */\nasync function readLocaleFile(\n path: string,\n { failLoudly = false }: { failLoudly?: boolean } = {}\n): Promise<Messages | null> {\n /** A 404 always means \"absent\"; everything else is a failure to read. */\n const unreadable = (reason: string, cause?: unknown): null => {\n if (failLoudly) throw new Error(`[translations] ${path}: ${reason}`, { cause });\n console.warn('[translations]', reason, path, cause ?? '');\n return null;\n };\n\n try {\n const response = await filesCdn.get(path, { throwHttpErrors: false, timeout: 5000 });\n if (response.status === 404) return null;\n\n if (!response.ok) {\n return unreadable(`answered ${response.status}`);\n }\n\n const data: unknown = await response.json();\n if (!isPlainObject(data)) {\n return unreadable('is not a JSON object');\n }\n\n return data;\n } catch (error) {\n if (error instanceof Error && error.message.startsWith('[translations]')) throw error;\n return unreadable('could not be read', error);\n }\n}\n\n/**\n * The pre-CDN global file, sliced to one language.\n *\n * Only reached when `translations/common/<locale>.json` is missing, which is\n * the state of the bucket until the sync has run once.\n */\nasync function readLegacyGlobal(locale: string): Promise<Messages | null> {\n try {\n const data = await cdn.get(LEGACY_GLOBAL_FILE, { timeout: 5000 }).json<TranslationMessages>();\n const forLocale = data?.[`${locale}.trans`];\n return isPlainObject(forLocale) ? forLocale : null;\n } catch {\n console.warn('[translations] the legacy global file could not be read either');\n return null;\n }\n}\n\nexport const translations = {\n /**\n * The platform's copy for `locale`.\n *\n * One file, so one request. See the file comment for why the merchant's own\n * wording is not merged in here yet and what it is waiting on.\n */\n get: async (locale: string): Promise<TranslationMessages | null> => {\n const common = await readLocaleFile(commonTranslationsPath(locale));\n const base = common ?? (await readLegacyGlobal(locale));\n if (!base) return null;\n\n // Still wrapped in the `<locale>.trans` shape the rest of the engine reads.\n // `createI18nInstance` slices by that key and so does the SDK bridge in\n // `I18nProvider`; changing the envelope here would be a second change for\n // no gain, since one language is all any of them ever take out of it.\n return { [`${locale}.trans`]: base as Record<string, string> };\n },\n\n /**\n * This merchant's own wording for `locale`, or `null` if they have none.\n *\n * Only worth calling when `settings.languages[<ISO>].has_custom_translations`\n * says there is something to get. Most stores have never customised a word,\n * and a miss here is an uncached round trip — `cf-cache-status: DYNAMIC` on a\n * 404 — on the critical path of an SSR render. The flag is what makes this\n * free for everyone who does not use it.\n *\n * Returned unwrapped, unlike {@link translations.get}: this is merged into\n * that one's messages rather than handed to i18next on its own.\n */\n forStore: async (storeId: string | number, locale: string): Promise<Messages | null> =>\n // `failLoudly`, unlike the platform file: this is only ever called because\n // the settings said overrides exist, so a 500, a timeout or a body that is\n // not JSON is a failure to read them — not a store that has none. Returning\n // `null` there would cache \"no overrides\" as a success, skip the query's\n // retry, and serve Salla's wording in place of the merchant's until the\n // entry expired. A 404 still means absent, and `rootBeforeLoad` catches the\n // throw and keeps the platform copy, so the worst case is unchanged.\n readLocaleFile(storeTranslationsPath(storeId, locale), { failLoudly: true }),\n\n /**\n * The platform's copy for `locale` with this merchant's wording laid over it.\n *\n * Takes the two as values rather than fetching them, so the caller decides\n * whether the second request happens at all and both stay separately cached.\n */\n /**\n * The platform's copy for `locale` with this merchant's wording over it.\n *\n * Delegates to `composeMessages`, which every other reader of these two\n * entries also uses — see `api/messages.ts` for why there is exactly one.\n */\n merge: (\n common: TranslationMessages | null,\n overrides: Messages | null,\n locale: string\n ): TranslationMessages | null => composeMessages(common, overrides, locale) ?? null,\n\n queries: {\n /**\n * @param locale taken as an argument rather than read from the twilight\n * context, and that is load-bearing. This key is built on the server, on\n * hydration, and again lazily from the context accessor; if any of the\n * three read a locale the others had not been given yet, the hydrated page\n * would miss the dehydrated entry and refetch both files it was just\n * handed. Every caller already has the locale in hand.\n *\n * The store is deliberately **not** in the key. One document serves one\n * store — a request that names a different one is redirected with\n * `reloadDocument`, so the client never changes store under a live cache —\n * and adding a value that resolves from the request on the server and from\n * the injected env on the client is how a key stops matching across\n * hydration.\n */\n byLocale: (locale: string) =>\n queryOptions({\n queryKey: translationsQueryKey(locale),\n queryFn: () => translations.get(locale),\n }),\n\n /**\n * This merchant's overrides, cached apart from the platform's copy.\n *\n * Its own entry rather than a wider `byLocale` key, so the common file is\n * fetched and dehydrated once per language whatever the store does, and a\n * store with no overrides never has an entry at all. Both sides compute the\n * key from the settings payload, so the hydrated page finds what the server\n * dehydrated instead of refetching it.\n */\n byStore: (storeId: string | number, locale: string) =>\n queryOptions({\n queryKey: storeTranslationsQueryKey(storeId, locale),\n queryFn: () => translations.forStore(storeId, locale),\n }),\n },\n};\n"]}
@@ -184,5 +184,5 @@ function useCanvasHost() {
184
184
  }
185
185
 
186
186
  export { matchBlocks, postToCanvas, takeCanvasCommands, useCanvasHost };
187
- //# sourceMappingURL=chunk-C42YDY5K.js.map
188
- //# sourceMappingURL=chunk-C42YDY5K.js.map
187
+ //# sourceMappingURL=chunk-K7F7ATZO.js.map
188
+ //# sourceMappingURL=chunk-K7F7ATZO.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/live-editor/canvas.ts"],"names":[],"mappings":";;;;;;AAaA,IAAM,KAAA,GAAQ,cAAA;AACd,IAAM,IAAA,GAAO,mBAAA;AAGN,IAAM,cAAA,GAAiB;AAAA,EAC5B,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,4BAAA;AAAA,EACA;AACF,CAAA;AAiCA,IAAM,QAAQ,CAAC,KAAA,KACb,OAAO,KAAA,KAAU,QAAA,IAAY,QAAQ,KAAA,GAAQ,IAAA;AAE/C,IAAM,SAAS,CAAC,KAAA,KACd,UAAU,MAAA,IAAU,KAAA,KAAU,SAAS,KAAA,GAAQ,MAAA;AAEjD,SAAS,SAAS,KAAA,EAAsC;AACtD,EAAA,IAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,GAAG,OAAO,IAAA;AAClC,EAAA,OAAO,KAAA,CAAM,OAAA,CAAQ,CAAC,IAAA,KAAS;AAC7B,IAAA,MAAM,KAAA,GAAQ,IAAA;AACd,IAAA,MAAM,GAAA,GAAM,KAAA,CAAM,KAAA,EAAO,GAAG,CAAA;AAC5B,IAAA,IAAI,CAAC,GAAA,EAAK,OAAO,EAAC;AAClB,IAAA,OAAO;AAAA,MACL;AAAA,QACE,GAAA;AAAA,QACA,KAAK,OAAO,KAAA,EAAO,GAAA,KAAQ,QAAA,GAAW,MAAM,GAAA,GAAM,IAAA;AAAA,QAClD,MAAM,OAAO,KAA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Aa,MAAA,EAAQ,EAAE,IAAA,EAAM,OAAA,EAAS,GAAA,EAAK,CAAC,GAAG,UAAU,CAAA,EAAG,CAAA;AAChF,IAAA,MAAA,CAAO,gBAAA,CAAiB,WAAW,SAAS,CAAA;AAC5C,IAAA,IAAI,QAAA,CAAS,UAAA,KAAe,UAAA,EAAY,KAAA,EAAM;AAAA,gBAClC,gBAAA,CAAiB,MAAA,EAAQ,OAAO,EAAE,IAAA,EAAM,MAAM,CAAA;AAC1D,IAAA,OAAO,MAAM;AACX,MAAA,MAAA,CAAO,mBAAA,CAAoB,WAAW,SAAS,CAAA;AAC/C,MAAA,MAAA,CAAO,mBAAA,CAAoB,QAAQ,KAAK,CAAA;AAAA,IAC1C,CAAA;AAAA,EACF,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,IAAA;AACT","file":"chunk-C42YDY5K.js","sourcesContent":["/**\n * The storefront's side of the design studio's canvas mode: the studio frames\n * the store and draws its own cards and panels, and the store outlines what the\n * merchant points at and reports what is picked. The same `postMessage`\n * protocol the twig themes' `live-themes-editor.js` speaks in canvas mode.\n */\n\nimport { useEffect, useState } from 'react';\nimport { isEditorFrame } from '../../dev/schema-types';\nimport { getTwilightContext } from '../../twilight/context';\nimport { parentOrigin } from './frame';\nimport { drawLiveBlocks } from './moves';\n\nconst CHILD = 'salla-canvas';\nconst HOST = 'salla-canvas-host';\n\n/** Where the studio runs; it alone turns canvas mode on. */\nexport const CANVAS_ORIGINS = [\n 'https://s.salla.sa',\n 'https://s.salla.dev',\n 'https://s.beta.salla.group',\n 'http://localhost:9000',\n] as const;\n\nexport type CanvasRole = 'component' | 'header' | 'footer';\n\n/** The header's or footer's own logo or menu, picked on its own. */\nexport type CanvasPart = 'logo' | 'menu';\n\n/**\n * A home block as the studio lists it, in page order. The storefront's blocks\n * carry no row id, so the studio's list names them: `eid` is what the studio\n * calls the block, matched to the page by its uuid (`key`) or its `slug`.\n */\nexport interface CanvasBlock {\n eid: string;\n key?: string | null;\n slug?: string | null;\n title?: string | null;\n}\n\nexport type CanvasCommand =\n | { type: 'select'; eid: string; part?: CanvasPart }\n | { type: 'deselect' }\n | { type: 'move'; eid: string; direction: 'up' | 'down' }\n /** Lays the blocks out in this order without saving it. */\n | { type: 'order'; eids: string[] };\n\nexport interface CanvasHost {\n /** The studio's origin once it has spoken, else `null`: the page is not in canvas mode. */\n origin: string | null;\n enabled: boolean;\n blocks: CanvasBlock[] | null;\n}\n\nconst asEid = (value: unknown): string | null =>\n typeof value === 'string' && value ? value : null;\n\nconst asPart = (value: unknown): CanvasPart | undefined =>\n value === 'logo' || value === 'menu' ? value : undefined;\n\nfunction asBlocks(value: unknown): CanvasBlock[] | null {\n if (!Array.isArray(value)) return null;\n return value.flatMap((item) => {\n const block = item as Partial<CanvasBlock> | null;\n const eid = asEid(block?.eid);\n if (!eid) return [];\n return [\n {\n eid,\n key: typeof block?.key === 'string' ? block.key : null,\n slug: typeof block?.slug === 'string' ? block.slug : null,\n title: typeof block?.title === 'string' ? block.title : null,\n },\n ];\n });\n}\n\n/** The command a studio message carries, if it is a well-formed one. */\nexport function readCommand(data: Record<string, unknown>): CanvasCommand | null {\n switch (data.type) {\n case 'select': {\n const eid = asEid(data.eid);\n return eid ? { type: 'select', eid, part: asPart(data.part) } : null;\n }\n case 'deselect':\n return { type: 'deselect' };\n case 'move': {\n const eid = asEid(data.eid);\n const direction =\n data.direction === 'up' || data.direction === 'down' ? data.direction : null;\n return eid && direction ? { type: 'move', eid, direction } : null;\n }\n case 'order':\n return Array.isArray(data.eids)\n ? { type: 'order', eids: data.eids.flatMap((eid) => asEid(eid) ?? []) }\n : null;\n default:\n return null;\n }\n}\n\n/** The engine's name for a studio block: its uuid, or its slug spelled as the storefront's path. */\nconst refOf = (block: CanvasBlock): string => block.key || block.slug?.replace(/_/g, '-') || '';\n\n/**\n * The studio block each page block is, by page order: copies of one component\n * share a uuid, so the n-th on the page is the n-th in the list. `refs` are\n * the page blocks' `data-live-block` values; `null` where none matches, and\n * for every copy of a ref the page and the list count differently, where the\n * n-th could be another row.\n */\nexport function matchBlocks(\n refs: readonly string[],\n blocks: readonly CanvasBlock[]\n): (CanvasBlock | null)[] {\n const names = (block: CanvasBlock, ref: string) => block.eid === ref || refOf(block) === ref;\n const used = new Set<number>();\n return refs.map((ref) => {\n const onPage = refs.filter((each) => each === ref).length;\n if (blocks.filter((block) => names(block, ref)).length !== onPage) return null;\n const at = blocks.findIndex((block, index) => !used.has(index) && names(block, ref));\n if (at === -1) return null;\n used.add(at);\n return blocks[at];\n });\n}\n\n/** Sends `message` to the studio, or, before it has spoken, to whichever allowed origin frames the page. */\nexport function postToCanvas(origin: string | null, message: Record<string, unknown>): void {\n const data = { source: CHILD, v: 1, ...message };\n if (origin) {\n window.parent.postMessage(data, origin);\n return;\n }\n let parent: string | null = null;\n try {\n parent = parentOrigin();\n } catch {\n parent = null;\n }\n const targets: readonly string[] = parent ? [parent] : CANVAS_ORIGINS;\n for (const target of targets) {\n if ((CANVAS_ORIGINS as readonly string[]).includes(target))\n window.parent.postMessage(data, target);\n }\n}\n\n/** What the page redraws in place when the studio saves, as `hello` tells it. */\nexport const CANVAS_CAN = ['refresh'] as const;\n\nlet lastDraw: Promise<unknown> = Promise.resolve();\n\n// Under the studio's own wait, so the page answers before the studio gives up on it.\nconst DRAW_LIMIT = 15_000;\n\n/**\n * Draws the home page again from what the studio just saved, without reloading it: its\n * blocks fetched afresh, spelled as the home loader spells them. Fails off the home page.\n */\nexport function redrawPage(): Promise<void> {\n // One at a time: the query cache would hand this save a fetch started before it.\n const draw = lastDraw.then(drawAfresh);\n lastDraw = draw.catch(() => undefined);\n return draw;\n}\n\nasync function drawAfresh(): Promise<void> {\n const { home } = await import('../../api/home');\n const { queryClient } = getTwilightContext();\n const components = home.queries.components();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const tooLong = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n // Its fetch is called off too, or the next redraw would be handed it.\n void queryClient.cancelQueries({ queryKey: components.queryKey });\n reject(new Error('redraw took too long'));\n }, DRAW_LIMIT);\n });\n const blocks = await Promise.race([\n queryClient.fetchQuery({ ...components, staleTime: 0 }),\n tooLong,\n ]).finally(() => clearTimeout(timer));\n const drawn = drawLiveBlocks(\n blocks.map((block) => ({ ...block, path: block.path?.replace('home.', '') || block.path }))\n );\n if (!drawn) throw new Error('no home page');\n}\n\n// Draws the page again for the section the studio saved; false for a refresh that names none.\nfunction refreshFor(studio: string, data: Record<string, unknown>): boolean {\n const eid = asEid(data.eid);\n if (!eid) {\n postToCanvas(studio, { type: 'refresh-failed', eid: String(data.eid ?? '') });\n return false;\n }\n redrawPage().then(\n () => {\n if (data.select === true) deliver({ type: 'select', eid });\n postToCanvas(studio, { type: 'refreshed', eid });\n },\n () => postToCanvas(studio, { type: 'refresh-failed', eid })\n );\n return true;\n}\n\n/** The overlay on screen takes the studio's commands; ones sent before it mounted wait for it. */\nlet handler: ((command: CanvasCommand) => void) | null = null;\nlet queued: CanvasCommand[] = [];\n\nfunction deliver(command: CanvasCommand): void {\n if (handler) handler(command);\n else queued.push(command);\n}\n\n/** Hands the studio's commands to `fn` while it is set, the waiting ones first. */\nexport function takeCanvasCommands(fn: (command: CanvasCommand) => void): () => void {\n handler = fn;\n const waiting = queued;\n queued = [];\n waiting.forEach(fn);\n return () => {\n if (handler === fn) handler = null;\n };\n}\n\n/**\n * Says hello to the studio once the page has loaded, and follows what it asks\n * for. Off for shoppers, for the theme editor (which never answers) and for the\n * engine's own dev editor, which keep the live editor bar.\n */\nexport function useCanvasHost(): CanvasHost {\n const [host, setHost] = useState<CanvasHost>({ origin: null, enabled: false, blocks: null });\n\n useEffect(() => {\n if (window.self === window.top || (import.meta.env.DEV && isEditorFrame())) return;\n let origin: string | null = null;\n\n const onMessage = (event: MessageEvent) => {\n if (event.source !== window.parent) return;\n const data = (event.data ?? {}) as Record<string, unknown>;\n // The studio saved on the server and wants the page drawn again, as the twig preview does.\n if (data.action === 'preview::reload') {\n if (origin && event.origin === origin) window.location.reload();\n return;\n }\n if (data.source !== HOST) return;\n if (!origin) {\n if (!(CANVAS_ORIGINS as readonly string[]).includes(event.origin)) return;\n origin = event.origin;\n } else if (event.origin !== origin) return;\n const studio = origin;\n\n // A section saved: the page is drawn again in place, and the section picked once the studio names it.\n if (data.type === 'refresh') {\n if (refreshFor(studio, data))\n setHost((prev) => (prev.origin ? prev : { ...prev, origin: studio }));\n } else if (data.type === 'enable') {\n const blocks = asBlocks(data.blocks);\n setHost((prev) => ({ origin: studio, enabled: true, blocks: blocks ?? prev.blocks }));\n } else if (data.type === 'disable') {\n queued = [];\n setHost((prev) => ({ ...prev, origin: studio, enabled: false }));\n } else {\n setHost((prev) => (prev.origin ? prev : { ...prev, origin: studio }));\n const command = readCommand(data);\n if (command) deliver(command);\n }\n };\n\n const hello = () => postToCanvas(origin, { type: 'hello', can: [...CANVAS_CAN] });\n window.addEventListener('message', onMessage);\n if (document.readyState === 'complete') hello();\n else window.addEventListener('load', hello, { once: true });\n return () => {\n window.removeEventListener('message', onMessage);\n window.removeEventListener('load', hello);\n };\n }, []);\n\n return host;\n}\n"]}
1
+ {"version":3,"sources":["../src/components/live-editor/canvas.ts"],"names":[],"mappings":";;;;;;AAaA,IAAM,KAAA,GAAQ,cAAA;AACd,IAAM,IAAA,GAAO,mBAAA;AAGN,IAAM,cAAA,GAAiB;AAAA,EAC5B,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA,4BAAA;AAAA,EACA;AACF,CAAA;AAiCA,IAAM,QAAQ,CAAC,KAAA,KACb,OAAO,KAAA,KAAU,QAAA,IAAY,QAAQ,KAAA,GAAQ,IAAA;AAE/C,IAAM,SAAS,CAAC,KAAA,KACd,UAAU,MAAA,IAAU,KAAA,KAAU,SAAS,KAAA,GAAQ,MAAA;AAEjD,SAAS,SAAS,KAAA,EAAsC;AACtD,EAAA,IAAI,CAAC,KAAA,CAAM,OAAA,CAAQ,KAAK,GAAG,OAAO,IAAA;AAClC,EAAA,OAAO,K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AS,KAAA,EAAM,CAAE,CAAA;AAAA,MACjE,CAAA,MAAO;AACL,QAAA,OAAA,CAAQ,CAAC,IAAA,KAAU,IAAA,CAAK,MAAA,GAAS,IAAA,GAAO,EAAE,GAAG,IAAA,EAAM,MAAA,EAAQ,MAAA,EAAS,CAAA;AACpE,QAAA,MAAM,OAAA,GAAU,YAAY,IAAI,CAAA;AAChC,QAAA,IAAI,OAAA,UAAiB,OAAO,CAAA;AAAA,MAC9B;AAAA,IACF,CAAA;AAEA,IAAA,MAAM,KAAA,GAAQ,MAAM,YAAA,CAAa,MAAA,EAAQ,EAAE,IAAA,EAAM,OAAA,EAAS,GAAA,EAAK,CAAC,GAAG,UAAU,CAAA,EAAG,CAAA;AAChF,IAAA,MAAA,CAAO,gBAAA,CAAiB,WAAW,SAAS,CAAA;AAC5C,IAAA,IAAI,QAAA,CAAS,UAAA,KAAe,UAAA,EAAY,KAAA,EAAM;AAAA,gBAClC,gBAAA,CAAiB,MAAA,EAAQ,OAAO,EAAE,IAAA,EAAM,MAAM,CAAA;AAC1D,IAAA,OAAO,MAAM;AACX,MAAA,MAAA,CAAO,mBAAA,CAAoB,WAAW,SAAS,CAAA;AAC/C,MAAA,MAAA,CAAO,mBAAA,CAAoB,QAAQ,KAAK,CAAA;AAAA,IAC1C,CAAA;AAAA,EACF,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,OAAO,IAAA;AACT","file":"chunk-K7F7ATZO.js","sourcesContent":["/**\n * The storefront's side of the design studio's canvas mode: the studio frames\n * the store and draws its own cards and panels, and the store outlines what the\n * merchant points at and reports what is picked. The same `postMessage`\n * protocol the twig themes' `live-themes-editor.js` speaks in canvas mode.\n */\n\nimport { useEffect, useState } from 'react';\nimport { isEditorFrame } from '../../dev/schema-types';\nimport { getTwilightContext } from '../../twilight/context';\nimport { parentOrigin } from './frame';\nimport { drawLiveBlocks } from './moves';\n\nconst CHILD = 'salla-canvas';\nconst HOST = 'salla-canvas-host';\n\n/** Where the studio runs; it alone turns canvas mode on. */\nexport const CANVAS_ORIGINS = [\n 'https://s.salla.sa',\n 'https://s.salla.dev',\n 'https://s.beta.salla.group',\n 'http://localhost:9000',\n] as const;\n\nexport type CanvasRole = 'component' | 'header' | 'footer';\n\n/** The header's or footer's own logo or menu, picked on its own. */\nexport type CanvasPart = 'logo' | 'menu';\n\n/**\n * A home block as the studio lists it, in page order. The storefront's blocks\n * carry no row id, so the studio's list names them: `eid` is what the studio\n * calls the block, matched to the page by its uuid (`key`) or its `slug`.\n */\nexport interface CanvasBlock {\n eid: string;\n key?: string | null;\n slug?: string | null;\n title?: string | null;\n}\n\nexport type CanvasCommand =\n | { type: 'select'; eid: string; part?: CanvasPart }\n | { type: 'deselect' }\n | { type: 'move'; eid: string; direction: 'up' | 'down' }\n /** Lays the blocks out in this order without saving it. */\n | { type: 'order'; eids: string[] };\n\nexport interface CanvasHost {\n /** The studio's origin once it has spoken, else `null`: the page is not in canvas mode. */\n origin: string | null;\n enabled: boolean;\n blocks: CanvasBlock[] | null;\n}\n\nconst asEid = (value: unknown): string | null =>\n typeof value === 'string' && value ? value : null;\n\nconst asPart = (value: unknown): CanvasPart | undefined =>\n value === 'logo' || value === 'menu' ? value : undefined;\n\nfunction asBlocks(value: unknown): CanvasBlock[] | null {\n if (!Array.isArray(value)) return null;\n return value.flatMap((item) => {\n const block = item as Partial<CanvasBlock> | null;\n const eid = asEid(block?.eid);\n if (!eid) return [];\n return [\n {\n eid,\n key: typeof block?.key === 'string' ? block.key : null,\n slug: typeof block?.slug === 'string' ? block.slug : null,\n title: typeof block?.title === 'string' ? block.title : null,\n },\n ];\n });\n}\n\n/** The command a studio message carries, if it is a well-formed one. */\nexport function readCommand(data: Record<string, unknown>): CanvasCommand | null {\n switch (data.type) {\n case 'select': {\n const eid = asEid(data.eid);\n return eid ? { type: 'select', eid, part: asPart(data.part) } : null;\n }\n case 'deselect':\n return { type: 'deselect' };\n case 'move': {\n const eid = asEid(data.eid);\n const direction =\n data.direction === 'up' || data.direction === 'down' ? data.direction : null;\n return eid && direction ? { type: 'move', eid, direction } : null;\n }\n case 'order':\n return Array.isArray(data.eids)\n ? { type: 'order', eids: data.eids.flatMap((eid) => asEid(eid) ?? []) }\n : null;\n default:\n return null;\n }\n}\n\n/** The engine's name for a studio block: its uuid, or its slug spelled as the storefront's path. */\nconst refOf = (block: CanvasBlock): string => block.key || block.slug?.replace(/_/g, '-') || '';\n\n/**\n * The studio block each page block is, by page order: copies of one component\n * share a uuid, so the n-th on the page is the n-th in the list. `refs` are\n * the page blocks' `data-live-block` values; `null` where none matches, and\n * for every copy of a ref the page and the list count differently, where the\n * n-th could be another row.\n */\nexport function matchBlocks(\n refs: readonly string[],\n blocks: readonly CanvasBlock[]\n): (CanvasBlock | null)[] {\n const names = (block: CanvasBlock, ref: string) => block.eid === ref || refOf(block) === ref;\n const used = new Set<number>();\n return refs.map((ref) => {\n const onPage = refs.filter((each) => each === ref).length;\n if (blocks.filter((block) => names(block, ref)).length !== onPage) return null;\n const at = blocks.findIndex((block, index) => !used.has(index) && names(block, ref));\n if (at === -1) return null;\n used.add(at);\n return blocks[at];\n });\n}\n\n/** Sends `message` to the studio, or, before it has spoken, to whichever allowed origin frames the page. */\nexport function postToCanvas(origin: string | null, message: Record<string, unknown>): void {\n const data = { source: CHILD, v: 1, ...message };\n if (origin) {\n window.parent.postMessage(data, origin);\n return;\n }\n let parent: string | null = null;\n try {\n parent = parentOrigin();\n } catch {\n parent = null;\n }\n const targets: readonly string[] = parent ? [parent] : CANVAS_ORIGINS;\n for (const target of targets) {\n if ((CANVAS_ORIGINS as readonly string[]).includes(target))\n window.parent.postMessage(data, target);\n }\n}\n\n/** What the page redraws in place when the studio saves, as `hello` tells it. */\nexport const CANVAS_CAN = ['refresh'] as const;\n\nlet lastDraw: Promise<unknown> = Promise.resolve();\n\n// Under the studio's own wait, so the page answers before the studio gives up on it.\nconst DRAW_LIMIT = 15_000;\n\n/**\n * Draws the home page again from what the studio just saved, without reloading it: its\n * blocks fetched afresh, spelled as the home loader spells them. Fails off the home page.\n */\nexport function redrawPage(): Promise<void> {\n // One at a time: the query cache would hand this save a fetch started before it.\n const draw = lastDraw.then(drawAfresh);\n lastDraw = draw.catch(() => undefined);\n return draw;\n}\n\nasync function drawAfresh(): Promise<void> {\n const { home } = await import('../../api/home');\n const { queryClient } = getTwilightContext();\n const components = home.queries.components();\n let timer: ReturnType<typeof setTimeout> | undefined;\n const tooLong = new Promise<never>((_, reject) => {\n timer = setTimeout(() => {\n // Its fetch is called off too, or the next redraw would be handed it.\n void queryClient.cancelQueries({ queryKey: components.queryKey });\n reject(new Error('redraw took too long'));\n }, DRAW_LIMIT);\n });\n const blocks = await Promise.race([\n queryClient.fetchQuery({ ...components, staleTime: 0 }),\n tooLong,\n ]).finally(() => clearTimeout(timer));\n const drawn = drawLiveBlocks(\n blocks.map((block) => ({ ...block, path: block.path?.replace('home.', '') || block.path }))\n );\n if (!drawn) throw new Error('no home page');\n}\n\n// Draws the page again for the section the studio saved; false for a refresh that names none.\nfunction refreshFor(studio: string, data: Record<string, unknown>): boolean {\n const eid = asEid(data.eid);\n if (!eid) {\n postToCanvas(studio, { type: 'refresh-failed', eid: String(data.eid ?? '') });\n return false;\n }\n redrawPage().then(\n () => {\n if (data.select === true) deliver({ type: 'select', eid });\n postToCanvas(studio, { type: 'refreshed', eid });\n },\n () => postToCanvas(studio, { type: 'refresh-failed', eid })\n );\n return true;\n}\n\n/** The overlay on screen takes the studio's commands; ones sent before it mounted wait for it. */\nlet handler: ((command: CanvasCommand) => void) | null = null;\nlet queued: CanvasCommand[] = [];\n\nfunction deliver(command: CanvasCommand): void {\n if (handler) handler(command);\n else queued.push(command);\n}\n\n/** Hands the studio's commands to `fn` while it is set, the waiting ones first. */\nexport function takeCanvasCommands(fn: (command: CanvasCommand) => void): () => void {\n handler = fn;\n const waiting = queued;\n queued = [];\n waiting.forEach(fn);\n return () => {\n if (handler === fn) handler = null;\n };\n}\n\n/**\n * Says hello to the studio once the page has loaded, and follows what it asks\n * for. Off for shoppers, for the theme editor (which never answers) and for the\n * engine's own dev editor, which keep the live editor bar.\n */\nexport function useCanvasHost(): CanvasHost {\n const [host, setHost] = useState<CanvasHost>({ origin: null, enabled: false, blocks: null });\n\n useEffect(() => {\n if (window.self === window.top || (import.meta.env.DEV && isEditorFrame())) return;\n let origin: string | null = null;\n\n const onMessage = (event: MessageEvent) => {\n if (event.source !== window.parent) return;\n const data = (event.data ?? {}) as Record<string, unknown>;\n // The studio saved on the server and wants the page drawn again, as the twig preview does.\n if (data.action === 'preview::reload') {\n if (origin && event.origin === origin) window.location.reload();\n return;\n }\n if (data.source !== HOST) return;\n if (!origin) {\n if (!(CANVAS_ORIGINS as readonly string[]).includes(event.origin)) return;\n origin = event.origin;\n } else if (event.origin !== origin) return;\n const studio = origin;\n\n // A section saved: the page is drawn again in place, and the section picked once the studio names it.\n if (data.type === 'refresh') {\n if (refreshFor(studio, data))\n setHost((prev) => (prev.origin ? prev : { ...prev, origin: studio }));\n } else if (data.type === 'enable') {\n const blocks = asBlocks(data.blocks);\n setHost((prev) => ({ origin: studio, enabled: true, blocks: blocks ?? prev.blocks }));\n } else if (data.type === 'disable') {\n queued = [];\n setHost((prev) => ({ ...prev, origin: studio, enabled: false }));\n } else {\n setHost((prev) => (prev.origin ? prev : { ...prev, origin: studio }));\n const command = readCommand(data);\n if (command) deliver(command);\n }\n };\n\n const hello = () => postToCanvas(origin, { type: 'hello', can: [...CANVAS_CAN] });\n window.addEventListener('message', onMessage);\n if (document.readyState === 'complete') hello();\n else window.addEventListener('load', hello, { once: true });\n return () => {\n window.removeEventListener('message', onMessage);\n window.removeEventListener('load', hello);\n };\n }, []);\n\n return host;\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { registry } from './chunk-Y32RHCOH.js';
2
- import { useMoney, useNumber } from './chunk-I6EEFDD2.js';
2
+ import { useMoney, useNumber } from './chunk-RZNFP6GR.js';
3
3
  import { useAsset } from './chunk-Z653O7MX.js';
4
4
  import { useWishlist } from './chunk-DVJGKIFQ.js';
5
5
  import { useTranslation } from './chunk-TYNZ5B2B.js';
@@ -229,5 +229,5 @@ var ProductCard = memo(function ProductCard2(props) {
229
229
  });
230
230
 
231
231
  export { ProductCard };
232
- //# sourceMappingURL=chunk-NWT2ZWNM.js.map
233
- //# sourceMappingURL=chunk-NWT2ZWNM.js.map
232
+ //# sourceMappingURL=chunk-KAB5TEFM.js.map
233
+ //# sourceMappingURL=chunk-KAB5TEFM.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/product/ProductCard.tsx"],"names":["ProductCardContent","ProductCard"],"mappings":";;;;;;;;;;;;;AAcA,IAAM,gBAAA,GAAmB,cAAA;AAEzB,IAAM,2BAAA,GAA8B,CAAC,GAAA,EAAK,GAAA,EAAK,KAAK,GAAG,CAAA;AAEvD,IAAM,mBAAA,GAAsB,+BAAA;AAE5B,IAAM,wBAAA,GAA2B,iCAAA;AAoCjC,IAAM,kBAAA,GAAqB,IAAA,CAAK,SAASA,mBAAAA,CAAmB;AAAA,EAC1D,OAAA;AAAA,EACA,MAAA,GAAS,UAAA;AAAA,EACT,SAAA,GAAY,EAAA;AAAA,EACZ,UAAA,GAAa,KAAA;AAAA,EACb,YAAA,GAAe,KAAA;AAAA,EACf,gBAAA,GAAmB,KAAA;AAAA,EACnB,KAAA,GAAQ,CAAA;AAAA,EACR,aAAA,GAAgB,KAAA;AAAA,EAChB;AACF,CAAA,EAAqB;AACnB,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,QAAA,EAAS;AAC5B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,EAAE,KAAA,EAAO,KAAA,EAAM,GAAI,WAAA,EAAY;AACrC,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,QAAA,EAAS;AACnC,EAAA,MAAM,EAAE,MAAA,EAAQ,YAAA,EAAa,GAAI,SAAA,EAAU;AA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L,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,uBAAO,GAAA,CAAC,SAAA,EAAA,EAAW,GAAG,KAAA,EAAO,CAAA;AAAA,EAC/B;AAEA,EAAA,uBAAO,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA;AACxC,CAAC","file":"chunk-NWT2ZWNM.js","sourcesContent":["import { memo, useCallback, useMemo } from 'react';\nimport { SallaAddProductButton } from '@salla.sa/twilight-components-react/add-product-button';\nimport { SallaButton } from '@salla.sa/twilight-components-react/button';\nimport { useHostAttributes } from '@salla.sa/twilight-theme-engine/hooks/useHostAttributes';\nimport { useMoney } from '../../hooks/useMoney';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useWishlist } from '../../hooks/useWishlist';\nimport { useAsset } from '../../hooks/useAsset';\nimport { useNumber } from '../../hooks/useNumber';\nimport { registry } from '../ComponentRegistry';\nimport { Image } from '../common';\nimport type { Product } from '../../types';\n\nconst PRODUCT_CARD_KEY = 'product:card';\n\nconst PRODUCT_IMAGE_SRCSET_WIDTHS = [150, 300, 450, 600] as const;\n/** Matches `.s-products-list-vertical-cards`: 2-col below 768px, 4-col above. */\nconst PRODUCT_IMAGE_SIZES = '(min-width: 768px) 25vw, 50vw';\n/** fullImage / minimal slots in FeaturedProductsStyle3 (`lg:grid-cols-2`). */\nconst PRODUCT_WIDE_IMAGE_SIZES = '(min-width: 1024px) 50vw, 100vw';\n\n/** Product card layout variants - mutually exclusive */\nexport type ProductCardLayout = 'vertical' | 'horizontal' | 'fullImage' | 'minimal' | 'special';\n\nexport interface ProductCardProps {\n product: Product;\n layout?: ProductCardLayout;\n className?: string;\n withShadow?: boolean;\n withQuantity?: boolean;\n withoutAddButton?: boolean;\n index?: number;\n imagePriority?: boolean;\n /** Overrides the layout-based image `sizes` hint. */\n sizes?: string;\n}\n\n/**\n * ProductCard - Displays a product in various layouts\n *\n * Layouts:\n * - vertical: Default card with image top, content bottom\n * - horizontal: Side-by-side image and content\n * - fullImage: Full bleed image with overlay content\n * - minimal: Compact version with reduced info\n * - special: Featured card with quantity pie chart\n *\n * Features:\n * - Native lazy loading for images\n * - Product badges (promotion, preorder, quantity, out of stock)\n * - Wishlist toggle button\n * - Price display (sale, starting, regular)\n * - Rating display\n * - Add to cart button via SallaAddProductButton (handles labels internally)\n */\nconst ProductCardContent = memo(function ProductCardContent({\n product,\n layout = 'vertical',\n className = '',\n withShadow = false,\n withQuantity = false,\n withoutAddButton = false,\n index = 0,\n imagePriority = false,\n sizes,\n}: ProductCardProps) {\n const { format } = useMoney();\n const { t } = useTranslation();\n const { store, theme } = useTwilight();\n const wishlist = useWishlist();\n const { isPlaceholder } = useAsset();\n const { format: formatNumber } = useNumber();\n\n // Out-of-stock cards offer \"notify me when available\" instead of a dead button, unless\n // the merchant switched `notify_when_available_in_card` off (Twig theme-raed parity).\n const notifyInCard = theme?.settings?.notify_when_available_in_card !== false;\n const addButtonStatus =\n notifyInCard &&\n product.is_out_of_stock &&\n product.type !== 'donating' &&\n product.type !== 'financial_support'\n ? 'out-and-notify'\n : product.status;\n\n const addButtonRef = useHostAttributes({ fill: 'outline', width: 'wide' });\n\n // Layout flags\n const isVertical = layout === 'vertical';\n const isHorizontal = layout === 'horizontal';\n const isFullImage = layout === 'fullImage';\n const isMinimal = layout === 'minimal';\n const isSpecial = layout === 'special';\n\n // Wishlist status\n const productInWishlist = wishlist.has(Number(product.id));\n const handleWishlistToggle = useCallback(() => {\n wishlist.toggle(Number(product.id));\n }, [wishlist, product.id]);\n\n // Get image fit type from store settings\n const fitImageHeight = store?.settings?.product?.fit_type;\n\n // Product badge component\n const getProductBadge = () => {\n if (product?.preorder?.label && typeof product.preorder.label === 'string') {\n return <div className=\"s-product-card-promotion-title\">{product.preorder.label}</div>;\n }\n if (product.promotion_title) {\n return <div className=\"s-product-card-promotion-title\">{product.promotion_title}</div>;\n }\n if (withQuantity && product?.quantity) {\n const formattedQty = formatNumber(product.quantity);\n return (\n <div className=\"s-product-card-quantity\">\n {t('pages.products.remained', 'Remained')} {formattedQty}\n </div>\n );\n }\n if (withQuantity && product?.is_out_of_stock) {\n return (\n <div className=\"s-product-card-out-badge\">\n {t('pages.products.out_of_stock', 'Out of Stock')}\n </div>\n );\n }\n return null;\n };\n\n // Price display component\n const getProductPrice = () => {\n if (product.is_on_sale && product.sale_price) {\n return (\n <div className=\"s-product-card-sale-price\">\n <h4>{format(product.sale_price)}</h4>\n {product.regular_price && <span>{format(product.regular_price)}</span>}\n </div>\n );\n }\n if (product.starting_price) {\n return (\n <div className=\"s-product-card-starting-price\">\n <p>{t('pages.products.starting_price', 'Starting from')}</p>\n <h4>{format(product.starting_price)}</h4>\n </div>\n );\n }\n return <h4 className=\"s-product-card-price\">{format(product.price)}</h4>;\n };\n\n // Build card class names\n const cardClassName = [\n 's-product-card',\n 's-product-card-entry',\n isVertical ? 's-product-card-vertical' : '',\n isHorizontal ? 's-product-card-horizontal' : '',\n // As Twig's card: the store's unified image height sizes horizontal cards too.\n fitImageHeight && (isVertical || isHorizontal) ? `s-product-card-fit-height` : '',\n isSpecial ? 's-product-card-special' : '',\n isFullImage ? 's-product-card-full-image' : '',\n isMinimal ? 's-product-card-minimal' : '',\n product?.donation ? 's-product-card-donation' : '',\n withShadow ? 's-product-card-shadow' : '',\n product?.is_out_of_stock ? 's-product-card-out-of-stock' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n // Image fit class\n const isProductPlaceholder = isPlaceholder(product.image?.url);\n const imageFitClass = isProductPlaceholder ? 'contain' : fitImageHeight || 'cover';\n\n return (\n <div\n id={`product-card-${product.id}`}\n className={cardClassName}\n data-product-id={product.id}\n style={{\n animationDelay: `${index * 100}ms`,\n }}\n >\n <div className={isFullImage ? 's-product-card-image-full' : 's-product-card-image'}>\n <a href={product.url} aria-label={product.image?.alt || product.name}>\n <Image\n className={`s-product-card-image-${imageFitClass}`}\n src={product.image?.url}\n alt={product.image?.alt ?? product.name}\n width={300}\n height={300}\n sizes={\n sizes ?? (isFullImage || isMinimal ? PRODUCT_WIDE_IMAGE_SIZES : PRODUCT_IMAGE_SIZES)\n }\n srcSetWidths={PRODUCT_IMAGE_SRCSET_WIDTHS}\n aspectRatio=\"1/1\"\n priority={imagePriority}\n />\n {!isFullImage && !isMinimal && getProductBadge()}\n </a>\n {isFullImage && (\n <a href={product.url} aria-label={product.name} className=\"s-product-card-overlay\" />\n )}\n {!isHorizontal && !isFullImage && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n <div className=\"s-product-card-content\">\n {/* Special card: quantity pie */}\n {isSpecial && product?.quantity && (\n <div className=\"s-product-card-content-pie\">\n <span>\n <b>{formatNumber(product.quantity)}</b>\n {t('pages.products.remained', 'Remained')}\n </span>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-2 -1 36 34\"\n className=\"s-product-card-content-pie-svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n )}\n\n <div\n className={`s-product-card-content-main ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n <h3 className=\"s-product-card-content-title\">\n <a href={product.url}>{product.name}</a>\n </h3>\n {product.subtitle && !isMinimal && (\n <p className=\"s-product-card-content-subtitle opacity-80\">{product.subtitle}</p>\n )}\n </div>\n\n <div\n className={`s-product-card-content-sub ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n {!product?.donation?.can_donate && getProductPrice()}\n {product.rating?.stars && (\n <div className=\"s-product-card-rating\">\n <i className=\"sicon-star2 text-orange-300\" />\n <span>{product.rating.stars}</span>\n </div>\n )}\n </div>\n\n {!withoutAddButton && (\n <div className=\"s-product-card-content-footer gap-2\">\n <SallaAddProductButton\n ref={addButtonRef}\n fill=\"outline\"\n width=\"wide\"\n productId={product.id}\n productStatus={addButtonStatus}\n productType={product.type}\n hasPreOrder={product.has_preorder_campaign}\n />\n {(isHorizontal || isFullImage) && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n )}\n </div>\n </div>\n );\n});\n\nexport const ProductCard = memo(function ProductCard(props: ProductCardProps) {\n const Component = useMemo(() => {\n const hasOverride = registry.getOriginal<ProductCardProps>(PRODUCT_CARD_KEY) !== null;\n if (hasOverride) {\n return registry.resolve<ProductCardProps>(PRODUCT_CARD_KEY);\n }\n return null;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductCardContent {...props} />;\n});\n\nexport default ProductCard;\n"]}
1
+ {"version":3,"sources":["../src/components/product/ProductCard.tsx"],"names":["ProductCardContent","ProductCard"],"mappings":";;;;;;;;;;;;;AAcA,IAAM,gBAAA,GAAmB,cAAA;AAEzB,IAAM,2BAAA,GAA8B,CAAC,GAAA,EAAK,GAAA,EAAK,KAAK,GAAG,CAAA;AAEvD,IAAM,mBAAA,GAAsB,+BAAA;AAE5B,IAAM,wBAAA,GAA2B,iCAAA;AAoCjC,IAAM,kBAAA,GAAqB,IAAA,CAAK,SAASA,mBAAAA,CAAmB;AAAA,EAC1D,OAAA;AAAA,EACA,MAAA,GAAS,UAAA;AAAA,EACT,SAAA,GAAY,EAAA;AAAA,EACZ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A,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,aAAA,EAAc;AAAA;AAAA;AAC7B,WAAA,EAEJ;AAAA,SAAA,EAEJ;AAAA;AAAA;AAAA,GACF;AAEJ,CAAC,CAAA;AAEM,IAAM,WAAA,GAAc,IAAA,CAAK,SAASC,YAAAA,CAAY,KAAA,EAAyB;AAC5E,EAAA,MAAM,SAAA,GAAY,QAAQ,MAAM;AAC9B,IAAA,MAAM,WAAA,GAAc,QAAA,CAAS,WAAA,CAA8B,gBAAgB,CAAA,KAAM,IAAA;AACjF,IAAA,IAAI,WAAA,EAAa;AACf,MAAA,OAAO,QAAA,CAAS,QAA0B,gBAAgB,CAAA;AAAA,IAC5D;AACA,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,uBAAO,GAAA,CAAC,SAAA,EAAA,EAAW,GAAG,KAAA,EAAO,CAAA;AAAA,EAC/B;AAEA,EAAA,uBAAO,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA;AACxC,CAAC","file":"chunk-KAB5TEFM.js","sourcesContent":["import { memo, useCallback, useMemo } from 'react';\nimport { SallaAddProductButton } from '@salla.sa/twilight-components-react/add-product-button';\nimport { SallaButton } from '@salla.sa/twilight-components-react/button';\nimport { useHostAttributes } from '@salla.sa/twilight-theme-engine/hooks/useHostAttributes';\nimport { useMoney } from '../../hooks/useMoney';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useWishlist } from '../../hooks/useWishlist';\nimport { useAsset } from '../../hooks/useAsset';\nimport { useNumber } from '../../hooks/useNumber';\nimport { registry } from '../ComponentRegistry';\nimport { Image } from '../common';\nimport type { Product } from '../../types';\n\nconst PRODUCT_CARD_KEY = 'product:card';\n\nconst PRODUCT_IMAGE_SRCSET_WIDTHS = [150, 300, 450, 600] as const;\n/** Matches `.s-products-list-vertical-cards`: 2-col below 768px, 4-col above. */\nconst PRODUCT_IMAGE_SIZES = '(min-width: 768px) 25vw, 50vw';\n/** fullImage / minimal slots in FeaturedProductsStyle3 (`lg:grid-cols-2`). */\nconst PRODUCT_WIDE_IMAGE_SIZES = '(min-width: 1024px) 50vw, 100vw';\n\n/** Product card layout variants - mutually exclusive */\nexport type ProductCardLayout = 'vertical' | 'horizontal' | 'fullImage' | 'minimal' | 'special';\n\nexport interface ProductCardProps {\n product: Product;\n layout?: ProductCardLayout;\n className?: string;\n withShadow?: boolean;\n withQuantity?: boolean;\n withoutAddButton?: boolean;\n index?: number;\n imagePriority?: boolean;\n /** Overrides the layout-based image `sizes` hint. */\n sizes?: string;\n}\n\n/**\n * ProductCard - Displays a product in various layouts\n *\n * Layouts:\n * - vertical: Default card with image top, content bottom\n * - horizontal: Side-by-side image and content\n * - fullImage: Full bleed image with overlay content\n * - minimal: Compact version with reduced info\n * - special: Featured card with quantity pie chart\n *\n * Features:\n * - Native lazy loading for images\n * - Product badges (promotion, preorder, quantity, out of stock)\n * - Wishlist toggle button\n * - Price display (sale, starting, regular)\n * - Rating display\n * - Add to cart button via SallaAddProductButton (handles labels internally)\n */\nconst ProductCardContent = memo(function ProductCardContent({\n product,\n layout = 'vertical',\n className = '',\n withShadow = false,\n withQuantity = false,\n withoutAddButton = false,\n index = 0,\n imagePriority = false,\n sizes,\n}: ProductCardProps) {\n const { format } = useMoney();\n const { t } = useTranslation();\n const { store, theme } = useTwilight();\n const wishlist = useWishlist();\n const { isPlaceholder } = useAsset();\n const { format: formatNumber } = useNumber();\n\n // Out-of-stock cards offer \"notify me when available\" instead of a dead button, unless\n // the merchant switched `notify_when_available_in_card` off (Twig theme-raed parity).\n const notifyInCard = theme?.settings?.notify_when_available_in_card !== false;\n const addButtonStatus =\n notifyInCard &&\n product.is_out_of_stock &&\n product.type !== 'donating' &&\n product.type !== 'financial_support'\n ? 'out-and-notify'\n : product.status;\n\n const addButtonRef = useHostAttributes({ fill: 'outline', width: 'wide' });\n\n // Layout flags\n const isVertical = layout === 'vertical';\n const isHorizontal = layout === 'horizontal';\n const isFullImage = layout === 'fullImage';\n const isMinimal = layout === 'minimal';\n const isSpecial = layout === 'special';\n\n // Wishlist status\n const productInWishlist = wishlist.has(Number(product.id));\n const handleWishlistToggle = useCallback(() => {\n wishlist.toggle(Number(product.id));\n }, [wishlist, product.id]);\n\n // Get image fit type from store settings\n const fitImageHeight = store?.settings?.product?.fit_type;\n\n // Product badge component\n const getProductBadge = () => {\n if (product?.preorder?.label && typeof product.preorder.label === 'string') {\n return <div className=\"s-product-card-promotion-title\">{product.preorder.label}</div>;\n }\n if (product.promotion_title) {\n return <div className=\"s-product-card-promotion-title\">{product.promotion_title}</div>;\n }\n if (withQuantity && product?.quantity) {\n const formattedQty = formatNumber(product.quantity);\n return (\n <div className=\"s-product-card-quantity\">\n {t('pages.products.remained', 'Remained')} {formattedQty}\n </div>\n );\n }\n if (withQuantity && product?.is_out_of_stock) {\n return (\n <div className=\"s-product-card-out-badge\">\n {t('pages.products.out_of_stock', 'Out of Stock')}\n </div>\n );\n }\n return null;\n };\n\n // Price display component\n const getProductPrice = () => {\n if (product.is_on_sale && product.sale_price) {\n return (\n <div className=\"s-product-card-sale-price\">\n <h4>{format(product.sale_price)}</h4>\n {product.regular_price && <span>{format(product.regular_price)}</span>}\n </div>\n );\n }\n if (product.starting_price) {\n return (\n <div className=\"s-product-card-starting-price\">\n <p>{t('pages.products.starting_price', 'Starting from')}</p>\n <h4>{format(product.starting_price)}</h4>\n </div>\n );\n }\n return <h4 className=\"s-product-card-price\">{format(product.price)}</h4>;\n };\n\n // Build card class names\n const cardClassName = [\n 's-product-card',\n 's-product-card-entry',\n isVertical ? 's-product-card-vertical' : '',\n isHorizontal ? 's-product-card-horizontal' : '',\n // As Twig's card: the store's unified image height sizes horizontal cards too.\n fitImageHeight && (isVertical || isHorizontal) ? `s-product-card-fit-height` : '',\n isSpecial ? 's-product-card-special' : '',\n isFullImage ? 's-product-card-full-image' : '',\n isMinimal ? 's-product-card-minimal' : '',\n product?.donation ? 's-product-card-donation' : '',\n withShadow ? 's-product-card-shadow' : '',\n product?.is_out_of_stock ? 's-product-card-out-of-stock' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n // Image fit class\n const isProductPlaceholder = isPlaceholder(product.image?.url);\n const imageFitClass = isProductPlaceholder ? 'contain' : fitImageHeight || 'cover';\n\n return (\n <div\n id={`product-card-${product.id}`}\n className={cardClassName}\n data-product-id={product.id}\n style={{\n animationDelay: `${index * 100}ms`,\n }}\n >\n <div className={isFullImage ? 's-product-card-image-full' : 's-product-card-image'}>\n <a href={product.url} aria-label={product.image?.alt || product.name}>\n <Image\n className={`s-product-card-image-${imageFitClass}`}\n src={product.image?.url}\n alt={product.image?.alt ?? product.name}\n width={300}\n height={300}\n sizes={\n sizes ?? (isFullImage || isMinimal ? PRODUCT_WIDE_IMAGE_SIZES : PRODUCT_IMAGE_SIZES)\n }\n srcSetWidths={PRODUCT_IMAGE_SRCSET_WIDTHS}\n aspectRatio=\"1/1\"\n priority={imagePriority}\n />\n {!isFullImage && !isMinimal && getProductBadge()}\n </a>\n {isFullImage && (\n <a href={product.url} aria-label={product.name} className=\"s-product-card-overlay\" />\n )}\n {!isHorizontal && !isFullImage && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n <div className=\"s-product-card-content\">\n {/* Special card: quantity pie */}\n {isSpecial && product?.quantity && (\n <div className=\"s-product-card-content-pie\">\n <span>\n <b>{formatNumber(product.quantity)}</b>\n {t('pages.products.remained', 'Remained')}\n </span>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-2 -1 36 34\"\n className=\"s-product-card-content-pie-svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n )}\n\n <div\n className={`s-product-card-content-main ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n <h3 className=\"s-product-card-content-title\">\n <a href={product.url}>{product.name}</a>\n </h3>\n {product.subtitle && !isMinimal && (\n <p className=\"s-product-card-content-subtitle opacity-80\">{product.subtitle}</p>\n )}\n </div>\n\n <div\n className={`s-product-card-content-sub ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n {!product?.donation?.can_donate && getProductPrice()}\n {product.rating?.stars && (\n <div className=\"s-product-card-rating\">\n <i className=\"sicon-star2 text-orange-300\" />\n <span>{product.rating.stars}</span>\n </div>\n )}\n </div>\n\n {!withoutAddButton && (\n <div className=\"s-product-card-content-footer gap-2\">\n <SallaAddProductButton\n ref={addButtonRef}\n fill=\"outline\"\n width=\"wide\"\n productId={product.id}\n productStatus={addButtonStatus}\n productType={product.type}\n hasPreOrder={product.has_preorder_campaign}\n />\n {(isHorizontal || isFullImage) && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n )}\n </div>\n </div>\n );\n});\n\nexport const ProductCard = memo(function ProductCard(props: ProductCardProps) {\n const Component = useMemo(() => {\n const hasOverride = registry.getOriginal<ProductCardProps>(PRODUCT_CARD_KEY) !== null;\n if (hasOverride) {\n return registry.resolve<ProductCardProps>(PRODUCT_CARD_KEY);\n }\n return null;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductCardContent {...props} />;\n});\n\nexport default ProductCard;\n"]}
@@ -1,4 +1,4 @@
1
- import { advertisement, advertisementsFor } from './chunk-NEMLRRIS.js';
1
+ import { advertisement, advertisementsFor } from './chunk-G4CSD4PD.js';
2
2
  import { useTranslation } from './chunk-TYNZ5B2B.js';
3
3
  import { whenSallaReady } from './chunk-MZPX4EPS.js';
4
4
  import { subscribeTwilight, getTwilightContext } from './chunk-MWUAHDQL.js';
@@ -99,5 +99,5 @@ function PageAdvertisements() {
99
99
  }
100
100
 
101
101
  export { PageAdvertisements };
102
- //# sourceMappingURL=chunk-JPZTLP7F.js.map
103
- //# sourceMappingURL=chunk-JPZTLP7F.js.map
102
+ //# sourceMappingURL=chunk-L7B7TS4R.js.map
103
+ //# sourceMappingURL=chunk-L7B7TS4R.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/layout/PageAdvertisements.tsx"],"names":[],"mappings":";;;;;;;;AAOA,IAAM,eAAA,GAAkB,MAAM,kBAAA,EAAmB,CAAE,IAAA,EAAM,IAAA;AAGzD,IAAM,YAAA,GAAe,CAAC,EAAA,KAAe,CAAA,SAAA,EAAY,EAAE,CAAA,CAAA;AAGnD,IAAM,SAA0B,EAAC;AAGjC,IAAM,qBAAA,GACJ,uPAAA;AAEF,SAAS,YAAY,EAAA,EAAqB;AACxC,EAAA,IAAI;AACF,IAAA,OAAO,QAAQ,MAAA,CAAO,YAAA,CAAa,QAAQ,YAAA,CAAa,EAAE,CAAC,CAAC,CAAA;AAAA,EAC9D,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,KAAA;AAAA,EACT;AACF;AAEA,SAAS,QAAQ,EAAA,EAAkB;AACjC,EAAA,MAAM,OAAA,GAAU,OAAO,KAAA,EAAO,OAAA;AAC9B,EAAA,IAAI,OAAO,SAAS,GAAA,KAAQ,UAAA,UAAoB,GAAA,CAAI,YAAA,CAAa,EAAE,CAAA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A,EAAU,4EAAA,EACb,QAAA,EAAA;AAAA,0BAAA,IAAA,CAAC,MAAA,EAAA,EAAK,WAAU,mEAAA,EAEd,QAAA,EAAA;AAAA,4BAAA,GAAA;AAAA,cAAC,GAAA;AAAA,cAAA;AAAA,gBACC,SAAA,EAAW,CAAA,sEAAA,EAAyE,EAAA,CAAG,IAAA,IAAQ,EAAE,CAAA;AAAA;AAAA,aACnG;AAAA,YACC,GAAG,GAAA,mBACF,GAAA;AAAA,cAAC,GAAA;AAAA,cAAA;AAAA,gBACC,MAAM,EAAA,CAAG,GAAA;AAAA,gBACT,MAAA,EAAQ,GAAG,MAAA,IAAU,MAAA;AAAA,gBACrB,GAAA,EAAK,EAAA,CAAG,MAAA,KAAW,QAAA,GAAW,UAAA,GAAa,MAAA;AAAA,gBAE1C,QAAA,EAAA,EAAA,CAAG;AAAA;AAAA,gBAGN,EAAA,CAAG;AAAA,WAAA,EAEP,CAAA;AAAA,0BACA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,IAAA,EAAK,QAAA;AAAA,cACL,SAAA,EAAU,6BAAA;AAAA,cACV,YAAA,EAAY,CAAA,CAAE,sBAAA,EAAwB,OAAO,CAAA;AAAA,cAC7C,OAAA,EAAS,MAAM,KAAA,CAAM,EAAA,CAAG,EAAE,CAAA;AAAA,cAG1B,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,2BAAA,EAA4B;AAAA;AAAA;AAC3C,SAAA,EACF;AAAA,OAAA;AAAA,MAhCK,EAAA,CAAG;AAAA,KAkCX,CAAA;AAAA,oBACD,GAAA,CAAC,QAAA,EAAA,EAAO,wBAAA,EAAwB,IAAA,EAAE,QAAA,EAAA,qBAAA,EAAsB;AAAA,GAAA,EAC1D,CAAA;AAEJ","file":"chunk-JPZTLP7F.js","sourcesContent":["import { useEffect, useState, useSyncExternalStore } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { advertisement, advertisementsFor, type Advertisement } from '../../api/advertisement';\nimport { whenSallaReady } from '../../utils/sdk-helpers';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { getTwilightContext, subscribeTwilight } from '../../twilight/context';\n\nconst currentPageSlug = () => getTwilightContext().page?.slug;\n\n/** The key `<salla-advertisement>` marks a closed ad with, through `salla.storage` (store.js, JSON). */\nconst dismissedKey = (id: number) => `statusAd-${id}`;\n\n/** Stable while the query has no data, so the effect below doesn't rerun on every render. */\nconst NO_ADS: Advertisement[] = [];\n\n/** Hides the ads this visitor closed before the first paint; the effect then drops them. */\nconst HIDE_DISMISSED_SCRIPT =\n \"(function(){try{if(window.self!==window.top)return;document.currentScript.parentNode.querySelectorAll('.s-advertisement[data-id]').forEach(function(e){if(localStorage.getItem('statusAd-'+e.getAttribute('data-id')))e.hidden=true})}catch(e){}})();\";\n\nfunction isDismissed(id: number): boolean {\n try {\n return Boolean(window.localStorage.getItem(dismissedKey(id)));\n } catch {\n return false;\n }\n}\n\nfunction dismiss(id: number): void {\n const storage = window.salla?.storage;\n if (typeof storage?.set === 'function') storage.set(dismissedKey(id), 'dismissed');\n else {\n try {\n window.localStorage.setItem(dismissedKey(id), JSON.stringify('dismissed'));\n } catch {\n // Storage disabled: the ad hides for this page view only.\n }\n }\n}\n\ninterface ClientView {\n /** The theme editor's iframe, or the SDK's debug flag: every ad shows, closed or not. */\n preview: boolean;\n /** Inside the Salla mobile app, which shows no ads. */\n inApp: boolean;\n dismissed: Set<number>;\n}\n\n/**\n * The merchant's announcement bars, in place of `<salla-advertisement>`. Same data, rules and\n * markup, but rendered on the server (the ads are prefetched in the root `beforeLoad`), so the\n * bar is in the first paint instead of pushing the page down when the web component fetches it.\n */\nexport function PageAdvertisements() {\n const { t } = useTranslation();\n // The deepest route loader's `page`, the page `salla.config` reports.\n const pageSlug = useSyncExternalStore(subscribeTwilight, currentPageSlug, currentPageSlug);\n // The query's `retry: 0` only bounds the server wait; the browser may retry.\n const { data: ads = NO_ADS } = useQuery({ ...advertisement.queries.list(), retry: 2 });\n const [view, setView] = useState<ClientView | null>(null);\n\n useEffect(() => {\n const dismissed = new Set(ads.filter((ad) => isDismissed(ad.id)).map((ad) => ad.id));\n setView({ preview: window.self !== window.top, inApp: false, dismissed });\n return whenSallaReady((sdk) => {\n const config = sdk.config as { isMobileApp?: () => boolean; isDebug?: () => boolean };\n const inApp = Boolean(config?.isMobileApp?.());\n const debug = Boolean(config?.isDebug?.());\n if (inApp || debug) {\n setView((current) =>\n current ? { ...current, inApp, preview: current.preview || debug } : current\n );\n }\n });\n }, [ads]);\n\n if (view?.inApp) return null;\n const shown = view?.preview\n ? ads\n : advertisementsFor(ads, pageSlug).filter((ad) => !view?.dismissed.has(ad.id));\n if (!shown.length) return null;\n\n const close = (id: number) => {\n dismiss(id);\n setView((current) =>\n current ? { ...current, dismissed: new Set(current.dismissed).add(id) } : current\n );\n };\n\n return (\n <>\n {shown.map((ad) => (\n <div\n key={ad.id}\n className=\"s-advertisement\"\n data-id={ad.id}\n style={{ backgroundColor: ad.colors?.bg, color: ad.colors?.text }}\n >\n <div className=\"s-advertisement-content container flex justify-between items-center py-2.5\">\n <span className=\"s-advertisement-content-main flex-1 font-bold text-center text-sm\">\n {/* Rendered without an icon too, as the SDK does: its margin is part of the layout. */}\n <i\n className={`s-advertisement-content-icon inline-block align-middle me-2 text-base ${ad.icon ?? ''}`}\n />\n {ad.url ? (\n <a\n href={ad.url}\n target={ad.target ?? undefined}\n rel={ad.target === '_blank' ? 'noopener' : undefined}\n >\n {ad.description}\n </a>\n ) : (\n ad.description\n )}\n </span>\n <button\n type=\"button\"\n className=\"s-advertisement-action px-1\"\n aria-label={t('common.buttons.close', 'Close')}\n onClick={() => close(ad.id)}\n >\n {/* `inline-block`: before the icon CSS loads, an empty inline `<i>` leaves the button 0px tall. */}\n <i className=\"sicon-cancel inline-block\" />\n </button>\n </div>\n </div>\n ))}\n <script suppressHydrationWarning>{HIDE_DISMISSED_SCRIPT}</script>\n </>\n );\n}\n"]}
1
+ {"version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CAAA;AAAA,0BACA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,IAAA,EAAK,QAAA;AAAA,cACL,SAAA,EAAU,6BAAA;AAAA,cACV,YAAA,EAAY,CAAA,CAAE,sBAAA,EAAwB,OAAO,CAAA;AAAA,cAC7C,OAAA,EAAS,MAAM,KAAA,CAAM,EAAA,CAAG,EAAE,CAAA;AAAA,cAG1B,QAAA,kBAAA,GAAA,CAAC,GAAA,EAAA,EAAE,SAAA,EAAU,2BAAA,EAA4B;AAAA;AAAA;AAC3C,SAAA,EACF;AAAA,OAAA;AAAA,MAhCK,EAAA,CAAG;AAAA,KAkCX,CAAA;AAAA,oBACD,GAAA,CAAC,QAAA,EAAA,EAAO,wBAAA,EAAwB,IAAA,EAAE,QAAA,EAAA,qBAAA,EAAsB;AAAA,GAAA,EAC1D,CAAA;AAEJ","file":"chunk-L7B7TS4R.js","sourcesContent":["import { useEffect, useState, useSyncExternalStore } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { advertisement, advertisementsFor, type Advertisement } from '../../api/advertisement';\nimport { whenSallaReady } from '../../utils/sdk-helpers';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { getTwilightContext, subscribeTwilight } from '../../twilight/context';\n\nconst currentPageSlug = () => getTwilightContext().page?.slug;\n\n/** The key `<salla-advertisement>` marks a closed ad with, through `salla.storage` (store.js, JSON). */\nconst dismissedKey = (id: number) => `statusAd-${id}`;\n\n/** Stable while the query has no data, so the effect below doesn't rerun on every render. */\nconst NO_ADS: Advertisement[] = [];\n\n/** Hides the ads this visitor closed before the first paint; the effect then drops them. */\nconst HIDE_DISMISSED_SCRIPT =\n \"(function(){try{if(window.self!==window.top)return;document.currentScript.parentNode.querySelectorAll('.s-advertisement[data-id]').forEach(function(e){if(localStorage.getItem('statusAd-'+e.getAttribute('data-id')))e.hidden=true})}catch(e){}})();\";\n\nfunction isDismissed(id: number): boolean {\n try {\n return Boolean(window.localStorage.getItem(dismissedKey(id)));\n } catch {\n return false;\n }\n}\n\nfunction dismiss(id: number): void {\n const storage = window.salla?.storage;\n if (typeof storage?.set === 'function') storage.set(dismissedKey(id), 'dismissed');\n else {\n try {\n window.localStorage.setItem(dismissedKey(id), JSON.stringify('dismissed'));\n } catch {\n // Storage disabled: the ad hides for this page view only.\n }\n }\n}\n\ninterface ClientView {\n /** The theme editor's iframe, or the SDK's debug flag: every ad shows, closed or not. */\n preview: boolean;\n /** Inside the Salla mobile app, which shows no ads. */\n inApp: boolean;\n dismissed: Set<number>;\n}\n\n/**\n * The merchant's announcement bars, in place of `<salla-advertisement>`. Same data, rules and\n * markup, but rendered on the server (the ads are prefetched in the root `beforeLoad`), so the\n * bar is in the first paint instead of pushing the page down when the web component fetches it.\n */\nexport function PageAdvertisements() {\n const { t } = useTranslation();\n // The deepest route loader's `page`, the page `salla.config` reports.\n const pageSlug = useSyncExternalStore(subscribeTwilight, currentPageSlug, currentPageSlug);\n // The query's `retry: 0` only bounds the server wait; the browser may retry.\n const { data: ads = NO_ADS } = useQuery({ ...advertisement.queries.list(), retry: 2 });\n const [view, setView] = useState<ClientView | null>(null);\n\n useEffect(() => {\n const dismissed = new Set(ads.filter((ad) => isDismissed(ad.id)).map((ad) => ad.id));\n setView({ preview: window.self !== window.top, inApp: false, dismissed });\n return whenSallaReady((sdk) => {\n const config = sdk.config as { isMobileApp?: () => boolean; isDebug?: () => boolean };\n const inApp = Boolean(config?.isMobileApp?.());\n const debug = Boolean(config?.isDebug?.());\n if (inApp || debug) {\n setView((current) =>\n current ? { ...current, inApp, preview: current.preview || debug } : current\n );\n }\n });\n }, [ads]);\n\n if (view?.inApp) return null;\n const shown = view?.preview\n ? ads\n : advertisementsFor(ads, pageSlug).filter((ad) => !view?.dismissed.has(ad.id));\n if (!shown.length) return null;\n\n const close = (id: number) => {\n dismiss(id);\n setView((current) =>\n current ? { ...current, dismissed: new Set(current.dismissed).add(id) } : current\n );\n };\n\n return (\n <>\n {shown.map((ad) => (\n <div\n key={ad.id}\n className=\"s-advertisement\"\n data-id={ad.id}\n style={{ backgroundColor: ad.colors?.bg, color: ad.colors?.text }}\n >\n <div className=\"s-advertisement-content container flex justify-between items-center py-2.5\">\n <span className=\"s-advertisement-content-main flex-1 font-bold text-center text-sm\">\n {/* Rendered without an icon too, as the SDK does: its margin is part of the layout. */}\n <i\n className={`s-advertisement-content-icon inline-block align-middle me-2 text-base ${ad.icon ?? ''}`}\n />\n {ad.url ? (\n <a\n href={ad.url}\n target={ad.target ?? undefined}\n rel={ad.target === '_blank' ? 'noopener' : undefined}\n >\n {ad.description}\n </a>\n ) : (\n ad.description\n )}\n </span>\n <button\n type=\"button\"\n className=\"s-advertisement-action px-1\"\n aria-label={t('common.buttons.close', 'Close')}\n onClick={() => close(ad.id)}\n >\n {/* `inline-block`: before the icon CSS loads, an empty inline `<i>` leaves the button 0px tall. */}\n <i className=\"sicon-cancel inline-block\" />\n </button>\n </div>\n </div>\n ))}\n <script suppressHydrationWarning>{HIDE_DISMISSED_SCRIPT}</script>\n </>\n );\n}\n"]}
@@ -2,7 +2,7 @@ import { lazyComponent } from './chunk-VYGA5AT5.js';
2
2
 
3
3
  // src/components/common/lazy.ts
4
4
  var LazyBreadcrumb = lazyComponent(
5
- () => import('./Breadcrumb-XA7NJB3I.js').then((m) => ({ default: m.Breadcrumb }))
5
+ () => import('./Breadcrumb-OHEBG52R.js').then((m) => ({ default: m.Breadcrumb }))
6
6
  );
7
7
  var LazyNoContent = lazyComponent(
8
8
  () => import('./NoContent-7YUWEXI2.js').then((m) => ({ default: m.NoContent }))
@@ -18,5 +18,5 @@ var LazyErrorPage = lazyComponent(
18
18
  );
19
19
 
20
20
  export { LazyBreadcrumb, LazyCurrencySymbol, LazyErrorPage, LazyNoContent, LazyRenderWhenVisible };
21
- //# sourceMappingURL=chunk-Z4D5KQK5.js.map
22
- //# sourceMappingURL=chunk-Z4D5KQK5.js.map
21
+ //# sourceMappingURL=chunk-M6ASPT2Y.js.map
22
+ //# sourceMappingURL=chunk-M6ASPT2Y.js.map