@salla.sa/twilight-theme-engine 1.0.206 → 1.0.208
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.
- package/dist/{AddToCartForm-SZ56QSZ7.js → AddToCartForm-FLSMTYQ4.js} +3 -3
- package/dist/{AddToCartForm-SZ56QSZ7.js.map → AddToCartForm-FLSMTYQ4.js.map} +1 -1
- package/dist/{BlogAuthorPage-M3OCNQ7D.js → BlogAuthorPage-PCA6Z5FA.js} +19 -19
- package/dist/{BlogAuthorPage-M3OCNQ7D.js.map → BlogAuthorPage-PCA6Z5FA.js.map} +1 -1
- package/dist/{BlogCategoryPage-CMKE3QCZ.js → BlogCategoryPage-V5OOLDO7.js} +19 -19
- package/dist/{BlogCategoryPage-CMKE3QCZ.js.map → BlogCategoryPage-V5OOLDO7.js.map} +1 -1
- package/dist/{BlogPage-GHLMIE3Z.js → BlogPage-3BWT5L66.js} +17 -17
- package/dist/{BlogPage-GHLMIE3Z.js.map → BlogPage-3BWT5L66.js.map} +1 -1
- package/dist/{BlogSinglePage-M75XQBWT.js → BlogSinglePage-5I5KYA3A.js} +17 -17
- package/dist/{BlogSinglePage-M75XQBWT.js.map → BlogSinglePage-5I5KYA3A.js.map} +1 -1
- package/dist/{BlogTagPage-ORFGMIBH.js → BlogTagPage-ZOXJ2ZL7.js} +19 -19
- package/dist/{BlogTagPage-ORFGMIBH.js.map → BlogTagPage-ZOXJ2ZL7.js.map} +1 -1
- package/dist/{BrandsPage-VIVRITLO.js → BrandsPage-OJL72GRV.js} +18 -18
- package/dist/{BrandsPage-VIVRITLO.js.map → BrandsPage-OJL72GRV.js.map} +1 -1
- package/dist/{Breadcrumb-Z6OBJQZM.js → Breadcrumb-GY5KGEKR.js} +17 -17
- package/dist/{Breadcrumb-Z6OBJQZM.js.map → Breadcrumb-GY5KGEKR.js.map} +1 -1
- package/dist/{CanvasOverlay-TYG2WK2Z.js → CanvasOverlay-AT6M5A2U.js} +3 -3
- package/dist/{CanvasOverlay-TYG2WK2Z.js.map → CanvasOverlay-AT6M5A2U.js.map} +1 -1
- package/dist/{CartItem-EL2F4CY6.js → CartItem-S4BD6EHA.js} +17 -17
- package/dist/{CartItem-EL2F4CY6.js.map → CartItem-S4BD6EHA.js.map} +1 -1
- package/dist/{CartSummary-KL63ND3A.js → CartSummary-JREM7MQD.js} +17 -17
- package/dist/{CartSummary-KL63ND3A.js.map → CartSummary-JREM7MQD.js.map} +1 -1
- package/dist/{Copyright-3ZSGL24B.js → Copyright-XX3HG3ZI.js} +3 -3
- package/dist/{Copyright-3ZSGL24B.js.map → Copyright-XX3HG3ZI.js.map} +1 -1
- package/dist/{CustomerLayout-AD7C46E5.js → CustomerLayout-NWSFIJO6.js} +17 -17
- package/dist/{CustomerLayout-AD7C46E5.js.map → CustomerLayout-NWSFIJO6.js.map} +1 -1
- package/dist/{Footer-BOHOZDHS.js → Footer-AANE2FAE.js} +3 -3
- package/dist/{Footer-BOHOZDHS.js.map → Footer-AANE2FAE.js.map} +1 -1
- package/dist/GoogleTag-L5HYN3QT.js +15 -0
- package/dist/{GoogleTag-VMMAYSX6.js.map → GoogleTag-L5HYN3QT.js.map} +1 -1
- package/dist/{Header-MKASJTCQ.js → Header-XTU4UI7Z.js} +8 -8
- package/dist/{Header-MKASJTCQ.js.map → Header-XTU4UI7Z.js.map} +1 -1
- package/dist/{LatestProducts-7VRYRZZU.js → LatestProducts-7JE23JAG.js} +19 -19
- package/dist/{LatestProducts-7VRYRZZU.js.map → LatestProducts-7JE23JAG.js.map} +1 -1
- package/dist/{LoyaltyPage-ZAKVJX4D.js → LoyaltyPage-ZN57ZJSO.js} +17 -17
- package/dist/{LoyaltyPage-ZAKVJX4D.js.map → LoyaltyPage-ZN57ZJSO.js.map} +1 -1
- package/dist/{LoyaltyPointsPage-D23DNGEM.js → LoyaltyPointsPage-XHKQJLKS.js} +6 -6
- package/dist/{LoyaltyPointsPage-D23DNGEM.js.map → LoyaltyPointsPage-XHKQJLKS.js.map} +1 -1
- package/dist/{MainMenu-VS6ACI36.js → MainMenu-5FWCLNGA.js} +5 -5
- package/dist/{MainMenu-VS6ACI36.js.map → MainMenu-5FWCLNGA.js.map} +1 -1
- package/dist/{MasterLayout-6NLIIYLH.js → MasterLayout-6NE5WERV.js} +17 -17
- package/dist/{MasterLayout-6NLIIYLH.js.map → MasterLayout-6NE5WERV.js.map} +1 -1
- package/dist/{MobileMenu-HI4UOJAG.js → MobileMenu-FJGYJSBC.js} +18 -18
- package/dist/{MobileMenu-HI4UOJAG.js.map → MobileMenu-FJGYJSBC.js.map} +1 -1
- package/dist/{NotificationsPage-MDH3WV25.js → NotificationsPage-3Y3MKZK6.js} +17 -17
- package/dist/{NotificationsPage-MDH3WV25.js.map → NotificationsPage-3Y3MKZK6.js.map} +1 -1
- package/dist/{OrderSinglePage-DZVUGLTR.js → OrderSinglePage-6YBCBFNO.js} +18 -18
- package/dist/{OrderSinglePage-DZVUGLTR.js.map → OrderSinglePage-6YBCBFNO.js.map} +1 -1
- package/dist/{OrdersPage-Z64EXGTP.js → OrdersPage-GPIWRVZG.js} +17 -17
- package/dist/{OrdersPage-Z64EXGTP.js.map → OrdersPage-GPIWRVZG.js.map} +1 -1
- package/dist/{PageSingle-O3KTWC2Q.js → PageSingle-NZPCT2XG.js} +3 -3
- package/dist/{PageSingle-O3KTWC2Q.js.map → PageSingle-NZPCT2XG.js.map} +1 -1
- package/dist/{ProductDetails-EGY4N3ZK.js → ProductDetails-3YGL2QGH.js} +5 -5
- package/dist/{ProductDetails-EGY4N3ZK.js.map → ProductDetails-3YGL2QGH.js.map} +1 -1
- package/dist/{ProfilePage-UWUJPOYA.js → ProfilePage-RCMMC7OG.js} +17 -17
- package/dist/{ProfilePage-UWUJPOYA.js.map → ProfilePage-RCMMC7OG.js.map} +1 -1
- package/dist/{ReviewsPage-G6BXHOSU.js → ReviewsPage-FVGX7INF.js} +3 -3
- package/dist/{ReviewsPage-G6BXHOSU.js.map → ReviewsPage-FVGX7INF.js.map} +1 -1
- package/dist/{SeoCartWidget-R4EVCBXK.js → SeoCartWidget-S4PEITSP.js} +17 -17
- package/dist/{SeoCartWidget-R4EVCBXK.js.map → SeoCartWidget-S4PEITSP.js.map} +1 -1
- package/dist/{SettingsPage-C2EIQZ2T.js → SettingsPage-2OZA647W.js} +17 -17
- package/dist/{SettingsPage-C2EIQZ2T.js.map → SettingsPage-2OZA647W.js.map} +1 -1
- package/dist/{StoreClosedNotification-AWNBBZJR.js → StoreClosedNotification-XIVWDEEQ.js} +18 -18
- package/dist/{StoreClosedNotification-AWNBBZJR.js.map → StoreClosedNotification-XIVWDEEQ.js.map} +1 -1
- package/dist/{TestimonialsPage-INUAUMKU.js → TestimonialsPage-EA3N7W56.js} +3 -3
- package/dist/{TestimonialsPage-INUAUMKU.js.map → TestimonialsPage-EA3N7W56.js.map} +1 -1
- package/dist/{ThankYouPage-GXC7W3HK.js → ThankYouPage-4SRPOE65.js} +17 -17
- package/dist/{ThankYouPage-GXC7W3HK.js.map → ThankYouPage-4SRPOE65.js.map} +1 -1
- package/dist/{WalletPage-TXJKPC5N.js → WalletPage-IBMF5AQ7.js} +18 -18
- package/dist/{WalletPage-TXJKPC5N.js.map → WalletPage-IBMF5AQ7.js.map} +1 -1
- package/dist/{WebMcpTools-X33C7Z2Q.js → WebMcpTools-7ILPBGW4.js} +5 -5
- package/dist/{WebMcpTools-X33C7Z2Q.js.map → WebMcpTools-7ILPBGW4.js.map} +1 -1
- package/dist/{WishlistPage-TEP3OEU6.js → WishlistPage-KVLEDTXR.js} +19 -19
- package/dist/{WishlistPage-TEP3OEU6.js.map → WishlistPage-KVLEDTXR.js.map} +1 -1
- package/dist/api/advertisement.js +2 -2
- package/dist/api/apps.js +2 -2
- package/dist/api/blog.js +3 -3
- package/dist/api/brands.js +3 -3
- package/dist/api/cart.js +3 -3
- package/dist/api/category.js +3 -3
- package/dist/api/client.js +1 -1
- package/dist/api/custom-url.js +2 -2
- package/dist/api/home.js +2 -2
- package/dist/api/loyalty.js +3 -3
- package/dist/api/menu.js +2 -2
- package/dist/api/notification.js +2 -2
- package/dist/api/order.js +3 -3
- package/dist/api/page.d.ts +15 -0
- package/dist/api/page.d.ts.map +1 -1
- package/dist/api/page.js +3 -3
- package/dist/api/product.js +3 -3
- package/dist/api/profile.js +1 -1
- package/dist/api/store.js +2 -2
- package/dist/api/translations.js +2 -2
- package/dist/api/user.js +2 -2
- package/dist/api/wallet.js +2 -2
- package/dist/api/wishlist.js +4 -4
- package/dist/{chunk-J2ONCJFP.js → chunk-2RYMYLXS.js} +3 -3
- package/dist/{chunk-J2ONCJFP.js.map → chunk-2RYMYLXS.js.map} +1 -1
- package/dist/{chunk-KXWDMETN.js → chunk-3LSW57HE.js} +3 -3
- package/dist/{chunk-KXWDMETN.js.map → chunk-3LSW57HE.js.map} +1 -1
- package/dist/{chunk-D2SVAGSH.js → chunk-3MHZVWRI.js} +9 -8
- package/dist/chunk-3MHZVWRI.js.map +1 -0
- package/dist/{chunk-WMSIZAHA.js → chunk-3W42UZSQ.js} +3 -3
- package/dist/{chunk-WMSIZAHA.js.map → chunk-3W42UZSQ.js.map} +1 -1
- package/dist/{chunk-AB2LBQTZ.js → chunk-42FFGD7O.js} +6 -6
- package/dist/{chunk-AB2LBQTZ.js.map → chunk-42FFGD7O.js.map} +1 -1
- package/dist/{chunk-EYGDVKW7.js → chunk-4QK6FO3U.js} +4 -4
- package/dist/{chunk-EYGDVKW7.js.map → chunk-4QK6FO3U.js.map} +1 -1
- package/dist/{chunk-KJGZ3GR3.js → chunk-4VQ2XUVG.js} +3 -3
- package/dist/{chunk-KJGZ3GR3.js.map → chunk-4VQ2XUVG.js.map} +1 -1
- package/dist/{chunk-GNECZLCV.js → chunk-54VGFM4I.js} +3 -3
- package/dist/{chunk-GNECZLCV.js.map → chunk-54VGFM4I.js.map} +1 -1
- package/dist/{chunk-BQBM36PF.js → chunk-7N5EUEMK.js} +4 -4
- package/dist/{chunk-BQBM36PF.js.map → chunk-7N5EUEMK.js.map} +1 -1
- package/dist/{chunk-YGREWGF7.js → chunk-7ORMPMZL.js} +4 -4
- package/dist/{chunk-YGREWGF7.js.map → chunk-7ORMPMZL.js.map} +1 -1
- package/dist/{chunk-HZT7H22K.js → chunk-7P6CX5CM.js} +4 -4
- package/dist/{chunk-HZT7H22K.js.map → chunk-7P6CX5CM.js.map} +1 -1
- package/dist/{chunk-K6LWHEGZ.js → chunk-ABQXES25.js} +5 -5
- package/dist/{chunk-K6LWHEGZ.js.map → chunk-ABQXES25.js.map} +1 -1
- package/dist/{chunk-2XBIMXCM.js → chunk-BOB2BDLK.js} +4 -4
- package/dist/{chunk-2XBIMXCM.js.map → chunk-BOB2BDLK.js.map} +1 -1
- package/dist/{chunk-UHDV3USV.js → chunk-BRX23CR2.js} +3 -3
- package/dist/{chunk-UHDV3USV.js.map → chunk-BRX23CR2.js.map} +1 -1
- package/dist/{chunk-QVXTEYE4.js → chunk-BXUX5FHW.js} +3 -3
- package/dist/{chunk-QVXTEYE4.js.map → chunk-BXUX5FHW.js.map} +1 -1
- package/dist/{chunk-QBVKHDAP.js → chunk-CBLSUXTP.js} +3 -3
- package/dist/{chunk-QBVKHDAP.js.map → chunk-CBLSUXTP.js.map} +1 -1
- package/dist/chunk-D4J3KPGI.js +33 -0
- package/dist/chunk-D4J3KPGI.js.map +1 -0
- package/dist/{chunk-UKPNHU6M.js → chunk-DWLEKQ3A.js} +3 -3
- package/dist/{chunk-UKPNHU6M.js.map → chunk-DWLEKQ3A.js.map} +1 -1
- package/dist/{chunk-MHM5XFTB.js → chunk-EKBM77K4.js} +3 -3
- package/dist/{chunk-MHM5XFTB.js.map → chunk-EKBM77K4.js.map} +1 -1
- package/dist/{chunk-RQU2X5RP.js → chunk-F7HINVWX.js} +19 -19
- package/dist/{chunk-RQU2X5RP.js.map → chunk-F7HINVWX.js.map} +1 -1
- package/dist/{chunk-YDY36E2Z.js → chunk-FK4SQURQ.js} +7 -7
- package/dist/{chunk-YDY36E2Z.js.map → chunk-FK4SQURQ.js.map} +1 -1
- package/dist/{chunk-MU7FXR2Q.js → chunk-FSCJ2VXL.js} +5 -5
- package/dist/{chunk-MU7FXR2Q.js.map → chunk-FSCJ2VXL.js.map} +1 -1
- package/dist/{chunk-SAZP2PYW.js → chunk-GGMWJJFB.js} +3 -3
- package/dist/{chunk-SAZP2PYW.js.map → chunk-GGMWJJFB.js.map} +1 -1
- package/dist/{chunk-JIKXE3YR.js → chunk-HI5OUST4.js} +3 -3
- package/dist/{chunk-JIKXE3YR.js.map → chunk-HI5OUST4.js.map} +1 -1
- package/dist/{chunk-RGKUQJMM.js → chunk-IAPLCMKH.js} +4 -4
- package/dist/{chunk-RGKUQJMM.js.map → chunk-IAPLCMKH.js.map} +1 -1
- package/dist/{chunk-OIQNGWO3.js → chunk-IPFX3GQO.js} +4 -4
- package/dist/{chunk-OIQNGWO3.js.map → chunk-IPFX3GQO.js.map} +1 -1
- package/dist/{chunk-HLSEXI5X.js → chunk-K5EHQI7U.js} +4 -4
- package/dist/{chunk-HLSEXI5X.js.map → chunk-K5EHQI7U.js.map} +1 -1
- package/dist/{chunk-FREN7T2I.js → chunk-LHCCAJXH.js} +3 -3
- package/dist/{chunk-FREN7T2I.js.map → chunk-LHCCAJXH.js.map} +1 -1
- package/dist/{chunk-UOS4ZNQ2.js → chunk-LUXNURXU.js} +29 -4
- package/dist/chunk-LUXNURXU.js.map +1 -0
- package/dist/{chunk-TILBL7L2.js → chunk-MFLYX5OS.js} +4 -4
- package/dist/{chunk-TILBL7L2.js.map → chunk-MFLYX5OS.js.map} +1 -1
- package/dist/chunk-MHBWYHS5.js +22 -0
- package/dist/chunk-MHBWYHS5.js.map +1 -0
- package/dist/{chunk-YF4DEYUZ.js → chunk-MQ35BIJL.js} +3 -3
- package/dist/{chunk-YF4DEYUZ.js.map → chunk-MQ35BIJL.js.map} +1 -1
- package/dist/{chunk-3WNU52EV.js → chunk-MSKSTXPM.js} +4 -4
- package/dist/{chunk-3WNU52EV.js.map → chunk-MSKSTXPM.js.map} +1 -1
- package/dist/{chunk-L3K5KK2Q.js → chunk-O3OSW5KZ.js} +3 -3
- package/dist/{chunk-L3K5KK2Q.js.map → chunk-O3OSW5KZ.js.map} +1 -1
- package/dist/{chunk-SWEAR4EL.js → chunk-OXPVKKJP.js} +7 -7
- package/dist/{chunk-SWEAR4EL.js.map → chunk-OXPVKKJP.js.map} +1 -1
- package/dist/{chunk-EOC2GILU.js → chunk-PJXTRHQN.js} +4 -4
- package/dist/{chunk-EOC2GILU.js.map → chunk-PJXTRHQN.js.map} +1 -1
- package/dist/{chunk-5XGJ7OTK.js → chunk-Q4RVSULH.js} +3 -3
- package/dist/{chunk-5XGJ7OTK.js.map → chunk-Q4RVSULH.js.map} +1 -1
- package/dist/{chunk-NRLXONDO.js → chunk-SFZBBDO5.js} +3 -3
- package/dist/{chunk-NRLXONDO.js.map → chunk-SFZBBDO5.js.map} +1 -1
- package/dist/{chunk-LGB6KWZN.js → chunk-SHUCELQ5.js} +3 -3
- package/dist/{chunk-LGB6KWZN.js.map → chunk-SHUCELQ5.js.map} +1 -1
- package/dist/{chunk-WUC25XBI.js → chunk-SWLIW4O7.js} +2 -2
- package/dist/{chunk-WUC25XBI.js.map → chunk-SWLIW4O7.js.map} +1 -1
- package/dist/{chunk-2ZA6SOF6.js → chunk-TJDFO67J.js} +3 -3
- package/dist/{chunk-2ZA6SOF6.js.map → chunk-TJDFO67J.js.map} +1 -1
- package/dist/{chunk-SQNREASU.js → chunk-TUZU2FUP.js} +4 -4
- package/dist/{chunk-SQNREASU.js.map → chunk-TUZU2FUP.js.map} +1 -1
- package/dist/{chunk-V45JKRB5.js → chunk-TZBXOHSS.js} +14 -14
- package/dist/{chunk-V45JKRB5.js.map → chunk-TZBXOHSS.js.map} +1 -1
- package/dist/{chunk-A4XSOGW7.js → chunk-VNX6EXCN.js} +7 -7
- package/dist/{chunk-A4XSOGW7.js.map → chunk-VNX6EXCN.js.map} +1 -1
- package/dist/{chunk-2SXDYAGG.js → chunk-WEBVRLRB.js} +3 -3
- package/dist/{chunk-2SXDYAGG.js.map → chunk-WEBVRLRB.js.map} +1 -1
- package/dist/{chunk-IN7XKP4U.js → chunk-WFXFO222.js} +3 -3
- package/dist/{chunk-IN7XKP4U.js.map → chunk-WFXFO222.js.map} +1 -1
- package/dist/{chunk-GGXODCMG.js → chunk-WHIIVRZF.js} +4 -4
- package/dist/{chunk-GGXODCMG.js.map → chunk-WHIIVRZF.js.map} +1 -1
- package/dist/{chunk-YRI77IKE.js → chunk-XN4FAL4G.js} +4 -4
- package/dist/{chunk-YRI77IKE.js.map → chunk-XN4FAL4G.js.map} +1 -1
- package/dist/{chunk-PC3CQKE2.js → chunk-XRBYWXFG.js} +3 -3
- package/dist/{chunk-PC3CQKE2.js.map → chunk-XRBYWXFG.js.map} +1 -1
- package/dist/{chunk-U233JWEI.js → chunk-XRUCBGMT.js} +4 -4
- package/dist/{chunk-U233JWEI.js.map → chunk-XRUCBGMT.js.map} +1 -1
- package/dist/{chunk-NC2G27YJ.js → chunk-YUWM5AU7.js} +5 -5
- package/dist/{chunk-NC2G27YJ.js.map → chunk-YUWM5AU7.js.map} +1 -1
- package/dist/components/cart/index.js +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/drawer/index.js +15 -15
- package/dist/components/home/index.js +20 -20
- package/dist/components/layout/index.js +4 -4
- package/dist/components/product/index.js +17 -17
- package/dist/components/store/index.js +16 -16
- package/dist/components/tracking/index.js +6 -6
- package/dist/{custom-urls-2MFMNEFR.js → custom-urls-XGNEF3FO.js} +7 -7
- package/dist/{custom-urls-2MFMNEFR.js.map → custom-urls-XGNEF3FO.js.map} +1 -1
- package/dist/dev/editor/index.js +1 -1
- package/dist/dev/index.js +1 -1
- package/dist/{document-class-S7KZVXXK.js → document-class-VGMESCGP.js} +17 -17
- package/dist/{document-class-S7KZVXXK.js.map → document-class-VGMESCGP.js.map} +1 -1
- package/dist/hooks/index.js +15 -15
- package/dist/hooks/useGtm.js +15 -15
- package/dist/hooks/useMoney.js +15 -15
- package/dist/hooks/useStore.js +15 -15
- package/dist/hooks/useUser.js +3 -3
- package/dist/index.js +15 -15
- package/dist/{navigation-IRWH4CHF.js → navigation-3RCZRME5.js} +4 -4
- package/dist/{navigation-IRWH4CHF.js.map → navigation-3RCZRME5.js.map} +1 -1
- package/dist/{navigation-RFYZOBRP.js → navigation-HCIKY36A.js} +5 -5
- package/dist/{navigation-RFYZOBRP.js.map → navigation-HCIKY36A.js.map} +1 -1
- package/dist/{not-found-JKV76IBT.js → not-found-MAYML5V7.js} +18 -18
- package/dist/{not-found-JKV76IBT.js.map → not-found-MAYML5V7.js.map} +1 -1
- package/dist/providers/index.js +15 -15
- package/dist/routes/account/orders.js +4 -4
- package/dist/routes/account.js +13 -13
- package/dist/routes/blog/index.d.ts.map +1 -1
- package/dist/routes/blog/types.d.ts +4 -0
- package/dist/routes/blog/types.d.ts.map +1 -1
- package/dist/routes/blog.js +22 -16
- package/dist/routes/blog.js.map +1 -1
- package/dist/routes/brands.js +4 -4
- package/dist/routes/cart.js +26 -25
- package/dist/routes/cart.js.map +1 -1
- package/dist/routes/home/index.d.ts.map +1 -1
- package/dist/routes/home.js +22 -21
- package/dist/routes/index.js +8 -8
- package/dist/routes/loyalty.js +5 -5
- package/dist/routes/page.js +4 -4
- package/dist/routes/product-listing.js +25 -25
- package/dist/routes/product.js +24 -24
- package/dist/routes/seo-redirects.d.ts +3 -2
- package/dist/routes/seo-redirects.d.ts.map +1 -1
- package/dist/routes/seo-redirects.js +8 -8
- package/dist/routes/testimonials.js +2 -2
- package/dist/routes/thank-you.js +4 -4
- package/dist/skeleton.js +24 -23
- package/dist/{store-lookup-IPVXW4UI.js → store-lookup-653RQUCV.js} +8 -8
- package/dist/{store-lookup-IPVXW4UI.js.map → store-lookup-653RQUCV.js.map} +1 -1
- package/dist/tanstack.js +17 -17
- package/dist/utils/index.js +2 -2
- package/dist/utils/seo-text.d.ts +23 -0
- package/dist/utils/seo-text.d.ts.map +1 -0
- package/package.json +1 -1
- package/tailwind/routes/blog/index.tsx.txt +15 -8
- package/tailwind/routes/blog/types.ts.txt +4 -0
- package/tailwind/routes/home/index.tsx.txt +5 -3
- package/tailwind/routes/seo-redirects.ts.txt +47 -2
- package/dist/GoogleTag-VMMAYSX6.js +0 -15
- package/dist/chunk-ACOK7N5Y.js +0 -21
- package/dist/chunk-ACOK7N5Y.js.map +0 -1
- package/dist/chunk-D2SVAGSH.js.map +0 -1
- package/dist/chunk-UOS4ZNQ2.js.map +0 -1
|
@@ -26,6 +26,7 @@ import type {
|
|
|
26
26
|
import type { IdParams, SlugIdParams } from '../types';
|
|
27
27
|
import type { TwilightContext } from '../../twilight/context';
|
|
28
28
|
import { RouteId } from '../../router/route-ids';
|
|
29
|
+
import { seoField, textExcerpt } from '../../utils/seo-text';
|
|
29
30
|
|
|
30
31
|
const LazyBlogPage = lazyComponent(() =>
|
|
31
32
|
import('./BlogPage').then((m) => ({ default: m.BlogPage }))
|
|
@@ -115,13 +116,16 @@ async function blogSingleLoaderWithExtend(
|
|
|
115
116
|
}
|
|
116
117
|
|
|
117
118
|
function blogSingleHead(ctx: TwilightContext, data: BlogSinglePageProps): HeadDescriptor {
|
|
119
|
+
const { article } = data;
|
|
120
|
+
// `seoField`, not `??`: the API sends an unset SEO field as "", which hid the article's own values.
|
|
121
|
+
const title = seoField(article.meta?.title, article.name);
|
|
118
122
|
const base: HeadDescriptor = {
|
|
119
|
-
title
|
|
120
|
-
description:
|
|
121
|
-
canonical:
|
|
123
|
+
title,
|
|
124
|
+
description: seoField(article.meta?.description, textExcerpt(article.description)),
|
|
125
|
+
canonical: seoField(article.meta?.canonical, article.url),
|
|
122
126
|
openGraph: {
|
|
123
|
-
title
|
|
124
|
-
images:
|
|
127
|
+
title,
|
|
128
|
+
images: seoField(article.meta?.og_image, article.image),
|
|
125
129
|
},
|
|
126
130
|
alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),
|
|
127
131
|
};
|
|
@@ -173,9 +177,12 @@ async function blogCategoryLoaderWithExtend(
|
|
|
173
177
|
|
|
174
178
|
function blogCategoryHead(ctx: TwilightContext, data: BlogCategoryLoaderData): HeadDescriptor {
|
|
175
179
|
const base: HeadDescriptor = {
|
|
176
|
-
title: data.blogCategory.meta?.title
|
|
177
|
-
description:
|
|
178
|
-
|
|
180
|
+
title: seoField(data.blogCategory.meta?.title, data.blogCategory.name),
|
|
181
|
+
description: seoField(
|
|
182
|
+
data.blogCategory.meta?.description,
|
|
183
|
+
`Articles in ${data.blogCategory.name}`
|
|
184
|
+
),
|
|
185
|
+
canonical: seoField(data.blogCategory.meta?.canonical, data.blogCategory.url),
|
|
179
186
|
alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),
|
|
180
187
|
};
|
|
181
188
|
|
|
@@ -32,6 +32,10 @@ export interface ArticleStats {
|
|
|
32
32
|
comments?: number;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
/**
|
|
36
|
+
* The merchant's SEO fields. The blog API sends each one, as `""` when the merchant set none, so read
|
|
37
|
+
* them through `seoField()`, never with `??`.
|
|
38
|
+
*/
|
|
35
39
|
export interface ArticleMeta {
|
|
36
40
|
title?: string;
|
|
37
41
|
description?: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HeadDescriptor } from '../../utils/head';
|
|
2
2
|
import { buildHreflangAlternates, storePageUrl } from '../../utils/baseHead';
|
|
3
|
+
import { seoField } from '../../utils/seo-text';
|
|
3
4
|
import type { HomeLoaderData } from './loader';
|
|
4
5
|
import { homeLoader } from './loader';
|
|
5
6
|
import type { TwilightContext } from '../../twilight/context';
|
|
@@ -25,9 +26,10 @@ function head(ctx: TwilightContext): HeadDescriptor {
|
|
|
25
26
|
const store = ctx.settings?.store;
|
|
26
27
|
if (!store) return {};
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
const
|
|
29
|
+
// `seoField`, not `??`: the store's unset SEO fields arrive as "".
|
|
30
|
+
const title = seoField(store.meta?.title, store.name);
|
|
31
|
+
const description = seoField(store.meta?.description, store.description);
|
|
32
|
+
const keywords = seoField(store.meta?.keywords, undefined);
|
|
31
33
|
// `/ar`, like Twig, where store.url reads `/ar/`.
|
|
32
34
|
const url = storePageUrl(ctx.settings, ctx.location.pathname) ?? store.url;
|
|
33
35
|
|
|
@@ -100,6 +100,12 @@ const SLUG_ROUTES = new Set([PRODUCT_SLUG_ROUTE_ID, CATEGORY_SLUG_ROUTE_ID]);
|
|
|
100
100
|
const TWIG_PRODUCT_URL = /^(?:\/([^/]+))?\/p(\d{1,18})(?:-[^/]*)?\/?$/;
|
|
101
101
|
/** `/category/{hash}`, with or without a leading segment. */
|
|
102
102
|
const TWIG_CATEGORY_URL = /^(?:\/([^/]+))?\/category\/([A-Za-z0-9]+)\/?$/;
|
|
103
|
+
/**
|
|
104
|
+
* `/p/{slug}`, with or without a leading segment: Twig's page address (`PageController@show`), the
|
|
105
|
+
* one a store without SEO URLs lists in its sitemap. Twig renders it there, or 301s it to the page's
|
|
106
|
+
* `/{slug}/page-{id}` on a store with SEO URLs.
|
|
107
|
+
*/
|
|
108
|
+
const TWIG_PAGE_URL = /^(?:\/([^/]+))?\/p\/([^/]+)\/?$/;
|
|
103
109
|
|
|
104
110
|
/** The page the router matched, as the locale layout's `beforeLoad` sees it. */
|
|
105
111
|
export interface MatchedPage {
|
|
@@ -172,6 +178,39 @@ async function shortLinkProductId(
|
|
|
172
178
|
}
|
|
173
179
|
}
|
|
174
180
|
|
|
181
|
+
/** A slug as Twig compares it: decoded, trimmed, case aside. */
|
|
182
|
+
function comparableSlug(slug: string): string {
|
|
183
|
+
let decoded = slug;
|
|
184
|
+
try {
|
|
185
|
+
decoded = decodeURIComponent(slug);
|
|
186
|
+
} catch {
|
|
187
|
+
// Not percent-encoded as a whole: compared as it came.
|
|
188
|
+
}
|
|
189
|
+
return decoded.trim().toLowerCase();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* The address of the page Twig calls `/p/{slug}`, found in the store's page list by its slug (the
|
|
194
|
+
* page API takes only an id). Any failure counts as "no such page", as for a short link: the
|
|
195
|
+
* address then stays the not-found page, after the merchant's custom URLs are asked.
|
|
196
|
+
*/
|
|
197
|
+
async function legacyPagePath(
|
|
198
|
+
slug: string,
|
|
199
|
+
queryClient?: QueryClient
|
|
200
|
+
): Promise<string | undefined> {
|
|
201
|
+
const { page } = await import('../api/page');
|
|
202
|
+
try {
|
|
203
|
+
const pages = queryClient
|
|
204
|
+
? await queryClient.ensureQueryData(page.queries.list())
|
|
205
|
+
: await page.list();
|
|
206
|
+
const wanted = comparableSlug(slug);
|
|
207
|
+
const found = pages.find((listed) => listed.slug && comparableSlug(listed.slug) === wanted);
|
|
208
|
+
return found ? `/${encodeURIComponent(found.slug.trim())}/page-${found.id}` : undefined;
|
|
209
|
+
} catch {
|
|
210
|
+
return undefined;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
175
214
|
/** Where a Twig URL's page is now, and the language its address carried. */
|
|
176
215
|
/**
|
|
177
216
|
* A Twig product or category URL: `/p{id}…` or `/category/{hash}`, bare or under a language. Under
|
|
@@ -196,6 +235,11 @@ async function twigTarget(
|
|
|
196
235
|
const id = await categoryIdOf(pageUrl.ref, queryClient);
|
|
197
236
|
return id ? { path: `/-/c${id}`, locale: pageUrl.locale } : undefined;
|
|
198
237
|
}
|
|
238
|
+
const legacyPage = TWIG_PAGE_URL.exec(pathname);
|
|
239
|
+
if (legacyPage && (!legacyPage[1] || isLocale(legacyPage[1]))) {
|
|
240
|
+
const path = await legacyPagePath(legacyPage[2], queryClient);
|
|
241
|
+
return path ? { path, locale: legacyPage[1] } : undefined;
|
|
242
|
+
}
|
|
199
243
|
const shortLink = parseShortLinkPath(pathname);
|
|
200
244
|
if (!shortLink) return undefined;
|
|
201
245
|
const id = await shortLinkProductId(shortLink.code, queryClient);
|
|
@@ -203,8 +247,9 @@ async function twigTarget(
|
|
|
203
247
|
}
|
|
204
248
|
|
|
205
249
|
/**
|
|
206
|
-
* Twig's product and
|
|
207
|
-
* them now: `/p{id}`, `/p{id}-{name}`, `/category/{hash}
|
|
250
|
+
* Twig's product, category and page URLs, each with or without a locale, sent to the page that
|
|
251
|
+
* has them now: `/p{id}`, `/p{id}-{name}`, `/category/{hash}`, the product short link `/{code}` and
|
|
252
|
+
* a page's `/p/{slug}`.
|
|
208
253
|
* Run by the locale layout's `beforeLoad`, only for an address no page answers: the router binds
|
|
209
254
|
* `/ar/p1` to `$slug/p{$id}` (slug `ar`) and `/p1` to the locale.
|
|
210
255
|
*
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export { GTM_LOAD_DELAY_MS, GoogleTagBody } from './chunk-RGKUQJMM.js';
|
|
2
|
-
import './chunk-2XBIMXCM.js';
|
|
3
|
-
import './chunk-KXWDMETN.js';
|
|
4
|
-
import './chunk-OUW6WESU.js';
|
|
5
|
-
import './chunk-2SXDYAGG.js';
|
|
6
|
-
import './chunk-QBVKHDAP.js';
|
|
7
|
-
import './chunk-Z5M4YYWT.js';
|
|
8
|
-
import './chunk-BZ2QSBXM.js';
|
|
9
|
-
import './chunk-MZPX4EPS.js';
|
|
10
|
-
import './chunk-4OZIBANF.js';
|
|
11
|
-
import './chunk-MWUAHDQL.js';
|
|
12
|
-
import './chunk-T72DAX7R.js';
|
|
13
|
-
import './chunk-DGUM43GV.js';
|
|
14
|
-
//# sourceMappingURL=GoogleTag-VMMAYSX6.js.map
|
|
15
|
-
//# sourceMappingURL=GoogleTag-VMMAYSX6.js.map
|
package/dist/chunk-ACOK7N5Y.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { orThrow } from './chunk-FREN7T2I.js';
|
|
2
|
-
import { api } from './chunk-QBVKHDAP.js';
|
|
3
|
-
import { queryOptions } from '@tanstack/react-query';
|
|
4
|
-
|
|
5
|
-
var page = {
|
|
6
|
-
find: async (slug) => {
|
|
7
|
-
const { data } = await api.get(`pages/${slug}`).json();
|
|
8
|
-
return data;
|
|
9
|
-
},
|
|
10
|
-
findOrThrow: (slug) => orThrow(page.find(slug)),
|
|
11
|
-
queries: {
|
|
12
|
-
detail: (slug) => queryOptions({
|
|
13
|
-
queryKey: ["pages", "detail", slug],
|
|
14
|
-
queryFn: () => page.find(slug)
|
|
15
|
-
})
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export { page };
|
|
20
|
-
//# sourceMappingURL=chunk-ACOK7N5Y.js.map
|
|
21
|
-
//# sourceMappingURL=chunk-ACOK7N5Y.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/page.ts"],"names":[],"mappings":";;;;AAKO,IAAM,IAAA,GAAO;AAAA,EAClB,IAAA,EAAM,OAAO,IAAA,KAA2C;AACtD,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,MAAA,EAAS,IAAI,CAAA,CAAE,CAAA,CAAE,IAAA,EAAgC;AAChF,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,aAAa,CAAC,IAAA,KAA2C,QAAQ,IAAA,CAAK,IAAA,CAAK,IAAI,CAAC,CAAA;AAAA,EAEhF,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,CAAC,IAAA,KACP,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,OAAA,EAAS,QAAA,EAAU,IAAI,CAAA;AAAA,MAClC,OAAA,EAAS,MAAM,IAAA,CAAK,IAAA,CAAK,IAAI;AAAA,KAC9B;AAAA;AAEP","file":"chunk-ACOK7N5Y.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { ApiPageResponse } from '../routes/page/types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const page = {\n find: async (slug: string): Promise<ApiPageResponse> => {\n const { data } = await api.get(`pages/${slug}`).json<{ data: ApiPageResponse }>();\n return data;\n },\n\n findOrThrow: (slug: string): Promise<ApiPageResponse> => orThrow(page.find(slug)),\n\n queries: {\n detail: (slug: string) =>\n queryOptions({\n queryKey: ['pages', 'detail', slug],\n queryFn: () => page.find(slug),\n }),\n },\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/routes/home/blockList.ts","../src/routes/home/loader.ts","../src/routes/home/HomePage.tsx","../src/routes/home/index.tsx"],"names":["HomeSkeleton","HomePage"],"mappings":";;;;;;;;;;;;;AAGO,SAAS,UAAU,MAAA,EAA8C;AACtE,EAAA,OAAO,IAAA,CAAK,SAAA,CAAU,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,KAAU,CAAC,KAAA,CAAM,IAAA,EAAM,KAAA,CAAM,GAAA,IAAO,IAAI,CAAC,CAAC,CAAA;AAC9E;;;ACYA,eAAsB,WAAW,GAAA,EAAoD;AACnF,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,kBAAA,EAAmB;AAC3C,EAAA,MAAM,aAAa,MAAM,WAAA,CAAY,gBAAgB,IAAA,CAAK,OAAA,CAAQ,YAAY,CAAA;AAC9E,EAAA,MAAM,MAAA,GAAS,UAAA,CAAW,GAAA,CAAI,CAAC,IAAA,MAAU;AAAA,IACvC,GAAG,IAAA;AAAA,IACH,MAAM,IAAA,CAAK,IAAA,EAAM,QAAQ,OAAA,EAAS,EAAE,KAAK,IAAA,CAAK;AAAA,GAChD,CAAE,CAAA;AACF,EAAA,OAAO;AAAA,IACL,MAAA,EAAQ,KAAK,MAAA,IAAU,IAAA;AAAA,IACvB,UAAA,EAAY,MAAA;AAAA,IACZ,IAAA,EAAM,EAAE,IAAA,EAAM,OAAA,CAAQ,KAAA,EAAM;AAAA,IAC5B,WAAA,EAAa,UAAU,MAAM;AAAA,GAC/B;AACF;ACpBO,IAAM,YAAA,GAAe,IAAA,CAAK,SAASA,aAAAA,GAAe;AACvD,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;A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OAAA,CAAQ,OAAO,MAAA,EAAQ,IAAA,EAAM,WAAW,QAAA","file":"chunk-D2SVAGSH.js","sourcesContent":["import type { HomeComponentData } from '../../types';\n\n/** Paths and keys of `blocks` in order: enough to tell the store's list from one a theme built. */\nexport function blockList(blocks: readonly HomeComponentData[]): string {\n return JSON.stringify(blocks.map((block) => [block.path, block.key ?? null]));\n}\n","import { getTwilightContext } from '../../twilight/context';\nimport { home } from '../../api/home';\nimport type { HomeComponentData } from '../../types';\nimport { RouteId } from '../../router/route-ids';\nimport { blockList } from './blockList';\n\nexport interface HomeLoaderData {\n locale: string;\n components: HomeComponentData[];\n page: { slug: string };\n /**\n * The store's blocks as this loader lists them (`blockList`). A theme whose own loader\n * reshapes `components` keeps this, so the page can tell its list is no longer the store's.\n */\n storeBlocks?: string;\n}\n\nexport async function homeLoader(ctx?: { locale?: string }): Promise<HomeLoaderData> {\n const { queryClient } = getTwilightContext();\n const components = await queryClient.ensureQueryData(home.queries.components());\n const blocks = components.map((comp) => ({\n ...comp,\n path: comp.path?.replace('home.', '') || comp.path,\n }));\n return {\n locale: ctx?.locale || 'ar',\n components: blocks,\n page: { slug: RouteId.INDEX },\n storeBlocks: blockList(blocks),\n };\n}\n","import { memo, useCallback, useMemo, useState } from 'react';\nimport { useDevHomeBlocks, type DevHomeBlock } from '../../dev/dev-settings-store';\nimport { HookSlot } from '../../hooks';\nimport { HomeComponentRenderer, ReorderProducts } from '../../components/home';\nimport { reorder, useLiveBlockList, useLiveBlockMoves } from '../../components/live-editor/moves';\nimport type { HomePageProps } from './types';\nimport { blockList } from './blockList';\nimport type { HomeComponentData } from '../../types';\nimport { Pulse } from '@salla.sa/twilight-components-react';\n\nexport const HomeSkeleton = memo(function HomeSkeleton() {\n return (\n <>\n <div className=\"s-block container skeleton-block-hero\">\n <Pulse className=\"h-64 sm:h-80 rounded-md\" />\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n </>\n );\n});\n\n/** As on Twig, a home page with no blocks lists the store's latest products instead. */\nconst LATEST_PRODUCTS: HomeComponentData = { path: 'latest-products' };\n\n/** The blocks' places in the store's order: 0, 1, 2… */\nconst storeOrder = (blocks: readonly unknown[]) => Array.from(blocks, (_, at) => at);\n\n// Stable, so a redraw of a page loaded without blocks is kept.\nconst NO_BLOCKS: HomeComponentData[] = [];\n\n// Catalog id (or path) plus copy number: a block drawn in or out leaves the others' state alone.\nfunction blockKeys(blocks: ReadonlyArray<DevHomeBlock<HomeComponentData>>): string[] {\n const copies = new Map<string, number>();\n return blocks.map((block) => {\n if (block.__dev_id) return block.__dev_id;\n const name = String(block.key ?? block.path);\n const copy = copies.get(name) ?? 0;\n copies.set(name, copy + 1);\n return `${name}~${copy}`;\n });\n}\n\nexport const HomePage = memo(function HomePage({\n components = NO_BLOCKS,\n storeBlocks,\n}: HomePageProps) {\n // The design studio draws the blocks again after a save, in place of the loaded\n // ones, until the page loads its blocks anew.\n const [drawn, setDrawn] = useState<{\n source: HomeComponentData[];\n blocks: HomeComponentData[];\n } | null>(null);\n const onList = useCallback(\n (blocks: HomeComponentData[]) => setDrawn({ source: components, blocks }),\n [components]\n );\n // A list the theme's own loader built (Tania's home) is not the store's: the studio reloads it instead.\n const storeList = useMemo(\n () => storeBlocks === undefined || storeBlocks === blockList(components),\n [storeBlocks, components]\n );\n useLiveBlockList(storeList ? onList : null);\n const current = drawn?.source === components ? drawn.blocks : components;\n // Dev-mode only: the dev editor's layout replaces the store's blocks while it\n // is on. No-op passthrough in production builds.\n const renderedComponents = useDevHomeBlocks(current);\n // The theme editor's preview moves blocks in place while the editor saves the\n // order; blocks from the server (a new page, a reload) start over from theirs.\n const [moved, setMoved] = useState<{ source: HomeComponentData[]; order: number[] } | null>(null);\n const order = moved?.source === renderedComponents ? moved.order : null;\n const onMove = useCallback(\n (from: number, to: number) =>\n setMoved((prev) => ({\n source: renderedComponents,\n order: reorder(\n prev?.source === renderedComponents ? prev.order : storeOrder(renderedComponents),\n from,\n to\n ),\n })),\n [renderedComponents]\n );\n useLiveBlockMoves(onMove);\n const placed = order ?? storeOrder(renderedComponents);\n const keys = useMemo(() => blockKeys(renderedComponents), [renderedComponents]);\n\n return (\n <>\n <HookSlot name=\"home:start\" />\n <HookSlot name=\"home:content\" />\n {placed.map((at, index) => {\n // A block's key stays with it when the preview moves it, so a move keeps its state.\n return <HomeComponentRenderer key={keys[at]} data={renderedComponents[at]} index={index} />;\n })}\n {!renderedComponents.length && (\n <HomeComponentRenderer data={LATEST_PRODUCTS} index={0} editable={false} />\n )}\n <HookSlot name=\"home:end\" />\n <ReorderProducts />\n </>\n );\n});\n\nexport { HomePage as default };\n","import type { HeadDescriptor } from '../../utils/head';\nimport { buildHreflangAlternates, storePageUrl } from '../../utils/baseHead';\nimport type { HomeLoaderData } from './loader';\nimport { homeLoader } from './loader';\nimport type { TwilightContext } from '../../twilight/context';\nimport { HomePage } from './HomePage';\nimport { RouteId } from '../../router/route-ids';\n\nexport { HomeSkeleton } from './HomePage';\nexport { registerHomeComponents, DefaultHomeComponents } from '../../components/home/register';\nexport { registerHomeComponentConfig } from '../../components/home';\nexport type { HomePageProps } from './types';\nexport type { HomeLoaderData } from './loader';\nexport type {\n HomeComponentsProps,\n AnyHomeComponent,\n HomeComponentConfig,\n} from '../../components/home';\n\nfunction loader(_ctx?: { locale?: string }): Promise<HomeLoaderData> {\n return homeLoader({ locale: _ctx?.locale });\n}\n\nfunction head(ctx: TwilightContext): HeadDescriptor {\n const store = ctx.settings?.store;\n if (!store) return {};\n\n const title = store.meta?.title ?? store.name;\n const description = store.meta?.description ?? store.description;\n const keywords = store.meta?.keywords;\n // `/ar`, like Twig, where store.url reads `/ar/`.\n const url = storePageUrl(ctx.settings, ctx.location.pathname) ?? store.url;\n\n return {\n title,\n description,\n keywords,\n canonical: url,\n openGraph: {\n type: 'website',\n title,\n description,\n images: store.logo,\n url,\n },\n twitter: {\n card: 'summary_large_image',\n title,\n description,\n images: store.logo,\n },\n alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),\n };\n}\n\nexport const Home = { id: RouteId.INDEX, loader, head, Component: HomePage } as const;\n\nexport { homeLoader };\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/routes/seo-redirects.ts"],"names":["id"],"mappings":";;;;;;;;AAwBA,eAAsB,wBAAwB,GAAA,EAAkD;AAC9F,EAAA,MAAM,MAAA,GAAS,IAAI,MAAA,CAAO,MAAA,GAAS,IAAI,GAAA,CAAI,MAAA,CAAO,MAAM,CAAA,CAAA,GAAK,EAAA;AAC7D,EAAA,MAAM,QAAA,CAAS,CAAA,EAAG,MAAM,CAAA,QAAA,EAAW,GAAA,CAAI,MAAA,CAAO,EAAE,CAAA,CAAA,EAAI,EAAE,UAAA,EAAY,GAAA,EAAK,CAAA;AACzE;AAOA,eAAsB,4BACpB,GAAA,GAA+C,EAAE,MAAA,EAAQ,IAAG,EAC5C;AAChB,EAAA,MAAM,MAAA,GAAS,GAAA,CAAI,MAAA,CAAO,MAAA,IAAU,eAAA;AACpC,EAAA,MAAM,QAAA,CAAS,CAAA,CAAA,EAAI,MAAM,CAAA,8BAAA,CAAgC,CAAA;AAC3D;AAGA,eAAsB,qBACpB,GAAA,GAA+C,EAAE,MAAA,EAAQ,IAAG,EAC5C;AAChB,EAAA,MAAM,MAAA,GAAS,GAAA,CAAI,MAAA,CAAO,MAAA,IAAU,eAAA;AACpC,EAAA,MAAM,QAAA,CAAS,CAAA,CAAA,EAAI,MAAM,CAAA,eAAA,CA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AAA,CAAY,QAAQ,CAAA,EAAG;AACnD,EAAA,MAAM,EAAE,iBAAA,EAAkB,GAAI,MAAM,OAAO,2BAAe,CAAA;AAC1D,EAAA,MAAM,iBAAA,CAAkB,UAAU,MAAA,EAAQ;AAAA,IACxC,aAAa,OAAA,CAAQ,WAAA;AAAA,IACrB,cAAc,OAAA,CAAQ;AAAA,GACvB,CAAA;AACH;AAUO,SAAS,cAAA,GAAuB;AACrC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,oBAAA,EAAqB;AAErB,IAAA,MAAA,CAAO,QAAA,CAAS,QAAQ,MAAA,CAAO,QAAA,CAAS,KAAK,OAAA,CAAQ,8BAAA,EAAgC,EAAE,CAAC,CAAA;AAAA,EAC1F,CAAA,EAAG,EAAE,CAAA;AACL,EAAA,OAAO,IAAA;AACT","file":"chunk-UOS4ZNQ2.js","sourcesContent":["import { useEffect } from 'react';\nimport type { QueryClient } from '@tanstack/react-query';\nimport { isMissingResource, redirect } from '../providers/NavigationProvider';\nimport { FALLBACK_LOCALE, isLocale } from '../providers/locale-constants';\nimport { productKeyOfId } from '../router/product-key-urls';\nimport { CATEGORY_SLUG_ROUTE_ID, PRODUCT_SLUG_ROUTE_ID } from '../router/slug-routes';\nimport { clearAuthTokenCookie } from '../utils/cookies';\nimport { parseShortLinkPath } from './short-link-path';\n\nexport interface SlugBrandParams {\n /** SEO slug segment (ignored — only here to match the route pattern). */\n slug: string;\n /** Brand numeric ID to redirect to. */\n id: string;\n /** Active locale from the `/$locale` parent layout (e.g. `'ar'`, `'en'`). */\n locale?: string;\n}\n\n/**\n * Twig's brand address, `/{slug}/brand-{id}`, the one its pages link and search engines indexed,\n * moved for good to the engine's `/brands/{id}`: a 301, so the brand page keeps its ranking at the\n * new address (a 307 keeps the old one indexed). No locale in the URL stays without one: the\n * locale layout adds it only where the store has several, so a single-language store is one hop.\n */\nexport async function slugBrandRedirectLoader(ctx: { params: SlugBrandParams }): Promise<never> {\n const prefix = ctx.params.locale ? `/${ctx.params.locale}` : '';\n throw redirect(`${prefix}/brands/${ctx.params.id}`, { statusCode: 301 });\n}\n\nexport interface PendingOrdersRedirectParams {\n /** Active locale from the `/$locale` parent layout (e.g. `'ar'`, `'en'`). */\n locale?: string;\n}\n\nexport async function pendingOrdersRedirectLoader(\n ctx: { params: PendingOrdersRedirectParams } = { params: {} }\n): Promise<never> {\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n throw redirect(`/${locale}/account/orders?status=pending`);\n}\n\n/** `/account/rating`: the loyalty \"rate your orders\" link. Twig Raed has no rating page and sends it to the orders list. */\nexport async function ratingRedirectLoader(\n ctx: { params: PendingOrdersRedirectParams } = { params: {} }\n): Promise<never> {\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n throw redirect(`/${locale}/account/orders`);\n}\n\n/**\n * `/rating/{id}` and `/account/rating/{id}`: the rate-your-order link in the order email and SMS,\n * sent like Twig to the order with its rating popup. The id goes as it came: the orders API\n * decodes it the way Store's `rateOrder` does (optimus when numeric, else the hash).\n */\nexport async function orderRatingRedirectLoader(ctx: {\n params: PendingOrdersRedirectParams & { id: string };\n /** The incoming query string, `token` included: the SDK signs the visitor in with it. */\n search?: string;\n}): Promise<never> {\n const prefix = ctx.params.locale ? `/${ctx.params.locale}` : '';\n const query = new URLSearchParams(ctx.search);\n query.set('show-rating-popup', 'true');\n throw redirect(`${prefix}/account/orders/${encodeURIComponent(ctx.params.id)}?${query}`);\n}\n\n/** A Twig customer URL (`/profile`, `/orders`, …) kept working as its `/account/…` page. */\nexport async function accountRedirectLoader(ctx: {\n params: PendingOrdersRedirectParams;\n page: string;\n /** The incoming query string (`?status=pending`), kept on the account page. */\n search?: string;\n}): Promise<never> {\n // No locale in the URL stays without one: the locale layout adds it only where the store has several.\n const prefix = ctx.params.locale ? `/${ctx.params.locale}` : '';\n throw redirect(`${prefix}/account/${ctx.page}${ctx.search ?? ''}`, { statusCode: 301 });\n}\n\n/** `/latest-products`, `/most-sales-products` and `/offers` now live at `/products?source=`. */\nexport async function productsSourceRedirectLoader(ctx: {\n params: PendingOrdersRedirectParams;\n source: 'latest' | 'sales' | 'offers';\n search?: string;\n}): Promise<never> {\n const prefix = ctx.params.locale ? `/${ctx.params.locale}` : '';\n const query = new URLSearchParams(ctx.search);\n query.delete('source');\n const rest = query.toString();\n throw redirect(`${prefix}/products?source=${ctx.source}${rest ? `&${rest}` : ''}`, {\n statusCode: 301,\n });\n}\n\nexport { resolveProductKeyPage } from './product/key';\nexport { publicProductKeyPath } from '../router/product-key-urls';\n\n/** Routes a Twig URL lands on by accident: a locale bound as `$slug`, or an id that is no number. */\nconst SLUG_ROUTES = new Set([PRODUCT_SLUG_ROUTE_ID, CATEGORY_SLUG_ROUTE_ID]);\n\n/** `/p{id}` or `/p{id}-{name}`, with or without a leading segment; the id capped as in `./product/id`. */\nconst TWIG_PRODUCT_URL = /^(?:\\/([^/]+))?\\/p(\\d{1,18})(?:-[^/]*)?\\/?$/;\n/** `/category/{hash}`, with or without a leading segment. */\nconst TWIG_CATEGORY_URL = /^(?:\\/([^/]+))?\\/category\\/([A-Za-z0-9]+)\\/?$/;\n\n/** The page the router matched, as the locale layout's `beforeLoad` sees it. */\nexport interface MatchedPage {\n routeId: string;\n params: Record<string, string | undefined>;\n}\n\nfunction rendersNoPage({ routeId, params }: MatchedPage): boolean {\n // A first segment that is no language binds as the locale, of the layout or of the home page.\n if (routeId === '/{-$locale}' || (params.locale && !isLocale(params.locale))) return true;\n if (!SLUG_ROUTES.has(routeId)) return false;\n // A SKU-link address the router's rewrite gave the product route (`router/product-key-urls`).\n if (productKeyOfId(params.id)) return false;\n return (!params.locale && isLocale(params.slug)) || !/^\\d+$/.test(params.id ?? '');\n}\n\nexport interface TwigUrlRedirectOptions {\n /**\n * The language segment the target takes, given the one the address had. The locale layout\n * knows how the store addresses its pages, so the redirect lands there in one hop: `/-/p1`\n * on a store with several languages was sent on again to `/ar/-/p1`, and that second request\n * also fetched the product, because the server starts every loader at once. Without it the\n * address's own segment is kept.\n */\n targetLocale?: (addressLocale: string | undefined) => Promise<string | undefined>;\n /**\n * The request's query client. The category lookup is then shared between a hover preload and\n * the click.\n */\n queryClient?: QueryClient;\n}\n\n/** The category's numeric id for its Twig hash, or `undefined` when the API has no such category. */\nasync function categoryIdOf(hash: string, queryClient?: QueryClient): Promise<string | undefined> {\n const { category } = await import('../api/category');\n try {\n const found = queryClient\n ? await queryClient.ensureQueryData(category.queries.detail(hash))\n : await category.find(hash);\n // Only the id is taken. The category is never filed under its id for the category page:\n // this lookup ran in the address's language (Arabic when it has none, the fallback), and\n // the page may be in another (`/en/-/c…` on an English-only store), while a category's\n // cache key carries no language.\n return String(found.id_ ?? found.id);\n } catch (error) {\n if (isMissingResource(error)) return undefined;\n throw error;\n }\n}\n\n/**\n * The product id behind a short link (`/KjQrpE`). A store without SEO URLs gives every product\n * that address, in its sitemap and in the API's `url`, and the API takes the code in place of\n * the id. Any failure counts as \"no such product\": a bare `/{code}` is also every scanner's\n * `/admin`, so an API error must not turn those into 500s. The not-found page's\n * `useProductShortLink` asks again from the browser, as it did before.\n */\nasync function shortLinkProductId(\n code: string,\n queryClient?: QueryClient\n): Promise<string | undefined> {\n const { product } = await import('../api/product');\n try {\n const found = queryClient\n ? await queryClient.ensureQueryData(product.queries.detail(code))\n : await product.find(code);\n return found?.id ? String(found.id) : undefined;\n } catch {\n return undefined;\n }\n}\n\n/** Where a Twig URL's page is now, and the language its address carried. */\n/**\n * A Twig product or category URL: `/p{id}…` or `/category/{hash}`, bare or under a language. Under\n * any other first segment it is no Twig route, so the Store's catch-all would have it.\n */\nfunction twigPageUrl(\n pathname: string\n): { kind: 'p' | 'c'; ref: string; locale?: string } | undefined {\n const productUrl = TWIG_PRODUCT_URL.exec(pathname);\n const match = productUrl ?? TWIG_CATEGORY_URL.exec(pathname);\n if (!match || (match[1] && !isLocale(match[1]))) return undefined;\n return { kind: productUrl ? 'p' : 'c', ref: match[2], locale: match[1] };\n}\n\nasync function twigTarget(\n pathname: string,\n queryClient?: QueryClient\n): Promise<{ path: string; locale?: string } | undefined> {\n const pageUrl = twigPageUrl(pathname);\n if (pageUrl) {\n if (pageUrl.kind === 'p') return { path: `/-/p${pageUrl.ref}`, locale: pageUrl.locale };\n const id = await categoryIdOf(pageUrl.ref, queryClient);\n return id ? { path: `/-/c${id}`, locale: pageUrl.locale } : undefined;\n }\n const shortLink = parseShortLinkPath(pathname);\n if (!shortLink) return undefined;\n const id = await shortLinkProductId(shortLink.code, queryClient);\n return id ? { path: `/-/p${id}`, locale: shortLink.locale } : undefined;\n}\n\n/**\n * Twig's product and category URLs, each with or without a locale, sent to the page that has\n * them now: `/p{id}`, `/p{id}-{name}`, `/category/{hash}` and the product short link `/{code}`.\n * Run by the locale layout's `beforeLoad`, only for an address no page answers: the router binds\n * `/ar/p1` to `$slug/p{$id}` (slug `ar`) and `/p1` to the locale.\n *\n * A product URL carries its id, so it is redirected without asking the API: a product that is\n * gone is the product page's not-found, one hop on. A category hash or a short code only the API\n * can turn into the id; one that is gone stays the not-found page at its address.\n *\n * Any other address no page answers, a short code that names no product included, may be one of\n * the merchant's custom URLs, which Twig's catch-all answers last (`./custom-urls`). A gone\n * category's Twig URL is not: Twig's category route answers it.\n */\nexport async function twigUrlRedirect(\n pathname: string,\n search: string,\n page: MatchedPage | undefined,\n options: TwigUrlRedirectOptions = {}\n): Promise<void> {\n if (!page || !rendersNoPage(page)) return;\n const target = await twigTarget(pathname, options.queryClient);\n if (target) {\n const locale = options.targetLocale ? await options.targetLocale(target.locale) : target.locale;\n throw redirect(`${locale ? `/${locale}` : ''}${target.path}${search}`, { statusCode: 301 });\n }\n if (!options.queryClient || twigPageUrl(pathname)) return;\n const { customUrlRedirect } = await import('./custom-urls');\n await customUrlRedirect(pathname, search, {\n queryClient: options.queryClient,\n targetLocale: options.targetLocale,\n });\n}\n\n/**\n * `/logout` — where the SDK sends the browser once `salla.auth.logout()` has run\n * (`salla.url.get('logout?from=…')`). The Twig storefront serves that URL server-side. Here\n * it renders nothing and, in the browser, removes the theme's own `token` cookie (the SDK's\n * `cookie.clearAll()` leaves it) and then does a full navigation home. It has to be a\n * component, not a loader redirect: a loader runs during server rendering, where the cookie\n * can't be cleared, so the redirect would leave the visitor signed in on the next request.\n */\nexport function LogoutRedirect(): null {\n useEffect(() => {\n clearAuthTokenCookie();\n // `/{store base}/{locale}/logout?from=…` → `/{store base}/{locale}`\n window.location.replace(window.location.href.replace(/\\/logout\\/?(\\?[^#]*)?(#.*)?$/, ''));\n }, []);\n return null;\n}\n"]}
|