@salla.sa/twilight-theme-engine 1.0.201 → 1.0.203

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 (261) hide show
  1. package/dist/{AddToCartForm-QKWVLTBW.js → AddToCartForm-6FMKWZ6T.js} +3 -3
  2. package/dist/{AddToCartForm-QKWVLTBW.js.map → AddToCartForm-6FMKWZ6T.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-2P3SSPUG.js → BlogAuthorPage-LX2G6ACQ.js} +19 -19
  4. package/dist/{BlogAuthorPage-2P3SSPUG.js.map → BlogAuthorPage-LX2G6ACQ.js.map} +1 -1
  5. package/dist/{BlogCategoryPage-O4FONWNB.js → BlogCategoryPage-YKZUJDOH.js} +19 -19
  6. package/dist/{BlogCategoryPage-O4FONWNB.js.map → BlogCategoryPage-YKZUJDOH.js.map} +1 -1
  7. package/dist/{BlogPage-CTF7WLKJ.js → BlogPage-PGNI7AH2.js} +17 -17
  8. package/dist/{BlogPage-CTF7WLKJ.js.map → BlogPage-PGNI7AH2.js.map} +1 -1
  9. package/dist/{BlogSinglePage-J5LGILUJ.js → BlogSinglePage-J35SDJ7Z.js} +17 -17
  10. package/dist/{BlogSinglePage-J5LGILUJ.js.map → BlogSinglePage-J35SDJ7Z.js.map} +1 -1
  11. package/dist/{BlogTagPage-KI3DWCLR.js → BlogTagPage-7DPI7CFX.js} +19 -19
  12. package/dist/{BlogTagPage-KI3DWCLR.js.map → BlogTagPage-7DPI7CFX.js.map} +1 -1
  13. package/dist/{BrandsPage-T5E2ON7N.js → BrandsPage-IXHS2NLZ.js} +18 -18
  14. package/dist/{BrandsPage-T5E2ON7N.js.map → BrandsPage-IXHS2NLZ.js.map} +1 -1
  15. package/dist/{Breadcrumb-TZFTOJYJ.js → Breadcrumb-F7YU3LCH.js} +17 -17
  16. package/dist/{Breadcrumb-TZFTOJYJ.js.map → Breadcrumb-F7YU3LCH.js.map} +1 -1
  17. package/dist/{CanvasOverlay-P7UGA42D.js → CanvasOverlay-65WZ3VPB.js} +3 -3
  18. package/dist/{CanvasOverlay-P7UGA42D.js.map → CanvasOverlay-65WZ3VPB.js.map} +1 -1
  19. package/dist/{CartItem-YRJYCZKA.js → CartItem-KKSCIQOG.js} +17 -17
  20. package/dist/{CartItem-YRJYCZKA.js.map → CartItem-KKSCIQOG.js.map} +1 -1
  21. package/dist/{CartSummary-45CL5JNP.js → CartSummary-YO6CY7GX.js} +17 -17
  22. package/dist/{CartSummary-45CL5JNP.js.map → CartSummary-YO6CY7GX.js.map} +1 -1
  23. package/dist/{Copyright-NUK5DSTO.js → Copyright-Q6T4OOG2.js} +3 -3
  24. package/dist/{Copyright-NUK5DSTO.js.map → Copyright-Q6T4OOG2.js.map} +1 -1
  25. package/dist/{CustomerLayout-ZXIAB7OL.js → CustomerLayout-HV4IGBAR.js} +17 -17
  26. package/dist/{CustomerLayout-ZXIAB7OL.js.map → CustomerLayout-HV4IGBAR.js.map} +1 -1
  27. package/dist/{Footer-GCVCCELN.js → Footer-SVJT3UAP.js} +3 -3
  28. package/dist/{Footer-GCVCCELN.js.map → Footer-SVJT3UAP.js.map} +1 -1
  29. package/dist/GoogleTag-4IUBSGDQ.js +15 -0
  30. package/dist/{GoogleTag-X5FQ66HX.js.map → GoogleTag-4IUBSGDQ.js.map} +1 -1
  31. package/dist/{Header-CBQ6A2QA.js → Header-HKN42YHL.js} +8 -8
  32. package/dist/{Header-CBQ6A2QA.js.map → Header-HKN42YHL.js.map} +1 -1
  33. package/dist/{LatestProducts-56AWELL4.js → LatestProducts-5G3TECJX.js} +19 -19
  34. package/dist/{LatestProducts-56AWELL4.js.map → LatestProducts-5G3TECJX.js.map} +1 -1
  35. package/dist/{LoyaltyPage-2Y572TZS.js → LoyaltyPage-ZFOD7SIT.js} +17 -17
  36. package/dist/{LoyaltyPage-2Y572TZS.js.map → LoyaltyPage-ZFOD7SIT.js.map} +1 -1
  37. package/dist/{LoyaltyPointsPage-LBLGLPAX.js → LoyaltyPointsPage-V67LM3UF.js} +6 -6
  38. package/dist/{LoyaltyPointsPage-LBLGLPAX.js.map → LoyaltyPointsPage-V67LM3UF.js.map} +1 -1
  39. package/dist/{MainMenu-IPOFN526.js → MainMenu-7F4UK4WB.js} +5 -5
  40. package/dist/{MainMenu-IPOFN526.js.map → MainMenu-7F4UK4WB.js.map} +1 -1
  41. package/dist/{MasterLayout-3KX4U3I7.js → MasterLayout-GRP2MPD6.js} +17 -17
  42. package/dist/{MasterLayout-3KX4U3I7.js.map → MasterLayout-GRP2MPD6.js.map} +1 -1
  43. package/dist/{MobileMenu-VIVDXZYY.js → MobileMenu-VAAQ43S6.js} +18 -18
  44. package/dist/{MobileMenu-VIVDXZYY.js.map → MobileMenu-VAAQ43S6.js.map} +1 -1
  45. package/dist/{NotificationsPage-7RM3H7WH.js → NotificationsPage-ERCQPECE.js} +17 -17
  46. package/dist/{NotificationsPage-7RM3H7WH.js.map → NotificationsPage-ERCQPECE.js.map} +1 -1
  47. package/dist/{OrderSinglePage-XZJAVECC.js → OrderSinglePage-43G324LB.js} +18 -18
  48. package/dist/{OrderSinglePage-XZJAVECC.js.map → OrderSinglePage-43G324LB.js.map} +1 -1
  49. package/dist/{OrdersPage-VUSR6V7N.js → OrdersPage-5ZBHBH6W.js} +17 -17
  50. package/dist/{OrdersPage-VUSR6V7N.js.map → OrdersPage-5ZBHBH6W.js.map} +1 -1
  51. package/dist/{PageSingle-DUZG4Z3S.js → PageSingle-45Z5EU5E.js} +3 -3
  52. package/dist/{PageSingle-DUZG4Z3S.js.map → PageSingle-45Z5EU5E.js.map} +1 -1
  53. package/dist/{ProductDetails-T6LNC4YC.js → ProductDetails-YD45MKRJ.js} +5 -5
  54. package/dist/{ProductDetails-T6LNC4YC.js.map → ProductDetails-YD45MKRJ.js.map} +1 -1
  55. package/dist/{ProfilePage-D3WFYS4I.js → ProfilePage-QB2D2NCO.js} +17 -17
  56. package/dist/{ProfilePage-D3WFYS4I.js.map → ProfilePage-QB2D2NCO.js.map} +1 -1
  57. package/dist/{ReviewsPage-PSALNGGX.js → ReviewsPage-LTGLXDVL.js} +3 -3
  58. package/dist/{ReviewsPage-PSALNGGX.js.map → ReviewsPage-LTGLXDVL.js.map} +1 -1
  59. package/dist/{SeoCartWidget-AF765NXF.js → SeoCartWidget-TCLBMX75.js} +17 -17
  60. package/dist/{SeoCartWidget-AF765NXF.js.map → SeoCartWidget-TCLBMX75.js.map} +1 -1
  61. package/dist/{SettingsPage-PRTXSWWO.js → SettingsPage-P6IACFWB.js} +17 -17
  62. package/dist/{SettingsPage-PRTXSWWO.js.map → SettingsPage-P6IACFWB.js.map} +1 -1
  63. package/dist/{StoreClosedNotification-4XJJD6EH.js → StoreClosedNotification-TBTT2KU2.js} +18 -18
  64. package/dist/{StoreClosedNotification-4XJJD6EH.js.map → StoreClosedNotification-TBTT2KU2.js.map} +1 -1
  65. package/dist/{TestimonialsPage-MVVZ76SC.js → TestimonialsPage-OVNNDMCX.js} +3 -3
  66. package/dist/{TestimonialsPage-MVVZ76SC.js.map → TestimonialsPage-OVNNDMCX.js.map} +1 -1
  67. package/dist/{ThankYouPage-HQ2RKCKL.js → ThankYouPage-I2BRD7QC.js} +17 -17
  68. package/dist/{ThankYouPage-HQ2RKCKL.js.map → ThankYouPage-I2BRD7QC.js.map} +1 -1
  69. package/dist/{WalletPage-LUT6BJRE.js → WalletPage-PRJDQLR3.js} +18 -18
  70. package/dist/{WalletPage-LUT6BJRE.js.map → WalletPage-PRJDQLR3.js.map} +1 -1
  71. package/dist/{WebMcpTools-UQ5TLWW4.js → WebMcpTools-UCY4IWDN.js} +5 -5
  72. package/dist/{WebMcpTools-UQ5TLWW4.js.map → WebMcpTools-UCY4IWDN.js.map} +1 -1
  73. package/dist/{WishlistPage-652AECE3.js → WishlistPage-NRUSXP32.js} +20 -20
  74. package/dist/WishlistPage-NRUSXP32.js.map +1 -0
  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-FJOWV33K.js → chunk-2EEIMTU7.js} +4 -4
  97. package/dist/{chunk-FJOWV33K.js.map → chunk-2EEIMTU7.js.map} +1 -1
  98. package/dist/{chunk-QZGV5ZW2.js → chunk-2LOLKRMT.js} +3 -3
  99. package/dist/{chunk-QZGV5ZW2.js.map → chunk-2LOLKRMT.js.map} +1 -1
  100. package/dist/{chunk-ESBRE4IP.js → chunk-3AEHPT4C.js} +3 -3
  101. package/dist/{chunk-ESBRE4IP.js.map → chunk-3AEHPT4C.js.map} +1 -1
  102. package/dist/{chunk-XLRDRMNJ.js → chunk-3ZUWSJVH.js} +4 -4
  103. package/dist/{chunk-XLRDRMNJ.js.map → chunk-3ZUWSJVH.js.map} +1 -1
  104. package/dist/{chunk-3DEZHSCO.js → chunk-467XYJGK.js} +4 -4
  105. package/dist/{chunk-3DEZHSCO.js.map → chunk-467XYJGK.js.map} +1 -1
  106. package/dist/{chunk-QQYTK5X2.js → chunk-77EKLFWG.js} +3 -3
  107. package/dist/{chunk-QQYTK5X2.js.map → chunk-77EKLFWG.js.map} +1 -1
  108. package/dist/{chunk-ZTW6GPAG.js → chunk-7R4SNM3G.js} +3 -3
  109. package/dist/{chunk-ZTW6GPAG.js.map → chunk-7R4SNM3G.js.map} +1 -1
  110. package/dist/{chunk-ACBPZSGI.js → chunk-A764QYEF.js} +4 -4
  111. package/dist/{chunk-ACBPZSGI.js.map → chunk-A764QYEF.js.map} +1 -1
  112. package/dist/{chunk-GDRTCJHN.js → chunk-BEQBNADR.js} +4 -4
  113. package/dist/{chunk-GDRTCJHN.js.map → chunk-BEQBNADR.js.map} +1 -1
  114. package/dist/{chunk-5HWVLLHT.js → chunk-CUIQQKVP.js} +5 -5
  115. package/dist/{chunk-5HWVLLHT.js.map → chunk-CUIQQKVP.js.map} +1 -1
  116. package/dist/{chunk-IGOV6HIE.js → chunk-DV6FY3F3.js} +7 -7
  117. package/dist/{chunk-IGOV6HIE.js.map → chunk-DV6FY3F3.js.map} +1 -1
  118. package/dist/{chunk-3XBNN6OL.js → chunk-FA57RGWU.js} +4 -4
  119. package/dist/{chunk-3XBNN6OL.js.map → chunk-FA57RGWU.js.map} +1 -1
  120. package/dist/{chunk-ENI2ZQ2D.js → chunk-FDNUH4RX.js} +3 -3
  121. package/dist/{chunk-ENI2ZQ2D.js.map → chunk-FDNUH4RX.js.map} +1 -1
  122. package/dist/{chunk-ZIIPOZDI.js → chunk-FJQPEXR5.js} +5 -5
  123. package/dist/{chunk-ZIIPOZDI.js.map → chunk-FJQPEXR5.js.map} +1 -1
  124. package/dist/{chunk-TQSP663S.js → chunk-GBZBG3VU.js} +3 -3
  125. package/dist/{chunk-TQSP663S.js.map → chunk-GBZBG3VU.js.map} +1 -1
  126. package/dist/{chunk-C6YZCPLN.js → chunk-H6ISS5WL.js} +7 -7
  127. package/dist/{chunk-C6YZCPLN.js.map → chunk-H6ISS5WL.js.map} +1 -1
  128. package/dist/{chunk-ADTOK3DS.js → chunk-HEDPG2B5.js} +4 -4
  129. package/dist/{chunk-ADTOK3DS.js.map → chunk-HEDPG2B5.js.map} +1 -1
  130. package/dist/{chunk-GGIB56FK.js → chunk-HJKJVBYI.js} +2 -2
  131. package/dist/{chunk-GGIB56FK.js.map → chunk-HJKJVBYI.js.map} +1 -1
  132. package/dist/{chunk-KS6NZ2W4.js → chunk-IA3CVVAC.js} +3 -3
  133. package/dist/{chunk-KS6NZ2W4.js.map → chunk-IA3CVVAC.js.map} +1 -1
  134. package/dist/{chunk-4LA7PENM.js → chunk-IB2POFG7.js} +3 -3
  135. package/dist/{chunk-4LA7PENM.js.map → chunk-IB2POFG7.js.map} +1 -1
  136. package/dist/{chunk-UDX7RVCF.js → chunk-IBGFKAHH.js} +4 -4
  137. package/dist/{chunk-UDX7RVCF.js.map → chunk-IBGFKAHH.js.map} +1 -1
  138. package/dist/{chunk-MRXJG2SZ.js → chunk-INCVJ6LJ.js} +4 -4
  139. package/dist/{chunk-MRXJG2SZ.js.map → chunk-INCVJ6LJ.js.map} +1 -1
  140. package/dist/{chunk-6RR3OXAF.js → chunk-IWECQPA3.js} +6 -6
  141. package/dist/{chunk-6RR3OXAF.js.map → chunk-IWECQPA3.js.map} +1 -1
  142. package/dist/{chunk-J3BVDSZB.js → chunk-J5BV3OJC.js} +5 -5
  143. package/dist/{chunk-J3BVDSZB.js.map → chunk-J5BV3OJC.js.map} +1 -1
  144. package/dist/{chunk-FFGAHJTO.js → chunk-JK2FVL6U.js} +3 -3
  145. package/dist/{chunk-FFGAHJTO.js.map → chunk-JK2FVL6U.js.map} +1 -1
  146. package/dist/{chunk-5E4YYPWS.js → chunk-JLPOORYB.js} +3 -3
  147. package/dist/{chunk-5E4YYPWS.js.map → chunk-JLPOORYB.js.map} +1 -1
  148. package/dist/{chunk-ZH3OMIUU.js → chunk-JLVYQBHV.js} +4 -4
  149. package/dist/{chunk-ZH3OMIUU.js.map → chunk-JLVYQBHV.js.map} +1 -1
  150. package/dist/{chunk-ICD5UHUM.js → chunk-LNJUQ2S6.js} +3 -3
  151. package/dist/{chunk-ICD5UHUM.js.map → chunk-LNJUQ2S6.js.map} +1 -1
  152. package/dist/{chunk-LM2BNMAO.js → chunk-LPGCUQGP.js} +4 -4
  153. package/dist/{chunk-LM2BNMAO.js.map → chunk-LPGCUQGP.js.map} +1 -1
  154. package/dist/{chunk-R5N7UED2.js → chunk-MRBNEIHQ.js} +29 -21
  155. package/dist/chunk-MRBNEIHQ.js.map +1 -0
  156. package/dist/{chunk-AVLMBTYR.js → chunk-N7Y6ODZM.js} +3 -3
  157. package/dist/{chunk-AVLMBTYR.js.map → chunk-N7Y6ODZM.js.map} +1 -1
  158. package/dist/{chunk-AAY2IYNR.js → chunk-NNMFEKSI.js} +4 -4
  159. package/dist/{chunk-AAY2IYNR.js.map → chunk-NNMFEKSI.js.map} +1 -1
  160. package/dist/{chunk-YC57NEKJ.js → chunk-OJERROHX.js} +4 -4
  161. package/dist/{chunk-YC57NEKJ.js.map → chunk-OJERROHX.js.map} +1 -1
  162. package/dist/{chunk-OB5SYNGI.js → chunk-ORW2SKDM.js} +3 -3
  163. package/dist/{chunk-OB5SYNGI.js.map → chunk-ORW2SKDM.js.map} +1 -1
  164. package/dist/{chunk-IPWBT53T.js → chunk-OSTF5LXJ.js} +4 -4
  165. package/dist/{chunk-IPWBT53T.js.map → chunk-OSTF5LXJ.js.map} +1 -1
  166. package/dist/{chunk-YSY76O6D.js → chunk-OT4UEO5H.js} +4 -4
  167. package/dist/{chunk-YSY76O6D.js.map → chunk-OT4UEO5H.js.map} +1 -1
  168. package/dist/{chunk-C2LUCXC3.js → chunk-PGM5R2XW.js} +3 -3
  169. package/dist/{chunk-C2LUCXC3.js.map → chunk-PGM5R2XW.js.map} +1 -1
  170. package/dist/{chunk-KSS2R2GP.js → chunk-QRTQQF2M.js} +3 -3
  171. package/dist/{chunk-KSS2R2GP.js.map → chunk-QRTQQF2M.js.map} +1 -1
  172. package/dist/{chunk-HFTJGEY3.js → chunk-R2PIKS37.js} +3 -3
  173. package/dist/{chunk-HFTJGEY3.js.map → chunk-R2PIKS37.js.map} +1 -1
  174. package/dist/{chunk-MXZRRFH6.js → chunk-SFMOOU6Z.js} +3 -3
  175. package/dist/{chunk-MXZRRFH6.js.map → chunk-SFMOOU6Z.js.map} +1 -1
  176. package/dist/{chunk-GLLSF6E2.js → chunk-SHIZAN54.js} +3 -3
  177. package/dist/{chunk-GLLSF6E2.js.map → chunk-SHIZAN54.js.map} +1 -1
  178. package/dist/{chunk-BP3MT6EB.js → chunk-SIQ563AO.js} +15 -14
  179. package/dist/chunk-SIQ563AO.js.map +1 -0
  180. package/dist/{chunk-D7WHE6WS.js → chunk-SUKNOJBZ.js} +4 -4
  181. package/dist/{chunk-D7WHE6WS.js.map → chunk-SUKNOJBZ.js.map} +1 -1
  182. package/dist/{chunk-CKJSF5LT.js → chunk-W5ARKYF2.js} +7 -7
  183. package/dist/{chunk-CKJSF5LT.js.map → chunk-W5ARKYF2.js.map} +1 -1
  184. package/dist/{chunk-YBJXKRJZ.js → chunk-WFXRDHF5.js} +3 -3
  185. package/dist/{chunk-YBJXKRJZ.js.map → chunk-WFXRDHF5.js.map} +1 -1
  186. package/dist/{chunk-34PFF37E.js → chunk-WUC4UYYL.js} +5 -5
  187. package/dist/{chunk-34PFF37E.js.map → chunk-WUC4UYYL.js.map} +1 -1
  188. package/dist/{chunk-M65FJR7E.js → chunk-XR7TECRL.js} +3 -3
  189. package/dist/{chunk-M65FJR7E.js.map → chunk-XR7TECRL.js.map} +1 -1
  190. package/dist/{chunk-GLLJCRRP.js → chunk-YKP4BFVK.js} +3 -3
  191. package/dist/{chunk-GLLJCRRP.js.map → chunk-YKP4BFVK.js.map} +1 -1
  192. package/dist/{chunk-5P2ZVC6Z.js → chunk-Z5DX5AXM.js} +3 -3
  193. package/dist/{chunk-5P2ZVC6Z.js.map → chunk-Z5DX5AXM.js.map} +1 -1
  194. package/dist/{chunk-L7UP3N7O.js → chunk-ZE2L2PAA.js} +37 -9
  195. package/dist/chunk-ZE2L2PAA.js.map +1 -0
  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-332EZARK.js → custom-urls-GRYQ2CLS.js} +7 -7
  205. package/dist/{custom-urls-332EZARK.js.map → custom-urls-GRYQ2CLS.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-PDL2FCQG.js → document-class-YA2Z4FVP.js} +17 -17
  209. package/dist/{document-class-PDL2FCQG.js.map → document-class-YA2Z4FVP.js.map} +1 -1
  210. package/dist/hooks/index.js +15 -15
  211. package/dist/hooks/useGtm.d.ts.map +1 -1
  212. package/dist/hooks/useGtm.js +15 -15
  213. package/dist/hooks/useMoney.js +15 -15
  214. package/dist/hooks/useStore.js +15 -15
  215. package/dist/hooks/useUser.js +3 -3
  216. package/dist/index.js +15 -15
  217. package/dist/lib/analytics/gtm-page.d.ts +6 -0
  218. package/dist/lib/analytics/gtm-page.d.ts.map +1 -1
  219. package/dist/{navigation-PALIYZRL.js → navigation-COMJX7AY.js} +5 -5
  220. package/dist/{navigation-PALIYZRL.js.map → navigation-COMJX7AY.js.map} +1 -1
  221. package/dist/{navigation-4RDDJ27X.js → navigation-WOID2TUS.js} +4 -4
  222. package/dist/{navigation-4RDDJ27X.js.map → navigation-WOID2TUS.js.map} +1 -1
  223. package/dist/{not-found-6HYCOTID.js → not-found-KCC3OUJZ.js} +18 -18
  224. package/dist/{not-found-6HYCOTID.js.map → not-found-KCC3OUJZ.js.map} +1 -1
  225. package/dist/providers/index.js +15 -15
  226. package/dist/routes/account/orders.js +4 -4
  227. package/dist/routes/account/types.d.ts +4 -0
  228. package/dist/routes/account/types.d.ts.map +1 -1
  229. package/dist/routes/account/wishlist/WishlistPage.d.ts.map +1 -1
  230. package/dist/routes/account.js +13 -13
  231. package/dist/routes/blog.js +8 -8
  232. package/dist/routes/brands.js +4 -4
  233. package/dist/routes/cart.js +25 -25
  234. package/dist/routes/home.js +21 -21
  235. package/dist/routes/index.js +8 -8
  236. package/dist/routes/loyalty.js +5 -5
  237. package/dist/routes/page.js +4 -4
  238. package/dist/routes/product/index.d.ts.map +1 -1
  239. package/dist/routes/product-listing.js +25 -25
  240. package/dist/routes/product.js +49 -38
  241. package/dist/routes/product.js.map +1 -1
  242. package/dist/routes/seo-redirects.js +8 -8
  243. package/dist/routes/testimonials.js +2 -2
  244. package/dist/routes/thank-you.js +4 -4
  245. package/dist/skeleton.js +23 -23
  246. package/dist/{store-lookup-RCBP7X6U.js → store-lookup-TZ62QW7B.js} +8 -8
  247. package/dist/{store-lookup-RCBP7X6U.js.map → store-lookup-TZ62QW7B.js.map} +1 -1
  248. package/dist/tanstack/router.d.ts.map +1 -1
  249. package/dist/tanstack.js +17 -17
  250. package/dist/utils/index.js +2 -2
  251. package/dist/utils/product-price.d.ts +12 -0
  252. package/dist/utils/product-price.d.ts.map +1 -0
  253. package/package.json +1 -1
  254. package/tailwind/routes/account/types.ts.txt +2 -0
  255. package/tailwind/routes/account/wishlist/WishlistPage.tsx.txt +3 -1
  256. package/tailwind/routes/product/index.tsx.txt +41 -20
  257. package/dist/GoogleTag-X5FQ66HX.js +0 -15
  258. package/dist/WishlistPage-652AECE3.js.map +0 -1
  259. package/dist/chunk-BP3MT6EB.js.map +0 -1
  260. package/dist/chunk-L7UP3N7O.js.map +0 -1
  261. package/dist/chunk-R5N7UED2.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/api/product.ts"],"names":["product"],"mappings":";;;;;AAgGA,IAAM,YAAA,GACJ,kNAAA;AAGF,SAAS,iBAAA,GAAoB;AAC3B,EAAA,IAAI;AACF,IAAA,MAAM,WAAA,GAAc,oBAAmB,CAAE,WAAA;AACzC,IAAA,OAAO,WAAA,IAAe,OAAO,WAAA,CAAY,YAAA,KAAiB,aAAa,WAAA,GAAc,IAAA;AAAA,EACvF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AA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AU,sBAAsB,EAAE,CAAA;AAAA,MAClC,OAAA,EAAS,MAAM,OAAA,CAAQ,IAAA,CAAK,EAAE,CAAA;AAAA;AAAA;AAAA,MAG9B,eAAA,EAAiB,MAAM,iBAAA,CAAkB,EAAE;AAAA,KAC5C,CAAA;AAAA,IACH,KAAA,EAAO,CAAC,GAAA,KACN,YAAA,CAAa;AAAA;AAAA,MAEX,QAAA,EAAU;AAAA,QACR,UAAA;AAAA,QACA,KAAA;AAAA,QACA,GAAA;AAAA,QACA,oBAAmB,CAAE,MAAA;AAAA,QACrB,EAAE,KAAA,EAAO,cAAA,EAAe;AAAE,OAC5B;AAAA,MACA,OAAA,EAAS,MAAM,OAAA,CAAQ,SAAA,CAAU,GAAG;AAAA,KACrC,CAAA;AAAA,IACH,GAAA,EAAK,CAAC,EAAA,KACJ,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,UAAA,EAAY,KAAA,EAAO,EAAE,CAAA;AAAA,MAChC,OAAA,EAAS,MAAM,OAAA,CAAQ,GAAA,CAAI,EAAE;AAAA,KAC9B,CAAA;AAAA,IACH,IAAA,EAAM,CAAC,MAAA,KACL,YAAA,CAAa;AAAA;AAAA;AAAA;AAAA,MAIX,QAAA,EAAU;AAAA,QACR,UAAA;AAAA,QACA,MAAA;AAAA,QACA,MAAA;AAAA,QACA,EAAE,KAAA,EAAO,cAAA,IAAkB,MAAA,EAAQ,kBAAA,GAAqB,MAAA;AAAO,OACjE;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,MAAA,EAAO,KAAM,OAAA,CAAQ,IAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,MAAA,EAAQ;AAAA,KAC5D;AAAA;AAEP","file":"chunk-ZH3OMIUU.js","sourcesContent":["import { queryOptions, defaultShouldDehydrateQuery } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport type { Product } from '../types';\nimport type { Pagination, PaginatedResult } from './types';\nimport { orThrow } from '../providers/NavigationProvider';\nimport { getTwilightContext } from '../twilight/context';\nimport type { ActiveScope } from '../utils/cookies';\n\n// ===== Filter Types =====\n\nexport interface FilterValue {\n key?: string;\n count?: number;\n value?: string;\n from?: number | '*';\n to?: number | '*';\n}\n\nexport interface Filter {\n key?: string;\n label?: string;\n type?: string;\n values?: FilterValue[];\n max?: number;\n min?: number;\n}\n\n// ===== Product List Types =====\n\nexport type ProductsListSource =\n | 'brands'\n | 'categories'\n | 'json'\n | 'landing-page'\n | 'latest'\n | 'offers'\n | 'recently'\n | 'related'\n | 'selected'\n | 'tags'\n | 'top-rated'\n | 'wishlist'\n | 'search'\n | 'sales'\n | 'reorder'\n | 'best_selling';\n\nexport interface ProductsListParams {\n /** Source type (wishlist, latest, brands, etc.) */\n source: ProductsListSource;\n /**\n * The ids the source reads, as an array: category, brand, tag or product ids\n * (`sourceValue: [708738657]`). Sent as `source_value[]`.\n */\n sourceValue?: string | number | number[] | null;\n /** The search words when `source` is `'search'`. Sent as `keyword`; other sources ignore it. */\n keyword?: string;\n /** Page number for offset-based pagination */\n page?: number;\n /** Cursor for cursor-based pagination (from previous response) */\n cursor?: string | null;\n /** Items per page (default: 15) */\n perPage?: number;\n /** Sort option */\n sort?: string;\n /** Enable filters on the response */\n filterable?: boolean;\n /** Applied `<salla-filters>` selection (the `salla-filters::changed` payload). */\n filters?: ProductListFilters;\n /** Abort signal for cancellation */\n signal?: AbortSignal;\n}\n\n/** One `<salla-filters>` value: a scalar, a list, or a nested `{ sub-key: value }` (variants). */\nexport type ProductListFilterValue =\n string | number | Array<string | number> | { [key: string]: ProductListFilterValue };\n\n/** A `<salla-filters>` selection, i.e. the `salla-filters::changed` payload. */\nexport type ProductListFilters = Record<string, ProductListFilterValue>;\n\nexport type ProductsListResult = PaginatedResult<Product> & {\n filters?: Filter[];\n};\n\nexport interface ProductsListResponse {\n data: Product[];\n cursor?: Pagination;\n filters?: Filter[];\n}\n\n// ===== List-card preview cache =====\n// List payloads are a subset of details (one `image`, no `options` / `images[]`).\n// They live on a separate query key so they can paint a sheet/quick-view without\n// being treated as a successful `products/{id}/details` fetch.\n\n/** What a product page shows, asked of `products/{id}/details` and `products/sku/{sku}/details`. */\nconst DETAILS_WITH =\n '?with[]=images&with[]=category&with[]=rating&with[]=notify_availability&with[]=tags&with[]=brand' +\n '&with[]=options&with[]=skus&with[]=skus_availability&with[]=included_products&with[]=bundle&with[]=sold_quantity';\n\nfunction queryClientOrNull() {\n try {\n const queryClient = getTwilightContext().queryClient;\n return queryClient && typeof queryClient.setQueryData === 'function' ? queryClient : null;\n } catch {\n return null;\n }\n}\n\nexport function productPreviewQueryKey(id: string) {\n return ['products', 'preview', String(id), { scope: getActiveScope() }] as const;\n}\n\nexport function productDetailQueryKey(id: string) {\n return ['products', 'detail', id, { scope: getActiveScope() }] as const;\n}\n\n/** True when this query is a list-card stand-in — skip it when dehydrating SSR. */\nexport function isProductPreviewQuery(query: { queryKey: readonly unknown[] }): boolean {\n return query.queryKey[0] === 'products' && query.queryKey[1] === 'preview';\n}\n\n/**\n * Default dehydrate policy (success) plus pending SSR-stream queries, minus\n * list-card stand-ins. Replacing the default wholesale would ship error states.\n */\nexport function shouldDehydrateQuery(\n query: Parameters<typeof defaultShouldDehydrateQuery>[0]\n): boolean {\n return (\n !isProductPreviewQuery(query) &&\n (defaultShouldDehydrateQuery(query) || query.state.status === 'pending')\n );\n}\n\n/**\n * Remember a list/card product so `product.queries.detail(id)` can use it as\n * `placeholderData` while details load. No-op if details for this id are already\n * cached. Themes that fetch products outside `product.list` should call this.\n */\nexport function rememberProductPreview(product: Product): void {\n const queryClient = queryClientOrNull();\n if (!queryClient || product?.id == null) return;\n const id = String(product.id);\n if (queryClient.getQueryState(productDetailQueryKey(id))?.status === 'success') return;\n queryClient.setQueryData(productPreviewQueryKey(id), product);\n}\n\nfunction scopeFromQueryKey(queryKey: readonly unknown[]): ActiveScope | null | undefined {\n const last = queryKey[queryKey.length - 1];\n if (last == null || typeof last !== 'object' || !('scope' in last)) return undefined;\n return (last as { scope: ActiveScope | null }).scope;\n}\n\nfunction isSameScope(a: ActiveScope | null | undefined, b: ActiveScope | null): boolean {\n if (a === undefined) return false;\n if (a === b) return true;\n if (a == null || b == null) return a == null && b == null;\n return (\n a.id === b.id &&\n a.type === b.type &&\n a.allocation_id === b.allocation_id &&\n a.allocation_type === b.allocation_type\n );\n}\n\nconst LIST_QUERY_PREFIXES = [\n ['products', 'list'],\n ['wishlist', 'list'],\n] as const;\n\n/**\n * Rebuild the scoped preview index from hydrated list/wishlist queries (SSR\n * dehydrate drops preview keys). Subsequent lookups hit `productPreviewQueryKey`.\n */\nfunction findProductInScopedLists(\n queryClient: NonNullable<ReturnType<typeof queryClientOrNull>>,\n id: string\n): Product | undefined {\n const scope = getActiveScope();\n let found: Product | undefined;\n for (const prefix of LIST_QUERY_PREFIXES) {\n for (const [queryKey, data] of queryClient.getQueriesData<ProductsListResult>({\n queryKey: prefix,\n })) {\n if (!isSameScope(scopeFromQueryKey(queryKey), scope)) continue;\n for (const item of data?.items ?? []) {\n if (item?.id == null) continue;\n rememberProductPreview(item);\n if (!found && String(item.id) === id) found = item;\n }\n }\n }\n return found;\n}\n\n/**\n * List-card product for `placeholderData`. Prefers the preview key; if that was\n * dropped on SSR dehydrate, rebuilds it from the current-scope list/wishlist.\n */\nexport function getProductPreview(id: string): Product | undefined {\n const queryClient = queryClientOrNull();\n if (!queryClient) return undefined;\n const key = String(id);\n return (\n queryClient.getQueryData(productPreviewQueryKey(key)) ??\n findProductInScopedLists(queryClient, key)\n );\n}\n\nfunction rememberProductPreviews(items: Product[]): void {\n for (const item of items) rememberProductPreview(item);\n}\n\n/**\n * Search sends its words as `keyword` (a `sourceValue` string is still read there, as before);\n * every other source sends its ids as `source_value[]`, which the API requires as an array.\n */\nfunction appendSourceParams(\n searchParams: URLSearchParams,\n { source, sourceValue, keyword }: Pick<ProductsListParams, 'source' | 'sourceValue' | 'keyword'>\n): void {\n if (source === 'search') {\n const words = keyword ?? sourceValue;\n if (words !== undefined) searchParams.set('keyword', String(words));\n } else if (Array.isArray(sourceValue)) {\n sourceValue.forEach((val) => searchParams.append('source_value[]', String(val)));\n } else if (sourceValue !== undefined) {\n searchParams.append('source_value[]', String(sourceValue));\n }\n}\n\n/**\n * Sends an applied filter selection the way the SDK's `<salla-products-list>` does:\n * `filters[key]=v`, `filters[key][]=v` or `filters[key][sub]=v`.\n */\nfunction appendFilterParams(\n searchParams: URLSearchParams,\n filters?: Record<string, ProductListFilterValue>,\n parentKey = 'filters'\n): void {\n if (!filters) return;\n for (const [key, value] of Object.entries(filters)) {\n const fullKey = `${parentKey}[${key}]`;\n if (Array.isArray(value)) {\n value.forEach((item) => searchParams.append(`${fullKey}[]`, String(item)));\n } else if (value !== null && typeof value === 'object') {\n appendFilterParams(searchParams, value, fullKey);\n } else if (value !== undefined && value !== null) {\n searchParams.append(fullKey, String(value));\n }\n }\n}\n\n/** A `category_id` filter replaces the page's category as the list source (as in the SDK). */\n// The API sends these four filter titles in Arabic whatever the language (the values are\n// translated). Twig's `<salla-filters>` swaps them for its own translations when the list\n// reaches it through `filters::fetched`; a list handed over as data, the loader's or a\n// theme's own query, is swapped here instead, with the keys the component uses.\nconst FILTER_TITLES: Record<string, [key: string, fallback: string]> = {\n category_id: ['common.titles.categories', 'Categories'],\n brand_id: ['common.titles.brands', 'Brands'],\n price: ['pages.categories.filter_price', 'Price'],\n rating: ['pages.categories.filter_rating', 'Rating'],\n};\n\nfunction titledFilters(filters?: Filter[]): Filter[] | undefined {\n const t = getTwilightContext().i18n?.t;\n if (!filters || !t) return filters;\n return filters.map((filter) => {\n const title = filter.key && FILTER_TITLES[filter.key];\n return title ? { ...filter, label: t(title[0], title[1]) } : filter;\n });\n}\n\nfunction categoryFilterIds(filters?: ProductListFilters): number[] | null {\n const raw = filters?.category_id;\n if (raw === undefined || raw === null) return null;\n const ids = Array.isArray(raw) ? raw : typeof raw === 'object' ? Object.values(raw) : [raw];\n return ids.map(Number);\n}\n\n// ===== Pagination =====\n\n/**\n * The API's own `cursor.next` (the previous page's response) is usually a\n * bare opaque cursor token, but for sources that don't support true\n * cursor-based pagination (observed: `source=offers`) it's instead a full\n * next-page URL carrying its own `page=N` — and no `cursor=` param at all.\n *\n * Passing that whole URL straight through as `list()`'s own `cursor` used to\n * smuggle its embedded `source` / `per_page` / `sort` into the request on\n * top of the ones `list()` already sets unconditionally, producing a\n * doubled query string (`source=offers&source=offers&...`) the API can't\n * paginate from correctly — every subsequent scroll re-fetched the exact\n * same first page instead of advancing. Pulling just the `page` number back\n * out here, the same way an actual `cursor=` is already pulled out, keeps\n * `list()`'s request to the one copy of each param it's supposed to have.\n */\nexport function parseNextPageToken(nextUrl: string | null | undefined): {\n cursor?: string;\n page?: number;\n} {\n if (!nextUrl) return {};\n\n const cursorMatch = nextUrl.match(/[?&]cursor=([^&]+)/);\n if (cursorMatch) return { cursor: decodeURIComponent(cursorMatch[1]) };\n\n const pageMatch = nextUrl.match(/[?&]page=([^&]+)/);\n if (pageMatch) {\n const page = Number(decodeURIComponent(pageMatch[1]));\n if (Number.isFinite(page)) return { page };\n }\n\n // Neither pattern matched: not a URL at all, just the bare opaque token itself.\n return { cursor: nextUrl };\n}\n\n// ===== API Functions =====\n\nexport const product = {\n find: async (id: string): Promise<Product> => {\n const { data } = await api\n .get(`products/${id}/details${DETAILS_WITH}`)\n .json<{ data: Product }>();\n return data;\n },\n\n findOrThrow: (id: string): Promise<Product> => orThrow(product.find(id)),\n\n /**\n * A product by its SKU, for a store on SKU links (`/{sku}-{name}`): the same details as `find`.\n * The API resolves the SKU as Twig's `showNewUrls` does (the product's own `sku`, in the store).\n */\n findBySku: async (sku: string): Promise<Product> => {\n const { data } = await api\n .get(`products/sku/${encodeURIComponent(sku)}/details${DETAILS_WITH}`)\n .json<{ data: Product }>();\n return data;\n },\n\n /** A tag's name. The list endpoint returns every product for an unknown tag; this one answers 410. */\n tag: async (id: string): Promise<{ id: number; name: string }> => {\n const { tag } = await api\n .get(`products/tags/${id}`)\n .json<{ tag: { id: number; name: string } }>();\n return tag;\n },\n\n /**\n * Fetch products list with pagination support\n * Used by native ProductsList component for SSR loaders\n *\n * API pattern: GET /products?source=wishlist&page=1\n */\n list: async (params: ProductsListParams): Promise<ProductsListResult> => {\n const {\n source,\n sourceValue,\n keyword,\n page,\n cursor,\n perPage = 16,\n sort,\n filterable,\n filters,\n signal,\n } = params;\n\n // Build URL with query parameters\n const searchParams = new URLSearchParams();\n searchParams.set('source', source);\n // Only send page when explicitly provided — cursor-based callers omit it entirely\n if (page !== undefined) searchParams.set('page', String(page));\n searchParams.set('per_page', String(perPage));\n\n appendSourceParams(searchParams, {\n source,\n sourceValue: (source === 'categories' && categoryFilterIds(filters)) || sourceValue,\n keyword,\n });\n appendFilterParams(searchParams, filters);\n\n // Add filterable parameter\n if (filterable !== undefined) {\n searchParams.set('filterable', filterable ? '1' : '0');\n }\n\n // Add sort parameter\n if (sort) {\n searchParams.set('sort', sort);\n }\n\n // Add cursor for cursor-based pagination\n if (cursor) {\n searchParams.set('cursor', cursor);\n }\n\n // Make the request\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`products?${searchParams.toString()}`, options as any)\n .json<ProductsListResponse>();\n\n const items = response.data ?? [];\n rememberProductPreviews(items);\n\n return {\n items,\n next: response.cursor?.next ?? null,\n filters: titledFilters(response.filters),\n };\n },\n\n queries: {\n detail: (id: string) =>\n queryOptions({\n // Stock and availability are resolved per branch allocation — same as the list.\n queryKey: productDetailQueryKey(id),\n queryFn: () => product.find(id),\n // List-card product, if one was remembered. Not written as the detail\n // cache entry — `queryFn` still hits products/{id}/details.\n placeholderData: () => getProductPreview(id),\n }),\n bySku: (sku: string) =>\n queryOptions({\n // In the page's language: a preload asked in another must not answer for it.\n queryKey: [\n 'products',\n 'sku',\n sku,\n getTwilightContext().locale,\n { scope: getActiveScope() },\n ],\n queryFn: () => product.findBySku(sku),\n }),\n tag: (id: string) =>\n queryOptions({\n queryKey: ['products', 'tag', id],\n queryFn: () => product.tag(id),\n }),\n list: (params: Omit<ProductsListParams, 'signal'>) =>\n queryOptions({\n // Scope (branch) varies product availability, and the locale the names and the\n // filter titles (a same-store link can switch language without a page load) — the\n // key must include both.\n queryKey: [\n 'products',\n 'list',\n params,\n { scope: getActiveScope(), locale: getTwilightContext().locale },\n ],\n queryFn: ({ signal }) => product.list({ ...params, signal }),\n }),\n },\n};\n"]}
