@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,5 +1,5 @@
|
|
|
1
|
-
import { orThrow, orUnauthorized } from './chunk-
|
|
2
|
-
import { api } from './chunk-
|
|
1
|
+
import { orThrow, orUnauthorized } from './chunk-UWDUMPL7.js';
|
|
2
|
+
import { api } from './chunk-YDSWLCOY.js';
|
|
3
3
|
import { queryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
var order = {
|
|
@@ -78,5 +78,5 @@ var order = {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
export { order };
|
|
81
|
-
//# sourceMappingURL=chunk-
|
|
82
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-UKLYL5LM.js.map
|
|
82
|
+
//# sourceMappingURL=chunk-UKLYL5LM.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/order.ts"],"names":[],"mappings":";;;;AAoDO,IAAM,KAAA,GAAQ;AAAA,EACnB,IAAA,EAAM,OAAO,MAAA,KAA2D;AACtE,IAAA,MAAM;AAAA,MACJ,IAAA;AAAA,MACA,MAAA;AAAA,MACA,MAAA;AAAA,MACA,eAAA,EAAiB,cAAA;AAAA,MACjB,UAAA,EAAY,SAAA;AAAA,MACZ;AAAA,KACF,GAAI,UAAU,EAAC;AAEf,IAAA,MAAM,YAAA,GAAe,IAAI,eAAA,EAAgB;AACzC,IAAA,IAAI,SAAS,MAAA,EAAW,YAAA,CAAa,IAAI,MAAA,EAAQ,MAAA,CAAO,IAAI,CAAC,CAAA;AAC7D,IAAA,IAAI,MAAA,EAAQ,YAAA,CAAa,GAAA,CAAI,QAAA,EAAU,MAAM,CAAA;AAC7C,IAAA,IAAI,MAAA,EAAQ,YAAA,CAAa,GAAA,CAA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A,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,QAAA,EAAU,WAAA,EAAa,OAAO,CAAA;AAAA,MACzC,OAAA,EAAS,MAAM,KAAA,CAAM,SAAA,CAAU,OAAO;AAAA,KACvC,CAAA;AAAA,IACH,OAAA,EAAS,CAAC,OAAA,KACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,QAAA,EAAU,SAAA,EAAW,OAAO,CAAA;AAAA,MACvC,OAAA,EAAS,MAAM,KAAA,CAAM,OAAA,CAAQ,OAAO;AAAA,KACrC,CAAA;AAAA,IACH,QAAA,EAAU,CAAC,OAAA,KACT,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,QAAA,EAAU,UAAA,EAAY,OAAO,CAAA;AAAA,MACxC,OAAA,EAAS,MAAM,KAAA,CAAM,QAAA,CAAS,OAAO;AAAA,KACtC;AAAA;AAEP","file":"chunk-UKLYL5LM.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\nimport type {\n Order,\n OrderListItem,\n OrderShipmentItem,\n OrderRatingItem,\n} from '../routes/account/types';\nimport type { Pagination } from './types';\nimport { orThrow, orUnauthorized } from '../providers/NavigationProvider';\n\nexport interface OrderDetailResponse {\n order: Order;\n}\n\n/**\n * The order in the shape the Twilight web components read (`salla-order-details`,\n * `salla-order-totals-card`) and the Twig themes render: the API answers `orders/{id}` this\n * way when the request does not say it comes from a React theme (`s-theme-type`).\n */\nexport interface TwilightOrder {\n items: Array<{\n name: string;\n quantity: number;\n product?: { id: number; url?: string; type?: string; image?: { url?: string } };\n options?: unknown[];\n }>;\n [key: string]: unknown;\n}\n\nexport interface CheckoutThankYouData {\n thank_you_title?: string;\n messages?: string[];\n share_message?: string;\n short_share_message?: string;\n}\n\nexport interface OrdersListResponse {\n data: OrderListItem[];\n cursor?: Pagination;\n}\n\nexport interface OrdersListParams {\n page?: number;\n cursor?: string | null;\n status?: string;\n feedback_status?: string;\n /** When set, the list payload includes each order's `items[]` (`with_items=1`). */\n with_items?: boolean | number;\n signal?: AbortSignal;\n}\n\nexport const order = {\n list: async (params?: OrdersListParams): Promise<OrdersListResponse> => {\n const {\n page,\n cursor,\n status,\n feedback_status: feedbackStatus,\n with_items: withItems,\n signal,\n } = params ?? {};\n\n const searchParams = new URLSearchParams();\n if (page !== undefined) searchParams.set('page', String(page));\n if (cursor) searchParams.set('cursor', cursor);\n if (status) searchParams.set('status', status);\n if (feedbackStatus) searchParams.set('feedback_status', feedbackStatus);\n if (withItems) searchParams.set('with_items', '1');\n\n const options: Record<string, unknown> = {};\n if (signal) options.signal = signal;\n\n const response = await api\n .get(`orders?${searchParams.toString()}`, options as any)\n .json<{ data: OrderListItem[] | null; cursor?: Pagination }>();\n\n return {\n data: response.data ?? [],\n cursor: response.cursor,\n };\n },\n\n find: async (id: string): Promise<OrderDetailResponse> => {\n const response = await api.get(`orders/${id}`).json<{ data: Order }>();\n\n return { order: response.data };\n },\n\n findForComponents: async (id: string): Promise<TwilightOrder> => {\n const response = await api\n .get(`orders/${id}`, {\n hooks: {\n // Runs after the client's own hook, which marks every request as from a React theme.\n beforeRequest: [({ request }) => request.headers.delete('s-theme-type')],\n },\n })\n .json<{ data: TwilightOrder }>();\n return response.data;\n },\n\n shipments: async (orderId: string): Promise<OrderShipmentItem[]> => {\n const response = await api\n .get(`orders/${orderId}/shipments`)\n .json<{ data: OrderShipmentItem[] }>();\n return response.data ?? [];\n },\n\n ratings: async (orderId: string): Promise<OrderRatingItem[]> => {\n const response = await api.get(`orders/${orderId}/ratings`).json<{ data: OrderRatingItem[] }>();\n return response.data ?? [];\n },\n\n findOrThrow: (id: string): Promise<OrderDetailResponse> =>\n orThrow(orUnauthorized(order.find(id))),\n\n thankYou: async (orderId: string): Promise<CheckoutThankYouData> => {\n const { data } = await api\n .get(`checkout/thank-you/${orderId}`)\n .json<{ data: CheckoutThankYouData }>();\n return data;\n },\n\n thankYouOrThrow: (orderId: string): Promise<CheckoutThankYouData> =>\n orThrow(order.thankYou(orderId)),\n\n queries: {\n list: (params?: Omit<OrdersListParams, 'signal'>) =>\n queryOptions({\n queryKey: ['orders', 'list', params],\n queryFn: ({ signal }) => order.list({ ...params, signal }),\n }),\n find: (id: string) =>\n queryOptions({\n queryKey: ['orders', 'detail', id],\n queryFn: () => order.find(id),\n }),\n shipments: (orderId: string) =>\n queryOptions({\n queryKey: ['orders', 'shipments', orderId],\n queryFn: () => order.shipments(orderId),\n }),\n ratings: (orderId: string) =>\n queryOptions({\n queryKey: ['orders', 'ratings', orderId],\n queryFn: () => order.ratings(orderId),\n }),\n thankYou: (orderId: string) =>\n queryOptions({\n queryKey: ['orders', 'thankYou', orderId],\n queryFn: () => order.thankYou(orderId),\n }),\n },\n};\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { RouteId } from './chunk-OUW6WESU.js';
|
|
2
|
-
import { getActiveScope } from './chunk-
|
|
3
|
-
import { openNativeBrowser } from './chunk-
|
|
4
|
-
import { withoutStoreUrlBase, extractScopeFromUrl } from './chunk-
|
|
5
|
-
import { subscribeTwilight, getTwilightContext } from './chunk-
|
|
2
|
+
import { getActiveScope } from './chunk-YDSWLCOY.js';
|
|
3
|
+
import { openNativeBrowser } from './chunk-A4NN6C5B.js';
|
|
4
|
+
import { withoutStoreUrlBase, extractScopeFromUrl } from './chunk-GXZW6BJY.js';
|
|
5
|
+
import { subscribeTwilight, getTwilightContext } from './chunk-JNAJTCJD.js';
|
|
6
6
|
import { useTwilight } from './chunk-DF6FBKDN.js';
|
|
7
7
|
import { createContext, createElement, useContext, useSyncExternalStore, useRef, useEffect, useCallback } from 'react';
|
|
8
8
|
|
|
@@ -304,5 +304,5 @@ function useNavigationInterceptor(navigate, storeUrl, username) {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
export { NavigationInterceptor, NavigationProvider, NotFoundError, RedirectError, UnauthorizedError, configureNavigation, defaultNavigate, notFound, orThrow, orUnauthorized, redirect, resolveRelativePath, unauthorized, useIsBlog, useIsBrands, useIsCart, useIsCustomer, useIsHome, useIsProduct, useIsSearch, useLocation, useNavigate, useRouteId };
|
|
307
|
-
//# sourceMappingURL=chunk-
|
|
308
|
-
//# sourceMappingURL=chunk-
|
|
307
|
+
//# sourceMappingURL=chunk-UWDUMPL7.js.map
|
|
308
|
+
//# sourceMappingURL=chunk-UWDUMPL7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/providers/NavigationProvider.ts"],"names":[],"mappings":";;;;;;;;AA6BO,IAAM,aAAA,GAAN,cAA4B,KAAA,CAAM;AAAA,EACvC,WAAA,CACS,IAAA,EACA,OAAA,GAAU,KAAA,EACjB;AACA,IAAA,KAAA,CAAM,CAAA,YAAA,EAAe,IAAI,CAAA,CAAE,CAAA;AAHpB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AACA,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAGP,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AAAA,EACd;AACF;AAGO,IAAM,aAAA,GAAN,cAA4B,KAAA,CAAM;AAAA,EACvC,YAAY,OAAA,EAAkB;AAC5B,IAAA,KAAA,CAAM,WAAW,WAAW,CAAA;AAC5B,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AAAA,EACd;AACF;AAGO,IAAM,iBAAA,GAAN,cAAgC,KAAA,CAAM;AAAA,EAC3C,YAAY,OAAA,EAAkB;AAC5B,IAAA,KAAA,CAAM,WAAW,cAAc,CAAA;AAC/B,IAAA,IAAA,CAAK,IAAA,GAAO,mBAAA;AAAA,EACd;AACF;AAIO,IAAM,eAAA,GAA8B,CAAC,EAAA,EAAI,IAAA,KAAS;AACvD,EAAA,IAAI,IAAA,EAAM,OAAA,EAAS,MAAA,CAAO,QAAA,CAAS,QAAQ,EAAE,CAAA;AAAA,OACxC,MAAA,CAAO,SAAS,IAAA,GAAO,EAAA;AAC9B;AASO,IAAM,eAAA,GAAkB,CAAC,IAAA,EAAc,IAAA,KAAkC;A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AA,IAAI;AACF,MAAA,MAAA,CAAO,SAAS,MAAA,GAAS,aAAA;AACzB,MAAA,aAAA,GAAgB,IAAA;AAAA,IAClB,CAAA,CAAA,MAAQ;AAAA,IAER;AACA,IAAA,IAAI;AACF,MAAA,MAAA,CAAO,SAAS,OAAA,GAAU,cAAA;AAC1B,MAAA,cAAA,GAAiB,IAAA;AAAA,IACnB,CAAA,CAAA,MAAQ;AAAA,IAER;AAEA,IAAA,QAAA,CAAS,iBAAiB,OAAA,EAAS,WAAA,EAAa,EAAE,OAAA,EAAS,MAAM,CAAA;AACjE,IAAA,QAAA,CAAS,iBAAiB,aAAA,EAAe,iBAAA,EAAmB,EAAE,OAAA,EAAS,MAAM,CAAA;AAC7E,IAAA,QAAA,CAAS,iBAAiB,WAAA,EAAa,eAAA,EAAiB,EAAE,OAAA,EAAS,MAAM,CAAA;AAEzE,IAAA,OAAO,MAAM;AACX,MAAA,QAAA,CAAS,oBAAoB,OAAA,EAAS,WAAA,EAAa,EAAE,OAAA,EAAS,MAAM,CAAA;AACpE,MAAA,QAAA,CAAS,mBAAA,CAAoB,eAAe,iBAAiB,CAAA;AAC7D,MAAA,QAAA,CAAS,mBAAA,CAAoB,aAAa,eAAe,CAAA;AACzD,MAAA,IAAI,aAAA,EAAe;AACjB,QAAA,IAAI;AACF,UAAA,MAAA,CAAO,SAAS,MAAA,GAAS,UAAA;AAAA,QAC3B,CAAA,CAAA,MAAQ;AAAA,QAER;AAAA,MACF;AACA,MAAA,IAAI,cAAA,EAAgB;AAClB,QAAA,IAAI;AACF,UAAA,MAAA,CAAO,SAAS,OAAA,GAAU,WAAA;AAAA,QAC5B,CAAA,CAAA,MAAQ;AAAA,QAER;AAAA,MACF;AAAA,IACF,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,WAAW,CAAC,CAAA;AAClB","file":"chunk-V7QFIGQ4.js","sourcesContent":["import {\n createElement,\n createContext,\n useContext,\n useCallback,\n useRef,\n useEffect,\n useSyncExternalStore,\n type ReactNode,\n} from 'react';\nimport { useTwilight } from './twilight-context';\nimport { getTwilightContext, subscribeTwilight, type TwilightLocation } from '../twilight/context';\nimport { RouteId } from '../router/route-ids';\nimport { withoutStoreUrlBase } from '../utils/store-base';\nimport { extractScopeFromUrl } from '../utils/cookies';\nimport { getActiveScope } from '../api/client';\nimport { openNativeBrowser } from '../native-app';\n\n// Re-export RouteId from centralized location\nexport { RouteId } from '../router/route-ids';\nexport type { RouteIdType } from '../router/route-ids';\n\n// Re-export TwilightLocation as Location for convenience\nexport type { TwilightLocation as Location } from '../twilight/context';\n\nexport type NavigateOptions = { replace?: boolean };\nexport type NavigateFn = (to: string, opts?: NavigateOptions) => void;\n\n/** Redirect error - thrown to trigger a redirect */\nexport class RedirectError extends Error {\n constructor(\n public path: string,\n public replace = false\n ) {\n super(`Redirect to ${path}`);\n this.name = 'RedirectError';\n }\n}\n\n/** NotFound error - thrown to trigger 404 */\nexport class NotFoundError extends Error {\n constructor(message?: string) {\n super(message ?? 'Not Found');\n this.name = 'NotFoundError';\n }\n}\n\n/** Unauthorized error - thrown to trigger 401 */\nexport class UnauthorizedError extends Error {\n constructor(message?: string) {\n super(message ?? 'Unauthorized');\n this.name = 'UnauthorizedError';\n }\n}\n\nexport { SettingsError } from '../utils/errors';\n\nexport const defaultNavigate: NavigateFn = (to, opts) => {\n if (opts?.replace) window.location.replace(to);\n else window.location.href = to;\n};\n\nexport interface RedirectOptions {\n replace?: boolean;\n /** HTTP status of a server redirect, e.g. 301 for a URL that moved for good. Defaults to 307. */\n statusCode?: number;\n}\n\n/** Default redirect - throws RedirectError with browser navigation as fallback */\nexport const defaultRedirect = (path: string, opts?: RedirectOptions): never => {\n const replace = opts?.replace ?? false;\n\n // In browser, perform actual navigation before throwing\n if (typeof window !== 'undefined') {\n if (replace) window.location.replace(path);\n else window.location.href = path;\n }\n\n throw new RedirectError(path, replace);\n};\n\n/** Default notFound - throws generic error */\nexport const defaultNotFound = (message?: string): never => {\n throw new NotFoundError(message);\n};\n\n/** Default unauthorized - throws generic error */\nexport const defaultUnauthorized = (message?: string): never => {\n throw new UnauthorizedError(message);\n};\n\n// ─── Framework-agnostic functions for loaders (outside React context) ──────\n\ninterface NavigationHandlers {\n notFound: (message?: string) => never;\n redirect: (path: string, opts?: RedirectOptions) => never;\n unauthorized: (message?: string) => never;\n}\n\n// One set per isolate, so a loader in another copy of this module (a separate\n// package entry, a dev reload) still throws what the framework adapter configured.\nconst HANDLERS_KEY = Symbol.for('salla.twilight.navigation.handlers');\nconst registry = globalThis as { [HANDLERS_KEY]?: NavigationHandlers };\nconst handlers: NavigationHandlers = (registry[HANDLERS_KEY] ??= {\n notFound: defaultNotFound,\n redirect: defaultRedirect,\n unauthorized: defaultUnauthorized,\n});\n\n/**\n * Throw a notFound error. Use in route loaders.\n * Framework adapters will override this to throw framework-specific errors.\n *\n * @example\n * ```ts\n * // In loader\n * import { notFound } from '@salla.sa/twilight-theme-engine/providers';\n *\n * if (!data) throw notFound();\n * ```\n */\nexport function notFound(message?: string): never {\n return handlers.notFound(message);\n}\n\n/**\n * Throw an unauthorized error. Use in route loaders to protect authenticated routes.\n * Framework adapters will override this to throw framework-specific errors.\n *\n * @example\n * ```ts\n * import { unauthorized } from '@salla.sa/twilight-theme-engine/providers';\n *\n * if (!user) throw unauthorized();\n * ```\n */\nexport function unauthorized(message?: string): never {\n return handlers.unauthorized(message);\n}\n\n/**\n * Throw a redirect. Use in route loaders.\n * Framework adapters will override this to throw framework-specific redirects.\n *\n * @param path - Path to redirect to\n * @param opts - Redirect options\n *\n * @example\n * ```ts\n * // In loader\n * import { redirect } from '@salla.sa/twilight-theme-engine/providers';\n *\n * throw redirect('/ar/cart');\n * ```\n */\nexport function redirect(path: string, opts?: RedirectOptions): never {\n return handlers.redirect(path, opts);\n}\n\n/**\n * Configure navigation functions for a specific framework.\n * Called by framework adapters during setup.\n */\nexport function configureNavigation(config: {\n notFound?: (message?: string) => never;\n redirect?: (path: string, opts?: RedirectOptions) => never;\n unauthorized?: (_message?: string) => never;\n}): void {\n if (config.notFound) handlers.notFound = config.notFound;\n if (config.redirect) handlers.redirect = config.redirect;\n if (config.unauthorized) handlers.unauthorized = config.unauthorized;\n}\n\n// ─── Loader Error Handling Helpers ─────────────────────────────────────────────\n\n/**\n * Wraps an API promise with error handling for route loaders.\n * On a 404/410 response throws notFound(); other errors propagate.\n *\n * @example\n * ```ts\n * findOrThrow: (id, locale) => orThrow(product.find(id, locale)),\n * const data = await product.findOrThrow(id, locale);\n * ```\n */\nexport async function orThrow<T>(promise: Promise<T>): Promise<T> {\n try {\n return await promise;\n } catch (error) {\n console.debug('[loader error]', error);\n const status = (error as unknown as { response?: { status?: number } })?.response?.status;\n // The API answers a missing resource with 410, sometimes 404.\n if (status === 404 || status === 410) return notFound();\n throw error;\n }\n}\n\n/**\n * Wraps an API promise with error handling for authenticated route loaders.\n * On a 401/403 response throws unauthorized(); other errors propagate.\n *\n * @example\n * ```ts\n * const data = await orUnauthorized(order.find(id, locale));\n * ```\n */\nexport async function orUnauthorized<T>(promise: Promise<T>): Promise<T> {\n try {\n return await promise;\n } catch (error) {\n const status = (error as unknown as { response?: { status?: number } })?.response?.status;\n if (status === 401 || status === 403) {\n throw unauthorized();\n }\n throw error;\n }\n}\n\n// ─── Navigation Context ──────────────────────────────────────────────────────\n\ninterface NavigationContextValue {\n navigate: NavigateFn;\n}\n\nconst NavigationContext = createContext<NavigationContextValue>({\n navigate: defaultNavigate,\n});\n\nexport function NavigationProvider({\n navigate,\n children,\n}: {\n navigate: NavigateFn;\n children: ReactNode;\n}) {\n return createElement(NavigationContext.Provider, { value: { navigate } }, children);\n}\n\n// ─── Primary Hooks (High Compatibility) ───────────────────────────────────────\n\n/**\n * Get the navigate function.\n * Matches React Router, TanStack Router, and Remix naming convention.\n *\n * @returns Navigate function\n *\n * @example\n * ```tsx\n * const navigate = useNavigate();\n * navigate('/cart');\n * navigate('/cart', { replace: true });\n * ```\n */\nexport function useNavigate(): NavigateFn {\n return useContext(NavigationContext).navigate;\n}\n\n/**\n * Get the current route ID.\n * Used for route detection (isHome, isProduct, etc.)\n *\n * @returns Current route ID string\n *\n * @example\n * ```tsx\n * const routeId = useRouteId();\n * if (routeId === RouteId.INDEX) { ... }\n * ```\n */\nexport function useRouteId(): string {\n return useSyncExternalStore(\n subscribeTwilight,\n () => getTwilightContext().routeId,\n () => getTwilightContext().routeId\n );\n}\n\n/**\n * Get the current location (TanStack Router compatible).\n * Reads from the router context for SSR compatibility.\n *\n * @returns Location object matching TanStack's ParsedLocation\n *\n * @example\n * ```tsx\n * const location = useLocation();\n * console.log(location.pathname); // '/ar/products'\n * console.log(location.searchStr); // '?q=shoes&page=2'\n * console.log(location.search); // { q: 'shoes', page: '2' }\n * console.log(location.href); // 'https://store.com/ar/products?q=shoes'\n * console.log(location.hash); // '#section-1'\n * console.log(location.state); // { scrollY: 100 }\n * ```\n */\nexport function useLocation<TSearch = Record<string, unknown>>(): TwilightLocation<TSearch> {\n useTwilight();\n return getTwilightContext().location as TwilightLocation<TSearch>;\n}\n\n// ─── Selector Hooks ───────────────────────────────────────────────────────────\n\n/**\n * Check if current page is homepage */\nexport function useIsHome(): boolean {\n return useRouteId() === RouteId.INDEX;\n}\n\n/** Check if current page is product detail */\nexport function useIsProduct(): boolean {\n return useRouteId() === RouteId.PRODUCT_SINGLE;\n}\n\n/** Check if current page is cart */\nexport function useIsCart(): boolean {\n return useRouteId() === RouteId.CART;\n}\n\n/** Check if current page is in customer area */\nexport function useIsCustomer(): boolean {\n return useRouteId().startsWith('customer');\n}\n\n/** Check if current page is blog related */\nexport function useIsBlog(): boolean {\n const routeId = useRouteId();\n return routeId === RouteId.BLOG_INDEX || routeId === RouteId.BLOG_SINGLE;\n}\n\n/** Check if current page is brands related */\nexport function useIsBrands(): boolean {\n const routeId = useRouteId();\n return routeId === RouteId.BRANDS_INDEX || routeId === RouteId.BRANDS_SINGLE;\n}\n\n/** Check if current page is search */\nexport function useIsSearch(): boolean {\n return useRouteId() === RouteId.SEARCH;\n}\n\n// ─── Navigation Interceptor ──────────────────────────────────────────────────\n\n/**\n * NavigationInterceptor - Framework-agnostic SPA navigation interceptor.\n *\n * Uses navigate function from NavigationProvider context and store URL\n * from TwilightProvider to intercept same-origin navigations.\n */\nexport function NavigationInterceptor(): null {\n const navigate = useNavigate();\n const { store } = useTwilight();\n useNavigationInterceptor(navigate, store?.url, store?.username);\n return null;\n}\n\n/**\n * resolveRelativePath - Resolve href to store-relative path\n *\n * Returns `null` when the URL is not on the same origin as the store,\n * keeping this helper safe against open-redirect misuse.\n *\n * The path is the application's, not the address on Salla's host: a store served\n * under its username there (`https://demostore.salla.sa/ar/dev-…/`) hands out links\n * carrying that segment, and it is removed. On a host where the store is the root\n * of every URL, the router adds its own segment back when it navigates.\n *\n * @param href - The URL to resolve\n * @param storeUrl - The store's base URL\n * @param username - The store's username, which tells that segment apart from a\n * locale spelled the same way (see `withoutStoreUrlBase`)\n * @returns The relative path string, or null if the URL is external\n */\nexport function resolveRelativePath(\n href: string,\n storeUrl: string,\n username?: string | null\n): string | null {\n try {\n const target = new URL(href, window.location.href);\n const base = new URL(storeUrl);\n\n if (target.origin !== base.origin) return null;\n\n const pathname = withoutStoreUrlBase(target.pathname, base.pathname, username);\n const path = pathname + target.search + target.hash;\n return path || '/';\n } catch {\n return null;\n }\n}\n\n/**\n * EXTERNAL_TARGETS - Target attribute values that indicate external navigation\n */\nconst EXTERNAL_TARGETS = new Set(['_blank', '_parent', '_top']);\n\n/**\n * shouldIntercept - Determine if an anchor click should be intercepted by SPA router\n *\n * Follows browser conventions: modifier keys, external targets, downloads,\n * and non-HTTP(S) protocols are left to the browser's default behavior.\n *\n * @param anchor - The anchor element that was clicked\n * @param event - The click event\n * @returns true if the click should be intercepted by the router\n */\nexport function shouldIntercept(anchor: HTMLAnchorElement, event: MouseEvent): boolean {\n if (event.defaultPrevented) return false;\n\n if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return false;\n\n const targetAttr = anchor.getAttribute('target');\n if (targetAttr && EXTERNAL_TARGETS.has(targetAttr)) return false;\n\n if (anchor.hasAttribute('download')) return false;\n\n const rel = (anchor.getAttribute('rel') ?? '').split(/\\s+/);\n if (rel.includes('external')) return false;\n\n const href = anchor.getAttribute('href') ?? '';\n if (!href) return false;\n\n try {\n const url = new URL(href, window.location.href);\n if (url.protocol.startsWith('javascript:')) return false;\n } catch {\n return false;\n }\n\n return true;\n}\n\n/**\n * Whether `href` switches market: its `?scope=` names another scope than the active one,\n * or the same scope with another branch (`allocation_type` / `allocation_id`).\n *\n * Twig switches market with a full load (the SDK's scopes modal calls\n * `location.replace('?scope=<id>')`), and only a document request lets the server render\n * the new market and record it in the `scope` cookie. Left to the browser, not the router.\n */\nexport function switchesScope(href: string): boolean {\n let url: URL;\n try {\n url = new URL(href, window.location.href);\n } catch {\n return false;\n }\n const requested = extractScopeFromUrl(url.href);\n if (!requested) return false;\n const active = getActiveScope();\n if (requested.id !== active?.id) return true;\n return (\n requested.allocation_id != null &&\n (requested.allocation_id !== active.allocation_id ||\n requested.allocation_type !== active.allocation_type)\n );\n}\n\n/**\n * Whether an untouched tap on `anchor` would load a page off the store: an\n * http(s) link to neither this page's origin nor the store's. `mailto:`, `tel:`\n * and the like are the device's to handle, and are left alone. So are product\n * gallery slides (`data-fslightbox`): each links to its own image or video, and\n * the gallery opens it in the app's native gallery, from a click handler that\n * runs after this capture-phase check, so `event.defaultPrevented` is still false.\n */\nexport function leavesStore(\n anchor: HTMLAnchorElement,\n event: MouseEvent,\n storeUrl: string | undefined\n): boolean {\n if (event.defaultPrevented || anchor.hasAttribute('download')) return false;\n if (anchor.hasAttribute('data-fslightbox')) return false;\n let url: URL;\n try {\n url = new URL(anchor.getAttribute('href') ?? '', window.location.href);\n } catch {\n return false;\n }\n if (url.protocol !== 'http:' && url.protocol !== 'https:') return false;\n if (url.origin === window.location.origin) return false;\n try {\n return !storeUrl || url.origin !== new URL(storeUrl).origin;\n } catch {\n return true;\n }\n}\n\nfunction isSamePage(href: string): boolean {\n const url = new URL(href, window.location.href);\n return url.pathname === window.location.pathname && url.search === window.location.search;\n}\n\nfunction closeEnclosingModal(path: EventTarget[]): void {\n const modal = path.find(\n (el): el is HTMLElement & { close?: () => unknown } =>\n el instanceof HTMLElement && el.localName === 'salla-modal'\n );\n void modal?.close?.();\n}\n\n// ─── Navigation Interceptor Hook (framework-agnostic) ─────────────────────────\n\n/**\n * Hook for navigation interception using framework-agnostic navigate function.\n * Framework adapters call this with their navigate implementation.\n */\nexport function useNavigationInterceptor(\n navigate: NavigateFn,\n storeUrl: string | undefined,\n username?: string\n): void {\n const storeUrlRef = useRef<string | undefined>(storeUrl);\n const usernameRef = useRef<string | undefined>(username);\n\n useEffect(() => {\n storeUrlRef.current = storeUrl;\n usernameRef.current = username;\n }, [storeUrl, username]);\n\n const tryNavigate = useCallback(\n (href: string, replace = false): boolean => {\n const currentStoreUrl = storeUrlRef.current;\n if (!currentStoreUrl || switchesScope(href)) return false;\n\n const relativePath = resolveRelativePath(href, currentStoreUrl, usernameRef.current);\n if (!relativePath) return false;\n\n navigate(relativePath, { replace });\n return true;\n },\n [navigate]\n );\n\n useEffect(() => {\n // ── Pointer movement tracking ────────────────────────────────────────────\n // Detect drag/scroll gestures to avoid intercepting clicks from swipes.\n let pointerStartX = 0;\n let pointerStartY = 0;\n let pointerSwiped = false;\n const MOVE_THRESHOLD = 10;\n\n function handlePointerDown(event: PointerEvent): void {\n pointerStartX = event.clientX;\n pointerStartY = event.clientY;\n pointerSwiped = false;\n }\n\n function handlePointerUp(event: PointerEvent): void {\n const dx = Math.abs(event.clientX - pointerStartX);\n const dy = Math.abs(event.clientY - pointerStartY);\n pointerSwiped = dx > MOVE_THRESHOLD || dy > MOVE_THRESHOLD;\n }\n\n // ── Anchor click interception ────────────────────────────────────────────\n function handleClick(event: MouseEvent): void {\n // Ignore clicks that resulted from swipe/drag gestures.\n if (pointerSwiped) {\n pointerSwiped = false;\n return;\n }\n\n const path = event.composedPath();\n const anchor = path.find((el): el is HTMLAnchorElement => el instanceof HTMLAnchorElement);\n\n // Inside the Salla app, a link that leaves the store opens in the device's\n // browser; loaded in the app's webview it would strand the shopper there.\n if (\n anchor &&\n leavesStore(anchor, event, storeUrlRef.current) &&\n openNativeBrowser(anchor.href)\n ) {\n event.preventDefault();\n return;\n }\n\n if (!anchor || !shouldIntercept(anchor, event)) return;\n\n const samePage = isSamePage(anchor.href);\n if (tryNavigate(anchor.href, false)) {\n event.preventDefault();\n // A page load would close a web component's modal; an in-app navigation leaves it open.\n if (!samePage) closeEnclosingModal(path);\n }\n }\n\n // ── window.location.assign patch ─────────────────────────────────────────\n const origAssign = window.location.assign;\n function patchedAssign(url: string): void {\n if (!tryNavigate(url, false)) origAssign.call(window.location, url);\n }\n\n // ── window.location.replace patch ────────────────────────────────────────\n const origReplace = window.location.replace;\n function patchedReplace(url: string): void {\n if (!tryNavigate(url, true)) origReplace.call(window.location, url);\n }\n\n let assignPatched = false;\n let replacePatched = false;\n try {\n window.location.assign = patchedAssign;\n assignPatched = true;\n } catch {\n /* non-writable in this environment */\n }\n try {\n window.location.replace = patchedReplace;\n replacePatched = true;\n } catch {\n /* non-writable in this environment */\n }\n\n document.addEventListener('click', handleClick, { capture: true });\n document.addEventListener('pointerdown', handlePointerDown, { passive: true });\n document.addEventListener('pointerup', handlePointerUp, { passive: true });\n\n return () => {\n document.removeEventListener('click', handleClick, { capture: true });\n document.removeEventListener('pointerdown', handlePointerDown);\n document.removeEventListener('pointerup', handlePointerUp);\n if (assignPatched) {\n try {\n window.location.assign = origAssign;\n } catch {\n /* ignore */\n }\n }\n if (replacePatched) {\n try {\n window.location.replace = origReplace;\n } catch {\n /* ignore */\n }\n }\n };\n }, [tryNavigate]);\n}\n\n// ─── Client navigation config ─────────────────────────────────────────────────\n\nexport interface ClientNav {\n /** Framework adapter to use for client-side navigation. @default 'tanstack' */\n framework?: 'tanstack' | 'nextjs';\n /**\n * Intercept same-origin `<a>` clicks and `window.location` calls from web\n * components and route them through the framework router.\n * @default true\n */\n interceptLinks?: boolean;\n}\n\n// Framework adapter setups are registered in navigation-setups.ts to avoid circular imports.\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/providers/NavigationProvider.ts"],"names":[],"mappings":";;;;;;;;AA6BO,IAAM,aAAA,GAAN,cAA4B,KAAA,CAAM;AAAA,EACvC,WAAA,CACS,IAAA,EACA,OAAA,GAAU,KAAA,EACjB;AACA,IAAA,KAAA,CAAM,CAAA,YAAA,EAAe,IAAI,CAAA,CAAE,CAAA;AAHpB,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AACA,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAGP,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AAAA,EACd;AACF;AAGO,IAAM,aAAA,GAAN,cAA4B,KAAA,CAAM;AAAA,EACvC,YAAY,OAAA,EAAkB;AAC5B,IAAA,KAAA,CAAM,WAAW,WAAW,CAAA;AAC5B,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AAAA,EACd;AACF;AAGO,IAAM,iBAAA,GAAN,cAAgC,KAAA,CAAM;AAAA,EAC3C,YAAY,OAAA,EAAkB;AAC5B,IAAA,KAAA,CAAM,WAAW,cAAc,CAAA;AAC/B,IAAA,IAAA,CAAK,IAAA,GAAO,mBAAA;AAAA,EACd;AACF;AAIO,IAAM,eAAA,GAA8B,CAAC,EAAA,EAAI,IAAA,KAAS;AACvD,EAAA,IAAI,IAAA,EAAM,OAAA,EAAS,MAAA,CAAO,QAAA,CAAS,QAAQ,EAAE,CAAA;AAAA,OACxC,MAAA,CAAO,SAAS,IAAA,GAAO,EAAA;AAC9B;AASO,IAAM,eAAA,GAAkB,CAAC,IAAA,EAAc,IAAA,KAAkC;AAC9E,EAAA,MAAM,OAAA,GAAU,MAAM,OAAA,IAAW,KAAA;AAGjC,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACjC,IAAA,IAAI,OAAA,EAAS,MAAA,CAAO,QAAA,CAAS,OAAA,CAAQ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,CAAO,SAAS,OAAA,GAAU,cAAA;AAC1B,MAAA,cAAA,GAAiB,IAAA;AAAA,IACnB,CAAA,CAAA,MAAQ;AAAA,IAER;AAEA,IAAA,QAAA,CAAS,iBAAiB,OAAA,EAAS,WAAA,EAAa,EAAE,OAAA,EAAS,MAAM,CAAA;AACjE,IAAA,QAAA,CAAS,iBAAiB,aAAA,EAAe,iBAAA,EAAmB,EAAE,OAAA,EAAS,MAAM,CAAA;AAC7E,IAAA,QAAA,CAAS,iBAAiB,WAAA,EAAa,eAAA,EAAiB,EAAE,OAAA,EAAS,MAAM,CAAA;AAEzE,IAAA,OAAO,MAAM;AACX,MAAA,QAAA,CAAS,oBAAoB,OAAA,EAAS,WAAA,EAAa,EAAE,OAAA,EAAS,MAAM,CAAA;AACpE,MAAA,QAAA,CAAS,mBAAA,CAAoB,eAAe,iBAAiB,CAAA;AAC7D,MAAA,QAAA,CAAS,mBAAA,CAAoB,aAAa,eAAe,CAAA;AACzD,MAAA,IAAI,aAAA,EAAe;AACjB,QAAA,IAAI;AACF,UAAA,MAAA,CAAO,SAAS,MAAA,GAAS,UAAA;AAAA,QAC3B,CAAA,CAAA,MAAQ;AAAA,QAER;AAAA,MACF;AACA,MAAA,IAAI,cAAA,EAAgB;AAClB,QAAA,IAAI;AACF,UAAA,MAAA,CAAO,SAAS,OAAA,GAAU,WAAA;AAAA,QAC5B,CAAA,CAAA,MAAQ;AAAA,QAER;AAAA,MACF;AAAA,IACF,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,WAAW,CAAC,CAAA;AAClB","file":"chunk-UWDUMPL7.js","sourcesContent":["import {\n createElement,\n createContext,\n useContext,\n useCallback,\n useRef,\n useEffect,\n useSyncExternalStore,\n type ReactNode,\n} from 'react';\nimport { useTwilight } from './twilight-context';\nimport { getTwilightContext, subscribeTwilight, type TwilightLocation } from '../twilight/context';\nimport { RouteId } from '../router/route-ids';\nimport { withoutStoreUrlBase } from '../utils/store-base';\nimport { extractScopeFromUrl } from '../utils/cookies';\nimport { getActiveScope } from '../api/client';\nimport { openNativeBrowser } from '../native-app';\n\n// Re-export RouteId from centralized location\nexport { RouteId } from '../router/route-ids';\nexport type { RouteIdType } from '../router/route-ids';\n\n// Re-export TwilightLocation as Location for convenience\nexport type { TwilightLocation as Location } from '../twilight/context';\n\nexport type NavigateOptions = { replace?: boolean };\nexport type NavigateFn = (to: string, opts?: NavigateOptions) => void;\n\n/** Redirect error - thrown to trigger a redirect */\nexport class RedirectError extends Error {\n constructor(\n public path: string,\n public replace = false\n ) {\n super(`Redirect to ${path}`);\n this.name = 'RedirectError';\n }\n}\n\n/** NotFound error - thrown to trigger 404 */\nexport class NotFoundError extends Error {\n constructor(message?: string) {\n super(message ?? 'Not Found');\n this.name = 'NotFoundError';\n }\n}\n\n/** Unauthorized error - thrown to trigger 401 */\nexport class UnauthorizedError extends Error {\n constructor(message?: string) {\n super(message ?? 'Unauthorized');\n this.name = 'UnauthorizedError';\n }\n}\n\nexport { SettingsError } from '../utils/errors';\n\nexport const defaultNavigate: NavigateFn = (to, opts) => {\n if (opts?.replace) window.location.replace(to);\n else window.location.href = to;\n};\n\nexport interface RedirectOptions {\n replace?: boolean;\n /** HTTP status of a server redirect, e.g. 301 for a URL that moved for good. Defaults to 307. */\n statusCode?: number;\n}\n\n/** Default redirect - throws RedirectError with browser navigation as fallback */\nexport const defaultRedirect = (path: string, opts?: RedirectOptions): never => {\n const replace = opts?.replace ?? false;\n\n // In browser, perform actual navigation before throwing\n if (typeof window !== 'undefined') {\n if (replace) window.location.replace(path);\n else window.location.href = path;\n }\n\n throw new RedirectError(path, replace);\n};\n\n/** Default notFound - throws generic error */\nexport const defaultNotFound = (message?: string): never => {\n throw new NotFoundError(message);\n};\n\n/** Default unauthorized - throws generic error */\nexport const defaultUnauthorized = (message?: string): never => {\n throw new UnauthorizedError(message);\n};\n\n// ─── Framework-agnostic functions for loaders (outside React context) ──────\n\ninterface NavigationHandlers {\n notFound: (message?: string) => never;\n redirect: (path: string, opts?: RedirectOptions) => never;\n unauthorized: (message?: string) => never;\n}\n\n// One set per isolate, so a loader in another copy of this module (a separate\n// package entry, a dev reload) still throws what the framework adapter configured.\nconst HANDLERS_KEY = Symbol.for('salla.twilight.navigation.handlers');\nconst registry = globalThis as { [HANDLERS_KEY]?: NavigationHandlers };\nconst handlers: NavigationHandlers = (registry[HANDLERS_KEY] ??= {\n notFound: defaultNotFound,\n redirect: defaultRedirect,\n unauthorized: defaultUnauthorized,\n});\n\n/**\n * Throw a notFound error. Use in route loaders.\n * Framework adapters will override this to throw framework-specific errors.\n *\n * @example\n * ```ts\n * // In loader\n * import { notFound } from '@salla.sa/twilight-theme-engine/providers';\n *\n * if (!data) throw notFound();\n * ```\n */\nexport function notFound(message?: string): never {\n return handlers.notFound(message);\n}\n\n/**\n * Throw an unauthorized error. Use in route loaders to protect authenticated routes.\n * Framework adapters will override this to throw framework-specific errors.\n *\n * @example\n * ```ts\n * import { unauthorized } from '@salla.sa/twilight-theme-engine/providers';\n *\n * if (!user) throw unauthorized();\n * ```\n */\nexport function unauthorized(message?: string): never {\n return handlers.unauthorized(message);\n}\n\n/**\n * Throw a redirect. Use in route loaders.\n * Framework adapters will override this to throw framework-specific redirects.\n *\n * @param path - Path to redirect to\n * @param opts - Redirect options\n *\n * @example\n * ```ts\n * // In loader\n * import { redirect } from '@salla.sa/twilight-theme-engine/providers';\n *\n * throw redirect('/ar/cart');\n * ```\n */\nexport function redirect(path: string, opts?: RedirectOptions): never {\n return handlers.redirect(path, opts);\n}\n\n/**\n * Configure navigation functions for a specific framework.\n * Called by framework adapters during setup.\n */\nexport function configureNavigation(config: {\n notFound?: (message?: string) => never;\n redirect?: (path: string, opts?: RedirectOptions) => never;\n unauthorized?: (_message?: string) => never;\n}): void {\n if (config.notFound) handlers.notFound = config.notFound;\n if (config.redirect) handlers.redirect = config.redirect;\n if (config.unauthorized) handlers.unauthorized = config.unauthorized;\n}\n\n// ─── Loader Error Handling Helpers ─────────────────────────────────────────────\n\n/**\n * Wraps an API promise with error handling for route loaders.\n * On a 404/410 response throws notFound(); other errors propagate.\n *\n * @example\n * ```ts\n * findOrThrow: (id, locale) => orThrow(product.find(id, locale)),\n * const data = await product.findOrThrow(id, locale);\n * ```\n */\nexport async function orThrow<T>(promise: Promise<T>): Promise<T> {\n try {\n return await promise;\n } catch (error) {\n console.debug('[loader error]', error);\n const status = (error as unknown as { response?: { status?: number } })?.response?.status;\n // The API answers a missing resource with 410, sometimes 404.\n if (status === 404 || status === 410) return notFound();\n throw error;\n }\n}\n\n/**\n * Wraps an API promise with error handling for authenticated route loaders.\n * On a 401/403 response throws unauthorized(); other errors propagate.\n *\n * @example\n * ```ts\n * const data = await orUnauthorized(order.find(id, locale));\n * ```\n */\nexport async function orUnauthorized<T>(promise: Promise<T>): Promise<T> {\n try {\n return await promise;\n } catch (error) {\n const status = (error as unknown as { response?: { status?: number } })?.response?.status;\n if (status === 401 || status === 403) {\n throw unauthorized();\n }\n throw error;\n }\n}\n\n// ─── Navigation Context ──────────────────────────────────────────────────────\n\ninterface NavigationContextValue {\n navigate: NavigateFn;\n}\n\nconst NavigationContext = createContext<NavigationContextValue>({\n navigate: defaultNavigate,\n});\n\nexport function NavigationProvider({\n navigate,\n children,\n}: {\n navigate: NavigateFn;\n children: ReactNode;\n}) {\n return createElement(NavigationContext.Provider, { value: { navigate } }, children);\n}\n\n// ─── Primary Hooks (High Compatibility) ───────────────────────────────────────\n\n/**\n * Get the navigate function.\n * Matches React Router, TanStack Router, and Remix naming convention.\n *\n * @returns Navigate function\n *\n * @example\n * ```tsx\n * const navigate = useNavigate();\n * navigate('/cart');\n * navigate('/cart', { replace: true });\n * ```\n */\nexport function useNavigate(): NavigateFn {\n return useContext(NavigationContext).navigate;\n}\n\n/**\n * Get the current route ID.\n * Used for route detection (isHome, isProduct, etc.)\n *\n * @returns Current route ID string\n *\n * @example\n * ```tsx\n * const routeId = useRouteId();\n * if (routeId === RouteId.INDEX) { ... }\n * ```\n */\nexport function useRouteId(): string {\n return useSyncExternalStore(\n subscribeTwilight,\n () => getTwilightContext().routeId,\n () => getTwilightContext().routeId\n );\n}\n\n/**\n * Get the current location (TanStack Router compatible).\n * Reads from the router context for SSR compatibility.\n *\n * @returns Location object matching TanStack's ParsedLocation\n *\n * @example\n * ```tsx\n * const location = useLocation();\n * console.log(location.pathname); // '/ar/products'\n * console.log(location.searchStr); // '?q=shoes&page=2'\n * console.log(location.search); // { q: 'shoes', page: '2' }\n * console.log(location.href); // 'https://store.com/ar/products?q=shoes'\n * console.log(location.hash); // '#section-1'\n * console.log(location.state); // { scrollY: 100 }\n * ```\n */\nexport function useLocation<TSearch = Record<string, unknown>>(): TwilightLocation<TSearch> {\n useTwilight();\n return getTwilightContext().location as TwilightLocation<TSearch>;\n}\n\n// ─── Selector Hooks ───────────────────────────────────────────────────────────\n\n/**\n * Check if current page is homepage */\nexport function useIsHome(): boolean {\n return useRouteId() === RouteId.INDEX;\n}\n\n/** Check if current page is product detail */\nexport function useIsProduct(): boolean {\n return useRouteId() === RouteId.PRODUCT_SINGLE;\n}\n\n/** Check if current page is cart */\nexport function useIsCart(): boolean {\n return useRouteId() === RouteId.CART;\n}\n\n/** Check if current page is in customer area */\nexport function useIsCustomer(): boolean {\n return useRouteId().startsWith('customer');\n}\n\n/** Check if current page is blog related */\nexport function useIsBlog(): boolean {\n const routeId = useRouteId();\n return routeId === RouteId.BLOG_INDEX || routeId === RouteId.BLOG_SINGLE;\n}\n\n/** Check if current page is brands related */\nexport function useIsBrands(): boolean {\n const routeId = useRouteId();\n return routeId === RouteId.BRANDS_INDEX || routeId === RouteId.BRANDS_SINGLE;\n}\n\n/** Check if current page is search */\nexport function useIsSearch(): boolean {\n return useRouteId() === RouteId.SEARCH;\n}\n\n// ─── Navigation Interceptor ──────────────────────────────────────────────────\n\n/**\n * NavigationInterceptor - Framework-agnostic SPA navigation interceptor.\n *\n * Uses navigate function from NavigationProvider context and store URL\n * from TwilightProvider to intercept same-origin navigations.\n */\nexport function NavigationInterceptor(): null {\n const navigate = useNavigate();\n const { store } = useTwilight();\n useNavigationInterceptor(navigate, store?.url, store?.username);\n return null;\n}\n\n/**\n * resolveRelativePath - Resolve href to store-relative path\n *\n * Returns `null` when the URL is not on the same origin as the store,\n * keeping this helper safe against open-redirect misuse.\n *\n * The path is the application's, not the address on Salla's host: a store served\n * under its username there (`https://demostore.salla.sa/ar/dev-…/`) hands out links\n * carrying that segment, and it is removed. On a host where the store is the root\n * of every URL, the router adds its own segment back when it navigates.\n *\n * @param href - The URL to resolve\n * @param storeUrl - The store's base URL\n * @param username - The store's username, which tells that segment apart from a\n * locale spelled the same way (see `withoutStoreUrlBase`)\n * @returns The relative path string, or null if the URL is external\n */\nexport function resolveRelativePath(\n href: string,\n storeUrl: string,\n username?: string | null\n): string | null {\n try {\n const target = new URL(href, window.location.href);\n const base = new URL(storeUrl);\n\n if (target.origin !== base.origin) return null;\n\n const pathname = withoutStoreUrlBase(target.pathname, base.pathname, username);\n const path = pathname + target.search + target.hash;\n return path || '/';\n } catch {\n return null;\n }\n}\n\n/**\n * EXTERNAL_TARGETS - Target attribute values that indicate external navigation\n */\nconst EXTERNAL_TARGETS = new Set(['_blank', '_parent', '_top']);\n\n/**\n * shouldIntercept - Determine if an anchor click should be intercepted by SPA router\n *\n * Follows browser conventions: modifier keys, external targets, downloads,\n * and non-HTTP(S) protocols are left to the browser's default behavior.\n *\n * @param anchor - The anchor element that was clicked\n * @param event - The click event\n * @returns true if the click should be intercepted by the router\n */\nexport function shouldIntercept(anchor: HTMLAnchorElement, event: MouseEvent): boolean {\n if (event.defaultPrevented) return false;\n\n if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return false;\n\n const targetAttr = anchor.getAttribute('target');\n if (targetAttr && EXTERNAL_TARGETS.has(targetAttr)) return false;\n\n if (anchor.hasAttribute('download')) return false;\n\n const rel = (anchor.getAttribute('rel') ?? '').split(/\\s+/);\n if (rel.includes('external')) return false;\n\n const href = anchor.getAttribute('href') ?? '';\n if (!href) return false;\n\n try {\n const url = new URL(href, window.location.href);\n if (url.protocol.startsWith('javascript:')) return false;\n } catch {\n return false;\n }\n\n return true;\n}\n\n/**\n * Whether `href` switches market: its `?scope=` names another scope than the active one,\n * or the same scope with another branch (`allocation_type` / `allocation_id`).\n *\n * Twig switches market with a full load (the SDK's scopes modal calls\n * `location.replace('?scope=<id>')`), and only a document request lets the server render\n * the new market and record it in the `scope` cookie. Left to the browser, not the router.\n */\nexport function switchesScope(href: string): boolean {\n let url: URL;\n try {\n url = new URL(href, window.location.href);\n } catch {\n return false;\n }\n const requested = extractScopeFromUrl(url.href);\n if (!requested) return false;\n const active = getActiveScope();\n if (requested.id !== active?.id) return true;\n return (\n requested.allocation_id != null &&\n (requested.allocation_id !== active.allocation_id ||\n requested.allocation_type !== active.allocation_type)\n );\n}\n\n/**\n * Whether an untouched tap on `anchor` would load a page off the store: an\n * http(s) link to neither this page's origin nor the store's. `mailto:`, `tel:`\n * and the like are the device's to handle, and are left alone. So are product\n * gallery slides (`data-fslightbox`): each links to its own image or video, and\n * the gallery opens it in the app's native gallery, from a click handler that\n * runs after this capture-phase check, so `event.defaultPrevented` is still false.\n */\nexport function leavesStore(\n anchor: HTMLAnchorElement,\n event: MouseEvent,\n storeUrl: string | undefined\n): boolean {\n if (event.defaultPrevented || anchor.hasAttribute('download')) return false;\n if (anchor.hasAttribute('data-fslightbox')) return false;\n let url: URL;\n try {\n url = new URL(anchor.getAttribute('href') ?? '', window.location.href);\n } catch {\n return false;\n }\n if (url.protocol !== 'http:' && url.protocol !== 'https:') return false;\n if (url.origin === window.location.origin) return false;\n try {\n return !storeUrl || url.origin !== new URL(storeUrl).origin;\n } catch {\n return true;\n }\n}\n\nfunction isSamePage(href: string): boolean {\n const url = new URL(href, window.location.href);\n return url.pathname === window.location.pathname && url.search === window.location.search;\n}\n\nfunction closeEnclosingModal(path: EventTarget[]): void {\n const modal = path.find(\n (el): el is HTMLElement & { close?: () => unknown } =>\n el instanceof HTMLElement && el.localName === 'salla-modal'\n );\n void modal?.close?.();\n}\n\n// ─── Navigation Interceptor Hook (framework-agnostic) ─────────────────────────\n\n/**\n * Hook for navigation interception using framework-agnostic navigate function.\n * Framework adapters call this with their navigate implementation.\n */\nexport function useNavigationInterceptor(\n navigate: NavigateFn,\n storeUrl: string | undefined,\n username?: string\n): void {\n const storeUrlRef = useRef<string | undefined>(storeUrl);\n const usernameRef = useRef<string | undefined>(username);\n\n useEffect(() => {\n storeUrlRef.current = storeUrl;\n usernameRef.current = username;\n }, [storeUrl, username]);\n\n const tryNavigate = useCallback(\n (href: string, replace = false): boolean => {\n const currentStoreUrl = storeUrlRef.current;\n if (!currentStoreUrl || switchesScope(href)) return false;\n\n const relativePath = resolveRelativePath(href, currentStoreUrl, usernameRef.current);\n if (!relativePath) return false;\n\n navigate(relativePath, { replace });\n return true;\n },\n [navigate]\n );\n\n useEffect(() => {\n // ── Pointer movement tracking ────────────────────────────────────────────\n // Detect drag/scroll gestures to avoid intercepting clicks from swipes.\n let pointerStartX = 0;\n let pointerStartY = 0;\n let pointerSwiped = false;\n const MOVE_THRESHOLD = 10;\n\n function handlePointerDown(event: PointerEvent): void {\n pointerStartX = event.clientX;\n pointerStartY = event.clientY;\n pointerSwiped = false;\n }\n\n function handlePointerUp(event: PointerEvent): void {\n const dx = Math.abs(event.clientX - pointerStartX);\n const dy = Math.abs(event.clientY - pointerStartY);\n pointerSwiped = dx > MOVE_THRESHOLD || dy > MOVE_THRESHOLD;\n }\n\n // ── Anchor click interception ────────────────────────────────────────────\n function handleClick(event: MouseEvent): void {\n // Ignore clicks that resulted from swipe/drag gestures.\n if (pointerSwiped) {\n pointerSwiped = false;\n return;\n }\n\n const path = event.composedPath();\n const anchor = path.find((el): el is HTMLAnchorElement => el instanceof HTMLAnchorElement);\n\n // Inside the Salla app, a link that leaves the store opens in the device's\n // browser; loaded in the app's webview it would strand the shopper there.\n if (\n anchor &&\n leavesStore(anchor, event, storeUrlRef.current) &&\n openNativeBrowser(anchor.href)\n ) {\n event.preventDefault();\n return;\n }\n\n if (!anchor || !shouldIntercept(anchor, event)) return;\n\n const samePage = isSamePage(anchor.href);\n if (tryNavigate(anchor.href, false)) {\n event.preventDefault();\n // A page load would close a web component's modal; an in-app navigation leaves it open.\n if (!samePage) closeEnclosingModal(path);\n }\n }\n\n // ── window.location.assign patch ─────────────────────────────────────────\n const origAssign = window.location.assign;\n function patchedAssign(url: string): void {\n if (!tryNavigate(url, false)) origAssign.call(window.location, url);\n }\n\n // ── window.location.replace patch ────────────────────────────────────────\n const origReplace = window.location.replace;\n function patchedReplace(url: string): void {\n if (!tryNavigate(url, true)) origReplace.call(window.location, url);\n }\n\n let assignPatched = false;\n let replacePatched = false;\n try {\n window.location.assign = patchedAssign;\n assignPatched = true;\n } catch {\n /* non-writable in this environment */\n }\n try {\n window.location.replace = patchedReplace;\n replacePatched = true;\n } catch {\n /* non-writable in this environment */\n }\n\n document.addEventListener('click', handleClick, { capture: true });\n document.addEventListener('pointerdown', handlePointerDown, { passive: true });\n document.addEventListener('pointerup', handlePointerUp, { passive: true });\n\n return () => {\n document.removeEventListener('click', handleClick, { capture: true });\n document.removeEventListener('pointerdown', handlePointerDown);\n document.removeEventListener('pointerup', handlePointerUp);\n if (assignPatched) {\n try {\n window.location.assign = origAssign;\n } catch {\n /* ignore */\n }\n }\n if (replacePatched) {\n try {\n window.location.replace = origReplace;\n } catch {\n /* ignore */\n }\n }\n };\n }, [tryNavigate]);\n}\n\n// ─── Client navigation config ─────────────────────────────────────────────────\n\nexport interface ClientNav {\n /** Framework adapter to use for client-side navigation. @default 'tanstack' */\n framework?: 'tanstack' | 'nextjs';\n /**\n * Intercept same-origin `<a>` clicks and `window.location` calls from web\n * components and route them through the framework router.\n * @default true\n */\n interceptLinks?: boolean;\n}\n\n// Framework adapter setups are registered in navigation-setups.ts to avoid circular imports.\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { api } from './chunk-
|
|
1
|
+
import { api } from './chunk-YDSWLCOY.js';
|
|
2
2
|
import { queryOptions } from '@tanstack/react-query';
|
|
3
3
|
|
|
4
4
|
var apps = {
|
|
@@ -40,5 +40,5 @@ var apps = {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
export { apps };
|
|
43
|
-
//# sourceMappingURL=chunk-
|
|
44
|
-
//# sourceMappingURL=chunk-
|
|
43
|
+
//# sourceMappingURL=chunk-UZGP2KFA.js.map
|
|
44
|
+
//# sourceMappingURL=chunk-UZGP2KFA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/apps.ts"],"names":[],"mappings":";;;AAmCO,IAAM,IAAA,GAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlB,UAAU,YAAmC;AAC3C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,eAAA,EAAiB,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA,CACtC,IAAA,EAA8B;AACjC,IAAA,OAAO,QAAQ,EAAC;AAAA,EAClB,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU,YAAkC;AAC1C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CACpB,GAAA,CAAI,wBAAA,EAA0B,EAAE,OAAA,EAAS,IAAA,EAAM,CAAA,CAC/C,IAAA,EAAsC;AACzC,IAAA,OAAO,EAAE,IAAA,EAAM,IAAA,EAAM,IAAA,IAAQ,EAAC,EAAE;AAAA,EAClC,CAAA;AAAA,EAEA,OAAA,EAAS;AAAA,IACP,QAAA,EAAU,MACR,YAAA,CAAa;AAAA,MACX,QAAA,EAAU,CAAC,MAAA,EAAQ,UAAU,CAAA;AAAA,MAC7B,OAAA,EAAS,MAAM,IAAA,CAAK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA;AAAA;AAAA;AAAA,MAIX,KAAA,EAAO;AAAA,KACR,CAAA;AAAA,IAEH,QAAA,EAAU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AK,QAAA,EAAS;AAAA;AAAA,MAE7B,SAAA,EAAW,QAAA;AAAA,MACX,KAAA,EAAO;AAAA,KACR;AAAA;AAEP","file":"chunk-UZGP2KFA.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api } from './client';\n\nexport interface AppSnippetRow {\n place: string;\n content: string;\n url?: string | null;\n /**\n * Raw snippet id, emitted as `data-snippet-id`. Present only on CDN rows — the\n * inline branch of the backend's snippet parser omits the key entirely.\n */\n id?: number;\n /** `{{customer.x}}` placeholders in `content` to substitute from SDK config `user.*` keys. */\n customer_parameters?: string[];\n}\n\nexport interface AppSnippet {\n service: string;\n app_id: string;\n /** Encoded app id (`getRouteKey()`): the scope id its snippets bind to via `data-scope-id`,\n * and its settings-bucket key. Absent on payloads predating the settings API. */\n id?: string;\n app_slug: string;\n status: string;\n snippets: AppSnippetRow[];\n}\n\n/**\n * Per-app public `app.*` buckets for CDN snippets, keyed by encoded app id (== `AppSnippet.id`,\n * the `Salla.appScope` scope id). One isolated bucket per app; reads within a scope are bare `app.*`.\n */\nexport interface AppSettings {\n apps: Record<string, Record<string, unknown>>;\n}\n\nexport const apps = {\n /**\n * Installed apps' snippets (scripts/HTML to inject). Timeout-bounded because it's awaited in\n * rootBeforeLoad (SSR/TTFB): a slow response degrades to no CDN tags, never stalls the page.\n */\n snippets: async (): Promise<AppSnippet[]> => {\n const { data } = await api\n .get('apps/snippets', { timeout: 2500 })\n .json<{ data?: AppSnippet[] }>();\n return data ?? [];\n },\n\n /**\n * Per-app public `app.*` buckets, keyed by encoded app id. Timeout-bounded (SSR-awaited):\n * a slow response degrades to empty buckets (fail-open), never strands injection.\n */\n settings: async (): Promise<AppSettings> => {\n const { data } = await api\n .get('apps/snippets/settings', { timeout: 2500 })\n .json<{ data?: Partial<AppSettings> }>();\n return { apps: data?.apps ?? {} };\n },\n\n queries: {\n snippets: () =>\n queryOptions({\n queryKey: ['apps', 'snippets'],\n queryFn: () => apps.snippets(),\n // Snippets are static per session; one fetch per page load is enough.\n staleTime: Infinity,\n // No retry: this is awaited in rootBeforeLoad, so the router's default `retry: 1` would\n // make the SSR wait 2 x the 2500ms timeout (plus backoff) before failing open. The\n // 2500ms timeout must be the whole budget; the client fallback query does the retrying.\n retry: 0,\n }),\n\n settings: () =>\n queryOptions({\n queryKey: ['apps', 'settings'],\n queryFn: () => apps.settings(),\n // Encoded app ids and their buckets are stable per page; one fetch is enough.\n staleTime: Infinity,\n retry: 0,\n }),\n },\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { orThrow } from './chunk-
|
|
2
|
-
import { getActiveScope, api } from './chunk-
|
|
1
|
+
import { orThrow } from './chunk-UWDUMPL7.js';
|
|
2
|
+
import { getActiveScope, api } from './chunk-YDSWLCOY.js';
|
|
3
3
|
import { queryOptions } from '@tanstack/react-query';
|
|
4
4
|
|
|
5
5
|
var category = {
|
|
@@ -26,5 +26,5 @@ var category = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export { category };
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-VUWBGAET.js.map
|
|
30
|
+
//# sourceMappingURL=chunk-VUWBGAET.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api/category.ts"],"names":[],"mappings":";;;;AAKO,IAAM,QAAA,GAAW;AAAA,EACtB,IAAA,EAAM,OAAO,EAAA,KAAkC;AAC7C,IAAA,MAAM,EAAE,IAAA,EAAK,GAAI,MAAM,GAAA,CAAI,IAAI,CAAA,WAAA,EAAc,EAAE,CAAA,CAAE,CAAA,CAAE,IAAA,EAAyB;AAC5E,IAAA,OAAO,IAAA;AAAA,EACT,CAAA;AAAA,EAEA,aAAa,CAAC,EAAA,KAAkC,QAAQ,QAAA,CAAS,IAAA,CAAK,EAAE,CAAC,CAAA;AAAA,EAEzE,MAAM,YAAiC;AACrC,IAAA,MAAM,EAAE,M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CAAA;AAAA,MACrC,OAAA,EAAS,MAAM,QAAA,CAAS,IAAA,CAAK,EAAE;AAAA,KAChC,CAAA;AAAA,IAEH,IAAA,EAAM,MACJ,YAAA,CAAa;AAAA;AAAA,MAEX,QAAA,EAAU,CAAC,YAAA,EAAc,MAAA,EAAQ,EAAE,KAAA,EAAO,cAAA,IAAkB,CAAA;AAAA,MAC5D,OAAA,EAAS,MAAM,QAAA,CAAS,IAAA;AAAK,KAC9B;AAAA;AAEP","file":"chunk-VUWBGAET.js","sourcesContent":["import { queryOptions } from '@tanstack/react-query';\nimport { api, getActiveScope } from './client';\nimport type { Category } from '../types';\nimport { orThrow } from '../providers/NavigationProvider';\n\nexport const category = {\n find: async (id: string): Promise<Category> => {\n const { data } = await api.get(`categories/${id}`).json<{ data: Category }>();\n return data;\n },\n\n findOrThrow: (id: string): Promise<Category> => orThrow(category.find(id)),\n\n list: async (): Promise<Category[]> => {\n const { data } = await api.get('categories').json<{ data: Category[] }>();\n return data ?? [];\n },\n\n queries: {\n detail: (id: string) =>\n queryOptions({\n queryKey: ['categories', 'detail', id],\n queryFn: () => category.find(id),\n }),\n\n list: () =>\n queryOptions({\n // Scope (branch) varies the API response — key must include it.\n queryKey: ['categories', 'list', { scope: getActiveScope() }],\n queryFn: () => category.list(),\n }),\n },\n};\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ensureTwilightContextFromMatches } from './chunk-
|
|
2
|
-
import { renderThemeHookSlotsScript, renderAppScopeInstallScript } from './chunk-
|
|
1
|
+
import { ensureTwilightContextFromMatches } from './chunk-EHX45KZG.js';
|
|
2
|
+
import { renderThemeHookSlotsScript, renderAppScopeInstallScript } from './chunk-U6KJ7XBO.js';
|
|
3
3
|
import { resolveHead, mergeHead } from './chunk-GD26FI4J.js';
|
|
4
4
|
import { buildBaseHead } from './chunk-4SZZPXM2.js';
|
|
5
|
-
import { readEnv, renderRuntimeEnvScript, escapeForInlineScript } from './chunk-
|
|
6
|
-
import { getTwilightContext, SettingsError } from './chunk-
|
|
5
|
+
import { readEnv, renderRuntimeEnvScript, escapeForInlineScript } from './chunk-GXZW6BJY.js';
|
|
6
|
+
import { getTwilightContext, SettingsError } from './chunk-JNAJTCJD.js';
|
|
7
7
|
import { FALLBACK_LOCALE } from './chunk-T72DAX7R.js';
|
|
8
8
|
|
|
9
9
|
// src/routes/root/head.ts
|
|
@@ -296,5 +296,5 @@ function buildCustomJsScript(customJs, isUrl) {
|
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
export { TICKETING_SCRIPT_URL, resolveTwilightSdkUrl, rootHead };
|
|
299
|
-
//# sourceMappingURL=chunk-
|
|
300
|
-
//# sourceMappingURL=chunk-
|
|
299
|
+
//# sourceMappingURL=chunk-W354TTIE.js.map
|
|
300
|
+
//# sourceMappingURL=chunk-W354TTIE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/routes/root/head.ts"],"names":[],"mappings":";;;;;;;;;AAeA,IAAM,mBAAA,GAAsB,sEAAA;AAC5B,IAAM,WAAA,GAAc,OAAA;AACpB,IAAM,YAAA,GAAe,+CAA+C,WAAW,CAAA,CAAA;AAG/E,IAAM,WAAA,GAAsC;AAAA,EAC1C,GAAA,EAAK,GAAG,YAAY,CAAA,OAAA,CAAA;AAAA,EACpB,MAAA,EAAQ,GAAG,YAAY,CAAA,CAAA,CAAA;AAAA,EACvB,UAAA,EAAY,GAAG,YAAY,CAAA,qBAAA,CAAA;AAAA,EAC3B,WAAA,EAAa,GAAG,YAAY,CAAA,UAAA,CAAA;AAAA,EAC5B,aAAA,EAAe,GAAG,YAAY,CAAA,2BAAA,CAAA;AAAA,EAC9B,cAAA,EAAgB,GAAG,YAAY,CAAA,aAAA,CAAA;AAAA,EAC/B,uBAAA,EAAyB,GAAG,YAAY,CAAA,qCAAA,CAAA;AAAA,EACxC,wBAAA,EAA0B,GAAG,YAAY,CAAA,kBAAA;AAC3C,CAAA;AAEO,IAAM,oBAAA,GACX;A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EAAI,iBAAA;AAAA,IACJ,QAAA,EAAU,KAAA,GACN,CAAA,sGAAA,EAAyG,qBAAA,CAAsB,IAAA,CAAK,SAAA,CAAU,QAAQ,CAAC,CAAC,CAAA,yDAAA,CAAA,GACxJ,CAAA,MAAA,EAAS,QAAQ,CAAA,yEAAA;AAAA,GACvB;AACF","file":"chunk-D2VMJV3L.js","sourcesContent":["import type { HeadDescriptor, HeadResult } from '../../utils/head';\nimport { mergeHead, resolveHead } from '../../utils/head';\nimport { buildBaseHead } from '../../utils/baseHead';\nimport { FALLBACK_LOCALE } from '../../providers/locale-constants';\nimport { getTwilightContext } from '../../twilight/context';\nimport type { TwilightContextMatch } from '../../twilight/ensure-context';\nimport { ensureTwilightContextFromMatches } from '../../twilight/ensure-context';\nimport type { StoreContext } from '../../api/store';\nimport type { AppSnippet } from '../../api/apps';\nimport { SettingsError } from '../../utils/errors';\nimport { renderAppScopeInstallScript } from '../../utils/app-scope';\nimport { renderThemeHookSlotsScript } from '../../utils/theme-hook-slots';\nimport { escapeForInlineScript } from '../../utils/inline-script';\nimport { readEnv, renderRuntimeEnvScript } from '../../utils/runtime-env';\n\nconst SALLA_ICONS_CSS_URL = 'https://cdn.assets.salla.network/static/fonts/sallaicons.css?v=2.0.5';\nconst LIT_VERSION = '3.3.3';\nconst LIT_CDN_BASE = `https://cdn.assets.salla.network/static/lit/${LIT_VERSION}`;\n\n/** Bare-specifier map for the lit build the engine's `<salla-*>` web components resolve against. */\nconst LIT_IMPORTS: Record<string, string> = {\n lit: `${LIT_CDN_BASE}/lit.js`,\n 'lit/': `${LIT_CDN_BASE}/`,\n 'lit-html': `${LIT_CDN_BASE}/lit-html/lit-html.js`,\n 'lit-html/': `${LIT_CDN_BASE}/lit-html/`,\n 'lit-element': `${LIT_CDN_BASE}/lit-element/lit-element.js`,\n 'lit-element/': `${LIT_CDN_BASE}/lit-element/`,\n '@lit/reactive-element': `${LIT_CDN_BASE}/reactive-element/reactive-element.js`,\n '@lit/reactive-element/': `${LIT_CDN_BASE}/reactive-element/`,\n};\n\nexport const TICKETING_SCRIPT_URL =\n 'https://cdn.assets.salla.network/latest/@salla.sa/ui-store-ticketing-system/ticketing-system.es.js';\n\nconst TWILIGHT_RELEASE_CDN = 'https://cdn.salla.network/js/twilight';\nconst TWILIGHT_DEV_CDN = 'https://cdn.assets.salla.network/dev/@salla.sa/twilight';\n// The oldest Twilight release this engine works with. Raise it whenever the engine\n// starts relying on something newer; the reason lives in that commit. Today's floor:\n// components ship their own CSS, which themes no longer compile (SallaApp/twilight#2107).\nconst MIN_TWILIGHT_VERSION = '2.14.538';\n// Last resort when no override and no platform pin, and the substitute for a pin below the floor.\nconst DEFAULT_TWILIGHT_VERSION = '2.14.584';\nconst releaseUrl = (version: string): string =>\n `${TWILIGHT_RELEASE_CDN}/${version}/twilight.esm.js`;\n// The head is built more than once per request (early hints, then the page); say it once.\nconst warnedPins = new Set<string>();\n\n/** `x.y.z` release pins only; dev shas and other strings are loaded as given. */\nfunction belowMinimum(version: string): boolean {\n return (\n /^\\d+\\.\\d+\\.\\d+$/.test(version) &&\n version.localeCompare(MIN_TWILIGHT_VERSION, undefined, { numeric: true }) < 0\n );\n}\n\n/** The `x.y.z` release segment of a release-CDN `.../twilight.esm.js` URL, if present. */\nfunction releaseVersionInUrl(url: string): string | null {\n const match = url.match(/\\/(\\d+\\.\\d+\\.\\d+)\\/twilight\\.esm\\.js(?:[?#]|$)/);\n return match ? match[1] : null;\n}\n\n/**\n * `VITE_TWILIGHT_URL`/`VITE_TWILIGHT_VERSION` outrank everything below, including\n * `theme.twilight.version`'s own `belowMinimum` guard — a stale override wins\n * silently otherwise (TD-16375: a scaffold-time pin outlived the engine raising\n * MIN_TWILIGHT_VERSION, so every new theme rendered without component CSS and\n * nothing said why). Only a dev-mode nudge, not a swap: an env override is a\n * deliberate choice, so unlike the settings-pin path below this never substitutes\n * the engine default underneath the developer.\n */\nfunction warnIfOverrideBelowMinimum(source: string, version: string): void {\n // Worker logs in production should stay quiet -- this is a developer-directed nudge,\n // not a user-facing or production-monitored signal. import.meta.env.DEV is a static\n // false in production builds, so this branch (and the console.warn below) is\n // tree-shaken out entirely, same as DevSettingsWidget / dev-settings-store.ts.\n if (!import.meta.env.DEV) return;\n if (!belowMinimum(version)) return;\n const key = `${source}:${version}`;\n if (warnedPins.has(key)) return;\n warnedPins.add(key);\n console.warn(\n `[twilight] ${source}=${version} is below the engine minimum ${MIN_TWILIGHT_VERSION} — components may load without their CSS (SallaApp/twilight#2107). Unset it or bump it to ${MIN_TWILIGHT_VERSION}+.`\n );\n}\n\n/**\n * Which twilight.esm.js the storefront loads, in priority order:\n * 1. `VITE_TWILIGHT_URL` — full local/deployment override.\n * 2. `VITE_TWILIGHT_VERSION` — dev-CDN build override.\n * 3. `theme.twilight.version` from the settings endpoint — the platform-pinned\n * release used when no environment override is configured.\n * 4. The engine's default release, also used when the pin is below the engine minimum.\n */\nexport function resolveTwilightSdkUrl(settings?: StoreContext): string {\n const urlOverride = readEnv('VITE_TWILIGHT_URL');\n if (urlOverride) {\n const version = releaseVersionInUrl(urlOverride);\n if (version) warnIfOverrideBelowMinimum('VITE_TWILIGHT_URL', version);\n return urlOverride;\n }\n\n const versionOverride = readEnv('VITE_TWILIGHT_VERSION');\n if (versionOverride) {\n warnIfOverrideBelowMinimum('VITE_TWILIGHT_VERSION', versionOverride);\n return `${TWILIGHT_DEV_CDN}/${versionOverride}/twilight.esm.js`;\n }\n\n const pinnedVersion = settings?.theme?.twilight?.version;\n if (pinnedVersion && belowMinimum(pinnedVersion)) {\n if (!warnedPins.has(pinnedVersion)) {\n warnedPins.add(pinnedVersion);\n console.warn(\n `[twilight] theme.twilight.version ${pinnedVersion} is below the engine minimum ${MIN_TWILIGHT_VERSION}; loading ${DEFAULT_TWILIGHT_VERSION} instead`\n );\n }\n return releaseUrl(DEFAULT_TWILIGHT_VERSION);\n }\n if (pinnedVersion) return releaseUrl(pinnedVersion);\n\n return releaseUrl(DEFAULT_TWILIGHT_VERSION);\n}\n\n// On a page that preloads its LCP image, the icon font (~270 KB) applies once the first screen's\n// priority images have painted, so it doesn't compete with them; other pages swap on load.\nconst MEDIA_SWAP_SCRIPT = `\n(function(){var d=document,s=function(l){if(l.sheet||\"all\"===l.media)l.media=\"all\";else l.onload=function(){this.media=\"all\"}},f=d.getElementById(\"salla-theme-font\"),i=d.getElementById(\"salla-icons-css\");f&&s(f);if(!i)return;if(!d.querySelector('link[rel=\"preload\"][as=\"image\"]'))return s(i);var g=function(){g=function(){};s(i)},p=function(){requestAnimationFrame(function(){setTimeout(function(){g()})});setTimeout(function(){g()},100)};d.addEventListener(\"DOMContentLoaded\",function(){var m=[].filter.call(d.querySelectorAll('img[fetchpriority=\"high\"]'),function(x){return!x.complete}),n=m.length;if(!n)return p();m.forEach(function(x){var o=function(){--n||p()};x.addEventListener(\"load\",o,{once:!0});x.addEventListener(\"error\",o,{once:!0})});setTimeout(function(){g()},2500)})})();\n`.trim();\n\nconst LOADING_CSS = `\n.loading-overlay{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#fff;z-index:9999}\n.loading-spinner{animation:spin 1s linear infinite;border-radius:9999px;height:3rem;width:3rem;border-bottom:2px solid var(--color-primary,#000)}\n@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}\nhtml,body{margin:0;padding:0;height:100%}\n`.trim();\n\nconst SALLA_INIT_SCRIPT = `\nwindow.salla = window.Salla = window.Salla || window.salla || {};\nwindow.Salla.onReady = window.Salla.onReady || function(callback) {\n return new Promise(function(resolve) {\n if (window.Salla.status === 'ready') {\n var config = window.salla && window.salla.config && window.salla.config.all();\n resolve(callback ? callback(config) : config);\n } else {\n window.addEventListener('twilight::initiated', function(event) {\n resolve(callback ? callback(event.detail) : event.detail);\n }, { once: true });\n }\n });\n};\n`.trim();\n\n/**\n * Distinct snippet-host origins to `preconnect` (warm DNS/TCP/TLS during parse). From the real\n * URLs (dev/prod-correct), deduped and capped at 4. No `crossOrigin`: snippets are no-cors fetches.\n */\nexport function snippetPreconnectOrigins(snippets: readonly AppSnippet[] | undefined): string[] {\n if (!snippets?.length) return [];\n const origins = new Set<string>();\n for (const app of snippets) {\n if (app.status !== 'enabled') continue;\n for (const s of app.snippets) {\n if (!s.url) continue;\n try {\n origins.add(new URL(s.url).origin);\n } catch {\n /* skip a malformed snippet url rather than breaking the head */\n }\n if (origins.size >= 4) return [...origins];\n }\n }\n return [...origins];\n}\n\nexport function rootHead(ctx: {\n params: Record<string, string>;\n matches?: readonly TwilightContextMatch[];\n}): HeadResult {\n // Re-run on the client during hydration, where the twilight module store may\n // still be empty. Recover it from the resolved match context so the head is\n // built from real settings instead of falling through to 'Store Unavailable'.\n ensureTwilightContextFromMatches(ctx.matches);\n\n let settings: StoreContext | undefined;\n try {\n settings = getTwilightContext().settings;\n } catch (e) {\n if (e instanceof SettingsError) {\n return resolveHead({\n title: 'Store Unavailable',\n });\n }\n throw e;\n }\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n const parts = deriveHeadParts(settings);\n\n return resolveHead(\n mergeHead(buildBaseHead(settings, locale), {\n meta: buildRootMeta(parts),\n links: buildRootLinks(parts),\n styles: buildRootStyles(parts),\n importMap: [{ imports: LIT_IMPORTS }],\n scripts: buildRootScripts(parts),\n })\n );\n}\n\n/** Everything the root head's tag builders read, derived once from the store settings. */\ninterface RootHeadParts {\n store: StoreContext['store'] | undefined;\n favicon?: string;\n primaryColor?: string;\n fontUrl?: string;\n fontUrlWithDisplay?: string;\n isGoogleFont?: boolean;\n fontFamilyName?: string;\n customJs?: string;\n customCss?: string;\n isCustomCssUrl?: boolean;\n isCustomJsUrl?: boolean;\n twilightSdkUrl: string;\n /** The visitor gets the maintenance page, which loads no SDK and no app snippets. */\n maintenance: boolean;\n snippetPreconnects: Array<{ rel: 'preconnect'; href: string }>;\n appScopeInstallScript: string;\n themeHookSlotsScript: string | null;\n runtimeEnvScript: string | null;\n}\n\n/** Google Fonts only honours `display=swap` as a query param; other hosts get the @font-face\n * override instead (see buildRootStyles). */\nfunction deriveFontParts(theme?: StoreContext['theme']) {\n const font = theme?.font;\n const fontUrl = font?.url || font?.path;\n const isGoogleFont = fontUrl?.includes('fonts.googleapis.com');\n const needsDisplay = Boolean(isGoogleFont && fontUrl && !fontUrl.includes('display='));\n const separator = fontUrl?.includes('?') ? '&' : '?';\n\n return {\n fontUrl,\n isGoogleFont,\n fontFamilyName: font?.family_name,\n fontUrlWithDisplay: needsDisplay ? `${fontUrl}${separator}display=swap` : fontUrl,\n };\n}\n\n/** Theme customization JS/CSS, each either a URL to load or an inline blob to embed. */\nfunction deriveCustomizationParts(theme?: StoreContext['theme']) {\n const customization = theme?.customization;\n const customJs = customization?.js?.trim();\n const customCss = customization?.css?.trim();\n const isUrl = (value?: string): boolean =>\n Boolean(value?.startsWith('http') || value?.startsWith('//'));\n\n return {\n customJs,\n customCss,\n isCustomCssUrl: isUrl(customCss),\n isCustomJsUrl: isUrl(customJs),\n };\n}\n\nfunction deriveHeadParts(settings?: StoreContext): RootHeadParts {\n const store = settings?.store;\n\n return {\n store,\n favicon: store?.icon,\n primaryColor: settings?.theme?.color?.primary,\n ...deriveFontParts(settings?.theme),\n ...deriveCustomizationParts(settings?.theme),\n twilightSdkUrl: resolveTwilightSdkUrl(settings),\n maintenance: getTwilightContext().maintenance,\n // Warm the connection to the snippet host(s) during head parse, so the body's deferred\n // `<script src>` snippet tags fetch off an already-open socket instead of DNS+TCP+TLS.\n snippetPreconnects: snippetPreconnectOrigins(getTwilightContext().appsSnippets).map((href) => ({\n rel: 'preconnect' as const,\n href,\n })),\n // Install `Salla.appScope` inline at parse time, before the SDK is ready — else a snippet's\n // onReady callback calls it too early and throws. Always emitted, even when the settings\n // prefetch failed: the CDN snippet tags ship regardless (they come from the *snippets*\n // endpoint), so the factory has to exist for them. `installAppScope` then seeds the real\n // buckets into this install once the client query resolves.\n appScopeInstallScript: renderAppScopeInstallScript(\n getTwilightContext().appsSettings ?? { apps: {} }\n ),\n // Whitelist the theme's own hook slots at parse time too, for the same reason: apps register\n // their `onReady` callbacks from parser-inserted snippet tags, long before React hydrates.\n themeHookSlotsScript: renderThemeHookSlotsScript(),\n // Env this render resolved (worker `vars` live in server-only `process.env`), handed to the\n // client so it doesn't silently fall back to the production defaults. Re-rendered on the\n // client during hydration, where it resolves to the same values or to nothing.\n runtimeEnvScript: renderRuntimeEnvScript(),\n };\n}\n\nfunction buildRootMeta(p: RootHeadParts): NonNullable<HeadDescriptor['meta']> {\n return [\n { name: 'robots', content: 'index, follow' },\n { name: 'msapplication-TileColor', content: '#ffffff' },\n ...(p.favicon ? [{ name: 'msapplication-TileImage', content: p.favicon }] : []),\n ...(p.primaryColor\n ? [\n { name: 'theme-color', content: p.primaryColor },\n { name: 'msapplication-navbutton-color', content: p.primaryColor },\n { name: 'apple-mobile-web-app-status-bar-style', content: p.primaryColor },\n ]\n : []),\n ];\n}\n\nfunction buildRootLinks(p: RootHeadParts): NonNullable<HeadDescriptor['links']> {\n return [\n { rel: 'preconnect', href: 'https://api.salla.dev' },\n { rel: 'preconnect', href: 'https://cdn.salla.sa' },\n { rel: 'preconnect', href: 'https://cdn.assets.salla.network', crossOrigin: 'anonymous' },\n // Warm the installed apps' CDN snippet host(s) — see snippetPreconnectOrigins.\n // Not on the maintenance page: it renders neither the snippets nor the SDK.\n ...(p.maintenance ? [] : p.snippetPreconnects),\n ...(p.isGoogleFont\n ? [\n {\n rel: 'preconnect' as const,\n href: 'https://fonts.gstatic.com',\n crossOrigin: 'anonymous' as const,\n },\n ]\n : []),\n ...(p.maintenance ? [] : [{ rel: 'modulepreload' as const, href: p.twilightSdkUrl }]),\n ...(p.fontUrlWithDisplay\n ? [\n {\n id: 'salla-theme-font',\n rel: 'stylesheet',\n href: p.fontUrlWithDisplay,\n media: 'print',\n },\n ]\n : []),\n ...(p.fontUrlWithDisplay && !p.isGoogleFont && p.fontFamilyName\n ? [\n {\n id: 'salla-font-display-override',\n rel: 'preload',\n as: 'style',\n href: p.fontUrlWithDisplay,\n },\n ]\n : []),\n ...(p.favicon ? [{ rel: 'icon', href: p.favicon }] : []),\n ...(p.favicon\n ? [{ id: 'salla-apple-icon', rel: 'apple-touch-icon-precomposed', href: p.favicon }]\n : []),\n ...(p.isCustomCssUrl && p.customCss\n ? [{ id: 'salla-custom-css', rel: 'stylesheet', href: p.customCss }]\n : []),\n {\n id: 'salla-icons-css',\n rel: 'stylesheet',\n href: SALLA_ICONS_CSS_URL,\n media: 'print',\n },\n // {\n // id: 'intl-tel-input-css',\n // rel: 'stylesheet',\n // href: 'https://cdn.jsdelivr.net/npm/intl-tel-input@26.8.0/build/css/intlTelInput.css',\n // },\n ...(p.isCustomJsUrl && p.customJs\n ? [{ id: 'salla-custom-js-preload', rel: 'preload', as: 'script', href: p.customJs }]\n : []),\n ];\n}\n\n// Hoistable (href + precedence): the web components insert their own <style> near the top of\n// <head> before hydration, which a positionally hydrated <style> would be matched against.\nconst hoisted = (id: string, children: string) => ({\n id,\n href: id,\n precedence: 'default',\n children,\n});\n\nfunction buildRootStyles(p: RootHeadParts): NonNullable<HeadDescriptor['styles']> {\n return [\n hoisted('twilight-loading', LOADING_CSS),\n ...(!p.isGoogleFont && p.fontFamilyName\n ? [\n hoisted(\n 'salla-font-display-swap',\n `@font-face{font-family:\"${p.fontFamilyName}\";font-display:swap;src:local(\"${p.fontFamilyName}\")}`\n ),\n ]\n : []),\n ...(!p.isCustomCssUrl && p.customCss ? [hoisted('salla-custom-css', p.customCss)] : []),\n ];\n}\n\nfunction buildRootScripts(p: RootHeadParts): NonNullable<HeadDescriptor['scripts']> {\n return [\n // First: the API base / store identifier this render used, so the hydrated client\n // resolves the same ones (worker `vars` never reach the browser bundle on their own).\n ...(p.runtimeEnvScript ? [{ id: 'salla-runtime-env', children: p.runtimeEnvScript }] : []),\n { id: 'twilight-init', children: SALLA_INIT_SCRIPT },\n // After twilight-init (which defines window.Salla) and before the SDK module, so the\n // appScope factory exists ahead of any snippet's onReady callback firing.\n { id: 'salla-app-scope', children: p.appScopeInstallScript },\n // Arms the hook-slot whitelist push here, so its `twilight::initiated` listener is\n // registered before any app snippet's — listeners fire in registration order.\n ...(p.themeHookSlotsScript\n ? [{ id: 'salla-theme-hook-slots', children: p.themeHookSlotsScript }]\n : []),\n { id: 'salla-async-css', children: MEDIA_SWAP_SCRIPT },\n // The SDK and ticketing modules are rendered at the end of <body> (SallaSdkScripts).\n ...(p.customJs ? [buildCustomJsScript(p.customJs, Boolean(p.isCustomJsUrl))] : []),\n ];\n}\n\n/** A URL customization is loaded after SDK init; an inline one is wrapped so a syntax/runtime\n * error in partner JS warns instead of taking the page down. */\nfunction buildCustomJsScript(customJs: string, isUrl: boolean) {\n return {\n id: 'salla-custom-js',\n children: isUrl\n ? `window.addEventListener('twilight::initiated',function(){var s=document.createElement('script');s.src=${escapeForInlineScript(JSON.stringify(customJs))};s.async=true;document.head.appendChild(s)},{once:true});`\n : `try { ${customJs} } catch(e) { console.warn(\"[ThemeCustomization] Custom JS error:\", e); }`,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/routes/root/head.ts"],"names":[],"mappings":";;;;;;;;;AAeA,IAAM,mBAAA,GAAsB,sEAAA;AAC5B,IAAM,WAAA,GAAc,OAAA;AACpB,IAAM,YAAA,GAAe,+CAA+C,WAAW,CAAA,CAAA;AAG/E,IAAM,WAAA,GAAsC;AAAA,EAC1C,GAAA,EAAK,GAAG,YAAY,CAAA,OAAA,CAAA;AAAA,EACpB,MAAA,EAAQ,GAAG,YAAY,CAAA,CAAA,CAAA;AAAA,EACvB,UAAA,EAAY,GAAG,YAAY,CAAA,qBAAA,CAAA;AAAA,EAC3B,WAAA,EAAa,GAAG,YAAY,CAAA,UAAA,CAAA;AAAA,EAC5B,aAAA,EAAe,GAAG,YAAY,CAAA,2BAAA,CAAA;AAAA,EAC9B,cAAA,EAAgB,GAAG,YAAY,CAAA,aAAA,CAAA;AAAA,EAC/B,uBAAA,EAAyB,GAAG,YAAY,CAAA,qCAAA,CAAA;AAAA,E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AAIA,SAAS,mBAAA,CAAoB,UAAkB,KAAA,EAAgB;AAC7D,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,iBAAA;AAAA,IACJ,QAAA,EAAU,KAAA,GACN,CAAA,sGAAA,EAAyG,qBAAA,CAAsB,IAAA,CAAK,SAAA,CAAU,QAAQ,CAAC,CAAC,CAAA,yDAAA,CAAA,GACxJ,CAAA,MAAA,EAAS,QAAQ,CAAA,yEAAA;AAAA,GACvB;AACF","file":"chunk-W354TTIE.js","sourcesContent":["import type { HeadDescriptor, HeadResult } from '../../utils/head';\nimport { mergeHead, resolveHead } from '../../utils/head';\nimport { buildBaseHead } from '../../utils/baseHead';\nimport { FALLBACK_LOCALE } from '../../providers/locale-constants';\nimport { getTwilightContext } from '../../twilight/context';\nimport type { TwilightContextMatch } from '../../twilight/ensure-context';\nimport { ensureTwilightContextFromMatches } from '../../twilight/ensure-context';\nimport type { StoreContext } from '../../api/store';\nimport type { AppSnippet } from '../../api/apps';\nimport { SettingsError } from '../../utils/errors';\nimport { renderAppScopeInstallScript } from '../../utils/app-scope';\nimport { renderThemeHookSlotsScript } from '../../utils/theme-hook-slots';\nimport { escapeForInlineScript } from '../../utils/inline-script';\nimport { readEnv, renderRuntimeEnvScript } from '../../utils/runtime-env';\n\nconst SALLA_ICONS_CSS_URL = 'https://cdn.assets.salla.network/static/fonts/sallaicons.css?v=2.0.5';\nconst LIT_VERSION = '3.3.3';\nconst LIT_CDN_BASE = `https://cdn.assets.salla.network/static/lit/${LIT_VERSION}`;\n\n/** Bare-specifier map for the lit build the engine's `<salla-*>` web components resolve against. */\nconst LIT_IMPORTS: Record<string, string> = {\n lit: `${LIT_CDN_BASE}/lit.js`,\n 'lit/': `${LIT_CDN_BASE}/`,\n 'lit-html': `${LIT_CDN_BASE}/lit-html/lit-html.js`,\n 'lit-html/': `${LIT_CDN_BASE}/lit-html/`,\n 'lit-element': `${LIT_CDN_BASE}/lit-element/lit-element.js`,\n 'lit-element/': `${LIT_CDN_BASE}/lit-element/`,\n '@lit/reactive-element': `${LIT_CDN_BASE}/reactive-element/reactive-element.js`,\n '@lit/reactive-element/': `${LIT_CDN_BASE}/reactive-element/`,\n};\n\nexport const TICKETING_SCRIPT_URL =\n 'https://cdn.assets.salla.network/latest/@salla.sa/ui-store-ticketing-system/ticketing-system.es.js';\n\nconst TWILIGHT_RELEASE_CDN = 'https://cdn.salla.network/js/twilight';\nconst TWILIGHT_DEV_CDN = 'https://cdn.assets.salla.network/dev/@salla.sa/twilight';\n// The oldest Twilight release this engine works with. Raise it whenever the engine\n// starts relying on something newer; the reason lives in that commit. Today's floor:\n// components ship their own CSS, which themes no longer compile (SallaApp/twilight#2107).\nconst MIN_TWILIGHT_VERSION = '2.14.538';\n// Last resort when no override and no platform pin, and the substitute for a pin below the floor.\nconst DEFAULT_TWILIGHT_VERSION = '2.14.584';\nconst releaseUrl = (version: string): string =>\n `${TWILIGHT_RELEASE_CDN}/${version}/twilight.esm.js`;\n// The head is built more than once per request (early hints, then the page); say it once.\nconst warnedPins = new Set<string>();\n\n/** `x.y.z` release pins only; dev shas and other strings are loaded as given. */\nfunction belowMinimum(version: string): boolean {\n return (\n /^\\d+\\.\\d+\\.\\d+$/.test(version) &&\n version.localeCompare(MIN_TWILIGHT_VERSION, undefined, { numeric: true }) < 0\n );\n}\n\n/** The `x.y.z` release segment of a release-CDN `.../twilight.esm.js` URL, if present. */\nfunction releaseVersionInUrl(url: string): string | null {\n const match = url.match(/\\/(\\d+\\.\\d+\\.\\d+)\\/twilight\\.esm\\.js(?:[?#]|$)/);\n return match ? match[1] : null;\n}\n\n/**\n * `VITE_TWILIGHT_URL`/`VITE_TWILIGHT_VERSION` outrank everything below, including\n * `theme.twilight.version`'s own `belowMinimum` guard — a stale override wins\n * silently otherwise (TD-16375: a scaffold-time pin outlived the engine raising\n * MIN_TWILIGHT_VERSION, so every new theme rendered without component CSS and\n * nothing said why). Only a dev-mode nudge, not a swap: an env override is a\n * deliberate choice, so unlike the settings-pin path below this never substitutes\n * the engine default underneath the developer.\n */\nfunction warnIfOverrideBelowMinimum(source: string, version: string): void {\n // Worker logs in production should stay quiet -- this is a developer-directed nudge,\n // not a user-facing or production-monitored signal. import.meta.env.DEV is a static\n // false in production builds, so this branch (and the console.warn below) is\n // tree-shaken out entirely, same as DevSettingsWidget / dev-settings-store.ts.\n if (!import.meta.env.DEV) return;\n if (!belowMinimum(version)) return;\n const key = `${source}:${version}`;\n if (warnedPins.has(key)) return;\n warnedPins.add(key);\n console.warn(\n `[twilight] ${source}=${version} is below the engine minimum ${MIN_TWILIGHT_VERSION} — components may load without their CSS (SallaApp/twilight#2107). Unset it or bump it to ${MIN_TWILIGHT_VERSION}+.`\n );\n}\n\n/**\n * Which twilight.esm.js the storefront loads, in priority order:\n * 1. `VITE_TWILIGHT_URL` — full local/deployment override.\n * 2. `VITE_TWILIGHT_VERSION` — dev-CDN build override.\n * 3. `theme.twilight.version` from the settings endpoint — the platform-pinned\n * release used when no environment override is configured.\n * 4. The engine's default release, also used when the pin is below the engine minimum.\n */\nexport function resolveTwilightSdkUrl(settings?: StoreContext): string {\n const urlOverride = readEnv('VITE_TWILIGHT_URL');\n if (urlOverride) {\n const version = releaseVersionInUrl(urlOverride);\n if (version) warnIfOverrideBelowMinimum('VITE_TWILIGHT_URL', version);\n return urlOverride;\n }\n\n const versionOverride = readEnv('VITE_TWILIGHT_VERSION');\n if (versionOverride) {\n warnIfOverrideBelowMinimum('VITE_TWILIGHT_VERSION', versionOverride);\n return `${TWILIGHT_DEV_CDN}/${versionOverride}/twilight.esm.js`;\n }\n\n const pinnedVersion = settings?.theme?.twilight?.version;\n if (pinnedVersion && belowMinimum(pinnedVersion)) {\n if (!warnedPins.has(pinnedVersion)) {\n warnedPins.add(pinnedVersion);\n console.warn(\n `[twilight] theme.twilight.version ${pinnedVersion} is below the engine minimum ${MIN_TWILIGHT_VERSION}; loading ${DEFAULT_TWILIGHT_VERSION} instead`\n );\n }\n return releaseUrl(DEFAULT_TWILIGHT_VERSION);\n }\n if (pinnedVersion) return releaseUrl(pinnedVersion);\n\n return releaseUrl(DEFAULT_TWILIGHT_VERSION);\n}\n\n// On a page that preloads its LCP image, the icon font (~270 KB) applies once the first screen's\n// priority images have painted, so it doesn't compete with them; other pages swap on load.\nconst MEDIA_SWAP_SCRIPT = `\n(function(){var d=document,s=function(l){if(l.sheet||\"all\"===l.media)l.media=\"all\";else l.onload=function(){this.media=\"all\"}},f=d.getElementById(\"salla-theme-font\"),i=d.getElementById(\"salla-icons-css\");f&&s(f);if(!i)return;if(!d.querySelector('link[rel=\"preload\"][as=\"image\"]'))return s(i);var g=function(){g=function(){};s(i)},p=function(){requestAnimationFrame(function(){setTimeout(function(){g()})});setTimeout(function(){g()},100)};d.addEventListener(\"DOMContentLoaded\",function(){var m=[].filter.call(d.querySelectorAll('img[fetchpriority=\"high\"]'),function(x){return!x.complete}),n=m.length;if(!n)return p();m.forEach(function(x){var o=function(){--n||p()};x.addEventListener(\"load\",o,{once:!0});x.addEventListener(\"error\",o,{once:!0})});setTimeout(function(){g()},2500)})})();\n`.trim();\n\nconst LOADING_CSS = `\n.loading-overlay{position:fixed;inset:0;display:flex;align-items:center;justify-content:center;background:#fff;z-index:9999}\n.loading-spinner{animation:spin 1s linear infinite;border-radius:9999px;height:3rem;width:3rem;border-bottom:2px solid var(--color-primary,#000)}\n@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}\nhtml,body{margin:0;padding:0;height:100%}\n`.trim();\n\nconst SALLA_INIT_SCRIPT = `\nwindow.salla = window.Salla = window.Salla || window.salla || {};\nwindow.Salla.onReady = window.Salla.onReady || function(callback) {\n return new Promise(function(resolve) {\n if (window.Salla.status === 'ready') {\n var config = window.salla && window.salla.config && window.salla.config.all();\n resolve(callback ? callback(config) : config);\n } else {\n window.addEventListener('twilight::initiated', function(event) {\n resolve(callback ? callback(event.detail) : event.detail);\n }, { once: true });\n }\n });\n};\n`.trim();\n\n/**\n * Distinct snippet-host origins to `preconnect` (warm DNS/TCP/TLS during parse). From the real\n * URLs (dev/prod-correct), deduped and capped at 4. No `crossOrigin`: snippets are no-cors fetches.\n */\nexport function snippetPreconnectOrigins(snippets: readonly AppSnippet[] | undefined): string[] {\n if (!snippets?.length) return [];\n const origins = new Set<string>();\n for (const app of snippets) {\n if (app.status !== 'enabled') continue;\n for (const s of app.snippets) {\n if (!s.url) continue;\n try {\n origins.add(new URL(s.url).origin);\n } catch {\n /* skip a malformed snippet url rather than breaking the head */\n }\n if (origins.size >= 4) return [...origins];\n }\n }\n return [...origins];\n}\n\nexport function rootHead(ctx: {\n params: Record<string, string>;\n matches?: readonly TwilightContextMatch[];\n}): HeadResult {\n // Re-run on the client during hydration, where the twilight module store may\n // still be empty. Recover it from the resolved match context so the head is\n // built from real settings instead of falling through to 'Store Unavailable'.\n ensureTwilightContextFromMatches(ctx.matches);\n\n let settings: StoreContext | undefined;\n try {\n settings = getTwilightContext().settings;\n } catch (e) {\n if (e instanceof SettingsError) {\n return resolveHead({\n title: 'Store Unavailable',\n });\n }\n throw e;\n }\n const locale = ctx.params.locale || FALLBACK_LOCALE;\n const parts = deriveHeadParts(settings);\n\n return resolveHead(\n mergeHead(buildBaseHead(settings, locale), {\n meta: buildRootMeta(parts),\n links: buildRootLinks(parts),\n styles: buildRootStyles(parts),\n importMap: [{ imports: LIT_IMPORTS }],\n scripts: buildRootScripts(parts),\n })\n );\n}\n\n/** Everything the root head's tag builders read, derived once from the store settings. */\ninterface RootHeadParts {\n store: StoreContext['store'] | undefined;\n favicon?: string;\n primaryColor?: string;\n fontUrl?: string;\n fontUrlWithDisplay?: string;\n isGoogleFont?: boolean;\n fontFamilyName?: string;\n customJs?: string;\n customCss?: string;\n isCustomCssUrl?: boolean;\n isCustomJsUrl?: boolean;\n twilightSdkUrl: string;\n /** The visitor gets the maintenance page, which loads no SDK and no app snippets. */\n maintenance: boolean;\n snippetPreconnects: Array<{ rel: 'preconnect'; href: string }>;\n appScopeInstallScript: string;\n themeHookSlotsScript: string | null;\n runtimeEnvScript: string | null;\n}\n\n/** Google Fonts only honours `display=swap` as a query param; other hosts get the @font-face\n * override instead (see buildRootStyles). */\nfunction deriveFontParts(theme?: StoreContext['theme']) {\n const font = theme?.font;\n const fontUrl = font?.url || font?.path;\n const isGoogleFont = fontUrl?.includes('fonts.googleapis.com');\n const needsDisplay = Boolean(isGoogleFont && fontUrl && !fontUrl.includes('display='));\n const separator = fontUrl?.includes('?') ? '&' : '?';\n\n return {\n fontUrl,\n isGoogleFont,\n fontFamilyName: font?.family_name,\n fontUrlWithDisplay: needsDisplay ? `${fontUrl}${separator}display=swap` : fontUrl,\n };\n}\n\n/** Theme customization JS/CSS, each either a URL to load or an inline blob to embed. */\nfunction deriveCustomizationParts(theme?: StoreContext['theme']) {\n const customization = theme?.customization;\n const customJs = customization?.js?.trim();\n const customCss = customization?.css?.trim();\n const isUrl = (value?: string): boolean =>\n Boolean(value?.startsWith('http') || value?.startsWith('//'));\n\n return {\n customJs,\n customCss,\n isCustomCssUrl: isUrl(customCss),\n isCustomJsUrl: isUrl(customJs),\n };\n}\n\nfunction deriveHeadParts(settings?: StoreContext): RootHeadParts {\n const store = settings?.store;\n\n return {\n store,\n favicon: store?.icon,\n primaryColor: settings?.theme?.color?.primary,\n ...deriveFontParts(settings?.theme),\n ...deriveCustomizationParts(settings?.theme),\n twilightSdkUrl: resolveTwilightSdkUrl(settings),\n maintenance: getTwilightContext().maintenance,\n // Warm the connection to the snippet host(s) during head parse, so the body's deferred\n // `<script src>` snippet tags fetch off an already-open socket instead of DNS+TCP+TLS.\n snippetPreconnects: snippetPreconnectOrigins(getTwilightContext().appsSnippets).map((href) => ({\n rel: 'preconnect' as const,\n href,\n })),\n // Install `Salla.appScope` inline at parse time, before the SDK is ready — else a snippet's\n // onReady callback calls it too early and throws. Always emitted, even when the settings\n // prefetch failed: the CDN snippet tags ship regardless (they come from the *snippets*\n // endpoint), so the factory has to exist for them. `installAppScope` then seeds the real\n // buckets into this install once the client query resolves.\n appScopeInstallScript: renderAppScopeInstallScript(\n getTwilightContext().appsSettings ?? { apps: {} }\n ),\n // Whitelist the theme's own hook slots at parse time too, for the same reason: apps register\n // their `onReady` callbacks from parser-inserted snippet tags, long before React hydrates.\n themeHookSlotsScript: renderThemeHookSlotsScript(),\n // Env this render resolved (worker `vars` live in server-only `process.env`), handed to the\n // client so it doesn't silently fall back to the production defaults. Re-rendered on the\n // client during hydration, where it resolves to the same values or to nothing.\n runtimeEnvScript: renderRuntimeEnvScript(),\n };\n}\n\nfunction buildRootMeta(p: RootHeadParts): NonNullable<HeadDescriptor['meta']> {\n return [\n { name: 'robots', content: 'index, follow' },\n { name: 'msapplication-TileColor', content: '#ffffff' },\n ...(p.favicon ? [{ name: 'msapplication-TileImage', content: p.favicon }] : []),\n ...(p.primaryColor\n ? [\n { name: 'theme-color', content: p.primaryColor },\n { name: 'msapplication-navbutton-color', content: p.primaryColor },\n { name: 'apple-mobile-web-app-status-bar-style', content: p.primaryColor },\n ]\n : []),\n ];\n}\n\nfunction buildRootLinks(p: RootHeadParts): NonNullable<HeadDescriptor['links']> {\n return [\n { rel: 'preconnect', href: 'https://api.salla.dev' },\n { rel: 'preconnect', href: 'https://cdn.salla.sa' },\n { rel: 'preconnect', href: 'https://cdn.assets.salla.network', crossOrigin: 'anonymous' },\n // Warm the installed apps' CDN snippet host(s) — see snippetPreconnectOrigins.\n // Not on the maintenance page: it renders neither the snippets nor the SDK.\n ...(p.maintenance ? [] : p.snippetPreconnects),\n ...(p.isGoogleFont\n ? [\n {\n rel: 'preconnect' as const,\n href: 'https://fonts.gstatic.com',\n crossOrigin: 'anonymous' as const,\n },\n ]\n : []),\n ...(p.maintenance ? [] : [{ rel: 'modulepreload' as const, href: p.twilightSdkUrl }]),\n ...(p.fontUrlWithDisplay\n ? [\n {\n id: 'salla-theme-font',\n rel: 'stylesheet',\n href: p.fontUrlWithDisplay,\n media: 'print',\n },\n ]\n : []),\n ...(p.fontUrlWithDisplay && !p.isGoogleFont && p.fontFamilyName\n ? [\n {\n id: 'salla-font-display-override',\n rel: 'preload',\n as: 'style',\n href: p.fontUrlWithDisplay,\n },\n ]\n : []),\n ...(p.favicon ? [{ rel: 'icon', href: p.favicon }] : []),\n ...(p.favicon\n ? [{ id: 'salla-apple-icon', rel: 'apple-touch-icon-precomposed', href: p.favicon }]\n : []),\n ...(p.isCustomCssUrl && p.customCss\n ? [{ id: 'salla-custom-css', rel: 'stylesheet', href: p.customCss }]\n : []),\n {\n id: 'salla-icons-css',\n rel: 'stylesheet',\n href: SALLA_ICONS_CSS_URL,\n media: 'print',\n },\n // {\n // id: 'intl-tel-input-css',\n // rel: 'stylesheet',\n // href: 'https://cdn.jsdelivr.net/npm/intl-tel-input@26.8.0/build/css/intlTelInput.css',\n // },\n ...(p.isCustomJsUrl && p.customJs\n ? [{ id: 'salla-custom-js-preload', rel: 'preload', as: 'script', href: p.customJs }]\n : []),\n ];\n}\n\n// Hoistable (href + precedence): the web components insert their own <style> near the top of\n// <head> before hydration, which a positionally hydrated <style> would be matched against.\nconst hoisted = (id: string, children: string) => ({\n id,\n href: id,\n precedence: 'default',\n children,\n});\n\nfunction buildRootStyles(p: RootHeadParts): NonNullable<HeadDescriptor['styles']> {\n return [\n hoisted('twilight-loading', LOADING_CSS),\n ...(!p.isGoogleFont && p.fontFamilyName\n ? [\n hoisted(\n 'salla-font-display-swap',\n `@font-face{font-family:\"${p.fontFamilyName}\";font-display:swap;src:local(\"${p.fontFamilyName}\")}`\n ),\n ]\n : []),\n ...(!p.isCustomCssUrl && p.customCss ? [hoisted('salla-custom-css', p.customCss)] : []),\n ];\n}\n\nfunction buildRootScripts(p: RootHeadParts): NonNullable<HeadDescriptor['scripts']> {\n return [\n // First: the API base / store identifier this render used, so the hydrated client\n // resolves the same ones (worker `vars` never reach the browser bundle on their own).\n ...(p.runtimeEnvScript ? [{ id: 'salla-runtime-env', children: p.runtimeEnvScript }] : []),\n { id: 'twilight-init', children: SALLA_INIT_SCRIPT },\n // After twilight-init (which defines window.Salla) and before the SDK module, so the\n // appScope factory exists ahead of any snippet's onReady callback firing.\n { id: 'salla-app-scope', children: p.appScopeInstallScript },\n // Arms the hook-slot whitelist push here, so its `twilight::initiated` listener is\n // registered before any app snippet's — listeners fire in registration order.\n ...(p.themeHookSlotsScript\n ? [{ id: 'salla-theme-hook-slots', children: p.themeHookSlotsScript }]\n : []),\n { id: 'salla-async-css', children: MEDIA_SWAP_SCRIPT },\n // The SDK and ticketing modules are rendered at the end of <body> (SallaSdkScripts).\n ...(p.customJs ? [buildCustomJsScript(p.customJs, Boolean(p.isCustomJsUrl))] : []),\n ];\n}\n\n/** A URL customization is loaded after SDK init; an inline one is wrapped so a syntax/runtime\n * error in partner JS warns instead of taking the page down. */\nfunction buildCustomJsScript(customJs: string, isUrl: boolean) {\n return {\n id: 'salla-custom-js',\n children: isUrl\n ? `window.addEventListener('twilight::initiated',function(){var s=document.createElement('script');s.src=${escapeForInlineScript(JSON.stringify(customJs))};s.async=true;document.head.appendChild(s)},{once:true});`\n : `try { ${customJs} } catch(e) { console.warn(\"[ThemeCustomization] Custom JS error:\", e); }`,\n };\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
2
|
-
import { getTwilightContext } from './chunk-
|
|
2
|
+
import { getTwilightContext } from './chunk-JNAJTCJD.js';
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
|
|
5
5
|
var THUMB_URL = "https://cdn.assets.salla.network/prod/stores/images/construction-01.png";
|
|
@@ -104,5 +104,5 @@ function MaintenancePage() {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
export { MaintenancePage };
|
|
107
|
-
//# sourceMappingURL=chunk-
|
|
108
|
-
//# sourceMappingURL=chunk-
|
|
107
|
+
//# sourceMappingURL=chunk-XL42DUCQ.js.map
|
|
108
|
+
//# sourceMappingURL=chunk-XL42DUCQ.js.map
|
|
@@ -1 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A,CAAA,CAAE,0BAAA,EAA4B;AAAA,YAC7B,YAAA,EAAc,SAAS,qEAAA,GAAiB;AAAA,WACzC,CAAA,EACH;AAAA,SAAA,EACF,CAAA,EAEJ,CAAA;AAAA,wBACA,GAAA,CAAC,QAAA,EAAA,EAAS,KAAA,EAAc,MAAA,EAAgB;AAAA,OAAA,EAC1C,CAAA;AAAA,sBACA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,OAAA,EACb,QAAA,kBAAA,GAAA,CAAC,SAAI,GAAA,EAAK,SAAA,EAAW,GAAA,EAAI,EAAA,EAAG,CAAA,EAC9B;AAAA,KAAA,EACF,CAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"chunk-RCRE66QK.js","sourcesContent":["import { getTwilightContext } from '../../twilight/context';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport type { Store, StoreSocial } from '../../types';\n\nconst THUMB_URL = 'https://cdn.assets.salla.network/prod/stores/images/construction-01.png';\n\n/** Social networks the page links to, in the old page's order, with their Salla icon class. */\nconst SOCIAL_ICONS: [keyof StoreSocial, string][] = [\n ['twitter', 'sicon-x'],\n ['snapchat', 'sicon-snapchat'],\n ['youtube', 'sicon-youtube'],\n ['tiktok', 'sicon-tiktok'],\n ['facebook', 'sicon-facebook'],\n ['instagram', 'sicon-instagram'],\n];\n\n// The platform's maintenance page (Store `pages/maintenance.blade.php` + `_maintenance.scss`),\n// trimmed to what it renders: greyscale, logo + title beside the message, contacts under a\n// rule, the illustration alongside; stacked and centred under 1024px.\n//\n// The page is its own scroll container, the viewport tall, because app-shell themes lock\n// `html, body { overflow: hidden }` and scroll only their main element, which this page\n// replaces. Centring is by auto margins, not `justify-content`, so content taller than the\n// viewport starts at the top instead of being clipped at both ends.\nconst STYLE = `\n.s-maintenance{display:flex;flex-direction:column;align-items:center;width:100%;height:100vh;height:100dvh;overflow-y:auto;color:#a3a3a3;background:#fff;filter:grayscale(100%);box-sizing:border-box}\n.s-maintenance *{box-sizing:border-box}\n.s-maintenance .mt-container{width:100%;max-width:1200px;margin:auto 0;padding:0 15px}\n.s-maintenance .mt-panel{display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%}\n.s-maintenance .mt-message{width:100%;padding-inline-start:80px;animation:revealMtBlock 1.5s forwards}\n.s-maintenance .mt-title{display:flex;align-items:center;margin:0 0 20px}\n.s-maintenance .mt-logo{display:block;flex-shrink:0;width:80px;height:80px;margin-inline-end:20px;border-radius:50%;overflow:hidden;box-shadow:0 0 5px rgb(0 0 0 / 10%)}\n.s-maintenance .mt-logo img{display:block;width:100%;height:100%;object-fit:cover}\n.s-maintenance .mt-title h1{font-size:2.25rem;line-height:1;margin:0;color:#666}\n.s-maintenance .mt-content p{margin:0;white-space:pre-line}\n.s-maintenance .mt-contact-list{display:inline-block;list-style:none;width:100%;max-width:500px;margin:20px 0 0;padding:20px 0 0;border-top:1px solid #eee}\n.s-maintenance .mt-contact-list li{display:inline-block;margin-inline-end:10px}\n.s-maintenance .mt-contact-list a{display:inline-flex;align-items:center;padding:5px;color:rgb(102 102 102 / 80%);text-decoration:none;font-size:1.25rem}\n.s-maintenance .mt-contact-list a:hover{color:#666}\n.s-maintenance .mt-contact--btn{padding:3px 20px 5px;border-radius:20px;color:#fff!important;background:rgb(102 102 102 / 80%);font-size:1rem!important}\n.s-maintenance .mt-contact--btn:hover{background:#666}\n.s-maintenance .mt-contact--btn i{margin-inline-end:10px}\n.s-maintenance .thumb{width:100%;animation:revealMtBlock 1.5s .1s forwards;opacity:0}\n.s-maintenance .thumb img{display:block;width:100%;max-width:450px;margin:0 auto}\n@media (max-width:1024px){\n.s-maintenance{padding:40px 0 10px}\n.s-maintenance .mt-panel{flex-direction:column}\n.s-maintenance .mt-message{order:2;text-align:center;padding:0;margin:50px 0 0}\n.s-maintenance .mt-title{flex-direction:column;margin-bottom:30px}\n.s-maintenance .mt-logo{margin:0 0 10px}\n.s-maintenance .mt-title h1{font-size:1.5rem}\n}\n@media (max-width:640px){.s-maintenance .thumb img{width:80%}}\n@keyframes revealMtBlock{from{opacity:0;transform:translateY(50%)}to{opacity:1;transform:translateY(0)}}\n`;\n\n/** The phone button and social links under the message; nothing when the store lists none. */\nfunction Contacts({ store, arabic }: { store: Store | undefined; arabic: boolean }) {\n const { t } = useTranslation();\n const mobile = store?.contacts?.mobile;\n const socials = SOCIAL_ICONS.flatMap(([key, icon]) => {\n const href = store?.social?.[key];\n return href ? [{ key, icon, href }] : [];\n });\n if (!mobile && socials.length === 0) return null;\n\n return (\n <ul className=\"mt-contact-list\">\n {mobile && (\n <li>\n <a href={`tel:${mobile}`} className=\"mt-contact--btn\">\n <i className=\"sicon-phone\" aria-hidden=\"true\" />\n {t('common.elements.contact_us', {\n defaultValue: arabic ? 'تواصل معنا' : 'Contact us',\n })}\n </a>\n </li>\n )}\n {socials.map(({ key, icon, href }) => (\n <li key={key}>\n <a href={href} target=\"_blank\" rel=\"noreferrer\" aria-label={key}>\n <i className={icon} aria-hidden=\"true\" />\n </a>\n </li>\n ))}\n </ul>\n );\n}\n\n/**\n * The page a customer sees while the store is closed: the platform's maintenance page,\n * fed by the settings' `maintenance_details` (the merchant's title and message) and the\n * store's contacts. Rendered by `TwilightProvider` in place of the layout; see\n * `rootBeforeLoad` for who sees it.\n */\nexport function MaintenancePage() {\n const { settings, locale } = getTwilightContext();\n const { t } = useTranslation();\n const store = settings.store;\n const details = settings.maintenance_details;\n const arabic = locale.startsWith('ar');\n\n const title =\n details?.title ||\n t('pages.maintenance.title', {\n defaultValue: arabic ? 'المتجر قيد الصيانة' : 'Store under maintenance',\n });\n\n return (\n <div className=\"s-maintenance\" data-testid=\"store-maintenance-page\">\n <style>{STYLE}</style>\n <div className=\"mt-container\">\n <section className=\"mt-panel\">\n <div className=\"mt-message\">\n <div className=\"mt-title\">\n {store?.logo && (\n <span className=\"mt-logo\">\n <img\n src={store.logo}\n alt={\n store.name ||\n t('common.elements.store_logo', {\n defaultValue: arabic ? 'شعار المتجر' : 'Store logo',\n })\n }\n />\n </span>\n )}\n <h1>{title}</h1>\n </div>\n <div className=\"mt-content\">\n {details?.message ? (\n // The merchant's own wording: a plain string the dashboard caps at 200 characters.\n <p>{details.message}</p>\n ) : (\n <>\n <p>\n {t('pages.maintenance.message', {\n defaultValue: arabic\n ? 'عذرا عزيزي العميل، المتجر حاليا قيد الصيانة و سنعاود العمل خلال فترة وجيزة'\n : 'Sorry, the store is under maintenance and will be back shortly.',\n })}\n </p>\n <p>\n {t('pages.maintenance.thanks', {\n defaultValue: arabic ? 'شكرا لتفهمكم' : 'Thank you for your understanding.',\n })}\n </p>\n </>\n )}\n </div>\n <Contacts store={store} arabic={arabic} />\n </div>\n <div className=\"thumb\">\n <img src={THUMB_URL} alt=\"\" />\n </div>\n </section>\n </div>\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/store/MaintenancePage.tsx"],"names":[],"mappings":";;;;AAIA,IAAM,SAAA,GAAY,yEAAA;AAGlB,IAAM,YAAA,GAA8C;AAAA,EAClD,CAAC,WAAW,SAAS,CAAA;AAAA,EACrB,CAAC,YAAY,gBAAgB,CAAA;AAAA,EAC7B,CAAC,WAAW,eAAe,CAAA;AAAA,EAC3B,CAAC,UAAU,cAAc,CAAA;AAAA,EACzB,CAAC,YAAY,gBAAgB,CAAA;AAAA,EAC7B,CAAC,aAAa,iBAAiB;AACjC,CAAA;AAUA,IAAM,KAAA,GAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,CAAA;AAiCd,SAAS,QAAA,CAAS,EAAE,KAAA,EAAO,MAAA,EAAO,EAAkD;AAClF,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,MAAA,GAAS,OAAO,QAAA,EAAU,MAAA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A,CAAC,QAAI,QAAA,EAAA,KAAA,EAAM;AAAA,SAAA,EACb,CAAA;AAAA,wBACA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,YAAA,EACZ,QAAA,EAAA,OAAA,EAAS,OAAA;AAAA;AAAA,0BAER,GAAA,CAAC,GAAA,EAAA,EAAG,QAAA,EAAA,OAAA,CAAQ,OAAA,EAAQ;AAAA,4BAEpB,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,0BAAA,GAAA,CAAC,GAAA,EAAA,EACE,YAAE,2BAAA,EAA6B;AAAA,YAC9B,YAAA,EAAc,SACV,kYAAA,GACA;AAAA,WACL,CAAA,EACH,CAAA;AAAA,0BACA,GAAA,CAAC,GAAA,EAAA,EACE,QAAA,EAAA,CAAA,CAAE,0BAAA,EAA4B;AAAA,YAC7B,YAAA,EAAc,SAAS,qEAAA,GAAiB;AAAA,WACzC,CAAA,EACH;AAAA,SAAA,EACF,CAAA,EAEJ,CAAA;AAAA,wBACA,GAAA,CAAC,QAAA,EAAA,EAAS,KAAA,EAAc,MAAA,EAAgB;AAAA,OAAA,EAC1C,CAAA;AAAA,sBACA,GAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,OAAA,EACb,QAAA,kBAAA,GAAA,CAAC,SAAI,GAAA,EAAK,SAAA,EAAW,GAAA,EAAI,EAAA,EAAG,CAAA,EAC9B;AAAA,KAAA,EACF,CAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ","file":"chunk-XL42DUCQ.js","sourcesContent":["import { getTwilightContext } from '../../twilight/context';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport type { Store, StoreSocial } from '../../types';\n\nconst THUMB_URL = 'https://cdn.assets.salla.network/prod/stores/images/construction-01.png';\n\n/** Social networks the page links to, in the old page's order, with their Salla icon class. */\nconst SOCIAL_ICONS: [keyof StoreSocial, string][] = [\n ['twitter', 'sicon-x'],\n ['snapchat', 'sicon-snapchat'],\n ['youtube', 'sicon-youtube'],\n ['tiktok', 'sicon-tiktok'],\n ['facebook', 'sicon-facebook'],\n ['instagram', 'sicon-instagram'],\n];\n\n// The platform's maintenance page (Store `pages/maintenance.blade.php` + `_maintenance.scss`),\n// trimmed to what it renders: greyscale, logo + title beside the message, contacts under a\n// rule, the illustration alongside; stacked and centred under 1024px.\n//\n// The page is its own scroll container, the viewport tall, because app-shell themes lock\n// `html, body { overflow: hidden }` and scroll only their main element, which this page\n// replaces. Centring is by auto margins, not `justify-content`, so content taller than the\n// viewport starts at the top instead of being clipped at both ends.\nconst STYLE = `\n.s-maintenance{display:flex;flex-direction:column;align-items:center;width:100%;height:100vh;height:100dvh;overflow-y:auto;color:#a3a3a3;background:#fff;filter:grayscale(100%);box-sizing:border-box}\n.s-maintenance *{box-sizing:border-box}\n.s-maintenance .mt-container{width:100%;max-width:1200px;margin:auto 0;padding:0 15px}\n.s-maintenance .mt-panel{display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%}\n.s-maintenance .mt-message{width:100%;padding-inline-start:80px;animation:revealMtBlock 1.5s forwards}\n.s-maintenance .mt-title{display:flex;align-items:center;margin:0 0 20px}\n.s-maintenance .mt-logo{display:block;flex-shrink:0;width:80px;height:80px;margin-inline-end:20px;border-radius:50%;overflow:hidden;box-shadow:0 0 5px rgb(0 0 0 / 10%)}\n.s-maintenance .mt-logo img{display:block;width:100%;height:100%;object-fit:cover}\n.s-maintenance .mt-title h1{font-size:2.25rem;line-height:1;margin:0;color:#666}\n.s-maintenance .mt-content p{margin:0;white-space:pre-line}\n.s-maintenance .mt-contact-list{display:inline-block;list-style:none;width:100%;max-width:500px;margin:20px 0 0;padding:20px 0 0;border-top:1px solid #eee}\n.s-maintenance .mt-contact-list li{display:inline-block;margin-inline-end:10px}\n.s-maintenance .mt-contact-list a{display:inline-flex;align-items:center;padding:5px;color:rgb(102 102 102 / 80%);text-decoration:none;font-size:1.25rem}\n.s-maintenance .mt-contact-list a:hover{color:#666}\n.s-maintenance .mt-contact--btn{padding:3px 20px 5px;border-radius:20px;color:#fff!important;background:rgb(102 102 102 / 80%);font-size:1rem!important}\n.s-maintenance .mt-contact--btn:hover{background:#666}\n.s-maintenance .mt-contact--btn i{margin-inline-end:10px}\n.s-maintenance .thumb{width:100%;animation:revealMtBlock 1.5s .1s forwards;opacity:0}\n.s-maintenance .thumb img{display:block;width:100%;max-width:450px;margin:0 auto}\n@media (max-width:1024px){\n.s-maintenance{padding:40px 0 10px}\n.s-maintenance .mt-panel{flex-direction:column}\n.s-maintenance .mt-message{order:2;text-align:center;padding:0;margin:50px 0 0}\n.s-maintenance .mt-title{flex-direction:column;margin-bottom:30px}\n.s-maintenance .mt-logo{margin:0 0 10px}\n.s-maintenance .mt-title h1{font-size:1.5rem}\n}\n@media (max-width:640px){.s-maintenance .thumb img{width:80%}}\n@keyframes revealMtBlock{from{opacity:0;transform:translateY(50%)}to{opacity:1;transform:translateY(0)}}\n`;\n\n/** The phone button and social links under the message; nothing when the store lists none. */\nfunction Contacts({ store, arabic }: { store: Store | undefined; arabic: boolean }) {\n const { t } = useTranslation();\n const mobile = store?.contacts?.mobile;\n const socials = SOCIAL_ICONS.flatMap(([key, icon]) => {\n const href = store?.social?.[key];\n return href ? [{ key, icon, href }] : [];\n });\n if (!mobile && socials.length === 0) return null;\n\n return (\n <ul className=\"mt-contact-list\">\n {mobile && (\n <li>\n <a href={`tel:${mobile}`} className=\"mt-contact--btn\">\n <i className=\"sicon-phone\" aria-hidden=\"true\" />\n {t('common.elements.contact_us', {\n defaultValue: arabic ? 'تواصل معنا' : 'Contact us',\n })}\n </a>\n </li>\n )}\n {socials.map(({ key, icon, href }) => (\n <li key={key}>\n <a href={href} target=\"_blank\" rel=\"noreferrer\" aria-label={key}>\n <i className={icon} aria-hidden=\"true\" />\n </a>\n </li>\n ))}\n </ul>\n );\n}\n\n/**\n * The page a customer sees while the store is closed: the platform's maintenance page,\n * fed by the settings' `maintenance_details` (the merchant's title and message) and the\n * store's contacts. Rendered by `TwilightProvider` in place of the layout; see\n * `rootBeforeLoad` for who sees it.\n */\nexport function MaintenancePage() {\n const { settings, locale } = getTwilightContext();\n const { t } = useTranslation();\n const store = settings.store;\n const details = settings.maintenance_details;\n const arabic = locale.startsWith('ar');\n\n const title =\n details?.title ||\n t('pages.maintenance.title', {\n defaultValue: arabic ? 'المتجر قيد الصيانة' : 'Store under maintenance',\n });\n\n return (\n <div className=\"s-maintenance\" data-testid=\"store-maintenance-page\">\n <style>{STYLE}</style>\n <div className=\"mt-container\">\n <section className=\"mt-panel\">\n <div className=\"mt-message\">\n <div className=\"mt-title\">\n {store?.logo && (\n <span className=\"mt-logo\">\n <img\n src={store.logo}\n alt={\n store.name ||\n t('common.elements.store_logo', {\n defaultValue: arabic ? 'شعار المتجر' : 'Store logo',\n })\n }\n />\n </span>\n )}\n <h1>{title}</h1>\n </div>\n <div className=\"mt-content\">\n {details?.message ? (\n // The merchant's own wording: a plain string the dashboard caps at 200 characters.\n <p>{details.message}</p>\n ) : (\n <>\n <p>\n {t('pages.maintenance.message', {\n defaultValue: arabic\n ? 'عذرا عزيزي العميل، المتجر حاليا قيد الصيانة و سنعاود العمل خلال فترة وجيزة'\n : 'Sorry, the store is under maintenance and will be back shortly.',\n })}\n </p>\n <p>\n {t('pages.maintenance.thanks', {\n defaultValue: arabic ? 'شكرا لتفهمكم' : 'Thank you for your understanding.',\n })}\n </p>\n </>\n )}\n </div>\n <Contacts store={store} arabic={arabic} />\n </div>\n <div className=\"thumb\">\n <img src={THUMB_URL} alt=\"\" />\n </div>\n </section>\n </div>\n </div>\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getActiveCurrency } from './chunk-
|
|
2
|
-
import { whenSallaLoaded } from './chunk-
|
|
3
|
-
import { getTwilightContext } from './chunk-
|
|
1
|
+
import { getActiveCurrency } from './chunk-YDSWLCOY.js';
|
|
2
|
+
import { whenSallaLoaded } from './chunk-3NFVZJNI.js';
|
|
3
|
+
import { getTwilightContext } from './chunk-JNAJTCJD.js';
|
|
4
4
|
|
|
5
5
|
// src/utils/sdk-events.ts
|
|
6
6
|
function dispatchRouteChanged() {
|
|
@@ -36,5 +36,5 @@ function dispatchProductViewed(product) {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
export { dispatchProductViewed, dispatchRouteChanged };
|
|
39
|
-
//# sourceMappingURL=chunk-
|
|
40
|
-
//# sourceMappingURL=chunk-
|
|
39
|
+
//# sourceMappingURL=chunk-Y464WYUT.js.map
|
|
40
|
+
//# sourceMappingURL=chunk-Y464WYUT.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils/sdk-events.ts"],"names":[],"mappings":";;;;;AA6BO,SAAS,oBAAA,GAA6B;AAC3C,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AAEnC,EAAA,MAAM,QAAQ,MAAA,CAAO,KAAA;AACrB,EAAA,IAAI,CAAC,KAAA,EAAO,KAAA,EAAO,QAAA,EAAU;AAE7B,EAAA,MAAM,MAAM,kBAAA,EAAmB;AAC/B,EAAA,KAAA,CAAM,MAAM,QAAA,CAAS,gBAAA,EAAkB,GAAA,CAAI,IAAA,IAAQ,EAAE,CAAA;AACvD;AAMO,SAAS,sBAAsB,OAAA,EAAwB;AAC5D,EAAA,IAAI,OAAO,WAAW,WAAA,EAAa;AACnC,EAAA,MAAM,KAAA,GAAQ,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,IAAK,CAAA;AACvC,EAAA,MAAM,KAAA,GAAQ,OAAA,CAAQ,KAAA,EAAO,GAAA,IAAO,EAAA;AACpC,EAAA,MAAM,OAAA,GAAU;AAAA,IACd,IAAI,OAAA,CAAQ,EAAA;AAAA,IACZ,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,UAAA,EAAY,OAAA,CAAQ,QAAA,GAAW,CAAC,EAAE,EAAA,EAAI,OAAA,CAAQ,QAAA,CAAS,EAAA,EAAI,MAAM,OAAA,CAAQ,QAAA,CAAS,IAAA,EA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Q,KAAA,EAAO,GAAA,IAAO,EAAA;AACpC,EAAA,MAAM,OAAA,GAAU;AAAA,IACd,IAAI,OAAA,CAAQ,EAAA;AAAA,IACZ,MAAM,OAAA,CAAQ,IAAA;AAAA,IACd,UAAA,EAAY,OAAA,CAAQ,QAAA,GAAW,CAAC,EAAE,EAAA,EAAI,OAAA,CAAQ,QAAA,CAAS,EAAA,EAAI,MAAM,OAAA,CAAQ,QAAA,CAAS,IAAA,EAAM,IAAI,EAAC;AAAA,IAC7F,QAAA,EAAU,OAAA,CAAQ,QAAA,EAAU,IAAA,IAAQ,EAAA;AAAA,IACpC,KAAA;AAAA,IACA,QAAA,EAAU,CAAA;AAAA,IACV,OAAA,EAAS,EAAA;AAAA,IACT,KAAA,EAAO,OAAA,CAAQ,KAAA,EAAO,IAAA,IAAQ,EAAA;AAAA,IAC9B,KAAA;AAAA,IACA,QAAA,EAAU,iBAAA,CAAkB,OAAA,CAAQ,QAAQ,CAAA;AAAA,IAC5C,GAAA,EAAK,QAAQ,GAAA,IAAO,EAAA;AAAA,IACpB,KAAA,EAAO,KAAA;AAAA,IACP,KAAK,OAAA,CAAQ,GAAA;AAAA,IACb,SAAA,EAAW;AAAA,GACb;AAEA,EAAA,eAAA;AAAA,IACE,CAAC,GAAA,KAAQ,KAAK,GAAA,CAAI,SAAQ,CAAE,IAAA,CAAK,MAAM,GAAA,CAAI,MAAM,QAAA,CAAS,gBAAA,EAAkB,CAAC,OAAO,CAAC,CAAC;AAAA,GACxF;AACF","file":"chunk-Y464WYUT.js","sourcesContent":["import { getTwilightContext } from '../twilight/context';\nimport type { PageContext } from '../twilight/context';\nimport type { Product } from '../types';\nimport { getActiveCurrency } from '../api/client';\nimport { whenSallaLoaded } from './sdk-helpers';\n\n/**\n * Payload dispatched via `salla.event.dispatch('route::changed', payload)`\n * after each client-side navigation completes.\n *\n * The page config fields are spread at root level. When the matched route\n * has no page data (e.g., 404, error boundary), an empty object is dispatched.\n *\n * @example\n * ```ts\n * salla.event.on('route::changed', (page: RouteChangedEvent) => {\n * console.log(page.slug, page.title, page.id);\n * });\n * ```\n */\nexport type RouteChangedEvent = PageContext;\n\n/**\n * Dispatch the `route::changed` Salla SDK event with the current page config.\n *\n * Framework-agnostic — reads from the twilight context store which is\n * populated by whichever framework adapter is active (TanStack, Next.js, etc.).\n * Each adapter should call this after navigation resolves.\n */\nexport function dispatchRouteChanged(): void {\n if (typeof window === 'undefined') return;\n\n const salla = window.salla;\n if (!salla?.event?.dispatch) return;\n\n const ctx = getTwilightContext();\n salla.event.dispatch('route::changed', ctx.page ?? {});\n}\n\n/**\n * Dispatch `Product Viewed`, which Twig's product page hands the SDK through `salla.init`'s\n * `events`: store analytics, pixels and apps that remember viewed products listen for it.\n */\nexport function dispatchProductViewed(product: Product): void {\n if (typeof window === 'undefined') return;\n const price = Number(product.price) || 0;\n const image = product.image?.url ?? '';\n const payload = {\n id: product.id,\n name: product.name,\n categories: product.category ? [{ id: product.category.id, name: product.category.name }] : [],\n category: product.category?.name ?? '',\n price,\n quantity: 1,\n variant: '',\n brand: product.brand?.name ?? '',\n image,\n currency: getActiveCurrency(product.currency),\n sku: product.sku ?? '',\n value: price,\n url: product.url,\n image_url: image,\n };\n // After init: analytics drops events until `salla.init` has merged the store's `jitsu` list.\n whenSallaLoaded(\n (sdk) => void sdk.onReady().then(() => sdk.event.dispatch('Product Viewed', [payload]))\n );\n}\n"]}
|