@salla.sa/twilight-theme-engine 1.0.163 → 1.0.165
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-2D4D2T2X.js → AddToCartForm-ESAWD6IC.js} +3 -3
- package/dist/{AddToCartForm-2D4D2T2X.js.map → AddToCartForm-ESAWD6IC.js.map} +1 -1
- package/dist/{BlogAuthorPage-ELZPCZEE.js → BlogAuthorPage-RKNI5PUS.js} +22 -21
- package/dist/BlogAuthorPage-RKNI5PUS.js.map +1 -0
- package/dist/{BlogCategoryPage-MADVXTFU.js → BlogCategoryPage-4C5JG7Y2.js} +22 -21
- package/dist/BlogCategoryPage-4C5JG7Y2.js.map +1 -0
- package/dist/{BlogPage-DTHRWEHK.js → BlogPage-3H2VKXRX.js} +20 -19
- package/dist/BlogPage-3H2VKXRX.js.map +1 -0
- package/dist/{BlogSinglePage-BSHIPWOR.js → BlogSinglePage-HVL7XO44.js} +20 -19
- package/dist/BlogSinglePage-HVL7XO44.js.map +1 -0
- package/dist/{BlogTagPage-YIGA3QZQ.js → BlogTagPage-E4GL3Y2Z.js} +22 -21
- package/dist/BlogTagPage-E4GL3Y2Z.js.map +1 -0
- package/dist/{BrandsPage-AD7RKXIC.js → BrandsPage-7SIOO7DY.js} +21 -20
- package/dist/BrandsPage-7SIOO7DY.js.map +1 -0
- package/dist/{Breadcrumb-O7YJIL52.js → Breadcrumb-6PDDM5IR.js} +20 -19
- package/dist/Breadcrumb-6PDDM5IR.js.map +1 -0
- package/dist/{CartItem-7A45S2WC.js → CartItem-FTM67QSA.js} +20 -19
- package/dist/CartItem-FTM67QSA.js.map +1 -0
- package/dist/{CartSummary-V6VP6MI5.js → CartSummary-EFSCR4FH.js} +20 -19
- package/dist/CartSummary-EFSCR4FH.js.map +1 -0
- package/dist/{Copyright-M2TKSKKL.js → Copyright-GTGQP5BH.js} +3 -3
- package/dist/{Copyright-M2TKSKKL.js.map → Copyright-GTGQP5BH.js.map} +1 -1
- package/dist/{CustomerLayout-LTP5EG72.js → CustomerLayout-7P2FF5XX.js} +20 -19
- package/dist/CustomerLayout-7P2FF5XX.js.map +1 -0
- package/dist/{Footer-PZVBBZKT.js → Footer-WECSE4NU.js} +4 -4
- package/dist/{Footer-PZVBBZKT.js.map → Footer-WECSE4NU.js.map} +1 -1
- package/dist/GoogleTag-PBB7MERI.js +15 -0
- package/dist/{GoogleTag-NHGB476C.js.map → GoogleTag-PBB7MERI.js.map} +1 -1
- package/dist/{Header-MOLMVHTO.js → Header-TOS5H6CE.js} +8 -8
- package/dist/{Header-MOLMVHTO.js.map → Header-TOS5H6CE.js.map} +1 -1
- package/dist/{LatestProducts-HZOHWLLU.js → LatestProducts-SYGFJ7UK.js} +22 -21
- package/dist/LatestProducts-SYGFJ7UK.js.map +1 -0
- package/dist/{LoyaltyPage-VKVING2R.js → LoyaltyPage-MLYZ332A.js} +20 -19
- package/dist/LoyaltyPage-MLYZ332A.js.map +1 -0
- package/dist/{LoyaltyPointsPage-RIIJOEAF.js → LoyaltyPointsPage-MK4IVAOD.js} +6 -6
- package/dist/{LoyaltyPointsPage-RIIJOEAF.js.map → LoyaltyPointsPage-MK4IVAOD.js.map} +1 -1
- package/dist/{MainMenu-LLVGN66B.js → MainMenu-JMF4GDY3.js} +5 -5
- package/dist/{MainMenu-LLVGN66B.js.map → MainMenu-JMF4GDY3.js.map} +1 -1
- package/dist/{MasterLayout-CLYJYYNP.js → MasterLayout-JO2RAGBY.js} +20 -19
- package/dist/{MasterLayout-CLYJYYNP.js.map → MasterLayout-JO2RAGBY.js.map} +1 -1
- package/dist/{MobileMenu-KNQHAIAW.js → MobileMenu-IY3XJF3K.js} +21 -20
- package/dist/MobileMenu-IY3XJF3K.js.map +1 -0
- package/dist/{NotificationsPage-W34PE52P.js → NotificationsPage-QWW47QMM.js} +20 -19
- package/dist/NotificationsPage-QWW47QMM.js.map +1 -0
- package/dist/{OrderSinglePage-P7WAQSPT.js → OrderSinglePage-JPZ43P3N.js} +21 -20
- package/dist/OrderSinglePage-JPZ43P3N.js.map +1 -0
- package/dist/{OrdersPage-U3OVVRCX.js → OrdersPage-QTXRO4XE.js} +20 -19
- package/dist/OrdersPage-QTXRO4XE.js.map +1 -0
- package/dist/{PageSingle-B2W5CDJT.js → PageSingle-YMUHXNV7.js} +3 -3
- package/dist/{PageSingle-B2W5CDJT.js.map → PageSingle-YMUHXNV7.js.map} +1 -1
- package/dist/{ProductDetails-2NQ73OJT.js → ProductDetails-IZOC7OMU.js} +4 -4
- package/dist/{ProductDetails-2NQ73OJT.js.map → ProductDetails-IZOC7OMU.js.map} +1 -1
- package/dist/{ProfilePage-3EMQAHEY.js → ProfilePage-2QGAJ7ZC.js} +20 -19
- package/dist/ProfilePage-2QGAJ7ZC.js.map +1 -0
- package/dist/{ReviewsPage-2HXSG6XJ.js → ReviewsPage-KFQ2RCZR.js} +3 -3
- package/dist/{ReviewsPage-2HXSG6XJ.js.map → ReviewsPage-KFQ2RCZR.js.map} +1 -1
- package/dist/{SeoCartWidget-QJA2XBV4.js → SeoCartWidget-HWAQQ72P.js} +20 -19
- package/dist/SeoCartWidget-HWAQQ72P.js.map +1 -0
- package/dist/{SettingsPage-QYHW6SJ2.js → SettingsPage-SGLOXRRZ.js} +20 -19
- package/dist/SettingsPage-SGLOXRRZ.js.map +1 -0
- package/dist/{StoreClosedNotification-LXZDHOY6.js → StoreClosedNotification-JZPC2QBU.js} +21 -20
- package/dist/{StoreClosedNotification-LXZDHOY6.js.map → StoreClosedNotification-JZPC2QBU.js.map} +1 -1
- package/dist/{TestimonialsPage-KGOSTMJM.js → TestimonialsPage-3Y7V6W43.js} +3 -3
- package/dist/{TestimonialsPage-KGOSTMJM.js.map → TestimonialsPage-3Y7V6W43.js.map} +1 -1
- package/dist/{ThankYouPage-5G7P3ADY.js → ThankYouPage-BKHJESFN.js} +20 -19
- package/dist/ThankYouPage-BKHJESFN.js.map +1 -0
- package/dist/{WalletPage-QAQHKFKN.js → WalletPage-I4R55BP6.js} +21 -20
- package/dist/WalletPage-I4R55BP6.js.map +1 -0
- package/dist/{WebMcpTools-RSOWCODK.js → WebMcpTools-RLOEVV2L.js} +7 -6
- package/dist/WebMcpTools-RLOEVV2L.js.map +1 -0
- package/dist/{WishlistPage-5XE5K3I4.js → WishlistPage-JPJ743TH.js} +22 -21
- package/dist/WishlistPage-JPJ743TH.js.map +1 -0
- 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.d.ts +24 -0
- package/dist/api/custom-url.d.ts.map +1 -0
- package/dist/api/custom-url.js +10 -0
- package/dist/api/custom-url.js.map +1 -0
- 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.js +3 -3
- package/dist/api/product.d.ts +14 -0
- package/dist/api/product.d.ts.map +1 -1
- 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-HMPQ5N64.js → chunk-2HOV53SL.js} +3 -3
- package/dist/{chunk-HMPQ5N64.js.map → chunk-2HOV53SL.js.map} +1 -1
- package/dist/{chunk-DK5DLORE.js → chunk-2LWHWWKQ.js} +4 -4
- package/dist/{chunk-DK5DLORE.js.map → chunk-2LWHWWKQ.js.map} +1 -1
- package/dist/{chunk-BHR52LEQ.js → chunk-3XKKY65J.js} +4 -4
- package/dist/{chunk-BHR52LEQ.js.map → chunk-3XKKY65J.js.map} +1 -1
- package/dist/{chunk-MPALYAMD.js → chunk-4UIPA7XU.js} +7 -7
- package/dist/{chunk-MPALYAMD.js.map → chunk-4UIPA7XU.js.map} +1 -1
- package/dist/{chunk-E4WYJJK3.js → chunk-5NOM2BWY.js} +3 -3
- package/dist/{chunk-E4WYJJK3.js.map → chunk-5NOM2BWY.js.map} +1 -1
- package/dist/{chunk-GFSUCSGC.js → chunk-6G3F4IBR.js} +3 -3
- package/dist/{chunk-GFSUCSGC.js.map → chunk-6G3F4IBR.js.map} +1 -1
- package/dist/{chunk-WAKEXNJP.js → chunk-6SHKQ6VB.js} +5 -5
- package/dist/{chunk-WAKEXNJP.js.map → chunk-6SHKQ6VB.js.map} +1 -1
- package/dist/{chunk-VIG3BEHV.js → chunk-6ZZMQ2J7.js} +6 -6
- package/dist/{chunk-VIG3BEHV.js.map → chunk-6ZZMQ2J7.js.map} +1 -1
- package/dist/{chunk-27UGZZKX.js → chunk-AAXJHVMA.js} +20 -15
- package/dist/chunk-AAXJHVMA.js.map +1 -0
- package/dist/{chunk-4YYHNNY6.js → chunk-B6RR3L4M.js} +3 -3
- package/dist/{chunk-4YYHNNY6.js.map → chunk-B6RR3L4M.js.map} +1 -1
- package/dist/{chunk-UJSP7BLE.js → chunk-BSTMWSRC.js} +25 -6
- package/dist/chunk-BSTMWSRC.js.map +1 -0
- package/dist/chunk-BYZFJB5F.js +46 -0
- package/dist/chunk-BYZFJB5F.js.map +1 -0
- package/dist/{chunk-5PZKQTNW.js → chunk-CK23F3G3.js} +25 -12
- package/dist/chunk-CK23F3G3.js.map +1 -0
- package/dist/{chunk-7OBFLUYV.js → chunk-DJCEAHHJ.js} +7 -7
- package/dist/{chunk-7OBFLUYV.js.map → chunk-DJCEAHHJ.js.map} +1 -1
- package/dist/chunk-DYLBU3ER.js +24 -0
- package/dist/chunk-DYLBU3ER.js.map +1 -0
- package/dist/{chunk-OYMPXPKB.js → chunk-E4HHNJT7.js} +3 -3
- package/dist/{chunk-OYMPXPKB.js.map → chunk-E4HHNJT7.js.map} +1 -1
- package/dist/{chunk-ZFUR5ZF6.js → chunk-FC2TX544.js} +4 -4
- package/dist/{chunk-ZFUR5ZF6.js.map → chunk-FC2TX544.js.map} +1 -1
- package/dist/{chunk-5CR46BDT.js → chunk-GC2QITUG.js} +3 -3
- package/dist/{chunk-5CR46BDT.js.map → chunk-GC2QITUG.js.map} +1 -1
- package/dist/{chunk-WEXPMJKG.js → chunk-HCDDVZ64.js} +4 -4
- package/dist/{chunk-WEXPMJKG.js.map → chunk-HCDDVZ64.js.map} +1 -1
- package/dist/chunk-HI3AQLKS.js +91 -0
- package/dist/chunk-HI3AQLKS.js.map +1 -0
- package/dist/{chunk-S5BATCEM.js → chunk-HJWJ4XMQ.js} +4 -4
- package/dist/{chunk-S5BATCEM.js.map → chunk-HJWJ4XMQ.js.map} +1 -1
- package/dist/{chunk-SSMWXIAE.js → chunk-HLZRPN4K.js} +4 -4
- package/dist/{chunk-SSMWXIAE.js.map → chunk-HLZRPN4K.js.map} +1 -1
- package/dist/{chunk-YWTGGTKK.js → chunk-HM3NZ3PK.js} +3 -3
- package/dist/{chunk-YWTGGTKK.js.map → chunk-HM3NZ3PK.js.map} +1 -1
- package/dist/{chunk-OL7X4VAI.js → chunk-IXUYCRYA.js} +15 -4
- package/dist/chunk-IXUYCRYA.js.map +1 -0
- package/dist/{chunk-MNYVJQAA.js → chunk-J5HHXQQO.js} +3 -3
- package/dist/{chunk-MNYVJQAA.js.map → chunk-J5HHXQQO.js.map} +1 -1
- package/dist/{chunk-ZGE4LQ7M.js → chunk-J62HGQ5E.js} +4 -4
- package/dist/{chunk-ZGE4LQ7M.js.map → chunk-J62HGQ5E.js.map} +1 -1
- package/dist/{chunk-SRP7XERU.js → chunk-KQXF6MCM.js} +4 -4
- package/dist/{chunk-SRP7XERU.js.map → chunk-KQXF6MCM.js.map} +1 -1
- package/dist/{chunk-5IL2OKTU.js → chunk-KWD4W7E3.js} +4 -4
- package/dist/{chunk-5IL2OKTU.js.map → chunk-KWD4W7E3.js.map} +1 -1
- package/dist/{chunk-UJZJB4VI.js → chunk-LBSFM7OG.js} +3 -3
- package/dist/{chunk-UJZJB4VI.js.map → chunk-LBSFM7OG.js.map} +1 -1
- package/dist/{chunk-HB77OKRF.js → chunk-MB7EKG6E.js} +17 -17
- package/dist/{chunk-HB77OKRF.js.map → chunk-MB7EKG6E.js.map} +1 -1
- package/dist/{chunk-ZWAPKTVU.js → chunk-MYTVAZHL.js} +3 -3
- package/dist/{chunk-ZWAPKTVU.js.map → chunk-MYTVAZHL.js.map} +1 -1
- package/dist/{chunk-N7PHXYAU.js → chunk-NDJUGQ62.js} +4 -4
- package/dist/{chunk-N7PHXYAU.js.map → chunk-NDJUGQ62.js.map} +1 -1
- package/dist/{chunk-NHEXCD4P.js → chunk-NLDPRPNY.js} +3 -3
- package/dist/{chunk-NHEXCD4P.js.map → chunk-NLDPRPNY.js.map} +1 -1
- package/dist/{chunk-STS64QGN.js → chunk-OMVKE2IU.js} +3 -3
- package/dist/{chunk-STS64QGN.js.map → chunk-OMVKE2IU.js.map} +1 -1
- package/dist/{chunk-KCZO4S63.js → chunk-PAM6ZF22.js} +4 -4
- package/dist/{chunk-KCZO4S63.js.map → chunk-PAM6ZF22.js.map} +1 -1
- package/dist/{chunk-47MZ7YMM.js → chunk-PVPMYCPU.js} +7 -7
- package/dist/{chunk-47MZ7YMM.js.map → chunk-PVPMYCPU.js.map} +1 -1
- package/dist/{chunk-Q46OTWR7.js → chunk-QFE7DOFQ.js} +3 -3
- package/dist/{chunk-Q46OTWR7.js.map → chunk-QFE7DOFQ.js.map} +1 -1
- package/dist/{chunk-MILS2KDT.js → chunk-QXXVZPGL.js} +3 -3
- package/dist/{chunk-MILS2KDT.js.map → chunk-QXXVZPGL.js.map} +1 -1
- package/dist/{chunk-ERKRUX2N.js → chunk-RD5CGB7H.js} +8 -8
- package/dist/{chunk-ERKRUX2N.js.map → chunk-RD5CGB7H.js.map} +1 -1
- package/dist/{chunk-GKXIKFQW.js → chunk-RIYYFWM4.js} +21 -4
- package/dist/chunk-RIYYFWM4.js.map +1 -0
- package/dist/{chunk-HOGOSY2M.js → chunk-RL7ALP55.js} +3 -3
- package/dist/{chunk-HOGOSY2M.js.map → chunk-RL7ALP55.js.map} +1 -1
- package/dist/{chunk-KFRCD433.js → chunk-RLQHUVWX.js} +5 -5
- package/dist/{chunk-KFRCD433.js.map → chunk-RLQHUVWX.js.map} +1 -1
- package/dist/{chunk-3IHHGY2E.js → chunk-RSWKANF4.js} +4 -4
- package/dist/{chunk-3IHHGY2E.js.map → chunk-RSWKANF4.js.map} +1 -1
- package/dist/{chunk-W6UHE6PI.js → chunk-SA3JGJHU.js} +4 -4
- package/dist/{chunk-W6UHE6PI.js.map → chunk-SA3JGJHU.js.map} +1 -1
- package/dist/chunk-SDBR4X3K.js +96 -0
- package/dist/chunk-SDBR4X3K.js.map +1 -0
- package/dist/{chunk-EPG3VR6C.js → chunk-SMOZVMEW.js} +4 -4
- package/dist/{chunk-EPG3VR6C.js.map → chunk-SMOZVMEW.js.map} +1 -1
- package/dist/{chunk-RUQBOPKU.js → chunk-TCX62D5V.js} +4 -4
- package/dist/{chunk-RUQBOPKU.js.map → chunk-TCX62D5V.js.map} +1 -1
- package/dist/{chunk-XHA3C2YL.js → chunk-TSVYNRSM.js} +3 -3
- package/dist/{chunk-XHA3C2YL.js.map → chunk-TSVYNRSM.js.map} +1 -1
- package/dist/{chunk-RAZFUKHV.js → chunk-VKHI7FGT.js} +3 -3
- package/dist/{chunk-RAZFUKHV.js.map → chunk-VKHI7FGT.js.map} +1 -1
- package/dist/{chunk-U5WM4OJY.js → chunk-ZCRSCOJF.js} +3 -3
- package/dist/{chunk-U5WM4OJY.js.map → chunk-ZCRSCOJF.js.map} +1 -1
- package/dist/{chunk-NO2MV4Y5.js → chunk-ZXQPSVNT.js} +3 -3
- package/dist/chunk-ZXQPSVNT.js.map +1 -0
- package/dist/components/cart/index.js +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/drawer/index.js +18 -17
- package/dist/components/home/index.js +23 -22
- package/dist/components/layout/index.js +4 -4
- package/dist/components/product/index.js +20 -19
- package/dist/components/store/index.js +19 -18
- package/dist/components/tracking/index.js +7 -7
- package/dist/custom-urls-W6URP2BL.js +17 -0
- package/dist/custom-urls-W6URP2BL.js.map +1 -0
- package/dist/dev/editor/index.js +1 -1
- package/dist/dev/index.js +1 -1
- package/dist/document-class-55FY3P3P.js +38 -0
- package/dist/{document-class-DMHQXNQW.js.map → document-class-55FY3P3P.js.map} +1 -1
- package/dist/hooks/index.js +18 -17
- package/dist/hooks/useGtm.js +18 -17
- package/dist/hooks/useMoney.js +18 -17
- package/dist/hooks/useStore.js +18 -17
- package/dist/hooks/useUser.js +3 -3
- package/dist/index.js +18 -17
- package/dist/index.js.map +1 -1
- package/dist/{navigation-SKUYNVCF.js → navigation-4LOHWQGM.js} +5 -5
- package/dist/{navigation-SKUYNVCF.js.map → navigation-4LOHWQGM.js.map} +1 -1
- package/dist/{navigation-M2JX4PVG.js → navigation-T7FYXSFZ.js} +4 -4
- package/dist/{navigation-M2JX4PVG.js.map → navigation-T7FYXSFZ.js.map} +1 -1
- package/dist/{not-found-CYFSHYKS.js → not-found-TRTXZNY7.js} +26 -52
- package/dist/not-found-TRTXZNY7.js.map +1 -0
- package/dist/providers/NavigationProvider.d.ts +5 -0
- package/dist/providers/NavigationProvider.d.ts.map +1 -1
- package/dist/providers/index.js +18 -17
- package/dist/router/product-key-urls.d.ts +56 -0
- package/dist/router/product-key-urls.d.ts.map +1 -0
- package/dist/routes/account/orders.js +6 -5
- package/dist/routes/account.js +15 -14
- package/dist/routes/account.js.map +1 -1
- package/dist/routes/blog.js +10 -9
- package/dist/routes/blog.js.map +1 -1
- package/dist/routes/brands.js +6 -5
- package/dist/routes/brands.js.map +1 -1
- package/dist/routes/cart.js +27 -26
- package/dist/routes/cart.js.map +1 -1
- package/dist/routes/custom-urls.d.ts +57 -0
- package/dist/routes/custom-urls.d.ts.map +1 -0
- package/dist/routes/home.js +24 -23
- package/dist/routes/index.js +10 -3
- package/dist/routes/loyalty.js +7 -6
- package/dist/routes/loyalty.js.map +1 -1
- package/dist/routes/page.js +6 -5
- package/dist/routes/page.js.map +1 -1
- package/dist/routes/product/index.d.ts.map +1 -1
- package/dist/routes/product/key.d.ts +39 -0
- package/dist/routes/product/key.d.ts.map +1 -0
- package/dist/routes/product/loader.d.ts +2 -1
- package/dist/routes/product/loader.d.ts.map +1 -1
- package/dist/routes/product-listing.js +28 -27
- package/dist/routes/product-listing.js.map +1 -1
- package/dist/routes/product-short-link.d.ts +7 -9
- package/dist/routes/product-short-link.d.ts.map +1 -1
- package/dist/routes/product.js +46 -33
- package/dist/routes/product.js.map +1 -1
- package/dist/routes/seo-redirects.d.ts +6 -0
- package/dist/routes/seo-redirects.d.ts.map +1 -1
- package/dist/routes/seo-redirects.js +10 -3
- package/dist/routes/testimonials.js +4 -3
- package/dist/routes/testimonials.js.map +1 -1
- package/dist/routes/thank-you.js +6 -5
- package/dist/routes/thank-you.js.map +1 -1
- package/dist/server/entry.d.ts +6 -0
- package/dist/server/entry.d.ts.map +1 -0
- package/dist/server/entry.js +131 -0
- package/dist/server/entry.js.map +1 -0
- package/dist/server/stream-handler.d.ts +53 -0
- package/dist/server/stream-handler.d.ts.map +1 -0
- package/dist/skeleton.js +24 -23
- package/dist/{store-lookup-H3RGYEXU.js → store-lookup-PPLGSTZ6.js} +8 -8
- package/dist/{store-lookup-H3RGYEXU.js.map → store-lookup-PPLGSTZ6.js.map} +1 -1
- package/dist/tanstack/navigation.d.ts +6 -0
- package/dist/tanstack/navigation.d.ts.map +1 -1
- package/dist/tanstack/router.d.ts.map +1 -1
- package/dist/tanstack/templates/locale-wrapper.d.ts.map +1 -1
- package/dist/tanstack.js +19 -18
- package/dist/tanstack.js.map +1 -1
- package/dist/utils/baseHead.d.ts +6 -0
- package/dist/utils/baseHead.d.ts.map +1 -1
- package/dist/utils/baseHead.js +2 -1
- package/dist/utils/index.js +5 -4
- package/dist/utils/index.js.map +1 -1
- package/dist/vite/index.js +16 -7
- package/dist/vite/index.js.map +1 -1
- package/dist/vite/plugins/worker-config.d.ts.map +1 -1
- package/package.json +10 -1
- package/tailwind/routes/custom-urls.ts.txt +161 -0
- package/tailwind/routes/product/index.tsx.txt +7 -2
- package/tailwind/routes/product/key.ts.txt +77 -0
- package/tailwind/routes/product/loader.ts.txt +25 -4
- package/tailwind/routes/product-short-link.ts.txt +13 -47
- package/tailwind/routes/seo-redirects.ts.txt +38 -10
- package/dist/BlogAuthorPage-ELZPCZEE.js.map +0 -1
- package/dist/BlogCategoryPage-MADVXTFU.js.map +0 -1
- package/dist/BlogPage-DTHRWEHK.js.map +0 -1
- package/dist/BlogSinglePage-BSHIPWOR.js.map +0 -1
- package/dist/BlogTagPage-YIGA3QZQ.js.map +0 -1
- package/dist/BrandsPage-AD7RKXIC.js.map +0 -1
- package/dist/Breadcrumb-O7YJIL52.js.map +0 -1
- package/dist/CartItem-7A45S2WC.js.map +0 -1
- package/dist/CartSummary-V6VP6MI5.js.map +0 -1
- package/dist/CustomerLayout-LTP5EG72.js.map +0 -1
- package/dist/GoogleTag-NHGB476C.js +0 -15
- package/dist/LatestProducts-HZOHWLLU.js.map +0 -1
- package/dist/LoyaltyPage-VKVING2R.js.map +0 -1
- package/dist/MobileMenu-KNQHAIAW.js.map +0 -1
- package/dist/NotificationsPage-W34PE52P.js.map +0 -1
- package/dist/OrderSinglePage-P7WAQSPT.js.map +0 -1
- package/dist/OrdersPage-U3OVVRCX.js.map +0 -1
- package/dist/ProfilePage-3EMQAHEY.js.map +0 -1
- package/dist/SeoCartWidget-QJA2XBV4.js.map +0 -1
- package/dist/SettingsPage-QYHW6SJ2.js.map +0 -1
- package/dist/ThankYouPage-5G7P3ADY.js.map +0 -1
- package/dist/WalletPage-QAQHKFKN.js.map +0 -1
- package/dist/WebMcpTools-RSOWCODK.js.map +0 -1
- package/dist/WishlistPage-5XE5K3I4.js.map +0 -1
- package/dist/chunk-27UGZZKX.js.map +0 -1
- package/dist/chunk-5PZKQTNW.js.map +0 -1
- package/dist/chunk-GKXIKFQW.js.map +0 -1
- package/dist/chunk-NO2MV4Y5.js.map +0 -1
- package/dist/chunk-OL7X4VAI.js.map +0 -1
- package/dist/chunk-UJSP7BLE.js.map +0 -1
- package/dist/document-class-DMHQXNQW.js +0 -37
- package/dist/not-found-CYFSHYKS.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/baseHead.ts"],"names":[],"mappings":";;;;;AAaA,IAAM,aAAA,GAAwC;AAAA,EAC5C,EAAA,EAAI,OAAA;AAAA,EACJ,EAAA,EAAI;AACN,CAAA;AAKO,SAAS,iBAAiB,MAAA,EAAwB;AACvD,EAAA,IAAI,CAAC,MAAA,EAAQ,OAAO,aAAA,CAAc,eAAe,CAAA,IAAK,OAAA;AACtD,EAAA,MAAM,OAAO,MAAA,CAAO,KAAA,CAAM,MAAM,CAAA,CAAE,CAAC,EAAE,WAAA,EAAY;AACjD,EAAA,OAAO,aAAA,CAAc,IAAI,CAAA,IAAK,CAAA,EAAG,IAAI,CAAA,CAAA,EAAI,IAAA,CAAK,aAAa,CAAA,CAAA;AAC7D;AAQA,SAAS,iBAAA,CAAkB,UAAkB,SAAA,EAA6B;AACxE,EAAA,MAAM,QAAQ,QAAA,CAAS,KAAA,CAAM,GAAG,CAAA,CAAE,OAAO,OAAO,CAAA;AAChD,EAAA,MAAM,QAAQ,SAAA,CAAU,KAAA,CAAM,GAAG,CAAA,CAAE,OAAO,OAAO,CAAA;AACjD,EAAA,MAAM,OAAA,GAAU,CAAC,KAAA,KACf,KAAA,CAAM,SAAS,CAAA,IAAK,KAAA,CAAM,KAAA,CAAM,CAAC,SAAS,CAAA,KAAM,KAAA,CAAM,KAAA,GAAQ,CAAC,MAAM,OAAO,CAAA;AAG9E,EAAA,MAAM,WAAW,CAAC,KAAA,KAAkB,QAAA,CAAS,KAAA,CAAM,KAAK,CAAC,CAAA;AAEzD,EAAA,IAAI,OAAA,CAAQ,CAAC,CAAA,EAAG,OA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AA,MAC9B,MAAA,EAAQ,iBAAiB,MAAM,CAAA;AAAA,MAC/B,GAAI,MAAM,IAAA,GAAO,EAAE,QAAQ,KAAA,CAAM,IAAA,KAAS;AAAC,KAC7C;AAAA,IACA,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,qBAAA;AAAA,MACN,KAAA;AAAA,MACA,GAAI,WAAA,GAAc,EAAE,WAAA,KAAgB,EAAC;AAAA,MACrC,GAAI,WAAA,GAAc,EAAE,IAAA,EAAM,WAAA,KAAgB,EAAC;AAAA,MAC3C,GAAI,MAAM,IAAA,GAAO,EAAE,QAAQ,KAAA,CAAM,IAAA,KAAS;AAAC,KAC7C;AAAA,IACA,GAAI,OAAO,EAAE,kBAAA,EAAoB,wBAAwB,QAAA,EAAU,IAAI,CAAA,EAAE,GAAI;AAAC,GAChF;AACF","file":"chunk-IXUYCRYA.js","sourcesContent":["import type { HeadDescriptor } from './head';\nimport type { StoreContext } from '../api/store';\nimport { FALLBACK_LOCALE, isLocale } from '../providers/locale-constants';\nimport { isProductKeyUrl } from '../router/product-key-urls';\nimport { resolveStoreBase, resolveStoreBaseFollowsLocale } from './store-identity';\nimport { splitLeadingSegment } from './store-base';\nimport { isMultilingualStore } from './shared-host-language';\n\n// ============================================================================\n// Locale helpers\n// ============================================================================\n\n/** Maps ISO-639-1 locale codes to the og:locale format (language_TERRITORY). */\nconst LOCALE_OG_MAP: Record<string, string> = {\n ar: 'ar_AR',\n en: 'en_US',\n};\n\n/**\n * Converts an ISO-639-1 locale string to the og:locale format (e.g. `ar` → `ar_AR`).\n */\nexport function localeToOgLocale(locale: string): string {\n if (!locale) return LOCALE_OG_MAP[FALLBACK_LOCALE] ?? 'ar_AR';\n const base = locale.split(/[-_]/)[0].toLowerCase();\n return LOCALE_OG_MAP[base] ?? `${base}_${base.toUpperCase()}`;\n}\n\n/**\n * The page's own segments of an absolute URL's path: without the store's path (`storePath`, the\n * `/<username>` of a store without a domain) and without a locale beside it. The locale may sit\n * on either side: after the store in a store root (`/<username>/ar/shoes`), and in front of it in\n * the URLs the API hands out for a shared-host store (`/ar/<username>/shoes`).\n */\nfunction pageSegmentsOfUrl(pathname: string, storePath: string): string[] {\n const parts = pathname.split('/').filter(Boolean);\n const store = storePath.split('/').filter(Boolean);\n const storeAt = (index: number) =>\n store.length > 0 && store.every((segment, i) => parts[index + i] === segment);\n // A language the engine knows (the router's own test), not any two letters: a category slugged\n // `tv` is no language, and Indonesian is `ind`.\n const localeAt = (index: number) => isLocale(parts[index]);\n\n if (storeAt(0)) return parts.slice(store.length + (localeAt(store.length) ? 1 : 0));\n if (localeAt(0) && storeAt(1)) return parts.slice(1 + store.length);\n return parts.slice(localeAt(0) ? 1 : 0);\n}\n\n/**\n * Extracts the path portion from a URL or path string, removing any locale prefix and, from an\n * absolute URL, the store's own path (`storePath`, the `/<username>` of a store without a domain).\n */\nfunction extractPath(urlOrPath: string | undefined, storePath = ''): string {\n if (!urlOrPath) return '/';\n\n try {\n const parsed = new URL(urlOrPath);\n return '/' + pageSegmentsOfUrl(parsed.pathname, storePath).join('/');\n } catch {\n const pathParts = urlOrPath.split('/').filter(Boolean);\n if (pathParts.length > 0 && isLocale(pathParts[0])) {\n pathParts.shift();\n }\n return '/' + pathParts.join('/');\n }\n}\n\n/**\n * The store's root URL from its store URL: the domain, plus the `/<username>` a store without\n * its own domain lives under, without a trailing locale.\n * \"https://saudiseamless.com/ar/\" → \"https://saudiseamless.com\"\n * \"https://salla.sa/my-store/ar/\" → \"https://salla.sa/my-store\"\n */\nfunction extractBaseUrl(storeUrl: string): string {\n try {\n const parsed = new URL(storeUrl);\n const segments = parsed.pathname.split('/').filter(Boolean);\n if (isLocale(segments[segments.length - 1])) segments.pop();\n return parsed.origin + segments.map((segment) => `/${segment}`).join('');\n } catch {\n return storeUrl.replace(/\\/[a-z]{2}\\/?$/i, '').replace(/\\/$/, '');\n }\n}\n\n/**\n * The store's root URL as pages are addressed now. On a Salla shared host that is\n * `https://demostore.salla.sa/<username>`: the API's `store.url` still carries the old\n * language segment (`/ar/<username>/`), which redirects, so it is not used there.\n */\nfunction storeRootUrl(storeUrl: string): string {\n const base = resolveStoreBase();\n if (base && resolveStoreBaseFollowsLocale()) {\n try {\n return `${new URL(storeUrl).origin}/${base}`;\n } catch {\n // Not an absolute URL: fall through to the generic rule.\n }\n }\n return extractBaseUrl(storeUrl);\n}\n\n/** Whether pages are addressed without a language segment (a Salla shared host). */\nfunction languageInQuery(): boolean {\n return Boolean(resolveStoreBase() && resolveStoreBaseFollowsLocale());\n}\n\n/**\n * A router path (`/ar/brands`) as a shared host addresses it: the leading locale comes off the\n * path and becomes `?lang=`, since the address carries no language. A path with no leading\n * locale takes `fallbackLocale` for its `?lang=`, or none when that is not given. `path` is\n * `''` for the store root.\n */\nfunction sharedHostPage(\n routerPath: string,\n fallbackLocale?: string\n): { path: string; search: string } {\n const { first, rest } = splitLeadingSegment(routerPath);\n const leading = isLocale(first);\n const remainder = leading ? rest : routerPath;\n const locale = leading ? first : fallbackLocale;\n return {\n path: remainder === '/' ? '' : remainder,\n search: locale ? `?lang=${encodeURIComponent(locale)}` : '',\n };\n}\n\n/**\n * `path` under the store's root URL, the way canonical URLs name a page.\n *\n * On a shared host `path` is the router's, with its virtual locale in front (`/ar/brands`),\n * and the page's address is `/<username>/brands?lang=ar`.\n */\nexport function storePageUrl(\n settings: StoreContext | null | undefined,\n path: string\n): string | undefined {\n const storeUrl = settings?.store?.url;\n if (!storeUrl) return undefined;\n const base = storeRootUrl(storeUrl);\n const page = languageInQuery()\n ? sharedHostPage(path)\n : { path: path === '/' ? '' : path, search: '' };\n if (!page.path && !page.search) return base;\n try {\n // Percent-encodes the decoded path the router hands over, and keeps escapes it left in.\n return new URL(`${base}${page.path}${page.search}`).href;\n } catch {\n return `${base}${page.path}${page.search}`;\n }\n}\n\n/** The `{key}-{name}` segment a SKU-link product URL ends with, or null for any other URL. */\nfunction productKeySegmentOf(url: string | undefined): string | null {\n if (!isProductKeyUrl(url)) return null;\n try {\n return new URL(url ?? '').pathname.split('/').filter(Boolean).pop() ?? null;\n } catch {\n return null;\n }\n}\n\n/**\n * The SEO slug of a product (`p`) or category (`c`) URL that ends `/{slug}/{kind}{id}`, or `-`\n * when it ends otherwise. A slug is never a language, nor the store's own segment\n * (`salla.sa/<username>/p1` has none).\n */\nexport function slugOfPageUrl(url: string | undefined, kind: 'p' | 'c', id: string): string {\n try {\n const segments = new URL(url ?? '').pathname.split('/').filter(Boolean);\n const [slug, last] = segments.slice(-2);\n if (segments.length < 2 || last !== `${kind}${id}`) return '-';\n return isLocale(slug) || slug === resolveStoreBase() ? '-' : slug;\n } catch {\n return '-';\n }\n}\n\n/**\n * The canonical URL of a product (`p`) or category (`c`) page: `/{slug}/{kind}{id}` under the\n * store root, in the language of the page's address (`routerPath`), with the slug the API's\n * `url` carries, or `-` when it carries none.\n *\n * It is built, not taken from the API, because the API's `url` is not always an address the\n * engine serves. A store on hash URLs gets `/{code}` and `/category/{code}`, and a store on \"new\n * links\" gets `/p{id}-{name}` or `/{sku}-{name}`. The engine redirects those to `/-/{kind}{id}`,\n * so a canonical naming one told search engines the page lived at an address that redirected\n * back to it. On a store with SEO URLs the result is the API's own `url`.\n */\nexport function slugPageCanonical(\n settings: StoreContext | null | undefined,\n kind: 'p' | 'c',\n id: string | number,\n apiUrl: string | undefined,\n routerPath: string\n): string | undefined {\n const first = routerPath.split('/').filter(Boolean)[0];\n const locale = isLocale(first) ? `/${first}` : '';\n // A store on SKU links names its product `/{key}-{name}`, and the engine serves it there.\n const keyAddress = kind === 'p' ? productKeySegmentOf(apiUrl) : null;\n if (keyAddress) return storePageUrl(settings, `${locale}/${keyAddress}`) ?? apiUrl;\n const slug = slugOfPageUrl(apiUrl, kind, String(id));\n return storePageUrl(settings, `${locale}/${slug}/${kind}${id}`) ?? apiUrl;\n}\n\n// ============================================================================\n// Hreflang alternates builder\n// ============================================================================\n\n/**\n * The language a single-language store's addresses carry: its one language, unless that is the\n * fallback, which an address with no language is read as. The locale layout's `addressLanguage`\n * decides the same way, so `/ar/x` on an Arabic-only store redirects to `/x`.\n */\nfunction singleLanguageSegment(settings: StoreContext): string | null {\n const listed = settings.languages;\n const sole = listed?.length === 1 ? (listed[0].iso_code ?? listed[0].code)?.toLowerCase() : null;\n return isLocale(sole ?? undefined) && sole !== FALLBACK_LOCALE ? sole : null;\n}\n\n/**\n * Builds hreflang alternate links for multilingual SEO.\n *\n * @param settings - StoreContext containing store and languages\n * @param path - Current route path from router (e.g., '/ar/products/123')\n */\nexport function buildHreflangAlternates(\n settings: StoreContext | null | undefined,\n path?: string\n): HeadDescriptor['alternateLanguages'] {\n const languages = settings?.languages;\n if (!languages?.length) {\n return undefined;\n }\n\n const baseUrl = settings?.store?.url ? storeRootUrl(settings.store.url) : '';\n const extractedPath = extractPath(path, baseUrl.replace(/^https?:\\/\\/[^/]+/, ''));\n const defaultLang = languages.find((l) => l.code === FALLBACK_LOCALE) ?? languages[0];\n const inQuery = languageInQuery();\n\n const pagePath = extractedPath === '/' ? '' : extractedPath;\n const buildUrl = (langCode: string) => {\n // On a shared host the language is not in the address; `?lang=` is how a link asks for one.\n return inQuery\n ? `${baseUrl}${pagePath}?lang=${encodeURIComponent(langCode)}`\n : `${baseUrl}/${langCode}${pagePath}`;\n };\n\n // A single-language store is shown in one language, at addresses that carry it only when it\n // is not the fallback. Every alternate named `/<lang>/…`, which redirects there (or `/en/…`,\n // a language the store does not show).\n if (!inQuery && settings && !isMultilingualStore(settings)) {\n const segment = singleLanguageSegment(settings);\n const href = `${baseUrl}${segment ? `/${segment}` : ''}${pagePath}`;\n return [\n { hreflang: 'x-default', href },\n { hreflang: segment ?? FALLBACK_LOCALE, href },\n ];\n }\n\n return [\n { hreflang: 'x-default', href: buildUrl(defaultLang.code) },\n ...languages.map((lang) => ({ hreflang: lang.code, href: buildUrl(lang.code) })),\n ];\n}\n\n// ============================================================================\n// Base head builder (for __root.tsx)\n// ============================================================================\n\n/**\n * Builds a base {@link HeadDescriptor} with store-wide OG and Twitter defaults.\n * Used in __root.tsx to set base metadata that can be overridden by child routes.\n *\n * Note: hreflang alternates, the canonical and og:url are only generated when\n * path is provided, since we need the current route path. Child routes call\n * buildHreflangAlternates directly with ctx.path.\n */\nexport function buildBaseHead(\n settings: StoreContext | null | undefined,\n locale: string = FALLBACK_LOCALE,\n path?: string\n): HeadDescriptor {\n const store = settings?.store;\n if (!store) return {};\n\n const title = store.meta?.title || store.name;\n const description = store.meta?.description || store.description || undefined;\n const keywords = store.meta?.keywords || undefined;\n const baseUrl = store.url ? storeRootUrl(store.url) : undefined;\n // A child route cannot replace a <link>, so a store-wide canonical would stick to every page.\n // On a shared host `path` is the router's, with the virtual locale in front: the address has\n // none, so it comes off and goes into `?lang=`, which keeps each language's page its own.\n const page = path && languageInQuery() ? sharedHostPage(path, locale) : null;\n const canonicalUrl =\n path && baseUrl\n ? page\n ? `${baseUrl}${page.path}${page.search}`\n : `${baseUrl}${path}`\n : undefined;\n const pagePath = path === '/' ? '' : path;\n const ogUrl =\n path && baseUrl ? (page ? canonicalUrl : `${baseUrl}/${locale}${pagePath}`) : undefined;\n\n // The store saves either a handle or a profile URL (https://x.com/<handle>).\n const twitterHandle = store.social?.twitter\n ?.split('?')[0]\n .replace(/\\/+$/, '')\n .split('/')\n .pop()\n ?.replace(/^@/, '');\n const twitterSite = twitterHandle ? `@${twitterHandle}` : undefined;\n\n return {\n title,\n ...(description ? { description } : {}),\n ...(keywords ? { keywords } : {}),\n ...(canonicalUrl ? { canonical: canonicalUrl } : {}),\n openGraph: {\n type: 'website',\n siteName: store.name,\n title,\n ...(description ? { description } : {}),\n ...(ogUrl ? { url: ogUrl } : {}),\n locale: localeToOgLocale(locale),\n ...(store.logo ? { images: store.logo } : {}),\n },\n twitter: {\n card: 'summary_large_image',\n title,\n ...(description ? { description } : {}),\n ...(twitterSite ? { site: twitterSite } : {}),\n ...(store.logo ? { images: store.logo } : {}),\n },\n ...(path ? { alternateLanguages: buildHreflangAlternates(settings, path) } : {}),\n };\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ensureTwilightContextFromMatches } from './chunk-X55R4VVK.js';
|
|
2
|
-
import { storePageUrl } from './chunk-
|
|
2
|
+
import { storePageUrl } from './chunk-IXUYCRYA.js';
|
|
3
3
|
import { getTwilightContext, SettingsError } from './chunk-6K34BCUP.js';
|
|
4
4
|
|
|
5
5
|
// src/tanstack/head.ts
|
|
@@ -125,5 +125,5 @@ function withHead(route, extend) {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
export { tanstackHeadAdapter, withHead };
|
|
128
|
-
//# sourceMappingURL=chunk-
|
|
129
|
-
//# sourceMappingURL=chunk-
|
|
128
|
+
//# sourceMappingURL=chunk-J5HHXQQO.js.map
|
|
129
|
+
//# sourceMappingURL=chunk-J5HHXQQO.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tanstack/head.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,kBAAkB,MAAA,EAAyC;AAClE,EAAA,IAAI,CAAC,MAAA,EAAQ,OAAO,EAAC;AACrB,EAAA,MAAM,MAAM,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,GAAI,MAAA,GAAS,CAAC,MAAM,CAAA;AACpD,EAAA,OAAO,GAAA,CAAI,GAAA,CAAI,CAAC,GAAA,KAAS,OAAO,GAAA,KAAQ,QAAA,GAAW,EAAE,GAAA,EAAK,GAAA,EAAI,GAAI,GAAI,CAAA;AACxE;AAGA,SAAS,UAAU,IAAA,EAAsB;AACvC,EAAA,OAAO,IAAA,CACJ,OAAA,CAAQ,sCAAA,EAAwC,GAAG,CAAA,CACnD,OAAA,CAAQ,UAAA,EAAY,EAAE,CAAA,CACtB,OAAA,CAAQ,MAAA,EAAQ,GAAG,EACnB,IAAA,EAAK;AACV;AAEO,SAAS,oBAAoB,UAAA,EAA4B;AAC9D,EAAA,MAAM,OAAuC,EAAC;AAC9C,EAAA,MAAM,QAAwC,EAAC;AAC/C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C;AAC5C,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF,CAAA;AACF","file":"chunk-MNYVJQAA.js","sourcesContent":["import type { HeadDescriptor, OpenGraphImage } from '../utils/head';\nimport type { TwilightContext } from '../twilight/context';\nimport { getTwilightContext } from '../twilight/context';\nimport type { TwilightContextMatch } from '../twilight/ensure-context';\nimport { ensureTwilightContextFromMatches } from '../twilight/ensure-context';\nimport { SettingsError } from '../utils/errors';\nimport { storePageUrl } from '../utils/baseHead';\n\ntype OgImagesInput = string | OpenGraphImage | Array<string | OpenGraphImage> | undefined;\n\nfunction normalizeOgImages(images: OgImagesInput): OpenGraphImage[] {\n if (!images) return [];\n const arr = Array.isArray(images) ? images : [images];\n return arr.map((img) => (typeof img === 'string' ? { url: img } : img));\n}\n\n/** Merchant descriptions are rich-text HTML; description meta tags take plain text. */\nfunction plainText(html: string): string {\n return html\n .replace(/<br\\s*\\/?>|<\\/(?:p|div|li|h[1-6])>/gi, ' ')\n .replace(/<[^>]*>/g, '')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\nexport function tanstackHeadAdapter(descriptor: HeadDescriptor) {\n const meta: Array<Record<string, unknown>> = [];\n const links: Array<Record<string, unknown>> = [];\n const scripts: Array<Record<string, unknown>> = [];\n const styles: Record<string, unknown>[] = [];\n\n if (descriptor.title) meta.push({ title: descriptor.title });\n if (descriptor.description)\n meta.push({ name: 'description', content: plainText(descriptor.description) });\n\n if (descriptor.keywords) {\n const kw = Array.isArray(descriptor.keywords)\n ? descriptor.keywords.join(', ')\n : descriptor.keywords;\n meta.push({ name: 'keywords', content: kw });\n }\n\n if (descriptor.robots) meta.push({ name: 'robots', content: descriptor.robots });\n\n // Open Graph\n const og = descriptor.openGraph;\n if (og) {\n if (og.siteName) meta.push({ property: 'og:site_name', content: og.siteName });\n if (og.type) meta.push({ property: 'og:type', content: og.type });\n if (og.title) meta.push({ property: 'og:title', content: og.title });\n if (og.description)\n meta.push({ property: 'og:description', content: plainText(og.description) });\n if (og.url) meta.push({ property: 'og:url', content: og.url });\n if (og.locale) meta.push({ property: 'og:locale', content: og.locale });\n for (const alt of og.alternateLocale ?? []) {\n meta.push({ property: 'og:locale:alternate', content: alt });\n }\n for (const img of normalizeOgImages(og.images)) {\n meta.push({ property: 'og:image', content: img.url });\n if (img.width != null) meta.push({ property: 'og:image:width', content: String(img.width) });\n if (img.height != null)\n meta.push({ property: 'og:image:height', content: String(img.height) });\n if (img.alt) meta.push({ property: 'og:image:alt', content: img.alt });\n }\n if (og.publishedTime)\n meta.push({ property: 'article:published_time', content: og.publishedTime });\n if (og.modifiedTime) meta.push({ property: 'article:modified_time', content: og.modifiedTime });\n }\n\n // Twitter Card\n const tw = descriptor.twitter;\n if (tw) {\n if (tw.card) meta.push({ name: 'twitter:card', content: tw.card });\n if (tw.title) meta.push({ name: 'twitter:title', content: tw.title });\n if (tw.description)\n meta.push({ name: 'twitter:description', content: plainText(tw.description) });\n if (tw.site) meta.push({ name: 'twitter:site', content: tw.site });\n if (tw.creator) meta.push({ name: 'twitter:creator', content: tw.creator });\n if (tw.url) meta.push({ name: 'twitter:url', content: tw.url });\n const twImages = tw.images ? (Array.isArray(tw.images) ? tw.images : [tw.images]) : [];\n for (const img of twImages) {\n meta.push({ name: 'twitter:image', content: img });\n }\n }\n\n // Canonical\n if (descriptor.canonical) links.push({ rel: 'canonical', href: descriptor.canonical });\n\n // hreflang alternates (React requires camelCase: hrefLang)\n for (const alt of descriptor.alternateLanguages ?? []) {\n links.push({ rel: 'alternate', hrefLang: alt.hreflang, href: alt.href });\n }\n\n // JSON-LD\n if (descriptor.jsonLd) {\n scripts.push({ type: 'application/ld+json', children: JSON.stringify(descriptor.jsonLd) });\n }\n\n // Escape hatches\n for (const m of descriptor.meta ?? []) {\n const { httpEquiv, ...rest } = m as typeof m & { httpEquiv?: string };\n meta.push(httpEquiv ? { httpEquiv, ...rest } : rest);\n }\n for (const l of descriptor.links ?? []) links.push(l);\n for (const s of descriptor.styles ?? []) styles.push(s as unknown as Record<string, unknown>);\n\n // Import maps must be emitted before module scripts that rely on bare specifiers.\n for (const im of descriptor.importMap ?? []) {\n scripts.push({ type: 'importmap', children: JSON.stringify(im) });\n }\n for (const s of descriptor.scripts ?? []) scripts.push(s);\n\n return { meta, links, styles, scripts };\n}\n\n// ============================================================================\n// withHead - Simplified head callback wrapper for TanStack Router\n// ============================================================================\n\n/** Twig's page title format: \"<page title> - <store meta title or store name>\". */\nfunction appendStoreTitle(\n descriptor: HeadDescriptor,\n settings: TwilightContext['settings']\n): HeadDescriptor {\n const store = settings?.store;\n const storeTitle = store?.meta?.title || store?.name;\n const pageTitle = descriptor.title;\n if (!pageTitle || !storeTitle || descriptor.appendStoreTitle === false) return descriptor;\n if (pageTitle === storeTitle) return descriptor;\n\n const title = `${pageTitle} - ${storeTitle}`;\n // Share titles follow the page title too, unless the route set its own.\n const shareTitle = (current?: string) => (!current || current === pageTitle ? title : current);\n return {\n ...descriptor,\n title,\n openGraph: { ...descriptor.openGraph, title: shareTitle(descriptor.openGraph?.title) },\n twitter: { ...descriptor.twitter, title: shareTitle(descriptor.twitter?.title) },\n };\n}\n\n/**\n * Twig's page URL for a page that names none: its own path on the store's domain, without the\n * query, as the canonical and the og:url and twitter:url share cards read.\n */\nfunction withPageUrl(descriptor: HeadDescriptor, ctx: TwilightContext): HeadDescriptor {\n const pathname = ctx.location?.pathname;\n const canonical =\n descriptor.canonical ?? (pathname ? storePageUrl(ctx.settings, pathname) : undefined);\n if (!canonical) return descriptor;\n return {\n ...descriptor,\n canonical,\n openGraph: { ...descriptor.openGraph, url: descriptor.openGraph?.url ?? canonical },\n twitter: { ...descriptor.twitter, url: descriptor.twitter?.url ?? canonical },\n };\n}\n\n/**\n * Minimal shape we need from TanStack Router's AssetFnContextOptions.\n * `loaderData` feeds the route's own head function; `matches` is the recovery\n * source for store settings when the twilight module store is not populated yet\n * (see `ensureTwilightContextFromMatches`).\n */\ntype HeadContext = {\n loaderData?: unknown;\n matches?: readonly TwilightContextMatch[];\n};\n\n/**\n * Wraps a route module's head function for TanStack Router.\n *\n * @example\n * ```typescript\n * head: withHead(Offers)\n * head: withHead(Product, (result) => ({ ...result, robots: 'noindex, follow' }))\n * ```\n */\nexport function withHead<T>(\n route: { head: (ctx: TwilightContext, data: T) => HeadDescriptor },\n extend?: (result: HeadDescriptor, _ctx: TwilightContext, data: T) => HeadDescriptor\n): (_ctx: Record<string, unknown>) => Record<string, unknown> {\n return (ctx: HeadContext) => {\n const loaderData = ctx.loaderData;\n\n if (!loaderData) return {};\n\n // TanStack re-runs every matched route's head() during client hydration,\n // where the twilight module store can still be empty. Recover it from the\n // match context TanStack has already resolved before giving up.\n ensureTwilightContextFromMatches(ctx.matches);\n\n try {\n const context = getTwilightContext();\n const result = route.head(context, loaderData as T);\n const extended = extend ? extend(result, context, loaderData as T) : result;\n const finalResult = withPageUrl(appendStoreTitle(extended, context.settings), context);\n\n return tanstackHeadAdapter(finalResult);\n } catch (error) {\n // A head function must never throw: TanStack surfaces the throw as a\n // hydration error, React then discards the server-rendered tree and the\n // storefront renders blank. Dropping this route's head tags degrades\n // gracefully — the server-rendered ones stay in the document.\n if (error instanceof SettingsError) return {};\n throw error;\n }\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/tanstack/head.ts"],"names":[],"mappings":";;;;;AAUA,SAAS,kBAAkB,MAAA,EAAyC;AAClE,EAAA,IAAI,CAAC,MAAA,EAAQ,OAAO,EAAC;AACrB,EAAA,MAAM,MAAM,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,GAAI,MAAA,GAAS,CAAC,MAAM,CAAA;AACpD,EAAA,OAAO,GAAA,CAAI,GAAA,CAAI,CAAC,GAAA,KAAS,OAAO,GAAA,KAAQ,QAAA,GAAW,EAAE,GAAA,EAAK,GAAA,EAAI,GAAI,GAAI,CAAA;AACxE;AAGA,SAAS,UAAU,IAAA,EAAsB;AACvC,EAAA,OAAO,IAAA,CACJ,OAAA,CAAQ,sCAAA,EAAwC,GAAG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AACrE,MAAA,MAAM,cAAc,WAAA,CAAY,gBAAA,CAAiB,UAAU,OAAA,CAAQ,QAAQ,GAAG,OAAO,CAAA;AAErF,MAAA,OAAO,oBAAoB,WAAW,CAAA;AAAA,IACxC,SAAS,KAAA,EAAO;AAKd,MAAA,IAAI,KAAA,YAAiB,aAAA,EAAe,OAAO,EAAC;AAC5C,MAAA,MAAM,KAAA;AAAA,IACR;AAAA,EACF,CAAA;AACF","file":"chunk-J5HHXQQO.js","sourcesContent":["import type { HeadDescriptor, OpenGraphImage } from '../utils/head';\nimport type { TwilightContext } from '../twilight/context';\nimport { getTwilightContext } from '../twilight/context';\nimport type { TwilightContextMatch } from '../twilight/ensure-context';\nimport { ensureTwilightContextFromMatches } from '../twilight/ensure-context';\nimport { SettingsError } from '../utils/errors';\nimport { storePageUrl } from '../utils/baseHead';\n\ntype OgImagesInput = string | OpenGraphImage | Array<string | OpenGraphImage> | undefined;\n\nfunction normalizeOgImages(images: OgImagesInput): OpenGraphImage[] {\n if (!images) return [];\n const arr = Array.isArray(images) ? images : [images];\n return arr.map((img) => (typeof img === 'string' ? { url: img } : img));\n}\n\n/** Merchant descriptions are rich-text HTML; description meta tags take plain text. */\nfunction plainText(html: string): string {\n return html\n .replace(/<br\\s*\\/?>|<\\/(?:p|div|li|h[1-6])>/gi, ' ')\n .replace(/<[^>]*>/g, '')\n .replace(/\\s+/g, ' ')\n .trim();\n}\n\nexport function tanstackHeadAdapter(descriptor: HeadDescriptor) {\n const meta: Array<Record<string, unknown>> = [];\n const links: Array<Record<string, unknown>> = [];\n const scripts: Array<Record<string, unknown>> = [];\n const styles: Record<string, unknown>[] = [];\n\n if (descriptor.title) meta.push({ title: descriptor.title });\n if (descriptor.description)\n meta.push({ name: 'description', content: plainText(descriptor.description) });\n\n if (descriptor.keywords) {\n const kw = Array.isArray(descriptor.keywords)\n ? descriptor.keywords.join(', ')\n : descriptor.keywords;\n meta.push({ name: 'keywords', content: kw });\n }\n\n if (descriptor.robots) meta.push({ name: 'robots', content: descriptor.robots });\n\n // Open Graph\n const og = descriptor.openGraph;\n if (og) {\n if (og.siteName) meta.push({ property: 'og:site_name', content: og.siteName });\n if (og.type) meta.push({ property: 'og:type', content: og.type });\n if (og.title) meta.push({ property: 'og:title', content: og.title });\n if (og.description)\n meta.push({ property: 'og:description', content: plainText(og.description) });\n if (og.url) meta.push({ property: 'og:url', content: og.url });\n if (og.locale) meta.push({ property: 'og:locale', content: og.locale });\n for (const alt of og.alternateLocale ?? []) {\n meta.push({ property: 'og:locale:alternate', content: alt });\n }\n for (const img of normalizeOgImages(og.images)) {\n meta.push({ property: 'og:image', content: img.url });\n if (img.width != null) meta.push({ property: 'og:image:width', content: String(img.width) });\n if (img.height != null)\n meta.push({ property: 'og:image:height', content: String(img.height) });\n if (img.alt) meta.push({ property: 'og:image:alt', content: img.alt });\n }\n if (og.publishedTime)\n meta.push({ property: 'article:published_time', content: og.publishedTime });\n if (og.modifiedTime) meta.push({ property: 'article:modified_time', content: og.modifiedTime });\n }\n\n // Twitter Card\n const tw = descriptor.twitter;\n if (tw) {\n if (tw.card) meta.push({ name: 'twitter:card', content: tw.card });\n if (tw.title) meta.push({ name: 'twitter:title', content: tw.title });\n if (tw.description)\n meta.push({ name: 'twitter:description', content: plainText(tw.description) });\n if (tw.site) meta.push({ name: 'twitter:site', content: tw.site });\n if (tw.creator) meta.push({ name: 'twitter:creator', content: tw.creator });\n if (tw.url) meta.push({ name: 'twitter:url', content: tw.url });\n const twImages = tw.images ? (Array.isArray(tw.images) ? tw.images : [tw.images]) : [];\n for (const img of twImages) {\n meta.push({ name: 'twitter:image', content: img });\n }\n }\n\n // Canonical\n if (descriptor.canonical) links.push({ rel: 'canonical', href: descriptor.canonical });\n\n // hreflang alternates (React requires camelCase: hrefLang)\n for (const alt of descriptor.alternateLanguages ?? []) {\n links.push({ rel: 'alternate', hrefLang: alt.hreflang, href: alt.href });\n }\n\n // JSON-LD\n if (descriptor.jsonLd) {\n scripts.push({ type: 'application/ld+json', children: JSON.stringify(descriptor.jsonLd) });\n }\n\n // Escape hatches\n for (const m of descriptor.meta ?? []) {\n const { httpEquiv, ...rest } = m as typeof m & { httpEquiv?: string };\n meta.push(httpEquiv ? { httpEquiv, ...rest } : rest);\n }\n for (const l of descriptor.links ?? []) links.push(l);\n for (const s of descriptor.styles ?? []) styles.push(s as unknown as Record<string, unknown>);\n\n // Import maps must be emitted before module scripts that rely on bare specifiers.\n for (const im of descriptor.importMap ?? []) {\n scripts.push({ type: 'importmap', children: JSON.stringify(im) });\n }\n for (const s of descriptor.scripts ?? []) scripts.push(s);\n\n return { meta, links, styles, scripts };\n}\n\n// ============================================================================\n// withHead - Simplified head callback wrapper for TanStack Router\n// ============================================================================\n\n/** Twig's page title format: \"<page title> - <store meta title or store name>\". */\nfunction appendStoreTitle(\n descriptor: HeadDescriptor,\n settings: TwilightContext['settings']\n): HeadDescriptor {\n const store = settings?.store;\n const storeTitle = store?.meta?.title || store?.name;\n const pageTitle = descriptor.title;\n if (!pageTitle || !storeTitle || descriptor.appendStoreTitle === false) return descriptor;\n if (pageTitle === storeTitle) return descriptor;\n\n const title = `${pageTitle} - ${storeTitle}`;\n // Share titles follow the page title too, unless the route set its own.\n const shareTitle = (current?: string) => (!current || current === pageTitle ? title : current);\n return {\n ...descriptor,\n title,\n openGraph: { ...descriptor.openGraph, title: shareTitle(descriptor.openGraph?.title) },\n twitter: { ...descriptor.twitter, title: shareTitle(descriptor.twitter?.title) },\n };\n}\n\n/**\n * Twig's page URL for a page that names none: its own path on the store's domain, without the\n * query, as the canonical and the og:url and twitter:url share cards read.\n */\nfunction withPageUrl(descriptor: HeadDescriptor, ctx: TwilightContext): HeadDescriptor {\n const pathname = ctx.location?.pathname;\n const canonical =\n descriptor.canonical ?? (pathname ? storePageUrl(ctx.settings, pathname) : undefined);\n if (!canonical) return descriptor;\n return {\n ...descriptor,\n canonical,\n openGraph: { ...descriptor.openGraph, url: descriptor.openGraph?.url ?? canonical },\n twitter: { ...descriptor.twitter, url: descriptor.twitter?.url ?? canonical },\n };\n}\n\n/**\n * Minimal shape we need from TanStack Router's AssetFnContextOptions.\n * `loaderData` feeds the route's own head function; `matches` is the recovery\n * source for store settings when the twilight module store is not populated yet\n * (see `ensureTwilightContextFromMatches`).\n */\ntype HeadContext = {\n loaderData?: unknown;\n matches?: readonly TwilightContextMatch[];\n};\n\n/**\n * Wraps a route module's head function for TanStack Router.\n *\n * @example\n * ```typescript\n * head: withHead(Offers)\n * head: withHead(Product, (result) => ({ ...result, robots: 'noindex, follow' }))\n * ```\n */\nexport function withHead<T>(\n route: { head: (ctx: TwilightContext, data: T) => HeadDescriptor },\n extend?: (result: HeadDescriptor, _ctx: TwilightContext, data: T) => HeadDescriptor\n): (_ctx: Record<string, unknown>) => Record<string, unknown> {\n return (ctx: HeadContext) => {\n const loaderData = ctx.loaderData;\n\n if (!loaderData) return {};\n\n // TanStack re-runs every matched route's head() during client hydration,\n // where the twilight module store can still be empty. Recover it from the\n // match context TanStack has already resolved before giving up.\n ensureTwilightContextFromMatches(ctx.matches);\n\n try {\n const context = getTwilightContext();\n const result = route.head(context, loaderData as T);\n const extended = extend ? extend(result, context, loaderData as T) : result;\n const finalResult = withPageUrl(appendStoreTitle(extended, context.settings), context);\n\n return tanstackHeadAdapter(finalResult);\n } catch (error) {\n // A head function must never throw: TanStack surfaces the throw as a\n // hydration error, React then discards the server-rendered tree and the\n // storefront renders blank. Dropping this route's head tags degrades\n // gracefully — the server-rendered ones stay in the document.\n if (error instanceof SettingsError) return {};\n throw error;\n }\n };\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { orThrow } from './chunk-
|
|
2
|
-
import { api } from './chunk-
|
|
1
|
+
import { orThrow } from './chunk-ZXQPSVNT.js';
|
|
2
|
+
import { api } from './chunk-HM3NZ3PK.js';
|
|
3
3
|
import { queryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
var brand = {
|
|
@@ -25,5 +25,5 @@ var brand = {
|
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
export { brand };
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
//# sourceMappingURL=chunk-J62HGQ5E.js.map
|
|
29
|
+
//# sourceMappingURL=chunk-J62HGQ5E.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/brands.ts"],"names":[],"mappings":";;;;AAMO,IAAM,KAAA,GAAQ;AAAA,EACnB,IAAA,EAAM,OAAO,IAAA,KAAmD;AAC9D,IAAA,MAAM,EAAE,IAAA,EAAM,MAAA,EAAO,GAAI,MAAM,GAAA,CAC5B,GAAA,CAAI,IAAA,GAAO,CAAA,YAAA,EAAe,IAAI,CAAA,CAAA,GAAK,QAAQ,EAC3C,IAAA,EAAoD;AACvD,IAAA,OAAO,EAAE,OAAO,IAAA,IAAQ,IAAI,IAAA,EAAM,MAAA,EAAQ,QAAQ,IAAA,EAAK;AAAA,EACzD,CAAA;AAAA,EAEA,IAAA,EAAM,OAAO,EAAA,KAA+B;AAC1C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,OAAA,EAAU,EAAE,CAAA,CAAE,CAAA,CAAE,IAAA,EAAsB;AACrE,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,aAAa,CAAC,EAAA,KAA+B,QAAQ,KAAA,CAAM,IAAA,CAAK,EAAE,CAAC,CAAA;AAAA,EAEnE,OAAA,EAAS;AAAA,IACP,IAAA,EAAM,CAAC,IAAA,KACL,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,QAAA,EAAU,MAAA,EAAQ,QAAQ,CAAC,CAAA;AAAA,MACtC,OAAA,EAAS,MAAM,KAAA,CAAM,IAAA,CAAK,IAAI;AAAA,KAC/B,CAAA;AAAA,IACH,MAAA,EAAQ,CAAC,EAAA,KACP,YAAA,CAAa;AAAA,MACX,QAAA,EAA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M,IAAA,CAAK,EAAE;AAAA,KAC7B;AAAA;AAEP","file":"chunk-J62HGQ5E.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { Brand } from '../routes/brands/types';\nimport type { PaginatedResult, Pagination } from './types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const brand = {\n list: async (page?: number): Promise<PaginatedResult<Brand>> => {\n const { data, cursor } = await api\n .get(page ? `brands?page=${page}` : 'brands')\n .json<{ data: Brand[] | null; cursor?: Pagination }>();\n return { items: data ?? [], next: cursor?.next ?? null };\n },\n\n find: async (id: string): Promise<Brand> => {\n const { data } = await api.get(`brands/${id}`).json<{ data: Brand }>();\n return data;\n },\n\n findOrThrow: (id: string): Promise<Brand> => orThrow(brand.find(id)),\n\n queries: {\n list: (page?: number) =>\n queryOptions({\n queryKey: ['brands', 'list', page ?? 1],\n queryFn: () => brand.list(page),\n }),\n detail: (id: string) =>\n queryOptions({\n queryKey: ['brands', 'detail', id],\n queryFn: () => brand.find(id),\n }),\n },\n};\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { registry } from './chunk-Y32RHCOH.js';
|
|
2
|
-
import { useMoney, useNumber } from './chunk-
|
|
2
|
+
import { useMoney, useNumber } from './chunk-MB7EKG6E.js';
|
|
3
3
|
import { useAsset } from './chunk-Z653O7MX.js';
|
|
4
4
|
import { useWishlist } from './chunk-AHR2RGKC.js';
|
|
5
5
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
6
|
-
import { Image } from './chunk-
|
|
6
|
+
import { Image } from './chunk-E4HHNJT7.js';
|
|
7
7
|
import { useTwilight } from './chunk-DF6FBKDN.js';
|
|
8
8
|
import { memo, useCallback, useMemo } from 'react';
|
|
9
9
|
import { SallaAddProductButton } from '@salla.sa/twilight-components-react/add-product-button';
|
|
@@ -229,5 +229,5 @@ var ProductCard = memo(function ProductCard2(props) {
|
|
|
229
229
|
});
|
|
230
230
|
|
|
231
231
|
export { ProductCard };
|
|
232
|
-
//# sourceMappingURL=chunk-
|
|
233
|
-
//# sourceMappingURL=chunk-
|
|
232
|
+
//# sourceMappingURL=chunk-KQXF6MCM.js.map
|
|
233
|
+
//# sourceMappingURL=chunk-KQXF6MCM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/product/ProductCard.tsx"],"names":["ProductCardContent","ProductCard"],"mappings":";;;;;;;;;;;;;AAcA,IAAM,gBAAA,GAAmB,cAAA;AAEzB,IAAM,2BAAA,GAA8B,CAAC,GAAA,EAAK,GAAA,EAAK,KAAK,GAAG,CAAA;AAEvD,IAAM,mBAAA,GAAsB,+BAAA;AAE5B,IAAM,wBAAA,GAA2B,iCAAA;AAoCjC,IAAM,kBAAA,GAAqB,IAAA,CAAK,SAASA,mBAAAA,CAAmB;AAAA,EAC1D,OAAA;AAAA,EACA,MAAA,GAAS,UAAA;AAAA,EACT,SAAA,GAAY,EAAA;AAAA,EACZ,UAAA,GAAa,KAAA;AAAA,EACb,YAAA,GAAe,KAAA;AAAA,EACf,gBAAA,GAAmB,KAAA;AAAA,EACnB,KAAA,GAAQ,CAAA;AAAA,EACR,aAAA,GAAgB,KAAA;AAAA,EAChB;AACF,CAAA,EAAqB;AACnB,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,QAAA,EAAS;AAC5B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,EAAE,KAAA,EAAO,KAAA,EAAM,GAAI,WAAA,EAAY;AACrC,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,QAAA,EAAS;AACnC,EAAA,MAAM,EAAE,MAAA,EAAQ,YAAA,EAAa,GAAI,SAAA,EAAU;AAI3C,EAAA,MAAM,YAAA,GAAe,KAAA,EAAO,QAAA,EAAU,6BAAA,KAAkC,KAAA;AACxE,EAAA,MAAM,eAAA,GACJ,YAAA,IACA,OAAA,CAAQ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AAO,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA;AACxC,CAAC","file":"chunk-SRP7XERU.js","sourcesContent":["import { memo, useCallback, useMemo } from 'react';\nimport { SallaAddProductButton } from '@salla.sa/twilight-components-react/add-product-button';\nimport { SallaButton } from '@salla.sa/twilight-components-react/button';\nimport { useHostAttributes } from '@salla.sa/twilight-theme-engine/hooks/useHostAttributes';\nimport { useMoney } from '../../hooks/useMoney';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useWishlist } from '../../hooks/useWishlist';\nimport { useAsset } from '../../hooks/useAsset';\nimport { useNumber } from '../../hooks/useNumber';\nimport { registry } from '../ComponentRegistry';\nimport { Image } from '../common';\nimport type { Product } from '../../types';\n\nconst PRODUCT_CARD_KEY = 'product:card';\n\nconst PRODUCT_IMAGE_SRCSET_WIDTHS = [150, 300, 450, 600] as const;\n/** Matches `.s-products-list-vertical-cards`: 2-col below 768px, 4-col above. */\nconst PRODUCT_IMAGE_SIZES = '(min-width: 768px) 25vw, 50vw';\n/** fullImage / minimal slots in FeaturedProductsStyle3 (`lg:grid-cols-2`). */\nconst PRODUCT_WIDE_IMAGE_SIZES = '(min-width: 1024px) 50vw, 100vw';\n\n/** Product card layout variants - mutually exclusive */\nexport type ProductCardLayout = 'vertical' | 'horizontal' | 'fullImage' | 'minimal' | 'special';\n\nexport interface ProductCardProps {\n product: Product;\n layout?: ProductCardLayout;\n className?: string;\n withShadow?: boolean;\n withQuantity?: boolean;\n withoutAddButton?: boolean;\n index?: number;\n imagePriority?: boolean;\n /** Overrides the layout-based image `sizes` hint. */\n sizes?: string;\n}\n\n/**\n * ProductCard - Displays a product in various layouts\n *\n * Layouts:\n * - vertical: Default card with image top, content bottom\n * - horizontal: Side-by-side image and content\n * - fullImage: Full bleed image with overlay content\n * - minimal: Compact version with reduced info\n * - special: Featured card with quantity pie chart\n *\n * Features:\n * - Native lazy loading for images\n * - Product badges (promotion, preorder, quantity, out of stock)\n * - Wishlist toggle button\n * - Price display (sale, starting, regular)\n * - Rating display\n * - Add to cart button via SallaAddProductButton (handles labels internally)\n */\nconst ProductCardContent = memo(function ProductCardContent({\n product,\n layout = 'vertical',\n className = '',\n withShadow = false,\n withQuantity = false,\n withoutAddButton = false,\n index = 0,\n imagePriority = false,\n sizes,\n}: ProductCardProps) {\n const { format } = useMoney();\n const { t } = useTranslation();\n const { store, theme } = useTwilight();\n const wishlist = useWishlist();\n const { isPlaceholder } = useAsset();\n const { format: formatNumber } = useNumber();\n\n // Out-of-stock cards offer \"notify me when available\" instead of a dead button, unless\n // the merchant switched `notify_when_available_in_card` off (Twig theme-raed parity).\n const notifyInCard = theme?.settings?.notify_when_available_in_card !== false;\n const addButtonStatus =\n notifyInCard &&\n product.is_out_of_stock &&\n product.type !== 'donating' &&\n product.type !== 'financial_support'\n ? 'out-and-notify'\n : product.status;\n\n const addButtonRef = useHostAttributes({ fill: 'outline', width: 'wide' });\n\n // Layout flags\n const isVertical = layout === 'vertical';\n const isHorizontal = layout === 'horizontal';\n const isFullImage = layout === 'fullImage';\n const isMinimal = layout === 'minimal';\n const isSpecial = layout === 'special';\n\n // Wishlist status\n const productInWishlist = wishlist.has(Number(product.id));\n const handleWishlistToggle = useCallback(() => {\n wishlist.toggle(Number(product.id));\n }, [wishlist, product.id]);\n\n // Get image fit type from store settings\n const fitImageHeight = store?.settings?.product?.fit_type;\n\n // Product badge component\n const getProductBadge = () => {\n if (product?.preorder?.label && typeof product.preorder.label === 'string') {\n return <div className=\"s-product-card-promotion-title\">{product.preorder.label}</div>;\n }\n if (product.promotion_title) {\n return <div className=\"s-product-card-promotion-title\">{product.promotion_title}</div>;\n }\n if (withQuantity && product?.quantity) {\n const formattedQty = formatNumber(product.quantity);\n return (\n <div className=\"s-product-card-quantity\">\n {t('pages.products.remained', 'Remained')} {formattedQty}\n </div>\n );\n }\n if (withQuantity && product?.is_out_of_stock) {\n return (\n <div className=\"s-product-card-out-badge\">\n {t('pages.products.out_of_stock', 'Out of Stock')}\n </div>\n );\n }\n return null;\n };\n\n // Price display component\n const getProductPrice = () => {\n if (product.is_on_sale && product.sale_price) {\n return (\n <div className=\"s-product-card-sale-price\">\n <h4>{format(product.sale_price)}</h4>\n {product.regular_price && <span>{format(product.regular_price)}</span>}\n </div>\n );\n }\n if (product.starting_price) {\n return (\n <div className=\"s-product-card-starting-price\">\n <p>{t('pages.products.starting_price', 'Starting from')}</p>\n <h4>{format(product.starting_price)}</h4>\n </div>\n );\n }\n return <h4 className=\"s-product-card-price\">{format(product.price)}</h4>;\n };\n\n // Build card class names\n const cardClassName = [\n 's-product-card',\n 's-product-card-entry',\n isVertical ? 's-product-card-vertical' : '',\n isHorizontal ? 's-product-card-horizontal' : '',\n // As Twig's card: the store's unified image height sizes horizontal cards too.\n fitImageHeight && (isVertical || isHorizontal) ? `s-product-card-fit-height` : '',\n isSpecial ? 's-product-card-special' : '',\n isFullImage ? 's-product-card-full-image' : '',\n isMinimal ? 's-product-card-minimal' : '',\n product?.donation ? 's-product-card-donation' : '',\n withShadow ? 's-product-card-shadow' : '',\n product?.is_out_of_stock ? 's-product-card-out-of-stock' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n // Image fit class\n const isProductPlaceholder = isPlaceholder(product.image?.url);\n const imageFitClass = isProductPlaceholder ? 'contain' : fitImageHeight || 'cover';\n\n return (\n <div\n id={`product-card-${product.id}`}\n className={cardClassName}\n data-product-id={product.id}\n style={{\n animationDelay: `${index * 100}ms`,\n }}\n >\n <div className={isFullImage ? 's-product-card-image-full' : 's-product-card-image'}>\n <a href={product.url} aria-label={product.image?.alt || product.name}>\n <Image\n className={`s-product-card-image-${imageFitClass}`}\n src={product.image?.url}\n alt={product.image?.alt ?? product.name}\n width={300}\n height={300}\n sizes={\n sizes ?? (isFullImage || isMinimal ? PRODUCT_WIDE_IMAGE_SIZES : PRODUCT_IMAGE_SIZES)\n }\n srcSetWidths={PRODUCT_IMAGE_SRCSET_WIDTHS}\n aspectRatio=\"1/1\"\n priority={imagePriority}\n />\n {!isFullImage && !isMinimal && getProductBadge()}\n </a>\n {isFullImage && (\n <a href={product.url} aria-label={product.name} className=\"s-product-card-overlay\" />\n )}\n {!isHorizontal && !isFullImage && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n <div className=\"s-product-card-content\">\n {/* Special card: quantity pie */}\n {isSpecial && product?.quantity && (\n <div className=\"s-product-card-content-pie\">\n <span>\n <b>{formatNumber(product.quantity)}</b>\n {t('pages.products.remained', 'Remained')}\n </span>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-2 -1 36 34\"\n className=\"s-product-card-content-pie-svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n )}\n\n <div\n className={`s-product-card-content-main ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n <h3 className=\"s-product-card-content-title\">\n <a href={product.url}>{product.name}</a>\n </h3>\n {product.subtitle && !isMinimal && (\n <p className=\"s-product-card-content-subtitle opacity-80\">{product.subtitle}</p>\n )}\n </div>\n\n <div\n className={`s-product-card-content-sub ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n {!product?.donation?.can_donate && getProductPrice()}\n {product.rating?.stars && (\n <div className=\"s-product-card-rating\">\n <i className=\"sicon-star2 text-orange-300\" />\n <span>{product.rating.stars}</span>\n </div>\n )}\n </div>\n\n {!withoutAddButton && (\n <div className=\"s-product-card-content-footer gap-2\">\n <SallaAddProductButton\n ref={addButtonRef}\n fill=\"outline\"\n width=\"wide\"\n productId={product.id}\n productStatus={addButtonStatus}\n productType={product.type}\n hasPreOrder={product.has_preorder_campaign}\n />\n {(isHorizontal || isFullImage) && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n )}\n </div>\n </div>\n );\n});\n\nexport const ProductCard = memo(function ProductCard(props: ProductCardProps) {\n const Component = useMemo(() => {\n const hasOverride = registry.getOriginal<ProductCardProps>(PRODUCT_CARD_KEY) !== null;\n if (hasOverride) {\n return registry.resolve<ProductCardProps>(PRODUCT_CARD_KEY);\n }\n return null;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductCardContent {...props} />;\n});\n\nexport default ProductCard;\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/product/ProductCard.tsx"],"names":["ProductCardContent","ProductCard"],"mappings":";;;;;;;;;;;;;AAcA,IAAM,gBAAA,GAAmB,cAAA;AAEzB,IAAM,2BAAA,GAA8B,CAAC,GAAA,EAAK,GAAA,EAAK,KAAK,GAAG,CAAA;AAEvD,IAAM,mBAAA,GAAsB,+BAAA;AAE5B,IAAM,wBAAA,GAA2B,iCAAA;AAoCjC,IAAM,kBAAA,GAAqB,IAAA,CAAK,SAASA,mBAAAA,CAAmB;AAAA,EAC1D,OAAA;AAAA,EACA,MAAA,GAAS,UAAA;AAAA,EACT,SAAA,GAAY,EAAA;AAAA,EACZ,UAAA,GAAa,KAAA;AAAA,EACb,YAAA,GAAe,KAAA;AAAA,EACf,gBAAA,GAAmB,KAAA;AAAA,EACnB,KAAA,GAAQ,CAAA;AAAA,EACR,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AAAA;AAAA,GACF;AAEJ,CAAC,CAAA;AAEM,IAAM,WAAA,GAAc,IAAA,CAAK,SAASC,YAAAA,CAAY,KAAA,EAAyB;AAC5E,EAAA,MAAM,SAAA,GAAY,QAAQ,MAAM;AAC9B,IAAA,MAAM,WAAA,GAAc,QAAA,CAAS,WAAA,CAA8B,gBAAgB,CAAA,KAAM,IAAA;AACjF,IAAA,IAAI,WAAA,EAAa;AACf,MAAA,OAAO,QAAA,CAAS,QAA0B,gBAAgB,CAAA;AAAA,IAC5D;AACA,IAAA,OAAO,IAAA;AAAA,EACT,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,IAAI,SAAA,EAAW;AACb,IAAA,uBAAO,GAAA,CAAC,SAAA,EAAA,EAAW,GAAG,KAAA,EAAO,CAAA;AAAA,EAC/B;AAEA,EAAA,uBAAO,GAAA,CAAC,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CAAA;AACxC,CAAC","file":"chunk-KQXF6MCM.js","sourcesContent":["import { memo, useCallback, useMemo } from 'react';\nimport { SallaAddProductButton } from '@salla.sa/twilight-components-react/add-product-button';\nimport { SallaButton } from '@salla.sa/twilight-components-react/button';\nimport { useHostAttributes } from '@salla.sa/twilight-theme-engine/hooks/useHostAttributes';\nimport { useMoney } from '../../hooks/useMoney';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useWishlist } from '../../hooks/useWishlist';\nimport { useAsset } from '../../hooks/useAsset';\nimport { useNumber } from '../../hooks/useNumber';\nimport { registry } from '../ComponentRegistry';\nimport { Image } from '../common';\nimport type { Product } from '../../types';\n\nconst PRODUCT_CARD_KEY = 'product:card';\n\nconst PRODUCT_IMAGE_SRCSET_WIDTHS = [150, 300, 450, 600] as const;\n/** Matches `.s-products-list-vertical-cards`: 2-col below 768px, 4-col above. */\nconst PRODUCT_IMAGE_SIZES = '(min-width: 768px) 25vw, 50vw';\n/** fullImage / minimal slots in FeaturedProductsStyle3 (`lg:grid-cols-2`). */\nconst PRODUCT_WIDE_IMAGE_SIZES = '(min-width: 1024px) 50vw, 100vw';\n\n/** Product card layout variants - mutually exclusive */\nexport type ProductCardLayout = 'vertical' | 'horizontal' | 'fullImage' | 'minimal' | 'special';\n\nexport interface ProductCardProps {\n product: Product;\n layout?: ProductCardLayout;\n className?: string;\n withShadow?: boolean;\n withQuantity?: boolean;\n withoutAddButton?: boolean;\n index?: number;\n imagePriority?: boolean;\n /** Overrides the layout-based image `sizes` hint. */\n sizes?: string;\n}\n\n/**\n * ProductCard - Displays a product in various layouts\n *\n * Layouts:\n * - vertical: Default card with image top, content bottom\n * - horizontal: Side-by-side image and content\n * - fullImage: Full bleed image with overlay content\n * - minimal: Compact version with reduced info\n * - special: Featured card with quantity pie chart\n *\n * Features:\n * - Native lazy loading for images\n * - Product badges (promotion, preorder, quantity, out of stock)\n * - Wishlist toggle button\n * - Price display (sale, starting, regular)\n * - Rating display\n * - Add to cart button via SallaAddProductButton (handles labels internally)\n */\nconst ProductCardContent = memo(function ProductCardContent({\n product,\n layout = 'vertical',\n className = '',\n withShadow = false,\n withQuantity = false,\n withoutAddButton = false,\n index = 0,\n imagePriority = false,\n sizes,\n}: ProductCardProps) {\n const { format } = useMoney();\n const { t } = useTranslation();\n const { store, theme } = useTwilight();\n const wishlist = useWishlist();\n const { isPlaceholder } = useAsset();\n const { format: formatNumber } = useNumber();\n\n // Out-of-stock cards offer \"notify me when available\" instead of a dead button, unless\n // the merchant switched `notify_when_available_in_card` off (Twig theme-raed parity).\n const notifyInCard = theme?.settings?.notify_when_available_in_card !== false;\n const addButtonStatus =\n notifyInCard &&\n product.is_out_of_stock &&\n product.type !== 'donating' &&\n product.type !== 'financial_support'\n ? 'out-and-notify'\n : product.status;\n\n const addButtonRef = useHostAttributes({ fill: 'outline', width: 'wide' });\n\n // Layout flags\n const isVertical = layout === 'vertical';\n const isHorizontal = layout === 'horizontal';\n const isFullImage = layout === 'fullImage';\n const isMinimal = layout === 'minimal';\n const isSpecial = layout === 'special';\n\n // Wishlist status\n const productInWishlist = wishlist.has(Number(product.id));\n const handleWishlistToggle = useCallback(() => {\n wishlist.toggle(Number(product.id));\n }, [wishlist, product.id]);\n\n // Get image fit type from store settings\n const fitImageHeight = store?.settings?.product?.fit_type;\n\n // Product badge component\n const getProductBadge = () => {\n if (product?.preorder?.label && typeof product.preorder.label === 'string') {\n return <div className=\"s-product-card-promotion-title\">{product.preorder.label}</div>;\n }\n if (product.promotion_title) {\n return <div className=\"s-product-card-promotion-title\">{product.promotion_title}</div>;\n }\n if (withQuantity && product?.quantity) {\n const formattedQty = formatNumber(product.quantity);\n return (\n <div className=\"s-product-card-quantity\">\n {t('pages.products.remained', 'Remained')} {formattedQty}\n </div>\n );\n }\n if (withQuantity && product?.is_out_of_stock) {\n return (\n <div className=\"s-product-card-out-badge\">\n {t('pages.products.out_of_stock', 'Out of Stock')}\n </div>\n );\n }\n return null;\n };\n\n // Price display component\n const getProductPrice = () => {\n if (product.is_on_sale && product.sale_price) {\n return (\n <div className=\"s-product-card-sale-price\">\n <h4>{format(product.sale_price)}</h4>\n {product.regular_price && <span>{format(product.regular_price)}</span>}\n </div>\n );\n }\n if (product.starting_price) {\n return (\n <div className=\"s-product-card-starting-price\">\n <p>{t('pages.products.starting_price', 'Starting from')}</p>\n <h4>{format(product.starting_price)}</h4>\n </div>\n );\n }\n return <h4 className=\"s-product-card-price\">{format(product.price)}</h4>;\n };\n\n // Build card class names\n const cardClassName = [\n 's-product-card',\n 's-product-card-entry',\n isVertical ? 's-product-card-vertical' : '',\n isHorizontal ? 's-product-card-horizontal' : '',\n // As Twig's card: the store's unified image height sizes horizontal cards too.\n fitImageHeight && (isVertical || isHorizontal) ? `s-product-card-fit-height` : '',\n isSpecial ? 's-product-card-special' : '',\n isFullImage ? 's-product-card-full-image' : '',\n isMinimal ? 's-product-card-minimal' : '',\n product?.donation ? 's-product-card-donation' : '',\n withShadow ? 's-product-card-shadow' : '',\n product?.is_out_of_stock ? 's-product-card-out-of-stock' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n // Image fit class\n const isProductPlaceholder = isPlaceholder(product.image?.url);\n const imageFitClass = isProductPlaceholder ? 'contain' : fitImageHeight || 'cover';\n\n return (\n <div\n id={`product-card-${product.id}`}\n className={cardClassName}\n data-product-id={product.id}\n style={{\n animationDelay: `${index * 100}ms`,\n }}\n >\n <div className={isFullImage ? 's-product-card-image-full' : 's-product-card-image'}>\n <a href={product.url} aria-label={product.image?.alt || product.name}>\n <Image\n className={`s-product-card-image-${imageFitClass}`}\n src={product.image?.url}\n alt={product.image?.alt ?? product.name}\n width={300}\n height={300}\n sizes={\n sizes ?? (isFullImage || isMinimal ? PRODUCT_WIDE_IMAGE_SIZES : PRODUCT_IMAGE_SIZES)\n }\n srcSetWidths={PRODUCT_IMAGE_SRCSET_WIDTHS}\n aspectRatio=\"1/1\"\n priority={imagePriority}\n />\n {!isFullImage && !isMinimal && getProductBadge()}\n </a>\n {isFullImage && (\n <a href={product.url} aria-label={product.name} className=\"s-product-card-overlay\" />\n )}\n {!isHorizontal && !isFullImage && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n <div className=\"s-product-card-content\">\n {/* Special card: quantity pie */}\n {isSpecial && product?.quantity && (\n <div className=\"s-product-card-content-pie\">\n <span>\n <b>{formatNumber(product.quantity)}</b>\n {t('pages.products.remained', 'Remained')}\n </span>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-2 -1 36 34\"\n className=\"s-product-card-content-pie-svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n )}\n\n <div\n className={`s-product-card-content-main ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n <h3 className=\"s-product-card-content-title\">\n <a href={product.url}>{product.name}</a>\n </h3>\n {product.subtitle && !isMinimal && (\n <p className=\"s-product-card-content-subtitle opacity-80\">{product.subtitle}</p>\n )}\n </div>\n\n <div\n className={`s-product-card-content-sub ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n {!product?.donation?.can_donate && getProductPrice()}\n {product.rating?.stars && (\n <div className=\"s-product-card-rating\">\n <i className=\"sicon-star2 text-orange-300\" />\n <span>{product.rating.stars}</span>\n </div>\n )}\n </div>\n\n {!withoutAddButton && (\n <div className=\"s-product-card-content-footer gap-2\">\n <SallaAddProductButton\n ref={addButtonRef}\n fill=\"outline\"\n width=\"wide\"\n productId={product.id}\n productStatus={addButtonStatus}\n productType={product.type}\n hasPreOrder={product.has_preorder_campaign}\n />\n {(isHorizontal || isFullImage) && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n )}\n </div>\n </div>\n );\n});\n\nexport const ProductCard = memo(function ProductCard(props: ProductCardProps) {\n const Component = useMemo(() => {\n const hasOverride = registry.getOriginal<ProductCardProps>(PRODUCT_CARD_KEY) !== null;\n if (hasOverride) {\n return registry.resolve<ProductCardProps>(PRODUCT_CARD_KEY);\n }\n return null;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductCardContent {...props} />;\n});\n\nexport default ProductCard;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { dispatchProductsFetched } from './chunk-
|
|
2
|
-
import { product } from './chunk-
|
|
1
|
+
import { dispatchProductsFetched } from './chunk-NLDPRPNY.js';
|
|
2
|
+
import { product } from './chunk-BSTMWSRC.js';
|
|
3
3
|
import { onSallaEvent } from './chunk-MJHYGAN3.js';
|
|
4
4
|
import { useState, useEffect, useCallback } from 'react';
|
|
5
5
|
|
|
@@ -71,5 +71,5 @@ function useAppliedFilters(source, sort, enabled) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
export { parseFiltersFromSearch, useAppliedFilters };
|
|
74
|
-
//# sourceMappingURL=chunk-
|
|
75
|
-
//# sourceMappingURL=chunk-
|
|
74
|
+
//# sourceMappingURL=chunk-KWD4W7E3.js.map
|
|
75
|
+
//# sourceMappingURL=chunk-KWD4W7E3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/routes/product-listing/useAppliedFilters.ts"],"names":[],"mappings":";;;;;AAYA,IAAM,8BAAc,IAAI,GAAA,CAAI,CAAC,WAAA,EAAa,aAAA,EAAe,WAAW,CAAC,CAAA;AAW9D,SAAS,uBAAuB,MAAA,EAA2C;AAChF,EAAA,MAAM,GAAA,mBAAY,MAAA,CAAO,MAAA,CAAO,IAAI,CAAA;AACpC,EAAA,IAAI,gBAAgB,MAAM,CAAA,CAAE,OAAA,CAAQ,CAAC,OAAO,MAAA,KAAW;AACrD,IAAA,IAAI,CAAC,MAAA,CAAO,UAAA,CAAW,UAAU,CAAA,EAAG;AACpC,IAAA,MAAM,IAAA,GAAO,CAAC,GAAG,MAAA,CAAO,QAAA,CAAS,eAAe,CAAC,CAAA,CAAE,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAE,CAAC,CAAC,CAAA;AAClE,IAAA,MAAM,MAAA,GAAS,IAAA,CAAK,IAAA,CAAK,MAAA,GAAS,CAAC,CAAA,KAAM,EAAA;AACzC,IAAA,MAAM,OAAO,MAAA,GAAS,IAAA,CA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AA;AAE5D,EAAA,IAAI,CAAC,OAAA,EAAS,OAAO,EAAE,OAAA,EAAS,IAAA,EAAM,IAAA,EAAM,IAAA,EAAM,QAAA,EAAU,IAAA,EAAM,MAAA,EAAQ,MAAA,EAAQ,KAAA,EAAM;AAExF,EAAA,MAAM,IAAA,GAAO,MAAA,EAAQ,GAAA,KAAQ,GAAA,GAAM,OAAO,IAAA,GAAO,IAAA;AACjD,EAAA,MAAM,MAAA,GAA+B,IAAA,GAAO,OAAA,GAAU,SAAA,KAAc,MAAM,OAAA,GAAU,SAAA;AACpF,EAAA,OAAO,EAAE,SAAS,IAAA,EAAM,QAAA,EAAU,QAAQ,IAAA,IAAQ,IAAA,EAAM,QAAQ,KAAA,EAAM;AACxE","file":"chunk-KWD4W7E3.js","sourcesContent":["import { useCallback, useEffect, useState } from 'react';\nimport { product } from '../../api/product';\nimport type { ProductListFilters } from '../../api/product';\nimport type { Product } from '../../types';\nimport type { ProductListLoaderData } from './types';\nimport { onSallaEvent } from '../../utils/sdk-helpers';\nimport { dispatchProductsFetched } from '../../utils/sdk-events';\n\ntype Source = ProductListLoaderData['source'];\ntype Node = Record<string, unknown>;\n\n/** Path segments that would reach the shared prototype chain if used as object keys. */\nconst UNSAFE_KEYS = new Set(['__proto__', 'constructor', 'prototype']);\n\n/**\n * Reads the `filters[...]` selection `<salla-filters>` writes to the address bar\n * (`filters[k]=v`, `filters[k][]=v`, `filters[k][sub]=v`) back into an object, so a\n * filtered link can be opened directly.\n *\n * The keys come straight from the URL, so nodes are null-prototype objects and any\n * `__proto__` / `constructor` / `prototype` segment drops the whole entry — a crafted\n * `?filters[__proto__][x]=1` must never reach `Object.prototype`.\n */\nexport function parseFiltersFromSearch(search: string): ProductListFilters | null {\n const out: Node = Object.create(null);\n new URLSearchParams(search).forEach((value, rawKey) => {\n if (!rawKey.startsWith('filters[')) return;\n const path = [...rawKey.matchAll(/\\[([^\\]]*)\\]/g)].map((m) => m[1]);\n const isList = path[path.length - 1] === '';\n const keys = isList ? path.slice(0, -1) : path;\n if (!keys.length || keys.includes('') || keys.some((key) => UNSAFE_KEYS.has(key))) return;\n\n let node = out;\n keys.slice(0, -1).forEach((key) => {\n const existing = node[key];\n if (typeof existing !== 'object' || existing === null || Array.isArray(existing)) {\n node[key] = Object.create(null);\n }\n node = node[key] as Node;\n });\n const leaf = keys[keys.length - 1];\n if (isList) {\n node[leaf] = [...(Array.isArray(node[leaf]) ? (node[leaf] as string[]) : []), value];\n } else {\n node[leaf] = value;\n }\n });\n return Object.keys(out).length ? (out as ProductListFilters) : null;\n}\n\ninterface FilteredPage {\n items: Product[];\n next: string | null;\n}\n\nexport type AppliedFiltersStatus = 'idle' | 'loading' | 'ready' | 'error';\n\n/**\n * Applies the `<salla-filters>` selection to the product list.\n *\n * The filters component only rewrites the address bar (`history.pushState`, invisible\n * to the router) and emits `salla-filters::changed`; nothing re-queries the list, so\n * the route's loader output — fetched without filters — kept showing. This listens\n * for that event (and for a filtered URL on first load) and fetches the first page\n * with the selection.\n *\n * Each fetched page is stored with the selection that produced it, so `page` is only\n * ever the page for the *current* selection. Until it arrives `status` is `loading`\n * (and `lastPage` is the previous selection's page, for a dimmed placeholder); if the\n * request fails `status` is `error` and `retry` re-runs it — the old products never\n * pass for the new selection.\n */\nexport function useAppliedFilters(\n source: Source,\n sort: string,\n enabled: boolean\n): {\n filters: ProductListFilters | null;\n page: FilteredPage | null;\n lastPage: FilteredPage | null;\n status: AppliedFiltersStatus;\n retry: () => void;\n} {\n const [filters, setFilters] = useState<ProductListFilters | null>(null);\n const [result, setResult] = useState<{ key: string; page: FilteredPage } | null>(null);\n const [failedKey, setFailedKey] = useState<string | null>(null);\n const [attempt, setAttempt] = useState(0);\n\n useEffect(() => {\n if (!enabled) return;\n setFilters(parseFiltersFromSearch(window.location.search));\n const onChanged = (...args: unknown[]) => {\n const next = args[0] as ProductListFilters | undefined;\n setFilters(next && Object.keys(next).length ? { ...next } : null);\n };\n return onSallaEvent('salla-filters::changed', onChanged);\n }, [enabled, source.type, source.value]);\n\n const key = filters ? JSON.stringify([source.type, source.value, sort, filters]) : '';\n\n useEffect(() => {\n if (!filters) return;\n const controller = new AbortController();\n setFailedKey(null);\n product\n .list({\n source: source.type,\n sourceValue: source.value,\n sort,\n filterable: true,\n filters,\n signal: controller.signal,\n })\n .then((res) => {\n setResult({ key, page: { items: res.items, next: res.next } });\n dispatchProductsFetched(res, source);\n })\n .catch(() => {\n // Aborted by a newer selection (its own effect run owns the state now), or failed.\n if (!controller.signal.aborted) setFailedKey(key);\n });\n return () => controller.abort();\n // `key` already encodes filters + source + sort.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [key, attempt]);\n\n const retry = useCallback(() => setAttempt((n) => n + 1), []);\n\n if (!filters) return { filters: null, page: null, lastPage: null, status: 'idle', retry };\n\n const page = result?.key === key ? result.page : null;\n const status: AppliedFiltersStatus = page ? 'ready' : failedKey === key ? 'error' : 'loading';\n return { filters, page, lastPage: result?.page ?? null, status, retry };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { api } from './chunk-
|
|
1
|
+
import { api } from './chunk-HM3NZ3PK.js';
|
|
2
2
|
import { queryOptions } from '@tanstack/react-query';
|
|
3
3
|
|
|
4
4
|
var notification = {
|
|
@@ -24,5 +24,5 @@ var notification = {
|
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export { notification };
|
|
27
|
-
//# sourceMappingURL=chunk-
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
27
|
+
//# sourceMappingURL=chunk-LBSFM7OG.js.map
|
|
28
|
+
//# sourceMappingURL=chunk-LBSFM7OG.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/notification.ts"],"names":[],"mappings":";;;AAcO,IAAM,YAAA,GAAe;AAAA,EAC1B,MAAM,YAAgD;AACpD,IAAA,MAAM,WAAW,MAAM,GAAA,CACpB,GAAA,CAAI,eAAe,EACnB,IAAA,EAAmF;AACtF,IAA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P,IAAA,EAAM,MACJ,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,eAAA,EAAiB,MAAM,CAAA;AAAA,MAClC,OAAA,EAAS,MAAM,YAAA,CAAa,IAAA;AAAK,KAClC;AAAA;AAEP","file":"chunk-LBSFM7OG.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type { Notification } from '../routes/account/notifications/types';\n\nexport interface NotificationsListResponse {\n data: Notification[];\n cursor: {\n current: number;\n previous: number | null;\n next: number | null;\n count: number;\n };\n}\n\nexport const notification = {\n list: async (): Promise<NotificationsListResponse> => {\n const response = await api\n .get('notifications')\n .json<{ data: Notification[] | null; cursor: NotificationsListResponse['cursor'] }>();\n return {\n data: response.data ?? [],\n cursor: response.cursor,\n };\n },\n\n markAsRead: async (id: number): Promise<void> => {\n await api.put(`notifications/${id}/read`).json();\n },\n\n markAllAsRead: async (): Promise<void> => {\n await api.put('notifications/read-all').json();\n },\n\n queries: {\n list: () =>\n queryOptions({\n queryKey: ['notifications', 'list'],\n queryFn: () => notification.list(),\n }),\n },\n};\n"]}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
+
import { Footer } from './chunk-RL7ALP55.js';
|
|
1
2
|
import { getModelContext } from './chunk-Q77J3D2W.js';
|
|
2
|
-
import { Header } from './chunk-
|
|
3
|
-
import { Footer } from './chunk-HOGOSY2M.js';
|
|
4
|
-
import { resolveTwilightSdkUrl, TICKETING_SCRIPT_URL } from './chunk-SSMWXIAE.js';
|
|
3
|
+
import { Header } from './chunk-DJCEAHHJ.js';
|
|
5
4
|
import { editorFrame, previewTheme, postToEditor, FRAME_LOADED_ACTION } from './chunk-YL6X3ZMG.js';
|
|
6
|
-
import {
|
|
7
|
-
import { apps } from './chunk-STS64QGN.js';
|
|
5
|
+
import { resolveTwilightSdkUrl, TICKETING_SCRIPT_URL } from './chunk-HLZRPN4K.js';
|
|
8
6
|
import { color } from './chunk-VVZNW5CB.js';
|
|
9
7
|
import { applyThemeHookSlots, installAppScope } from './chunk-SY7ESZ44.js';
|
|
8
|
+
import { useDevSettingsOverrides, useDevReportSettingsFetchedAt } from './chunk-ZCRSCOJF.js';
|
|
9
|
+
import { apps } from './chunk-OMVKE2IU.js';
|
|
10
10
|
import { withOwnerMaintenanceButton, withoutMaintenanceOnPreviewHost } from './chunk-LK643DPN.js';
|
|
11
|
-
import { useLocation, useIsHome, NavigationInterceptor } from './chunk-
|
|
12
|
-
import { useUser } from './chunk-
|
|
11
|
+
import { useLocation, useIsHome, NavigationInterceptor } from './chunk-ZXQPSVNT.js';
|
|
12
|
+
import { useUser } from './chunk-B6RR3L4M.js';
|
|
13
13
|
import { DocumentClassProvider, useDocumentClass } from './chunk-JWXJPJBO.js';
|
|
14
14
|
import { WidgetHead } from './chunk-V2ZDTY6H.js';
|
|
15
15
|
import { HookSlot } from './chunk-5XDPAKF5.js';
|
|
16
16
|
import { hookRegistry } from './chunk-GCPEMNSU.js';
|
|
17
|
-
import { getActiveCurrency, ENGINE_VERSION } from './chunk-
|
|
17
|
+
import { getActiveCurrency, ENGINE_VERSION } from './chunk-HM3NZ3PK.js';
|
|
18
18
|
import { useTranslation, I18nProvider } from './chunk-TYNZ5B2B.js';
|
|
19
19
|
import { Toaster } from './chunk-3VII4U2I.js';
|
|
20
20
|
import { isNativeApp } from './chunk-UB22F4FC.js';
|
|
@@ -352,16 +352,16 @@ function useWebMcpSupported() {
|
|
|
352
352
|
}
|
|
353
353
|
var navigationSetups = {
|
|
354
354
|
tanstack: lazyComponent(
|
|
355
|
-
() => import('./navigation-
|
|
355
|
+
() => import('./navigation-4LOHWQGM.js').then((m) => ({ default: m.NavigationSetup }))
|
|
356
356
|
),
|
|
357
357
|
// Not preloaded with the rest: a TanStack worker would load Next.js code it never runs.
|
|
358
|
-
nextjs: lazy(() => import('./navigation-
|
|
358
|
+
nextjs: lazy(() => import('./navigation-T7FYXSFZ.js').then((m) => ({ default: m.NavigationSetup })))
|
|
359
359
|
};
|
|
360
360
|
|
|
361
361
|
// src/providers/DocumentSyncRegistry.ts
|
|
362
362
|
var routeDocumentSyncs = {
|
|
363
363
|
tanstack: lazyComponent(
|
|
364
|
-
() => import('./document-class-
|
|
364
|
+
() => import('./document-class-55FY3P3P.js').then((m) => ({
|
|
365
365
|
default: m.TanStackDocumentSync
|
|
366
366
|
}))
|
|
367
367
|
)
|
|
@@ -874,7 +874,7 @@ function injectFastCheckoutScript() {
|
|
|
874
874
|
document.head.appendChild(s);
|
|
875
875
|
}
|
|
876
876
|
var GoogleTagBody = lazyComponent(
|
|
877
|
-
() => import('./GoogleTag-
|
|
877
|
+
() => import('./GoogleTag-PBB7MERI.js').then((m) => ({ default: m.GoogleTagBody }))
|
|
878
878
|
);
|
|
879
879
|
var TwilightBundles = lazyComponent(
|
|
880
880
|
() => import('./TwilightBundles-G6GHWBID.js').then((m) => ({ default: m.TwilightBundles }))
|
|
@@ -883,7 +883,7 @@ var LazySiftSnippet = lazyComponent(
|
|
|
883
883
|
() => import('./SiftSnippet-5FCU6TR6.js').then((m) => ({ default: m.SiftSnippet }))
|
|
884
884
|
);
|
|
885
885
|
var LazyStoreClosedNotification = lazyComponent(
|
|
886
|
-
() => import('./StoreClosedNotification-
|
|
886
|
+
() => import('./StoreClosedNotification-JZPC2QBU.js').then((m) => ({
|
|
887
887
|
default: m.StoreClosedNotification
|
|
888
888
|
}))
|
|
889
889
|
);
|
|
@@ -1129,7 +1129,7 @@ function SallaSdkScripts({ settings }) {
|
|
|
1129
1129
|
|
|
1130
1130
|
// src/components/store/lazy.ts
|
|
1131
1131
|
var LazyStoreClosedNotification2 = lazyComponent(
|
|
1132
|
-
() => import('./StoreClosedNotification-
|
|
1132
|
+
() => import('./StoreClosedNotification-JZPC2QBU.js').then((m) => ({
|
|
1133
1133
|
default: m.StoreClosedNotification
|
|
1134
1134
|
}))
|
|
1135
1135
|
);
|
|
@@ -1199,7 +1199,7 @@ function LiveEditor() {
|
|
|
1199
1199
|
if (!frame) return null;
|
|
1200
1200
|
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyLiveEditorBar, { origin: frame.origin, dev: frame.dev }) });
|
|
1201
1201
|
}
|
|
1202
|
-
var LazyWebMcpTools = React2.lazy(() => import('./WebMcpTools-
|
|
1202
|
+
var LazyWebMcpTools = React2.lazy(() => import('./WebMcpTools-RLOEVV2L.js'));
|
|
1203
1203
|
var getSalla2 = () => typeof window !== "undefined" ? window.salla : void 0;
|
|
1204
1204
|
var TWILIGHT_LOG_STYLES = {
|
|
1205
1205
|
header: "background: linear-gradient(90deg, #7c3aed, #6366f1); color: white; padding: 4px 8px; border-radius: 4px; font-weight: bold;",
|
|
@@ -1488,5 +1488,5 @@ function useStore() {
|
|
|
1488
1488
|
}
|
|
1489
1489
|
|
|
1490
1490
|
export { LazyMaintenancePage, LazyStoreClosedNotification2 as LazyStoreClosedNotification, MasterLayout, TwilightProvider, fastCheckoutScript, registerDefaultHooks, registerDocumentSync, routeDocumentSyncs, useBreadcrumbs, useDate, useGtm, useMoney, useNumber, useOpeningHours, usePageConfig, useStore };
|
|
1491
|
-
//# sourceMappingURL=chunk-
|
|
1492
|
-
//# sourceMappingURL=chunk-
|
|
1491
|
+
//# sourceMappingURL=chunk-MB7EKG6E.js.map
|
|
1492
|
+
//# sourceMappingURL=chunk-MB7EKG6E.js.map
|