1
+ {"version":3,"sources":["../src/api/product.ts"],"names":["product"],"mappings":";;;;;AAgGA,IAAM,YAAA,GACJ,kNAAA;AAGF,SAAS,iBAAA,GAAoB;AAC3B,EAAA,IAAI;AACF,IAAA,MAAM,WAAA,GAAc,oBAAmB,CAAE,WAAA;AACzC,IAAA,OAAO,WAAA,IAAe,OAAO,WAAA,CAAY,YAAA,KAAiB,aAAa,WAAA,GAAc,IAAA;AAAA,EACvF,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAEO,SAAS,uBAAuB,EAAA,EAAY;AACjD,EAAA,OAAO,CAAC,UAAA,EAAY,SAAA,EAAW,MAAA,CAAO,EAAE,GAAG,EAAE,KAAA,EAAO,cAAA,EAAe,EAAG,CAAA;AACxE;AAEO,SAAS,sBAAsB,EAAA,EAAY;AAChD,EAAA,OAAO,CAAC,YAAY,QAAA,EAAU,EAAA,EAAI,EAAE,KAAA,EAAO,cAAA,IAAkB,CAAA;AAC/D;AAGO,SAAS,sBAAsB,KAAA,EAAkD;AACtF,EAAA,OAAO,KAAA,CAAM,SAAS,CAAC,CAAA,KAAM,cAAc,KAAA,CAAM,QAAA,CAAS,CAAC,CAAA,KAAM,SAAA;AACnE;AAMO,SAAS,qBACd,KAAA,EACS;AACT,EAAA,OACE,CAAC,sBAAsB,KAAK,CAAA,KAC3B,4BAA4B,KAAK,CAAA,IAAK,KAAA,CAAM,KAAA,CAAM,MAAA,KAAW,SAAA,CAAA;AAElE;AAOO,SAAS,uBAAuBA,QAAAA,EAAwB;AAC7D,EAAA,MAAM,cAAc,iBAAA,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,KAC9B,CAAA;AAAA,IACH,IAAA,EAAM,CAAC,MAAA,KACL,YAAA,CAAa;AAAA;AAAA;AAAA;AAAA,MAIX,QAAA,EAAU;AAAA,QACR,UAAA;AAAA,QACA,MAAA;AAAA,QACA,MAAA;AAAA,QACA,EAAE,KAAA,EAAO,cAAA,IAAkB,MAAA,EAAQ,kBAAA,GAAqB,MAAA;AAAO,OACjE;AAAA,MACA,OAAA,EAAS,CAAC,EAAE,MAAA,EAAO,KAAM,OAAA,CAAQ,IAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,MAAA,EAAQ;AAAA,KAC5D;AAAA;AAEP","file":"chunk-JLVYQBHV.js","sourcesContent":["import { queryOptions, defaultShouldDehydrateQuery } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport type { Product } from '../types';\nimport type { Pagination, PaginatedResult } from './types';\nimport { orThrow } from '../providers/NavigationProvider';\nimport { getTwilightContext } from '../twilight/context';\nimport type { ActiveScope } from '../utils/cookies';\n\n// ===== Filter Types =====\n\nexport interface FilterValue {\n key?: string;\n count?: number;\n value?: string;\n from?: number | '*';\n to?: number | '*';\n}\n\nexport interface Filter {\n key?: string;\n label?: string;\n type?: string;\n values?: FilterValue[];\n max?: number;\n min?: number;\n}\n\n// ===== Product List Types =====\n\nexport type ProductsListSource =\n | 'brands'\n | 'categories'\n | 'json'\n | 'landing-page'\n | 'latest'\n | 'offers'\n | 'recently'\n | 'related'\n | 'selected'\n | 'tags'\n | 'top-rated'\n | 'wishlist'\n | 'search'\n | 'sales'\n | 'reorder'\n | 'best_selling';\n\nexport interface ProductsListParams {\n /** Source type (wishlist, latest, brands, etc.) */\n source: ProductsListSource;\n /**\n * The ids the source reads, as an array: category, brand, tag or product ids\n * (`sourceValue: [708738657]`). Sent as `source_value[]`.\n */\n sourceValue?: string | number | number[] | null;\n /** The search words when `source` is `'search'`. Sent as `keyword`; other sources ignore it. */\n keyword?: string;\n /** Page number for offset-based pagination */\n page?: number;\n /** Cursor for cursor-based pagination (from previous response) */\n cursor?: string | null;\n /** Items per page (default: 15) */\n perPage?: number;\n /** Sort option */\n sort?: string;\n /** Enable filters on the response */\n filterable?: boolean;\n /** Applied `<salla-filters>` selection (the `salla-filters::changed` payload). */\n filters?: ProductListFilters;\n /** Abort signal for cancellation */\n signal?: AbortSignal;\n}\n\n/** One `<salla-filters>` value: a scalar, a list, or a nested `{ sub-key: value }` (variants). */\nexport type ProductListFilterValue =\n string | number | Array<string | number> | { [key: string]: ProductListFilterValue };\n\n/** A `<salla-filters>` selection, i.e. the `salla-filters::changed` payload. */\nexport type ProductListFilters = Record<string, ProductListFilterValue>;\n\nexport type ProductsListResult = PaginatedResult<Product> & {\n filters?: Filter[];\n};\n\nexport interface ProductsListResponse {\n data: Product[];\n cursor?: Pagination;\n filters?: Filter[];\n}\n\n// ===== List-card preview cache =====\n// List payloads are a subset of details (one `image`, no `options` / `images[]`).\n// They live on a separate query key so they can paint a sheet/quick-view without\n// being treated as a successful `products/{id}/details` fetch.\n\n/** What a product page shows, asked of `products/{id}/details` and `products/sku/{sku}/details`. */\nconst DETAILS_WITH =\n '?with[]=images&with[]=category&with[]=rating&with[]=notify_availability&with[]=tags&with[]=brand' +\n '&with[]=options&with[]=skus&with[]=skus_availability&with[]=included_products&with[]=bundle&with[]=sold_quantity';\n\nfunction queryClientOrNull() {\n try {\n const queryClient = getTwilightContext().queryClient;\n return queryClient && typeof queryClient.setQueryData === 'function' ? queryClient : null;\n } catch {\n return null;\n }\n}\n\nexport function productPreviewQueryKey(id: string) {\n return ['products', 'preview', String(id), { scope: getActiveScope() }] as const;\n}\n\nexport function productDetailQueryKey(id: string) {\n return ['products', 'detail', id, { scope: getActiveScope() }] as const;\n}\n\n/** True when this query is a list-card stand-in — skip it when dehydrating SSR. */\nexport function isProductPreviewQuery(query: { queryKey: readonly unknown[] }): boolean {\n return query.queryKey[0] === 'products' && query.queryKey[1] === 'preview';\n}\n\n/**\n * Default dehydrate policy (success) plus pending SSR-stream queries, minus\n * list-card stand-ins. Replacing the default wholesale would ship error states.\n */\nexport function shouldDehydrateQuery(\n query: Parameters<typeof defaultShouldDehydrateQuery>[0]\n): boolean {\n return (\n !isProductPreviewQuery(query) &&\n (defaultShouldDehydrateQuery(query) || query.state.status === 'pending')\n );\n}\n\n/**\n * Remember a list/card product so `product.queries.detail(id)` can use it as\n * `placeholderData` while details load. No-op if details for this id are already\n * cached. Themes that fetch products outside `product.list` should call this.\n */\nexport function rememberProductPreview(product: Product): void {\n const queryClient = queryClientOrNull();\n if (!queryClient || product?.id == null) return;\n const id = String(product.id);\n if (queryClient.getQueryState(productDetailQueryKey(id))?.status === 'success') return;\n queryClient.setQueryData(productPreviewQueryKey(id), product);\n}\n\nfunction scopeFromQueryKey(queryKey: readonly unknown[]): ActiveScope | null | undefined {\n const last = queryKey[queryKey.length - 1];\n if (last == null || typeof last !== 'object' || !('scope' in last)) return undefined;\n return (last as { scope: ActiveScope | null }).scope;\n}\n\nfunction isSameScope(a: ActiveScope | null | undefined, b: ActiveScope | null): boolean {\n if (a === undefined) return false;\n if (a === b) return true;\n if (a == null || b == null) return a == null && b == null;\n return (\n a.id === b.id &&\n a.type === b.type &&\n a.allocation_id === b.allocation_id &&\n a.allocation_type === b.allocation_type\n );\n}\n\nconst LIST_QUERY_PREFIXES = [\n ['products', 'list'],\n ['wishlist', 'list'],\n] as const;\n\n/**\n * Rebuild the scoped preview index from hydrated list/wishlist queries (SSR\n * dehydrate drops preview keys). Subsequent lookups hit `productPreviewQueryKey`.\n */\nfunction findProductInScopedLists(\n queryClient: NonNullable<ReturnType<typeof queryClientOrNull>>,\n id: string\n): Product | undefined {\n const scope = getActiveScope();\n let found: Product | undefined;\n for (const prefix of LIST_QUERY_PREFIXES) {\n for (const [queryKey, data] of queryClient.getQueriesData<ProductsListResult>({\n queryKey: prefix,\n })) {\n if (!isSameScope(scopeFromQueryKey(queryKey), scope)) continue;\n for (const item of data?.items ?? []) {\n if (item?.id == null) continue;\n rememberProductPreview(item);\n if (!found && String(item.id) === id) found = item;\n }\n }\n }\n return found;\n}\n\n/**\n * List-card product for `placeholderData`. Prefers the preview key; if that was\n * dropped on SSR dehydrate, rebuilds it from the current-scope list/wishlist.\n */\nexport function getProductPreview(id: string): Product | undefined {\n const queryClient = queryClientOrNull();\n if (!queryClient) return undefined;\n const key = String(id);\n return (\n queryClient.getQueryData(productPreviewQueryKey(key)) ??\n findProductInScopedLists(queryClient, key)\n );\n}\n\nfunction rememberProductPreviews(items: Product[]): void {\n for (const item of items) rememberProductPreview(item);\n}\n\n/**\n * Search sends its words as `keyword` (a `sourceValue` string is still read there, as before);\n * every other source sends its ids as `source_value[]`, which the API requires as an array.\n */\nfunction appendSourceParams(\n searchParams: URLSearchParams,\n { source, sourceValue, keyword }: Pick<ProductsListParams, 'source' | 'sourceValue' | 'keyword'>\n): void {\n if (source === 'search') {\n const words = keyword ?? sourceValue;\n if (words !== undefined) searchParams.set('keyword', String(words));\n } else if (Array.isArray(sourceValue)) {\n sourceValue.forEach((val) => searchParams.append('source_value[]', String(val)));\n } else if (sourceValue !== undefined) {\n searchParams.append('source_value[]', String(sourceValue));\n }\n}\n\n/**\n * Sends an applied filter selection the way the SDK's `<salla-products-list>` does:\n * `filters[key]=v`, `filters[key][]=v` or `filters[key][sub]=v`.\n */\nfunction appendFilterParams(\n searchParams: URLSearchParams,\n filters?: Record<string, ProductListFilterValue>,\n parentKey = 'filters'\n): void {\n if (!filters) return;\n for (const [key, value] of Object.entries(filters)) {\n const fullKey = `${parentKey}[${key}]`;\n if (Array.isArray(value)) {\n value.forEach((item) => searchParams.append(`${fullKey}[]`, String(item)));\n } else if (value !== null && typeof value === 'object') {\n appendFilterParams(searchParams, value, fullKey);\n } else if (value !== undefined && value !== null) {\n searchParams.append(fullKey, String(value));\n }\n }\n}\n\n/** A `category_id` filter replaces the page's category as the list source (as in the SDK). */\n// The API sends these four filter titles in Arabic whatever the language (the values are\n// translated). Twig's `<salla-filters>` swaps them for its own translations when the list\n// reaches it through `filters::fetched`; a list handed over as data, the loader's or a\n// theme's own query, is swapped here instead, with the keys the component uses.\nconst FILTER_TITLES: Record<string, [key: string, fallback: string]> = {\n category_id: ['common.titles.categories', 'Categories'],\n brand_id: ['common.titles.brands', 'Brands'],\n price: ['pages.categories.filter_price', 'Price'],\n rating: ['pages.categories.filter_rating', 'Rating'],\n};\n\nfunction titledFilters(filters?: Filter[]): Filter[] | undefined {\n const t = getTwilightContext().i18n?.t;\n if (!filters || !t) return filters;\n return filters.map((filter) => {\n const title = filter.key && FILTER_TITLES[filter.key];\n return title ? { ...filter, label: t(title[0], title[1]) } : filter;\n });\n}\n\nfunction categoryFilterIds(filters?: ProductListFilters): number[] | null {\n const raw = filters?.category_id;\n if (raw === undefined || raw === null) return null;\n const ids = Array.isArray(raw) ? raw : typeof raw === 'object' ? Object.values(raw) : [raw];\n return ids.map(Number);\n}\n\n// ===== Pagination =====\n\n/**\n * The API's own `cursor.next` (the previous page's response) is usually a\n * bare opaque cursor token, but for sources that don't support true\n * cursor-based pagination (observed: `source=offers`) it's instead a full\n * next-page URL carrying its own `page=N` — and no `cursor=` param at all.\n *\n * Passing that whole URL straight through as `list()`'s own `cursor` used to\n * smuggle its embedded `source` / `per_page` / `sort` into the request on\n * top of the ones `list()` already sets unconditionally, producing a\n * doubled query string (`source=offers&source=offers&...`) the API can't\n * paginate from correctly — every subsequent scroll re-fetched the exact\n * same first page instead of advancing. Pulling just the `page` number back\n * out here, the same way an actual `cursor=` is already pulled out, keeps\n * `list()`'s request to the one copy of each param it's supposed to have.\n */\nexport function parseNextPageToken(nextUrl: string | null | undefined): {\n cursor?: string;\n page?: number;\n} {\n if (!nextUrl) return {};\n\n const cursorMatch = nextUrl.match(/[?&]cursor=([^&]+)/);\n if (cursorMatch) return { cursor: decodeURIComponent(cursorMatch[1]) };\n\n const pageMatch = nextUrl.match(/[?&]page=([^&]+)/);\n if (pageMatch) {\n const page = Number(decodeURIComponent(pageMatch[1]));\n if (Number.isFinite(page)) return { page };\n }\n\n // Neither pattern matched: not a URL at all, just the bare opaque token itself.\n return { cursor: nextUrl };\n}\n\n// ===== API Functions =====\n\nexport const product = {\n find: async (id: string): Promise<Product> => {\n const { data } = await api\n .get(`products/${id}/details${DETAILS_WITH}`)\n .json<{ data: Product }>();\n return data;\n },\n\n findOrThrow: (id: string): Promise<Product> => orThrow(product.find(id)),\n\n /**\n * A product by its SKU, for a store on SKU links (`/{sku}-{name}`): the same details as `find`.\n * The API resolves the SKU as Twig's `showNewUrls` does (the product's own `sku`, in the store).\n */\n findBySku: async (sku: string): Promise<Product> => {\n const { data } = await api\n .get(`products/sku/${encodeURIComponent(sku)}/details${DETAILS_WITH}`)\n .json<{ data: Product }>();\n return data;\n },\n\n /** A tag's name. The list endpoint returns every product for an unknown tag; this one answers 410. */\n tag: async (id: string): Promise<{ id: number; name: string }> => {\n const { tag } = await api\n .get(`products/tags/${id}`)\n .json<{ tag: { id: number; name: string } }>();\n return tag;\n },\n\n /**\n * Fetch products list with pagination support\n * Used by native ProductsList component for SSR loaders\n *\n * API pattern: GET /products?source=wishlist&page=1\n */\n list: async (params: ProductsListParams): Promise<ProductsListResult> => {\n const {\n source,\n sourceValue,\n keyword,\n page,\n cursor,\n perPage = 16,\n sort,\n filterable,\n filters,\n signal,\n } = params;\n\n // Build URL with query parameters\n const searchParams = new URLSearchParams();\n searchParams.set('source', source);\n // Only send page when explicitly provided — cursor-based callers omit it entirely\n if (page !== undefined) searchParams.set('page', String(page));\n searchParams.set('per_page', String(perPage));\n\n appendSourceParams(searchParams, {\n source,\n sourceValue: (source === 'categories' && categoryFilterIds(filters)) || sourceValue,\n keyword,\n });\n appendFilterParams(searchParams, filters);\n\n // Add filterable parameter\n if (filterable !== undefined) {\n searchParams.set('filterable', filterable ? '1' : '0');\n }\n\n // Add sort parameter\n if (sort) {\n searchParams.set('sort', sort);\n }\n\n // Add cursor for cursor-based pagination\n if (cursor) {\n searchParams.set('cursor', cursor);\n }\n\n // Make the request\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`products?${searchParams.toString()}`, options as any)\n .json<ProductsListResponse>();\n\n const items = response.data ?? [];\n rememberProductPreviews(items);\n\n return {\n items,\n next: response.cursor?.next ?? null,\n filters: titledFilters(response.filters),\n };\n },\n\n queries: {\n detail: (id: string) =>\n queryOptions({\n // Stock and availability are resolved per branch allocation — same as the list.\n queryKey: productDetailQueryKey(id),\n queryFn: () => product.find(id),\n // List-card product, if one was remembered. Not written as the detail\n // cache entry — `queryFn` still hits products/{id}/details.\n placeholderData: () => getProductPreview(id),\n }),\n bySku: (sku: string) =>\n queryOptions({\n // In the page's language: a preload asked in another must not answer for it.\n queryKey: [\n 'products',\n 'sku',\n sku,\n getTwilightContext().locale,\n { scope: getActiveScope() },\n ],\n queryFn: () => product.findBySku(sku),\n }),\n tag: (id: string) =>\n queryOptions({\n queryKey: ['products', 'tag', id],\n queryFn: () => product.tag(id),\n }),\n list: (params: Omit<ProductsListParams, 'signal'>) =>\n queryOptions({\n // Scope (branch) varies product availability, and the locale the names and the\n // filter titles (a same-store link can switch language without a page load) — the\n // key must include both.\n queryKey: [\n 'products',\n 'list',\n params,\n { scope: getActiveScope(), locale: getTwilightContext().locale },\n ],\n queryFn: ({ signal }) => product.list({ ...params, signal }),\n }),\n },\n};\n"]}
@@ -30,7 +30,7 @@ function rebaseApiUrl(url, from, to) {
30
30
  }
