@salla.sa/twilight-theme-engine 1.0.106 → 1.0.108
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-DQ3VNTFE.js → AddToCartForm-CF4H32X7.js} +3 -3
- package/dist/{AddToCartForm-DQ3VNTFE.js.map → AddToCartForm-CF4H32X7.js.map} +1 -1
- package/dist/{BlogAuthorPage-DSFZ6OLA.js → BlogAuthorPage-LHYDUFDA.js} +27 -27
- package/dist/{BlogAuthorPage-DSFZ6OLA.js.map → BlogAuthorPage-LHYDUFDA.js.map} +1 -1
- package/dist/{BlogCategoryPage-AD5LV4R3.js → BlogCategoryPage-6BORI4YG.js} +27 -27
- package/dist/{BlogCategoryPage-AD5LV4R3.js.map → BlogCategoryPage-6BORI4YG.js.map} +1 -1
- package/dist/{BlogPage-GXGSY6ET.js → BlogPage-TSRWNX6M.js} +25 -25
- package/dist/{BlogPage-GXGSY6ET.js.map → BlogPage-TSRWNX6M.js.map} +1 -1
- package/dist/{BlogSinglePage-KHF37HSX.js → BlogSinglePage-TLTW67S7.js} +25 -25
- package/dist/{BlogSinglePage-KHF37HSX.js.map → BlogSinglePage-TLTW67S7.js.map} +1 -1
- package/dist/{BlogTagPage-OSWZDEND.js → BlogTagPage-RAMP5XNR.js} +27 -27
- package/dist/{BlogTagPage-OSWZDEND.js.map → BlogTagPage-RAMP5XNR.js.map} +1 -1
- package/dist/{BrandsPage-T2AVCDET.js → BrandsPage-KUFEUFVZ.js} +26 -26
- package/dist/{BrandsPage-T2AVCDET.js.map → BrandsPage-KUFEUFVZ.js.map} +1 -1
- package/dist/{Breadcrumb-6CMWBRFH.js → Breadcrumb-ZS3ZMMTM.js} +25 -25
- package/dist/{Breadcrumb-6CMWBRFH.js.map → Breadcrumb-ZS3ZMMTM.js.map} +1 -1
- package/dist/{CartItem-SVR5WS4N.js → CartItem-7QCAQ3QQ.js} +25 -25
- package/dist/{CartItem-SVR5WS4N.js.map → CartItem-7QCAQ3QQ.js.map} +1 -1
- package/dist/{CartSummary-RCX2NAF5.js → CartSummary-ZPG7IAXE.js} +25 -25
- package/dist/{CartSummary-RCX2NAF5.js.map → CartSummary-ZPG7IAXE.js.map} +1 -1
- package/dist/{Copyright-N2V5LBLG.js → Copyright-VPJMIQSO.js} +3 -3
- package/dist/{Copyright-N2V5LBLG.js.map → Copyright-VPJMIQSO.js.map} +1 -1
- package/dist/{CustomerLayout-WHXOXK46.js → CustomerLayout-E5FYPKT4.js} +25 -25
- package/dist/{CustomerLayout-WHXOXK46.js.map → CustomerLayout-E5FYPKT4.js.map} +1 -1
- package/dist/{Footer-WWPE5TZT.js → Footer-GIPFBQEY.js} +4 -4
- package/dist/{Footer-WWPE5TZT.js.map → Footer-GIPFBQEY.js.map} +1 -1
- package/dist/Header-HYTNO4IR.js +22 -0
- package/dist/{Header-NXUFMN3V.js.map → Header-HYTNO4IR.js.map} +1 -1
- package/dist/{LoyaltyPage-DORPKRUO.js → LoyaltyPage-YMK7SISF.js} +25 -25
- package/dist/{LoyaltyPage-DORPKRUO.js.map → LoyaltyPage-YMK7SISF.js.map} +1 -1
- package/dist/{LoyaltyPointsPage-QFK6SI23.js → LoyaltyPointsPage-V2463UQ6.js} +9 -9
- package/dist/{LoyaltyPointsPage-QFK6SI23.js.map → LoyaltyPointsPage-V2463UQ6.js.map} +1 -1
- package/dist/{MainMenu-VV7XR3W3.js → MainMenu-IP6AVEIF.js} +8 -8
- package/dist/{MainMenu-VV7XR3W3.js.map → MainMenu-IP6AVEIF.js.map} +1 -1
- package/dist/MaintenancePage-Z34IQCUV.js +7 -0
- package/dist/{MaintenancePage-IKWAGFKU.js.map → MaintenancePage-Z34IQCUV.js.map} +1 -1
- package/dist/{MasterLayout-BCIRVCX5.js → MasterLayout-3YSR4VFQ.js} +25 -25
- package/dist/{MasterLayout-BCIRVCX5.js.map → MasterLayout-3YSR4VFQ.js.map} +1 -1
- package/dist/{MobileMenu-PYCT6V4P.js → MobileMenu-ZJLXCG4P.js} +26 -26
- package/dist/{MobileMenu-PYCT6V4P.js.map → MobileMenu-ZJLXCG4P.js.map} +1 -1
- package/dist/{NotificationsPage-6WNYAZOR.js → NotificationsPage-XKSW3DFD.js} +25 -25
- package/dist/{NotificationsPage-6WNYAZOR.js.map → NotificationsPage-XKSW3DFD.js.map} +1 -1
- package/dist/{OrderSinglePage-YV3LBB7I.js → OrderSinglePage-WSUNHCY6.js} +26 -26
- package/dist/{OrderSinglePage-YV3LBB7I.js.map → OrderSinglePage-WSUNHCY6.js.map} +1 -1
- package/dist/{OrdersPage-PPTYNBK2.js → OrdersPage-TAME5ACG.js} +25 -25
- package/dist/{OrdersPage-PPTYNBK2.js.map → OrdersPage-TAME5ACG.js.map} +1 -1
- package/dist/{PageSingle-JBRR5X3B.js → PageSingle-MYDLIP55.js} +7 -7
- package/dist/{PageSingle-JBRR5X3B.js.map → PageSingle-MYDLIP55.js.map} +1 -1
- package/dist/{ProductDetails-EGIMNYEY.js → ProductDetails-MFAKRQ72.js} +8 -8
- package/dist/{ProductDetails-EGIMNYEY.js.map → ProductDetails-MFAKRQ72.js.map} +1 -1
- package/dist/{ProfilePage-4NDLJCST.js → ProfilePage-4W7DBXLW.js} +25 -25
- package/dist/{ProfilePage-4NDLJCST.js.map → ProfilePage-4W7DBXLW.js.map} +1 -1
- package/dist/{ReviewsPage-IB3HTSSY.js → ReviewsPage-G3IEPOOO.js} +3 -3
- package/dist/{ReviewsPage-IB3HTSSY.js.map → ReviewsPage-G3IEPOOO.js.map} +1 -1
- package/dist/{SeoCartWidget-TZQUVTS7.js → SeoCartWidget-7UDOVSWP.js} +25 -25
- package/dist/{SeoCartWidget-TZQUVTS7.js.map → SeoCartWidget-7UDOVSWP.js.map} +1 -1
- package/dist/{SettingsPage-ZSN2P2XD.js → SettingsPage-TEMXC3OF.js} +25 -25
- package/dist/{SettingsPage-ZSN2P2XD.js.map → SettingsPage-TEMXC3OF.js.map} +1 -1
- package/dist/StoreClosedNotification-YMPBP56U.js +54 -0
- package/dist/{StoreClosedNotification-WJGHUXGJ.js.map → StoreClosedNotification-YMPBP56U.js.map} +1 -1
- package/dist/{TestimonialsPage-AF7EIJMK.js → TestimonialsPage-G2S3JQNT.js} +7 -7
- package/dist/{TestimonialsPage-AF7EIJMK.js.map → TestimonialsPage-G2S3JQNT.js.map} +1 -1
- package/dist/{ThankYouPage-NPUUJ4M6.js → ThankYouPage-HPF3PIAT.js} +25 -25
- package/dist/{ThankYouPage-NPUUJ4M6.js.map → ThankYouPage-HPF3PIAT.js.map} +1 -1
- package/dist/{WalletPage-5T7UBXH4.js → WalletPage-G7FOMHFX.js} +26 -26
- package/dist/{WalletPage-5T7UBXH4.js.map → WalletPage-G7FOMHFX.js.map} +1 -1
- package/dist/{WishlistPage-IYKIDZT2.js → WishlistPage-VULTU6K2.js} +27 -27
- package/dist/{WishlistPage-IYKIDZT2.js.map → WishlistPage-VULTU6K2.js.map} +1 -1
- package/dist/api/advertisement.js +5 -5
- package/dist/api/apps.js +5 -5
- package/dist/api/blog.js +7 -7
- package/dist/api/brands.js +7 -7
- package/dist/api/cart.js +7 -7
- package/dist/api/category.js +7 -7
- package/dist/api/client.js +4 -4
- package/dist/api/home.js +5 -5
- package/dist/api/loyalty.js +7 -7
- package/dist/api/menu.js +5 -5
- package/dist/api/notification.js +5 -5
- package/dist/api/order.js +7 -7
- package/dist/api/page.js +7 -7
- package/dist/api/product.js +7 -7
- package/dist/api/profile.js +4 -4
- package/dist/api/store.d.ts.map +1 -1
- package/dist/api/store.js +5 -5
- package/dist/api/translations.js +5 -5
- package/dist/api/user.js +5 -5
- package/dist/api/wallet.js +5 -5
- package/dist/api/wishlist.js +8 -8
- package/dist/{chunk-C5MQ6VWX.js → chunk-24UCMWQB.js} +3 -3
- package/dist/{chunk-C5MQ6VWX.js.map → chunk-24UCMWQB.js.map} +1 -1
- package/dist/{chunk-MSNU4NYS.js → chunk-2CL6AEO4.js} +3 -3
- package/dist/{chunk-MSNU4NYS.js.map → chunk-2CL6AEO4.js.map} +1 -1
- package/dist/{chunk-HGKAIIAJ.js → chunk-2IW3JRWL.js} +4 -4
- package/dist/{chunk-HGKAIIAJ.js.map → chunk-2IW3JRWL.js.map} +1 -1
- package/dist/{chunk-UAKYRNUV.js → chunk-3DVAXIY3.js} +4 -4
- package/dist/{chunk-UAKYRNUV.js.map → chunk-3DVAXIY3.js.map} +1 -1
- package/dist/{chunk-OWJMPD7X.js → chunk-3NFVZJNI.js} +3 -3
- package/dist/{chunk-OWJMPD7X.js.map → chunk-3NFVZJNI.js.map} +1 -1
- package/dist/chunk-47C3MTZI.js +14 -0
- package/dist/{chunk-JJIXGYVN.js.map → chunk-47C3MTZI.js.map} +1 -1
- package/dist/{chunk-YSRKR5DE.js → chunk-4PT5MXGR.js} +4 -4
- package/dist/{chunk-YSRKR5DE.js.map → chunk-4PT5MXGR.js.map} +1 -1
- package/dist/{chunk-TYLJMWSI.js → chunk-5L37UNQQ.js} +6 -6
- package/dist/{chunk-TYLJMWSI.js.map → chunk-5L37UNQQ.js.map} +1 -1
- package/dist/{chunk-EL2IPQLA.js → chunk-5N74JJ2Z.js} +15 -15
- package/dist/{chunk-EL2IPQLA.js.map → chunk-5N74JJ2Z.js.map} +1 -1
- package/dist/{chunk-ZTH65CJY.js → chunk-6UG4IVUF.js} +23 -23
- package/dist/{chunk-ZTH65CJY.js.map → chunk-6UG4IVUF.js.map} +1 -1
- package/dist/{chunk-QUBQPGT7.js → chunk-A4NN6C5B.js} +14 -4
- package/dist/chunk-A4NN6C5B.js.map +1 -0
- package/dist/{chunk-YD4TVUA4.js → chunk-B2OJZKU4.js} +8 -8
- package/dist/{chunk-YD4TVUA4.js.map → chunk-B2OJZKU4.js.map} +1 -1
- package/dist/{chunk-4O52OV5N.js → chunk-BEMWHR4T.js} +3 -3
- package/dist/{chunk-4O52OV5N.js.map → chunk-BEMWHR4T.js.map} +1 -1
- package/dist/{chunk-STKR2KHL.js → chunk-BQ2MNEN7.js} +3 -3
- package/dist/{chunk-STKR2KHL.js.map → chunk-BQ2MNEN7.js.map} +1 -1
- package/dist/{chunk-LPAWMUJR.js → chunk-BR56OEPZ.js} +4 -4
- package/dist/{chunk-LPAWMUJR.js.map → chunk-BR56OEPZ.js.map} +1 -1
- package/dist/{chunk-5DWTU5KS.js → chunk-D42M66E4.js} +46 -7
- package/dist/chunk-D42M66E4.js.map +1 -0
- package/dist/{chunk-U3UY2BDN.js → chunk-D7XWUD6T.js} +4 -4
- package/dist/{chunk-U3UY2BDN.js.map → chunk-D7XWUD6T.js.map} +1 -1
- package/dist/{chunk-S6SP272Z.js → chunk-EHX45KZG.js} +3 -3
- package/dist/{chunk-S6SP272Z.js.map → chunk-EHX45KZG.js.map} +1 -1
- package/dist/{chunk-ZE262XHY.js → chunk-ENC6POPF.js} +4 -4
- package/dist/{chunk-ZE262XHY.js.map → chunk-ENC6POPF.js.map} +1 -1
- package/dist/{chunk-HGY7P2Y3.js → chunk-F6XPGONG.js} +5 -5
- package/dist/{chunk-HGY7P2Y3.js.map → chunk-F6XPGONG.js.map} +1 -1
- package/dist/{chunk-4H7HB3HQ.js → chunk-FQLF555I.js} +4 -4
- package/dist/{chunk-4H7HB3HQ.js.map → chunk-FQLF555I.js.map} +1 -1
- package/dist/{chunk-W2FFROOO.js → chunk-GFUXGVER.js} +3 -3
- package/dist/{chunk-W2FFROOO.js.map → chunk-GFUXGVER.js.map} +1 -1
- package/dist/{chunk-6W4J6ZDX.js → chunk-GKKHNGLI.js} +8 -8
- package/dist/{chunk-6W4J6ZDX.js.map → chunk-GKKHNGLI.js.map} +1 -1
- package/dist/{chunk-SU7NHAYA.js → chunk-GXZW6BJY.js} +3 -3
- package/dist/{chunk-SU7NHAYA.js.map → chunk-GXZW6BJY.js.map} +1 -1
- package/dist/{chunk-3EBV4X6W.js → chunk-HNSR4KLL.js} +3 -3
- package/dist/{chunk-3EBV4X6W.js.map → chunk-HNSR4KLL.js.map} +1 -1
- package/dist/{chunk-HG4B4F4N.js → chunk-JNAJTCJD.js} +8 -2
- package/dist/chunk-JNAJTCJD.js.map +1 -0
- package/dist/{chunk-VEA7QDNY.js → chunk-KSS7OA3Q.js} +3 -3
- package/dist/{chunk-VEA7QDNY.js.map → chunk-KSS7OA3Q.js.map} +1 -1
- package/dist/{chunk-QXX54X55.js → chunk-L4JI2AAL.js} +4 -4
- package/dist/{chunk-QXX54X55.js.map → chunk-L4JI2AAL.js.map} +1 -1
- package/dist/{chunk-XD33WKKI.js → chunk-LUFLN7WL.js} +7 -7
- package/dist/{chunk-XD33WKKI.js.map → chunk-LUFLN7WL.js.map} +1 -1
- package/dist/{chunk-RSWRKU4X.js → chunk-OHUTM224.js} +4 -4
- package/dist/{chunk-RSWRKU4X.js.map → chunk-OHUTM224.js.map} +1 -1
- package/dist/{chunk-76GCBYJX.js → chunk-OSSOU36J.js} +3 -3
- package/dist/{chunk-76GCBYJX.js.map → chunk-OSSOU36J.js.map} +1 -1
- package/dist/{chunk-U5TBXUQT.js → chunk-PTQVBPPN.js} +3 -3
- package/dist/{chunk-U5TBXUQT.js.map → chunk-PTQVBPPN.js.map} +1 -1
- package/dist/{chunk-5L6IBYWZ.js → chunk-QA4FBMFJ.js} +4 -4
- package/dist/{chunk-5L6IBYWZ.js.map → chunk-QA4FBMFJ.js.map} +1 -1
- package/dist/{chunk-2IS4QU3P.js → chunk-RA6ZTHN6.js} +4 -4
- package/dist/{chunk-2IS4QU3P.js.map → chunk-RA6ZTHN6.js.map} +1 -1
- package/dist/{chunk-25SLMOCZ.js → chunk-RBFLDI2Z.js} +4 -4
- package/dist/{chunk-25SLMOCZ.js.map → chunk-RBFLDI2Z.js.map} +1 -1
- package/dist/{chunk-BHV2RZWY.js → chunk-S5EVFWAL.js} +23 -13
- package/dist/chunk-S5EVFWAL.js.map +1 -0
- package/dist/{chunk-CTV5GA2U.js → chunk-SCRNQWZT.js} +4 -4
- package/dist/{chunk-CTV5GA2U.js.map → chunk-SCRNQWZT.js.map} +1 -1
- package/dist/{chunk-VJQ7SM4O.js → chunk-SQXUWX4B.js} +5 -5
- package/dist/{chunk-VJQ7SM4O.js.map → chunk-SQXUWX4B.js.map} +1 -1
- package/dist/{chunk-WLGTF3V4.js → chunk-T4BRWJSI.js} +7 -7
- package/dist/{chunk-WLGTF3V4.js.map → chunk-T4BRWJSI.js.map} +1 -1
- package/dist/{chunk-PSBXF3O5.js → chunk-T5VU67NQ.js} +4 -4
- package/dist/{chunk-PSBXF3O5.js.map → chunk-T5VU67NQ.js.map} +1 -1
- package/dist/{chunk-42YMCOK4.js → chunk-TWUOIBO7.js} +3 -3
- package/dist/{chunk-42YMCOK4.js.map → chunk-TWUOIBO7.js.map} +1 -1
- package/dist/{chunk-FQHNVD3H.js → chunk-U6KJ7XBO.js} +3 -3
- package/dist/{chunk-FQHNVD3H.js.map → chunk-U6KJ7XBO.js.map} +1 -1
- package/dist/{chunk-SDEBSX6Z.js → chunk-UKLYL5LM.js} +4 -4
- package/dist/{chunk-SDEBSX6Z.js.map → chunk-UKLYL5LM.js.map} +1 -1
- package/dist/{chunk-V7QFIGQ4.js → chunk-UWDUMPL7.js} +6 -6
- package/dist/{chunk-V7QFIGQ4.js.map → chunk-UWDUMPL7.js.map} +1 -1
- package/dist/{chunk-TWD4ECS3.js → chunk-UZGP2KFA.js} +3 -3
- package/dist/{chunk-TWD4ECS3.js.map → chunk-UZGP2KFA.js.map} +1 -1
- package/dist/{chunk-UWDS42UX.js → chunk-VUWBGAET.js} +4 -4
- package/dist/{chunk-UWDS42UX.js.map → chunk-VUWBGAET.js.map} +1 -1
- package/dist/{chunk-D2VMJV3L.js → chunk-W354TTIE.js} +6 -6
- package/dist/{chunk-D2VMJV3L.js.map → chunk-W354TTIE.js.map} +1 -1
- package/dist/{chunk-RCRE66QK.js → chunk-XL42DUCQ.js} +3 -3
- package/dist/{chunk-RCRE66QK.js.map → chunk-XL42DUCQ.js.map} +1 -1
- package/dist/{chunk-LBBPJM4K.js → chunk-Y464WYUT.js} +5 -5
- package/dist/{chunk-LBBPJM4K.js.map → chunk-Y464WYUT.js.map} +1 -1
- package/dist/{chunk-KTLQV4Q4.js → chunk-YDSWLCOY.js} +5 -5
- package/dist/{chunk-KTLQV4Q4.js.map → chunk-YDSWLCOY.js.map} +1 -1
- package/dist/{chunk-5Q3SDXVC.js → chunk-ZLLHL3NI.js} +7 -7
- package/dist/{chunk-5Q3SDXVC.js.map → chunk-ZLLHL3NI.js.map} +1 -1
- package/dist/{chunk-DMMGD4GW.js → chunk-ZVYJK6XQ.js} +5 -5
- package/dist/{chunk-DMMGD4GW.js.map → chunk-ZVYJK6XQ.js.map} +1 -1
- package/dist/components/cart/index.js +1 -1
- package/dist/components/common/index.js +1 -1
- package/dist/components/drawer/index.js +23 -23
- package/dist/components/home/FeaturedProductsStyle2.d.ts.map +1 -1
- package/dist/components/home/FixedProducts.d.ts.map +1 -1
- package/dist/components/home/index.js +27 -27
- package/dist/components/layout/index.js +7 -7
- package/dist/components/product/index.js +24 -24
- package/dist/components/store/index.js +25 -25
- package/dist/components/toast/index.js +5 -5
- package/dist/dev/editor/index.js +3 -3
- package/dist/dev/index.js +3 -3
- package/dist/document-class-B2MXKYAQ.js +29 -0
- package/dist/{document-class-JTMWALK3.js.map → document-class-B2MXKYAQ.js.map} +1 -1
- package/dist/hooks/index.js +23 -23
- package/dist/hooks/useComments.js +4 -4
- package/dist/hooks/useGtm.js +23 -23
- package/dist/hooks/useMoney.js +23 -23
- package/dist/hooks/useProduct.js +4 -4
- package/dist/hooks/useStore.js +23 -23
- package/dist/hooks/useUser.js +6 -6
- package/dist/hooks/useWishlist.js +4 -4
- package/dist/index.js +23 -23
- package/dist/native-app/index.d.ts +8 -0
- package/dist/native-app/index.d.ts.map +1 -1
- package/dist/native-app/index.js +4 -4
- package/dist/{navigation-6MDIVFMB.js → navigation-LSRNHKGJ.js} +8 -8
- package/dist/{navigation-6MDIVFMB.js.map → navigation-LSRNHKGJ.js.map} +1 -1
- package/dist/navigation-WASYQTFC.js +14 -0
- package/dist/{navigation-P3RDLBP7.js.map → navigation-WASYQTFC.js.map} +1 -1
- package/dist/{not-found-RLM7SV7P.js → not-found-M3ZPUVVC.js} +26 -26
- package/dist/{not-found-RLM7SV7P.js.map → not-found-M3ZPUVVC.js.map} +1 -1
- package/dist/providers/index.js +23 -23
- package/dist/routes/account/orders.js +8 -8
- package/dist/routes/account.js +17 -17
- package/dist/routes/blog.js +12 -12
- package/dist/routes/brands.js +8 -8
- package/dist/routes/cart.js +31 -31
- package/dist/routes/home.js +28 -28
- package/dist/routes/index.js +7 -7
- package/dist/routes/loyalty.js +9 -9
- package/dist/routes/page.js +8 -8
- package/dist/routes/product-listing.js +29 -29
- package/dist/routes/product.js +27 -27
- package/dist/routes/seo-redirects.js +7 -7
- package/dist/routes/testimonials.js +3 -3
- package/dist/routes/thank-you.js +8 -8
- package/dist/skeleton.js +28 -28
- package/dist/{store-lookup-7SAEE4L3.js → store-lookup-EW6ALPQF.js} +12 -12
- package/dist/{store-lookup-7SAEE4L3.js.map → store-lookup-EW6ALPQF.js.map} +1 -1
- package/dist/tanstack/middleware/twilight.d.ts.map +1 -1
- package/dist/tanstack.js +31 -21
- package/dist/tanstack.js.map +1 -1
- package/dist/twilight/context.d.ts +2 -0
- package/dist/twilight/context.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/index.js +6 -6
- package/dist/utils/native-app-headers.d.ts +12 -0
- package/dist/utils/native-app-headers.d.ts.map +1 -0
- package/dist/vite/index.js +3 -3
- package/package.json +1 -1
- package/tailwind/components/home/FeaturedProductsStyle2.tsx.txt +8 -2
- package/tailwind/components/home/FixedProducts.tsx.txt +9 -2
- package/dist/Header-NXUFMN3V.js +0 -22
- package/dist/MaintenancePage-IKWAGFKU.js +0 -7
- package/dist/StoreClosedNotification-WJGHUXGJ.js +0 -54
- package/dist/chunk-5DWTU5KS.js.map +0 -1
- package/dist/chunk-BHV2RZWY.js.map +0 -1
- package/dist/chunk-HG4B4F4N.js.map +0 -1
- package/dist/chunk-JJIXGYVN.js +0 -14
- package/dist/chunk-QUBQPGT7.js.map +0 -1
- package/dist/document-class-JTMWALK3.js +0 -29
- package/dist/navigation-P3RDLBP7.js +0 -14
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/tanstack/link.tsx","../src/tanstack/native-app-events.tsx","../src/utils/request-host.ts","../src/tanstack/navigation.tsx"],"names":["TanStackLink","tanstackNotFound","tanstackRedirect","useParams","jsx"],"mappings":";;;;;;;;;;;;AAWO,SAAS,mBAAA,CAAoB,aAAqB,MAAA,EAAiB;AACxE,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,WAAA,CAAY,UAAA,CAAW,GAAG,CAAA,IAAK,WAAA,CAAY,UAAA,CAAW,IAAI,CAAA,EAAG,OAAO,WAAA;AACpF,EAAA,MAAM,YAAA,GAAe,WAAA,CAAY,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,EAAG,KAAA,CAAM,MAAM,CAAA,CAAE,CAAC,CAAA;AAC/D,EAAA,IAAI,QAAA,CAAS,YAAY,CAAA,EAAG,OAAO,WAAA;AACnC,EAAA,OAAO,WAAA,KAAgB,MAAM,CAAA,CAAA,EAAI,MAAM,KAAK,CAAA,CAAA,EAAI,MAAM,GAAG,WAAW,CAAA,CAAA;AACtE;AAMO,IAAM,mBAAA,GAAsB,UAAA;AAAA,EACjC,CACE;AAAA,IACE,EAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA,EAAc,SAAA;AAAA,IACd,GAAG;AAAA,KAEL,GAAA,KACG;AACH,IAAA,MAAM,EAAE,MAAA,EAAO,GAAI,UAAU,EAAE,MAAA,EAAQ,OAAO,CAAA;AAC9C,I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AAC,mBAAgB,MAAA,EAAgB,CAAA;AAAA,oBACjCA,GAAAA,CAAC,YAAA,EAAA,EAAa,OAAA,EAAS,qBAAsB,QAAA,EAAS;AAAA,GAAA,EACxD,CAAA;AAEJ;AAGO,SAAS,0BAAA,CAA2B,EAAE,QAAA,EAAS,EAA4B;AAChF,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,uBACEA,GAAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAU,CAAC,EAAA,EAAY,IAAA,KAA2B,QAAA,CAAS,EAAE,EAAA,EAAI,OAAA,EAAS,IAAA,EAAM,OAAA,EAAS,CAAA;AAAA,MAEzF,QAAA,kBAAAA,GAAAA,CAAC,YAAA,EAAA,EAAa,OAAA,EAAS,qBAAsB,QAAA,EAAS;AAAA;AAAA,GACxD;AAEJ","file":"chunk-XD33WKKI.js","sourcesContent":["import { forwardRef, createElement } from 'react';\nimport { Link as TanStackLink, useParams } from '@tanstack/react-router';\nimport { isLocale } from '../providers/locale-constants';\nimport type { BaseLinkProps } from '../components/common/Link.types';\n\n/**\n * Routes live under an optional `/{-$locale}` param, so a bare `to=\"/brands\"`\n * resolves with the locale omitted and the $locale loader bounces the user to\n * the fallback locale. Prefix the current locale onto internal paths that\n * don't already carry one.\n */\nexport function localizeDestination(destination: string, locale?: string) {\n if (!locale || !destination.startsWith('/') || destination.startsWith('//')) return destination;\n const firstSegment = destination.split('/')[1]?.split(/[?#]/)[0];\n if (isLocale(firstSegment)) return destination;\n return destination === '/' ? `/${locale}` : `/${locale}${destination}`;\n}\n\n/**\n * TanStack Router Link adapter.\n * Translates framework-agnostic props to TanStack Router Link props.\n */\nexport const TanStackLinkAdapter = forwardRef<HTMLAnchorElement, BaseLinkProps>(\n (\n {\n to,\n href,\n children,\n className,\n style,\n title,\n target,\n rel,\n onClick,\n preload,\n replace,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref\n ) => {\n const { locale } = useParams({ strict: false }) as { locale?: string };\n const destination = localizeDestination(to ?? href ?? '/', locale);\n\n return createElement(\n TanStackLink,\n {\n ref,\n to: destination,\n className,\n style,\n title,\n target,\n rel,\n onClick,\n preload: preload === 'intent' || preload === false ? preload : undefined,\n replace,\n 'aria-label': ariaLabel,\n ...(rest as Record<string, unknown>),\n },\n children\n );\n }\n);\n\nTanStackLinkAdapter.displayName = 'TanStackLinkAdapter';\n\n/**\n * Create a TanStack Router Link adapter component.\n */\nexport function createTanStackLinkAdapter() {\n return TanStackLinkAdapter;\n}\n","import { useEffect } from 'react';\nimport { useRouter } from '@tanstack/react-router';\nimport { resolveRelativePath } from '../providers/NavigationProvider';\nimport { useTwilight } from '../providers/twilight-context';\nimport { isLocale } from '../providers/locale-constants';\nimport { getTwilightContext } from '../twilight/context';\nimport { useIsNativeApp } from '../native-app';\nimport { onSallaEvent } from '../utils/sdk-helpers';\nimport { hasStoreUrlBase } from '../utils/store-base';\nimport { localizeDestination } from './link';\n\nconst UI_UPDATE_EVENT = 'mobile::ui.update';\nconst OPEN_ORDER_EVENT = 'mobile::open.order';\nconst NAVIGATE_TO_EVENT = 'mobile::navigate.to';\n\n/**\n * Events the native app sends into its webview. `NavigationSetup` mounts this once, so a\n * theme adds no listener of its own:\n *\n * - `mobile::ui.update` re-runs the route loaders and refetches what is on screen.\n * - `mobile::open.order` `{ id }` opens that order, with a fresh cart.\n * - `mobile::navigate.to` `{ url }` opens a notification deep link in-app. Only a link to\n * this store is followed (`deepLinkPath`), so `javascript:`, off-site and other stores'\n * URLs are dropped.\n *\n * Nothing is mounted outside the app (`useIsNativeApp()`), so a browser runs none of it.\n */\nexport function NativeAppEvents({ locale }: { locale?: string }) {\n return useIsNativeApp() ? <Listeners locale={locale} /> : null;\n}\n\nfunction Listeners({ locale }: { locale?: string }) {\n useNativeAppEvents(locale);\n return null;\n}\n\n/** The listeners themselves. `NativeAppEvents` mounts them inside the app only. */\nexport function useNativeAppEvents(locale?: string): void {\n const router = useRouter();\n const { store } = useTwilight();\n const storeUrl = store?.url;\n const username = store?.username;\n\n useEffect(() => {\n // `href`, not `to`: the router parses the query and the hash out of it.\n const open = (path: string) =>\n void router.navigate({ href: localizeDestination(path, locale) });\n\n const refresh = () => {\n void Promise.allSettled([\n router.invalidate(),\n getTwilightContext().queryClient?.refetchQueries({ type: 'active' }),\n ]);\n };\n const openOrder = (data?: unknown) => {\n const rawId = (data as { id?: unknown } | undefined)?.id;\n if (typeof rawId !== 'string' && typeof rawId !== 'number') return;\n\n const id = String(rawId).trim();\n if (!id) return;\n\n void getTwilightContext().queryClient?.invalidateQueries({ queryKey: ['cart'] });\n open(`/account/orders/${encodeURIComponent(id)}`);\n };\n const navigateTo = (data?: unknown) => {\n const url = (data as { url?: unknown } | undefined)?.url;\n if (typeof url !== 'string' || !url.trim() || !storeUrl) return;\n\n const path = deepLinkPath(url.trim(), storeUrl, username);\n if (path) void router.navigate({ href: inLocale(path, locale) });\n };\n\n const offs = [\n onSallaEvent(UI_UPDATE_EVENT, refresh),\n onSallaEvent(OPEN_ORDER_EVENT, openOrder),\n onSallaEvent(NAVIGATE_TO_EVENT, navigateTo),\n ];\n return () => offs.forEach((off) => off());\n }, [router, locale, storeUrl, username]);\n}\n\n/** A URL that names its host: `https://…` or `//…`. Anything else is a path of this app. */\nfunction isAbsoluteUrl(url: string): boolean {\n if (url.startsWith('//')) return true;\n try {\n // Without a base, only a URL with its own scheme parses.\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * The application path of a deep link to this store, or null for any other link.\n *\n * It passes the test a tapped link does (`resolveRelativePath`: the store's origin, the\n * username taken off), and one more. On a shared host that origin is every store's, so\n * an absolute link has to carry this store's username: without it, another store's\n * `/ar/offers` would open this store's offers.\n */\nfunction deepLinkPath(url: string, storeUrl: string, username?: string): string | null {\n const path = resolveRelativePath(url, storeUrl, username);\n if (!path || !isAbsoluteUrl(url)) return path;\n\n // Both parse: `resolveRelativePath` returns null when either does not.\n const { pathname } = new URL(url, window.location.href);\n return hasStoreUrlBase(pathname, new URL(storeUrl).pathname, username) ? path : null;\n}\n\n/**\n * A deep link in the locale the visitor is browsing in. A notification is written in one\n * language and opened in whichever is on screen, so the link's own locale gives way.\n *\n * The prefix is written here, not by `localizeDestination`: that one leaves a path alone\n * when it already starts with a locale, and would take the slug of `/ar/en/p456` for one.\n */\nfunction inLocale(path: string, locale?: string): string {\n const first = path.split('/')[1]?.split(/[?#]/)[0];\n const own = isLocale(first) ? path.slice(first.length + 1) : path;\n const rest = own.startsWith('/') ? own : `/${own}`;\n\n if (!locale) return rest;\n return rest === '/' ? `/${locale}` : `/${locale}${rest}`;\n}\n","/**\n * What the request itself is enough to describe: its host.\n *\n * Small, and deliberately its own module rather than a helper inside the\n * middleware. This value decides two things — which store a live storefront is,\n * and whether the request is allowed to name a store at all — so it is worth\n * testing directly instead of only through the wiring that calls it.\n */\nimport { isLoopback } from './cookies';\n\n/** The part of a `Request` this needs, so a test does not have to build a whole one. */\nexport interface HostSource {\n url: string;\n headers: { get(name: string): string | null };\n}\n\n/**\n * The host this request arrived on, with its port when it has one.\n *\n * Taken from the request URL, which in a Worker is the address the platform\n * actually routed on, and from the `Host` header only when that fails.\n *\n * **`X-Forwarded-Host` is deliberately not consulted.** A client can set it, and\n * this value gates `allowsRequestStoreId` — so honouring it would be a way to\n * talk a merchant's own domain into behaving like the preview host, and from\n * there into serving a stranger's shop. The dispatcher strips that header today;\n * a theme must not be one edit to another repository's allowlist away from a\n * spoofable identity.\n */\nexport function requestHostOf(request: HostSource): string | null {\n try {\n const fromUrl = new URL(request.url).host;\n if (fromUrl) return fromUrl;\n } catch {\n /* an unparseable URL falls through to the header */\n }\n\n return request.headers.get('Host')?.trim() || null;\n}\n\n/** The origin a browser reached this host on: `http` for a dev server, `https` otherwise. */\nexport function requestOriginOf(host: string): string {\n return `${isLoopback(host.replace(/:\\d+$/, '')) ? 'http' : 'https'}://${host}`;\n}\n","import {\n useNavigate,\n useParams,\n redirect as tanstackRedirect,\n notFound as tanstackNotFound,\n} from '@tanstack/react-router';\nimport {\n NavigationProvider,\n configureNavigation,\n type NavigateOptions,\n} from '../providers/NavigationProvider';\nimport { LinkProvider } from '../providers/LinkProvider';\nimport { TanStackLinkAdapter, localizeDestination } from './link';\nimport { NativeAppEvents } from './native-app-events';\nimport { useCallback, type ReactNode } from 'react';\nimport { UnauthorizedError, type RedirectOptions } from '../providers/NavigationProvider';\nimport { getRequestStore, getTwilightContext } from '../twilight/context';\nimport { resolveStoreBase, resolveStoreBaseFollowsLocale } from '../utils/store-identity';\nimport { loginRedirectHref } from '../utils/store-base';\nimport { requestOriginOf } from '../utils/request-host';\n\nfunction currentOrigin(): string | null {\n if (typeof window !== 'undefined') return window.location.origin;\n const host = getRequestStore().requestHost;\n return host ? requestOriginOf(host) : null;\n}\n\nconfigureNavigation({\n notFound: (message?: string) => {\n throw tanstackNotFound({ data: message });\n },\n redirect: (path: string, opts?: RedirectOptions) => {\n throw tanstackRedirect({ to: path, replace: opts?.replace, statusCode: opts?.statusCode });\n },\n unauthorized: (message?: string) => {\n const origin = currentOrigin();\n const { pathname, searchStr } = getTwilightContext().location;\n const href =\n origin &&\n loginRedirectHref({\n pathname,\n searchStr,\n origin,\n base: resolveStoreBase(),\n baseFollowsLocale: resolveStoreBaseFollowsLocale(),\n });\n // A full load, because the SDK only reads `intended_to` when a page starts.\n if (href) throw tanstackRedirect({ href, reloadDocument: true, replace: true });\n throw new UnauthorizedError(message);\n },\n});\n\n/**\n * TanStack navigation setup - wraps children with NavigationProvider and LinkProvider.\n * Called by TwilightProvider when client.framework === 'tanstack'.\n */\nexport function NavigationSetup({ children }: { children: ReactNode }) {\n const navigate = useNavigate();\n const { locale } = useParams({ strict: false }) as { locale?: string };\n const navigateFn = useCallback(\n (to: string, opts?: NavigateOptions) =>\n navigate({ to: localizeDestination(to, locale), replace: opts?.replace }),\n [navigate, locale]\n );\n\n return (\n <NavigationProvider navigate={navigateFn}>\n <NativeAppEvents locale={locale} />\n <LinkProvider adapter={TanStackLinkAdapter}>{children}</LinkProvider>\n </NavigationProvider>\n );\n}\n\n/** @deprecated Use NavigationSetup instead */\nexport function TanStackNavigationProvider({ children }: { children: ReactNode }) {\n const navigate = useNavigate();\n return (\n <NavigationProvider\n navigate={(to: string, opts?: NavigateOptions) => navigate({ to, replace: opts?.replace })}\n >\n <LinkProvider adapter={TanStackLinkAdapter}>{children}</LinkProvider>\n </NavigationProvider>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/tanstack/link.tsx","../src/tanstack/native-app-events.tsx","../src/utils/request-host.ts","../src/tanstack/navigation.tsx"],"names":["TanStackLink","tanstackNotFound","tanstackRedirect","useParams","jsx"],"mappings":";;;;;;;;;;;;AAWO,SAAS,mBAAA,CAAoB,aAAqB,MAAA,EAAiB;AACxE,EAAA,IAAI,CAAC,MAAA,IAAU,CAAC,WAAA,CAAY,UAAA,CAAW,GAAG,CAAA,IAAK,WAAA,CAAY,UAAA,CAAW,IAAI,CAAA,EAAG,OAAO,WAAA;AACpF,EAAA,MAAM,YAAA,GAAe,WAAA,CAAY,KAAA,CAAM,GAAG,CAAA,CAAE,CAAC,CAAA,EAAG,KAAA,CAAM,MAAM,CAAA,CAAE,CAAC,CAAA;AAC/D,EAAA,IAAI,QAAA,CAAS,YAAY,CAAA,EAAG,OAAO,WAAA;AACnC,EAAA,OAAO,WAAA,KAAgB,MAAM,CAAA,CAAA,EAAI,MAAM,KAAK,CAAA,CAAA,EAAI,MAAM,GAAG,WAAW,CAAA,CAAA;AACtE;AAMO,IAAM,mBAAA,GAAsB,UAAA;AAAA,EACjC,CACE;AAAA,IACE,EAAA;AAAA,IACA,IAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA;AAAA,IACA,GAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAA;AAAA,IACA,YAAA,EAAc,SAAA;AAAA,IACd,GAAG;AAAA,KAEL,GAA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,IAAA,CAAC,kBAAA,EAAA,EAAmB,QAAA,EAAU,UAAA,EAC5B,QAAA,EAAA;AAAA,oBAAAC,GAAAA,CAAC,mBAAgB,MAAA,EAAgB,CAAA;AAAA,oBACjCA,GAAAA,CAAC,YAAA,EAAA,EAAa,OAAA,EAAS,qBAAsB,QAAA,EAAS;AAAA,GAAA,EACxD,CAAA;AAEJ;AAGO,SAAS,0BAAA,CAA2B,EAAE,QAAA,EAAS,EAA4B;AAChF,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,uBACEA,GAAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,QAAA,EAAU,CAAC,EAAA,EAAY,IAAA,KAA2B,QAAA,CAAS,EAAE,EAAA,EAAI,OAAA,EAAS,IAAA,EAAM,OAAA,EAAS,CAAA;AAAA,MAEzF,QAAA,kBAAAA,GAAAA,CAAC,YAAA,EAAA,EAAa,OAAA,EAAS,qBAAsB,QAAA,EAAS;AAAA;AAAA,GACxD;AAEJ","file":"chunk-LUFLN7WL.js","sourcesContent":["import { forwardRef, createElement } from 'react';\nimport { Link as TanStackLink, useParams } from '@tanstack/react-router';\nimport { isLocale } from '../providers/locale-constants';\nimport type { BaseLinkProps } from '../components/common/Link.types';\n\n/**\n * Routes live under an optional `/{-$locale}` param, so a bare `to=\"/brands\"`\n * resolves with the locale omitted and the $locale loader bounces the user to\n * the fallback locale. Prefix the current locale onto internal paths that\n * don't already carry one.\n */\nexport function localizeDestination(destination: string, locale?: string) {\n if (!locale || !destination.startsWith('/') || destination.startsWith('//')) return destination;\n const firstSegment = destination.split('/')[1]?.split(/[?#]/)[0];\n if (isLocale(firstSegment)) return destination;\n return destination === '/' ? `/${locale}` : `/${locale}${destination}`;\n}\n\n/**\n * TanStack Router Link adapter.\n * Translates framework-agnostic props to TanStack Router Link props.\n */\nexport const TanStackLinkAdapter = forwardRef<HTMLAnchorElement, BaseLinkProps>(\n (\n {\n to,\n href,\n children,\n className,\n style,\n title,\n target,\n rel,\n onClick,\n preload,\n replace,\n 'aria-label': ariaLabel,\n ...rest\n },\n ref\n ) => {\n const { locale } = useParams({ strict: false }) as { locale?: string };\n const destination = localizeDestination(to ?? href ?? '/', locale);\n\n return createElement(\n TanStackLink,\n {\n ref,\n to: destination,\n className,\n style,\n title,\n target,\n rel,\n onClick,\n preload: preload === 'intent' || preload === false ? preload : undefined,\n replace,\n 'aria-label': ariaLabel,\n ...(rest as Record<string, unknown>),\n },\n children\n );\n }\n);\n\nTanStackLinkAdapter.displayName = 'TanStackLinkAdapter';\n\n/**\n * Create a TanStack Router Link adapter component.\n */\nexport function createTanStackLinkAdapter() {\n return TanStackLinkAdapter;\n}\n","import { useEffect } from 'react';\nimport { useRouter } from '@tanstack/react-router';\nimport { resolveRelativePath } from '../providers/NavigationProvider';\nimport { useTwilight } from '../providers/twilight-context';\nimport { isLocale } from '../providers/locale-constants';\nimport { getTwilightContext } from '../twilight/context';\nimport { useIsNativeApp } from '../native-app';\nimport { onSallaEvent } from '../utils/sdk-helpers';\nimport { hasStoreUrlBase } from '../utils/store-base';\nimport { localizeDestination } from './link';\n\nconst UI_UPDATE_EVENT = 'mobile::ui.update';\nconst OPEN_ORDER_EVENT = 'mobile::open.order';\nconst NAVIGATE_TO_EVENT = 'mobile::navigate.to';\n\n/**\n * Events the native app sends into its webview. `NavigationSetup` mounts this once, so a\n * theme adds no listener of its own:\n *\n * - `mobile::ui.update` re-runs the route loaders and refetches what is on screen.\n * - `mobile::open.order` `{ id }` opens that order, with a fresh cart.\n * - `mobile::navigate.to` `{ url }` opens a notification deep link in-app. Only a link to\n * this store is followed (`deepLinkPath`), so `javascript:`, off-site and other stores'\n * URLs are dropped.\n *\n * Nothing is mounted outside the app (`useIsNativeApp()`), so a browser runs none of it.\n */\nexport function NativeAppEvents({ locale }: { locale?: string }) {\n return useIsNativeApp() ? <Listeners locale={locale} /> : null;\n}\n\nfunction Listeners({ locale }: { locale?: string }) {\n useNativeAppEvents(locale);\n return null;\n}\n\n/** The listeners themselves. `NativeAppEvents` mounts them inside the app only. */\nexport function useNativeAppEvents(locale?: string): void {\n const router = useRouter();\n const { store } = useTwilight();\n const storeUrl = store?.url;\n const username = store?.username;\n\n useEffect(() => {\n // `href`, not `to`: the router parses the query and the hash out of it.\n const open = (path: string) =>\n void router.navigate({ href: localizeDestination(path, locale) });\n\n const refresh = () => {\n void Promise.allSettled([\n router.invalidate(),\n getTwilightContext().queryClient?.refetchQueries({ type: 'active' }),\n ]);\n };\n const openOrder = (data?: unknown) => {\n const rawId = (data as { id?: unknown } | undefined)?.id;\n if (typeof rawId !== 'string' && typeof rawId !== 'number') return;\n\n const id = String(rawId).trim();\n if (!id) return;\n\n void getTwilightContext().queryClient?.invalidateQueries({ queryKey: ['cart'] });\n open(`/account/orders/${encodeURIComponent(id)}`);\n };\n const navigateTo = (data?: unknown) => {\n const url = (data as { url?: unknown } | undefined)?.url;\n if (typeof url !== 'string' || !url.trim() || !storeUrl) return;\n\n const path = deepLinkPath(url.trim(), storeUrl, username);\n if (path) void router.navigate({ href: inLocale(path, locale) });\n };\n\n const offs = [\n onSallaEvent(UI_UPDATE_EVENT, refresh),\n onSallaEvent(OPEN_ORDER_EVENT, openOrder),\n onSallaEvent(NAVIGATE_TO_EVENT, navigateTo),\n ];\n return () => offs.forEach((off) => off());\n }, [router, locale, storeUrl, username]);\n}\n\n/** A URL that names its host: `https://…` or `//…`. Anything else is a path of this app. */\nfunction isAbsoluteUrl(url: string): boolean {\n if (url.startsWith('//')) return true;\n try {\n // Without a base, only a URL with its own scheme parses.\n new URL(url);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * The application path of a deep link to this store, or null for any other link.\n *\n * It passes the test a tapped link does (`resolveRelativePath`: the store's origin, the\n * username taken off), and one more. On a shared host that origin is every store's, so\n * an absolute link has to carry this store's username: without it, another store's\n * `/ar/offers` would open this store's offers.\n */\nfunction deepLinkPath(url: string, storeUrl: string, username?: string): string | null {\n const path = resolveRelativePath(url, storeUrl, username);\n if (!path || !isAbsoluteUrl(url)) return path;\n\n // Both parse: `resolveRelativePath` returns null when either does not.\n const { pathname } = new URL(url, window.location.href);\n return hasStoreUrlBase(pathname, new URL(storeUrl).pathname, username) ? path : null;\n}\n\n/**\n * A deep link in the locale the visitor is browsing in. A notification is written in one\n * language and opened in whichever is on screen, so the link's own locale gives way.\n *\n * The prefix is written here, not by `localizeDestination`: that one leaves a path alone\n * when it already starts with a locale, and would take the slug of `/ar/en/p456` for one.\n */\nfunction inLocale(path: string, locale?: string): string {\n const first = path.split('/')[1]?.split(/[?#]/)[0];\n const own = isLocale(first) ? path.slice(first.length + 1) : path;\n const rest = own.startsWith('/') ? own : `/${own}`;\n\n if (!locale) return rest;\n return rest === '/' ? `/${locale}` : `/${locale}${rest}`;\n}\n","/**\n * What the request itself is enough to describe: its host.\n *\n * Small, and deliberately its own module rather than a helper inside the\n * middleware. This value decides two things — which store a live storefront is,\n * and whether the request is allowed to name a store at all — so it is worth\n * testing directly instead of only through the wiring that calls it.\n */\nimport { isLoopback } from './cookies';\n\n/** The part of a `Request` this needs, so a test does not have to build a whole one. */\nexport interface HostSource {\n url: string;\n headers: { get(name: string): string | null };\n}\n\n/**\n * The host this request arrived on, with its port when it has one.\n *\n * Taken from the request URL, which in a Worker is the address the platform\n * actually routed on, and from the `Host` header only when that fails.\n *\n * **`X-Forwarded-Host` is deliberately not consulted.** A client can set it, and\n * this value gates `allowsRequestStoreId` — so honouring it would be a way to\n * talk a merchant's own domain into behaving like the preview host, and from\n * there into serving a stranger's shop. The dispatcher strips that header today;\n * a theme must not be one edit to another repository's allowlist away from a\n * spoofable identity.\n */\nexport function requestHostOf(request: HostSource): string | null {\n try {\n const fromUrl = new URL(request.url).host;\n if (fromUrl) return fromUrl;\n } catch {\n /* an unparseable URL falls through to the header */\n }\n\n return request.headers.get('Host')?.trim() || null;\n}\n\n/** The origin a browser reached this host on: `http` for a dev server, `https` otherwise. */\nexport function requestOriginOf(host: string): string {\n return `${isLoopback(host.replace(/:\\d+$/, '')) ? 'http' : 'https'}://${host}`;\n}\n","import {\n useNavigate,\n useParams,\n redirect as tanstackRedirect,\n notFound as tanstackNotFound,\n} from '@tanstack/react-router';\nimport {\n NavigationProvider,\n configureNavigation,\n type NavigateOptions,\n} from '../providers/NavigationProvider';\nimport { LinkProvider } from '../providers/LinkProvider';\nimport { TanStackLinkAdapter, localizeDestination } from './link';\nimport { NativeAppEvents } from './native-app-events';\nimport { useCallback, type ReactNode } from 'react';\nimport { UnauthorizedError, type RedirectOptions } from '../providers/NavigationProvider';\nimport { getRequestStore, getTwilightContext } from '../twilight/context';\nimport { resolveStoreBase, resolveStoreBaseFollowsLocale } from '../utils/store-identity';\nimport { loginRedirectHref } from '../utils/store-base';\nimport { requestOriginOf } from '../utils/request-host';\n\nfunction currentOrigin(): string | null {\n if (typeof window !== 'undefined') return window.location.origin;\n const host = getRequestStore().requestHost;\n return host ? requestOriginOf(host) : null;\n}\n\nconfigureNavigation({\n notFound: (message?: string) => {\n throw tanstackNotFound({ data: message });\n },\n redirect: (path: string, opts?: RedirectOptions) => {\n throw tanstackRedirect({ to: path, replace: opts?.replace, statusCode: opts?.statusCode });\n },\n unauthorized: (message?: string) => {\n const origin = currentOrigin();\n const { pathname, searchStr } = getTwilightContext().location;\n const href =\n origin &&\n loginRedirectHref({\n pathname,\n searchStr,\n origin,\n base: resolveStoreBase(),\n baseFollowsLocale: resolveStoreBaseFollowsLocale(),\n });\n // A full load, because the SDK only reads `intended_to` when a page starts.\n if (href) throw tanstackRedirect({ href, reloadDocument: true, replace: true });\n throw new UnauthorizedError(message);\n },\n});\n\n/**\n * TanStack navigation setup - wraps children with NavigationProvider and LinkProvider.\n * Called by TwilightProvider when client.framework === 'tanstack'.\n */\nexport function NavigationSetup({ children }: { children: ReactNode }) {\n const navigate = useNavigate();\n const { locale } = useParams({ strict: false }) as { locale?: string };\n const navigateFn = useCallback(\n (to: string, opts?: NavigateOptions) =>\n navigate({ to: localizeDestination(to, locale), replace: opts?.replace }),\n [navigate, locale]\n );\n\n return (\n <NavigationProvider navigate={navigateFn}>\n <NativeAppEvents locale={locale} />\n <LinkProvider adapter={TanStackLinkAdapter}>{children}</LinkProvider>\n </NavigationProvider>\n );\n}\n\n/** @deprecated Use NavigationSetup instead */\nexport function TanStackNavigationProvider({ children }: { children: ReactNode }) {\n const navigate = useNavigate();\n return (\n <NavigationProvider\n navigate={(to: string, opts?: NavigateOptions) => navigate({ to, replace: opts?.replace })}\n >\n <LinkProvider adapter={TanStackLinkAdapter}>{children}</LinkProvider>\n </NavigationProvider>\n );\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { rememberProductPreview } from './chunk-
|
|
2
|
-
import { getActiveScope, api } from './chunk-
|
|
1
|
+
import { rememberProductPreview } from './chunk-SQXUWX4B.js';
|
|
2
|
+
import { getActiveScope, api } from './chunk-YDSWLCOY.js';
|
|
3
3
|
import { queryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
var wishlist = {
|
|
@@ -31,5 +31,5 @@ var wishlist = {
|
|
|
31
31
|
};
|
|
32
32
|
|
|
33
33
|
export { wishlist };
|
|
34
|
-
//# sourceMappingURL=chunk-
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
34
|
+
//# sourceMappingURL=chunk-OHUTM224.js.map
|
|
35
|
+
//# sourceMappingURL=chunk-OHUTM224.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/wishlist.ts"],"names":[],"mappings":";;;;AAmBO,IAAM,QAAA,GAAW;AAAA,EACtB,IAAA,EAAM,OAAO,MAAA,GAA6B,EAAC,KAAmC;AAC5E,IAAA,MAAM,EAAE,IAAA,GAAO,CAAA,EAAG,UAAU,EAAA,EAAI,UAAA,EAAY,QAAO,GAAI,MAAA;AAEvD,IAAA,MAAM,YAAA,GAAe,IAAI,eAAA,EAAgB;AACzC,IAAA,YAAA,CAAa,GAAA,CAAI,UAAU,UAAU,CAAA;AACrC,IAAA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AA,EAAO,KAAM,QAAA,CAAS,IAAA,CAAK,EAAE,GAAG,MAAA,EAAQ,MAAA,EAAQ;AAAA,KAC7D;AAAA;AAEP","file":"chunk-OHUTM224.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport {\n rememberProductPreview,\n type ProductsListResult,\n type ProductsListResponse,\n} from './product';\n\nexport interface WishlistListParams {\n page?: number;\n perPage?: number;\n filterable?: boolean;\n signal?: AbortSignal;\n}\n\n/**\n * Wishlist API — page-based pagination only.\n * Kept separate from product.list to avoid mixing cursor and page pagination strategies.\n */\nexport const wishlist = {\n list: async (params: WishlistListParams = {}): Promise<ProductsListResult> => {\n const { page = 1, perPage = 15, filterable, signal } = params;\n\n const searchParams = new URLSearchParams();\n searchParams.set('source', 'wishlist');\n searchParams.set('page', String(page));\n searchParams.set('per_page', String(perPage));\n\n if (filterable !== undefined) {\n searchParams.set('filterable', filterable ? '1' : '0');\n }\n\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`products?${searchParams.toString()}`, options as any)\n .json<ProductsListResponse>();\n\n const items = response.data ?? [];\n for (const item of items) rememberProductPreview(item);\n\n return {\n items,\n next: response.cursor?.next ?? null,\n };\n },\n\n queries: {\n list: (params: Omit<WishlistListParams, 'signal'>) =>\n queryOptions({\n queryKey: ['wishlist', 'list', params, { scope: getActiveScope() }],\n queryFn: ({ signal }) => wishlist.list({ ...params, signal }),\n }),\n },\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isNativeApp } from './chunk-
|
|
1
|
+
import { isNativeApp } from './chunk-A4NN6C5B.js';
|
|
2
2
|
import { useTwilight } from './chunk-DF6FBKDN.js';
|
|
3
3
|
import { useRef, useState, useEffect } from 'react';
|
|
4
4
|
import { toast, Toaster as Toaster$1 } from 'sonner';
|
|
@@ -137,5 +137,5 @@ function Toaster({
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
export { Toaster };
|
|
140
|
-
//# sourceMappingURL=chunk-
|
|
141
|
-
//# sourceMappingURL=chunk-
|
|
140
|
+
//# sourceMappingURL=chunk-OSSOU36J.js.map
|
|
141
|
+
//# sourceMappingURL=chunk-OSSOU36J.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/toast/Toaster.tsx"],"names":["SonnerToaster"],"mappings":";;;;;;AAMA,IAAM,eAAA,GAAkB;AAAA,EACtB,KAAA,EAAO,gEAAA;AAAA,EACP,KAAA,EAAO,qBAAA;AAAA,EACP,WAAA,EAAa,4BAAA;AAAA,EACb,YAAA,EAAc,yCAAA;AAAA,EACd,YAAA,EAAc,+BAAA;AAAA,EACd,OAAA,EAAS,kEAAA;AAAA,EACT,KAAA,EAAO,4DAAA;AAAA,EACP,OAAA,EAAS,qEAAA;AAAA,EACT,IAAA,EAAM,+DAAA;AAAA,EACN,OAAA,EAAS;AACX,CAAA;AAKA,IAAM,iBAAA,GAAoB,GAAA;AAC1B,IAAM,kBAAA,GAAqB,WAAA;AAE3B,SAAS,mBAAA,CAAoB,IAAA,EAAoB,OAAA,EAAiB,KAAA,EAAgB;AAChF,EAAA,MAAM,QAAQ,MAAA,CAAO,KAAA;AACrB,EAAA,IAAI,CAAC,WAAA,EAAY,IAAK,CAAC,KAAA,EAAO,KAAA,EAAO,UAAU,OAAO,KAAA;AAEtD,EAAA,KAAA,CAAM,KAAA,CAAM,SAAS,kBAAA,EAAoB;AAAA,IACvC,IAAA;AAAA,IACA,OAAA;AAAA,IACA,GAAwB;AAAC,GAC1B,CAAA;AACD,EAAA,OAAO,IAAA;AACT;AAEO,SAAS,OAAA,CAAQ;AAAA,EACtB,cAAA,GAAiB,eAAA;AAAA,EACjB,cAAA,GAAiB;AACnB,CAAA,EAIG;AACD,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,WAAA,EAAY;AAC9B,EAAA,MAAM,QAAA,GAAW,OAAO,KAAK,CAAA;AAC7B,EAAA,QAAA,CAA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S,EAAE,QAAA,EAAU,KAAM,CAAA;AAAA,MACzC;AAAA,IACF,GAAG,GAAG,CAAA;AAEN,IAAA,OAAO,MAAM,aAAa,KAAK,CAAA;AAAA,EACjC,CAAA,EAAG,EAAE,CAAA;AAEL,EAAA,uBACE,GAAA;AAAA,IAACA,SAAA;AAAA,IAAA;AAAA,MACC,QAAA;AAAA,MAIA,MAAA,EAAQ,EAAE,GAAA,EAAK,4CAAA,EAA6C;AAAA,MAC5D,YAAA,EAAc,EAAE,GAAA,EAAK,4CAAA,EAA6C;AAAA,MAClE,YAAA,EAAc;AAAA,QACZ,UAAA,EAAY,eAAA;AAAA,QACZ,KAAA,EAAO;AAAA,UACL,UAAA,EAAY;AAAA;AACd,OACF;AAAA,MACA,KAAA,EAAO;AAAA,QACL,UAAA,EAAY;AAAA;AACd;AAAA,GACF;AAEJ","file":"chunk-76GCBYJX.js","sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { Toaster as SonnerToaster, toast } from 'sonner';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { isNativeApp } from '../../native-app';\nimport type { ToastPosition } from './types';\n\nconst toastClassNames = {\n toast: 'group bg-white border-2 rounded-xl shadow-2xl p-4 font-primary',\n title: 'text-base font-bold',\n description: 'text-sm mt-1 text-gray-600',\n actionButton: 'bg-primary text-white px-3 py-1 rounded',\n cancelButton: 'bg-gray-100 px-3 py-1 rounded',\n success: 'border-green-500 [&_svg]:text-green-500 [&_aside]:text-green-700',\n error: 'border-red-500 [&_svg]:text-red-500 [&_aside]:text-red-700',\n warning: 'border-yellow-500 [&_svg]:text-yellow-500 [&_aside]:text-yellow-700',\n info: 'border-blue-500 [&_svg]:text-blue-500 [&_aside]:text-blue-700',\n loading: 'border-gray-400',\n};\n\ntype RawMessage = string | { title?: string; text?: string; icon?: string };\ntype ToastVariant = 'success' | 'error' | 'warning' | 'info';\n\nconst MOBILE_BREAKPOINT = 768;\nconst NATIVE_ALERT_EVENT = 'ui::alert';\n\nfunction dispatchNativeAlert(type: ToastVariant, message: string, title?: string) {\n const salla = window.salla;\n if (!isNativeApp() || !salla?.event?.dispatch) return false;\n\n salla.event.dispatch(NATIVE_ALERT_EVENT, {\n type,\n message,\n ...(title ? { title } : {}),\n });\n return true;\n}\n\nexport function Toaster({\n mobilePosition = 'bottom-center',\n addToCartToast = true,\n}: {\n mobilePosition?: ToastPosition;\n /** Show the default add-to-cart toast. Themes whose cart badge is the feedback can turn it off. */\n addToCartToast?: boolean;\n}) {\n const { theme } = useTwilight();\n const themeRef = useRef(theme);\n themeRef.current = theme;\n const flashShownRef = useRef(false);\n\n const isRtl = theme.is_rtl;\n const desktopPosition: ToastPosition = isRtl ? 'top-left' : 'top-right';\n\n const [position, setPosition] = useState<ToastPosition>(() => {\n if (typeof window === 'undefined') return desktopPosition;\n return window.innerWidth < MOBILE_BREAKPOINT ? mobilePosition : desktopPosition;\n });\n\n useEffect(() => {\n const handleResize = () => {\n setPosition(window.innerWidth < MOBILE_BREAKPOINT ? mobilePosition : desktopPosition);\n };\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [desktopPosition, mobilePosition]);\n\n useEffect(() => {\n const salla = window.salla;\n if (!salla) return;\n let active = true;\n\n const handleNotify = (message: RawMessage, type: string, data?: unknown) => {\n const eventData = data as { data?: { googleTags?: { event?: string } } } | undefined;\n const shouldSuppressAddToCartToast =\n (!addToCartToast || themeRef.current.settings?.enable_add_product_toast) &&\n eventData?.data?.googleTags?.event === 'addToCart';\n let title: string;\n let toastType: ToastVariant;\n\n if (typeof message === 'object' && message !== null) {\n title = message.title || message.text || '';\n toastType = (message.icon || type || 'info') as ToastVariant;\n } else {\n title = message;\n toastType = (type || 'info') as ToastVariant;\n }\n\n // Suppress the default addToCart toast when the theme opted out (addToCartToast=false)\n // or renders its own rich toast (enable_add_product_toast) so they don't double up.\n if (shouldSuppressAddToCartToast) {\n return;\n }\n\n if (dispatchNativeAlert(toastType, title)) {\n return;\n }\n\n if (toastType === 'success') {\n toast.success(title, { duration: 3000 });\n } else if (toastType === 'error') {\n toast.error(title, { duration: 3000 });\n } else if (toastType === 'warning') {\n toast.warning(title, { duration: 3000 });\n } else {\n toast.info(title, { duration: 3000 });\n }\n };\n\n // Before the SDK loads `salla` is the head stub, and the SDK's default notifier is alert().\n void (async () => {\n try {\n await salla.onReady?.();\n } catch {\n // onReady() may fail during partial initialization; the toast still beats alert().\n }\n if (active) salla.notify?.setNotifier?.(handleNotify);\n })();\n return () => {\n active = false;\n salla.notify?.setNotifier?.(() => {});\n };\n }, [addToCartToast]);\n\n useEffect(() => {\n if (flashShownRef.current || typeof window === 'undefined') return;\n\n const params = new URLSearchParams(window.location.search);\n const successMsg = params.get('success');\n const dangerMsg = params.get('danger');\n\n if (!successMsg && !dangerMsg) return;\n\n flashShownRef.current = true;\n\n const message = successMsg || dangerMsg || '';\n const toastType = dangerMsg ? 'error' : 'success';\n\n const url = new URL(window.location.href);\n url.searchParams.delete('success');\n url.searchParams.delete('danger');\n window.history.replaceState({}, '', url.toString());\n\n const timer = setTimeout(() => {\n if (dispatchNativeAlert(toastType, message)) return;\n\n if (toastType === 'success') {\n toast.success(message, { duration: 3000 });\n } else {\n toast.error(message, { duration: 3000 });\n }\n }, 100);\n\n return () => clearTimeout(timer);\n }, []);\n\n return (\n <SonnerToaster\n position={position}\n // Keep sonner's default gaps (24px desktop / 16px mobile) but clear the\n // native status bar inset (--app-safe-area-top, set by useSafeAreaInset)\n // so top-positioned toasts aren't covered in the app webview.\n offset={{ top: 'calc(var(--app-safe-area-top, 0px) + 24px)' }}\n mobileOffset={{ top: 'calc(var(--app-safe-area-top, 0px) + 16px)' }}\n toastOptions={{\n classNames: toastClassNames,\n style: {\n fontFamily: 'var(--font-main, inherit)',\n },\n }}\n style={{\n fontFamily: 'var(--font-main, inherit)',\n }}\n />\n );\n}\n\nexport type { ToasterProps } from 'sonner';\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/toast/Toaster.tsx"],"names":["SonnerTo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,MAAA,EAAQ,EAAE,GAAA,EAAK,4CAAA,EAA6C;AAAA,MAC5D,YAAA,EAAc,EAAE,GAAA,EAAK,4CAAA,EAA6C;AAAA,MAClE,YAAA,EAAc;AAAA,QACZ,UAAA,EAAY,eAAA;AAAA,QACZ,KAAA,EAAO;AAAA,UACL,UAAA,EAAY;AAAA;AACd,OACF;AAAA,MACA,KAAA,EAAO;AAAA,QACL,UAAA,EAAY;AAAA;AACd;AAAA,GACF;AAEJ","file":"chunk-OSSOU36J.js","sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { Toaster as SonnerToaster, toast } from 'sonner';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { isNativeApp } from '../../native-app';\nimport type { ToastPosition } from './types';\n\nconst toastClassNames = {\n toast: 'group bg-white border-2 rounded-xl shadow-2xl p-4 font-primary',\n title: 'text-base font-bold',\n description: 'text-sm mt-1 text-gray-600',\n actionButton: 'bg-primary text-white px-3 py-1 rounded',\n cancelButton: 'bg-gray-100 px-3 py-1 rounded',\n success: 'border-green-500 [&_svg]:text-green-500 [&_aside]:text-green-700',\n error: 'border-red-500 [&_svg]:text-red-500 [&_aside]:text-red-700',\n warning: 'border-yellow-500 [&_svg]:text-yellow-500 [&_aside]:text-yellow-700',\n info: 'border-blue-500 [&_svg]:text-blue-500 [&_aside]:text-blue-700',\n loading: 'border-gray-400',\n};\n\ntype RawMessage = string | { title?: string; text?: string; icon?: string };\ntype ToastVariant = 'success' | 'error' | 'warning' | 'info';\n\nconst MOBILE_BREAKPOINT = 768;\nconst NATIVE_ALERT_EVENT = 'ui::alert';\n\nfunction dispatchNativeAlert(type: ToastVariant, message: string, title?: string) {\n const salla = window.salla;\n if (!isNativeApp() || !salla?.event?.dispatch) return false;\n\n salla.event.dispatch(NATIVE_ALERT_EVENT, {\n type,\n message,\n ...(title ? { title } : {}),\n });\n return true;\n}\n\nexport function Toaster({\n mobilePosition = 'bottom-center',\n addToCartToast = true,\n}: {\n mobilePosition?: ToastPosition;\n /** Show the default add-to-cart toast. Themes whose cart badge is the feedback can turn it off. */\n addToCartToast?: boolean;\n}) {\n const { theme } = useTwilight();\n const themeRef = useRef(theme);\n themeRef.current = theme;\n const flashShownRef = useRef(false);\n\n const isRtl = theme.is_rtl;\n const desktopPosition: ToastPosition = isRtl ? 'top-left' : 'top-right';\n\n const [position, setPosition] = useState<ToastPosition>(() => {\n if (typeof window === 'undefined') return desktopPosition;\n return window.innerWidth < MOBILE_BREAKPOINT ? mobilePosition : desktopPosition;\n });\n\n useEffect(() => {\n const handleResize = () => {\n setPosition(window.innerWidth < MOBILE_BREAKPOINT ? mobilePosition : desktopPosition);\n };\n window.addEventListener('resize', handleResize);\n return () => window.removeEventListener('resize', handleResize);\n }, [desktopPosition, mobilePosition]);\n\n useEffect(() => {\n const salla = window.salla;\n if (!salla) return;\n let active = true;\n\n const handleNotify = (message: RawMessage, type: string, data?: unknown) => {\n const eventData = data as { data?: { googleTags?: { event?: string } } } | undefined;\n const shouldSuppressAddToCartToast =\n (!addToCartToast || themeRef.current.settings?.enable_add_product_toast) &&\n eventData?.data?.googleTags?.event === 'addToCart';\n let title: string;\n let toastType: ToastVariant;\n\n if (typeof message === 'object' && message !== null) {\n title = message.title || message.text || '';\n toastType = (message.icon || type || 'info') as ToastVariant;\n } else {\n title = message;\n toastType = (type || 'info') as ToastVariant;\n }\n\n // Suppress the default addToCart toast when the theme opted out (addToCartToast=false)\n // or renders its own rich toast (enable_add_product_toast) so they don't double up.\n if (shouldSuppressAddToCartToast) {\n return;\n }\n\n if (dispatchNativeAlert(toastType, title)) {\n return;\n }\n\n if (toastType === 'success') {\n toast.success(title, { duration: 3000 });\n } else if (toastType === 'error') {\n toast.error(title, { duration: 3000 });\n } else if (toastType === 'warning') {\n toast.warning(title, { duration: 3000 });\n } else {\n toast.info(title, { duration: 3000 });\n }\n };\n\n // Before the SDK loads `salla` is the head stub, and the SDK's default notifier is alert().\n void (async () => {\n try {\n await salla.onReady?.();\n } catch {\n // onReady() may fail during partial initialization; the toast still beats alert().\n }\n if (active) salla.notify?.setNotifier?.(handleNotify);\n })();\n return () => {\n active = false;\n salla.notify?.setNotifier?.(() => {});\n };\n }, [addToCartToast]);\n\n useEffect(() => {\n if (flashShownRef.current || typeof window === 'undefined') return;\n\n const params = new URLSearchParams(window.location.search);\n const successMsg = params.get('success');\n const dangerMsg = params.get('danger');\n\n if (!successMsg && !dangerMsg) return;\n\n flashShownRef.current = true;\n\n const message = successMsg || dangerMsg || '';\n const toastType = dangerMsg ? 'error' : 'success';\n\n const url = new URL(window.location.href);\n url.searchParams.delete('success');\n url.searchParams.delete('danger');\n window.history.replaceState({}, '', url.toString());\n\n const timer = setTimeout(() => {\n if (dispatchNativeAlert(toastType, message)) return;\n\n if (toastType === 'success') {\n toast.success(message, { duration: 3000 });\n } else {\n toast.error(message, { duration: 3000 });\n }\n }, 100);\n\n return () => clearTimeout(timer);\n }, []);\n\n return (\n <SonnerToaster\n position={position}\n // Keep sonner's default gaps (24px desktop / 16px mobile) but clear the\n // native status bar inset (--app-safe-area-top, set by useSafeAreaInset)\n // so top-positioned toasts aren't covered in the app webview.\n offset={{ top: 'calc(var(--app-safe-area-top, 0px) + 24px)' }}\n mobileOffset={{ top: 'calc(var(--app-safe-area-top, 0px) + 16px)' }}\n toastOptions={{\n classNames: toastClassNames,\n style: {\n fontFamily: 'var(--font-main, inherit)',\n },\n }}\n style={{\n fontFamily: 'var(--font-main, inherit)',\n }}\n />\n );\n}\n\nexport type { ToasterProps } from 'sonner';\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HookSlot, useIsClient } from './chunk-5XDPAKF5.js';
|
|
2
2
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
3
|
-
import { Image } from './chunk-
|
|
3
|
+
import { Image } from './chunk-GFUXGVER.js';
|
|
4
4
|
import { Link } from './chunk-AXW67SY7.js';
|
|
5
5
|
import { LazyImageModal } from './chunk-7V5HOZW4.js';
|
|
6
6
|
import { useTwilight } from './chunk-DF6FBKDN.js';
|
|
@@ -278,5 +278,5 @@ function Footer({ inSheet = false } = {}) {
|
|
|
278
278
|
}
|
|
279
279
|
|
|
280
280
|
export { Footer };
|
|
281
|
-
//# sourceMappingURL=chunk-
|
|
282
|
-
//# sourceMappingURL=chunk-
|
|
281
|
+
//# sourceMappingURL=chunk-PTQVBPPN.js.map
|
|
282
|
+
//# sourceMappingURL=chunk-PTQVBPPN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/layout/Footer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAM,YAAA,GACJ,+HAAA;AAOF,SAAS,SAAA,CAAU,EAAE,IAAA,EAAK,EAAsB;AAC9C,EAAA,MAAM,EAAE,KAAA,EAAM,GAAI,WAAA,EAAY;AAC9B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,CAAC,IAAA,EAAM,OAAO,CAAA,GAAI,SAAS,KAAK,CAAA;AACtC,EAAA,MAAM,MAAA,GAAS,KAAA,CAAM,QAAA,EAAU,GAAA,EAAK,MAAA;AACpC,EAAA,MAAM,WAAA,GAAc,KAAA,CAAM,QAAA,EAAU,GAAA,EAAK,WAAA;AACzC,EAAA,IAAI,CAAC,QAAQ,OAAO,IAAA;AAEpB,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,aAAA,EAAY,kBAAA;AAAA,MACZ,SAAA,EAAU,4DAAA;AAAA,MAET,QAAA,EAAA;AAAA,QAAA,WAAA,oBACC,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,0BAAA,GAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,IAAA,EAAK,QAAA;AAAA,cACL,aAAA,EAAY,8BAAA;AAAA,cACZ,SAAA,EAAU,iCAAA;AAAA,cACV,YAAA,EAAY,CAAA,CAAE,iCAAA,EAAmC,iBAAiB,CAAA;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,YAAA;AAAA,cACC,IAAA,EAAK,WAAA;AAAA,cACL,OAAA,EAAS,EAAE,SAAA,EAAW,KAAA,CAAM,IAAA,EAAK;AAAA,cACjC,0BACE,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,gBAAA,CAAA,CAAE,2BAA2B,qBAAqB,CAAA;AAAA,gBAAG,GAAA;AAAA,oCACrD,IAAA,EAAA,EAAK,EAAA,EAAG,KAAI,SAAA,EAAU,wDAAA,EACpB,gBAAM,IAAA,EACT,CAAA;AAAA,gBAAQ,GAAA;AAAA,gBAAI,OAAA;AAAA,gBACT;AAAA,eAAA,EACL;AAAA;AAAA,WAEJ,EACF,CAAA;AAAA,8BAEC,aAAA,EAAA,EAAc;AAAA,SAAA,EACjB,CAAA;AAAA,QAEC,CAAC,OAAA,oBAAW,GAAA,CAAC,QAAA,EAAA,EAAS,MAAK,YAAA,EAAa;AAAA;AAAA;AAAA,GAC3C;AAEJ","file":"chunk-U5TBXUQT.js","sourcesContent":["import { useState } from 'react';\nimport { SallaAppsIcons } from '@salla.sa/twilight-components-react/apps-icons';\nimport { SallaContacts } from '@salla.sa/twilight-components-react/contacts';\nimport { SallaSocial } from '@salla.sa/twilight-components-react/social';\nimport { SallaMenu } from '@salla.sa/twilight-components-react/menu';\nimport { SallaTrustBadges } from '@salla.sa/twilight-components-react/trust-badges';\nimport { SallaPayments } from '@salla.sa/twilight-components-react/payments';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { HookSlot } from '../../hooks/HookSlot';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { Link, Image } from '../common';\nimport { ImageModal } from '../modal';\n\n/** Salla's value-added-tax badge icon (70×70, CDN-resized) — a platform\n * asset shared by every store, not specific to any one theme. */\nconst TAX_ICON_URL =\n 'https://cdn.salla.network/cdn-cgi/image/fit=scale-down,width=70,height=70,onerror=redirect,format=auto/images/tax.png?v=2.0.5';\n\n/**\n * The store's value-added-tax registration: the tax number, plus the certificate as\n * the tax icon that opens the certificate image full size in a modal. Nothing shows\n * when the store has no tax number.\n */\nfunction FooterTax({ dark }: { dark: boolean }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const [open, setOpen] = useState(false);\n const number = store.settings?.tax?.number;\n const certificate = store.settings?.tax?.certificate;\n if (!number) return null;\n\n return (\n <div\n data-testid=\"store-footer-tax\"\n className=\"store-footer__tax flex items-end gap-2 rtl:space-x-reverse\"\n >\n {certificate && (\n <>\n <button\n type=\"button\"\n data-testid=\"store-footer-tax-certificate\"\n className=\"store-footer__tax-cert shrink-0\"\n aria-label={t('common.elements.tax_certificate', 'Tax Certificate')}\n aria-haspopup=\"dialog\"\n onClick={() => setOpen(true)}\n >\n <img\n src={TAX_ICON_URL}\n alt={t('common.elements.tax_certificate', 'Tax Certificate')}\n width={40}\n height={50}\n loading=\"lazy\"\n decoding=\"async\"\n className=\"w-10 rounded-sm transition-opacity hover:opacity-80\"\n />\n </button>\n <ImageModal\n isOpen={open}\n onClose={() => setOpen(false)}\n src={certificate}\n alt={t('common.elements.tax_certificate', 'Tax Certificate')}\n title={t('common.elements.tax_certificate', 'Tax Certificate')}\n />\n </>\n )}\n <div>\n <p className={`mb-1 text-sm opacity-70 ${dark ? 'text-white' : ''}`}>\n {t('common.elements.tax_number', 'Tax Number')}\n </p>\n <b className=\"text-sm\">{number}</b>\n </div>\n </div>\n );\n}\n\n/** Saudi Business Center (SBC) logo, CDN-versioned like the tax icon -- also a\n * platform asset, not theme-specific. */\nconst SBC_ICON_URL = 'https://cdn.salla.network/images/sbc.png?v=2.0.5';\n\n/**\n * The store's Saudi Business Center certificate: a \"Trusted by Business Platform\" badge that\n * opens the certificate's page on the SBC site so visitors can verify the merchant. Nothing\n * shows when the store has no certificate.\n */\nfunction FooterSbc({ dark }: { dark: boolean }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const id = store.settings?.certificate?.id;\n if (!id) return null;\n\n return (\n <a\n href={`https://eauthenticate.saudibusiness.gov.sa/certificate-details/${encodeURIComponent(id)}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-testid=\"store-footer-sbc\"\n className=\"store-footer__sbc flex items-center gap-2.5 transition-opacity hover:opacity-75\"\n >\n <img\n src={SBC_ICON_URL}\n alt={`SBC ${id}`}\n width={56}\n height={40}\n loading=\"lazy\"\n decoding=\"async\"\n className=\"h-10 w-14 rounded-sm\"\n />\n <div>\n <p className={`text-xs opacity-70 ${dark ? 'text-white' : ''}`}>\n {t('blocks.footer.sbc_trusted_by', 'Trusted by')}\n </p>\n <b className=\"text-sm\">{t('blocks.footer.sbc_platform', 'Business Platform')}</b>\n </div>\n </a>\n );\n}\n\n/** Trust badges, the tax registration and the SBC badge, side by side (wrapping on narrow columns). */\nfunction FooterTrust({ dark, centered }: { dark: boolean; centered: boolean }) {\n return (\n <div\n data-testid=\"store-footer-trust\"\n className={`store-footer__trust flex flex-wrap items-end gap-x-6 gap-y-3${centered ? ' justify-center' : ''}`}\n >\n <FooterTax dark={dark} />\n <FooterSbc dark={dark} />\n <SallaTrustBadges {...(dark ? { dark: true } : {})} />\n </div>\n );\n}\n\n/**\n * The footer's own menu of (\"important\") links -- skipped entirely when\n * `inSheet`, for a theme that opens it from somewhere else of its own (a\n * mobile account sheet, a dedicated links screen, …) instead; showing it\n * again down here would just be a redundant second copy. `heading` wraps it\n * in the grid layout's own `.store-footer__links` column; the centered\n * layout's inline row has none.\n */\nfunction FooterLinksMenu({\n inSheet,\n className,\n heading,\n dark,\n}: {\n inSheet: boolean;\n className: string;\n heading?: string;\n dark: boolean;\n}) {\n if (inSheet) return null;\n\n const menu = <SallaMenu source=\"footer\" className={className} suppressHydrationWarning />;\n if (!heading) return menu;\n\n return (\n <div className=\"store-footer__links\">\n <h3 className={`mb-3 text-lg font-bold lg:mb-5 ${dark ? 'text-white' : 'text-gray-900'}`}>\n {heading}\n </h3>\n {menu}\n </div>\n );\n}\n\n/** App-store / Google-Play buttons. Nothing shows -- not even the wrapping\n * div -- when the store has neither link set. */\nfunction FooterApps({ className }: { className: string }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n // The web component fills its light DOM before React hydrates the footer, a hydration error.\n const isClient = useIsClient();\n if (!store.apps?.appstore && !store.apps?.googleplay) return null;\n\n return (\n <div data-testid=\"store-footer-apps\" className={`store-footer__apps ${className}`}>\n {isClient && (\n <SallaAppsIcons\n apps={store.apps}\n appsTitle={t('blocks.footer.download_apps', 'Get our apps')}\n />\n )}\n </div>\n );\n}\n\n/** The logo link, same shape in both layouts -- only its own spacing differs. */\nfunction FooterLogo({ className }: { className: string }) {\n const { store } = useTwilight();\n return (\n <Link\n to=\"/\"\n className={`store-footer__logo inline-flex items-center m-0 transition-opacity hover:opacity-75 ${className}`}\n >\n <Image\n src={store.logo}\n alt={store.name || 'Store'}\n width={150}\n height={44}\n objectFit=\"contain\"\n className=\"h-11 w-auto max-w-[180px]\"\n />\n </Link>\n );\n}\n\n/** Merchant-authored description HTML -- mirrors the Twig theme's\n * `store.description|raw`. Renders nothing when the store has none set. */\nfunction FooterDescription({ className }: { className: string }) {\n const { store } = useTwilight();\n if (!store.description) return null;\n return (\n <div\n className={`store-footer__desc opacity-80 ${className}`}\n dangerouslySetInnerHTML={{ __html: store.description }}\n />\n );\n}\n\n/** The store's phone and email as one \"Contact us: …\" row under the description\n * (`<salla-contacts>`'s compact `isHeader` layout, which shows only those two).\n * Renders nothing when the store has neither. */\nfunction FooterContacts({ className }: { className: string }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n if (!store.contacts?.phone && !store.contacts?.email) return null;\n return (\n <div className={`store-footer__contacts ${className}`}>\n <SallaContacts\n contacts={store.contacts}\n contactsTitle={t('blocks.footer.social', 'Contact us')}\n isHeader\n />\n </div>\n );\n}\n\n/** Centered layout: logo, description, contacts, social, footer menu, trust\n * badges and app buttons stacked as one centered column. */\nfunction FooterCenteredBody({ inSheet, isDark }: { inSheet: boolean; isDark: boolean }) {\n return (\n <div className=\"container mx-auto flex max-w-2xl flex-col items-center gap-6 text-center\">\n <FooterLogo className=\"\" />\n <FooterDescription className=\"\" />\n <FooterContacts className=\"\" />\n <SallaSocial />\n\n <FooterLinksMenu\n inSheet={inSheet}\n className=\"store-footer__menu store-footer__menu--inline\"\n dark={isDark}\n />\n\n <FooterTrust dark={isDark} centered />\n\n <FooterApps className=\"flex flex-col items-center gap-3\" />\n </div>\n );\n}\n\n/** Columns layout: brand (logo / description / contacts / social / trust) and app\n * buttons side by side, with the footer menu as its own labeled column. */\nfunction FooterColumnsBody({ inSheet, isDark }: { inSheet: boolean; isDark: boolean }) {\n const { t } = useTranslation();\n\n return (\n <div className=\"container grid grid-cols-1 gap-10 sm:grid-cols-2 lg:grid-cols-4 lg:gap-16\">\n <div className=\"store-footer__brand rtl:lg:pl-16 ltr:lg:pr-16 sm:col-span-2\">\n <FooterLogo className=\"mb-5\" />\n <FooterDescription className=\"max-w-sm leading-6 my-5\" />\n <FooterContacts className=\"mb-6\" />\n <SallaSocial className=\"block mb-6\" />\n <FooterTrust dark={isDark} centered={false} />\n </div>\n\n <FooterLinksMenu\n inSheet={inSheet}\n className=\"store-footer__menu store-footer__menu--stacked\"\n heading={t('blocks.footer.important_links', 'Important links')}\n dark={isDark}\n />\n\n <FooterApps className=\"\" />\n </div>\n );\n}\n\nexport interface FooterProps {\n /**\n * Renders as a plain `<div>` (no second `<footer>` landmark) with the\n * `footer:start` / `footer:end` hook slots skipped -- for a theme that\n * repeats these widgets somewhere other than the page's own footer (a\n * mobile sheet, for example) rather than rendering the real page footer a\n * second time.\n */\n inSheet?: boolean;\n}\n\n/**\n * Storefront footer.\n *\n * Two layouts, chosen by the `footer_layout` theme setting:\n * - **columns** (default): logo / description / social / trust badges, the\n * footer menu (\"important links\"), and app-store buttons, side by side.\n * - **centered**: the same pieces stacked as one centered column, with the\n * footer menu laid out as an inline, pipe-separated row.\n *\n * Styling for the handful of pieces rendered by web components this owns no\n * markup for (`<salla-social>`'s `.social-link` icons, `<salla-menu>`'s\n * `.s-menu-footer-item` rows, `<salla-payments>`'s `.s-payments-list-item`\n * icons) is the consuming theme's own responsibility, the same way\n * `inSheet`'s own presentation is -- this component owns structure and data,\n * not every pixel.\n */\nexport function Footer({ inSheet = false }: FooterProps = {}) {\n const { store, theme } = useTwilight();\n const { t } = useTranslation();\n const year = new Date().getFullYear();\n const isCentered = theme.settings?.footer_layout === 'centered';\n const isDark = !!theme.settings?.footer_is_dark;\n\n const Root = inSheet ? 'div' : 'footer';\n\n return (\n <Root\n className={`store-footer store-footer--${isCentered ? 'centered' : 'columns'}${\n inSheet ? ' store-footer--sheet' : ''\n } relative mt-8 sm:mt-16 ${isDark ? 'bg-[#0E0F0F] text-white' : 'bg-[#F4F7F2] text-gray-600'}`}\n suppressHydrationWarning\n >\n {!inSheet && <HookSlot name=\"footer:start\" />}\n\n <div\n aria-label=\"footer\"\n className={`store-footer__inner border-b py-8 lg:py-16 ${\n isDark ? 'bg-[#1D1F1F] border-dashed border-white/10' : 'bg-transparent border-gray-200'\n }`}\n >\n {isCentered ? (\n <FooterCenteredBody inSheet={inSheet} isDark={isDark} />\n ) : (\n <FooterColumnsBody inSheet={inSheet} isDark={isDark} />\n )}\n </div>\n\n <div className=\"store-footer__bottom container md:flex items-center justify-between gap-4 py-4 lg:py-7 text-center\">\n <span className={`text-sm copyright-text ${isDark ? 'text-gray-400' : 'text-gray-700'}`}>\n <HookSlot\n name=\"copyright\"\n context={{ storeName: store.name }}\n fallback={\n <>\n {t('blocks.footer.copyright', 'All rights reserved')}{' '}\n <Link to=\"/\" className=\"transition-opacity hover:opacity-75 hover:text-primary\">\n {store.name}\n </Link>{' '}\n © {year}\n </>\n }\n />\n </span>\n\n <SallaPayments />\n </div>\n\n {!inSheet && <HookSlot name=\"footer:end\" />}\n </Root>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/layout/Footer.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAM,YAAA,GACJ,+HAAA;AAO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WAEJ,EACF,CAAA;AAAA,8BAEC,aAAA,EAAA,EAAc;AAAA,SAAA,EACjB,CAAA;AAAA,QAEC,CAAC,OAAA,oBAAW,GAAA,CAAC,QAAA,EAAA,EAAS,MAAK,YAAA,EAAa;AAAA;AAAA;AAAA,GAC3C;AAEJ","file":"chunk-PTQVBPPN.js","sourcesContent":["import { useState } from 'react';\nimport { SallaAppsIcons } from '@salla.sa/twilight-components-react/apps-icons';\nimport { SallaContacts } from '@salla.sa/twilight-components-react/contacts';\nimport { SallaSocial } from '@salla.sa/twilight-components-react/social';\nimport { SallaMenu } from '@salla.sa/twilight-components-react/menu';\nimport { SallaTrustBadges } from '@salla.sa/twilight-components-react/trust-badges';\nimport { SallaPayments } from '@salla.sa/twilight-components-react/payments';\nimport { useTwilight } from '../../providers/twilight-context';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { HookSlot } from '../../hooks/HookSlot';\nimport { useIsClient } from '../../hooks/useIsClient';\nimport { Link, Image } from '../common';\nimport { ImageModal } from '../modal';\n\n/** Salla's value-added-tax badge icon (70×70, CDN-resized) — a platform\n * asset shared by every store, not specific to any one theme. */\nconst TAX_ICON_URL =\n 'https://cdn.salla.network/cdn-cgi/image/fit=scale-down,width=70,height=70,onerror=redirect,format=auto/images/tax.png?v=2.0.5';\n\n/**\n * The store's value-added-tax registration: the tax number, plus the certificate as\n * the tax icon that opens the certificate image full size in a modal. Nothing shows\n * when the store has no tax number.\n */\nfunction FooterTax({ dark }: { dark: boolean }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const [open, setOpen] = useState(false);\n const number = store.settings?.tax?.number;\n const certificate = store.settings?.tax?.certificate;\n if (!number) return null;\n\n return (\n <div\n data-testid=\"store-footer-tax\"\n className=\"store-footer__tax flex items-end gap-2 rtl:space-x-reverse\"\n >\n {certificate && (\n <>\n <button\n type=\"button\"\n data-testid=\"store-footer-tax-certificate\"\n className=\"store-footer__tax-cert shrink-0\"\n aria-label={t('common.elements.tax_certificate', 'Tax Certificate')}\n aria-haspopup=\"dialog\"\n onClick={() => setOpen(true)}\n >\n <img\n src={TAX_ICON_URL}\n alt={t('common.elements.tax_certificate', 'Tax Certificate')}\n width={40}\n height={50}\n loading=\"lazy\"\n decoding=\"async\"\n className=\"w-10 rounded-sm transition-opacity hover:opacity-80\"\n />\n </button>\n <ImageModal\n isOpen={open}\n onClose={() => setOpen(false)}\n src={certificate}\n alt={t('common.elements.tax_certificate', 'Tax Certificate')}\n title={t('common.elements.tax_certificate', 'Tax Certificate')}\n />\n </>\n )}\n <div>\n <p className={`mb-1 text-sm opacity-70 ${dark ? 'text-white' : ''}`}>\n {t('common.elements.tax_number', 'Tax Number')}\n </p>\n <b className=\"text-sm\">{number}</b>\n </div>\n </div>\n );\n}\n\n/** Saudi Business Center (SBC) logo, CDN-versioned like the tax icon -- also a\n * platform asset, not theme-specific. */\nconst SBC_ICON_URL = 'https://cdn.salla.network/images/sbc.png?v=2.0.5';\n\n/**\n * The store's Saudi Business Center certificate: a \"Trusted by Business Platform\" badge that\n * opens the certificate's page on the SBC site so visitors can verify the merchant. Nothing\n * shows when the store has no certificate.\n */\nfunction FooterSbc({ dark }: { dark: boolean }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n const id = store.settings?.certificate?.id;\n if (!id) return null;\n\n return (\n <a\n href={`https://eauthenticate.saudibusiness.gov.sa/certificate-details/${encodeURIComponent(id)}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n data-testid=\"store-footer-sbc\"\n className=\"store-footer__sbc flex items-center gap-2.5 transition-opacity hover:opacity-75\"\n >\n <img\n src={SBC_ICON_URL}\n alt={`SBC ${id}`}\n width={56}\n height={40}\n loading=\"lazy\"\n decoding=\"async\"\n className=\"h-10 w-14 rounded-sm\"\n />\n <div>\n <p className={`text-xs opacity-70 ${dark ? 'text-white' : ''}`}>\n {t('blocks.footer.sbc_trusted_by', 'Trusted by')}\n </p>\n <b className=\"text-sm\">{t('blocks.footer.sbc_platform', 'Business Platform')}</b>\n </div>\n </a>\n );\n}\n\n/** Trust badges, the tax registration and the SBC badge, side by side (wrapping on narrow columns). */\nfunction FooterTrust({ dark, centered }: { dark: boolean; centered: boolean }) {\n return (\n <div\n data-testid=\"store-footer-trust\"\n className={`store-footer__trust flex flex-wrap items-end gap-x-6 gap-y-3${centered ? ' justify-center' : ''}`}\n >\n <FooterTax dark={dark} />\n <FooterSbc dark={dark} />\n <SallaTrustBadges {...(dark ? { dark: true } : {})} />\n </div>\n );\n}\n\n/**\n * The footer's own menu of (\"important\") links -- skipped entirely when\n * `inSheet`, for a theme that opens it from somewhere else of its own (a\n * mobile account sheet, a dedicated links screen, …) instead; showing it\n * again down here would just be a redundant second copy. `heading` wraps it\n * in the grid layout's own `.store-footer__links` column; the centered\n * layout's inline row has none.\n */\nfunction FooterLinksMenu({\n inSheet,\n className,\n heading,\n dark,\n}: {\n inSheet: boolean;\n className: string;\n heading?: string;\n dark: boolean;\n}) {\n if (inSheet) return null;\n\n const menu = <SallaMenu source=\"footer\" className={className} suppressHydrationWarning />;\n if (!heading) return menu;\n\n return (\n <div className=\"store-footer__links\">\n <h3 className={`mb-3 text-lg font-bold lg:mb-5 ${dark ? 'text-white' : 'text-gray-900'}`}>\n {heading}\n </h3>\n {menu}\n </div>\n );\n}\n\n/** App-store / Google-Play buttons. Nothing shows -- not even the wrapping\n * div -- when the store has neither link set. */\nfunction FooterApps({ className }: { className: string }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n // The web component fills its light DOM before React hydrates the footer, a hydration error.\n const isClient = useIsClient();\n if (!store.apps?.appstore && !store.apps?.googleplay) return null;\n\n return (\n <div data-testid=\"store-footer-apps\" className={`store-footer__apps ${className}`}>\n {isClient && (\n <SallaAppsIcons\n apps={store.apps}\n appsTitle={t('blocks.footer.download_apps', 'Get our apps')}\n />\n )}\n </div>\n );\n}\n\n/** The logo link, same shape in both layouts -- only its own spacing differs. */\nfunction FooterLogo({ className }: { className: string }) {\n const { store } = useTwilight();\n return (\n <Link\n to=\"/\"\n className={`store-footer__logo inline-flex items-center m-0 transition-opacity hover:opacity-75 ${className}`}\n >\n <Image\n src={store.logo}\n alt={store.name || 'Store'}\n width={150}\n height={44}\n objectFit=\"contain\"\n className=\"h-11 w-auto max-w-[180px]\"\n />\n </Link>\n );\n}\n\n/** Merchant-authored description HTML -- mirrors the Twig theme's\n * `store.description|raw`. Renders nothing when the store has none set. */\nfunction FooterDescription({ className }: { className: string }) {\n const { store } = useTwilight();\n if (!store.description) return null;\n return (\n <div\n className={`store-footer__desc opacity-80 ${className}`}\n dangerouslySetInnerHTML={{ __html: store.description }}\n />\n );\n}\n\n/** The store's phone and email as one \"Contact us: …\" row under the description\n * (`<salla-contacts>`'s compact `isHeader` layout, which shows only those two).\n * Renders nothing when the store has neither. */\nfunction FooterContacts({ className }: { className: string }) {\n const { store } = useTwilight();\n const { t } = useTranslation();\n if (!store.contacts?.phone && !store.contacts?.email) return null;\n return (\n <div className={`store-footer__contacts ${className}`}>\n <SallaContacts\n contacts={store.contacts}\n contactsTitle={t('blocks.footer.social', 'Contact us')}\n isHeader\n />\n </div>\n );\n}\n\n/** Centered layout: logo, description, contacts, social, footer menu, trust\n * badges and app buttons stacked as one centered column. */\nfunction FooterCenteredBody({ inSheet, isDark }: { inSheet: boolean; isDark: boolean }) {\n return (\n <div className=\"container mx-auto flex max-w-2xl flex-col items-center gap-6 text-center\">\n <FooterLogo className=\"\" />\n <FooterDescription className=\"\" />\n <FooterContacts className=\"\" />\n <SallaSocial />\n\n <FooterLinksMenu\n inSheet={inSheet}\n className=\"store-footer__menu store-footer__menu--inline\"\n dark={isDark}\n />\n\n <FooterTrust dark={isDark} centered />\n\n <FooterApps className=\"flex flex-col items-center gap-3\" />\n </div>\n );\n}\n\n/** Columns layout: brand (logo / description / contacts / social / trust) and app\n * buttons side by side, with the footer menu as its own labeled column. */\nfunction FooterColumnsBody({ inSheet, isDark }: { inSheet: boolean; isDark: boolean }) {\n const { t } = useTranslation();\n\n return (\n <div className=\"container grid grid-cols-1 gap-10 sm:grid-cols-2 lg:grid-cols-4 lg:gap-16\">\n <div className=\"store-footer__brand rtl:lg:pl-16 ltr:lg:pr-16 sm:col-span-2\">\n <FooterLogo className=\"mb-5\" />\n <FooterDescription className=\"max-w-sm leading-6 my-5\" />\n <FooterContacts className=\"mb-6\" />\n <SallaSocial className=\"block mb-6\" />\n <FooterTrust dark={isDark} centered={false} />\n </div>\n\n <FooterLinksMenu\n inSheet={inSheet}\n className=\"store-footer__menu store-footer__menu--stacked\"\n heading={t('blocks.footer.important_links', 'Important links')}\n dark={isDark}\n />\n\n <FooterApps className=\"\" />\n </div>\n );\n}\n\nexport interface FooterProps {\n /**\n * Renders as a plain `<div>` (no second `<footer>` landmark) with the\n * `footer:start` / `footer:end` hook slots skipped -- for a theme that\n * repeats these widgets somewhere other than the page's own footer (a\n * mobile sheet, for example) rather than rendering the real page footer a\n * second time.\n */\n inSheet?: boolean;\n}\n\n/**\n * Storefront footer.\n *\n * Two layouts, chosen by the `footer_layout` theme setting:\n * - **columns** (default): logo / description / social / trust badges, the\n * footer menu (\"important links\"), and app-store buttons, side by side.\n * - **centered**: the same pieces stacked as one centered column, with the\n * footer menu laid out as an inline, pipe-separated row.\n *\n * Styling for the handful of pieces rendered by web components this owns no\n * markup for (`<salla-social>`'s `.social-link` icons, `<salla-menu>`'s\n * `.s-menu-footer-item` rows, `<salla-payments>`'s `.s-payments-list-item`\n * icons) is the consuming theme's own responsibility, the same way\n * `inSheet`'s own presentation is -- this component owns structure and data,\n * not every pixel.\n */\nexport function Footer({ inSheet = false }: FooterProps = {}) {\n const { store, theme } = useTwilight();\n const { t } = useTranslation();\n const year = new Date().getFullYear();\n const isCentered = theme.settings?.footer_layout === 'centered';\n const isDark = !!theme.settings?.footer_is_dark;\n\n const Root = inSheet ? 'div' : 'footer';\n\n return (\n <Root\n className={`store-footer store-footer--${isCentered ? 'centered' : 'columns'}${\n inSheet ? ' store-footer--sheet' : ''\n } relative mt-8 sm:mt-16 ${isDark ? 'bg-[#0E0F0F] text-white' : 'bg-[#F4F7F2] text-gray-600'}`}\n suppressHydrationWarning\n >\n {!inSheet && <HookSlot name=\"footer:start\" />}\n\n <div\n aria-label=\"footer\"\n className={`store-footer__inner border-b py-8 lg:py-16 ${\n isDark ? 'bg-[#1D1F1F] border-dashed border-white/10' : 'bg-transparent border-gray-200'\n }`}\n >\n {isCentered ? (\n <FooterCenteredBody inSheet={inSheet} isDark={isDark} />\n ) : (\n <FooterColumnsBody inSheet={inSheet} isDark={isDark} />\n )}\n </div>\n\n <div className=\"store-footer__bottom container md:flex items-center justify-between gap-4 py-4 lg:py-7 text-center\">\n <span className={`text-sm copyright-text ${isDark ? 'text-gray-400' : 'text-gray-700'}`}>\n <HookSlot\n name=\"copyright\"\n context={{ storeName: store.name }}\n fallback={\n <>\n {t('blocks.footer.copyright', 'All rights reserved')}{' '}\n <Link to=\"/\" className=\"transition-opacity hover:opacity-75 hover:text-primary\">\n {store.name}\n </Link>{' '}\n © {year}\n </>\n }\n />\n </span>\n\n <SallaPayments />\n </div>\n\n {!inSheet && <HookSlot name=\"footer:end\" />}\n </Root>\n );\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { orThrow } from './chunk-
|
|
2
|
-
import { getAuthToken, api } from './chunk-
|
|
1
|
+
import { orThrow } from './chunk-UWDUMPL7.js';
|
|
2
|
+
import { getAuthToken, api } from './chunk-YDSWLCOY.js';
|
|
3
3
|
import { queryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
var loyalty = {
|
|
@@ -29,5 +29,5 @@ var loyalty = {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
export { loyalty };
|
|
32
|
-
//# sourceMappingURL=chunk-
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
32
|
+
//# sourceMappingURL=chunk-QA4FBMFJ.js.map
|
|
33
|
+
//# sourceMappingURL=chunk-QA4FBMFJ.js.map
|
|
@@ -1 +1 @@
|
|
|
1
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,kBAAkB,YAA6B;AAC7C,IAAA,MAAM,WAAW,MAAM,GAAA,CAAI,GAAA,CAAI,gBAAgB,EAAE,IAAA,EAA2B;AAC5E,IAAA,OAAO,QAAA,CAAS,OAAA;AAAA,EAClB,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,MAAA,EAAQ,MACN,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,SAAS,CAAA;AAAA,MACpB,OAAA,EAAS,MAAM,OAAA,CAAQ,GAAA;AAAI,KAC5B,CAAA;AAAA,IACH,MAAA,EAAQ,MACN,YAAA,CAA4B;AAAA,MAC1B,QAAA,EAAU,CAAC,SAAA,EAAW,QAAQ,CAAA;AAAA,MAC9B,OAAA,EAAS,MAAM,OAAA,CAAQ,gBAAA,EAAiB;AAAA;AAAA;AAAA,MAGxC,OAAA,EAAS,CAAC,CAAC,YAAA,EAAa;AAAA,MACxB,SAAA,EAAW;AAAA,KACZ;AAAA;AAEP","file":"chunk-QA4FBMFJ.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getAuthToken } from './client';\nimport type { Loyalty, PointBalanceResponse } from '../routes/loyalty/types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const loyalty = {\n get: async (): Promise<Loyalty> => {\n const { data } = await api.get('loyalty').json<{ data: Loyalty }>();\n return data;\n },\n\n getOrThrow: (): Promise<Loyalty> => orThrow(loyalty.get()),\n\n getPointsBalance: async (): Promise<number> => {\n const response = await api.get('balance/points').json<PointBalanceResponse>();\n return response.balance;\n },\n\n queries: {\n detail: () =>\n queryOptions({\n queryKey: ['loyalty'],\n queryFn: () => loyalty.get(),\n }),\n points: () =>\n queryOptions<number | null>({\n queryKey: ['loyalty', 'points'],\n queryFn: () => loyalty.getPointsBalance(),\n // Points are customer-scoped; skip for guests (no token) — the request would\n // otherwise 400 with `token_not_provided`.\n enabled: !!getAuthToken(),\n staleTime: 30_000,\n }),\n },\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { redirect } from './chunk-
|
|
2
|
-
import { clearAuthTokenCookie } from './chunk-
|
|
1
|
+
import { redirect } from './chunk-UWDUMPL7.js';
|
|
2
|
+
import { clearAuthTokenCookie } from './chunk-GXZW6BJY.js';
|
|
3
3
|
import { FALLBACK_LOCALE } from './chunk-T72DAX7R.js';
|
|
4
4
|
import { useEffect } from 'react';
|
|
5
5
|
|
|
@@ -37,5 +37,5 @@ function LogoutRedirect() {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
export { LogoutRedirect, accountRedirectLoader, pendingOrdersRedirectLoader, productsSourceRedirectLoader, ratingRedirectLoader, slugBrandRedirectLoader };
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
41
|
-
//# sourceMappingURL=chunk-
|
|
40
|
+
//# sourceMappingURL=chunk-RA6ZTHN6.js.map
|
|
41
|
+
//# sourceMappingURL=chunk-RA6ZTHN6.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/routes/seo-redirects.ts"],"names":[],"mappings":";;;;;AAcA,eAAsB,wBAAwB,GAAA,EAAkD;AAC9F,EAAA,MAAM,MAAA,GAAS,GAAA,CAAI,MAAA,CAAO,MAAA,IAAU,eAAA;AACpC,EAAA,MAAM,SAAS,CAAA,CAAA,EAAI,MAAM,WAAW,GAAA,CAAI,MAAA,CAAO,EAAE,CAAA,CAAE,CAAA;AACrD;AAOA,eAAsB,4BACpB,GAAA,GAA+C,EAAE,MAAA,EAAQ,IAAG,EAC5C;AAChB,EAAA,MAAM,MAAA,GAAS,GAAA,CAAI,MAAA,CAAO,MAAA,IAAU,eAAA;AACpC,EAAA,MAAM,QAAA,CAAS,CAAA,CAAA,EAAI,MAAM,CAAA,8BAAA,CAAgC,CAAA;AAC3D;AAGA,eAAsB,qBACpB,GAAA,GAA+C,EAAE,MAAA,EAAQ,IAAG,EAC5C;AAChB,EAAA,MAAM,MAAA,GAAS,GAAA,CAAI,MAAA,CAAO,MAAA,IAAU,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;AAC7D,EAAA,MAAM,KAAA,GAAQ,IAAI,eAAA,CAAgB,GAAA,CAAI,MAAM,CAAA;AAC5C,EAAA,KAAA,CAAM,OAAO,QAAQ,CAAA;AACrB,EAAA,MAAM,IAAA,GAAO,MAAM,QAAA,EAAS;AAC5B,EAAA,MAAM,QAAA,CAAS,CAAA,EAAG,MAAM,CAAA,iBAAA,EAAoB,GAAA,CAAI,MAAM,CAAA,EAAG,IAAA,GAAO,CAAA,CAAA,EAAI,IAAI,CAAA,CAAA,GAAK,EAAE,CAAA,CAAA,EAAI;AAAA,IACjF,UAAA,EAAY;AAAA,GACb,CAAA;AACH;AAUO,SAAS,cAAA,GAAuB;AACrC,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,oBAAA,EAAqB;AAErB,IAAA,MAAA,CAAO,QAAA,CAAS,QAAQ,MAAA,CAAO,QAAA,CAAS,KAAK,OAAA,CAAQ,8BAAA,EAAgC,EAAE,CAAC,CAAA;AAAA,EAC1F,CAAA,EAAG,EAAE,CAAA;AACL,EAAA,OAAO,IAAA;AACT","file":"chunk-RA6ZTHN6.js","sourcesContent":["import { useEffect } from 'react';\nimport { redirect } from '../providers/NavigationProvider';\nimport { FALLBACK_LOCALE } from '../providers/locale-constants';\nimport { clearAuthTokenCookie } from '../utils/cookies';\n\nexport interface SlugBrandParams {\n /** SEO slug segment (ignored — only here to match the route pattern). */\n slug: string;\n /** Brand numeric ID to redirect to. */\n id: string;\n /** Active locale from the `/$locale` parent layout (e.g. `'ar'`, `'en'`). */\n locale?: string;\n}\n\nexport async function slugBrandRedirectLoader(ctx: { params: SlugBrandParams }): Promise<never> {\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n throw redirect(`/${locale}/brands/${ctx.params.id}`);\n}\n\nexport interface PendingOrdersRedirectParams {\n /** Active locale from the `/$locale` parent layout (e.g. `'ar'`, `'en'`). */\n locale?: string;\n}\n\nexport async function pendingOrdersRedirectLoader(\n ctx: { params: PendingOrdersRedirectParams } = { params: {} }\n): Promise<never> {\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n throw redirect(`/${locale}/account/orders?status=pending`);\n}\n\n/** `/account/rating`: the loyalty \"rate your orders\" link. Twig Raed has no rating page and sends it to the orders list. */\nexport async function ratingRedirectLoader(\n ctx: { params: PendingOrdersRedirectParams } = { params: {} }\n): Promise<never> {\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n throw redirect(`/${locale}/account/orders`);\n}\n\n/** A Twig customer URL (`/profile`, `/orders`, …) kept working as its `/account/…` page. */\nexport async function accountRedirectLoader(ctx: {\n params: PendingOrdersRedirectParams;\n page: string;\n /** The incoming query string (`?status=pending`), kept on the account page. */\n search?: string;\n}): Promise<never> {\n // No locale in the URL stays without one: the locale layout adds it only where the store has several.\n const prefix = ctx.params.locale ? `/${ctx.params.locale}` : '';\n throw redirect(`${prefix}/account/${ctx.page}${ctx.search ?? ''}`, { statusCode: 301 });\n}\n\n/** `/latest-products`, `/most-sales-products` and `/offers` now live at `/products?source=`. */\nexport async function productsSourceRedirectLoader(ctx: {\n params: PendingOrdersRedirectParams;\n source: 'latest' | 'sales' | 'offers';\n search?: string;\n}): Promise<never> {\n const prefix = ctx.params.locale ? `/${ctx.params.locale}` : '';\n const query = new URLSearchParams(ctx.search);\n query.delete('source');\n const rest = query.toString();\n throw redirect(`${prefix}/products?source=${ctx.source}${rest ? `&${rest}` : ''}`, {\n statusCode: 301,\n });\n}\n\n/**\n * `/logout` — where the SDK sends the browser once `salla.auth.logout()` has run\n * (`salla.url.get('logout?from=…')`). The Twig storefront serves that URL server-side. Here\n * it renders nothing and, in the browser, removes the theme's own `token` cookie (the SDK's\n * `cookie.clearAll()` leaves it) and then does a full navigation home. It has to be a\n * component, not a loader redirect: a loader runs during server rendering, where the cookie\n * can't be cleared, so the redirect would leave the visitor signed in on the next request.\n */\nexport function LogoutRedirect(): null {\n useEffect(() => {\n clearAuthTokenCookie();\n // `/{store base}/{locale}/logout?from=…` → `/{store base}/{locale}`\n window.location.replace(window.location.href.replace(/\\/logout\\/?(\\?[^#]*)?(#.*)?$/, ''));\n }, []);\n return null;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { user } from './chunk-
|
|
2
|
-
import { getTwilightContext } from './chunk-
|
|
1
|
+
import { user } from './chunk-24UCMWQB.js';
|
|
2
|
+
import { getTwilightContext } from './chunk-JNAJTCJD.js';
|
|
3
3
|
import { useQuery } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
function useUser() {
|
|
@@ -13,5 +13,5 @@ function useUser() {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export { useUser };
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-RBFLDI2Z.js.map
|
|
17
|
+
//# sourceMappingURL=chunk-RBFLDI2Z.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/useUser.ts"],"names":[],"mappings":";;;;AAUO,SAAS,OAAA,GAAyB;AACvC,EAAA,MAAM,KAAA,GAAQ,oBAAmB,CAAE,SAAA;AAEnC,EAAA,MAAM,QAAQ,QAAA,CAAS;AAAA,IACrB,GAAG,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAQ;AAAA,IACxB,OAAA,EAAS,CAAC,CAAC,KAAA;AAAA,IACX,eAAA,EAAiB;AAAA,GAClB,CAAA;AAED,EAAA,OAAO,EAAE,GAAG,KAAA,EAAO,UAAA,EAAY,CAAC,CAAC,KAAA,EAAM;AACzC","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/hooks/useUser.ts"],"names":[],"mappings":";;;;AAUO,SAAS,OAAA,GAAyB;AACvC,EAAA,MAAM,KAAA,GAAQ,oBAAmB,CAAE,SAAA;AAEnC,EAAA,MAAM,QAAQ,QAAA,CAAS;AAAA,IACrB,GAAG,IAAA,CAAK,OAAA,CAAQ,OAAA,EAAQ;AAAA,IACxB,OAAA,EAAS,CAAC,CAAC,KAAA;AAAA,IACX,eAAA,EAAiB;AAAA,GAClB,CAAA;AAED,EAAA,OAAO,EAAE,GAAG,KAAA,EAAO,UAAA,EAAY,CAAC,CAAC,KAAA,EAAM;AACzC","file":"chunk-RBFLDI2Z.js","sourcesContent":["import { useQuery, type UseQueryResult } from '@tanstack/react-query';\nimport { getTwilightContext } from '../twilight/context';\nimport { user } from '../api/user';\nimport type { User } from '../types';\n\nexport type UseUserReturn = UseQueryResult<User | null> & {\n /** True when an auth token exists (regardless of query state). */\n isLoggedIn: boolean;\n};\n\nexport function useUser(): UseUserReturn {\n const token = getTwilightContext().authToken;\n\n const query = useQuery({\n ...user.queries.current(),\n enabled: !!token,\n placeholderData: null,\n });\n\n return { ...query, isLoggedIn: !!token };\n}\n"]}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { home } from './chunk-
|
|
2
|
-
import { product } from './chunk-
|
|
3
|
-
import { ProductCard } from './chunk-
|
|
1
|
+
import { home } from './chunk-TWUOIBO7.js';
|
|
2
|
+
import { product } from './chunk-SQXUWX4B.js';
|
|
3
|
+
import { ProductCard } from './chunk-B2OJZKU4.js';
|
|
4
4
|
import { registry } from './chunk-Y32RHCOH.js';
|
|
5
5
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
6
|
-
import { Image, LazyRenderWhenVisible } from './chunk-
|
|
6
|
+
import { Image, LazyRenderWhenVisible } from './chunk-GFUXGVER.js';
|
|
7
7
|
import { Link } from './chunk-AXW67SY7.js';
|
|
8
|
-
import { whenSallaLoaded } from './chunk-
|
|
9
|
-
import { getTwilightContext } from './chunk-
|
|
10
|
-
import { TwilightContext } from './chunk-DF6FBKDN.js';
|
|
8
|
+
import { whenSallaLoaded } from './chunk-3NFVZJNI.js';
|
|
9
|
+
import { getTwilightContext } from './chunk-JNAJTCJD.js';
|
|
10
|
+
import { useTwilight, TwilightContext } from './chunk-DF6FBKDN.js';
|
|
11
11
|
import { memo, useState, useCallback, createElement, useEffect, lazy, Component, useRef, useMemo, Suspense } from 'react';
|
|
12
12
|
import { SallaProductsSlider, SallaProductsList, ProductsSliderSkeleton, ListSkeleton, SliderSkeleton, BackgroundSliderSkeleton, BulletDeliverySkeleton, ReviewItemSkeleton, FixedProductsSkeleton, Pulse } from '@salla.sa/twilight-components-react';
|
|
13
13
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
@@ -125,10 +125,11 @@ var FixedBanner = memo(function FixedBanner2(props) {
|
|
|
125
125
|
});
|
|
126
126
|
function FixedProducts({ data }) {
|
|
127
127
|
const { t } = useTranslation();
|
|
128
|
+
const { theme } = useTwilight();
|
|
128
129
|
const title = data.title;
|
|
129
130
|
const parsedLimit = Number(data.limit);
|
|
130
131
|
const limit = Number.isInteger(parsedLimit) && parsedLimit > 0 ? parsedLimit : void 0;
|
|
131
|
-
const isVertical = data.isVertical ?? true;
|
|
132
|
+
const isVertical = data.isVertical ?? theme.settings.vertical_fixed_products ?? true;
|
|
132
133
|
const { data: result, isLoading } = useQuery(
|
|
133
134
|
product.queries.list({
|
|
134
135
|
source: data.products.source,
|
|
@@ -153,7 +154,14 @@ function FixedProducts({ data }) {
|
|
|
153
154
|
"div",
|
|
154
155
|
{
|
|
155
156
|
className: "s-products-list-wrapper " + (isVertical ? "s-products-list-vertical-cards" : "s-products-list-horizontal-cards"),
|
|
156
|
-
children: products.slice(0, limit).map((product2) => /* @__PURE__ */ jsx(
|
|
157
|
+
children: products.slice(0, limit).map((product2) => /* @__PURE__ */ jsx(
|
|
158
|
+
ProductCard,
|
|
159
|
+
{
|
|
160
|
+
product: product2,
|
|
161
|
+
layout: isVertical ? "vertical" : "horizontal"
|
|
162
|
+
},
|
|
163
|
+
product2.id
|
|
164
|
+
))
|
|
157
165
|
}
|
|
158
166
|
)
|
|
159
167
|
] });
|
|
@@ -234,8 +242,10 @@ var FeaturedProductsStyle1 = memo(function FeaturedProductsStyle12({
|
|
|
234
242
|
var FeaturedProductsStyle2 = memo(function FeaturedProductsStyle22({
|
|
235
243
|
data
|
|
236
244
|
}) {
|
|
245
|
+
const { theme } = useTwilight();
|
|
237
246
|
const items = data.items || [];
|
|
238
247
|
const isSlider = data.is_slider ?? true;
|
|
248
|
+
const cardLayout = theme.settings.vertical_fixed_products ?? true ? "vertical" : "horizontal";
|
|
239
249
|
const [activeTab, setActiveTab] = useState(items[0]?.id || "");
|
|
240
250
|
const [isAnimating, setIsAnimating] = useState(false);
|
|
241
251
|
const handleTabClick = useCallback(
|
|
@@ -295,8 +305,8 @@ var FeaturedProductsStyle2 = memo(function FeaturedProductsStyle22({
|
|
|
295
305
|
section.products?.source_value,
|
|
296
306
|
section.products?.limit
|
|
297
307
|
),
|
|
298
|
-
itemsClassName:
|
|
299
|
-
children: (products) => products.map((product2) => /* @__PURE__ */ jsx(ProductCard, { product: product2 }, product2.id))
|
|
308
|
+
itemsClassName: `s-products-list-${cardLayout}-cards`,
|
|
309
|
+
children: (products) => products.map((product2) => /* @__PURE__ */ jsx(ProductCard, { product: product2, layout: cardLayout }, product2.id))
|
|
300
310
|
}
|
|
301
311
|
)
|
|
302
312
|
},
|
|
@@ -773,5 +783,5 @@ var ReorderProducts = memo(function ReorderProducts2() {
|
|
|
773
783
|
});
|
|
774
784
|
|
|
775
785
|
export { BundleComponent, ComponentErrorBoundary, DefaultHomeComponents, FeaturedProductsStyle1, FeaturedProductsStyle2, FeaturedProductsStyle3, FixedBanner, FixedProducts, HomeComponentRenderer, LazyTestimonials, PageBlocks, ParallaxBackground, PhotosSlider, ProductsSlider, ReorderProducts, SquarePhotos, StoreFeatures, Youtube, registerHomeComponentConfig, registerHomeComponents, useReorderButtons };
|
|
776
|
-
//# sourceMappingURL=chunk-
|
|
777
|
-
//# sourceMappingURL=chunk-
|
|
786
|
+
//# sourceMappingURL=chunk-S5EVFWAL.js.map
|
|
787
|
+
//# sourceMappingURL=chunk-S5EVFWAL.js.map
|