@salla.sa/twilight-theme-engine 1.0.163 → 1.0.164

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 (322) hide show
  1. package/dist/{AddToCartForm-2D4D2T2X.js → AddToCartForm-O6CLISF2.js} +3 -3
  2. package/dist/{AddToCartForm-2D4D2T2X.js.map → AddToCartForm-O6CLISF2.js.map} +1 -1
  3. package/dist/{BlogAuthorPage-ELZPCZEE.js → BlogAuthorPage-CW52BKQZ.js} +22 -21
  4. package/dist/BlogAuthorPage-CW52BKQZ.js.map +1 -0
  5. package/dist/{BlogCategoryPage-MADVXTFU.js → BlogCategoryPage-XXGAXQ5K.js} +22 -21
  6. package/dist/BlogCategoryPage-XXGAXQ5K.js.map +1 -0
  7. package/dist/{BlogPage-DTHRWEHK.js → BlogPage-VOFYWE4C.js} +20 -19
  8. package/dist/BlogPage-VOFYWE4C.js.map +1 -0
  9. package/dist/{BlogSinglePage-BSHIPWOR.js → BlogSinglePage-UKI5JAIB.js} +20 -19
  10. package/dist/BlogSinglePage-UKI5JAIB.js.map +1 -0
  11. package/dist/{BlogTagPage-YIGA3QZQ.js → BlogTagPage-FRDP6EZ2.js} +22 -21
  12. package/dist/BlogTagPage-FRDP6EZ2.js.map +1 -0
  13. package/dist/{BrandsPage-AD7RKXIC.js → BrandsPage-FWAASSUP.js} +21 -20
  14. package/dist/BrandsPage-FWAASSUP.js.map +1 -0
  15. package/dist/{Breadcrumb-O7YJIL52.js → Breadcrumb-Z4PR66RS.js} +20 -19
  16. package/dist/Breadcrumb-Z4PR66RS.js.map +1 -0
  17. package/dist/{CartItem-7A45S2WC.js → CartItem-IIHIWUIY.js} +20 -19
  18. package/dist/CartItem-IIHIWUIY.js.map +1 -0
  19. package/dist/{CartSummary-V6VP6MI5.js → CartSummary-XKC2MGTJ.js} +20 -19
  20. package/dist/CartSummary-XKC2MGTJ.js.map +1 -0
  21. package/dist/{Copyright-M2TKSKKL.js → Copyright-FHZS3TKO.js} +3 -3
  22. package/dist/{Copyright-M2TKSKKL.js.map → Copyright-FHZS3TKO.js.map} +1 -1
  23. package/dist/{CustomerLayout-LTP5EG72.js → CustomerLayout-RPQUKERT.js} +20 -19
  24. package/dist/CustomerLayout-RPQUKERT.js.map +1 -0
  25. package/dist/{Footer-PZVBBZKT.js → Footer-LBVQTLZ6.js} +4 -4
  26. package/dist/{Footer-PZVBBZKT.js.map → Footer-LBVQTLZ6.js.map} +1 -1
  27. package/dist/GoogleTag-SWQF6GIR.js +15 -0
  28. package/dist/{GoogleTag-NHGB476C.js.map → GoogleTag-SWQF6GIR.js.map} +1 -1
  29. package/dist/{Header-MOLMVHTO.js → Header-7NZ2QG6E.js} +8 -8
  30. package/dist/{Header-MOLMVHTO.js.map → Header-7NZ2QG6E.js.map} +1 -1
  31. package/dist/{LatestProducts-HZOHWLLU.js → LatestProducts-H7RJ7H6R.js} +22 -21
  32. package/dist/LatestProducts-H7RJ7H6R.js.map +1 -0
  33. package/dist/{LoyaltyPage-VKVING2R.js → LoyaltyPage-6RIC4UHO.js} +20 -19
  34. package/dist/LoyaltyPage-6RIC4UHO.js.map +1 -0
  35. package/dist/{LoyaltyPointsPage-RIIJOEAF.js → LoyaltyPointsPage-D23TGJIJ.js} +6 -6
  36. package/dist/{LoyaltyPointsPage-RIIJOEAF.js.map → LoyaltyPointsPage-D23TGJIJ.js.map} +1 -1
  37. package/dist/{MainMenu-LLVGN66B.js → MainMenu-FW7L7HWX.js} +5 -5
  38. package/dist/{MainMenu-LLVGN66B.js.map → MainMenu-FW7L7HWX.js.map} +1 -1
  39. package/dist/{MasterLayout-CLYJYYNP.js → MasterLayout-DMH7KE4K.js} +20 -19
  40. package/dist/{MasterLayout-CLYJYYNP.js.map → MasterLayout-DMH7KE4K.js.map} +1 -1
  41. package/dist/{MobileMenu-KNQHAIAW.js → MobileMenu-UNYIED26.js} +21 -20
  42. package/dist/MobileMenu-UNYIED26.js.map +1 -0
  43. package/dist/{NotificationsPage-W34PE52P.js → NotificationsPage-LLIPKHCV.js} +20 -19
  44. package/dist/NotificationsPage-LLIPKHCV.js.map +1 -0
  45. package/dist/{OrderSinglePage-P7WAQSPT.js → OrderSinglePage-PQ6QL5JD.js} +21 -20
  46. package/dist/OrderSinglePage-PQ6QL5JD.js.map +1 -0
  47. package/dist/{OrdersPage-U3OVVRCX.js → OrdersPage-VEZHGB7K.js} +20 -19
  48. package/dist/OrdersPage-VEZHGB7K.js.map +1 -0
  49. package/dist/{PageSingle-B2W5CDJT.js → PageSingle-AHKPSRXA.js} +3 -3
  50. package/dist/{PageSingle-B2W5CDJT.js.map → PageSingle-AHKPSRXA.js.map} +1 -1
  51. package/dist/{ProductDetails-2NQ73OJT.js → ProductDetails-ENZTRU62.js} +4 -4
  52. package/dist/{ProductDetails-2NQ73OJT.js.map → ProductDetails-ENZTRU62.js.map} +1 -1
  53. package/dist/{ProfilePage-3EMQAHEY.js → ProfilePage-5ATVLLJK.js} +20 -19
  54. package/dist/ProfilePage-5ATVLLJK.js.map +1 -0
  55. package/dist/{ReviewsPage-2HXSG6XJ.js → ReviewsPage-GZY5ZMPI.js} +3 -3
  56. package/dist/{ReviewsPage-2HXSG6XJ.js.map → ReviewsPage-GZY5ZMPI.js.map} +1 -1
  57. package/dist/{SeoCartWidget-QJA2XBV4.js → SeoCartWidget-SGFIAFQP.js} +20 -19
  58. package/dist/SeoCartWidget-SGFIAFQP.js.map +1 -0
  59. package/dist/{SettingsPage-QYHW6SJ2.js → SettingsPage-G5G2EERO.js} +20 -19
  60. package/dist/SettingsPage-G5G2EERO.js.map +1 -0
  61. package/dist/{StoreClosedNotification-LXZDHOY6.js → StoreClosedNotification-LNGMAQE3.js} +21 -20
  62. package/dist/{StoreClosedNotification-LXZDHOY6.js.map → StoreClosedNotification-LNGMAQE3.js.map} +1 -1
  63. package/dist/{TestimonialsPage-KGOSTMJM.js → TestimonialsPage-QIUIOT3U.js} +3 -3
  64. package/dist/{TestimonialsPage-KGOSTMJM.js.map → TestimonialsPage-QIUIOT3U.js.map} +1 -1
  65. package/dist/{ThankYouPage-5G7P3ADY.js → ThankYouPage-JEWYPNXN.js} +20 -19
  66. package/dist/ThankYouPage-JEWYPNXN.js.map +1 -0
  67. package/dist/{WalletPage-QAQHKFKN.js → WalletPage-HJ4SWRIU.js} +21 -20
  68. package/dist/WalletPage-HJ4SWRIU.js.map +1 -0
  69. package/dist/{WebMcpTools-RSOWCODK.js → WebMcpTools-63VVK7N7.js} +7 -6
  70. package/dist/WebMcpTools-63VVK7N7.js.map +1 -0
  71. package/dist/{WishlistPage-5XE5K3I4.js → WishlistPage-RZTJAOCK.js} +22 -21
  72. package/dist/WishlistPage-RZTJAOCK.js.map +1 -0
  73. package/dist/api/advertisement.js +2 -2
  74. package/dist/api/apps.js +2 -2
  75. package/dist/api/blog.js +3 -3
  76. package/dist/api/brands.js +3 -3
  77. package/dist/api/cart.js +3 -3
  78. package/dist/api/category.js +3 -3
  79. package/dist/api/client.js +1 -1
  80. package/dist/api/custom-url.d.ts +24 -0
  81. package/dist/api/custom-url.d.ts.map +1 -0
  82. package/dist/api/custom-url.js +10 -0
  83. package/dist/api/custom-url.js.map +1 -0
  84. package/dist/api/home.js +2 -2
  85. package/dist/api/loyalty.js +3 -3
  86. package/dist/api/menu.js +2 -2
  87. package/dist/api/notification.js +2 -2
  88. package/dist/api/order.js +3 -3
  89. package/dist/api/page.js +3 -3
  90. package/dist/api/product.d.ts +14 -0
  91. package/dist/api/product.d.ts.map +1 -1
  92. package/dist/api/product.js +3 -3
  93. package/dist/api/profile.js +1 -1
  94. package/dist/api/store.js +2 -2
  95. package/dist/api/translations.js +2 -2
  96. package/dist/api/user.js +2 -2
  97. package/dist/api/wallet.js +2 -2
  98. package/dist/api/wishlist.js +4 -4
  99. package/dist/{chunk-UJZJB4VI.js → chunk-2HBSM7CW.js} +3 -3
  100. package/dist/{chunk-UJZJB4VI.js.map → chunk-2HBSM7CW.js.map} +1 -1
  101. package/dist/{chunk-SRP7XERU.js → chunk-2K555ZEO.js} +4 -4
  102. package/dist/{chunk-SRP7XERU.js.map → chunk-2K555ZEO.js.map} +1 -1
  103. package/dist/{chunk-BHR52LEQ.js → chunk-3HN2TJXA.js} +4 -4
  104. package/dist/{chunk-BHR52LEQ.js.map → chunk-3HN2TJXA.js.map} +1 -1
  105. package/dist/{chunk-GKXIKFQW.js → chunk-4ADIJBHA.js} +21 -4
  106. package/dist/chunk-4ADIJBHA.js.map +1 -0
  107. package/dist/{chunk-STS64QGN.js → chunk-55ZYTUNS.js} +3 -3
  108. package/dist/{chunk-STS64QGN.js.map → chunk-55ZYTUNS.js.map} +1 -1
  109. package/dist/{chunk-5IL2OKTU.js → chunk-65PAZUBA.js} +4 -4
  110. package/dist/{chunk-5IL2OKTU.js.map → chunk-65PAZUBA.js.map} +1 -1
  111. package/dist/{chunk-NHEXCD4P.js → chunk-6MTSUVSC.js} +3 -3
  112. package/dist/{chunk-NHEXCD4P.js.map → chunk-6MTSUVSC.js.map} +1 -1
  113. package/dist/{chunk-4YYHNNY6.js → chunk-B3THCXOX.js} +3 -3
  114. package/dist/{chunk-4YYHNNY6.js.map → chunk-B3THCXOX.js.map} +1 -1
  115. package/dist/{chunk-XHA3C2YL.js → chunk-BKGJ7T2K.js} +3 -3
  116. package/dist/{chunk-XHA3C2YL.js.map → chunk-BKGJ7T2K.js.map} +1 -1
  117. package/dist/chunk-BSNTDPAL.js +24 -0
  118. package/dist/chunk-BSNTDPAL.js.map +1 -0
  119. package/dist/{chunk-S5BATCEM.js → chunk-BV3Q4QOW.js} +4 -4
  120. package/dist/{chunk-S5BATCEM.js.map → chunk-BV3Q4QOW.js.map} +1 -1
  121. package/dist/chunk-C72TBN2W.js +91 -0
  122. package/dist/chunk-C72TBN2W.js.map +1 -0
  123. package/dist/{chunk-HMPQ5N64.js → chunk-CUTSVC2T.js} +3 -3
  124. package/dist/{chunk-HMPQ5N64.js.map → chunk-CUTSVC2T.js.map} +1 -1
  125. package/dist/{chunk-47MZ7YMM.js → chunk-DA4OCAV5.js} +7 -7
  126. package/dist/{chunk-47MZ7YMM.js.map → chunk-DA4OCAV5.js.map} +1 -1
  127. package/dist/{chunk-RAZFUKHV.js → chunk-DD4KCUXC.js} +3 -3
  128. package/dist/{chunk-RAZFUKHV.js.map → chunk-DD4KCUXC.js.map} +1 -1
  129. package/dist/{chunk-HB77OKRF.js → chunk-DDZIUI45.js} +17 -17
  130. package/dist/{chunk-HB77OKRF.js.map → chunk-DDZIUI45.js.map} +1 -1
  131. package/dist/{chunk-SSMWXIAE.js → chunk-EOQ5YNQD.js} +4 -4
  132. package/dist/{chunk-SSMWXIAE.js.map → chunk-EOQ5YNQD.js.map} +1 -1
  133. package/dist/{chunk-RUQBOPKU.js → chunk-EPOCN2YF.js} +4 -4
  134. package/dist/{chunk-RUQBOPKU.js.map → chunk-EPOCN2YF.js.map} +1 -1
  135. package/dist/{chunk-Q46OTWR7.js → chunk-F7MAXMET.js} +3 -3
  136. package/dist/{chunk-Q46OTWR7.js.map → chunk-F7MAXMET.js.map} +1 -1
  137. package/dist/{chunk-W6UHE6PI.js → chunk-FYAKNYE4.js} +4 -4
  138. package/dist/{chunk-W6UHE6PI.js.map → chunk-FYAKNYE4.js.map} +1 -1
  139. package/dist/{chunk-WEXPMJKG.js → chunk-G6GSTFII.js} +4 -4
  140. package/dist/{chunk-WEXPMJKG.js.map → chunk-G6GSTFII.js.map} +1 -1
  141. package/dist/{chunk-E4WYJJK3.js → chunk-GEHSDTOK.js} +3 -3
  142. package/dist/{chunk-E4WYJJK3.js.map → chunk-GEHSDTOK.js.map} +1 -1
  143. package/dist/{chunk-HOGOSY2M.js → chunk-HZXWSBMG.js} +3 -3
  144. package/dist/{chunk-HOGOSY2M.js.map → chunk-HZXWSBMG.js.map} +1 -1
  145. package/dist/{chunk-GFSUCSGC.js → chunk-I5DAAEUW.js} +3 -3
  146. package/dist/{chunk-GFSUCSGC.js.map → chunk-I5DAAEUW.js.map} +1 -1
  147. package/dist/{chunk-OL7X4VAI.js → chunk-IXUYCRYA.js} +15 -4
  148. package/dist/chunk-IXUYCRYA.js.map +1 -0
  149. package/dist/{chunk-MNYVJQAA.js → chunk-J5HHXQQO.js} +3 -3
  150. package/dist/{chunk-MNYVJQAA.js.map → chunk-J5HHXQQO.js.map} +1 -1
  151. package/dist/{chunk-ZWAPKTVU.js → chunk-JMOAM6TH.js} +3 -3
  152. package/dist/{chunk-ZWAPKTVU.js.map → chunk-JMOAM6TH.js.map} +1 -1
  153. package/dist/{chunk-27UGZZKX.js → chunk-LFFJ3GXM.js} +20 -15
  154. package/dist/chunk-LFFJ3GXM.js.map +1 -0
  155. package/dist/{chunk-3IHHGY2E.js → chunk-LGJYXSFH.js} +4 -4
  156. package/dist/{chunk-3IHHGY2E.js.map → chunk-LGJYXSFH.js.map} +1 -1
  157. package/dist/{chunk-VIG3BEHV.js → chunk-MHXZPWY3.js} +6 -6
  158. package/dist/{chunk-VIG3BEHV.js.map → chunk-MHXZPWY3.js.map} +1 -1
  159. package/dist/{chunk-5CR46BDT.js → chunk-MPIUNUPK.js} +3 -3
  160. package/dist/{chunk-5CR46BDT.js.map → chunk-MPIUNUPK.js.map} +1 -1
  161. package/dist/chunk-OCSCIPJ2.js +46 -0
  162. package/dist/chunk-OCSCIPJ2.js.map +1 -0
  163. package/dist/{chunk-ZFUR5ZF6.js → chunk-OEOHTMHZ.js} +4 -4
  164. package/dist/{chunk-ZFUR5ZF6.js.map → chunk-OEOHTMHZ.js.map} +1 -1
  165. package/dist/{chunk-YWTGGTKK.js → chunk-OHSUKU65.js} +3 -3
  166. package/dist/{chunk-YWTGGTKK.js.map → chunk-OHSUKU65.js.map} +1 -1
  167. package/dist/{chunk-OYMPXPKB.js → chunk-PB3J74LT.js} +3 -3
  168. package/dist/{chunk-OYMPXPKB.js.map → chunk-PB3J74LT.js.map} +1 -1
  169. package/dist/{chunk-UJSP7BLE.js → chunk-PKUUUIIV.js} +25 -6
  170. package/dist/chunk-PKUUUIIV.js.map +1 -0
  171. package/dist/{chunk-7OBFLUYV.js → chunk-PUR6DY3C.js} +7 -7
  172. package/dist/{chunk-7OBFLUYV.js.map → chunk-PUR6DY3C.js.map} +1 -1
  173. package/dist/{chunk-KCZO4S63.js → chunk-PYCQINIJ.js} +4 -4
  174. package/dist/{chunk-KCZO4S63.js.map → chunk-PYCQINIJ.js.map} +1 -1
  175. package/dist/{chunk-MILS2KDT.js → chunk-QKCWNA4Q.js} +3 -3
  176. package/dist/{chunk-MILS2KDT.js.map → chunk-QKCWNA4Q.js.map} +1 -1
  177. package/dist/{chunk-DK5DLORE.js → chunk-RRSFHS6O.js} +4 -4
  178. package/dist/{chunk-DK5DLORE.js.map → chunk-RRSFHS6O.js.map} +1 -1
  179. package/dist/chunk-SDBR4X3K.js +96 -0
  180. package/dist/chunk-SDBR4X3K.js.map +1 -0
  181. package/dist/{chunk-ERKRUX2N.js → chunk-SPHYVWRT.js} +8 -8
  182. package/dist/{chunk-ERKRUX2N.js.map → chunk-SPHYVWRT.js.map} +1 -1
  183. package/dist/{chunk-KFRCD433.js → chunk-TJ5LSV7K.js} +5 -5
  184. package/dist/{chunk-KFRCD433.js.map → chunk-TJ5LSV7K.js.map} +1 -1
  185. package/dist/{chunk-U5WM4OJY.js → chunk-TWJLAJ3Z.js} +3 -3
  186. package/dist/{chunk-U5WM4OJY.js.map → chunk-TWJLAJ3Z.js.map} +1 -1
  187. package/dist/{chunk-EPG3VR6C.js → chunk-UHEFR5NF.js} +4 -4
  188. package/dist/{chunk-EPG3VR6C.js.map → chunk-UHEFR5NF.js.map} +1 -1
  189. package/dist/{chunk-WAKEXNJP.js → chunk-UK4735NF.js} +5 -5
  190. package/dist/{chunk-WAKEXNJP.js.map → chunk-UK4735NF.js.map} +1 -1
  191. package/dist/{chunk-NO2MV4Y5.js → chunk-UQRIWDYW.js} +3 -3
  192. package/dist/chunk-UQRIWDYW.js.map +1 -0
  193. package/dist/{chunk-MPALYAMD.js → chunk-VNDCHJ43.js} +7 -7
  194. package/dist/{chunk-MPALYAMD.js.map → chunk-VNDCHJ43.js.map} +1 -1
  195. package/dist/{chunk-5PZKQTNW.js → chunk-WTU7I75Y.js} +25 -12
  196. package/dist/chunk-WTU7I75Y.js.map +1 -0
  197. package/dist/{chunk-ZGE4LQ7M.js → chunk-XQS627C2.js} +4 -4
  198. package/dist/{chunk-ZGE4LQ7M.js.map → chunk-XQS627C2.js.map} +1 -1
  199. package/dist/{chunk-N7PHXYAU.js → chunk-Y6V5EI6M.js} +4 -4
  200. package/dist/{chunk-N7PHXYAU.js.map → chunk-Y6V5EI6M.js.map} +1 -1
  201. package/dist/components/cart/index.js +1 -1
  202. package/dist/components/common/index.js +1 -1
  203. package/dist/components/drawer/index.js +18 -17
  204. package/dist/components/home/index.js +23 -22
  205. package/dist/components/layout/index.js +4 -4
  206. package/dist/components/product/index.js +20 -19
  207. package/dist/components/store/index.js +19 -18
  208. package/dist/components/tracking/index.js +7 -7
  209. package/dist/custom-urls-ZCGT5KZM.js +17 -0
  210. package/dist/custom-urls-ZCGT5KZM.js.map +1 -0
  211. package/dist/dev/editor/index.js +1 -1
  212. package/dist/dev/index.js +1 -1
  213. package/dist/document-class-UDYMON7L.js +38 -0
  214. package/dist/{document-class-DMHQXNQW.js.map → document-class-UDYMON7L.js.map} +1 -1
  215. package/dist/hooks/index.js +18 -17
  216. package/dist/hooks/useGtm.js +18 -17
  217. package/dist/hooks/useMoney.js +18 -17
  218. package/dist/hooks/useStore.js +18 -17
  219. package/dist/hooks/useUser.js +3 -3
  220. package/dist/index.js +18 -17
  221. package/dist/index.js.map +1 -1
  222. package/dist/{navigation-SKUYNVCF.js → navigation-2CES2VMD.js} +5 -5
  223. package/dist/{navigation-SKUYNVCF.js.map → navigation-2CES2VMD.js.map} +1 -1
  224. package/dist/{navigation-M2JX4PVG.js → navigation-GSNC4E2N.js} +4 -4
  225. package/dist/{navigation-M2JX4PVG.js.map → navigation-GSNC4E2N.js.map} +1 -1
  226. package/dist/{not-found-CYFSHYKS.js → not-found-ZCEKDWFF.js} +26 -52
  227. package/dist/not-found-ZCEKDWFF.js.map +1 -0
  228. package/dist/providers/NavigationProvider.d.ts +5 -0
  229. package/dist/providers/NavigationProvider.d.ts.map +1 -1
  230. package/dist/providers/index.js +18 -17
  231. package/dist/router/product-key-urls.d.ts +56 -0
  232. package/dist/router/product-key-urls.d.ts.map +1 -0
  233. package/dist/routes/account/orders.js +6 -5
  234. package/dist/routes/account.js +15 -14
  235. package/dist/routes/account.js.map +1 -1
  236. package/dist/routes/blog.js +10 -9
  237. package/dist/routes/blog.js.map +1 -1
  238. package/dist/routes/brands.js +6 -5
  239. package/dist/routes/brands.js.map +1 -1
  240. package/dist/routes/cart.js +27 -26
  241. package/dist/routes/cart.js.map +1 -1
  242. package/dist/routes/custom-urls.d.ts +57 -0
  243. package/dist/routes/custom-urls.d.ts.map +1 -0
  244. package/dist/routes/home.js +24 -23
  245. package/dist/routes/index.js +10 -3
  246. package/dist/routes/loyalty.js +7 -6
  247. package/dist/routes/loyalty.js.map +1 -1
  248. package/dist/routes/page.js +6 -5
  249. package/dist/routes/page.js.map +1 -1
  250. package/dist/routes/product/index.d.ts.map +1 -1
  251. package/dist/routes/product/key.d.ts +39 -0
  252. package/dist/routes/product/key.d.ts.map +1 -0
  253. package/dist/routes/product/loader.d.ts +2 -1
  254. package/dist/routes/product/loader.d.ts.map +1 -1
  255. package/dist/routes/product-listing.js +28 -27
  256. package/dist/routes/product-listing.js.map +1 -1
  257. package/dist/routes/product-short-link.d.ts +7 -9
  258. package/dist/routes/product-short-link.d.ts.map +1 -1
  259. package/dist/routes/product.js +46 -33
  260. package/dist/routes/product.js.map +1 -1
  261. package/dist/routes/seo-redirects.d.ts +6 -0
  262. package/dist/routes/seo-redirects.d.ts.map +1 -1
  263. package/dist/routes/seo-redirects.js +10 -3
  264. package/dist/routes/testimonials.js +4 -3
  265. package/dist/routes/testimonials.js.map +1 -1
  266. package/dist/routes/thank-you.js +6 -5
  267. package/dist/routes/thank-you.js.map +1 -1
  268. package/dist/skeleton.js +24 -23
  269. package/dist/{store-lookup-H3RGYEXU.js → store-lookup-RYJWKKY3.js} +8 -8
  270. package/dist/{store-lookup-H3RGYEXU.js.map → store-lookup-RYJWKKY3.js.map} +1 -1
  271. package/dist/tanstack/navigation.d.ts +6 -0
  272. package/dist/tanstack/navigation.d.ts.map +1 -1
  273. package/dist/tanstack/router.d.ts.map +1 -1
  274. package/dist/tanstack/templates/locale-wrapper.d.ts.map +1 -1
  275. package/dist/tanstack.js +19 -18
  276. package/dist/tanstack.js.map +1 -1
  277. package/dist/utils/baseHead.d.ts +6 -0
  278. package/dist/utils/baseHead.d.ts.map +1 -1
  279. package/dist/utils/baseHead.js +2 -1
  280. package/dist/utils/index.js +4 -3
  281. package/dist/utils/index.js.map +1 -1
  282. package/dist/vite/index.js +15 -6
  283. package/dist/vite/index.js.map +1 -1
  284. package/package.json +5 -1
  285. package/tailwind/routes/custom-urls.ts.txt +161 -0
  286. package/tailwind/routes/product/index.tsx.txt +7 -2
  287. package/tailwind/routes/product/key.ts.txt +77 -0
  288. package/tailwind/routes/product/loader.ts.txt +25 -4
  289. package/tailwind/routes/product-short-link.ts.txt +13 -47
  290. package/tailwind/routes/seo-redirects.ts.txt +38 -10
  291. package/dist/BlogAuthorPage-ELZPCZEE.js.map +0 -1
  292. package/dist/BlogCategoryPage-MADVXTFU.js.map +0 -1
  293. package/dist/BlogPage-DTHRWEHK.js.map +0 -1
  294. package/dist/BlogSinglePage-BSHIPWOR.js.map +0 -1
  295. package/dist/BlogTagPage-YIGA3QZQ.js.map +0 -1
  296. package/dist/BrandsPage-AD7RKXIC.js.map +0 -1
  297. package/dist/Breadcrumb-O7YJIL52.js.map +0 -1
  298. package/dist/CartItem-7A45S2WC.js.map +0 -1
  299. package/dist/CartSummary-V6VP6MI5.js.map +0 -1
  300. package/dist/CustomerLayout-LTP5EG72.js.map +0 -1
  301. package/dist/GoogleTag-NHGB476C.js +0 -15
  302. package/dist/LatestProducts-HZOHWLLU.js.map +0 -1
  303. package/dist/LoyaltyPage-VKVING2R.js.map +0 -1
  304. package/dist/MobileMenu-KNQHAIAW.js.map +0 -1
  305. package/dist/NotificationsPage-W34PE52P.js.map +0 -1
  306. package/dist/OrderSinglePage-P7WAQSPT.js.map +0 -1
  307. package/dist/OrdersPage-U3OVVRCX.js.map +0 -1
  308. package/dist/ProfilePage-3EMQAHEY.js.map +0 -1
  309. package/dist/SeoCartWidget-QJA2XBV4.js.map +0 -1
  310. package/dist/SettingsPage-QYHW6SJ2.js.map +0 -1
  311. package/dist/ThankYouPage-5G7P3ADY.js.map +0 -1
  312. package/dist/WalletPage-QAQHKFKN.js.map +0 -1
  313. package/dist/WebMcpTools-RSOWCODK.js.map +0 -1
  314. package/dist/WishlistPage-5XE5K3I4.js.map +0 -1
  315. package/dist/chunk-27UGZZKX.js.map +0 -1
  316. package/dist/chunk-5PZKQTNW.js.map +0 -1
  317. package/dist/chunk-GKXIKFQW.js.map +0 -1
  318. package/dist/chunk-NO2MV4Y5.js.map +0 -1
  319. package/dist/chunk-OL7X4VAI.js.map +0 -1
  320. package/dist/chunk-UJSP7BLE.js.map +0 -1
  321. package/dist/document-class-DMHQXNQW.js +0 -37
  322. package/dist/not-found-CYFSHYKS.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salla.sa/twilight-theme-engine",