31
31
 
32
32
  // src/utils/engine-version.ts
33
- var ENGINE_VERSION = "1.0.201" ;
33
+ var ENGINE_VERSION = "1.0.203" ;
34
34
  var DEV_SETTINGS_TTL_MS = 60 * 6e4;
35
35
  var HIT_HEADER = "x-twilight-dev-cache";
36
36
  var FETCHED_AT_HEADER = "x-twilight-dev-fetched-at";
@@ -298,5 +298,5 @@ var filesCdn = ky.extend({
298
298
  });
299
299
 
300
300
  export { API_BASE_HEADER, ENGINE_VERSION, STORE_IDENTIFIER_HEADER, api, cdn, devSettingsFetchedAt, filesCdn, getActiveCurrency, getActiveScope, getActiveScopeId, getAuthToken, rememberStoreRay, resolveRequestApiBase };
301
- //# sourceMappingURL=chunk-ICD5UHUM.js.map
302
- //# sourceMappingURL=chunk-ICD5UHUM.js.map
301
+ //# sourceMappingURL=chunk-LNJUQ2S6.js.map
302
+ //# sourceMappingURL=chunk-LNJUQ2S6.js.map
@@ -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,IAAI,IAAI,QAAA,CAAS,OAAA,CAAQ,QAAQ,EAAE,CAAA,KAAM,eAAe,OAAO,IAAA;AAC/D,EAAA,OAAO,CAAA,EAAG,GAAA,CAAI,MAAM,CAAA,EAAG,aAAa,CAAA,CAAA;AACtC;AAOO,SAAS,YAAA,CAAa,GAAA,EAAa,IAAA,EAAc,EAAA,EAA2B;AACjF,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ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Store API base in, on the\n * storefronts that must not call production: the beta storefront and its per-PR\n * previews (`web.beta.salla.group`, `web-<hash>.beta.salla.group`). There the\n * Store serves the storefront API under its own address, `https://<host>/api/v1`.\n *\n * Trusted for the same reason `x-salla-store-base` is: the dispatcher sets it\n * after dropping everything off its allowlist, so a visitor's copy never arrives.\n * It is still checked against the request's own host, so even a forged one could\n * only point the theme back at the storefront it is already serving.\n */\nexport const API_BASE_HEADER = 'x-salla-api-base';\n\n/** The one path the dispatcher names: the Store's storefront API under its own host. */\nconst API_BASE_PATH = '/api/v1';\n\n/**\n * The API base this request was told to use, or null for the build's default.\n *\n * Accepted only as `https://<the request's own host>/api/v1` (a trailing slash\n * allowed), with no credentials, query or fragment; returned without the slash.\n */\nexport function resolveRequestApiBase(\n header: string | null | undefined,\n requestHost: string | null\n): string | null {\n if (!header || !requestHost) return null;\n let url: URL;\n try {\n url = new URL(header.trim());\n } catch {\n return null;\n }\n if (url.protocol !== 'https:') return null;\n if (url.host.toLowerCase() !== requestHost.toLowerCase()) return null;\n if (url.username || url.password || url.search || url.hash) return null;\n if (url.pathname.replace(/\\/+$/, '') !== API_BASE_PATH) return null;\n return `${url.origin}${API_BASE_PATH}`;\n}\n\n/**\n * `url` moved from one API base to another: `https://api.salla.dev/store/v1/cart/1`\n * under `https://web.beta.salla.group/api/v1` is `https://web.beta.salla.group/api/v1/cart/1`.\n * Null when `url` is not under `from`, which leaves the request as it was.\n */\nexport function rebaseApiUrl(url: string, from: string, to: string): string | null {\n const base = from.replace(/\\/+$/, '');\n if (url !== base && !url.startsWith(`${base}/`) && !url.startsWith(`${base}?`)) return null;\n return to.replace(/\\/+$/, '') + url.slice(base.length);\n}\n","/**\n * The engine's own build version, injected by tsup `define` when dist is\n * built. Falls back to 'dev' when the source runs unbundled (vitest, direct\n * src imports in the monorepo).\n *\n * Exposed at runtime as `salla.versions.engine` by `useTwilightInit` so a\n * storefront can always be asked which engine build rendered it.\n */\nexport const ENGINE_VERSION: string =\n typeof __TWILIGHT_ENGINE_VERSION__ !== 'undefined' ? __TWILIGHT_ENGINE_VERSION__ : 'dev';\n","import type { AfterResponseHook, BeforeRequestHook } from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { DEV_SETTINGS_REFRESH_COOKIE } from '../utils/dev-settings-refresh';\n\n/**\n * A dev server reuses a store's settings for up to an hour.\n *\n * Every server render asks the API for `store/settings`, and a developer clicking\n * around a theme renders dozens of pages a minute. The API answers a burst of\n * settings requests for one store from one address with a challenge, which a\n * server-side fetch cannot pass, so the dev server rendered \"Store Unavailable\"\n * (6.05k challenged `(development; ssr)` calls in the 7 days to 2026-10-25). In\n * development, on the server, the same request within {@link DEV_SETTINGS_TTL_MS}\n * is answered from memory instead. An hour because the API counts settings\n * requests per hour, so one fetch an hour can never reach its limit; the theme\n * editor's \"Fetch fresh store data\" fetches sooner, and says how old the settings\n * are. A production build never runs it: `import.meta.env.DEV` is statically\n * false there.\n */\nexport const DEV_SETTINGS_TTL_MS = 60 * 60_000;\n\n/** Marks an answer from memory, so the store step does not file it again. */\nconst HIT_HEADER = 'x-twilight-dev-cache';\n\n/** When the answer was really fetched from the API (epoch ms), on fresh answers and reused ones alike. */\nconst FETCHED_AT_HEADER = 'x-twilight-dev-fetched-at';\n\n/**\n * When the dev server fetched these settings from the API, read off the answer the\n * cache handed back; `undefined` when the cache did not handle the call (a\n * production build, the browser, a test), so nothing new reaches the settings there.\n */\nexport function devSettingsFetchedAt(headers: Headers | undefined): number | undefined {\n const at = Number(headers?.get(FETCHED_AT_HEADER));\n return Number.isFinite(at) && at > 0 ? at : undefined;\n}\n\n/**\n * Not carried over to an answer from memory: the body is stored decoded, so its\n * original encoding and length no longer describe it.\n */\nconst DROPPED_HEADERS = new Set(['content-encoding', 'content-length']);\n\ninterface Entry {\n body: string;\n status: number;\n statusText: string;\n headers: [string, string][];\n fetchedAt: number;\n /** The refresh cookie's value when this answer was fetched. */\n refresh: string | null;\n}\n\nexport interface DevSettingsCacheOptions {\n /** Whether this call may use the cache at all. */\n enabled: () => boolean;\n /** The current value of {@link DEV_SETTINGS_REFRESH_COOKIE}, or null. */\n refreshToken: () => string | null;\n now?: () => number;\n ttlMs?: number;\n /** Called the first time an answer comes from memory. */\n onFirstHit?: () => void;\n}\n\nfunction isSettingsRequest(request: Request): boolean {\n if (request.method !== 'GET') return false;\n try {\n return new URL(request.url).pathname.endsWith('/store/settings');\n } catch {\n return false;\n }\n}\n\n/**\n * An answer `requestSettings` accepts: JSON carrying `data`. A 200 without it is\n * refused there as \"Store Unavailable\"; kept here, it would be refused for the next\n * hour too, after the API had recovered.\n */\nfunction hasSettings(body: string): boolean {\n try {\n return Boolean((JSON.parse(body) as { data?: unknown } | null)?.data);\n } catch {\n return false;\n }\n}\n\n/**\n * The request as the API receives it: method, URL and every header the client's\n * hooks set. Keyed on the request itself rather than on the inputs that build it,\n * so a header added to the client later cannot be missing from the key.\n */\nfunction keyOf(request: Request): string {\n const headers = [...request.headers].map(([name, value]) => `${name}: ${value}`).join('\\n');\n return `${request.method} ${request.url}\\n${headers}`;\n}\n\n/**\n * The two ky hooks behind the cache: `lookup` runs last among `beforeRequest`, once\n * every header is set, and `store` among `afterResponse`. Only an answer with\n * settings in it is kept, so a timeout, a 429, a challenge or an empty 200 is asked\n * again on the next render.\n */\nexport function createDevSettingsCache(options: DevSettingsCacheOptions) {\n const {\n enabled,\n refreshToken,\n now = Date.now,\n ttlMs = DEV_SETTINGS_TTL_MS,\n onFirstHit,\n } = options;\n const entries = new Map<string, Entry>();\n let announced = false;\n\n const isFresh = (entry: Entry): boolean =>\n now() - entry.fetchedAt < ttlMs && entry.refresh === refreshToken();\n\n const answerOf = (entry: Entry, hit: boolean): Response => {\n const headers = new Headers(entry.headers);\n headers.set(FETCHED_AT_HEADER, String(entry.fetchedAt));\n if (hit) headers.set(HIT_HEADER, 'hit');\n return new Response(entry.body, {\n status: entry.status,\n statusText: entry.statusText,\n headers,\n });\n };\n\n const lookup: BeforeRequestHook = ({ request }) => {\n if (!enabled() || !isSettingsRequest(request)) return;\n const key = keyOf(request);\n const entry = entries.get(key);\n if (!entry) return;\n if (!isFresh(entry)) {\n entries.delete(key);\n return;\n }\n if (!announced) {\n announced = true;\n onFirstHit?.();\n }\n return answerOf(entry, true);\n };\n\n const store: AfterResponseHook = async ({ request, response }) => {\n if (!enabled() || !isSettingsRequest(request) || !response.ok) return;\n if (response.headers.has(HIT_HEADER)) return;\n // ky hands each hook a clone, so reading it leaves the answer it returns intact.\n const body = await response.text();\n if (!hasSettings(body)) return;\n for (const [key, entry] of entries) {\n if (now() - entry.fetchedAt >= ttlMs) entries.delete(key);\n }\n const entry: Entry = {\n body,\n status: response.status,\n statusText: response.statusText,\n headers: [...response.headers].filter(([name]) => !DROPPED_HEADERS.has(name)),\n fetchedAt: now(),\n refresh: refreshToken(),\n };\n entries.set(keyOf(request), entry);\n // Handed on in place of the API's own answer, so it carries its fetch time too.\n return answerOf(entry, false);\n };\n\n return { lookup, store, clear: () => entries.clear() };\n}\n\nconst readRefreshCookie = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(DEV_SETTINGS_REFRESH_COOKIE) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\nexport const devSettingsCache = createDevSettingsCache({\n // A dev server's render only. A production build has `DEV` statically false,\n // the browser keeps the settings it was handed in its query cache, and vitest\n // runs in `test` mode, where every test wants the request it mocked.\n enabled: () =>\n import.meta.env.DEV && import.meta.env.MODE !== 'test' && typeof document === 'undefined',\n refreshToken: readRefreshCookie,\n onFirstHit: () =>\n console.warn(\n `[twilight] Store settings are reused for up to ${DEV_SETTINGS_TTL_MS / 60_000} minutes while you develop, to stay under the Salla API's rate limit. To see a change you made in the dashboard, press \"Fetch fresh store data\" in the theme editor's side panel: it also says when they were last fetched.`\n ),\n});\n","import ky from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { getStoreIdentifier } from '../utils/sdk-helpers';\nimport { requestedDraftThemeName, resolveThemeVersionId } from '../utils/theme-version';\nimport { getInjectedRuntimeEnv, readEnv } from '../utils/runtime-env';\nimport { getRequestStore, getTwilightContext, isAuthTokenRevoked } from '../twilight/context';\nimport { rebaseApiUrl } from '../utils/api-base';\nimport { ENGINE_VERSION } from '../utils/engine-version';\nimport { devSettingsCache } from './dev-settings-cache';\nimport {\n AUTH_TOKEN_COOKIE_NAME,\n CURRENCY_COOKIE_NAME,\n extractCurrencyFromCookies,\n extractScopeFromCookies,\n toCurrencyCode,\n extractTokenFromCookies,\n readSdkScope,\n type ActiveScope,\n} from '../utils/cookies';\n\n// The twilight module store doesn't reliably carry authToken into every scope: on the\n// SERVER workerd has no AsyncLocalStorage, and on BOTH sides this api client can live in a\n// different module instance than the one rootBeforeLoad populates (engine subpath import vs\n// engine-internal relative import). So `getTwilightContext().authToken` is often null even\n// for logged-in users → API calls (orders/customer/…) return `token_not_provided` (400).\n// Read the token directly from the request cookie (server) or document.cookie / salla.storage\n// (client) as a fallback. The server-only import is stripped from the client bundle by\n// createIsomorphicFn.\nconst readFallbackToken = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(AUTH_TOKEN_COOKIE_NAME) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => {\n const fromCookie =\n typeof document !== 'undefined'\n ? extractTokenFromCookies(document.cookie, AUTH_TOKEN_COOKIE_NAME)\n : null;\n if (fromCookie) return fromCookie;\n const storage = typeof window !== 'undefined' ? window.salla?.storage : undefined;\n const fromStorage =\n typeof storage?.get === 'function' ? storage.get(AUTH_TOKEN_COOKIE_NAME) : null;\n if (typeof fromStorage === 'string' && fromStorage) return fromStorage;\n // `?token=` webview injection lands only on the SDK's axios instance\n const fromSdkApi = typeof window !== 'undefined' ? window.salla?.api?.token : undefined;\n return typeof fromSdkApi === 'string' && fromSdkApi ? fromSdkApi : null;\n });\n\n/**\n * The auth token as the api client sees it: twilight context first, cookie/storage fallback.\n * Use this (not `getTwilightContext().authToken`, which is often null for logged-in users —\n * see the note above) to decide whether an authenticated-only query should run.\n */\nexport const getAuthToken = (): string | null =>\n isAuthTokenRevoked() ? null : (getTwilightContext().authToken ?? readFallbackToken());\n\nconst readRequestCurrency = createIsomorphicFn()\n .server((): string | null => {\n try {\n return toCurrencyCode(getCookie(CURRENCY_COOKIE_NAME));\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\n/**\n * The currency the visitor chose, from the `s-curr` cookie the SDK writes: the API\n * answers in the store's own currency unless the request names one.\n */\nexport function getActiveCurrency(): string | null;\nexport function getActiveCurrency(fallback: string): string;\nexport function getActiveCurrency(fallback: string | null = null): string | null {\n const chosen =\n typeof document !== 'undefined'\n ? extractCurrencyFromCookies(document.cookie)\n : readRequestCurrency();\n return chosen ?? fallback;\n}\n\nconst API_HEADERS = {\n ACCEPT: 'accept',\n ACCEPT_LANGUAGE: 'accept-language',\n APP_OS: 's-app-os',\n APP_VERSION: 's-app-version',\n RAY: 's-ray',\n SOURCE: 's-source',\n THEME_TYPE: 's-theme-type',\n REQUESTED_WITH: 'x-requested-with',\n CF_PROXY_WHITELIST: 's-cf-proxy-whitelist-id',\n STORE_IDENTIFIER: 'store-identifier',\n CURRENCY: 'currency',\n AUTHORIZATION: 'Authorization',\n VERSION_ID: 's-version-id',\n THEME_NAME: 's-theme-name',\n SCOPE_ID: 's-scope-id',\n SCOPE_TYPE: 's-scope-type',\n SCOPE_ALLOCATION_TYPE: 's-scope-allocation-type',\n SCOPE_ALLOCATION_ID: 's-scope-allocation-id',\n USER_AGENT: 'user-agent',\n} as const;\n\n/**\n * The header every Salla API call is answered by store.\n *\n * Exported because a caller that already knows which store it is asking about\n * must be able to say so on the request itself — see `store.settings`. Without\n * it the only way to name a store is the ambient resolver, and \"the identifier\n * I checked\" and \"the identifier that was sent\" become two different things.\n */\nexport const STORE_IDENTIFIER_HEADER = API_HEADERS.STORE_IDENTIFIER;\n\n/**\n * Active scope: the market plus its branch allocation, as the SDK stores it. On the\n * client it comes from `salla.storage.get('scope')`; before the SDK hydrates storage\n * it falls back to the `scope` cookie the theme mirrors that selection into (see\n * writeScopeCookie), then to the scope twilightMiddleware seeded from the same\n * cookie on the server. Requests vary by the `s-scope-*` headers, so React Query\n * keys must include this to avoid serving another branch's cached categories/products.\n *\n * The cookie step matters for hydration: the SDK is not guaranteed to have\n * populated `salla.storage` by the time the client rebuilds a dehydrated query\n * key, and without it the client would compute null against a scoped SSR key.\n */\nexport const getActiveScope = (): ActiveScope | null => {\n // `!== undefined`, not `!= null`: a null here is the SDK authoritatively saying \"no branch\n // selected\", which must beat a cookie left over from the previous selection. Only a\n // not-yet-ready storage API (undefined) falls through to the cookie.\n const fromStorage = readSdkScope();\n if (fromStorage !== undefined) return fromStorage;\n\n if (typeof document !== 'undefined') {\n const fromCookie = extractScopeFromCookies(document.cookie);\n if (fromCookie != null) return fromCookie;\n }\n\n try {\n return getTwilightContext().scope;\n } catch {\n return null;\n }\n};\n\n/** {@link getActiveScope} reduced to the market id. */\nexport const getActiveScopeId = (): string | null => getActiveScope()?.id ?? null;\n\n// The S-Ray (plan score) each store's settings named. Cloudflare routes api.salla.dev by it\n// (100 = VIP cluster, where VIP shoppers' address allocations are cached), so the fixed '50'\n// sent a VIP store's server render to the other cluster. Only the first render of a store in\n// an isolate, the settings call that names it, still goes with the default.\n// ponytail: one entry per store this isolate rendered, unbounded; isolates are short-lived.\nconst storeRays = new Map<string, string>();\n\nfunction rayOf(headers: Record<string, unknown> | undefined): string | null {\n const ray = Object.entries(headers ?? {}).find(([name]) => name.toLowerCase() === 's-ray')?.[1];\n // A plan score (the API sends a number) or nothing: any other value is not a routing input.\n const score = typeof ray === 'number' || typeof ray === 'string' ? String(ray) : '';\n return /^\\d{1,3}$/.test(score) ? score : null;\n}\n\n/** Keeps the S-Ray a store's settings named, for that store's next calls in this isolate. */\nexport function rememberStoreRay(identifier: string, headers: Record<string, unknown> | undefined) {\n const ray = rayOf(headers);\n if (ray) storeRays.set(identifier, ray);\n else storeRays.delete(identifier);\n}\n\nfunction resolveStoreRay(identifier: string | null): string | null {\n const learned = identifier ? storeRays.get(identifier) : undefined;\n if (learned) return learned;\n // The browser never makes the settings call: it reads the score off the settings SSR sent,\n // which are the ambient store's, so never for a call that names another store.\n try {\n if (identifier && identifier !== getStoreIdentifier()) return null;\n return rayOf(getTwilightContext().settings?.headers);\n } catch {\n return null;\n }\n}\n\n// No `s-store-api-version`: a Cloudflare rule on api.salla.dev adds it to the paths the\n// Swoole pool serves. Sent from here, it put every call there, `cart/{id}` among them.\nconst sharedHeaders = (locale: string) => ({\n [API_HEADERS.ACCEPT]: 'application/json' as const,\n [API_HEADERS.ACCEPT_LANGUAGE]: locale,\n [API_HEADERS.APP_OS]: 'browser',\n [API_HEADERS.APP_VERSION]: '2.14.363',\n [API_HEADERS.RAY]: '50',\n [API_HEADERS.SOURCE]: 'twilight',\n [API_HEADERS.THEME_TYPE]: 'react',\n [API_HEADERS.REQUESTED_WITH]: 'XMLHttpRequest',\n [API_HEADERS.CF_PROXY_WHITELIST]: '019a2f78-a64c-7edb-proxy-whitelist-id-9a3a-17afda90f03a',\n});\n\n/**\n * Who a server-rendered call says it is.\n *\n * Every theme worker reaches api.salla.dev from Cloudflare's one Workers address, so\n * salla.dev's per-IP rate limits counted every React store as a single client and\n * refused the calls each page makes (`store/settings` among them: \"Store Unavailable\").\n * The zone skips rate limiting for a User-Agent shaped `Salla-<Name>/<N.N.N> (<env>; <meta>)`\n * from Cloudflare's or AWS's networks, the convention Salla's other services already send.\n *\n * Built from fixed parts: the zone's pattern takes only digits and dots for the version,\n * so a prerelease suffix is dropped, and an unbundled engine (`dev`) reads as `0.0.0`.\n */\nconst SERVER_USER_AGENT = `Salla-TwilightReact/${\n /^\\d+(?:\\.\\d+)*/.exec(ENGINE_VERSION)?.[0] ?? '0.0.0'\n} (${import.meta.env.DEV ? 'development' : 'production'}; ssr)`;\n\n/**\n * Store API base. `VITE_API_URL` override points a preview at a branch backend; unset → prod\n * `api.salla.dev`. Resolution order matters: the value the SSR worker resolved (published into\n * the head, since worker `vars` are server-only `process.env` and never reach the browser\n * bundle) wins, so the hydrated client keeps talking to the backend that rendered the page.\n */\n\nconst STORE_API_BASE =\n getInjectedRuntimeEnv().apiBase || readEnv('VITE_API_URL') || 'https://api.salla.dev/store/v1';\n\n/**\n * Moves a call onto the API base this request was told to use, when it has one.\n *\n * `STORE_API_BASE` is read once per isolate, and one theme worker serves every\n * storefront the dispatcher sends it: production, and the beta and PR preview\n * storefronts (`web[-<hash>].beta.salla.group`), whose Store API is on their own\n * host (`x-salla-api-base`, see `utils/api-base.ts`). So SSR rebases each call per\n * request. In the browser the request store is empty and `STORE_API_BASE` is\n * already the published per-page value, so this does nothing there.\n *\n * After every hook that sets a header, so the request it copies carries them all.\n * It runs only where the dispatcher named a base (beta), and the dev settings cache\n * after it only in a dev build, which never gets that header.\n */\nfunction toRequestApiBase({ request }: { request: Request }): Request | undefined {\n const { apiBase } = getRequestStore();\n if (!apiBase || apiBase === STORE_API_BASE) return undefined;\n const url = rebaseApiUrl(request.url, STORE_API_BASE, apiBase);\n return url ? new Request(url, request) : undefined;\n}\n\nexport const api = ky.extend({\n prefix: STORE_API_BASE,\n timeout: 8000,\n hooks: {\n beforeRequest: [\n ({ request }) => {\n const { locale } = getTwilightContext();\n const headers = sharedHeaders(locale);\n for (const [key, value] of Object.entries(headers)) {\n request.headers.set(key, value);\n }\n // Only when the caller did not say. `headers.set` here would otherwise\n // overwrite a per-request identifier with the ambient one, which is a\n // silent way to answer a question about one store with another's data.\n if (!request.headers.get(API_HEADERS.STORE_IDENTIFIER)) {\n request.headers.set(API_HEADERS.STORE_IDENTIFIER, getStoreIdentifier());\n }\n\n const ray = resolveStoreRay(request.headers.get(API_HEADERS.STORE_IDENTIFIER));\n if (ray) request.headers.set(API_HEADERS.RAY, ray);\n\n // Server only. A browser call comes from the shopper's own address and is\n // counted against it, which is what the zone's limits are for.\n if (typeof document === 'undefined') {\n request.headers.set(API_HEADERS.USER_AGENT, SERVER_USER_AGENT);\n }\n\n const scope = getActiveScope();\n\n // The version the request asked for, else the one the settings named for\n // this scope. Absent means \"whatever is live\", which is what an ordinary\n // storefront visit wants — so a null is left off rather than sent empty.\n const versionId = resolveThemeVersionId(scope?.id ?? null);\n if (versionId) {\n request.headers.set(API_HEADERS.VERSION_ID, versionId);\n }\n\n // The draft theme a preview renders, by the name the Store knows drafts\n // by. Without it the Store answers the draft's version as the store's own\n // theme, and checks the draft's components against that one. Absent on\n // every other call, so an ordinary storefront request is unchanged.\n const draftThemeName = requestedDraftThemeName();\n if (draftThemeName) {\n request.headers.set(API_HEADERS.THEME_NAME, draftThemeName);\n }\n\n const currency = getActiveCurrency();\n if (currency) request.headers.set(API_HEADERS.CURRENCY, currency);\n\n const token = getAuthToken();\n if (token) {\n request.headers.set(API_HEADERS.AUTHORIZATION, `Bearer ${token}`);\n }\n\n // The same four the SDK's own client sends. The API resolves stock per\n // allocation: id alone asks about the market, not the branch the shopper chose.\n if (scope) {\n request.headers.set(API_HEADERS.SCOPE_ID, scope.id);\n if (scope.type) request.headers.set(API_HEADERS.SCOPE_TYPE, scope.type);\n if (scope.allocation_type)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_TYPE, scope.allocation_type);\n if (scope.allocation_id)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_ID, scope.allocation_id);\n }\n },\n toRequestApiBase,\n // Last, so it keys on the request with every header above set.\n devSettingsCache.lookup,\n ],\n afterResponse: [devSettingsCache.store],\n },\n});\n\nexport const cdn = ky.extend({\n prefix: 'https://cdn.salla.network',\n timeout: 5000,\n});\n\n/**\n * The merchant uploader's public bucket, `admin-uploader-prod`.\n *\n * A different host from {@link cdn} and a different thing behind it: this one\n * is an R2 custom domain, so a read never passes through a worker. Storefront\n * translations live here, per language, under `translations/` — see\n * `api/translations.ts`.\n */\nexport const filesCdn = ky.extend({\n prefix: 'https://cdn.files.salla.network',\n timeout: 5000,\n});\n"]}
1
+ {"version":3,"sources":["../src/utils/api-base.ts","../src/utils/engine-version.ts","../src/api/dev-settings-cache.ts","../src/api/client.ts"],"names":["entry","createIsomorphicFn","getCookie"],"mappings":";;;;;;;;;AAWO,IAAM,eAAA,GAAkB;AAG/B,IAAM,aAAA,GAAgB,SAAA;AAQf,SAAS,qBAAA,CACd,QACA,WAAA,EACe;AACf,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,WAAA,EAAa,OAAO,IAAA;AACpC,EAAA,IAAI,GAAA;AACJ,EAAA,IAAI;AACF,IAAA,GAAA,GAAM,IAAI,GAAA,CAAI,MAAA,CAAO,IAAA,EAAM,CAAA;AAAA,EAC7B,CAAA,CAAA,MAAQ;AACN,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,IAAI,GAAA,CAAI,QAAA,KAAa,QAAA,EAAU,OAAO,IAAA;AACtC,EAAA,IAAI,IAAI,IAAA,CAAK,WAAA,OAAkB,WAAA,CAAY,WAAA,IAAe,OAAO,IAAA;AACjE,EAAA,IAAI,GAAA,CAAI,YAAY,GAAA,CAAI,QAAA,IAAY,IAAI,MAAA,IAAU,GAAA,CAAI,MAAM,OAAO,IAAA;AACnE,EAAA,IAAI,IAAI,QAAA,CAAS,OAAA,CAAQ,QAAQ,EAAE,CAAA,KAAM,eAAe,OAAO,IAAA;AAC/D,EAAA,OAAO,CAAA,EAAG,GAAA,CAAI,MAAM,CAAA,EAAG,aAAa,CAAA,CAAA;AACtC;AAOO,SAAS,YAAA,CAAa,GAAA,EAAa,IAAA,EAAc,EAAA,EAA2B;AACjF,EAAA,MAAM,IAAA,GAAO,IAAA,CAAK,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAA;AACpC,EAAA,IAAI,QAAQ,IAAA,IAAQ,CAAC,GAAA,CAAI,UAAA,CAAW,GAAG,IAAI,CAAA,CAAA,CAAG,CAAA,IAAK,CAAC,IAAI,UAAA,CAAW,CAAA,EAAG,IAAI,CAAA,CAAA,CAAG,GAAG,O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Q,QAAQ,GAAA,CAAI,WAAA,CAAY,aAAA,EAAe,CAAA,OAAA,EAAU,KAAK,CAAA,CAAE,CAAA;AAAA,QAClE;AAIA,QAAA,IAAI,KAAA,EAAO;AACT,UAAA,OAAA,CAAQ,OAAA,CAAQ,GAAA,CAAI,WAAA,CAAY,QAAA,EAAU,MAAM,EAAE,CAAA;AAClD,UAAA,IAAI,KAAA,CAAM,MAAM,OAAA,CAAQ,OAAA,CAAQ,IAAI,WAAA,CAAY,UAAA,EAAY,MAAM,IAAI,CAAA;AACtE,UAAA,IAAI,KAAA,CAAM,eAAA;AACR,YAAA,OAAA,CAAQ,OAAA,CAAQ,GAAA,CAAI,WAAA,CAAY,qBAAA,EAAuB,MAAM,eAAe,CAAA;AAC9E,UAAA,IAAI,KAAA,CAAM,aAAA;AACR,YAAA,OAAA,CAAQ,OAAA,CAAQ,GAAA,CAAI,WAAA,CAAY,mBAAA,EAAqB,MAAM,aAAa,CAAA;AAAA,QAC5E;AAAA,MACF,CAAA;AAAA,MACA,gBAAA;AAAA;AAAA,MAEA,gBAAA,CAAiB;AAAA,KACnB;AAAA,IACA,aAAA,EAAe,CAAC,gBAAA,CAAiB,KAAK;AAAA;AAE1C,CAAC;AAEM,IAAM,GAAA,GAAM,GAAG,MAAA,CAAO;AAAA,EAC3B,MAAA,EAAQ,2BAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAC;AAUM,IAAM,QAAA,GAAW,GAAG,MAAA,CAAO;AAAA,EAChC,MAAA,EAAQ,iCAAA;AAAA,EACR,OAAA,EAAS;AACX,CAAC","file":"chunk-LNJUQ2S6.js","sourcesContent":["/**\n * The header the storefront dispatcher names the Store API base in, on the\n * storefronts that must not call production: the beta storefront and its per-PR\n * previews (`web.beta.salla.group`, `web-<hash>.beta.salla.group`). There the\n * Store serves the storefront API under its own address, `https://<host>/api/v1`.\n *\n * Trusted for the same reason `x-salla-store-base` is: the dispatcher sets it\n * after dropping everything off its allowlist, so a visitor's copy never arrives.\n * It is still checked against the request's own host, so even a forged one could\n * only point the theme back at the storefront it is already serving.\n */\nexport const API_BASE_HEADER = 'x-salla-api-base';\n\n/** The one path the dispatcher names: the Store's storefront API under its own host. */\nconst API_BASE_PATH = '/api/v1';\n\n/**\n * The API base this request was told to use, or null for the build's default.\n *\n * Accepted only as `https://<the request's own host>/api/v1` (a trailing slash\n * allowed), with no credentials, query or fragment; returned without the slash.\n */\nexport function resolveRequestApiBase(\n header: string | null | undefined,\n requestHost: string | null\n): string | null {\n if (!header || !requestHost) return null;\n let url: URL;\n try {\n url = new URL(header.trim());\n } catch {\n return null;\n }\n if (url.protocol !== 'https:') return null;\n if (url.host.toLowerCase() !== requestHost.toLowerCase()) return null;\n if (url.username || url.password || url.search || url.hash) return null;\n if (url.pathname.replace(/\\/+$/, '') !== API_BASE_PATH) return null;\n return `${url.origin}${API_BASE_PATH}`;\n}\n\n/**\n * `url` moved from one API base to another: `https://api.salla.dev/store/v1/cart/1`\n * under `https://web.beta.salla.group/api/v1` is `https://web.beta.salla.group/api/v1/cart/1`.\n * Null when `url` is not under `from`, which leaves the request as it was.\n */\nexport function rebaseApiUrl(url: string, from: string, to: string): string | null {\n const base = from.replace(/\\/+$/, '');\n if (url !== base && !url.startsWith(`${base}/`) && !url.startsWith(`${base}?`)) return null;\n return to.replace(/\\/+$/, '') + url.slice(base.length);\n}\n","/**\n * The engine's own build version, injected by tsup `define` when dist is\n * built. Falls back to 'dev' when the source runs unbundled (vitest, direct\n * src imports in the monorepo).\n *\n * Exposed at runtime as `salla.versions.engine` by `useTwilightInit` so a\n * storefront can always be asked which engine build rendered it.\n */\nexport const ENGINE_VERSION: string =\n typeof __TWILIGHT_ENGINE_VERSION__ !== 'undefined' ? __TWILIGHT_ENGINE_VERSION__ : 'dev';\n","import type { AfterResponseHook, BeforeRequestHook } from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { DEV_SETTINGS_REFRESH_COOKIE } from '../utils/dev-settings-refresh';\n\n/**\n * A dev server reuses a store's settings for up to an hour.\n *\n * Every server render asks the API for `store/settings`, and a developer clicking\n * around a theme renders dozens of pages a minute. The API answers a burst of\n * settings requests for one store from one address with a challenge, which a\n * server-side fetch cannot pass, so the dev server rendered \"Store Unavailable\"\n * (6.05k challenged `(development; ssr)` calls in the 7 days to 2026-10-25). In\n * development, on the server, the same request within {@link DEV_SETTINGS_TTL_MS}\n * is answered from memory instead. An hour because the API counts settings\n * requests per hour, so one fetch an hour can never reach its limit; the theme\n * editor's \"Fetch fresh store data\" fetches sooner, and says how old the settings\n * are. A production build never runs it: `import.meta.env.DEV` is statically\n * false there.\n */\nexport const DEV_SETTINGS_TTL_MS = 60 * 60_000;\n\n/** Marks an answer from memory, so the store step does not file it again. */\nconst HIT_HEADER = 'x-twilight-dev-cache';\n\n/** When the answer was really fetched from the API (epoch ms), on fresh answers and reused ones alike. */\nconst FETCHED_AT_HEADER = 'x-twilight-dev-fetched-at';\n\n/**\n * When the dev server fetched these settings from the API, read off the answer the\n * cache handed back; `undefined` when the cache did not handle the call (a\n * production build, the browser, a test), so nothing new reaches the settings there.\n */\nexport function devSettingsFetchedAt(headers: Headers | undefined): number | undefined {\n const at = Number(headers?.get(FETCHED_AT_HEADER));\n return Number.isFinite(at) && at > 0 ? at : undefined;\n}\n\n/**\n * Not carried over to an answer from memory: the body is stored decoded, so its\n * original encoding and length no longer describe it.\n */\nconst DROPPED_HEADERS = new Set(['content-encoding', 'content-length']);\n\ninterface Entry {\n body: string;\n status: number;\n statusText: string;\n headers: [string, string][];\n fetchedAt: number;\n /** The refresh cookie's value when this answer was fetched. */\n refresh: string | null;\n}\n\nexport interface DevSettingsCacheOptions {\n /** Whether this call may use the cache at all. */\n enabled: () => boolean;\n /** The current value of {@link DEV_SETTINGS_REFRESH_COOKIE}, or null. */\n refreshToken: () => string | null;\n now?: () => number;\n ttlMs?: number;\n /** Called the first time an answer comes from memory. */\n onFirstHit?: () => void;\n}\n\nfunction isSettingsRequest(request: Request): boolean {\n if (request.method !== 'GET') return false;\n try {\n return new URL(request.url).pathname.endsWith('/store/settings');\n } catch {\n return false;\n }\n}\n\n/**\n * An answer `requestSettings` accepts: JSON carrying `data`. A 200 without it is\n * refused there as \"Store Unavailable\"; kept here, it would be refused for the next\n * hour too, after the API had recovered.\n */\nfunction hasSettings(body: string): boolean {\n try {\n return Boolean((JSON.parse(body) as { data?: unknown } | null)?.data);\n } catch {\n return false;\n }\n}\n\n/**\n * The request as the API receives it: method, URL and every header the client's\n * hooks set. Keyed on the request itself rather than on the inputs that build it,\n * so a header added to the client later cannot be missing from the key.\n */\nfunction keyOf(request: Request): string {\n const headers = [...request.headers].map(([name, value]) => `${name}: ${value}`).join('\\n');\n return `${request.method} ${request.url}\\n${headers}`;\n}\n\n/**\n * The two ky hooks behind the cache: `lookup` runs last among `beforeRequest`, once\n * every header is set, and `store` among `afterResponse`. Only an answer with\n * settings in it is kept, so a timeout, a 429, a challenge or an empty 200 is asked\n * again on the next render.\n */\nexport function createDevSettingsCache(options: DevSettingsCacheOptions) {\n const {\n enabled,\n refreshToken,\n now = Date.now,\n ttlMs = DEV_SETTINGS_TTL_MS,\n onFirstHit,\n } = options;\n const entries = new Map<string, Entry>();\n let announced = false;\n\n const isFresh = (entry: Entry): boolean =>\n now() - entry.fetchedAt < ttlMs && entry.refresh === refreshToken();\n\n const answerOf = (entry: Entry, hit: boolean): Response => {\n const headers = new Headers(entry.headers);\n headers.set(FETCHED_AT_HEADER, String(entry.fetchedAt));\n if (hit) headers.set(HIT_HEADER, 'hit');\n return new Response(entry.body, {\n status: entry.status,\n statusText: entry.statusText,\n headers,\n });\n };\n\n const lookup: BeforeRequestHook = ({ request }) => {\n if (!enabled() || !isSettingsRequest(request)) return;\n const key = keyOf(request);\n const entry = entries.get(key);\n if (!entry) return;\n if (!isFresh(entry)) {\n entries.delete(key);\n return;\n }\n if (!announced) {\n announced = true;\n onFirstHit?.();\n }\n return answerOf(entry, true);\n };\n\n const store: AfterResponseHook = async ({ request, response }) => {\n if (!enabled() || !isSettingsRequest(request) || !response.ok) return;\n if (response.headers.has(HIT_HEADER)) return;\n // ky hands each hook a clone, so reading it leaves the answer it returns intact.\n const body = await response.text();\n if (!hasSettings(body)) return;\n for (const [key, entry] of entries) {\n if (now() - entry.fetchedAt >= ttlMs) entries.delete(key);\n }\n const entry: Entry = {\n body,\n status: response.status,\n statusText: response.statusText,\n headers: [...response.headers].filter(([name]) => !DROPPED_HEADERS.has(name)),\n fetchedAt: now(),\n refresh: refreshToken(),\n };\n entries.set(keyOf(request), entry);\n // Handed on in place of the API's own answer, so it carries its fetch time too.\n return answerOf(entry, false);\n };\n\n return { lookup, store, clear: () => entries.clear() };\n}\n\nconst readRefreshCookie = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(DEV_SETTINGS_REFRESH_COOKIE) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\nexport const devSettingsCache = createDevSettingsCache({\n // A dev server's render only. A production build has `DEV` statically false,\n // the browser keeps the settings it was handed in its query cache, and vitest\n // runs in `test` mode, where every test wants the request it mocked.\n enabled: () =>\n import.meta.env.DEV && import.meta.env.MODE !== 'test' && typeof document === 'undefined',\n refreshToken: readRefreshCookie,\n onFirstHit: () =>\n console.warn(\n `[twilight] Store settings are reused for up to ${DEV_SETTINGS_TTL_MS / 60_000} minutes while you develop, to stay under the Salla API's rate limit. To see a change you made in the dashboard, press \"Fetch fresh store data\" in the theme editor's side panel: it also says when they were last fetched.`\n ),\n});\n","import ky from 'ky';\nimport { createIsomorphicFn } from '@tanstack/react-start';\nimport { getCookie } from '@tanstack/react-start/server';\nimport { getStoreIdentifier } from '../utils/sdk-helpers';\nimport { requestedDraftThemeName, resolveThemeVersionId } from '../utils/theme-version';\nimport { getInjectedRuntimeEnv, readEnv } from '../utils/runtime-env';\nimport { getRequestStore, getTwilightContext, isAuthTokenRevoked } from '../twilight/context';\nimport { rebaseApiUrl } from '../utils/api-base';\nimport { ENGINE_VERSION } from '../utils/engine-version';\nimport { devSettingsCache } from './dev-settings-cache';\nimport {\n AUTH_TOKEN_COOKIE_NAME,\n CURRENCY_COOKIE_NAME,\n extractCurrencyFromCookies,\n extractScopeFromCookies,\n toCurrencyCode,\n extractTokenFromCookies,\n readSdkScope,\n type ActiveScope,\n} from '../utils/cookies';\n\n// The twilight module store doesn't reliably carry authToken into every scope: on the\n// SERVER workerd has no AsyncLocalStorage, and on BOTH sides this api client can live in a\n// different module instance than the one rootBeforeLoad populates (engine subpath import vs\n// engine-internal relative import). So `getTwilightContext().authToken` is often null even\n// for logged-in users → API calls (orders/customer/…) return `token_not_provided` (400).\n// Read the token directly from the request cookie (server) or document.cookie / salla.storage\n// (client) as a fallback. The server-only import is stripped from the client bundle by\n// createIsomorphicFn.\nconst readFallbackToken = createIsomorphicFn()\n .server((): string | null => {\n try {\n return getCookie(AUTH_TOKEN_COOKIE_NAME) ?? null;\n } catch {\n return null;\n }\n })\n .client((): string | null => {\n const fromCookie =\n typeof document !== 'undefined'\n ? extractTokenFromCookies(document.cookie, AUTH_TOKEN_COOKIE_NAME)\n : null;\n if (fromCookie) return fromCookie;\n const storage = typeof window !== 'undefined' ? window.salla?.storage : undefined;\n const fromStorage =\n typeof storage?.get === 'function' ? storage.get(AUTH_TOKEN_COOKIE_NAME) : null;\n if (typeof fromStorage === 'string' && fromStorage) return fromStorage;\n // `?token=` webview injection lands only on the SDK's axios instance\n const fromSdkApi = typeof window !== 'undefined' ? window.salla?.api?.token : undefined;\n return typeof fromSdkApi === 'string' && fromSdkApi ? fromSdkApi : null;\n });\n\n/**\n * The auth token as the api client sees it: twilight context first, cookie/storage fallback.\n * Use this (not `getTwilightContext().authToken`, which is often null for logged-in users —\n * see the note above) to decide whether an authenticated-only query should run.\n */\nexport const getAuthToken = (): string | null =>\n isAuthTokenRevoked() ? null : (getTwilightContext().authToken ?? readFallbackToken());\n\nconst readRequestCurrency = createIsomorphicFn()\n .server((): string | null => {\n try {\n return toCurrencyCode(getCookie(CURRENCY_COOKIE_NAME));\n } catch {\n return null;\n }\n })\n .client((): string | null => null);\n\n/**\n * The currency the visitor chose, from the `s-curr` cookie the SDK writes: the API\n * answers in the store's own currency unless the request names one.\n */\nexport function getActiveCurrency(): string | null;\nexport function getActiveCurrency(fallback: string): string;\nexport function getActiveCurrency(fallback: string | null = null): string | null {\n const chosen =\n typeof document !== 'undefined'\n ? extractCurrencyFromCookies(document.cookie)\n : readRequestCurrency();\n return chosen ?? fallback;\n}\n\nconst API_HEADERS = {\n ACCEPT: 'accept',\n ACCEPT_LANGUAGE: 'accept-language',\n APP_OS: 's-app-os',\n APP_VERSION: 's-app-version',\n RAY: 's-ray',\n SOURCE: 's-source',\n THEME_TYPE: 's-theme-type',\n REQUESTED_WITH: 'x-requested-with',\n CF_PROXY_WHITELIST: 's-cf-proxy-whitelist-id',\n STORE_IDENTIFIER: 'store-identifier',\n CURRENCY: 'currency',\n AUTHORIZATION: 'Authorization',\n VERSION_ID: 's-version-id',\n THEME_NAME: 's-theme-name',\n SCOPE_ID: 's-scope-id',\n SCOPE_TYPE: 's-scope-type',\n SCOPE_ALLOCATION_TYPE: 's-scope-allocation-type',\n SCOPE_ALLOCATION_ID: 's-scope-allocation-id',\n USER_AGENT: 'user-agent',\n} as const;\n\n/**\n * The header every Salla API call is answered by store.\n *\n * Exported because a caller that already knows which store it is asking about\n * must be able to say so on the request itself — see `store.settings`. Without\n * it the only way to name a store is the ambient resolver, and \"the identifier\n * I checked\" and \"the identifier that was sent\" become two different things.\n */\nexport const STORE_IDENTIFIER_HEADER = API_HEADERS.STORE_IDENTIFIER;\n\n/**\n * Active scope: the market plus its branch allocation, as the SDK stores it. On the\n * client it comes from `salla.storage.get('scope')`; before the SDK hydrates storage\n * it falls back to the `scope` cookie the theme mirrors that selection into (see\n * writeScopeCookie), then to the scope twilightMiddleware seeded from the same\n * cookie on the server. Requests vary by the `s-scope-*` headers, so React Query\n * keys must include this to avoid serving another branch's cached categories/products.\n *\n * The cookie step matters for hydration: the SDK is not guaranteed to have\n * populated `salla.storage` by the time the client rebuilds a dehydrated query\n * key, and without it the client would compute null against a scoped SSR key.\n */\nexport const getActiveScope = (): ActiveScope | null => {\n // `!== undefined`, not `!= null`: a null here is the SDK authoritatively saying \"no branch\n // selected\", which must beat a cookie left over from the previous selection. Only a\n // not-yet-ready storage API (undefined) falls through to the cookie.\n const fromStorage = readSdkScope();\n if (fromStorage !== undefined) return fromStorage;\n\n if (typeof document !== 'undefined') {\n const fromCookie = extractScopeFromCookies(document.cookie);\n if (fromCookie != null) return fromCookie;\n }\n\n try {\n return getTwilightContext().scope;\n } catch {\n return null;\n }\n};\n\n/** {@link getActiveScope} reduced to the market id. */\nexport const getActiveScopeId = (): string | null => getActiveScope()?.id ?? null;\n\n// The S-Ray (plan score) each store's settings named. Cloudflare routes api.salla.dev by it\n// (100 = VIP cluster, where VIP shoppers' address allocations are cached), so the fixed '50'\n// sent a VIP store's server render to the other cluster. Only the first render of a store in\n// an isolate, the settings call that names it, still goes with the default.\n// ponytail: one entry per store this isolate rendered, unbounded; isolates are short-lived.\nconst storeRays = new Map<string, string>();\n\nfunction rayOf(headers: Record<string, unknown> | undefined): string | null {\n const ray = Object.entries(headers ?? {}).find(([name]) => name.toLowerCase() === 's-ray')?.[1];\n // A plan score (the API sends a number) or nothing: any other value is not a routing input.\n const score = typeof ray === 'number' || typeof ray === 'string' ? String(ray) : '';\n return /^\\d{1,3}$/.test(score) ? score : null;\n}\n\n/** Keeps the S-Ray a store's settings named, for that store's next calls in this isolate. */\nexport function rememberStoreRay(identifier: string, headers: Record<string, unknown> | undefined) {\n const ray = rayOf(headers);\n if (ray) storeRays.set(identifier, ray);\n else storeRays.delete(identifier);\n}\n\nfunction resolveStoreRay(identifier: string | null): string | null {\n const learned = identifier ? storeRays.get(identifier) : undefined;\n if (learned) return learned;\n // The browser never makes the settings call: it reads the score off the settings SSR sent,\n // which are the ambient store's, so never for a call that names another store.\n try {\n if (identifier && identifier !== getStoreIdentifier()) return null;\n return rayOf(getTwilightContext().settings?.headers);\n } catch {\n return null;\n }\n}\n\n// No `s-store-api-version`: a Cloudflare rule on api.salla.dev adds it to the paths the\n// Swoole pool serves. Sent from here, it put every call there, `cart/{id}` among them.\nconst sharedHeaders = (locale: string) => ({\n [API_HEADERS.ACCEPT]: 'application/json' as const,\n [API_HEADERS.ACCEPT_LANGUAGE]: locale,\n [API_HEADERS.APP_OS]: 'browser',\n [API_HEADERS.APP_VERSION]: '2.14.363',\n [API_HEADERS.RAY]: '50',\n [API_HEADERS.SOURCE]: 'twilight',\n [API_HEADERS.THEME_TYPE]: 'react',\n [API_HEADERS.REQUESTED_WITH]: 'XMLHttpRequest',\n [API_HEADERS.CF_PROXY_WHITELIST]: '019a2f78-a64c-7edb-proxy-whitelist-id-9a3a-17afda90f03a',\n});\n\n/**\n * Who a server-rendered call says it is.\n *\n * Every theme worker reaches api.salla.dev from Cloudflare's one Workers address, so\n * salla.dev's per-IP rate limits counted every React store as a single client and\n * refused the calls each page makes (`store/settings` among them: \"Store Unavailable\").\n * The zone skips rate limiting for a User-Agent shaped `Salla-<Name>/<N.N.N> (<env>; <meta>)`\n * from Cloudflare's or AWS's networks, the convention Salla's other services already send.\n *\n * Built from fixed parts: the zone's pattern takes only digits and dots for the version,\n * so a prerelease suffix is dropped, and an unbundled engine (`dev`) reads as `0.0.0`.\n */\nconst SERVER_USER_AGENT = `Salla-TwilightReact/${\n /^\\d+(?:\\.\\d+)*/.exec(ENGINE_VERSION)?.[0] ?? '0.0.0'\n} (${import.meta.env.DEV ? 'development' : 'production'}; ssr)`;\n\n/**\n * Store API base. `VITE_API_URL` override points a preview at a branch backend; unset → prod\n * `api.salla.dev`. Resolution order matters: the value the SSR worker resolved (published into\n * the head, since worker `vars` are server-only `process.env` and never reach the browser\n * bundle) wins, so the hydrated client keeps talking to the backend that rendered the page.\n */\n\nconst STORE_API_BASE =\n getInjectedRuntimeEnv().apiBase || readEnv('VITE_API_URL') || 'https://api.salla.dev/store/v1';\n\n/**\n * Moves a call onto the API base this request was told to use, when it has one.\n *\n * `STORE_API_BASE` is read once per isolate, and one theme worker serves every\n * storefront the dispatcher sends it: production, and the beta and PR preview\n * storefronts (`web[-<hash>].beta.salla.group`), whose Store API is on their own\n * host (`x-salla-api-base`, see `utils/api-base.ts`). So SSR rebases each call per\n * request. In the browser the request store is empty and `STORE_API_BASE` is\n * already the published per-page value, so this does nothing there.\n *\n * After every hook that sets a header, so the request it copies carries them all.\n * It runs only where the dispatcher named a base (beta), and the dev settings cache\n * after it only in a dev build, which never gets that header.\n */\nfunction toRequestApiBase({ request }: { request: Request }): Request | undefined {\n const { apiBase } = getRequestStore();\n if (!apiBase || apiBase === STORE_API_BASE) return undefined;\n const url = rebaseApiUrl(request.url, STORE_API_BASE, apiBase);\n return url ? new Request(url, request) : undefined;\n}\n\nexport const api = ky.extend({\n prefix: STORE_API_BASE,\n timeout: 8000,\n hooks: {\n beforeRequest: [\n ({ request }) => {\n const { locale } = getTwilightContext();\n const headers = sharedHeaders(locale);\n for (const [key, value] of Object.entries(headers)) {\n request.headers.set(key, value);\n }\n // Only when the caller did not say. `headers.set` here would otherwise\n // overwrite a per-request identifier with the ambient one, which is a\n // silent way to answer a question about one store with another's data.\n if (!request.headers.get(API_HEADERS.STORE_IDENTIFIER)) {\n request.headers.set(API_HEADERS.STORE_IDENTIFIER, getStoreIdentifier());\n }\n\n const ray = resolveStoreRay(request.headers.get(API_HEADERS.STORE_IDENTIFIER));\n if (ray) request.headers.set(API_HEADERS.RAY, ray);\n\n // Server only. A browser call comes from the shopper's own address and is\n // counted against it, which is what the zone's limits are for.\n if (typeof document === 'undefined') {\n request.headers.set(API_HEADERS.USER_AGENT, SERVER_USER_AGENT);\n }\n\n const scope = getActiveScope();\n\n // The version the request asked for, else the one the settings named for\n // this scope. Absent means \"whatever is live\", which is what an ordinary\n // storefront visit wants — so a null is left off rather than sent empty.\n const versionId = resolveThemeVersionId(scope?.id ?? null);\n if (versionId) {\n request.headers.set(API_HEADERS.VERSION_ID, versionId);\n }\n\n // The draft theme a preview renders, by the name the Store knows drafts\n // by. Without it the Store answers the draft's version as the store's own\n // theme, and checks the draft's components against that one. Absent on\n // every other call, so an ordinary storefront request is unchanged.\n const draftThemeName = requestedDraftThemeName();\n if (draftThemeName) {\n request.headers.set(API_HEADERS.THEME_NAME, draftThemeName);\n }\n\n const currency = getActiveCurrency();\n if (currency) request.headers.set(API_HEADERS.CURRENCY, currency);\n\n const token = getAuthToken();\n if (token) {\n request.headers.set(API_HEADERS.AUTHORIZATION, `Bearer ${token}`);\n }\n\n // The same four the SDK's own client sends. The API resolves stock per\n // allocation: id alone asks about the market, not the branch the shopper chose.\n if (scope) {\n request.headers.set(API_HEADERS.SCOPE_ID, scope.id);\n if (scope.type) request.headers.set(API_HEADERS.SCOPE_TYPE, scope.type);\n if (scope.allocation_type)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_TYPE, scope.allocation_type);\n if (scope.allocation_id)\n request.headers.set(API_HEADERS.SCOPE_ALLOCATION_ID, scope.allocation_id);\n }\n },\n toRequestApiBase,\n // Last, so it keys on the request with every header above set.\n devSettingsCache.lookup,\n ],\n afterResponse: [devSettingsCache.store],\n },\n});\n\nexport const cdn = ky.extend({\n prefix: 'https://cdn.salla.network',\n timeout: 5000,\n});\n\n/**\n * The merchant uploader's public bucket, `admin-uploader-prod`.\n *\n * A different host from {@link cdn} and a different thing behind it: this one\n * is an R2 custom domain, so a read never passes through a worker. Storefront\n * translations live here, per language, under `translations/` — see\n * `api/translations.ts`.\n */\nexport const filesCdn = ky.extend({\n prefix: 'https://cdn.files.salla.network',\n timeout: 5000,\n});\n"]}
@@ -1,5 +1,5 @@
1
- import { orThrow } from './chunk-FFGAHJTO.js';
2
- import { getActiveScope, api } from './chunk-ICD5UHUM.js';
1
+ import { orThrow } from './chunk-JK2FVL6U.js';
2
+ import { getActiveScope, api } from './chunk-LNJUQ2S6.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-LM2BNMAO.js.map
30
- //# sourceMappingURL=chunk-LM2BNMAO.js.map
29
+ //# sourceMappingURL=chunk-LPGCUQGP.js.map
30
+ //# sourceMappingURL=chunk-LPGCUQGP.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-LM2BNMAO.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-LPGCUQGP.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,22 +1,22 @@
1
1
  import { Footer } from './chunk-K4HCMVAQ.js';
2
- import { useCanvasHost } from './chunk-GGIB56FK.js';
2
+ import { useCanvasHost } from './chunk-HJKJVBYI.js';
3
3
  import { getModelContext } from './chunk-Q77J3D2W.js';
4
- import { Header } from './chunk-6RR3OXAF.js';
4
+ import { Header } from './chunk-IWECQPA3.js';
5
5
  import { editorFrame, previewTheme, LIVE_EDITOR_DISABLE_ACTION, postToEditor, FRAME_LOADED_ACTION } from './chunk-K4QQRA6L.js';
6
- import { useDevSettingsOverrides, useDevReportSettingsFetchedAt } from './chunk-5P2ZVC6Z.js';
7
- import { resolveTwilightSdkUrl, TICKETING_SCRIPT_URL } from './chunk-TQSP663S.js';
6
+ import { useDevSettingsOverrides, useDevReportSettingsFetchedAt } from './chunk-Z5DX5AXM.js';
7
+ import { resolveTwilightSdkUrl, TICKETING_SCRIPT_URL } from './chunk-GBZBG3VU.js';
8
8
  import { color } from './chunk-VVZNW5CB.js';
9
9
  import { applyThemeHookSlots, installAppScope } from './chunk-QJOTD2GJ.js';
10
- import { apps } from './chunk-ZTW6GPAG.js';
11
- import { cart, replaceSdkCart } from './chunk-YSY76O6D.js';
10
+ import { apps } from './chunk-7R4SNM3G.js';
11
+ import { cart, replaceSdkCart } from './chunk-OT4UEO5H.js';
12
12
  import { withOwnerMaintenanceButton, withoutMaintenanceOnPreviewHost } from './chunk-O7JTXTGP.js';
13
- import { useLocation, useIsHome, NavigationInterceptor } from './chunk-FFGAHJTO.js';
14
- import { useUser } from './chunk-C2LUCXC3.js';
13
+ import { useLocation, useIsHome, NavigationInterceptor } from './chunk-JK2FVL6U.js';
14
+ import { useUser } from './chunk-PGM5R2XW.js';
15
15
  import { DocumentClassProvider, useDocumentClass } from './chunk-JWXJPJBO.js';
16
16
  import { WidgetHead } from './chunk-FWNSNBLY.js';
17
17
  import { HookSlot } from './chunk-XZFWBF3P.js';
18
18
  import { hookRegistry } from './chunk-GCPEMNSU.js';
19
- import { getActiveCurrency, ENGINE_VERSION } from './chunk-ICD5UHUM.js';
19
+ import { getActiveCurrency, ENGINE_VERSION } from './chunk-LNJUQ2S6.js';
20
20
  import { useTranslation, I18nProvider } from './chunk-TYNZ5B2B.js';
21
21
  import { Toaster } from './chunk-2QDPVKV3.js';
22
22
  import { isNativeApp } from './chunk-BZ2QSBXM.js';
@@ -390,16 +390,16 @@ function useWebMcpSupported() {
390
390
  }
391
391
  var navigationSetups = {
392
392
  tanstack: lazyComponent(
393
- () => import('./navigation-PALIYZRL.js').then((m) => ({ default: m.NavigationSetup }))
393
+ () => import('./navigation-COMJX7AY.js').then((m) => ({ default: m.NavigationSetup }))
394
394
  ),
395
395
  // Not preloaded with the rest: a TanStack worker would load Next.js code it never runs.
396
- nextjs: lazy(() => import('./navigation-4RDDJ27X.js').then((m) => ({ default: m.NavigationSetup })))
396
+ nextjs: lazy(() => import('./navigation-WOID2TUS.js').then((m) => ({ default: m.NavigationSetup })))
397
397
  };
398
398
 
399
399
  // src/providers/DocumentSyncRegistry.ts
400
400
  var routeDocumentSyncs = {
401
401
  tanstack: lazyComponent(
402
- () => import('./document-class-PDL2FCQG.js').then((m) => ({
402
+ () => import('./document-class-YA2Z4FVP.js').then((m) => ({
403
403
  default: m.TanStackDocumentSync
404
404
  }))
405
405
  )
@@ -537,6 +537,14 @@ function useMoney() {
537
537
  };
538
538
  return { format, parse, isValid };
539
539
  }
540
+
541
+ // src/utils/product-price.ts
542
+ function activePrice(product) {
543
+ const sale = Number(product.sale_price);
544
+ return product.is_on_sale && sale > 0 ? sale : Number(product.price);
545
+ }
546
+
547
+ // src/hooks/useGtm.ts
540
548
  function eventId(prefix) {
541
549
  return `${prefix}_${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
542
550
  }
@@ -544,7 +552,7 @@ function toProduct(product, overrides) {
544
552
  return {
545
553
  id: product.id,
546
554
  name: product.name,
547
- price: product.sale_price,
555
+ price: activePrice(product),
548
556
  brand: product.brand?.name,
549
557
  category: product.category?.name,
550
558
  quantity: 1,
@@ -912,7 +920,7 @@ function injectFastCheckoutScript() {
912
920
  document.head.appendChild(s);
913
921
  }
914
922
  var GoogleTagBody = lazyComponent(
915
- () => import('./GoogleTag-X5FQ66HX.js').then((m) => ({ default: m.GoogleTagBody }))
923
+ () => import('./GoogleTag-4IUBSGDQ.js').then((m) => ({ default: m.GoogleTagBody }))
916
924
  );
917
925
  var TwilightBundles = lazyComponent(
918
926
  () => import('./TwilightBundles-G6GHWBID.js').then((m) => ({ default: m.TwilightBundles }))
@@ -921,7 +929,7 @@ var LazySiftSnippet = lazyComponent(
921
929
  () => import('./SiftSnippet-5FCU6TR6.js').then((m) => ({ default: m.SiftSnippet }))
922
930
  );
923
931
  var LazyStoreClosedNotification = lazyComponent(
924
- () => import('./StoreClosedNotification-4XJJD6EH.js').then((m) => ({
932
+ () => import('./StoreClosedNotification-TBTT2KU2.js').then((m) => ({
925
933
  default: m.StoreClosedNotification
926
934
  }))
927
935
  );
@@ -1167,7 +1175,7 @@ function SallaSdkScripts({ settings }) {
1167
1175
 
1168
1176
  // src/components/store/lazy.ts
1169
1177
  var LazyStoreClosedNotification2 = lazyComponent(
1170
- () => import('./StoreClosedNotification-4XJJD6EH.js').then((m) => ({
1178
+ () => import('./StoreClosedNotification-TBTT2KU2.js').then((m) => ({
1171
1179
  default: m.StoreClosedNotification
1172
1180
  }))
1173
1181
  );
@@ -1220,7 +1228,7 @@ var LazyLiveEditorBar = lazyComponent(
1220
1228
  () => import('./LiveEditorBar-BSCHU7WO.js').then((m) => ({ default: m.LiveEditorBar }))
1221
1229
  );
1222
1230
  var LazyCanvasOverlay = lazyComponent(
1223
- () => import('./CanvasOverlay-P7UGA42D.js').then((m) => ({ default: m.CanvasOverlay }))
1231
+ () => import('./CanvasOverlay-65WZ3VPB.js').then((m) => ({ default: m.CanvasOverlay }))
1224
1232
  );
1225
1233
  function LiveEditor() {
1226
1234
  const [frame, setFrame] = useState(null);
@@ -1257,7 +1265,7 @@ function LiveEditor() {
1257
1265
  if (!frame || disabled) return null;
1258
1266
  return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyLiveEditorBar, { origin: frame.origin, dev: frame.dev }) });
1259
1267
  }
1260
- var LazyWebMcpTools = React2.lazy(() => import('./WebMcpTools-UQ5TLWW4.js'));
1268
+ var LazyWebMcpTools = React2.lazy(() => import('./WebMcpTools-UCY4IWDN.js'));
1261
1269
  function WebMcpMount() {
1262
1270
  if (!useWebMcpSupported()) return null;
1263
1271
  return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyWebMcpTools, {}) });
@@ -1548,6 +1556,6 @@ function useStore() {
1548
1556
  return { ...store, refresh };
1549
1557
  }
1550
1558
 
1551
- export { LazyMaintenancePage, LazyStoreClosedNotification2 as LazyStoreClosedNotification, MasterLayout, TwilightProvider, fastCheckoutScript, registerDefaultHooks, registerDocumentSync, routeDocumentSyncs, useBreadcrumbs, useDate, useGtm, useMoney, useNumber, useOpeningHours, usePageConfig, useStore };
1552
- //# sourceMappingURL=chunk-R5N7UED2.js.map
1553
- //# sourceMappingURL=chunk-R5N7UED2.js.map
1559
+ export { LazyMaintenancePage, LazyStoreClosedNotification2 as LazyStoreClosedNotification, MasterLayout, TwilightProvider, activePrice, fastCheckoutScript, registerDefaultHooks, registerDocumentSync, routeDocumentSyncs, useBreadcrumbs, useDate, useGtm, useMoney, useNumber, useOpeningHours, usePageConfig, useStore };
1560
+ //# sourceMappingURL=chunk-MRBNEIHQ.js.map
1561
+ //# sourceMappingURL=chunk-MRBNEIHQ.js.map