3
- "version": "1.0.163",
3
+ "version": "1.0.164",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -350,6 +350,10 @@
350
350
  "types": "./dist/api/category.d.ts",
351
351
  "import": "./dist/api/category.js"
352
352
  },
353
+ "./api/custom-url": {
354
+ "types": "./dist/api/custom-url.d.ts",
355
+ "import": "./dist/api/custom-url.js"
356
+ },
353
357
  "./api/page": {
354
358
  "types": "./dist/api/page.d.ts",
355
359
  "import": "./dist/api/page.js"
@@ -0,0 +1,161 @@
1
+ /**
2
+ * @fileoverview A merchant's custom URLs (Dashboard → SEO → custom links) on a React storefront.
3
+ *
4
+ * Twig answers them in the Store's catch-all, its last fallback: after every route, and after the
5
+ * product lookups by short code (`/{code}`) and by SKU (`/{sku}-{name}`). A React theme has no
6
+ * catch-all, so the locale layout's `beforeLoad` asks the API (Store-Module#1798, the catch-all's
7
+ * own lookup) at the same two points:
8
+ * - an address no page answers (`twigUrlRedirect`, after the short code);
9
+ * - a SKU-link address whose SKU names no product (`resolveProductKeyPage`).
10
+ *
11
+ * It asks only on a store that lists `custom-urls` in `store.features` (the plan has it, and the
12
+ * store has an active one), so an address no page answers costs a store without one nothing. The answer is a 302, as Twig's, because the
13
+ * merchant can point the URL elsewhere at any time.
14
+ */
15
+ import type { QueryClient } from '@tanstack/react-query';
16
+ import { customUrl, type CustomUrlTarget } from '../api/custom-url';
17
+ import { store } from '../api/store';
18
+ import type { StoreContext } from '../api/store';
19
+ import { redirect } from '../providers/NavigationProvider';
20
+ import { isLocale } from '../providers/locale-constants';
21
+
22
+ export interface CustomUrlRedirectOptions {
23
+ /** The request's query client: the settings are in it already, and a lookup is shared. */
24
+ queryClient: QueryClient;
25
+ /** The language segment an item's page takes, given the one the address had (the locale layout's rule). */
26
+ targetLocale?: (addressLocale: string | undefined) => Promise<string | undefined>;
27
+ }
28
+
29
+ /**
30
+ * The path a custom URL is saved under, for an address the router hands over (the store base
31
+ * already off): without a language segment, which the Store strips before its catch-all, and
32
+ * without the slashes around it. `null` for a home page.
33
+ */
34
+ export function customUrlKey(pathname: string): { key: string; locale?: string } | null {
35
+ const segments = pathname.split('/').filter(Boolean);
36
+ const locale = isLocale(segments[0]) ? segments.shift() : undefined;
37
+ if (!segments.length) return null;
38
+ return { key: segments.join('/'), locale };
39
+ }
40
+
41
+ /**
42
+ * The path an item's URL has under the store root, without its language segment:
43
+ * `https://salla.sa/dev-x/en/shoes/p1` with store URL `https://salla.sa/dev-x/` is `/shoes/p1`.
44
+ * `null` when the URL is not on the store (another host, or outside the store's segment).
45
+ */
46
+ export function storePathOf(url: string, storeUrl: string | undefined): string | null {
47
+ let item: URL;
48
+ let root: URL;
49
+ try {
50
+ item = new URL(url);
51
+ root = new URL(storeUrl ?? '');
52
+ } catch {
53
+ return null;
54
+ }
55
+ if (item.host !== root.host) return null;
56
+ const rootPath = root.pathname.replace(/\/+$/, '');
57
+ if (rootPath && item.pathname !== rootPath && !item.pathname.startsWith(`${rootPath}/`)) {
58
+ return null;
59
+ }
60
+ const segments = item.pathname.slice(rootPath.length).split('/').filter(Boolean);
61
+ if (isLocale(segments[0])) segments.shift();
62
+ return `/${segments.join('/')}`;
63
+ }
64
+
65
+ /** Twig's brand address, `/{slug}/brand-{id}`: the engine's brand page is `/brands/{id}`. */
66
+ const TWIG_BRAND_PATH = /^\/[^/]+\/brand-(\d+)$/;
67
+
68
+ /**
69
+ * The engine's page for the item a custom URL names, under the store root and with no language,
70
+ * or `null` for a `custom` row or an item URL that is not on the store. The item's own address
71
+ * is used: the engine serves Twig's product, category, tag and page addresses (and redirects a
72
+ * hash URL itself), and only a brand is sent straight to its page, a hop shorter.
73
+ */
74
+ export function customUrlPagePath(
75
+ target: CustomUrlTarget,
76
+ storeUrl: string | undefined
77
+ ): string | null {
78
+ if (target.type === 'custom') return null;
79
+ const path = storePathOf(target.url, storeUrl);
80
+ if (!path) return null;
81
+ const brand = TWIG_BRAND_PATH.exec(path);
82
+ return brand ? `/brands/${brand[1]}` : path;
83
+ }
84
+
85
+ /**
86
+ * `target` with the address's query string on it, as the Store's catch-all keeps it (an ad's
87
+ * `utm_*`): after the target's own query, and before its fragment.
88
+ */
89
+ export function withAddressQuery(target: string, search: string): string {
90
+ const query = search.replace(/^\?/, '');
91
+ if (!query) return target;
92
+ const hashAt = target.indexOf('#');
93
+ const [head, fragment] =
94
+ hashAt < 0 ? [target, ''] : [target.slice(0, hashAt), target.slice(hashAt)];
95
+ return `${head}${head.includes('?') ? '&' : '?'}${query}${fragment}`;
96
+ }
97
+
98
+ /** A URL when it is http(s): the Dashboard asks for a URL, and the router refuses any other scheme. */
99
+ function httpUrl(url: string): string | null {
100
+ try {
101
+ const { protocol } = new URL(url);
102
+ return protocol === 'http:' || protocol === 'https:' ? url : null;
103
+ } catch {
104
+ return null;
105
+ }
106
+ }
107
+
108
+ /** The settings, when they list `custom-urls` in the store's features; else `null`. */
109
+ async function settingsWithCustomUrls(queryClient: QueryClient): Promise<StoreContext | null> {
110
+ try {
111
+ const settings = await queryClient.ensureQueryData(store.queries.settings());
112
+ return settings?.store?.features?.includes('custom-urls') ? settings : null;
113
+ } catch {
114
+ return null;
115
+ }
116
+ }
117
+
118
+ /**
119
+ * The custom URL saved for `key`, or `undefined`. Any failure counts as none: an address no page
120
+ * answers is also every scanner's, and an API error must leave it the 404 it was, not a 500.
121
+ */
122
+ async function lookup(key: string, queryClient: QueryClient): Promise<CustomUrlTarget | undefined> {
123
+ try {
124
+ return await queryClient.ensureQueryData(customUrl.queries.resolve(key));
125
+ } catch {
126
+ return undefined;
127
+ }
128
+ }
129
+
130
+ /**
131
+ * Sends the visitor where the custom URL saved for `pathname` leads, with the address's query, by
132
+ * a 302; returns when there is none, and the caller answers as it would have. An item on the store
133
+ * is reached in one hop, in the language the locale layout would give it. A `custom` row's URL,
134
+ * or an item URL on another site, is a full page load.
135
+ */
136
+ export async function customUrlRedirect(
137
+ pathname: string,
138
+ search: string,
139
+ options: CustomUrlRedirectOptions
140
+ ): Promise<void> {
141
+ const address = customUrlKey(pathname);
142
+ if (!address) return;
143
+ const settings = await settingsWithCustomUrls(options.queryClient);
144
+ if (!settings) return;
145
+ const target = await lookup(address.key, options.queryClient);
146
+ if (!target) return;
147
+
148
+ const path = customUrlPagePath(target, settings.store?.url);
149
+ if (path) {
150
+ const locale = options.targetLocale
151
+ ? await options.targetLocale(address.locale)
152
+ : address.locale;
153
+ throw redirect(withAddressQuery(`${locale ? `/${locale}` : ''}${path}`, search), {
154
+ statusCode: 302,
155
+ });
156
+ }
157
+ const href = httpUrl(target.url);
158
+ if (href) {
159
+ throw redirect(withAddressQuery(href, search), { statusCode: 302, reloadDocument: true });
160
+ }
161
+ }
@@ -8,6 +8,7 @@ import { RouteId } from '../../router/route-ids';
8
8
  import { ProductPage } from './ProductPage';
9
9
  import { fastCheckoutScript } from '../../utils/fast-checkout';
10
10
  import { getActiveCurrency } from '../../api/client';
11
+ import { publicProductKeyPath } from '../../router/product-key-urls';
11
12
  export { productLoader } from './loader';
12
13
  export type { ProductPageProps } from './types';
13
14
 
@@ -18,7 +19,7 @@ async function loader(
18
19
  ctx: { params: IdParams }
19
20
  ) => Promise<Record<string, unknown>> | Record<string, unknown>
20
21
  ): Promise<ProductPageProps> {
21
- const data = await productLoader({ params: ctx.params });
22
+ const data = await productLoader({ params: ctx.params, locale: ctx.locale });
22
23
 
23
24
  if (extend) {
24
25
  const extra = await extend(data, ctx);
@@ -141,7 +142,11 @@ function head(ctx: TwilightContext, data: ProductPageProps): HeadDescriptor {
141
142
  images: product.image?.url,
142
143
  },
143
144
  jsonLd,
144
- alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),
145
+ // The address, not the router's path: a SKU-link page is `/{name}/p~{key}` inside the router.
146
+ alternateLanguages: buildHreflangAlternates(
147
+ ctx.settings,
148
+ publicProductKeyPath(ctx.location.pathname) ?? ctx.location.pathname
149
+ ),
145
150
  // Quick-buy widget code, eager only here: the Buy Now button is above the fold on this page.
146
151
  // Other routes load it on idle from the body:end default hook, which also owns the
147
152
  // `#fast-checkout-js` marker `salla-add-product-button` checks for.
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @fileoverview The product at a SKU-link address (`/{key}-{name}`, see `router/product-key-urls`).
3
+ *
4
+ * The rewrite hands the product route an id of `~{key}`. The key is `p{id}` (the product id
5
+ * itself) or a SKU of letters and digits, as Twig's `getProductBySkuOrId` reads it.
6
+ */
7
+ import type { QueryClient } from '@tanstack/react-query';
8
+ import type { Product } from '../../types';
9
+ import { product } from '../../api/product';
10
+ import { isMissingResource, notFound, orThrow } from '../../providers/NavigationProvider';
11
+ import { productKeyOfId, publicProductKeyPath } from '../../router/product-key-urls';
12
+ import { PRODUCT_SLUG_ROUTE_ID } from '../../router/slug-routes';
13
+ import { customUrlRedirect, type CustomUrlRedirectOptions } from '../custom-urls';
14
+ import { isProductId } from './id';
15
+
16
+ /** `p{id}`: Sluggable's key for a product whose SKU is not letters and digits. */
17
+ const ID_KEY = /^p(\d+)$/;
18
+
19
+ /**
20
+ * The product a key names: by id for `p{id}`, else by SKU. A SKU is read through the query cache,
21
+ * which `resolveProductKeyPage` filled in the same navigation, so it costs one call.
22
+ */
23
+ export async function productOfKey(
24
+ key: string,
25
+ queryClient?: QueryClient | null
26
+ ): Promise<Product> {
27
+ const id = ID_KEY.exec(key)?.[1];
28
+ if (id !== undefined) {
29
+ // Past 18 digits the API answers 417, not 404 (see `./id`).
30
+ if (!isProductId(id)) return notFound();
31
+ return product.findOrThrow(id);
32
+ }
33
+ return orThrow(
34
+ queryClient ? queryClient.ensureQueryData(product.queries.bySku(key)) : product.findBySku(key)
35
+ );
36
+ }
37
+
38
+ /** The address a SKU-link lookup was made for, so a miss can still be one of the merchant's custom URLs. */
39
+ export interface ProductKeyAddress {
40
+ /** The router's location: the internal path (`/{name}/p~{key}`) and the query string. */
41
+ location: { pathname: string; searchStr: string };
42
+ /** The language segment an item's page takes (the locale layout's rule). */
43
+ targetLocale?: CustomUrlRedirectOptions['targetLocale'];
44
+ }
45
+
46
+ /**
47
+ * Run by the locale layout's `beforeLoad`: a SKU that names no product is the not-found page, a
48
+ * 404, as Twig's catch-all answers it, unless the address is one of the merchant's custom URLs.
49
+ * Twig tries those after its SKU route: `/values-in-action` is first SKU `values`.
50
+ *
51
+ * It is resolved here, ahead of the product loader, because a theme may turn that loader's
52
+ * not-found into something else: Raed sends it home with a toast. That suits a product that was
53
+ * deleted, but not `/new-arrivals` or a scanner's path, which only look like a SKU link. The
54
+ * answer stays in the query cache for the loader.
55
+ */
56
+ export async function resolveProductKeyPage(
57
+ page: { routeId: string; params: Record<string, string | undefined> } | undefined,
58
+ queryClient: QueryClient,
59
+ address?: ProductKeyAddress
60
+ ): Promise<void> {
61
+ if (page?.routeId !== PRODUCT_SLUG_ROUTE_ID) return;
62
+ const key = productKeyOfId(page.params.id);
63
+ if (!key || ID_KEY.test(key)) return;
64
+ try {
65
+ await queryClient.ensureQueryData(product.queries.bySku(key));
66
+ } catch (error) {
67
+ if (!isMissingResource(error)) throw error;
68
+ const publicPath = address && publicProductKeyPath(address.location.pathname);
69
+ if (publicPath) {
70
+ await customUrlRedirect(publicPath, address.location.searchStr, {
71
+ queryClient,
72
+ targetLocale: address.targetLocale,
73
+ });
74
+ }
75
+ notFound();
76
+ }
77
+ }
@@ -4,16 +4,37 @@ import { product } from '../../api/product';
4
4
  import { getTwilightContext } from '../../twilight/context';
5
5
  import { RouteId } from '../../router/route-ids';
6
6
  import type { Breadcrumb } from '../../types';
7
- import { notFound } from '../../providers/NavigationProvider';
7
+ import { notFound, redirect } from '../../providers/NavigationProvider';
8
+ import { isProductKeyUrl, productKeyOfId } from '../../router/product-key-urls';
9
+ import { slugOfPageUrl } from '../../utils/baseHead';
8
10
  import { isProductId } from './id';
11
+ import { productOfKey } from './key';
9
12
 
10
- export async function productLoader({ params }: { params: IdParams }): Promise<ProductPageProps> {
13
+ export async function productLoader({
14
+ params,
15
+ locale,
16
+ }: {
17
+ params: IdParams;
18
+ locale?: string;
19
+ }): Promise<ProductPageProps> {
20
+ // A SKU-link address (`/{key}-{name}`), which the router's rewrite hands over as `~{key}`.
21
+ const key = productKeyOfId(params.id);
11
22
  // A product id is digits. Anything else is put in the API path as it is, and the API answers
12
23
  // neither 404 nor 410 for it: `hello.html` is a 403 and `oc%u0022xx` Cloudflare's 400, so the
13
24
  // error page went out as a 500 (`/php_info.html` matches `p{$id}`, and scanners ask for it).
14
25
  // Too many digits is the same: past a 64-bit integer the API answers 417 (see `./id`).
15
- if (!isProductId(params.id)) throw notFound();
16
- const data = await product.findOrThrow(params.id);
26
+ if (!key && !isProductId(params.id)) throw notFound();
27
+ const data = key
28
+ ? await productOfKey(key, getTwilightContext().queryClient)
29
+ : await product.findOrThrow(params.id);
30
+ // An old SKU link on a store that is not on SKU links (any more): its products are at
31
+ // `/{slug}/p{id}`, and Twig 301s the link there (`SeoCanonicalRedirect`). On a store that is,
32
+ // any name is served: the key alone names the product, and the canonical names its URL.
33
+ if (key && !isProductKeyUrl(data.url)) {
34
+ const search = getTwilightContext().location?.searchStr ?? '';
35
+ const slug = slugOfPageUrl(data.url, 'p', String(data.id));
36
+ redirect(`${locale ? `/${locale}` : ''}/${slug}/p${data.id}${search}`, { statusCode: 301 });
37
+ }
17
38
  const i18n = getTwilightContext().i18n;
18
39
  const home: Breadcrumb = { name: i18n.t('common.titles.home'), url: '/' };
19
40
 
@@ -1,67 +1,33 @@
1
1
  import { useEffect, useState } from 'react';
2
2
  import { product } from '../api/product';
3
- import { isLocale } from '../providers/locale-constants';
4
3
  import { useLocation, useNavigate } from '../providers/NavigationProvider';
5
4
  import { parseShortLinkPath, slugFromProductUrl } from './short-link-path';
6
5
 
7
6
  export { parseShortLinkPath, slugFromProductUrl };
8
7
 
9
- /** A product URL in the stores' "new URLs" format: `{sku}-{name}`, or `p{id}-{name}` without a SKU. */
10
- const PRODUCT_KEY = /^([0-9A-Za-z]+)-./;
11
-
12
- /** The `{sku}` or `p{id}` key of `/{locale}/{sku}-{name}` or `/{sku}-{name}`, with that locale. */
13
- export function parseProductKeyPath(pathname: string): { key: string; locale?: string } | null {
14
- const segments = pathname.split('/').filter(Boolean);
15
- const hasLocale = segments.length === 2 && isLocale(segments[0]);
16
- if (!hasLocale && (segments.length !== 1 || isLocale(segments[0]))) return null;
17
- const key = segments[segments.length - 1].match(PRODUCT_KEY)?.[1];
18
- if (!key) return null;
19
- return hasLocale ? { key, locale: segments[0] } : { key };
20
- }
21
-
22
- function productKeyOf(url: string | undefined): string | undefined {
23
- try {
24
- const last = new URL(url ?? '').pathname.split('/').filter(Boolean).pop() ?? '';
25
- return last.match(PRODUCT_KEY)?.[1];
26
- } catch {
27
- return undefined;
28
- }
29
- }
30
-
31
- /** Like Laravel: `p{id}` is the id; anything else is a SKU, which only search can find. */
32
- async function findByProductKey(key: string): Promise<number | null> {
33
- const id = key.match(/^p(\d+)$/)?.[1];
34
- if (id) return Number(id);
35
- const { items } = await product.list({ source: 'search', keyword: key, perPage: 50 });
36
- const found = items.find((item) => productKeyOf(item.url) === key);
37
- return found ? Number(found.id) : null;
38
- }
39
-
40
8
  /**
41
- * Resolves a product URL that matched no route, a short link (`/ar/lvXvzln`) or
42
- * a "new URLs" one (`/ar/1213asa-chocolate`), and replaces the URL with the
43
- * product's page. Returns `true` while a lookup is in flight (so the 404 isn't
44
- * flashed); settles to `false` when the path is neither or doesn't resolve.
9
+ * Resolves a short link (`/ar/lvXvzln`) that matched no route, and replaces the URL with the
10
+ * product's page. Returns `true` while a lookup is in flight (so the 404 isn't flashed); settles
11
+ * to `false` when the path is not one or doesn't resolve.
12
+ *
13
+ * A SKU-link address (`/ar/1213asa-chocolate`) is not resolved here any more: the router serves
14
+ * it as the product's page (`router/product-key-urls`), and the server already looked up a SKU
15
+ * that names no product before answering 404.
45
16
  */
46
17
  export function useProductShortLink(): boolean {
47
18
  const { pathname } = useLocation();
48
19
  const navigate = useNavigate();
49
20
  const shortLink = parseShortLinkPath(pathname);
50
- const productKey = parseProductKeyPath(pathname);
51
- const lookup = shortLink?.code ?? productKey?.key;
52
- const locale = shortLink?.locale ?? productKey?.locale;
53
- const isShortLink = !!shortLink;
21
+ const lookup = shortLink?.code;
22
+ const locale = shortLink?.locale;
54
23
  const [failed, setFailed] = useState<string | null>(null);
55
24
 
56
25
  useEffect(() => {
57
26
  if (!lookup) return;
58
27
  let cancelled = false;
59
- const productPath = isShortLink
60
- ? product
61
- .find(lookup)
62
- .then((found) => (found?.id ? `${slugFromProductUrl(found.url)}/p${found.id}` : null))
63
- : findByProductKey(lookup).then((id) => (id ? `-/p${id}` : null));
64
- productPath
28
+ product
29
+ .find(lookup)
30
+ .then((found) => (found?.id ? `${slugFromProductUrl(found.url)}/p${found.id}` : null))
65
31
  .then((path) => {
66
32
  if (cancelled) return;
67
33
  if (!path) return setFailed(lookup);
@@ -71,7 +37,7 @@ export function useProductShortLink(): boolean {
71
37
  return () => {
72
38
  cancelled = true;
73
39
  };
74
- }, [lookup, isShortLink, locale, navigate]);
40
+ }, [lookup, locale, navigate]);
75
41
 
76
42
  return !!lookup && failed !== lookup;
77
43
  }
@@ -2,6 +2,7 @@ import { useEffect } from 'react';
2
2
  import type { QueryClient } from '@tanstack/react-query';
3
3
  import { isMissingResource, redirect } from '../providers/NavigationProvider';
4
4
  import { FALLBACK_LOCALE, isLocale } from '../providers/locale-constants';
5
+ import { productKeyOfId } from '../router/product-key-urls';
5
6
  import { CATEGORY_SLUG_ROUTE_ID, PRODUCT_SLUG_ROUTE_ID } from '../router/slug-routes';
6
7
  import { clearAuthTokenCookie } from '../utils/cookies';
7
8
  import { parseShortLinkPath } from './short-link-path';
@@ -83,6 +84,9 @@ export async function productsSourceRedirectLoader(ctx: {
83
84
  });
84
85
  }
85
86
 
87
+ export { resolveProductKeyPage } from './product/key';
88
+ export { publicProductKeyPath } from '../router/product-key-urls';
89
+
86
90
  /** Routes a Twig URL lands on by accident: a locale bound as `$slug`, or an id that is no number. */
87
91
  const SLUG_ROUTES = new Set([PRODUCT_SLUG_ROUTE_ID, CATEGORY_SLUG_ROUTE_ID]);
88
92
 
@@ -101,6 +105,8 @@ function rendersNoPage({ routeId, params }: MatchedPage): boolean {
101
105
  // A first segment that is no language binds as the locale, of the layout or of the home page.
102
106
  if (routeId === '/{-$locale}' || (params.locale && !isLocale(params.locale))) return true;
103
107
  if (!SLUG_ROUTES.has(routeId)) return false;
108
+ // A SKU-link address the router's rewrite gave the product route (`router/product-key-urls`).
109
+ if (productKeyOfId(params.id)) return false;
104
110
  return (!params.locale && isLocale(params.slug)) || !/^\d+$/.test(params.id ?? '');
105
111
  }
106
112
 
@@ -161,17 +167,28 @@ async function shortLinkProductId(
161
167
  }
162
168
 
163
169
  /** Where a Twig URL's page is now, and the language its address carried. */
170
+ /**
171
+ * A Twig product or category URL: `/p{id}…` or `/category/{hash}`, bare or under a language. Under
172
+ * any other first segment it is no Twig route, so the Store's catch-all would have it.
173
+ */
174
+ function twigPageUrl(
175
+ pathname: string
176
+ ): { kind: 'p' | 'c'; ref: string; locale?: string } | undefined {
177
+ const productUrl = TWIG_PRODUCT_URL.exec(pathname);
178
+ const match = productUrl ?? TWIG_CATEGORY_URL.exec(pathname);
179
+ if (!match || (match[1] && !isLocale(match[1]))) return undefined;
180
+ return { kind: productUrl ? 'p' : 'c', ref: match[2], locale: match[1] };
181
+ }
182
+
164
183
  async function twigTarget(
165
184
  pathname: string,
166
185
  queryClient?: QueryClient
167
186
  ): Promise<{ path: string; locale?: string } | undefined> {
168
- const productUrl = TWIG_PRODUCT_URL.exec(pathname);
169
- const match = productUrl ?? TWIG_CATEGORY_URL.exec(pathname);
170
- if (match) {
171
- if (match[1] && !isLocale(match[1])) return undefined;
172
- if (productUrl) return { path: `/-/p${match[2]}`, locale: match[1] };
173
- const id = await categoryIdOf(match[2], queryClient);
174
- return id ? { path: `/-/c${id}`, locale: match[1] } : undefined;
187
+ const pageUrl = twigPageUrl(pathname);
188
+ if (pageUrl) {
189
+ if (pageUrl.kind === 'p') return { path: `/-/p${pageUrl.ref}`, locale: pageUrl.locale };
190
+ const id = await categoryIdOf(pageUrl.ref, queryClient);
191
+ return id ? { path: `/-/c${id}`, locale: pageUrl.locale } : undefined;
175
192
  }
176
193
  const shortLink = parseShortLinkPath(pathname);
177
194
  if (!shortLink) return undefined;
@@ -188,6 +205,10 @@ async function twigTarget(
188
205
  * A product URL carries its id, so it is redirected without asking the API: a product that is
189
206
  * gone is the product page's not-found, one hop on. A category hash or a short code only the API
190
207
  * can turn into the id; one that is gone stays the not-found page at its address.
208
+ *
209
+ * Any other address no page answers, a short code that names no product included, may be one of
210
+ * the merchant's custom URLs, which Twig's catch-all answers last (`./custom-urls`). A gone
211
+ * category's Twig URL is not: Twig's category route answers it.
191
212
  */
192
213
  export async function twigUrlRedirect(
193
214
  pathname: string,
@@ -197,9 +218,16 @@ export async function twigUrlRedirect(
197
218
  ): Promise<void> {
198
219
  if (!page || !rendersNoPage(page)) return;
199
220
  const target = await twigTarget(pathname, options.queryClient);
200
- if (!target) return;
201
- const locale = options.targetLocale ? await options.targetLocale(target.locale) : target.locale;
202
- throw redirect(`${locale ? `/${locale}` : ''}${target.path}${search}`, { statusCode: 301 });
221
+ if (target) {
222
+ const locale = options.targetLocale ? await options.targetLocale(target.locale) : target.locale;
223
+ throw redirect(`${locale ? `/${locale}` : ''}${target.path}${search}`, { statusCode: 301 });
224
+ }
225
+ if (!options.queryClient || twigPageUrl(pathname)) return;
226
+ const { customUrlRedirect } = await import('./custom-urls');
227
+ await customUrlRedirect(pathname, search, {
228
+ queryClient: options.queryClient,
229
+ targetLocale: options.targetLocale,
230
+ });
203
231
  }
204
232
 
205
233
  /**
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/routes/blog/BlogAuthorPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAM,mBAAuD,EAAC;AAC9D,IAAM,iBAAmC,EAAC;AAEnC,SAAS,cAAA,CAAe;AAAA,EAC7B,IAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA,GAAa,gBAAA;AAAA,EACb,QAAA,GAAW,cAAA;AAAA,EACX;AACF,CAAA,EAAyB;AACvB,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAU,GAAI,WAAA,EAAY;AAC5C,EAAA,MAAM,aAAA,GAAgB,MAAA,CAAsB,MAAA,EAAQ,IAAA,IAAQ,IAAI,CAAA;AAEhE,EAAA,MAAM,MAAA,GAAS,YAAY,YAAY;AACrC,I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import { ItemsList } from '@salla.sa/twilight-components-react';\nimport { HookSlot } from '../../hooks';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { useLocation } from '../../providers/NavigationProvider';\nimport { Breadcrumb, NoContent } from '../../components/common';\nimport { blog } from '../../api/blog';\nimport { BlogArticleCard, BlogListLayout } from './components';\nimport type { BlogAuthorLoaderData, ArticleSummary } from './types';\n\nconst EMPTY_CATEGORIES: BlogAuthorLoaderData['categories'] = [];\nconst EMPTY_ARTICLES: ArticleSummary[] = [];\n\nexport function BlogAuthorPage({\n page,\n author,\n categories = EMPTY_CATEGORIES,\n articles = EMPTY_ARTICLES,\n cursor,\n}: BlogAuthorLoaderData) {\n const { t } = useTranslation();\n const { pathname, searchStr } = useLocation();\n const nextCursorRef = useRef<string | null>(cursor?.next ?? null);\n\n const loader = useCallback(async () => {\n const nextUrl = nextCursorRef.current;\n const cursorMatch = nextUrl?.match(/[?&]cursor=([^&]+)/);\n const cursorValue = cursorMatch ? decodeURIComponent(cursorMatch[1]) : (nextUrl ?? undefined);\n\n const result = await blog.articles.list({ author: String(page.id), cursor: cursorValue });\n nextCursorRef.current = result.cursor?.next ?? null;\n\n return {\n items: result.data,\n next: result.cursor?.next ?? null,\n };\n }, [page.id]);\n\n if (articles.length === 0) {\n return (\n <div className=\"container mb-8 sm:mb-24\">\n <Breadcrumb page={page} />\n <BlogListLayout categories={categories}>\n <HookSlot name=\"blog:author.start\" />\n <NoContent icon=\"sicon-inbox\" message={t('pages.blog_categories.no_articles')} />\n <HookSlot name=\"blog:author.end\" />\n </BlogListLayout>\n </div>\n );\n }\n\n return (\n <div className=\"container mb-8 sm:mb-24\">\n <Breadcrumb page={page} />\n\n <BlogListLayout categories={categories}>\n <HookSlot name=\"blog:author.start\" />\n\n <div className=\"mb-6\">\n <h1 className=\"font-bold text-xl\">{author.name}</h1>\n </div>\n\n <ItemsList<ArticleSummary>\n items={articles}\n loader={cursor?.next ? loader : undefined}\n mode={cursor?.next ? 'infinite' : 'static'}\n pageUrl={pathname + searchStr}\n className=\"s-blog-list\"\n itemsClassName=\"grid md:grid-cols-2 gap-2.5 md:gap-8\"\n empty={<NoContent icon=\"sicon-inbox\" message={t('pages.blog_categories.no_articles')} />}\n t={(key, fallback) => t(key, fallback || key)}\n >\n {(items) =>\n items.map((article) => <BlogArticleCard key={article.id} article={article} />)\n }\n </ItemsList>\n\n <HookSlot name=\"blog:author.end\" />\n </BlogListLayout>\n </div>\n );\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/routes/blog/BlogCategoryPage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAM,mBAAyD,EAAC;AAChE,IAAM,iBAAmC,EAAC;AAEnC,SAAS,gBAAA,CAAiB;AAAA,EAC/B,IAAA;AAAA,EACA,YAAA;AAAA,EACA,UAAA,GAAa,gBAAA;AAAA,EACb,QAAA,GAAW,cAAA;AAAA,EACX;AACF,CAAA,EAA2B;AACzB,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,EAAE,QAAA,EAAU,SAAA,EAAU,GAAI,WAAA,EAAY;AAC5C,EAAA,MAAM,aAAA,GAAgB,MAAA,CAAsB,MAAA,EAAQ,IAAA,IAAQ,IAAI,CAAA;AAEhE,EAAA,MAAM,MAAA,GAAS,YAAY,YAAY;AACrC,IAAA,MAAM,UAAU,aAAA,CAAc,OAAA;AAC9B,IAAA,MAAM,WAAA,GAAc,OAAA,EAAS,KAAA,CAAM,oBAAoB,CAAA;AACvD,IAAA,MAAM,cAAc,WAAA,GAAc,kBAAA,CAAmB,YAAY,CAAC,CAAC,IAAK,OAAA,IAAW,MAAA;AAEnF,IAAA,MAAM,MAAA,GAAS,MAAM,IAAA,CAAK,QAAA,CAAS,IAAA,CAAK,EAAE,QAAA,EAAU,YAAA,CAAa,EAAA,EAAI,MAAA,EAAQ,WAAA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AAK,CAAA,EACvD,CAAA;AAAA,sBAEA,GAAA;AAAA,QAAC,SAAA;AAAA,QAAA;AAAA,UACC,KAAA,EAAO,QAAA;AAAA,UACP,MAAA,EAAQ,MAAA,EAAQ,IAAA,GAAO,MAAA,GAAS,MAAA;AAAA,UAChC,IAAA,EAAM,MAAA,EAAQ,IAAA,GAAO,UAAA,GAAa,QAAA;AAAA,UAClC,SAAS,QAAA,GAAW,SAAA;AAAA,UACpB,SAAA,EAAU,aAAA;AAAA,UACV,cAAA,EAAe,sCAAA;AAAA,UACf,KAAA,sBAAQ,aAAA,EAAA,EAAU,IAAA,EAAK,eAAc,OAAA,EAAS,CAAA,CAAE,mCAAmC,CAAA,EAAG,CAAA;AAAA,UACtF,GAAG,CAAC,GAAA,EAAK,aAAa,CAAA,CAAE,GAAA,EAAK,YAAY,GAAG,CAAA;AAAA,UAE3C,QAAA,EAAA,CAAC,KAAA,KACA,KAAA,CAAM,GAAA,CAAI,CAAC,OAAA,qBACT,GAAA,CAAC,eAAA,EAAA,EAAiC,OAAA,EAAkB,UAAA,EAAU,IAAA,EAAA,EAAxC,OAAA,CAAQ,EAAiC,CAChE;AAAA;AAAA,OAEL;AAAA,sBAEA,GAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAK,mBAAA,EAAoB;AAAA,KAAA,EACrC;AAAA,GAAA,EACF,CAAA;AAEJ","file":"BlogCategoryPage-MADVXTFU.js","sourcesContent":["import { useRef, useCallback } from 'react';\nimport { ItemsList } from '@salla.sa/twilight-components-react';\nimport { HookSlot } from '../../hooks';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { useLocation } from '../../providers/NavigationProvider';\nimport { Breadcrumb, NoContent } from '../../components/common';\nimport { blog } from '../../api/blog';\nimport { BlogArticleCard, BlogListLayout } from './components';\nimport type { BlogCategoryLoaderData, ArticleSummary } from './types';\n\nconst EMPTY_CATEGORIES: BlogCategoryLoaderData['categories'] = [];\nconst EMPTY_ARTICLES: ArticleSummary[] = [];\n\nexport function BlogCategoryPage({\n page,\n blogCategory,\n categories = EMPTY_CATEGORIES,\n articles = EMPTY_ARTICLES,\n cursor,\n}: BlogCategoryLoaderData) {\n const { t } = useTranslation();\n const { pathname, searchStr } = useLocation();\n const nextCursorRef = useRef<string | null>(cursor?.next ?? null);\n\n const loader = useCallback(async () => {\n const nextUrl = nextCursorRef.current;\n const cursorMatch = nextUrl?.match(/[?&]cursor=([^&]+)/);\n const cursorValue = cursorMatch ? decodeURIComponent(cursorMatch[1]) : (nextUrl ?? undefined);\n\n const result = await blog.articles.list({ category: blogCategory.id, cursor: cursorValue });\n nextCursorRef.current = result.cursor?.next ?? null;\n\n return {\n items: result.data,\n next: result.cursor?.next ?? null,\n };\n }, [blogCategory.id]);\n\n if (articles.length === 0) {\n return (\n <div className=\"container mb-8 sm:mb-24\">\n <Breadcrumb page={page} />\n <BlogListLayout categories={categories}>\n <HookSlot name=\"blog:category.start\" />\n <NoContent icon=\"sicon-inbox\" message={t('pages.blog_categories.no_articles')} />\n <HookSlot name=\"blog:category.end\" />\n </BlogListLayout>\n </div>\n );\n }\n\n return (\n <div className=\"container mb-8 sm:mb-24\">\n <Breadcrumb page={page} />\n\n <BlogListLayout categories={categories}>\n <HookSlot name=\"blog:category.start\" />\n\n <div className=\"mb-6\">\n <h1 className=\"font-bold text-xl\">{blogCategory.name}</h1>\n </div>\n\n <ItemsList<ArticleSummary>\n items={articles}\n loader={cursor?.next ? loader : undefined}\n mode={cursor?.next ? 'infinite' : 'static'}\n pageUrl={pathname + searchStr}\n className=\"s-blog-list\"\n itemsClassName=\"grid md:grid-cols-2 gap-2.5 md:gap-8\"\n empty={<NoContent icon=\"sicon-inbox\" message={t('pages.blog_categories.no_articles')} />}\n t={(key, fallback) => t(key, fallback || key)}\n >\n {(items) =>\n items.map((article) => (\n <BlogArticleCard key={article.id} article={article} showAuthor />\n ))\n }\n </ItemsList>\n\n <HookSlot name=\"blog:category.end\" />\n </BlogListLayout>\n </div>\n );\n}\n"]}
@@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,mCAAmC,CAAA,EAAG,CAAA;AAAA,wBAInFA,GAAAA,CAAC,QAAA,EAAA,EAAS,IAAA,EAAK,UAAA,EAAW;AAAA,OAAA,EAC5B;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"BlogPage-DTHRWEHK.js","sourcesContent":["import { useState } from 'react';\nimport { Link } from '../../components/common';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport type { BlogTag } from './types';\n\n/** Tags shown on a blog card before the rest fold behind a \"+N\" toggle. */\nexport const BLOG_CARD_VISIBLE_TAGS = 3;\n\ninterface BlogTagsProps {\n tags: BlogTag[];\n /** How many tags to show before folding the rest. */\n visible?: number;\n}\n\n/**\n * The tag row of a blog card. Articles can carry dozens of tags, which used to wrap into\n * a wall of links and stretch the card; show the first few as compact chips and fold the\n * rest behind a \"+N\" toggle that expands them in place (and \"Show less\" to fold back).\n * Nothing folds when the tags fit.\n */\nexport function BlogTags({ tags, visible = BLOG_CARD_VISIBLE_TAGS }: BlogTagsProps) {\n const { t } = useTranslation();\n const [expanded, setExpanded] = useState(false);\n\n if (tags.length === 0) return null;\n\n const hiddenCount = Math.max(0, tags.length - visible);\n const shown = expanded ? tags : tags.slice(0, visible);\n\n return (\n <div className=\"s-blog-tags p-4 flex flex-wrap items-center gap-2 border-t border-gray-200\">\n {shown.map((tag) => (\n <Link\n key={tag.id}\n to={tag.url}\n className=\"s-blog-tags-item py-1 px-3 rounded-full border border-gray-200 inline-flex items-center max-w-full text-gray-500 hover:text-dark hover:border-gray-300 text-xs\"\n >\n <i className=\"font-medium sicon-tag rtl:ml-1.5 ltr:mr-1.5\"></i>\n <span className=\"fix-align truncate\">{tag.name}</span>\n </Link>\n ))}\n {hiddenCount > 0 && (\n <button\n type=\"button\"\n className=\"s-blog-tags-more py-1 px-3 rounded-full text-xs font-medium text-primary hover:opacity-80\"\n aria-expanded={expanded}\n onClick={() => setExpanded((open) => !open)}\n >\n {expanded ? t('common.elements.show_less', 'Show less') : `+${hiddenCount}`}\n </button>\n )}\n </div>\n );\n}\n","import { SallaSlider } from '@salla.sa/twilight-components-react/slider';\nimport { HookSlot, useDate } from '../../hooks';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport type { BlogPageProps, ArticleSummary } from './types';\nimport { Breadcrumb, NoContent, Link, Image } from '../../components/common';\nimport { BlogTags } from './BlogTags';\n\nconst EMPTY_CATEGORIES: NonNullable<BlogPageProps['categories']> = [];\nconst EMPTY_ARTICLES: ArticleSummary[] = [];\nconst EMPTY_SLIDES: NonNullable<BlogPageProps['slides']> = [];\n\nexport function BlogPage({\n page,\n categories = EMPTY_CATEGORIES,\n articles = EMPTY_ARTICLES,\n slides = EMPTY_SLIDES,\n}: BlogPageProps) {\n const { t } = useTranslation();\n const { format: formatDate } = useDate();\n\n return (\n <div className=\"container mb-8 sm:mb-24\">\n <div className=\"center-between\">\n <Breadcrumb page={page} />\n </div>\n\n <div className=\"grid grid-cols-1 lg:grid-cols-8 gap-8\">\n <nav aria-label=\"Sidebar\" className=\"hidden lg:block lg:sticky shrink-0 top-24 col-span-2\">\n <h2 className=\"font-bold mb-3\">{t('pages.blog_categories.categories')}</h2>\n <ul>\n {categories.map((category) => (\n <li key={category.id} className={category.is_current ? 'text-primary' : ''}>\n <Link className=\"py-3 block text-sm hover:text-primary\" to={category.url}>\n {category.name}\n </Link>\n </li>\n ))}\n </ul>\n </nav>\n\n <div className=\"main-content lg:col-span-6\">\n <HookSlot name=\"blog:start\" />\n\n {slides.length > 0 && (\n <SallaSlider\n id=\"blog-home-slider\"\n type=\"blog\"\n autoPlay\n autoHeight\n showControls={false}\n pagination\n className=\"blog-slider block rounded overflow-hidden mb-2.5 lg:mb-8\"\n sliderConfig={{ watchOverflow: true }}\n >\n <div slot=\"items\">\n {slides.map((article, index) => (\n <div\n key={article.id}\n className=\"swiper-slide has-overlay blog-slider__slide h-[300px] md:h-[400px] relative bg-border-color flex justify-center\"\n >\n <Image\n className=\"object-cover h-full w-full\"\n src={article.image}\n alt={article.name}\n aspectRatio=\"3/1\"\n priority={index === 0}\n />\n <div className=\"absolute z-10 bottom-0 rtl:right-0 ltr:left-0 p-4 pb-10 rtl:lg:pr-10 ltr:lg:pl-10 lg:pb-20\">\n <div className=\"blog-slider__content relative\">\n <div className=\"z-20 w-full md:w-5/6 lg:w-6/12 text-white\">\n <div className=\"block-slide-anime\">\n <div className=\"mb-2.5 rounded-md inline-flex text-sm rtl:space-x-reverse space-x-5\">\n <div className=\"flex items-center\">\n <i className=\"sicon-calendar-date rtl:ml-1 ltr:mr-1\"></i>\n <span className=\"whitespace-nowrap\">\n {formatDate(article.created_at)}\n </span>\n </div>\n <Link\n to={article.author?.url || '#'}\n className=\"flex items-center hover:underline\"\n >\n <i className=\"sicon-user rtl:ml-1 ltr:mr-1\"></i>\n <span className=\"whitespace-nowrap\">{article.author?.name}</span>\n </Link>\n </div>\n <h3 className=\"text-sm font-bold leading-normal mb-4\">\n <Link to={article.url}>{article.name}</Link>\n </h3>\n </div>\n <p className=\"line-clamp-2 block-slide-anime description\">\n {article.description}\n </p>\n </div>\n </div>\n </div>\n </div>\n ))}\n </div>\n </SallaSlider>\n )}\n\n {!slides.length && (\n <div className=\"sr-only lg:not-sr-only\">\n <h1 className=\"blog-category__title font-bold text-lg mb-8\">\n {t('blocks.footer.blog')}\n </h1>\n </div>\n )}\n\n {slides.length > 0 && <h1 className=\"sr-only\">{t('blocks.footer.blog')}</h1>}\n\n {articles.length > 0 ? (\n <>\n <HookSlot name=\"blog:items.start\" />\n <div className=\"grid md:grid-cols-2 gap-2.5 md:gap-8\">\n {articles.map((article) => (\n <div\n key={article.id}\n className=\"list-block post-entry relative h-full transition-shadow duration-500 bg-white hover:shadow-default rounded-lg justify-around overflow-hidden flex flex-col\"\n >\n <Link\n to={article.url}\n className=\"post-entry__image relative overflow-hidden hover:opacity-90 w-full h-56 bg-border-color flex items-center justify-center\"\n >\n <Image\n className=\"h-full w-full object-cover\"\n src={article.image}\n alt={article.name}\n aspectRatio=\"16/9\"\n />\n </Link>\n\n <div className=\"flex-1 px-5 pt-5 pb-7\">\n <div className=\"mb-2.5 text-gray-500 rounded-md inline-flex text-sm rtl:space-x-reverse space-x-5\">\n <div className=\"flex items-center\">\n <i className=\"sicon-calendar-date rtl:ml-1 ltr:mr-1\"></i>\n <span>{formatDate(article.created_at)}</span>\n </div>\n <Link\n to={article.author?.url || '#'}\n className=\"flex items-center hover:text-dark\"\n >\n <i className=\"sicon-user rtl:ml-1 ltr:mr-1\"></i>\n <span>{article.author?.name}</span>\n </Link>\n </div>\n\n <h3 className=\"post-entry__title text-sm font-bold text-gray-800 leading-6 mb-2.5\">\n <Link to={article.url}>{article.name}</Link>\n </h3>\n <p className=\"text-sm text-gray-500 leading-6 mb-2.5\">\n {article.description}\n </p>\n\n {((article.stats?.likes ?? 0) > 0 || (article.stats?.comments ?? 0) > 0) && (\n <div className=\"post-entry__icons flex items-center gap-2.5 text-gray-500 text-sm\">\n {(article.stats?.likes ?? 0) > 0 && (\n <div className=\"flex items-center gap-1\">\n <i className=\"sicon-thumbs-up\"></i>\n {article.stats?.likes}\n </div>\n )}\n {(article.stats?.comments ?? 0) > 0 && (\n <div className=\"flex items-center gap-1\">\n <i className=\"sicon-chat\"></i>\n {article.stats?.comments}\n </div>\n )}\n </div>\n )}\n </div>\n\n {article.tags && <BlogTags tags={article.tags} />}\n </div>\n ))}\n </div>\n <HookSlot name=\"blog:items.end\" />\n </>\n ) : (\n !slides.length && (\n <NoContent icon=\"sicon-inbox\" message={t('pages.blog_categories.no_articles')} />\n )\n )}\n\n <HookSlot name=\"blog:end\" />\n </div>\n </div>\n </div>\n );\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/routes/blog/BlogSinglePage.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASO,SAAS,eAAe,EAAE,IAAA,EAAM,SAAS,OAAA,GAAU,IAAG,EAAw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port { HookSlot, useAsset, useDate } from '../../hooks';\nimport { useBlogLike } from '../../hooks/useBlogLike';\nimport { useComments } from '../../hooks/useComments';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport type { BlogSinglePageProps } from './types';\nimport { Breadcrumb, Image, Link } from '../../components/common';\nimport { useTwilight } from '../../providers/twilight-context';\n\nexport function BlogSinglePage({ page, article, related = [] }: BlogSinglePageProps) {\n const { t } = useTranslation();\n const { store } = useTwilight();\n const { cdn } = useAsset();\n const { format: formatDate } = useDate();\n const { active, count, toggle, loading } = useBlogLike(\n Number(article.id) || 0,\n article.stats?.likes ?? 0\n );\n const { commentsKey } = useComments();\n\n return (\n <div key={article.id} className=\"container mb-8 sm:mb-24\">\n <Breadcrumb page={page} />\n\n <div className=\"md:flex items-start\">\n <div className=\"main-content blog-category md:w-96 flex-1 bg-white lg:p-8 rounded-md mb-10 md:mb-0\">\n <HookSlot name=\"blog:single.start\" />\n\n <h1 className=\"font-bold text-3xl mb-5 leading-10\">{article.name}</h1>\n\n <div className=\"mb-10 text-gray-500 rounded-md inline-flex text-sm rtl:space-x-reverse space-x-5\">\n <div className=\"flex items-center\">\n <i className=\"sicon-calendar-date rtl:ml-1 ltr:mr-1\"></i>\n <span>{formatDate(article.created_at)}</span>\n </div>\n <Link to={article.author?.url || '#'} className=\"flex items-center hover:text-dark\">\n <i className=\"sicon-user rtl:ml-1 ltr:mr-1\"></i>\n <span>{article.author?.name}</span>\n </Link>\n </div>\n\n {article.image && (\n <Image\n src={article.image}\n alt={article.name}\n className=\"h-80 mb-10 w-full rounded-md\"\n aspectRatio=\"16/9\"\n priority\n noWrapper\n />\n )}\n\n {store.settings?.blog?.allow_likes_and_comments && (\n <div className=\"flex items-center gap-2.5 text-gray-500 text-base mb-2\">\n <button\n type=\"button\"\n id=\"blog-like\"\n data-blog-id={article.id}\n className={`flex items-center gap-1 transition-colors ${active ? 'text-primary font-semibold liked' : ''}`}\n onClick={toggle}\n disabled={loading}\n >\n {loading ? (\n <span className=\"loader loader--small\"></span>\n ) : (\n <i className={`sicon-thumbs-up ${active ? 'text-primary' : ''}`}></i>\n )}\n <span>{count}</span>\n </button>\n {(article.stats?.comments ?? 0) > 0 && (\n <div className=\"flex items-center gap-1\">\n <i className=\"sicon-chat text-primary\"></i>\n {article.stats?.comments}\n </div>\n )}\n </div>\n )}\n\n <article\n className=\"leading-7 text-sm mb-10\"\n dangerouslySetInnerHTML={{ __html: article.description?.replace(/&nbsp;/g, ' ') || '' }}\n />\n\n {article.tags && article.tags.length > 0 && (\n <div className=\"p-4 flex flex-wrap items-center border-t border-gray-200\">\n {article.tags.map((tag) => (\n <Link\n key={tag.id}\n to={tag.url}\n className=\"py-2 px-4 rounded-large inline-flex items-center text-gray-500 hover:text-dark justify-center text-sm\"\n >\n <i className=\"font-medium sicon-tag rtl:ml-1.5 ltr:mr-1.5\"></i>\n <span className=\"fix-align whitespace-nowrap\">{tag.name}</span>\n </Link>\n ))}\n </div>\n )}\n\n {store.settings?.blog?.allow_likes_and_comments && (\n <SallaComments\n key={commentsKey}\n itemId={Number(article.id) || 0}\n type={'blog' as any}\n />\n )}\n\n <HookSlot name=\"blog:single.end\" />\n </div>\n\n <aside\n aria-label=\"Sidebar\"\n className=\"sticky shrink-0 top-24 md:w-96 rtl:lg:mr-8 ltr:lg:ml-8 pb-11\"\n >\n {related.length > 0 && (\n <>\n <h2 className=\"font-bold mb-3\">{t('pages.blog_articles.related')}</h2>\n\n <HookSlot name=\"blog:single.related.start\" />\n\n {related.map((relatedArticle) => (\n <div\n key={relatedArticle.id}\n className=\"mt-5 flex items-center bg-white p-5 rounded-md\"\n >\n <div className=\"shrink-0\">\n <Link\n to={relatedArticle.url}\n className=\"bg-border-color h-24 w-24 rounded-md overflow-hidden flex items-center justify-center\"\n >\n <span className=\"sr-only\">{relatedArticle.name}</span>\n {relatedArticle.image ? (\n <Image\n className=\"h-full w-full object-cover\"\n src={relatedArticle.image}\n alt={relatedArticle.name}\n aspectRatio=\"1/1\"\n />\n ) : (\n <Image\n className=\"sm:h-full w-10 object-contain opacity-60\"\n src={cdn('/images/placeholder.png')}\n alt=\"post image\"\n />\n )}\n </Link>\n </div>\n <div className=\"rtl:mr-3 ltr:ml-3\">\n <div className=\"flex items-center text-sm text-gray-500 mb-2\">\n <i className=\"sicon-calendar-date rtl:ml-1 ltr:mr-1 rtl:pl-px ltr:pr-px\"></i>\n <time>{formatDate(relatedArticle.created_at)}</time>\n </div>\n <h3 className=\"text-sm font-bold text-gray-800 leading-6\">\n <Link to={relatedArticle.url} className=\"hover:underline\">\n {relatedArticle.name}\n </Link>\n </h3>\n </div>\n </div>\n ))}\n\n <HookSlot name=\"blog:single.related.end\" />\n </>\n )}\n </aside>\n </div>\n </div>\n );\n}\n"]}