@salla.sa/twilight-theme-engine 1.0.108 → 1.0.110
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-CF4H32X7.js → AddToCartForm-JKGAATX3.js} +3 -3
- package/dist/{AddToCartForm-CF4H32X7.js.map → AddToCartForm-JKGAATX3.js.map} +1 -1
- package/dist/{BlogAuthorPage-LHYDUFDA.js → BlogAuthorPage-GM2T2QPS.js} +29 -28
- package/dist/BlogAuthorPage-GM2T2QPS.js.map +1 -0
- package/dist/{BlogCategoryPage-6BORI4YG.js → BlogCategoryPage-KSC5UCJY.js} +29 -28
- package/dist/BlogCategoryPage-KSC5UCJY.js.map +1 -0
- package/dist/{BlogPage-TSRWNX6M.js → BlogPage-5QTDYSZR.js} +27 -26
- package/dist/BlogPage-5QTDYSZR.js.map +1 -0
- package/dist/{BlogSinglePage-TLTW67S7.js → BlogSinglePage-JKRNJ3P7.js} +27 -26
- package/dist/BlogSinglePage-JKRNJ3P7.js.map +1 -0
- package/dist/{BlogTagPage-RAMP5XNR.js → BlogTagPage-JTOBAXV2.js} +29 -28
- package/dist/BlogTagPage-JTOBAXV2.js.map +1 -0
- package/dist/{BrandsPage-KUFEUFVZ.js → BrandsPage-6IEMAQ3V.js} +28 -27
- package/dist/BrandsPage-6IEMAQ3V.js.map +1 -0
- package/dist/{Breadcrumb-ZS3ZMMTM.js → Breadcrumb-267KWOPY.js} +27 -26
- package/dist/Breadcrumb-267KWOPY.js.map +1 -0
- package/dist/{CartItem-7QCAQ3QQ.js → CartItem-BUP3WUZC.js} +27 -26
- package/dist/CartItem-BUP3WUZC.js.map +1 -0
- package/dist/{CartSummary-ZPG7IAXE.js → CartSummary-U3MOISSP.js} +27 -26
- package/dist/CartSummary-U3MOISSP.js.map +1 -0
- package/dist/{Copyright-VPJMIQSO.js → Copyright-FSNCI3EE.js} +3 -3
- package/dist/{Copyright-VPJMIQSO.js.map → Copyright-FSNCI3EE.js.map} +1 -1
- package/dist/{CustomerLayout-E5FYPKT4.js → CustomerLayout-JCOMMGZ7.js} +27 -26
- package/dist/CustomerLayout-JCOMMGZ7.js.map +1 -0
- package/dist/{Footer-GIPFBQEY.js → Footer-VP3IBUMQ.js} +5 -4
- package/dist/{Footer-GIPFBQEY.js.map → Footer-VP3IBUMQ.js.map} +1 -1
- package/dist/Header-3YOZ7XLJ.js +22 -0
- package/dist/{Header-HYTNO4IR.js.map → Header-3YOZ7XLJ.js.map} +1 -1
- package/dist/{LoyaltyPage-YMK7SISF.js → LoyaltyPage-5X42RIJQ.js} +27 -26
- package/dist/LoyaltyPage-5X42RIJQ.js.map +1 -0
- package/dist/{LoyaltyPointsPage-V2463UQ6.js → LoyaltyPointsPage-67KYJN2Z.js} +10 -9
- package/dist/LoyaltyPointsPage-67KYJN2Z.js.map +1 -0
- package/dist/{MainMenu-IP6AVEIF.js → MainMenu-FYIK55JU.js} +8 -8
- package/dist/{MainMenu-IP6AVEIF.js.map → MainMenu-FYIK55JU.js.map} +1 -1
- package/dist/MaintenancePage-UBJ5Q3L5.js +7 -0
- package/dist/{MaintenancePage-Z34IQCUV.js.map → MaintenancePage-UBJ5Q3L5.js.map} +1 -1
- package/dist/MasterLayout-UMZHQTU2.js +54 -0
- package/dist/{MasterLayout-3YSR4VFQ.js.map → MasterLayout-UMZHQTU2.js.map} +1 -1
- package/dist/{MobileMenu-ZJLXCG4P.js → MobileMenu-FFPJYJ7F.js} +28 -27
- package/dist/MobileMenu-FFPJYJ7F.js.map +1 -0
- package/dist/{NotificationsPage-XKSW3DFD.js → NotificationsPage-HKJN6ME2.js} +27 -26
- package/dist/NotificationsPage-HKJN6ME2.js.map +1 -0
- package/dist/{OrderSinglePage-WSUNHCY6.js → OrderSinglePage-ASYL4SMQ.js} +28 -27
- package/dist/OrderSinglePage-ASYL4SMQ.js.map +1 -0
- package/dist/{OrdersPage-TAME5ACG.js → OrdersPage-IQXHFGLQ.js} +27 -26
- package/dist/OrdersPage-IQXHFGLQ.js.map +1 -0
- package/dist/{PageSingle-MYDLIP55.js → PageSingle-B4WQVQVQ.js} +7 -7
- package/dist/{PageSingle-MYDLIP55.js.map → PageSingle-B4WQVQVQ.js.map} +1 -1
- package/dist/{ProductDetails-MFAKRQ72.js → ProductDetails-WSEGLJSW.js} +8 -8
- package/dist/{ProductDetails-MFAKRQ72.js.map → ProductDetails-WSEGLJSW.js.map} +1 -1
- package/dist/{ProfilePage-4W7DBXLW.js → ProfilePage-6GNEI6OV.js} +27 -26
- package/dist/ProfilePage-6GNEI6OV.js.map +1 -0
- package/dist/{ReviewsPage-G3IEPOOO.js → ReviewsPage-JP4LZI4A.js} +3 -3
- package/dist/{ReviewsPage-G3IEPOOO.js.map → ReviewsPage-JP4LZI4A.js.map} +1 -1
- package/dist/{SeoCartWidget-7UDOVSWP.js → SeoCartWidget-KCB4E65P.js} +27 -26
- package/dist/SeoCartWidget-KCB4E65P.js.map +1 -0
- package/dist/{SettingsPage-TEMXC3OF.js → SettingsPage-UFGVJOI2.js} +27 -26
- package/dist/SettingsPage-UFGVJOI2.js.map +1 -0
- package/dist/StoreClosedNotification-Q4QPPYEH.js +55 -0
- package/dist/{StoreClosedNotification-YMPBP56U.js.map → StoreClosedNotification-Q4QPPYEH.js.map} +1 -1
- package/dist/{TestimonialsPage-G2S3JQNT.js → TestimonialsPage-K5PHW7WD.js} +7 -7
- package/dist/{TestimonialsPage-G2S3JQNT.js.map → TestimonialsPage-K5PHW7WD.js.map} +1 -1
- package/dist/{ThankYouPage-HPF3PIAT.js → ThankYouPage-DSDAYYJN.js} +27 -26
- package/dist/ThankYouPage-DSDAYYJN.js.map +1 -0
- package/dist/{WalletPage-G7FOMHFX.js → WalletPage-3LWCFG25.js} +28 -27
- package/dist/WalletPage-3LWCFG25.js.map +1 -0
- package/dist/{WishlistPage-VULTU6K2.js → WishlistPage-LF4A2H3I.js} +29 -28
- package/dist/WishlistPage-LF4A2H3I.js.map +1 -0
- 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-XL42DUCQ.js → chunk-2MHMQOMJ.js} +3 -3
- package/dist/{chunk-XL42DUCQ.js.map → chunk-2MHMQOMJ.js.map} +1 -1
- package/dist/{chunk-KSS7OA3Q.js → chunk-3DNVQVNY.js} +3 -3
- package/dist/{chunk-KSS7OA3Q.js.map → chunk-3DNVQVNY.js.map} +1 -1
- package/dist/{chunk-2IW3JRWL.js → chunk-4INSECDW.js} +5 -5
- package/dist/{chunk-2IW3JRWL.js.map → chunk-4INSECDW.js.map} +1 -1
- package/dist/{chunk-VUWBGAET.js → chunk-56OZRZIZ.js} +4 -4
- package/dist/{chunk-VUWBGAET.js.map → chunk-56OZRZIZ.js.map} +1 -1
- package/dist/{chunk-D7XWUD6T.js → chunk-6NV6T24C.js} +4 -4
- package/dist/{chunk-D7XWUD6T.js.map → chunk-6NV6T24C.js.map} +1 -1
- package/dist/{chunk-SQXUWX4B.js → chunk-6T7FUHJY.js} +5 -5
- package/dist/{chunk-SQXUWX4B.js.map → chunk-6T7FUHJY.js.map} +1 -1
- package/dist/{chunk-UZGP2KFA.js → chunk-6Z6BGS7P.js} +3 -3
- package/dist/{chunk-UZGP2KFA.js.map → chunk-6Z6BGS7P.js.map} +1 -1
- package/dist/{chunk-6UG4IVUF.js → chunk-72DGJN4Q.js} +23 -23
- package/dist/{chunk-6UG4IVUF.js.map → chunk-72DGJN4Q.js.map} +1 -1
- package/dist/{chunk-FQLF555I.js → chunk-7T5UR3XD.js} +4 -4
- package/dist/{chunk-FQLF555I.js.map → chunk-7T5UR3XD.js.map} +1 -1
- package/dist/{chunk-T4BRWJSI.js → chunk-7ZBSIOVM.js} +7 -7
- package/dist/{chunk-T4BRWJSI.js.map → chunk-7ZBSIOVM.js.map} +1 -1
- package/dist/{chunk-3DVAXIY3.js → chunk-ALAHGZPN.js} +4 -4
- package/dist/{chunk-3DVAXIY3.js.map → chunk-ALAHGZPN.js.map} +1 -1
- package/dist/{chunk-YDSWLCOY.js → chunk-BFA2U7P3.js} +5 -5
- package/dist/{chunk-YDSWLCOY.js.map → chunk-BFA2U7P3.js.map} +1 -1
- package/dist/{chunk-F6XPGONG.js → chunk-CA3QVM6Y.js} +5 -5
- package/dist/{chunk-F6XPGONG.js.map → chunk-CA3QVM6Y.js.map} +1 -1
- package/dist/{chunk-24UCMWQB.js → chunk-CFARTPUQ.js} +3 -3
- package/dist/{chunk-24UCMWQB.js.map → chunk-CFARTPUQ.js.map} +1 -1
- package/dist/chunk-D6XIFBYA.js +14 -0
- package/dist/{chunk-47C3MTZI.js.map → chunk-D6XIFBYA.js.map} +1 -1
- package/dist/{chunk-UWDUMPL7.js → chunk-E5PEYI5I.js} +6 -6
- package/dist/{chunk-UWDUMPL7.js.map → chunk-E5PEYI5I.js.map} +1 -1
- package/dist/{chunk-TWUOIBO7.js → chunk-E7AO2Q32.js} +3 -3
- package/dist/{chunk-TWUOIBO7.js.map → chunk-E7AO2Q32.js.map} +1 -1
- package/dist/{chunk-Y464WYUT.js → chunk-EJLVOWXU.js} +5 -5
- package/dist/{chunk-Y464WYUT.js.map → chunk-EJLVOWXU.js.map} +1 -1
- package/dist/{chunk-T5VU67NQ.js → chunk-FJQD3LTR.js} +4 -4
- package/dist/{chunk-T5VU67NQ.js.map → chunk-FJQD3LTR.js.map} +1 -1
- package/dist/{chunk-BR56OEPZ.js → chunk-FMSRB2TT.js} +4 -4
- package/dist/{chunk-BR56OEPZ.js.map → chunk-FMSRB2TT.js.map} +1 -1
- package/dist/chunk-FNM2OUPD.js +182 -0
- package/dist/chunk-FNM2OUPD.js.map +1 -0
- package/dist/{chunk-ZLLHL3NI.js → chunk-G3VAJVY5.js} +7 -7
- package/dist/{chunk-ZLLHL3NI.js.map → chunk-G3VAJVY5.js.map} +1 -1
- package/dist/{chunk-ZVYJK6XQ.js → chunk-GAGTCI3J.js} +5 -5
- package/dist/{chunk-ZVYJK6XQ.js.map → chunk-GAGTCI3J.js.map} +1 -1
- package/dist/{chunk-U6KJ7XBO.js → chunk-I7WSIN27.js} +3 -3
- package/dist/{chunk-U6KJ7XBO.js.map → chunk-I7WSIN27.js.map} +1 -1
- package/dist/{chunk-2CL6AEO4.js → chunk-IAHWLUFK.js} +3 -3
- package/dist/{chunk-2CL6AEO4.js.map → chunk-IAHWLUFK.js.map} +1 -1
- package/dist/{chunk-QA4FBMFJ.js → chunk-K7U46BT2.js} +4 -4
- package/dist/{chunk-QA4FBMFJ.js.map → chunk-K7U46BT2.js.map} +1 -1
- package/dist/{chunk-4PT5MXGR.js → chunk-LU5DRXS5.js} +4 -4
- package/dist/{chunk-4PT5MXGR.js.map → chunk-LU5DRXS5.js.map} +1 -1
- package/dist/{chunk-EHX45KZG.js → chunk-LZZ6EESI.js} +3 -3
- package/dist/{chunk-EHX45KZG.js.map → chunk-LZZ6EESI.js.map} +1 -1
- package/dist/{chunk-HNSR4KLL.js → chunk-MEMJOJO4.js} +3 -3
- package/dist/{chunk-HNSR4KLL.js.map → chunk-MEMJOJO4.js.map} +1 -1
- package/dist/{chunk-RBFLDI2Z.js → chunk-MJ7TL42D.js} +4 -4
- package/dist/{chunk-RBFLDI2Z.js.map → chunk-MJ7TL42D.js.map} +1 -1
- package/dist/{chunk-W354TTIE.js → chunk-MVBMVM22.js} +7 -7
- package/dist/{chunk-W354TTIE.js.map → chunk-MVBMVM22.js.map} +1 -1
- package/dist/{chunk-ENC6POPF.js → chunk-OMY65JIW.js} +4 -4
- package/dist/{chunk-ENC6POPF.js.map → chunk-OMY65JIW.js.map} +1 -1
- package/dist/chunk-OQIIJRAS.js +30 -0
- package/dist/chunk-OQIIJRAS.js.map +1 -0
- package/dist/{chunk-GFUXGVER.js → chunk-OSAFBMRT.js} +3 -3
- package/dist/{chunk-GFUXGVER.js.map → chunk-OSAFBMRT.js.map} +1 -1
- package/dist/{chunk-OHUTM224.js → chunk-PF2WSBJ7.js} +4 -4
- package/dist/{chunk-OHUTM224.js.map → chunk-PF2WSBJ7.js.map} +1 -1
- package/dist/{chunk-L4JI2AAL.js → chunk-PKJJ6Z7A.js} +4 -4
- package/dist/{chunk-L4JI2AAL.js.map → chunk-PKJJ6Z7A.js.map} +1 -1
- package/dist/{chunk-GXZW6BJY.js → chunk-POI4G5EA.js} +113 -8
- package/dist/chunk-POI4G5EA.js.map +1 -0
- package/dist/{chunk-JNAJTCJD.js → chunk-QRHXAKJ3.js} +5 -3
- package/dist/chunk-QRHXAKJ3.js.map +1 -0
- package/dist/{chunk-5L37UNQQ.js → chunk-S67SB2O2.js} +7 -7
- package/dist/{chunk-5L37UNQQ.js.map → chunk-S67SB2O2.js.map} +1 -1
- package/dist/{chunk-B2OJZKU4.js → chunk-SCSJROJX.js} +8 -8
- package/dist/{chunk-B2OJZKU4.js.map → chunk-SCSJROJX.js.map} +1 -1
- package/dist/{chunk-SCRNQWZT.js → chunk-TL256OK3.js} +4 -4
- package/dist/{chunk-SCRNQWZT.js.map → chunk-TL256OK3.js.map} +1 -1
- package/dist/{chunk-4SZZPXM2.js → chunk-TMMK2VYE.js} +50 -17
- package/dist/chunk-TMMK2VYE.js.map +1 -0
- package/dist/{chunk-LUFLN7WL.js → chunk-VFXAHTB3.js} +7 -7
- package/dist/{chunk-LUFLN7WL.js.map → chunk-VFXAHTB3.js.map} +1 -1
- package/dist/{chunk-PTQVBPPN.js → chunk-VIR6L7KJ.js} +6 -4
- package/dist/chunk-VIR6L7KJ.js.map +1 -0
- package/dist/{chunk-OSSOU36J.js → chunk-WD576F4S.js} +3 -3
- package/dist/{chunk-OSSOU36J.js.map → chunk-WD576F4S.js.map} +1 -1
- package/dist/{chunk-BQ2MNEN7.js → chunk-WN35SBLD.js} +3 -3
- package/dist/{chunk-BQ2MNEN7.js.map → chunk-WN35SBLD.js.map} +1 -1
- package/dist/{chunk-GKKHNGLI.js → chunk-WRYCOIYC.js} +9 -9
- package/dist/{chunk-GKKHNGLI.js.map → chunk-WRYCOIYC.js.map} +1 -1
- package/dist/{chunk-3NFVZJNI.js → chunk-X2JCU7GY.js} +3 -3
- package/dist/{chunk-3NFVZJNI.js.map → chunk-X2JCU7GY.js.map} +1 -1
- package/dist/{chunk-S5EVFWAL.js → chunk-XU33IHQA.js} +8 -8
- package/dist/{chunk-S5EVFWAL.js.map → chunk-XU33IHQA.js.map} +1 -1
- package/dist/{chunk-5N74JJ2Z.js → chunk-YSYA64WS.js} +103 -21
- package/dist/chunk-YSYA64WS.js.map +1 -0
- package/dist/{chunk-A4NN6C5B.js → chunk-YYMKDBZV.js} +3 -3
- package/dist/{chunk-A4NN6C5B.js.map → chunk-YYMKDBZV.js.map} +1 -1
- package/dist/{chunk-RA6ZTHN6.js → chunk-Z4UTYKKV.js} +4 -4
- package/dist/{chunk-RA6ZTHN6.js.map → chunk-Z4UTYKKV.js.map} +1 -1
- package/dist/{chunk-UKLYL5LM.js → chunk-ZDKQL2E4.js} +4 -4
- package/dist/{chunk-UKLYL5LM.js.map → chunk-ZDKQL2E4.js.map} +1 -1
- package/dist/{chunk-BEMWHR4T.js → chunk-ZRT6L6TC.js} +3 -3
- package/dist/{chunk-BEMWHR4T.js.map → chunk-ZRT6L6TC.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 +25 -24
- package/dist/components/home/index.js +29 -28
- package/dist/components/layout/Footer.d.ts.map +1 -1
- package/dist/components/layout/MadeWithSalla.d.ts +9 -0
- package/dist/components/layout/MadeWithSalla.d.ts.map +1 -0
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/layout/index.d.ts.map +1 -1
- package/dist/components/layout/index.js +8 -7
- package/dist/components/product/index.js +26 -25
- package/dist/components/store/index.js +27 -26
- 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-5BRFPS6J.js +29 -0
- package/dist/{document-class-B2MXKYAQ.js.map → document-class-5BRFPS6J.js.map} +1 -1
- package/dist/hooks/index.js +25 -24
- package/dist/hooks/useComments.js +4 -4
- package/dist/hooks/useGtm.js +25 -24
- package/dist/hooks/useMoney.js +25 -24
- package/dist/hooks/useProduct.js +4 -4
- package/dist/hooks/useStore.js +25 -24
- package/dist/hooks/useUser.js +6 -6
- package/dist/hooks/useWishlist.js +4 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -24
- package/dist/index.js.map +1 -1
- package/dist/native-app/index.js +4 -4
- package/dist/{navigation-LSRNHKGJ.js → navigation-NM4AO2OX.js} +8 -8
- package/dist/{navigation-LSRNHKGJ.js.map → navigation-NM4AO2OX.js.map} +1 -1
- package/dist/navigation-S5EUYOVI.js +14 -0
- package/dist/{navigation-WASYQTFC.js.map → navigation-S5EUYOVI.js.map} +1 -1
- package/dist/{not-found-M3ZPUVVC.js → not-found-NO54GPIK.js} +28 -27
- package/dist/not-found-NO54GPIK.js.map +1 -0
- package/dist/providers/index.js +25 -24
- package/dist/routes/account/orders.js +9 -9
- package/dist/routes/account.js +18 -18
- package/dist/routes/blog.js +13 -13
- package/dist/routes/brands.js +9 -9
- package/dist/routes/cart.js +33 -32
- package/dist/routes/cart.js.map +1 -1
- package/dist/routes/home.js +30 -29
- package/dist/routes/index.js +7 -7
- package/dist/routes/loyalty.js +10 -10
- package/dist/routes/page.js +9 -9
- package/dist/routes/product-listing.js +31 -30
- package/dist/routes/product-listing.js.map +1 -1
- package/dist/routes/product.js +29 -28
- package/dist/routes/product.js.map +1 -1
- package/dist/routes/root/beforeLoad.d.ts +6 -0
- package/dist/routes/root/beforeLoad.d.ts.map +1 -1
- package/dist/routes/seo-redirects.js +7 -7
- package/dist/routes/testimonials.js +5 -4
- package/dist/routes/testimonials.js.map +1 -1
- package/dist/routes/thank-you.js +9 -9
- package/dist/skeleton.js +30 -29
- package/dist/{store-lookup-EW6ALPQF.js → store-lookup-LVKWUL6Z.js} +12 -12
- package/dist/{store-lookup-EW6ALPQF.js.map → store-lookup-LVKWUL6Z.js.map} +1 -1
- package/dist/tanstack/middleware/twilight.d.ts.map +1 -1
- package/dist/tanstack/store-base.d.ts +10 -2
- package/dist/tanstack/store-base.d.ts.map +1 -1
- package/dist/tanstack/templates/locale-wrapper.d.ts +2 -1
- package/dist/tanstack/templates/locale-wrapper.d.ts.map +1 -1
- package/dist/tanstack.js +45 -23
- package/dist/tanstack.js.map +1 -1
- package/dist/types/index.d.ts +8 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/utils/baseHead.d.ts +6 -1
- package/dist/utils/baseHead.d.ts.map +1 -1
- package/dist/utils/baseHead.js +3 -1
- package/dist/utils/cookies.d.ts +6 -0
- package/dist/utils/cookies.d.ts.map +1 -1
- package/dist/utils/errors.d.ts +18 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/index.js +7 -7
- package/dist/utils/language-cookie.d.ts +10 -0
- package/dist/utils/language-cookie.d.ts.map +1 -0
- package/dist/utils/shared-host-language.d.ts +72 -0
- package/dist/utils/shared-host-language.d.ts.map +1 -0
- package/dist/utils/store-base.d.ts +28 -6
- package/dist/utils/store-base.d.ts.map +1 -1
- package/dist/vite/index.js +43 -7
- package/dist/vite/index.js.map +1 -1
- package/package.json +1 -1
- package/tailwind/components/layout/Footer.tsx.txt +2 -0
- package/tailwind/components/layout/MadeWithSalla.tsx.txt +34 -0
- package/tailwind/components/layout/index.ts.txt +3 -0
- package/tailwind/routes/root/beforeLoad.ts.txt +61 -3
- package/dist/BlogAuthorPage-LHYDUFDA.js.map +0 -1
- package/dist/BlogCategoryPage-6BORI4YG.js.map +0 -1
- package/dist/BlogPage-TSRWNX6M.js.map +0 -1
- package/dist/BlogSinglePage-TLTW67S7.js.map +0 -1
- package/dist/BlogTagPage-RAMP5XNR.js.map +0 -1
- package/dist/BrandsPage-KUFEUFVZ.js.map +0 -1
- package/dist/Breadcrumb-ZS3ZMMTM.js.map +0 -1
- package/dist/CartItem-7QCAQ3QQ.js.map +0 -1
- package/dist/CartSummary-ZPG7IAXE.js.map +0 -1
- package/dist/CustomerLayout-E5FYPKT4.js.map +0 -1
- package/dist/Header-HYTNO4IR.js +0 -22
- package/dist/LoyaltyPage-YMK7SISF.js.map +0 -1
- package/dist/LoyaltyPointsPage-V2463UQ6.js.map +0 -1
- package/dist/MaintenancePage-Z34IQCUV.js +0 -7
- package/dist/MasterLayout-3YSR4VFQ.js +0 -53
- package/dist/MobileMenu-ZJLXCG4P.js.map +0 -1
- package/dist/NotificationsPage-XKSW3DFD.js.map +0 -1
- package/dist/OrderSinglePage-WSUNHCY6.js.map +0 -1
- package/dist/OrdersPage-TAME5ACG.js.map +0 -1
- package/dist/ProfilePage-4W7DBXLW.js.map +0 -1
- package/dist/SeoCartWidget-7UDOVSWP.js.map +0 -1
- package/dist/SettingsPage-TEMXC3OF.js.map +0 -1
- package/dist/StoreClosedNotification-YMPBP56U.js +0 -54
- package/dist/ThankYouPage-HPF3PIAT.js.map +0 -1
- package/dist/WalletPage-G7FOMHFX.js.map +0 -1
- package/dist/WishlistPage-VULTU6K2.js.map +0 -1
- package/dist/chunk-47C3MTZI.js +0 -14
- package/dist/chunk-4SZZPXM2.js.map +0 -1
- package/dist/chunk-5N74JJ2Z.js.map +0 -1
- package/dist/chunk-D42M66E4.js +0 -127
- package/dist/chunk-D42M66E4.js.map +0 -1
- package/dist/chunk-GXZW6BJY.js.map +0 -1
- package/dist/chunk-JNAJTCJD.js.map +0 -1
- package/dist/chunk-PTQVBPPN.js.map +0 -1
- package/dist/document-class-B2MXKYAQ.js +0 -29
- package/dist/navigation-WASYQTFC.js +0 -14
- package/dist/not-found-M3ZPUVVC.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/cookies.ts","../src/utils/inline-script.ts","../src/utils/runtime-env.ts","../src/utils/shared-host-language.ts","../src/utils/store-base.ts","../src/utils/store-identity.ts"],"names":[],"mappings":";;;;AAEO,IAAM,sBAAA,GAAyB;AAC/B,IAAM,iBAAA,GAAoB;AAC1B,IAAM,oBAAA,GAAuB;AAE7B,IAAM,oBAAA,GAAuB;AAE7B,IAAM,cAAA,GAAiB,MAAA;AAEvB,IAAM,uBAAA,GAA0B,EAAA,GAAK,EAAA,GAAK,EAAA,GAAK;AAoB/C,IAAM,oBAAA,GAAuB,WAAA;AAG7B,IAAM,cAAA,GAAiB,SAAA;AAsBvB,IAAM,sBAAA,GAAyB,WAAA;AAG/B,IAAM,gBAAA,GAAmB,WAAA;AAchC,SAAS,eAAe,GAAA,EAA+C;AACrE,EAAA,IAAI,CAAC,KAAK,OAAO,IAAA;AACjB,EAAA,OAAO,oBAAA,CAAqB,IAAA,CAAK,GAAG,CAAA,GAAI,GAAA,GAAM,IAAA;AAChD;AAGO,SAAS,aAAa,GAAA,EAA+C;AAC1E,EAAA,OAAO,eAAe,GAAG,CAAA;AAC3B;AAoCO,IAAM,cAAA,GAAoC,CAAC,sBAAsB,CAAA;AAGxE,SAAS,WAAW,IAAA,EAAsB;AACxC,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,IAAA,EAAK,CAAE,WAAA,EAAY;AAExC,EAAA,IAAI,OAAA,CAAQ,UAAA,CAAW,GAAG,CAAA,EAAG,OAAO,OAAA,CAAQ,KAAA,CAAM,CAAA,EAAG,OAAA,CAAQ,OAAA,CAAQ,GAAG,CAAA,GAAI,CAAC,CAAA,IAAK,O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AgB;AAC9D,EAAA,IAAI,WAAW,OAAO,sBAAA;AACtB,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,EAAa,OAAO,KAAA;AAE1C,EAAA,MAAM,YAAY,qBAAA,EAAsB;AACxC,EAAA,OAAO,OAAA,CAAQ,SAAA,CAAU,SAAA,IAAa,SAAA,CAAU,sBAAsB,CAAA;AACxE;AAaO,SAAS,wBAAA,CACd,UACA,IAAA,EACe;AACf,EAAA,MAAM,IAAA,GACJ,iBAAgB,CAAE,WAAA,KAAgB,OAAO,MAAA,KAAW,WAAA,GAAc,MAAA,CAAO,QAAA,CAAS,IAAA,GAAO,IAAA,CAAA;AAC3F,EAAA,OAAO,qBAAA,CAAsB,EAAE,IAAA,EAAM,IAAA,EAAM,kBAAiB,EAAG,QAAA,EAAU,MAAM,CAAA;AACjF","file":"chunk-POI4G5EA.js","sourcesContent":["import { isLocale } from '../providers/locale-constants';\n\nexport const AUTH_TOKEN_COOKIE_NAME = 'token';\nexport const SCOPE_COOKIE_NAME = 'scope';\nexport const CURRENCY_COOKIE_NAME = 's-curr';\n/** The language the SDK's localization modal remembers; host-wide, so shared by every store on a shared host. */\nexport const LANGUAGE_COOKIE_NAME = 's-lang';\n/** Query parameter the localization modal navigates with to ask for a language. */\nexport const LANGUAGE_PARAM = 'lang';\n/** How long a language choice is remembered: one year, like the `scope` cookie. */\nexport const LANGUAGE_COOKIE_MAX_AGE = 60 * 60 * 24 * 365;\n\n/**\n * Which store this request is for, when the hostname does not say.\n *\n * A live storefront is reached at its own domain, so the hostname identifies it\n * and nothing else is needed. A preview is not: every theme under review is\n * served from the one preview hostname, so the store has to be named some other\n * way — the dispatcher takes it from `?storeId=` and puts it here, the same way\n * it remembers which theme to serve.\n *\n * Written by the dispatcher rather than the theme, and set on the *forwarded\n * request* as well as the response, because the response cookie only arrives in\n * time for the second page load and the first one has to render too.\n *\n * The literal is a contract with `STORE_COOKIE` in store-front-dispacher\n * (`src/dispatch/preview.ts`), and **nothing checks the two agree**. Drift does\n * not fail loudly — it renders somebody else's shop. Grep both repos before\n * changing it.\n */\nexport const STORE_ID_COOKIE_NAME = 'salla_sid';\n\n/** Query parameter naming the store, on a host that serves more than one. */\nexport const STORE_ID_PARAM = 'storeId';\n\n/**\n * Which version of the theme's settings to render.\n *\n * A merchant's theme settings are versioned, and the storefront normally shows\n * whichever version is live — the API answers with it, and names it back as\n * `theme.profile.id`. Two places need a different one: the merchant's own theme\n * editor, which previews a draft version before it is published, and a partner\n * running a theme locally against a store whose settings they are editing. Both\n * open the theme inside an iframe, and the version travels in that URL.\n *\n * Named `versionId` rather than the `version_id` the Dashboard uses internally,\n * because it sits beside `?storeId=` and one URL should not spell two ids two\n * ways. The value is the same one either way: the Optimus-encoded version id,\n * which is exactly what `s-version-id` has always carried.\n *\n * The literal is a contract with `VERSION_COOKIE` in store-front-dispacher\n * (`src/dispatch/preview.ts`), on the same terms as {@link STORE_ID_COOKIE_NAME}:\n * nothing checks the two agree, and drift shows a merchant the wrong version of\n * their own settings rather than failing.\n */\nexport const VERSION_ID_COOKIE_NAME = 'salla_vid';\n\n/** Query parameter naming the theme-settings version, where one may be named. */\nexport const VERSION_ID_PARAM = 'versionId';\n\n/**\n * An id named by a request is an integer, and anything else is not one.\n *\n * Validated rather than passed through because these values end up in an upstream\n * API path and header. Leading zeroes, signs, decimals and whitespace are all\n * rejected: the point is a single canonical form, not the widest set of things\n * that could be coerced into a number.\n *\n * One function for both ids on purpose. They arrive the same way, from the same\n * untrusted place, and are spent the same way; two copies of this rule would be\n * two chances for one of them to be relaxed on its own.\n */\nfunction parseRequestId(raw: string | null | undefined): string | null {\n if (!raw) return null;\n return /^[1-9][0-9]{0,18}$/.test(raw) ? raw : null;\n}\n\n/** A store id in its canonical form, or null when it is not one. */\nexport function parseStoreId(raw: string | null | undefined): string | null {\n return parseRequestId(raw);\n}\n\n/** A theme-settings version id in its canonical form, or null when it is not one. */\nexport function parseVersionId(raw: string | null | undefined): string | null {\n return parseRequestId(raw);\n}\n\n/** The store id the dispatcher left in the cookie, or null when absent or malformed. */\nexport function extractStoreIdFromCookies(cookieHeader: string | null): string | null {\n return parseStoreId(extractTokenFromCookies(cookieHeader, STORE_ID_COOKIE_NAME));\n}\n\n/** The version id the dispatcher left in the cookie, or null when absent or malformed. */\nexport function extractVersionIdFromCookies(cookieHeader: string | null): string | null {\n return parseVersionId(extractTokenFromCookies(cookieHeader, VERSION_ID_COOKIE_NAME));\n}\n\n/**\n * The only hosts on which a request may name its own store.\n *\n * **This is a security boundary, not a convenience.** On a merchant's own domain\n * the hostname *is* the store, and it is the only thing that may decide. A theme\n * that also honoured `?storeId=` there would let anyone open\n * `https://reefperfumes.com/?storeId=<someone else>` and be served a different\n * merchant's shop from the domain its owner controls — their branding, their\n * customers' address bar, somebody else's catalogue — and the cookie would keep\n * serving it for the rest of that browser's session. Salla points SaaS domains\n * at this dispatcher, so those hostnames are real and reachable.\n *\n * The override exists for one situation: a host that serves many stores and so\n * cannot identify one from its name. That is the preview host, where every theme\n * under review answers on the same address, and local development.\n *\n * Adding an entry grants that host the ability to render any store on request.\n * Add nothing that a merchant's traffic reaches.\n */\nexport const STORE_ID_HOSTS: readonly string[] = ['preview.salla.design'];\n\n/** The hostname alone — a port never distinguishes one host's authority from another's. */\nfunction hostnameOf(host: string): string {\n const trimmed = host.trim().toLowerCase();\n // IPv6 literals are bracketed, and the colons inside them are not a port.\n if (trimmed.startsWith('[')) return trimmed.slice(0, trimmed.indexOf(']') + 1) || trimmed;\n const colon = trimmed.indexOf(':');\n return colon === -1 ? trimmed : trimmed.slice(0, colon);\n}\n\nexport function isLoopback(hostname: string): boolean {\n return (\n hostname === 'localhost' ||\n hostname === '127.0.0.1' ||\n hostname === '[::1]' ||\n hostname.endsWith('.localhost')\n );\n}\n\n/**\n * Whether this host is allowed to let the request choose a store.\n *\n * Deliberately an allowlist of exact hostnames plus loopback. No suffix matching:\n * a rule like \"anything ending in salla.design\" is one wildcard DNS record away\n * from admitting a host nobody meant to admit, and the list of hosts that serve\n * more than one store is short and known.\n *\n * It gates {@link resolveRequestVersionId} as well, and the name has been left\n * alone rather than generalised because one predicate that both call is the\n * property worth keeping — a second, subtly different list is how a host ends up\n * permitted to name one thing and not the other. A version is worth gating for\n * the same reason a store is: on a merchant's own domain, honouring\n * `?versionId=` would publish whatever draft settings they are still working on\n * to anyone who guessed the URL.\n */\nexport function allowsRequestStoreId(host: string | null | undefined): boolean {\n if (!host) return false;\n const hostname = hostnameOf(host);\n return STORE_ID_HOSTS.includes(hostname) || isLoopback(hostname);\n}\n\n/**\n * Whether this host *is* a store, so its name can be used as the identifier.\n *\n * The exact inverse of {@link allowsRequestStoreId}, and deliberately written as\n * one so the two can never disagree: a host that may name its store is a host\n * that serves more than one, and a host that serves more than one cannot be the\n * answer to \"which store is this?\". `preview.salla.design` and `localhost:5188`\n * are not shops; asking the API about them earns a 422 and a page that reads as\n * a broken theme.\n */\nexport function hostIdentifiesStore(host: string | null | undefined): boolean {\n return Boolean(host) && !allowsRequestStoreId(host);\n}\n\n/**\n * The store this request names, on a host permitted to name one.\n *\n * The host check is inside the resolution rather than at a call site, because a\n * call site is a thing someone can add without reading this comment. There is no\n * way to ask \"what store did the request name?\" without also asking \"is this a\n * host that may say?\" — get it wrong and the answer is a security bug that looks\n * like a feature.\n *\n * Between the two permitted sources the URL wins, the same precedence the\n * dispatcher uses for the theme and for the same reason: a link is how someone\n * switches, and a cookie they cannot see should never beat the address they\n * just typed.\n */\nexport function resolveRequestStoreId(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined\n): string | null {\n return resolveRequestId(url, cookieHeader, host, STORE_ID_PARAM, STORE_ID_COOKIE_NAME);\n}\n\n/**\n * A store username as it can appear as the first segment of a path.\n *\n * Starts with a letter or digit, so nothing the platform mounts at the root of a\n * host — `/_serverFn/`, `/.well-known/` — is ever read as a store. Dots are allowed\n * (`zyros.sa`), but a root file (`/favicon.ico`, `/robots.txt`) is not a store.\n * The value is sent upstream as the `store-identifier` header, so the set is kept\n * narrow on purpose: a username outside it cannot be addressed by path, and\n * `?storeId=` still can.\n */\nconst STORE_BASE_SEGMENT = /^[a-z0-9][a-z0-9._-]{0,62}$/i;\nconst ROOT_FILE =\n /\\.(ico|txt|xml|json|webmanifest|html?|js|mjs|css|map|png|jpe?g|gif|svg|webp|avif|woff2?|ttf|otf|eot|pdf|mp4|webm|wasm)$/i;\n\n/**\n * Whether this could be a store's username in the first segment of a path.\n *\n * A supported locale code never is, in any case: `/ar` and `/EN` are languages,\n * so `preview.salla.design/en/cart` is the English cart of the store the cookie\n * names. That makes a store whose username is a locale code (`ar` is one)\n * unreachable by path; `?storeId=` still reaches it.\n *\n * The same predicate decides whether a username may become a path's root\n * (`storeBaseRedirectHref`). That is what stops the redirect from looping: a\n * store called `ar`, sent to `/ar/…`, would find no store there and be sent again.\n */\nexport function isStoreBaseSegment(value: string | null | undefined): value is string {\n return (\n typeof value === 'string' &&\n STORE_BASE_SEGMENT.test(value) &&\n !ROOT_FILE.test(value) &&\n !isLocale(value.toLowerCase())\n );\n}\n\n/**\n * The store the first segment of this request's path names, on a host permitted\n * to name one.\n *\n * On such a host the first segment **is** the store. It is the root of the\n * application there, so `https://preview.salla.design/mtgr-alaatr-2/cart` is the\n * cart of the store whose username is `mtgr-alaatr-2`. This is a rule rather than\n * a guess, and it has to be: `cart`, `offers` and `search` are all real store\n * usernames, so a store cannot be told from a page by looking at the segment.\n * `/cart` on these hosts is the store called `cart`.\n *\n * The one segment that is not a store is a supported locale code (see\n * {@link isStoreBaseSegment}). `/ar/cart` names a language, and the store comes\n * from the cookie or `VITE_STORE_DOMAIN`, as it would at `/`.\n *\n * A URL that carries `storeId` is not read this way at all, whatever its value.\n * That is how `salla theme dev` names a store (`/ar?storeId=…`), on a path that\n * begins with a page; the root loader then redirects to the store's own address.\n * Checking for a *valid* id instead would let a malformed one hand the page's\n * first segment the store's job. (On the preview host the dispatcher removes the\n * parameter and sends a cookie; the editor opens that host at `/`, where there is\n * no segment to read.)\n *\n * Same gate as {@link resolveRequestStoreId}, for the same reason: on a merchant's\n * own domain the hostname is the store and the path is only ever a page.\n */\nexport function resolveRequestStoreBase(\n url: string,\n host: string | null | undefined\n): string | null {\n if (!allowsRequestStoreId(host)) return null;\n\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return null;\n }\n if (parsed.searchParams.has(STORE_ID_PARAM)) return null;\n\n const first = parsed.pathname.split('/')[1];\n return isStoreBaseSegment(first) ? first : null;\n}\n\n/** Which store a request addressed, and how. At most one of the two is set. */\nexport interface RequestStore {\n /** Named by `?storeId=`, or by the cookie remembering it. */\n storeId: string | null;\n /** Named by the first segment of the path. */\n storeBase: string | null;\n}\n\n/**\n * The store this request addressed: the query, then the path, then the cookie.\n *\n * The path outranks the cookie because it is the address the visitor can see.\n * The cookie is one value for the whole preview host, so with two stores open in\n * two tabs it names whichever was opened last; the path names the one in front\n * of them.\n */\nexport function resolveRequestStore(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined\n): RequestStore {\n const storeBase = resolveRequestStoreBase(url, host);\n return {\n storeBase,\n storeId: storeBase ? null : resolveRequestStoreId(url, cookieHeader, host),\n };\n}\n\n/**\n * The header the storefront dispatcher names the store in, on a Salla shared host\n * that routes by username: `demostore.salla.sa/ar/dev-x/cart` is store `dev-x`.\n *\n * There the hostname belongs to every store, so the API cannot be asked about it\n * (it answers 422 and the page reads \"Store Unavailable\"), and only the dispatcher\n * has already read the username out of the path to choose this theme.\n *\n * Trusted because nothing else can set it. A theme worker is reached only through\n * the dispatcher, which hands it the headers on its own allowlist and then this one;\n * a visitor's copy never arrives. On a merchant's own domain the dispatcher does\n * not send it, so the hostname stays the store there.\n */\nexport const STORE_BASE_HEADER = 'x-salla-store-base';\n\n/** {@link RequestStore}, plus where the store segment sits in the path. */\nexport interface AddressedStore extends RequestStore {\n /**\n * True when the store segment follows the locale (`/ar/dev-x/cart`), as on a\n * Salla shared host; false when it is the root (`/mtgr-alaatr-2/ar/cart`), as on\n * the preview host and a dev server.\n */\n storeBaseFollowsLocale: boolean;\n}\n\n/**\n * The store this request addressed, counting the one the dispatcher named.\n *\n * The dispatcher's answer comes first and replaces the others: on a shared host it\n * is the address the visitor typed, read by the service that routed it here. Any\n * other request is resolved as {@link resolveRequestStore} always has, with the\n * segment at the root.\n */\nexport function resolveAddressedStore(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined,\n dispatchedStoreBase: string | null | undefined\n): AddressedStore {\n if (isStoreBaseSegment(dispatchedStoreBase)) {\n return { storeBase: dispatchedStoreBase, storeId: null, storeBaseFollowsLocale: true };\n }\n return { ...resolveRequestStore(url, cookieHeader, host), storeBaseFollowsLocale: false };\n}\n\n/**\n * The theme-settings version this request names, on a host permitted to name one.\n *\n * Same shape and the same host gate as {@link resolveRequestStoreId}, deliberately:\n * both answer \"what did this request ask to be shown?\", both are reached only on\n * a host that serves more than one thing, and a version that could be named where\n * a store could not would be a second rule to keep in step with the first.\n *\n * Null is the ordinary answer, and it is not a failure — it means nothing\n * addressed a version, so the store's own live one is what gets rendered.\n */\nexport function resolveRequestVersionId(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined\n): string | null {\n return resolveRequestId(url, cookieHeader, host, VERSION_ID_PARAM, VERSION_ID_COOKIE_NAME);\n}\n\n/**\n * The id this request names, from the query first and the cookie after.\n *\n * The host check lives here rather than at either call site, for the reason the\n * two wrappers above are wrappers at all: there must be no way to ask what a\n * request named without also asking whether this host may say.\n */\nfunction resolveRequestId(\n url: string,\n cookieHeader: string | null,\n host: string | null | undefined,\n param: string,\n cookieName: string\n): string | null {\n if (!allowsRequestStoreId(host)) return null;\n\n let fromQuery: string | null = null;\n try {\n fromQuery = parseRequestId(new URL(url).searchParams.get(param));\n } catch {\n /* a relative or malformed URL simply names nothing */\n }\n return fromQuery ?? parseRequestId(extractTokenFromCookies(cookieHeader, cookieName));\n}\n\n/**\n * Deletes the auth `token` cookie. This cookie is written client-side by the theme\n * (TwilightProvider), not by the SDK — `salla.cookie.clearAll()` only clears its own\n * allowlist and leaves `token` behind — so logout must clear it here. Client-only.\n */\n/**\n * On a dev server, remembers the store the page is showing, so a later URL that\n * names no store keeps it instead of falling back to `VITE_STORE_DOMAIN`.\n * Loopback only: on the preview host this cookie belongs to the dispatcher. Client-only.\n */\nexport function rememberDevStoreId(id: string | number | null | undefined): void {\n if (typeof document === 'undefined' || !isLoopback(window.location.hostname)) return;\n const storeId = parseStoreId(id == null ? null : String(id));\n if (storeId) document.cookie = `${STORE_ID_COOKIE_NAME}=${storeId}; path=/; SameSite=Lax`;\n}\n\nexport function clearAuthTokenCookie(): void {\n if (typeof document === 'undefined') return;\n document.cookie = `${AUTH_TOKEN_COOKIE_NAME}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;\n}\n\nexport function extractTokenFromCookies(\n cookieHeader: string | null,\n cookieName: string\n): string | null {\n if (!cookieHeader) return null;\n\n const prefix = `${cookieName}=`;\n let start = 0;\n\n while (start < cookieHeader.length) {\n const idx = cookieHeader.indexOf(prefix, start);\n if (idx === -1) return null;\n\n const prevChar = idx > 0 ? cookieHeader[idx - 1] : '';\n if (prevChar === '' || prevChar === ';' || prevChar === ' ') {\n let end = cookieHeader.indexOf(';', idx);\n if (end === -1) end = cookieHeader.length;\n\n const value = cookieHeader.slice(idx + prefix.length, end).trim();\n try {\n return decodeURIComponent(value) || null;\n } catch {\n return value || null;\n }\n }\n\n start = idx + prefix.length;\n }\n\n return null;\n}\n\n/**\n * The scope the Salla SDK persists as `scope`: the market (`id`/`type`) plus, once\n * bullet delivery confirms an address or branch, the allocation. The SDK sends all\n * four as request headers (`s-scope-id`, `s-scope-type`, `s-scope-allocation-type`,\n * `s-scope-allocation-id`) and the API resolves stock per allocation — a scope sent\n * without its allocation is a different question, answered from a different branch.\n */\nexport interface ActiveScope {\n id: string;\n type?: string;\n allocation_type?: string;\n allocation_id?: string;\n}\n\n/** The SDK stores the scope either as its full object or as a bare id. */\nfunction normalizeScope(raw: unknown): ActiveScope | null {\n if (raw == null) return null;\n if (typeof raw !== 'object') return { id: String(raw) };\n const s = raw as Record<string, unknown>;\n if (s.id == null) return null;\n const scope: ActiveScope = { id: String(s.id) };\n if (s.type != null) scope.type = String(s.type);\n if (s.allocation_type != null) scope.allocation_type = String(s.allocation_type);\n if (s.allocation_id != null) scope.allocation_id = String(s.allocation_id);\n return scope;\n}\n\n/**\n * Reads the active scope from the `scope` cookie, which Salla persists as a JSON\n * object (e.g. `{\"id\":123,\"type\":\"scope\",\"allocation_type\":\"branch\",\"allocation_id\":\"9\"}`).\n * Returns null when the cookie is missing or unparseable. Used server-side, where\n * `salla.storage` is absent.\n */\nexport function extractScopeFromCookies(cookieHeader: string | null): ActiveScope | null {\n const raw = extractTokenFromCookies(cookieHeader, SCOPE_COOKIE_NAME);\n if (!raw) return null;\n try {\n return normalizeScope(JSON.parse(raw));\n } catch {\n return null;\n }\n}\n\n/** `value` when it is a currency code, else null: the cookie's value goes into a request header. */\nexport function toCurrencyCode(value: string | null | undefined): string | null {\n return value && /^[A-Z]{3}$/.test(value) ? value : null;\n}\n\n/** The currency the visitor chose (`s-curr`, written by the SDK), or null for the store's own. */\nexport function extractCurrencyFromCookies(cookieHeader: string | null): string | null {\n return toCurrencyCode(extractTokenFromCookies(cookieHeader, CURRENCY_COOKIE_NAME));\n}\n\n/** {@link extractScopeFromCookies} reduced to the id. */\nexport function extractScopeIdFromCookies(cookieHeader: string | null): string | null {\n return extractScopeFromCookies(cookieHeader)?.id ?? null;\n}\n\n/**\n * The scope the Salla SDK persisted in its storage (`salla.storage.get('scope')`).\n *\n * Returns `undefined` when the SDK storage API isn't ready yet — deliberately\n * distinct from `null` (\"no branch selected\"), so callers can't mistake a\n * not-yet-hydrated SDK for a cleared selection. Client-only.\n *\n * Storage the SDK has loaded but not yet initialised counts as not ready: it is\n * what the previous visit left, and `init` replaces it with the scope the page\n * was rendered for and the one `?scope=` names. Read before that, it would\n * outvote the `scope` cookie the server wrote for this page.\n */\nexport function readSdkScope(): ActiveScope | null | undefined {\n const sdk = typeof window !== 'undefined' ? window.salla : undefined;\n const storage = sdk?.storage;\n if (typeof storage?.get !== 'function') return undefined;\n const status = (sdk as { status?: unknown } | undefined)?.status;\n if (status !== undefined && status !== 'ready') return undefined;\n return normalizeScope(storage.get(SCOPE_COOKIE_NAME));\n}\n\n/** The type of a multi-market (Country Scopes) store's scopes, which `s-scope-type` must name. */\nconst MARKET_SCOPE_TYPE = 'scope';\n\nconst ALLOCATION_TYPES = ['address', 'branch'];\n\n/** An encoded branch id, or the `msa_` token several branches are packed into. */\nconst ALLOCATION_ID = /^(?:[1-9][0-9]{0,18}|msa_[A-Za-z0-9+/=_-]{1,2048})$/;\n\n/**\n * The scope a page URL names, the way Twig storefronts switch market: the SDK's\n * scopes modal reloads the page with `?scope=<id>`, and a branch picked for it\n * travels as `allocation_type` / `allocation_id`. Null when the URL names none\n * or names it malformed; an allocation is kept only when both halves are valid.\n */\nexport function extractScopeFromUrl(url: string): ActiveScope | null {\n let params: URLSearchParams;\n try {\n params = new URL(url).searchParams;\n } catch {\n return null;\n }\n const id = parseRequestId(params.get('scope'));\n if (!id) return null;\n\n const scope: ActiveScope = { id };\n const allocationType = params.get('allocation_type');\n const allocationId = params.get('allocation_id');\n if (\n allocationType &&\n ALLOCATION_TYPES.includes(allocationType) &&\n allocationId &&\n ALLOCATION_ID.test(allocationId)\n ) {\n scope.allocation_type = allocationType;\n scope.allocation_id = allocationId;\n }\n return scope;\n}\n\n/**\n * The scope a request is for: the one its URL names, else the `scope` cookie.\n *\n * The URL wins because it is the newer choice: it is how a market is switched,\n * and the cookie still holds the one switched from. Merged with that cookie only\n * when both name the same scope; a different scope does not inherit the previous\n * one's branch. The type is store-wide, so it comes from the cookie, or is the\n * multi-market one when there is no cookie yet — the settings answer corrects it\n * for a store that browses by branch or city (see `rootBeforeLoad`).\n */\nexport function resolveRequestScope(url: string, cookieHeader: string | null): ActiveScope | null {\n const fromCookie = extractScopeFromCookies(cookieHeader);\n const fromUrl = extractScopeFromUrl(url);\n if (!fromUrl) return fromCookie;\n if (fromCookie?.id === fromUrl.id) return { ...fromCookie, ...fromUrl };\n return { ...fromUrl, type: fromCookie?.type ?? MARKET_SCOPE_TYPE };\n}\n\n/** {@link readSdkScope} reduced to the id; keeps the not-ready/none distinction. */\nexport function readSdkScopeId(): string | null | undefined {\n const scope = readSdkScope();\n return scope === undefined ? undefined : (scope?.id ?? null);\n}\n\n/** One year — the SDK keeps the selected branch in localStorage indefinitely. */\nexport const SCOPE_COOKIE_MAX_AGE = 60 * 60 * 24 * 365;\n\nexport const sameScope = (a: ActiveScope | null, b: ActiveScope | null): boolean =>\n JSON.stringify(a) === JSON.stringify(b);\n\n/**\n * Mirrors the scope the Salla SDK selected into the `scope` cookie so the SERVER\n * can see it. The SDK persists the selection in localStorage ONLY and writes no\n * cookie, so without this the server computes scope=null for every visitor who\n * picked a branch while the client computes the branch id — the dehydrated settings\n * query key never matches and the client refetches store settings on every page\n * load (SAL-122).\n *\n * Written in the SDK's own JSON shape so {@link extractScopeFromCookies} parses it,\n * allocation included: the bullet-delivery component writes the same cookie with the\n * full object, and rewriting it with the id alone would drop the branch the server\n * needs. Returns true when the cookie was (re)written. Client-only; no-op on the server.\n */\nexport function writeScopeCookie(scope: ActiveScope | null): boolean {\n if (typeof document === 'undefined') return false;\n if (sameScope(extractScopeFromCookies(document.cookie), scope)) return false;\n\n if (scope == null) {\n document.cookie = `${SCOPE_COOKIE_NAME}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`;\n return true;\n }\n\n const value = encodeURIComponent(JSON.stringify(scope));\n document.cookie = `${SCOPE_COOKIE_NAME}=${value}; path=/; max-age=${SCOPE_COOKIE_MAX_AGE}; samesite=lax`;\n return true;\n}\n\n/**\n * Keeps the `scope` cookie in step with the SDK's selected branch. Call on every\n * client navigation; it no-ops while the SDK storage API is still hydrating so a\n * late-loading SDK can't wipe a valid cookie.\n */\nexport function syncScopeCookie(): boolean {\n const scope = readSdkScope();\n return scope === undefined ? false : writeScopeCookie(scope);\n}\n","/**\n * Escape a JSON-stringified value for safe embedding inside an inline `<script>` body.\n *\n * The head injects script bodies raw, so a `</script>` inside partner-set data would break out\n * of the tag; U+2028/U+2029 are line terminators in JS but not in JSON, so they must go too.\n */\nexport function escapeForInlineScript(value: string): string {\n return value\n .replace(/</g, '\\\\u003c')\n .replace(/>/g, '\\\\u003e')\n .replace(/&/g, '\\\\u0026')\n .replace(/\\u2028/g, '\\\\u2028')\n .replace(/\\u2029/g, '\\\\u2029');\n}\n","import { escapeForInlineScript } from './inline-script';\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore } from './cookies';\n\n/** Where `rootHead` publishes the SSR-resolved env for the browser bundle to read. */\nconst RUNTIME_ENV_KEY = '__SALLA_RUNTIME_ENV__';\n\n/** The env values that must agree between the SSR render and the hydrated client. */\nexport interface RuntimeEnv {\n /** Store API base — `VITE_API_URL`. */\n apiBase?: string;\n /** Store identifier — `VITE_STORE_DOMAIN`. */\n storeIdentifier?: string;\n /**\n * The theme-settings version the request named, if any.\n *\n * Published for the same reason `storeIdentifier` is: the dispatcher strips\n * `?versionId=` on the way in, so by the time the browser has the page its own\n * URL no longer says which version it is showing. Without this the hydrated\n * client would ask the API about the store's live version and quietly replace\n * the draft it was handed.\n *\n * Absent — not empty — when nothing named one, so it drops out of the inline\n * script entirely rather than publishing a value that means \"live\".\n */\n versionId?: string;\n /**\n * The store segment at the root of this page's paths, when the store is\n * addressed that way — see `resolveStoreBase`.\n *\n * Published because the browser's address is not always the URL the server\n * read: the dispatcher removes `?storeId=` from the request it forwards but not\n * from the address bar, and a URL carrying it is never read for a segment. The\n * client builds its router from this, and a router that disagreed with the\n * server about the root would hydrate a different page.\n */\n storeBase?: string;\n /**\n * True when {@link storeBase} sits behind the locale (`/ar/dev-x/cart`), as on a\n * Salla shared host. Published with it: a client router that put the segment in\n * the other place would build every link to a page the dispatcher cannot route.\n * Absent when false, like the other flags here.\n */\n storeBaseFollowsLocale?: boolean;\n}\n\n/**\n * A build-time `import.meta.env` var, falling back to the worker's runtime `process.env`\n * (wrangler `vars`, exposed via the `nodejs_compat_populate_process_env` flag).\n */\nexport function readEnv(key: string): string | undefined {\n try {\n const vite = (import.meta as unknown as { env?: Record<string, string | undefined> }).env?.[\n key\n ];\n if (vite) return vite;\n } catch {\n /* import.meta.env not available in all environments */\n }\n return typeof process !== 'undefined' ? process.env?.[key] : undefined;\n}\n\n/**\n * What this runtime resolves from its own env — server-side that includes the worker vars.\n * Prefers what the server already published, so re-rendering the head during hydration yields\n * the same script instead of dropping it.\n */\nexport function resolveRuntimeEnv(): RuntimeEnv {\n const injected = getInjectedRuntimeEnv();\n const { storeId, storeBase, storeBaseFollowsLocale, versionId, requestHost } = getRequestStore();\n return {\n apiBase: injected.apiBase || readEnv('VITE_API_URL'),\n // The request outranks the build-time var here for the same reason it does\n // in `resolveStoreIdentifier`, and this is the copy that reaches the\n // browser: publish the store SSR actually rendered, or hydration resolves\n // again from a URL whose `?storeId=` the dispatcher has already stripped and\n // queries a different store than the markup it is hydrating.\n storeIdentifier:\n injected.storeIdentifier ||\n storeId ||\n storeBase ||\n (hostIdentifiesStore(requestHost) ? requestHost : null) ||\n readEnv('VITE_STORE_DOMAIN'),\n // Absent rather than empty when the path named no store, so it drops out of\n // the inline script, like `versionId`.\n storeBase: injected.storeBase || storeBase || undefined,\n storeBaseFollowsLocale:\n injected.storeBaseFollowsLocale || (storeBase ? storeBaseFollowsLocale : false) || undefined,\n // No env fallback on purpose. A store identifier has one because a build can\n // legitimately be pinned to a store; a version is something a request asks\n // for, and a build-time default would make every visitor of every store see\n // whichever draft was current when the theme was compiled.\n versionId: injected.versionId || versionId || undefined,\n };\n}\n\n/**\n * The env the SSR worker resolved, as handed to the browser by `rootHead`. Empty on the server\n * and on a client whose head carried nothing.\n *\n * Worker `vars` are *runtime* env: they live in `process.env` on the server only, while\n * `import.meta.env` is substituted at build time. A bundle built without those vars therefore\n * sees `undefined` in the browser and silently falls back to the production defaults — SSR\n * would render off the configured backend while every post-hydration fetch hits another one.\n */\nexport function getInjectedRuntimeEnv(): RuntimeEnv {\n const holder = globalThis as typeof globalThis & { [RUNTIME_ENV_KEY]?: RuntimeEnv };\n return holder[RUNTIME_ENV_KEY] ?? {};\n}\n\n/**\n * Inline head `<script>` body publishing the server-resolved env, or null when there is nothing\n * to publish (no overrides configured — the defaults already agree on both sides).\n */\nexport function renderRuntimeEnvScript(env: RuntimeEnv = resolveRuntimeEnv()): string | null {\n const set = Object.entries(env).filter(([, value]) => Boolean(value));\n if (!set.length) return null;\n const json = escapeForInlineScript(JSON.stringify(Object.fromEntries(set)));\n return `window.${RUNTIME_ENV_KEY}=${json};`;\n}\n","/**\n * @fileoverview The language of a page on a Salla shared host, where the URL does not carry it.\n *\n * On `demostore.salla.sa` and `salla.sa` a store is addressed `/dev-x/cart`. The route tree\n * still has a `/{-$locale}` segment, so the router puts a *virtual* locale in front of the\n * path on the way in and takes it off on the way out (`tanstack/store-base.ts`). This file\n * decides which one, and what to do when the choice is not one the store offers. See\n * `docs/store-base-path.md`.\n *\n * Pure: no request, no cookies written. The callers read and write those.\n */\nimport type { StoreContext } from '../api/store';\nimport { FALLBACK_LOCALE, isLocale } from '../providers/locale-constants';\nimport { extractTokenFromCookies, LANGUAGE_COOKIE_NAME, LANGUAGE_PARAM } from './cookies';\n\n/** A language code from a request, if it is one the engine knows. Case is not significant. */\nfunction knownLocale(value: string | null | undefined): string | null {\n const code = value?.toLowerCase();\n return isLocale(code) ? code : null;\n}\n\nfunction safeDecode(value: string): string {\n try {\n return decodeURIComponent(value);\n } catch {\n return value;\n }\n}\n\n/** The value of `?lang=` in a query string (with or without the `?`), or null when absent. */\nfunction langParam(search: string): string | null {\n for (const part of search.replace(/^\\?/, '').split('&')) {\n const [key, value = ''] = part.split('=');\n if (safeDecode(key) === LANGUAGE_PARAM) return safeDecode(value);\n }\n return null;\n}\n\n/** Whether a query string (with or without the `?`) carries `lang`, whatever its value. */\nexport function hasLanguageParam(search: string): boolean {\n return langParam(search) !== null;\n}\n\n/** The language the `s-lang` cookie remembers, if it is a known one. */\nexport function languageFromCookies(cookieHeader: string | null): string | null {\n return knownLocale(extractTokenFromCookies(cookieHeader, LANGUAGE_COOKIE_NAME));\n}\n\n/**\n * The language a request on a shared host is for, before the store's settings are known:\n * `?lang=`, then the `s-lang` cookie, then {@link FALLBACK_LOCALE}. Each must be a language\n * the engine knows; whether the store offers it is {@link decideSharedHostLanguage}'s\n * question.\n */\nexport function virtualLocale(search: string, cookieHeader: string | null): string {\n return knownLocale(langParam(search)) ?? languageFromCookies(cookieHeader) ?? FALLBACK_LOCALE;\n}\n\n/** The ISO codes (lower case) a store lists, or null when its settings did not say. */\nfunction listedLocales(settings: StoreContext): string[] | null {\n const codes = (settings.languages ?? [])\n .map((language) => (language.iso_code ?? language.code)?.toLowerCase())\n .filter((code): code is string => Boolean(code));\n return codes.length ? codes : null;\n}\n\n/**\n * Whether the store has more than one language to choose between.\n *\n * Both signals count: the merchant's `is_multilingual` switch, and the number of languages\n * the settings list. Either one saying \"single\" makes the store single-language. The count\n * is only used when the settings carry the list at all.\n */\nexport function isMultilingualStore(settings: StoreContext | null | undefined): boolean {\n if (settings?.store?.settings?.is_multilingual === false) return false;\n return settings?.languages == null || settings.languages.length >= 2;\n}\n\n/** The store's default language: the one marked, else the engine's fallback, else the first listed. */\nexport function defaultLanguage(settings: StoreContext): string | null {\n const listed = listedLocales(settings);\n if (!listed) return null;\n const marked = settings.languages?.find((language) => Boolean(language.is_default));\n const markedCode = (marked?.iso_code ?? marked?.code)?.toLowerCase();\n if (markedCode) return markedCode;\n return listed.includes(FALLBACK_LOCALE) ? FALLBACK_LOCALE : listed[0];\n}\n\n/**\n * The languages this store can be shown in, or null when its settings did not list any\n * (nothing to check against). A store that is not multilingual shows its default only.\n */\nexport function offeredLanguages(settings: StoreContext): string[] | null {\n const listed = listedLocales(settings);\n if (!listed) return null;\n if (isMultilingualStore(settings)) return listed;\n const only = defaultLanguage(settings);\n return only ? [only] : listed;\n}\n\n/** `search` (a query string, with or without `?`) without `lang`, and then `lang=<code>` if given. */\nexport function withLanguageParam(search: string, code?: string): string {\n const kept = search\n .replace(/^\\?/, '')\n .split('&')\n .filter((part) => part && safeDecode(part.split('=')[0]) !== LANGUAGE_PARAM);\n if (code) kept.push(`${LANGUAGE_PARAM}=${encodeURIComponent(code)}`);\n return kept.length ? `?${kept.join('&')}` : '';\n}\n\nexport interface SharedHostLanguage {\n /** A language to remember in the `s-lang` cookie, or null to leave the cookie alone. */\n cookie: string | null;\n /** Where to send the visitor (path, query and hash, in the address the browser uses), or null to render. */\n redirectTo: string | null;\n}\n\n/**\n * What to do with the language of a page on a shared host, once the store's settings are in.\n *\n * - `?lang=` asking for a language the store offers is remembered in the cookie. It is taken\n * off the URL with a redirect when that cannot change what the next request renders: the\n * cookie already says it, or it is the fallback a cookieless request gets anyway. Otherwise\n * it stays, so a visitor whose browser drops the cookie is not sent round in circles.\n * - `?lang=` asking for one the store does not offer is dropped, and nothing is remembered.\n * - No `?lang=`, and the language the request resolved to is not offered (a stale cookie\n * from another store on this host, or the fallback of a store that does not offer it):\n * sent to `?lang=<the store's default>`.\n *\n * Every redirect either removes `?lang=` or adds one for an offered language, so none\n * returns the request to itself.\n *\n * @param href - the browser's address for this page: path (with the store segment, without\n * a language), query and hash.\n * @param locale - the language the request resolved to ({@link virtualLocale}).\n */\nexport function decideSharedHostLanguage(args: {\n settings: StoreContext;\n locale: string;\n href: string;\n cookieHeader: string | null;\n}): SharedHostLanguage {\n const { settings, locale, href, cookieHeader } = args;\n const offered = offeredLanguages(settings);\n const url = new URL(href, 'http://shared-host.invalid');\n const withSearch = (search: string) => `${url.pathname}${search}${url.hash}`;\n\n const asked = langParam(url.search);\n if (asked !== null) {\n const wanted = knownLocale(asked);\n if (!wanted || (offered && !offered.includes(wanted))) {\n return { cookie: null, redirectTo: withSearch(withLanguageParam(url.search)) };\n }\n const remembered = languageFromCookies(cookieHeader);\n const clean = remembered === wanted || wanted === FALLBACK_LOCALE;\n return {\n cookie: remembered === wanted ? null : wanted,\n redirectTo: clean ? withSearch(withLanguageParam(url.search)) : null,\n };\n }\n\n if (offered && !offered.includes(locale)) {\n const fallback = defaultLanguage(settings) as string;\n return { cookie: null, redirectTo: withSearch(withLanguageParam(url.search, fallback)) };\n }\n return { cookie: null, redirectTo: null };\n}\n","/**\n * @fileoverview Paths on a host where the store is part of every address.\n *\n * On `preview.salla.design` and a dev server a store is addressed by the first\n * segment of the path — `/mtgr-alaatr-2/cart` — and that segment is the root of\n * the application. No route knows about it: the router takes it off every URL on\n * the way in and puts it back on every URL on the way out\n * (`tanstack/store-base.ts`), so pages, links and loaders all see `/cart`.\n *\n * On a Salla shared host (`demostore.salla.sa`, `salla.sa`) the store is the\n * root too — `/dev-x/cart`, with no language in the address — and the storefront\n * dispatcher names it (`resolveAddressedStore`). The old shape, `/ar/dev-x/cart`,\n * is still read, and redirected once by `twilightMiddleware`. The same two\n * functions move the segment, told which host it is.\n *\n * Which segment it is, and on which hosts, is decided once, in `utils/cookies.ts`.\n * This file only moves it on and off a path. See `docs/store-base-path.md`.\n */\nimport { allowsRequestStoreId, isStoreBaseSegment, STORE_ID_PARAM } from './cookies';\nimport { isLocale } from '../providers/locale-constants';\nimport { withLanguageParam } from './shared-host-language';\n\n/**\n * An application pathname, without the store segment in front.\n *\n * Only a whole segment is removed, so `/mtgr-alaatr-2x/cart` is left alone, and a\n * pathname that does not start with the segment comes back unchanged.\n *\n * With `followsLocale` the segment is also taken from behind a leading locale,\n * where Salla's shared hosts used to put it (`/ar/dev-x/cart` → `/ar/cart`). It is\n * looked for there first, then at the root, which is where it is now\n * (`/dev-x/cart`).\n */\nexport function stripStoreBase(pathname: string, base: string, followsLocale = false): string {\n if (followsLocale) {\n const segments = pathname.split('/');\n if (isLocale(segments[1]) && segments[2] === base) {\n segments.splice(2, 1);\n return segments.join('/');\n }\n }\n\n const prefix = `/${base}`;\n if (pathname === prefix) return '/';\n return pathname.startsWith(`${prefix}/`) ? pathname.slice(prefix.length) : pathname;\n}\n\n/**\n * A rooted path split into its first segment and what follows it (a path, a query, a hash, or\n * nothing). The segment ends at the first `/`, `?` or `#`. Plain string work, no pattern.\n */\nexport function splitLeadingSegment(rooted: string): { first: string; rest: string } {\n if (!rooted.startsWith('/')) return { first: '', rest: '' };\n let end = 1;\n while (end < rooted.length && rooted[end] !== '/' && rooted[end] !== '?' && rooted[end] !== '#') {\n end += 1;\n }\n return { first: rooted.slice(1, end), rest: rooted.slice(end) };\n}\n\n/**\n * An application path as the browser addresses it, with the store segment in front.\n *\n * It never checks whether the segment is already there, because that cannot be\n * told apart from a page of the same name: a store called `cart` keeps its cart at\n * `/cart/cart`. Callers pass application paths only.\n *\n * With `followsLocale` (a Salla shared host) the address has no language in it at\n * all: a leading locale is dropped (`/ar/cart` → `/dev-x/cart`). The language comes\n * back from `?lang=` or the `s-lang` cookie on the way in (`tanstack/store-base.ts`).\n */\nexport function prefixStoreBase(path: string, base: string, followsLocale = false): string {\n let rooted = path.startsWith('/') ? path : `/${path}`;\n\n if (followsLocale) {\n const { first, rest } = splitLeadingSegment(rooted);\n // What follows the locale is a path (`/cart`), a query or a hash, or nothing: the root.\n if (isLocale(first)) rooted = rest.startsWith('/') ? rest : `/${rest}`;\n }\n\n // The store's root is `/<base>`, not `/<base>/`, with or without a query or hash.\n const atRoot = rooted === '/' || rooted[1] === '?' || rooted[1] === '#';\n return `/${base}${atRoot ? rooted.slice(1) : rooted}`;\n}\n\n/**\n * Where to send a request that still uses the old shared-host address, or null when it\n * does not.\n *\n * Shared hosts used to put the language in front of the store (`/ar/dev-x/cart`) and now\n * leave it out (`/dev-x/cart`). A link in the old shape is sent once to the new one,\n * carrying its language as `?lang=` so the visitor keeps it; the page then remembers it\n * and the language stays out of the address (`rootBeforeLoad`).\n *\n * Only a path that *starts* with a locale and then names this store as a whole segment\n * matches, so a page whose slug is a locale code, or that is spelled like the store, is\n * never redirected. The result is a relative path: it cannot leave the host.\n */\nexport function legacyLocaleRedirectHref(url: string, base: string): string | null {\n let parsed: URL;\n try {\n parsed = new URL(url);\n } catch {\n return null;\n }\n\n const segments = parsed.pathname.split('/');\n if (!isLocale(segments[1]) || segments[2] !== base) return null;\n\n const pathname = ['', base, ...segments.slice(3)].join('/');\n // An explicit `?lang=` outranks the old path's language, as it did when it was rewritten\n // into the path.\n const search = parsed.searchParams.has('lang')\n ? parsed.search\n : withLanguageParam(parsed.search, segments[1]);\n return `${pathname}${search}`;\n}\n\n/**\n * A pathname from a link the Salla API handed out, without the store's username in it.\n *\n * A store with no domain of its own is served under its username on a shared host,\n * and every URL the API returns for it carries that segment. Its `store.url` is\n * `/{lang}/{username}/` when the store is multilingual and `/{username}/` when it is\n * not: `https://demostore.salla.sa/ar/dev-vgckq3fssfhjewwi/`, `https://salla.sa/cart/`.\n * The segment there belongs to Salla's host, not to the application. Left in, it\n * lands where a page slug is expected and matches no route.\n *\n * The username is the last segment of `store.url`, but only when it equals the\n * store's username. Neither its position nor its spelling says so on its own: `/ar/`\n * is the locale of `https://3tir.com/ar/`, a store on its own domain whose links carry\n * no username, and it is also the whole address of the store called `ar`,\n * `https://salla.sa/ar/`. Without a username to compare against, a last segment\n * spelled like a locale is taken to be one, which is wrong only for a store whose\n * username is a locale code.\n *\n * The locale stays wherever the link put it.\n */\nexport function withoutStoreUrlBase(\n pathname: string,\n storeUrlPathname: string,\n username?: string | null\n): string {\n const own = storeUrlSegment(storeUrlPathname, username);\n if (!own) return pathname;\n\n const segments = pathname.split('/');\n // Salla puts the locale first (`/ar/dev-x/…`); a store that is not multilingual has\n // none (`/dev-x/…`). Checked in that order, `/ar/ar/…` for a store called `ar` keeps\n // its locale.\n let at = -1;\n if (isLocale(segments[1]) && segments[2] === own) at = 2;\n else if (segments[1] === own) at = 1;\n if (at === -1) return pathname;\n\n segments.splice(at, 1);\n return segments.join('/') || '/';\n}\n\n/**\n * Whether a pathname on the store's host is this store's.\n *\n * On a shared host the origin belongs to every store there, and a link names its store\n * by the username in its path, where {@link withoutStoreUrlBase} looks for it. One\n * without it is another store's page, or the host's own. A store on its own domain has\n * no such segment, and every path on its host is its own.\n */\nexport function hasStoreUrlBase(\n pathname: string,\n storeUrlPathname: string,\n username?: string | null\n): boolean {\n const own = storeUrlSegment(storeUrlPathname, username);\n if (!own) return true;\n\n const segments = pathname.split('/');\n return segments[1] === own || (isLocale(segments[1]) && segments[2] === own);\n}\n\n/** The segment `store.url` serves the store under, or null when it has none. */\nfunction storeUrlSegment(storeUrlPathname: string, username?: string | null): string | null {\n const last = storeUrlPathname.split('/').filter(Boolean).pop();\n if (!last) return null;\n if (username) return last === username ? last : null;\n return isLocale(last) ? null : last;\n}\n\n/**\n * Where to send a page whose store was not named by its own first segment, or null\n * when it already was.\n *\n * On a host where the store is the root, every page has one address,\n * `/<username>/…`. A request that found its store some other way (`?storeId=`, the\n * preview cookie, `VITE_STORE_DOMAIN`, or a first segment that named the store by\n * another spelling, such as its numeric id) is sent there once the store's settings\n * say what its username is.\n *\n * `storeId` is dropped from the query on the way. It has to be: a URL carrying it\n * is never read for a store segment, so keeping it would redirect to an address\n * that redirects again, forever. For the same reason a username that could not be\n * read back out of a path produces no redirect at all.\n *\n * `href` is the application's own href (path, query and hash, already without any\n * store segment), which the router keeps percent-encoded, so the result is safe to\n * put in a `Location` header.\n */\nexport function storeBaseRedirectHref(args: {\n host: string | null | undefined;\n base: string | null;\n username: string | null | undefined;\n href: string;\n}): string | null {\n const { host, base, username, href } = args;\n if (!allowsRequestStoreId(host) || !isStoreBaseSegment(username) || username === base) {\n return null;\n }\n\n const url = new URL(href, 'http://store-base.invalid');\n url.searchParams.delete(STORE_ID_PARAM);\n return `${prefixStoreBase(url.pathname, username)}${url.search}${url.hash}`;\n}\n\n/**\n * Where to send a guest who opened a customer-only page: the locale's home with\n * `intended_to`, which the SDK reads to open the login modal and come back after.\n * Null when already there, so the redirect cannot loop.\n */\nexport function loginRedirectHref(args: {\n pathname: string;\n searchStr: string;\n origin: string;\n base: string | null;\n baseFollowsLocale?: boolean;\n}): string | null {\n const { pathname, searchStr, origin, base, baseFollowsLocale = false } = args;\n const first = pathname.split('/')[1];\n const home = isLocale(first) ? `/${first}` : '/';\n if ((pathname.replace(/\\/$/, '') || '/') === home) return null;\n\n const browserPath = (path: string) =>\n base ? prefixStoreBase(path, base, baseFollowsLocale) : path;\n const intended = `${origin}${browserPath(pathname)}${searchStr}`;\n return `${browserPath(home)}?intended_to=${encodeURIComponent(intended)}`;\n}\n","/**\n * @fileoverview Which store to ask about — the one answer, in one place.\n *\n * This lived in two places once. `api/store.ts` learned to read the store a\n * request names, and `utils/sdk-helpers.ts` — the copy `api/client.ts` actually\n * sets the `store-identifier` header from — did not. So the resolver that had\n * been taught the answer was consulted for a null check and thrown away, every\n * outgoing request carried an empty identifier, the API answered\n * `422 Store Identifier not found`, and every published theme rendered\n * \"Store Unavailable\" while its tests passed: the client's suite mocked the\n * resolver, and the resolver's suite never went near a request.\n *\n * Hence one module, imported by both. If a third place ever needs a store\n * identifier, it imports this — a second implementation is the bug, not a\n * refactor away from it.\n *\n * See `docs/store-identity.md` for the full picture, including the security\n * boundary on who may name a store.\n */\nimport { getRequestStore } from '../twilight/context';\nimport { hostIdentifiesStore, resolveRequestStoreBase } from './cookies';\nimport { getInjectedRuntimeEnv, readEnv } from './runtime-env';\nimport { storeBaseRedirectHref } from './store-base';\n\n/**\n * Which store to ask about, in the order the answers can be trusted.\n *\n * A deployed theme worker is published with **no vars and no bindings** — the\n * script metadata carries `main_module`, compatibility settings, assets and tags\n * and nothing else — so `VITE_STORE_DOMAIN` exists only where a build baked it\n * in, which is local development. In production this function used to reach the\n * end of that chain and return the empty string, `store.settings` refused to\n * call with no identifier, and the root loader threw \"Store Unavailable\" — a\n * theme that renders its own failure page for every visitor of every store.\n *\n * The order:\n *\n * 1. what the caller passed, which is always deliberate;\n * 2. the store this request names — the `?storeId=` a preview was opened with,\n * then the cookie remembering it — seeded by `twilightMiddleware`, and only\n * on a host permitted to name one;\n * 3. the store the first segment of the path names, on those same hosts — its\n * username, which the API accepts as an identifier as readily as an id (see\n * {@link resolveStoreBase});\n * 4. what SSR already resolved and published, so the hydrated client asks about\n * the same store the server rendered instead of resolving again from a URL\n * that no longer names it;\n * 5. the request's own host, which *is* the identity of a live storefront —\n * but only when that host is a storefront. `preview.salla.design` and\n * `localhost` serve many stores, so their names identify none;\n * 6. `VITE_STORE_DOMAIN`, last, because a build-time constant is a development\n * convenience and must never outrank what the request actually said.\n *\n * Steps 2 and 3 never both answer: a path that names a store takes the place of\n * the cookie, and a URL carrying `?storeId=` is not read for a path segment.\n */\nexport function resolveStoreIdentifier(explicit?: string): string {\n if (explicit) return explicit;\n\n const { storeId, requestHost } = getRequestStore();\n if (storeId) return storeId;\n\n const storeBase = resolveStoreBase();\n if (storeBase) return storeBase;\n\n const injected = getInjectedRuntimeEnv().storeIdentifier;\n if (injected) return injected;\n\n if (hostIdentifiesStore(requestHost)) return requestHost as string;\n\n // The browser's own address, for a client render that reached neither of the\n // above — a live storefront, where the host is the store.\n const browserHost = typeof window !== 'undefined' ? window.location.host : null;\n if (hostIdentifiesStore(browserHost)) return browserHost as string;\n\n return readEnv('VITE_STORE_DOMAIN') || readEnv('STORE_DOMAIN') || '';\n}\n\n/**\n * The store segment at the root of this page's paths, or null when the store is\n * not addressed that way.\n *\n * On the server it is what `twilightMiddleware` read off the request. In the\n * browser it is what SSR published, because the address bar is not always the\n * URL the server rendered: on the preview host the dispatcher removes\n * `?storeId=` from the request it forwards and leaves it in the browser's, and a\n * URL carrying `storeId` is never read for a segment. Re-reading\n * `window.location` would, for `/ar?storeId=…`, route the page under a different\n * store than the one it was rendered for.\n *\n * The address bar is read only when SSR published nothing at all: a page the dev\n * server answered with its client shell instead of a render, where there is no\n * server decision to agree with.\n */\nexport function resolveStoreBase(): string | null {\n const { storeBase } = getRequestStore();\n if (storeBase) return storeBase;\n if (typeof window === 'undefined') return null;\n\n const published = getInjectedRuntimeEnv();\n if (published.storeBase) return published.storeBase;\n if (Object.keys(published).length > 0) return null;\n\n return resolveRequestStoreBase(window.location.href, window.location.host);\n}\n\n/**\n * Whether {@link resolveStoreBase}'s segment sits behind the locale\n * (`/ar/dev-x/cart`) rather than at the root of the path.\n *\n * True only on a Salla shared host, where the dispatcher named the store. Read\n * from the same place as the segment, so the two always describe one address: the\n * request on the server, what SSR published in the browser.\n */\nexport function resolveStoreBaseFollowsLocale(): boolean {\n const { storeBase, storeBaseFollowsLocale } = getRequestStore();\n if (storeBase) return storeBaseFollowsLocale;\n if (typeof window === 'undefined') return false;\n\n const published = getInjectedRuntimeEnv();\n return Boolean(published.storeBase && published.storeBaseFollowsLocale);\n}\n\n/**\n * The address this page should be loaded from instead, when the store is the root\n * of every URL on this host and this request did not use it; null otherwise.\n *\n * @param username - the store's username, from the settings the request loaded\n * @param href - the router's own href for the page, without any store segment\n *\n * See `storeBaseRedirectHref` for the rules. The host is the request's on the\n * server and the browser's own in the browser, so the decision is gated the same\n * way on both sides.\n */\nexport function resolveStoreBaseRedirect(\n username: string | null | undefined,\n href: string\n): string | null {\n const host =\n getRequestStore().requestHost ?? (typeof window !== 'undefined' ? window.location.host : null);\n return storeBaseRedirectHref({ host, base: resolveStoreBase(), username, href });\n}\n"]}
|
|
@@ -47,9 +47,11 @@ function composeMessages(common, overrides, locale) {
|
|
|
47
47
|
|
|
48
48
|
// src/utils/errors.ts
|
|
49
49
|
var SettingsError = class extends Error {
|
|
50
|
-
constructor(message) {
|
|
50
|
+
constructor(message, details) {
|
|
51
51
|
super(message ?? "Store settings could not be loaded.");
|
|
52
52
|
this.name = "SettingsError";
|
|
53
|
+
this.reason = details?.reason;
|
|
54
|
+
this.status = details?.status;
|
|
53
55
|
}
|
|
54
56
|
};
|
|
55
57
|
function createI18nInstance(locale, translations, themeTranslations) {
|
|
@@ -306,5 +308,5 @@ function getTwilightContext() {
|
|
|
306
308
|
}
|
|
307
309
|
|
|
308
310
|
export { SettingsError, composeMessages, createI18nInstance, getRequestStore, getTwilightContext, hasTwilightSettings, isPlainObject, messagesForLocale, runWithTwilightContext, storeTranslationsQueryKey, subscribeTwilight, translationsQueryKey, updateTwilightContext };
|
|
309
|
-
//# sourceMappingURL=chunk-
|
|
310
|
-
//# sourceMappingURL=chunk-
|
|
311
|
+
//# sourceMappingURL=chunk-QRHXAKJ3.js.map
|
|
312
|
+
//# sourceMappingURL=chunk-QRHXAKJ3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/api/translations-key.ts","../src/api/messages.ts","../src/utils/errors.ts","../src/providers/i18n-factory.ts","../src/twilight/context.ts"],"names":[],"mappings":";;;;;;AAwBO,SAAS,qBAAqB,MAAA,EAAkC;AACrE,EAAA,OAAO,CAAC,gBAAgB,MAAM,CAAA;AAChC;AAkBO,SAAS,yBAAA,CACd,SACA,MAAA,EAC0B;AAC1B,EAAA,OAAO,CAAC,cAAA,EAAgB,MAAA,CAAO,OAAO,GAAG,MAAM,CAAA;AACjD;;;ACrBO,SAAS,cAAc,KAAA,EAAmC;AAC/D,EAAA,OAAO,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA;AAC5E;AAgBO,SAAS,aAAA,CAAc,MAAgB,SAAA,EAA+B;AAC3E,EAAA,MAAM,MAAA,GAAmB,EAAE,GAAG,IAAA,EAAK;AAEnC,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,SAAS,CAAA,EAAG;AACpD,IAAA,MAAM,QAAA,GAAW,OAAO,GAAG,CAAA;AAC3B,IAAA,MAAA,CAAO,GAAG,CAAA,GACR,aAAA,CAAc,QAAQ,CAAA,IAAK,aAAA,CAAc,KAAK,CAAA,GAAI,aAAA,CAAc,QAAA,EAAU,KAAK,CAAA,GAAI,KAAA;AAAA,EACvF;AAEA,EAAA,OAAO,MAAA;AACT;AAcA,SAAS,eAAA,CAAgB,a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,MAAA,OAAO,IAAA,CAAK,IAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,GAAA,GAAM;AACR,MAAA,OAAO,eAAA,CAAgB,IAAA,CAAK,MAAM,CAAA,CAAE,GAAA;AAAA,IACtC,CAAA;AAAA,IACA,IAAI,IAAA,GAAO;AACT,MAAA,OAAO,IAAA,CAAK,IAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,YAAA,GAAe;AACjB,MAAA,OAAO,IAAA,CAAK,YAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,YAAA,GAAe;AACjB,MAAA,OAAO,IAAA,CAAK,YAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,WAAA,GAAc;AAChB,MAAA,OAAO,IAAA,CAAK,WAAA;AAAA,IACd,CAAA;AAAA,IACA,IAAI,MAAA,GAAS;AACX,MAAA,OAAO,IAAA,CAAK,MAAA;AAAA,IACd;AAAA,GACF;AACF","file":"chunk-QRHXAKJ3.js","sourcesContent":["/**\n * @fileoverview The translations query key, on its own, importing nothing.\n *\n * Three places read the cached translations — `rootBeforeLoad`, the hydration\n * path in `tanstack/router.tsx`, and the lazy `i18n` accessor in\n * `twilight/context.ts` — and all three have to agree on the key or the\n * hydrated page misses the entry it was just handed and refetches. One\n * definition is the only way to keep that true.\n *\n * It lives here rather than in `api/translations.ts`, where it would naturally\n * sit, because **`twilight/context.ts` cannot afford that module's imports**.\n * `api/translations` pulls in `api/client`, which pulls in `ky`; `context.ts`\n * is imported directly by tests that mock `ky`, and adding that edge made six\n * of them stop being mocked and start issuing real requests to `api.salla.dev`\n * (`tests/routes/rootBeforeLoad.test.ts`, bisected to exactly this import). A\n * leaf module with no imports of its own cannot do that to anyone.\n */\n\n/**\n * @param locale is part of the key because each file on the CDN holds one\n * language. The global file this replaced carried every language and was\n * sliced after the cache, so a key without the locale was correct then and is\n * a wrong-language bug now: `/ar` → `/en` would reuse the Arabic entry.\n */\nexport function translationsQueryKey(locale: string): [string, string] {\n return ['translations', locale];\n}\n\n/**\n * The merchant's own wording for one store and one language.\n *\n * Separate from {@link translationsQueryKey} rather than folded into it,\n * because the two files have different lifetimes and different audiences: the\n * platform's copy is the same object for every store on the CDN, and this one\n * is a single merchant's overrides. Keeping them apart means a store with no\n * overrides never invalidates, refetches or dehydrates anything on its account.\n *\n * @param storeId is `settings.store.id` — the Optimus-encoded numeric id, which\n * is what names the object. It is safe in a key even though the locale-only key\n * deliberately avoids naming a store: that warning is about a store *resolved\n * from the request*, which differs between server and client. This one is read\n * out of the settings payload, so both sides compute it from the same\n * dehydrated data and agree.\n */\nexport function storeTranslationsQueryKey(\n storeId: string | number,\n locale: string\n): [string, string, string] {\n return ['translations', String(storeId), locale];\n}\n","/**\n * @fileoverview Composing one language's messages out of the query cache.\n *\n * **There are three places that build an i18n instance**, and they have to\n * agree on more than the key: `rootBeforeLoad`, the hydration path in\n * `tanstack/router.tsx`, and the lazy `i18n` accessor in `twilight/context.ts`.\n * When the platform's copy was the only source, agreeing on\n * `translationsQueryKey` was enough. It is not any more — a merchant's own\n * wording is a second cache entry, and a reader that knows about one and not\n * the other renders different text from the page beside it.\n *\n * That is exactly what shipped in #366: the server rendered the merchant's\n * words and hydration replaced them with the platform's, because only\n * `rootBeforeLoad` had been taught to merge. Greptile caught it. This module is\n * the single answer to \"what are the messages for this locale\", so the next\n * source cannot be added to one reader and forgotten in two.\n *\n * It lives beside `translations-key.ts` and imports nothing at runtime for the\n * same reason that file does: `twilight/context.ts` cannot afford\n * `api/translations`, which pulls in `api/client` and therefore `ky`, and tests\n * that mock `ky` stop being mocked the moment that edge exists.\n */\nimport type { QueryClient } from '@tanstack/react-query';\nimport { translationsQueryKey } from './translations-key';\nimport type { TranslationMessages } from '../providers/I18nProvider';\n\nexport type Messages = Record<string, unknown>;\n\nexport function isPlainObject(value: unknown): value is Messages {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * `overrides` laid over `base`, one leaf at a time.\n *\n * Recursive rather than a spread, because both files are nested by group\n * (`common.errors.500`) and a top-level spread would make a merchant who\n * overrode one string inside `common` lose every other string in it. The\n * merchant's value wins at the leaf, and a group they never touched is left\n * exactly as the platform sent it.\n *\n * A type conflict — one side an object where the other is a string — resolves\n * to the merchant's value. It is the more specific of the two and there is no\n * sensible way to merge a string into a group; the alternative, keeping the\n * platform's, would mean a merchant's edit silently doing nothing.\n */\nexport function mergeMessages(base: Messages, overrides: Messages): Messages {\n const merged: Messages = { ...base };\n\n for (const [key, value] of Object.entries(overrides)) {\n const existing = merged[key];\n merged[key] =\n isPlainObject(existing) && isPlainObject(value) ? mergeMessages(existing, value) : value;\n }\n\n return merged;\n}\n\n/**\n * This store's overrides for `locale`, if any were fetched into the cache.\n *\n * Found by **shape** rather than by asking the settings for a store id, and\n * that is deliberate: the two readers that were missing the merge have a\n * `queryClient` and a locale between them and nothing else, and reaching for\n * `api/store` from `twilight/context.ts` would drag `ky` in through the back\n * door. One document serves one store — a request naming a different one is\n * redirected with `reloadDocument` — so at most one such entry per locale\n * exists, and matching `['translations', <anything>, <locale>]` cannot pick up\n * somebody else's.\n */\nfunction cachedOverrides(queryClient: QueryClient, locale: string): Messages | undefined {\n const entries = queryClient.getQueriesData<Messages>({ queryKey: ['translations'] });\n\n for (const [key, data] of entries) {\n if (key.length === 3 && key[2] === locale && isPlainObject(data)) {\n return data;\n }\n }\n\n return undefined;\n}\n\n/**\n * The messages for `locale`: the platform's copy with this merchant's over it.\n *\n * Reads only — whoever wants the merchant's file in the cache has to have put\n * it there, which `rootBeforeLoad` does and only when the settings say there is\n * one. A reader that runs without it simply gets the platform's copy, which is\n * the same thing it got before any of this existed.\n */\nexport function messagesForLocale(\n queryClient: QueryClient | undefined,\n locale: string\n): TranslationMessages | undefined {\n const common = queryClient?.getQueryData<TranslationMessages>(translationsQueryKey(locale));\n const overrides = queryClient ? cachedOverrides(queryClient, locale) : undefined;\n\n return composeMessages(common, overrides, locale);\n}\n\n/**\n * The same composition from values rather than from the cache.\n *\n * `rootBeforeLoad` has both in hand already — it just awaited them — so it\n * composes directly instead of reading back what it put in.\n */\nexport function composeMessages(\n common: TranslationMessages | null | undefined,\n overrides: Messages | null | undefined,\n locale: string\n): TranslationMessages | undefined {\n if (!overrides || Object.keys(overrides).length === 0) return common ?? undefined;\n\n const base = common?.[`${locale}.trans`];\n\n return {\n [`${locale}.trans`]: mergeMessages(isPlainObject(base) ? base : {}, overrides) as Record<\n string,\n string\n >,\n };\n}\n","/**\n * Why a store's settings did not load:\n * - `no-store`: nothing named a store for this request;\n * - `timeout`: the Salla API did not answer in time;\n * - `http`: it answered with an error status;\n * - `network`: no answer arrived at all;\n * - `empty`: it answered without settings.\n */\nexport type SettingsErrorReason = 'no-store' | 'timeout' | 'http' | 'network' | 'empty';\n\nexport interface SettingsErrorDetails {\n reason?: SettingsErrorReason;\n /** The API's status, when `reason` is `'http'`. */\n status?: number;\n}\n\nexport class SettingsError extends Error {\n /** Absent when nothing said why, e.g. `getTwilightContext().settings` read before they loaded. */\n readonly reason?: SettingsErrorReason;\n readonly status?: number;\n\n constructor(message?: string, details?: SettingsErrorDetails) {\n super(message ?? 'Store settings could not be loaded.');\n this.name = 'SettingsError';\n this.reason = details?.reason;\n this.status = details?.status;\n }\n}\n","import { createInstance, type i18n as I18nInstance } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nexport type TranslationMessages = Record<string, Record<string, string>>;\n\n/**\n * Creates a new i18next instance for the given locale.\n *\n * @param locale - Active locale code, e.g. `'ar'`\n * @param translations - App translations from the Salla API (store-specific)\n * @param themeTranslations - Bundled theme translations (static defaults)\n */\nexport function createI18nInstance(\n locale: string,\n translations?: TranslationMessages,\n themeTranslations?: TranslationMessages\n): I18nInstance {\n const instance = createInstance();\n const transKey = `${locale}.trans`;\n\n instance.use(initReactI18next).init({\n lng: locale,\n fallbackLng: locale,\n ns: ['app', 'theme'],\n defaultNS: 'app',\n fallbackNS: 'theme',\n resources: {\n [locale]: {\n app: translations?.[transKey] ?? {},\n theme: themeTranslations?.[transKey] ?? {},\n },\n },\n interpolation: { escapeValue: false },\n react: { useSuspense: false },\n keySeparator: '.',\n nsSeparator: false,\n });\n\n return instance;\n}\n\n/**\n * Creates i18n instance for testing\n * @param locale - Locale code (default: 'ar')\n * @param translations - Optional translations\n */\nexport function createTestI18n(locale = 'ar', translations?: TranslationMessages): I18nInstance {\n return createI18nInstance(locale, translations);\n}\n","import type { QueryClient } from '@tanstack/react-query';\nimport type { i18n } from 'i18next';\nimport type { StoreContext } from '../api/store';\nimport type { AppSnippet, AppSettings } from '../api/apps';\nimport { FALLBACK_LOCALE, getLanguageInfo } from '../providers/locale-constants';\nimport { createI18nInstance } from '../providers/i18n-factory';\nimport { messagesForLocale } from '../api/messages';\nimport { SettingsError } from '../utils/errors';\nimport type { ActiveScope } from '../utils/cookies';\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface TwilightLocation<TSearch = Record<string, unknown>> {\n href: string;\n pathname: string;\n search: TSearch;\n searchStr: string;\n state: Record<string, unknown>;\n hash: string;\n}\n\nexport interface PageContext {\n slug: string;\n id?: string | number;\n title: string;\n url?: string;\n parent?: { id: string | number; name: string; url: string } | null;\n breadcrumbs?: { name: string; url: string }[];\n}\n\nexport interface TwilightContext {\n queryClient: QueryClient;\n settings: StoreContext;\n locale: string;\n routeId: string;\n location: TwilightLocation;\n authToken: string | null;\n /**\n * The selected market and, once bullet delivery confirmed one, its branch\n * allocation — the full object the SDK sends as `s-scope-*` headers. Seeded from\n * the `scope` cookie on the server; see {@link ActiveScope}.\n */\n scope: ActiveScope | null;\n /** `scope.id`, kept for callers that only need the market. */\n scopeId: string | null;\n /**\n * Which store this request is for, when something other than the hostname says\n * so — the `?storeId=` a preview was opened with, or the cookie remembering it.\n *\n * Null on a live storefront, where the hostname is the answer and there is\n * nothing to carry. See {@link resolveRequestStoreId}.\n */\n storeId: string | null;\n /**\n * Which store the first segment of this request's path named, on a host where\n * the store is the root of every URL: `mtgr-alaatr-2` for\n * `https://preview.salla.design/mtgr-alaatr-2/cart`.\n *\n * Null whenever something else named the store, and on every merchant domain.\n * See {@link resolveRequestStoreBase}.\n */\n storeBase: string | null;\n /**\n * Where {@link storeBase} sits in this request's paths: behind the locale on a\n * Salla shared host (`/ar/dev-x/cart`, named by the dispatcher), in front of it\n * everywhere else. See {@link resolveAddressedStore}.\n */\n storeBaseFollowsLocale: boolean;\n /**\n * Which version of the theme's settings this request asked for — the\n * `?versionId=` an editor preview or a local dev session was opened with, or\n * the cookie remembering it.\n *\n * Null on an ordinary storefront visit, which is the common case: nothing\n * named a version, so the store's live one is what the API answers with. See\n * {@link resolveRequestVersionId}.\n */\n versionId: string | null;\n /**\n * The host this request arrived on, captured server-side.\n *\n * A theme worker is deployed with no vars and no bindings, so the request is\n * the only thing that knows which storefront it is serving. On the client this\n * is `window.location.host`; on the server nothing else has it.\n */\n requestHost: string | null;\n /** The native app's `s-app-*` headers when the request came from its webview; see {@link readNativeAppHeaders}. */\n nativeAppHeaders: Record<string, string> | null;\n i18n: i18n;\n dir: 'ltr' | 'rtl';\n page?: PageContext;\n /** Installed apps' snippets, fetched in rootBeforeLoad so AppsSnippets can render CDN\n * <script> tags during SSR (React Query isn't dehydrated here, so useQuery has no SSR data). */\n appsSnippets?: AppSnippet[];\n /** Per-app public `app.*` buckets, fetched in rootBeforeLoad so rootHead can install the\n * `Salla.appScope` factory inline at parse time — ahead of the snippets' onReady callbacks. */\n appsSettings?: AppSettings;\n /**\n * This visitor sees the maintenance page, not the store. Decided in rootBeforeLoad\n * from `settings.maintenance` and the merchant's owner view; see `utils/maintenance`.\n */\n maintenance: boolean;\n extras?: Record<string, unknown>;\n}\n\n// ============================================================================\n// Internal Store\n// ============================================================================\n\nconst DEFAULT_LOCATION: TwilightLocation = {\n href: '',\n pathname: '',\n search: {},\n searchStr: '',\n state: {},\n hash: '',\n};\n\ninterface ContextData {\n queryClient: QueryClient;\n settings: StoreContext | null;\n locale: string;\n routeId: string;\n location: TwilightLocation;\n authToken: string | null;\n scope: ActiveScope | null;\n storeId: string | null;\n storeBase: string | null;\n storeBaseFollowsLocale: boolean;\n versionId: string | null;\n requestHost: string | null;\n nativeAppHeaders: Record<string, string> | null;\n i18n?: i18n;\n page?: PageContext;\n appsSnippets?: AppSnippet[];\n appsSettings?: AppSettings;\n maintenance: boolean;\n extras?: Record<string, unknown>;\n}\n\nconst DEFAULT_DATA: ContextData = {\n queryClient: null as unknown as QueryClient,\n settings: null,\n locale: FALLBACK_LOCALE,\n routeId: '',\n location: { ...DEFAULT_LOCATION },\n authToken: null,\n scope: null,\n storeId: null,\n storeBase: null,\n storeBaseFollowsLocale: false,\n versionId: null,\n requestHost: null,\n nativeAppHeaders: null,\n i18n: undefined,\n page: undefined,\n maintenance: false,\n};\n\n// ============================================================================\n// Storage: AsyncLocalStorage (server) or module-level store (client)\n// ============================================================================\n\ntype AsyncLocalStore<T> = { getStore(): T | undefined; run(val: T, fn: () => unknown): unknown };\n\n// Initialize ALS at module load time for SSR — no race condition\ntype AsyncHooks = { AsyncLocalStorage: new <T>() => AsyncLocalStore<T> };\n\n// workerd has no global `require`, so a bundled `require()` throws there; it does have\n// `process.getBuiltinModule` (so does Node >= 20.16), which keeps this out of the browser bundle.\nfunction loadAsyncHooks(): AsyncHooks | null {\n const proc = (globalThis as { process?: { getBuiltinModule?: (id: string) => unknown } }).process;\n try {\n const builtin = proc?.getBuiltinModule?.('node:async_hooks') as AsyncHooks | undefined;\n if (builtin?.AsyncLocalStorage) return builtin;\n } catch {\n /* fall through to require */\n }\n try {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require('node:async_hooks') as AsyncHooks;\n } catch {\n return null;\n }\n}\n\nconst isServer = typeof window === 'undefined';\n// One instance per isolate, so a re-evaluated or duplicated copy of this module (dev\n// reloads, src next to dist) reads the scope the request middleware opened.\nconst ALS_KEY = Symbol.for('salla.twilight.context.als');\nlet _als: AsyncLocalStore<ContextData> | null = null;\nif (isServer) {\n const registry = globalThis as { [ALS_KEY]?: AsyncLocalStore<ContextData> };\n const hooks = registry[ALS_KEY] ? null : loadAsyncHooks();\n if (hooks) registry[ALS_KEY] = new hooks.AsyncLocalStorage<ContextData>();\n _als = registry[ALS_KEY] ?? null;\n}\n\n// Without request isolation every request would share `clientStore`: one visitor's\n// auth token and store settings rendered into another's page.\nfunction assertRequestIsolation(): void {\n if (isServer && !_als) {\n throw new Error(\n '[Twilight] AsyncLocalStorage is unavailable; refusing to share request state.'\n );\n }\n}\n\n// The browser's store, shared by every copy of this module on the page like the ALS above,\n// so a loader in one copy reads the location and token the router wrote through another.\nconst CLIENT_KEY = Symbol.for('salla.twilight.context.client');\nconst clientRegistry = globalThis as {\n [CLIENT_KEY]?: { store: ContextData; listeners: Set<() => void> };\n};\nconst clientShared = (clientRegistry[CLIENT_KEY] ??= {\n store: { ...DEFAULT_DATA },\n listeners: new Set<() => void>(),\n});\nconst clientStore: ContextData = clientShared.store;\n\nfunction getTwilightStore(): ContextData {\n assertRequestIsolation();\n if (_als) {\n const store = _als.getStore();\n if (!store)\n throw new Error('[Twilight] No request context. Wrap with runWithTwilightContext().');\n return store;\n }\n return clientStore;\n}\n\nfunction writableStore(): ContextData {\n if (_als) {\n const store = _als.getStore();\n if (store) return store;\n }\n return clientStore;\n}\n\nfunction mergeIntoStore(store: ContextData, partial: Partial<TwilightContext>): void {\n if ('queryClient' in partial && partial.queryClient) store.queryClient = partial.queryClient;\n if ('settings' in partial && partial.settings != null) store.settings = partial.settings;\n if ('locale' in partial && partial.locale != null) store.locale = partial.locale;\n if ('routeId' in partial && partial.routeId != null) store.routeId = partial.routeId;\n if ('location' in partial && partial.location != null)\n store.location = { ...store.location, ...partial.location };\n if ('authToken' in partial && partial.authToken !== undefined)\n store.authToken = partial.authToken ?? null;\n if ('scope' in partial && partial.scope !== undefined) store.scope = partial.scope ?? null;\n else if ('scopeId' in partial && partial.scopeId !== undefined)\n store.scope = partial.scopeId == null ? null : { id: partial.scopeId };\n if ('storeId' in partial && partial.storeId !== undefined)\n store.storeId = partial.storeId ?? null;\n if ('storeBase' in partial && partial.storeBase !== undefined)\n store.storeBase = partial.storeBase ?? null;\n if ('storeBaseFollowsLocale' in partial && partial.storeBaseFollowsLocale !== undefined)\n store.storeBaseFollowsLocale = partial.storeBaseFollowsLocale === true;\n if ('versionId' in partial && partial.versionId !== undefined)\n store.versionId = partial.versionId ?? null;\n if ('requestHost' in partial && partial.requestHost !== undefined)\n store.requestHost = partial.requestHost ?? null;\n if ('nativeAppHeaders' in partial && partial.nativeAppHeaders !== undefined)\n store.nativeAppHeaders = partial.nativeAppHeaders ?? null;\n if ('i18n' in partial && partial.i18n != null) store.i18n = partial.i18n;\n if ('page' in partial) store.page = partial.page;\n if ('appsSnippets' in partial) store.appsSnippets = partial.appsSnippets;\n if ('appsSettings' in partial) store.appsSettings = partial.appsSettings;\n if ('maintenance' in partial) store.maintenance = partial.maintenance === true;\n if ('extras' in partial) store.extras = partial.extras;\n}\n\n// ============================================================================\n// Public API\n// ============================================================================\n\nexport function runWithTwilightContext<T>(partial: Partial<TwilightContext>, fn: () => T): T {\n assertRequestIsolation();\n if (_als) {\n const data: ContextData = { ...DEFAULT_DATA };\n mergeIntoStore(data, partial);\n return _als.run(data, fn) as T;\n }\n mergeIntoStore(clientStore, partial);\n return fn();\n}\n\n// Client-only subscription so React consumers (useRouteId/useIsHome/…) re-render\n// when navigation mutates the module store. Mirrors hooks/useWishlist.ts.\nconst listeners = clientShared.listeners;\n\nexport function subscribeTwilight(listener: () => void): () => void {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\nexport function updateTwilightContext(partial: Partial<TwilightContext>): void {\n mergeIntoStore(getTwilightStore(), partial);\n // Server uses AsyncLocalStorage and has no React subscribers; notify on client only.\n if (typeof window !== 'undefined') {\n for (const listener of listeners) listener();\n }\n}\n\n/**\n * Whether store settings are available, without throwing.\n *\n * `getTwilightContext().settings` throws a `SettingsError` when the store is\n * empty, which is fatal inside a head function during hydration. Callers that\n * need to *test* availability must use this instead of a try/catch around the\n * getter. Returns false when there is no request context at all (server-side\n * calls outside `runWithTwilightContext`).\n */\nexport function hasTwilightSettings(): boolean {\n try {\n return getTwilightStore().settings != null;\n } catch {\n return false;\n }\n}\n\n/** What a request addressed, as opposed to what it is. */\nexport interface RequestAddressing {\n storeId: string | null;\n storeBase: string | null;\n storeBaseFollowsLocale: boolean;\n versionId: string | null;\n requestHost: string | null;\n}\n\n/**\n * What this request named and the host it arrived on, without throwing.\n *\n * Separate from {@link getTwilightContext} because store identity is read while\n * deciding *what to fetch* — before there is a context worth having — and on the\n * server outside a request the getter throws. A caller asking \"which store?\" has\n * a sane answer for \"none named\"; it has none for an exception.\n *\n * The version rides along rather than getting an accessor of its own: it is read\n * at the same moment, for the same reason, and by the same callers, and a second\n * copy of this try/catch would be a second thing to remember to widen.\n */\nexport function getRequestStore(): RequestAddressing {\n try {\n const data = getTwilightStore();\n return {\n storeId: data.storeId,\n storeBase: data.storeBase,\n storeBaseFollowsLocale: data.storeBaseFollowsLocale,\n versionId: data.versionId,\n requestHost: data.requestHost,\n };\n } catch {\n return {\n storeId: null,\n storeBase: null,\n storeBaseFollowsLocale: false,\n versionId: null,\n requestHost: null,\n };\n }\n}\n\nexport function getTwilightContext(): TwilightContext {\n const data = getTwilightStore();\n return {\n get queryClient() {\n return data.queryClient;\n },\n get settings() {\n if (!data.settings) throw new SettingsError();\n return data.settings;\n },\n get locale() {\n return data.locale;\n },\n get routeId() {\n return data.routeId;\n },\n get location() {\n return data.location;\n },\n get authToken() {\n return data.authToken;\n },\n get scope() {\n return data.scope;\n },\n get scopeId() {\n return data.scope?.id ?? null;\n },\n get storeId() {\n return data.storeId;\n },\n get storeBase() {\n return data.storeBase;\n },\n get storeBaseFollowsLocale() {\n return data.storeBaseFollowsLocale;\n },\n get versionId() {\n return data.versionId;\n },\n get requestHost() {\n return data.requestHost;\n },\n get nativeAppHeaders() {\n return data.nativeAppHeaders;\n },\n get i18n() {\n if (!data.i18n) {\n // Composed the same way as `rootBeforeLoad` and the hydration path —\n // the platform's copy with this merchant's over it. See\n // `api/messages.ts`: this accessor reading one entry while the others\n // read two is precisely the drift that module exists to stop.\n data.i18n = createI18nInstance(\n data.locale,\n messagesForLocale(data.queryClient, data.locale)\n );\n }\n return data.i18n;\n },\n get dir() {\n return getLanguageInfo(data.locale).dir;\n },\n get page() {\n return data.page;\n },\n get appsSnippets() {\n return data.appsSnippets;\n },\n get appsSettings() {\n return data.appsSettings;\n },\n get maintenance() {\n return data.maintenance;\n },\n get extras() {\n return data.extras;\n },\n };\n}\n\n/** @internal Reset store for testing */\nexport function resetForTesting(): void {\n Object.assign(writableStore(), { ...DEFAULT_DATA });\n}\n"]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { HomeComponentRenderer, ReorderProducts } from './chunk-
|
|
2
|
-
import { home } from './chunk-
|
|
3
|
-
import { useDevHomeBlocks } from './chunk-
|
|
4
|
-
import { storePageUrl, buildHreflangAlternates } from './chunk-
|
|
1
|
+
import { HomeComponentRenderer, ReorderProducts } from './chunk-XU33IHQA.js';
|
|
2
|
+
import { home } from './chunk-E7AO2Q32.js';
|
|
3
|
+
import { useDevHomeBlocks } from './chunk-FMSRB2TT.js';
|
|
4
|
+
import { storePageUrl, buildHreflangAlternates } from './chunk-TMMK2VYE.js';
|
|
5
5
|
import { RouteId } from './chunk-OUW6WESU.js';
|
|
6
6
|
import { HookSlot } from './chunk-5XDPAKF5.js';
|
|
7
|
-
import { getTwilightContext } from './chunk-
|
|
7
|
+
import { getTwilightContext } from './chunk-QRHXAKJ3.js';
|
|
8
8
|
import { memo } from 'react';
|
|
9
9
|
import { Pulse } from '@salla.sa/twilight-components-react';
|
|
10
10
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
@@ -87,5 +87,5 @@ function head(ctx) {
|
|
|
87
87
|
var Home = { id: RouteId.INDEX, loader, head, Component: HomePage };
|
|
88
88
|
|
|
89
89
|
export { Home, HomeSkeleton, homeLoader };
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
90
|
+
//# sourceMappingURL=chunk-S67SB2O2.js.map
|
|
91
|
+
//# sourceMappingURL=chunk-S67SB2O2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/routes/home/loader.ts","../src/routes/home/HomePage.tsx","../src/routes/home/index.tsx"],"names":["HomeSkeleton","HomePage"],"mappings":";;;;;;;;;;;;AAWA,eAAsB,WAAW,GAAA,EAAoD;AACnF,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,kBAAA,EAAmB;AAC3C,EAAA,MAAM,aAAa,MAAM,WAAA,CAAY,gBAAgB,IAAA,CAAK,OAAA,CAAQ,YAAY,CAAA;AAC9E,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,MAAA,EAAQ,KAAK,MAAA,IAAU,IAAA;AAAA,IACvB,UAAA,EAAY,UAAA,CAAW,GAAA,CAAI,CAAC,IAAA,MAAU;AAAA,MACpC,GAAG,IAAA;AAAA,MACH,MAAM,IAAA,CAAK,IAAA,EAAM,QAAQ,OAAA,EAAS,EAAE,KAAK,IAAA,CAAK;AAAA,KAChD,CAAE,CAAA;AAAA,IACF,IAAA,EAAM,EAAE,IAAA,EAAM,OAAA,CAAQ,KAAA;AAAM,GAC9B;AACA,EAAA,OAAO,MAAA;AACT;AChBO,IAAM,YAAA,GAAe,IAAA,CAAK,SAASA,aAAAA,GAAe;AACvD,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,SAAI,SAAA,EAAU,uCAAA,EACb,8BAAC,KAAA,EAAA,EAAM,SAAA,EAAU,2BAA0B,CAAA,EAC7C,CAAA;AAAA,oBACA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,2CAAA,EACb,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,KAAA,EAAA,EAAM,WAAU,gBAAA,EAAiB,CAAA;AAAA,0BACjC,K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AAA","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/routes/home/loader.ts","../src/routes/home/HomePage.tsx","../src/routes/home/index.tsx"],"names":["HomeSkeleton","HomePage"],"mappings":";;;;;;;;;;;;AAWA,eAAsB,WAAW,GAAA,EAAoD;AACnF,EAAA,MAAM,EAAE,WAAA,EAAY,GAAI,kBAAA,EAAmB;AAC3C,EAAA,MAAM,aAAa,MAAM,WAAA,CAAY,gBAAgB,IAAA,CAAK,OAAA,CAAQ,YAAY,CAAA;AAC9E,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,MAAA,EAAQ,KAAK,MAAA,IAAU,IAAA;AAAA,IACvB,UAAA,EAAY,UAAA,CAAW,GAAA,CAAI,CAAC,IAAA,MAAU;AAAA,MACpC,GAAG,IAAA;AAAA,MACH,MAAM,IAAA,CAAK,IAAA,EAAM,QAAQ,OAAA,EAAS,EAAE,KAAK,IAAA,CAAK;AAAA,KAChD,CAAE,CAAA;AAAA,IACF,IAAA,EAAM,EAAE,IAAA,EAAM,OAAA,CAAQ,KAAA;AAAM,GAC9B;AACA,EAAA,OAAO,MAAA;AACT;AChBO,IAAM,YAAA,GAAe,IAAA,CAAK,SAASA,aAAAA,GAAe;AACvD,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,SAAI,SAAA,EAAU,uCAAA,EACb,8BAAC,KAAA,EAAA,EAAM,SAAA,EAAU,2BAA0B,CAAA,EAC7C,CAAA;AAAA,oBACA,IAAA,CAAC,KAAA,EAAA,EAAI,SAAA,EAAU,2CAAA,EACb,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,KAAA,EAAA,EAAM,WAAU,gBAAA,EAAiB,CAAA;AAAA,0BACjC,KAAA,EAAA,EAAI,SAAA,EAAU,yCACZ,QAAA,EAAA,CAAC,CAAA,EAAG,GAAG,CAAA,EAAG,CAAC,EAAE,GAAA,CAAI,CAAC,sBACjB,GAAA,CAAC,KAAA,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AAW,EAAE,MAAA,EAAQ,IAAA,EAAM,QAAQ,CAAA;AAC5C;AAEA,SAAS,KAAK,GAAA,EAAsC;AAClD,EAAA,MAAM,KAAA,GAAQ,IAAI,QAAA,EAAU,KAAA;AAC5B,EAAA,IAAI,CAAC,KAAA,EAAO,OAAO,EAAC;AAEpB,EAAA,MAAM,KAAA,GAAQ,KAAA,CAAM,IAAA,EAAM,KAAA,IAAS,KAAA,CAAM,IAAA;AACzC,EAAA,MAAM,WAAA,GAAc,KAAA,CAAM,IAAA,EAAM,WAAA,IAAe,KAAA,CAAM,WAAA;AACrD,EAAA,MAAM,QAAA,GAAW,MAAM,IAAA,EAAM,QAAA;AAE7B,EAAA,MAAM,GAAA,GAAM,aAAa,GAAA,CAAI,QAAA,EAAU,IAAI,QAAA,CAAS,QAAQ,KAAK,KAAA,CAAM,GAAA;AAEvE,EAAA,OAAO;AAAA,IACL,KAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,SAAA,EAAW,GAAA;AAAA,IACX,SAAA,EAAW;AAAA,MACT,IAAA,EAAM,SAAA;AAAA,MACN,KAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAQ,KAAA,CAAM,IAAA;AAAA,MACd;AAAA,KACF;AAAA,IACA,OAAA,EAAS;AAAA,MACP,IAAA,EAAM,qBAAA;AAAA,MACN,KAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAQ,KAAA,CAAM;AAAA,KAChB;AAAA,IACA,oBAAoB,uBAAA,CAAwB,GAAA,CAAI,QAAA,EAAU,GAAA,CAAI,SAAS,QAAQ;AAAA,GACjF;AACF;AAEO,IAAM,IAAA,GAAO,EAAE,EAAA,EAAI,OAAA,CAAQ,OAAO,MAAA,EAAQ,IAAA,EAAM,WAAW,QAAA","file":"chunk-S67SB2O2.js","sourcesContent":["import { getTwilightContext } from '../../twilight/context';\nimport { home } from '../../api/home';\nimport type { HomeComponentData } from '../../types';\nimport { RouteId } from '../../router/route-ids';\n\nexport interface HomeLoaderData {\n locale: string;\n components: HomeComponentData[];\n page: { slug: string };\n}\n\nexport async function homeLoader(ctx?: { locale?: string }): Promise<HomeLoaderData> {\n const { queryClient } = getTwilightContext();\n const components = await queryClient.ensureQueryData(home.queries.components());\n const result = {\n locale: ctx?.locale || 'ar',\n components: components.map((comp) => ({\n ...comp,\n path: comp.path?.replace('home.', '') || comp.path,\n })),\n page: { slug: RouteId.INDEX },\n };\n return result;\n}\n","import { memo } from 'react';\nimport { useDevHomeBlocks } from '../../dev/dev-settings-store';\nimport { HookSlot } from '../../hooks';\nimport { HomeComponentRenderer, ReorderProducts } from '../../components/home';\nimport type { HomePageProps } from './types';\nimport { Pulse } from '@salla.sa/twilight-components-react';\n\nexport const HomeSkeleton = memo(function HomeSkeleton() {\n return (\n <>\n <div className=\"s-block container skeleton-block-hero\">\n <Pulse className=\"h-64 sm:h-80 rounded-md\" />\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n <div className=\"s-block container skeleton-block-products\">\n <Pulse className=\"h-10 w-48 mb-4\" />\n <div className=\"grid grid-cols-2 sm:grid-cols-4 gap-4\">\n {[1, 2, 3, 4].map((i) => (\n <Pulse key={i} className=\"h-56\" />\n ))}\n </div>\n </div>\n </>\n );\n});\n\nexport const HomePage = memo(function HomePage({ components = [] }: HomePageProps) {\n // Dev-mode only: the dev editor's layout replaces the store's blocks while it\n // is on. No-op passthrough in production builds.\n const renderedComponents = useDevHomeBlocks(components);\n return (\n <>\n <HookSlot name=\"home:start\" />\n <HookSlot name=\"home:content\" />\n {renderedComponents.map((data, index) => (\n // `data.key` is the twilight.json catalog id, shared by every placement\n // of that block. Platform blocks send null. Position is unique; a dev\n // layout block keeps its own id so a reorder doesn't remount the rest.\n <HomeComponentRenderer key={data.__dev_id ?? index} data={data} index={index} />\n ))}\n <HookSlot name=\"home:end\" />\n <ReorderProducts />\n </>\n );\n});\n\nexport { HomePage as default };\n","import type { HeadDescriptor } from '../../utils/head';\nimport { buildHreflangAlternates, storePageUrl } from '../../utils/baseHead';\nimport type { HomeLoaderData } from './loader';\nimport { homeLoader } from './loader';\nimport type { TwilightContext } from '../../twilight/context';\nimport { HomePage } from './HomePage';\nimport { RouteId } from '../../router/route-ids';\n\nexport { HomeSkeleton } from './HomePage';\nexport { registerHomeComponents, DefaultHomeComponents } from '../../components/home/register';\nexport { registerHomeComponentConfig } from '../../components/home';\nexport type { HomePageProps } from './types';\nexport type { HomeLoaderData } from './loader';\nexport type {\n HomeComponentsProps,\n AnyHomeComponent,\n HomeComponentConfig,\n} from '../../components/home';\n\nfunction loader(_ctx?: { locale?: string }): Promise<HomeLoaderData> {\n return homeLoader({ locale: _ctx?.locale });\n}\n\nfunction head(ctx: TwilightContext): HeadDescriptor {\n const store = ctx.settings?.store;\n if (!store) return {};\n\n const title = store.meta?.title ?? store.name;\n const description = store.meta?.description ?? store.description;\n const keywords = store.meta?.keywords;\n // `/ar`, like Twig, where store.url reads `/ar/`.\n const url = storePageUrl(ctx.settings, ctx.location.pathname) ?? store.url;\n\n return {\n title,\n description,\n keywords,\n canonical: url,\n openGraph: {\n type: 'website',\n title,\n description,\n images: store.logo,\n url,\n },\n twitter: {\n card: 'summary_large_image',\n title,\n description,\n images: store.logo,\n },\n alternateLanguages: buildHreflangAlternates(ctx.settings, ctx.location.pathname),\n };\n}\n\nexport const Home = { id: RouteId.INDEX, loader, head, Component: HomePage } as const;\n\nexport { homeLoader };\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { registry } from './chunk-Y32RHCOH.js';
|
|
2
|
-
import { useMoney, useNumber } from './chunk-
|
|
2
|
+
import { useMoney, useNumber } from './chunk-72DGJN4Q.js';
|
|
3
3
|
import { useAsset } from './chunk-Z653O7MX.js';
|
|
4
|
-
import { useWishlist } from './chunk-
|
|
4
|
+
import { useWishlist } from './chunk-MEMJOJO4.js';
|
|
5
5
|
import { useTranslation } from './chunk-TYNZ5B2B.js';
|
|
6
|
-
import { Image } from './chunk-
|
|
6
|
+
import { Image } from './chunk-OSAFBMRT.js';
|
|
7
7
|
import { LazyImageModal } from './chunk-7V5HOZW4.js';
|
|
8
|
-
import { isNativeApp } from './chunk-
|
|
8
|
+
import { isNativeApp } from './chunk-YYMKDBZV.js';
|
|
9
9
|
import { useTwilight } from './chunk-DF6FBKDN.js';
|
|
10
10
|
import { lazy, memo, useCallback, useMemo, useState, useEffect, Suspense } from 'react';
|
|
11
11
|
import { SallaAddProductButton } from '@salla.sa/twilight-components-react/add-product-button';
|
|
@@ -15,10 +15,10 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
15
15
|
import { SallaSlider } from '@salla.sa/twilight-components-react/slider';
|
|
16
16
|
|
|
17
17
|
var LazyProductDetails = lazy(
|
|
18
|
-
() => import('./ProductDetails-
|
|
18
|
+
() => import('./ProductDetails-WSEGLJSW.js').then((m) => ({ default: m.ProductDetails }))
|
|
19
19
|
);
|
|
20
20
|
var LazyAddToCartForm = lazy(
|
|
21
|
-
() => import('./AddToCartForm-
|
|
21
|
+
() => import('./AddToCartForm-JKGAATX3.js').then((m) => ({ default: m.AddToCartForm }))
|
|
22
22
|
);
|
|
23
23
|
var PRODUCT_CARD_KEY = "product:card";
|
|
24
24
|
var PRODUCT_IMAGE_SRCSET_WIDTHS = [150, 300, 450, 600];
|
|
@@ -421,5 +421,5 @@ function ThumbSlide({ image, index }) {
|
|
|
421
421
|
}
|
|
422
422
|
|
|
423
423
|
export { LazyAddToCartForm, LazyProductDetails, ProductCard, ProductGallery };
|
|
424
|
-
//# sourceMappingURL=chunk-
|
|
425
|
-
//# sourceMappingURL=chunk-
|
|
424
|
+
//# sourceMappingURL=chunk-SCSJROJX.js.map
|
|
425
|
+
//# sourceMappingURL=chunk-SCSJROJX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/product/lazy.ts","../src/components/product/ProductCard.tsx","../src/components/product/ProductGallery.tsx"],"names":["ProductCardContent","ProductCard","jsxs","jsx","useMemo"],"mappings":";;;;;;;;;;;;;;;;AAEO,IAAM,kBAAA,GAAqB,IAAA;AAAA,EAAK,MACrC,OAAO,8BAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,cAAA,EAAe,CAAE;AACxE;AAEO,IAAM,iBAAA,GAAoB,IAAA;AAAA,EAAK,MACpC,OAAO,6BAAiB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,aAAA,EAAc,CAAE;AACtE;ACMA,IAAM,gBAAA,GAAmB,cAAA;AAEzB,IAAM,2BAAA,GAA8B,CAAC,GAAA,EAAK,GAAA,EAAK,KAAK,GAAG,CAAA;AAEvD,IAAM,mBAAA,GAAsB,+BAAA;AAE5B,IAAM,wBAAA,GAA2B,iCAAA;AAoCjC,IAAM,kBAAA,GAAqB,IAAA,CAAK,SAASA,mBAAAA,CAAmB;AAAA,EAC1D,OAAA;AAAA,EACA,MAAA,GAAS,UAAA;AAAA,EACT,SAAA,GAAY,EAAA;AAAA,EACZ,UAAA,GAAa,KAAA;AAAA,EACb,YAAA,GAAe,KAAA;AAAA,EACf,gBAAA,GAAmB,KAAA;AAAA,EACnB,KAAA,GAAQ,CAAA;AAAA,EACR,aAAA,GAAgB,KAAA;AAAA,EAChB;AACF,CAAA,EAAqB;AACnB,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,QAAA,EAAS;AAC5B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,cAAA,EAAe;AAC7B,EAAA,MAAM,EAAE,KAAA,EAAO,KAAA,EAAM,GAAI,WAAA,EAAY;AACrC,EAAA,MAAM,WAAW,WAAA,EAAY;AAC7B,EAAA,MAAM,EAAE,aAAA,EAAc,GAAI,QAA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,KAAA,CAAM,iBAAA,GAAoB,aAAA,GAAgB,EAAE,CAAA,CAAA;AAAA,MACpH,gBAAc,KAAA,CAAM,GAAA;AAAA,MAEpB,QAAA,kBAAAA,GAAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,KAAK,KAAA,CAAM,GAAA;AAAA,UACX,GAAA,EAAK,MAAM,GAAA,IAAO,EAAA;AAAA,UAClB,SAAA,EAAU,mEAAA;AAAA,UACV,OAAO,KAAA,CAAM,GAAA;AAAA,UACb,UAAU,KAAA,GAAQ,CAAA;AAAA,UAClB,SAAA,EAAS;AAAA;AAAA;AACX;AAAA,GACF;AAEJ","file":"chunk-B2OJZKU4.js","sourcesContent":["import { lazy } from 'react';\n\nexport const LazyProductDetails = lazy(() =>\n import('./ProductDetails').then((m) => ({ default: m.ProductDetails }))\n);\n\nexport const LazyAddToCartForm = lazy(() =>\n import('./AddToCartForm').then((m) => ({ default: m.AddToCartForm }))\n);\n","import { memo, useCallback, useMemo } from 'react';\nimport { SallaAddProductButton } from '@salla.sa/twilight-components-react/add-product-button';\nimport { SallaButton } from '@salla.sa/twilight-components-react/button';\nimport { useHostAttributes } from '@salla.sa/twilight-theme-engine/hooks/useHostAttributes';\nimport { useMoney } from '../../hooks/useMoney';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useWishlist } from '../../hooks/useWishlist';\nimport { useAsset } from '../../hooks/useAsset';\nimport { useNumber } from '../../hooks/useNumber';\nimport { registry } from '../ComponentRegistry';\nimport { Image } from '../common';\nimport type { Product } from '../../types';\n\nconst PRODUCT_CARD_KEY = 'product:card';\n\nconst PRODUCT_IMAGE_SRCSET_WIDTHS = [150, 300, 450, 600] as const;\n/** Matches `.s-products-list-vertical-cards`: 2-col below 768px, 4-col above. */\nconst PRODUCT_IMAGE_SIZES = '(min-width: 768px) 25vw, 50vw';\n/** fullImage / minimal slots in FeaturedProductsStyle3 (`lg:grid-cols-2`). */\nconst PRODUCT_WIDE_IMAGE_SIZES = '(min-width: 1024px) 50vw, 100vw';\n\n/** Product card layout variants - mutually exclusive */\nexport type ProductCardLayout = 'vertical' | 'horizontal' | 'fullImage' | 'minimal' | 'special';\n\nexport interface ProductCardProps {\n product: Product;\n layout?: ProductCardLayout;\n className?: string;\n withShadow?: boolean;\n withQuantity?: boolean;\n withoutAddButton?: boolean;\n index?: number;\n imagePriority?: boolean;\n /** Overrides the layout-based image `sizes` hint. */\n sizes?: string;\n}\n\n/**\n * ProductCard - Displays a product in various layouts\n *\n * Layouts:\n * - vertical: Default card with image top, content bottom\n * - horizontal: Side-by-side image and content\n * - fullImage: Full bleed image with overlay content\n * - minimal: Compact version with reduced info\n * - special: Featured card with quantity pie chart\n *\n * Features:\n * - Native lazy loading for images\n * - Product badges (promotion, preorder, quantity, out of stock)\n * - Wishlist toggle button\n * - Price display (sale, starting, regular)\n * - Rating display\n * - Add to cart button via SallaAddProductButton (handles labels internally)\n */\nconst ProductCardContent = memo(function ProductCardContent({\n product,\n layout = 'vertical',\n className = '',\n withShadow = false,\n withQuantity = false,\n withoutAddButton = false,\n index = 0,\n imagePriority = false,\n sizes,\n}: ProductCardProps) {\n const { format } = useMoney();\n const { t } = useTranslation();\n const { store, theme } = useTwilight();\n const wishlist = useWishlist();\n const { isPlaceholder } = useAsset();\n const { format: formatNumber } = useNumber();\n\n // Out-of-stock cards offer \"notify me when available\" instead of a dead button, unless\n // the merchant switched `notify_when_available_in_card` off (Twig theme-raed parity).\n const notifyInCard = theme?.settings?.notify_when_available_in_card !== false;\n const addButtonStatus =\n notifyInCard &&\n product.is_out_of_stock &&\n product.type !== 'donating' &&\n product.type !== 'financial_support'\n ? 'out-and-notify'\n : product.status;\n\n const addButtonRef = useHostAttributes({ fill: 'outline', width: 'wide' });\n\n // Layout flags\n const isVertical = layout === 'vertical';\n const isHorizontal = layout === 'horizontal';\n const isFullImage = layout === 'fullImage';\n const isMinimal = layout === 'minimal';\n const isSpecial = layout === 'special';\n\n // Wishlist status\n const productInWishlist = wishlist.has(Number(product.id));\n const handleWishlistToggle = useCallback(() => {\n wishlist.toggle(Number(product.id));\n }, [wishlist, product.id]);\n\n // Get image fit type from store settings\n const fitImageHeight = store?.settings?.product?.fit_type;\n\n // Product badge component\n const getProductBadge = () => {\n if (product?.preorder?.label && typeof product.preorder.label === 'string') {\n return <div className=\"s-product-card-promotion-title\">{product.preorder.label}</div>;\n }\n if (product.promotion_title) {\n return <div className=\"s-product-card-promotion-title\">{product.promotion_title}</div>;\n }\n if (withQuantity && product?.quantity) {\n const formattedQty = formatNumber(product.quantity);\n return (\n <div className=\"s-product-card-quantity\">\n {t('pages.products.remained', 'Remained')} {formattedQty}\n </div>\n );\n }\n if (withQuantity && product?.is_out_of_stock) {\n return (\n <div className=\"s-product-card-out-badge\">\n {t('pages.products.out_of_stock', 'Out of Stock')}\n </div>\n );\n }\n return null;\n };\n\n // Price display component\n const getProductPrice = () => {\n if (product.is_on_sale && product.sale_price) {\n return (\n <div className=\"s-product-card-sale-price\">\n <h4>{format(product.sale_price)}</h4>\n {product.regular_price && <span>{format(product.regular_price)}</span>}\n </div>\n );\n }\n if (product.starting_price) {\n return (\n <div className=\"s-product-card-starting-price\">\n <p>{t('pages.products.starting_price', 'Starting from')}</p>\n <h4>{format(product.starting_price)}</h4>\n </div>\n );\n }\n return <h4 className=\"s-product-card-price\">{format(product.price)}</h4>;\n };\n\n // Build card class names\n const cardClassName = [\n 's-product-card',\n 's-product-card-entry',\n isVertical ? 's-product-card-vertical' : '',\n isHorizontal ? 's-product-card-horizontal' : '',\n fitImageHeight && isVertical ? `s-product-card-fit-height` : '',\n isSpecial ? 's-product-card-special' : '',\n isFullImage ? 's-product-card-full-image' : '',\n isMinimal ? 's-product-card-minimal' : '',\n product?.donation ? 's-product-card-donation' : '',\n withShadow ? 's-product-card-shadow' : '',\n product?.is_out_of_stock ? 's-product-card-out-of-stock' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n // Image fit class\n const isProductPlaceholder = isPlaceholder(product.image?.url);\n const imageFitClass = isProductPlaceholder ? 'contain' : fitImageHeight || 'cover';\n\n return (\n <div\n id={`product-card-${product.id}`}\n className={cardClassName}\n data-product-id={product.id}\n style={{\n animationDelay: `${index * 100}ms`,\n }}\n >\n <div className={isFullImage ? 's-product-card-image-full' : 's-product-card-image'}>\n <a href={product.url} aria-label={product.image?.alt || product.name}>\n <Image\n className={`s-product-card-image-${imageFitClass}`}\n src={product.image?.url}\n alt={product.image?.alt ?? product.name}\n width={300}\n height={300}\n sizes={\n sizes ?? (isFullImage || isMinimal ? PRODUCT_WIDE_IMAGE_SIZES : PRODUCT_IMAGE_SIZES)\n }\n srcSetWidths={PRODUCT_IMAGE_SRCSET_WIDTHS}\n aspectRatio=\"1/1\"\n priority={imagePriority}\n />\n {!isFullImage && !isMinimal && getProductBadge()}\n </a>\n {isFullImage && (\n <a href={product.url} aria-label={product.name} className=\"s-product-card-overlay\" />\n )}\n {!isHorizontal && !isFullImage && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n <div className=\"s-product-card-content\">\n {/* Special card: quantity pie */}\n {isSpecial && product?.quantity && (\n <div className=\"s-product-card-content-pie\">\n <span>\n <b>{formatNumber(product.quantity)}</b>\n {t('pages.products.remained', 'Remained')}\n </span>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-2 -1 36 34\"\n className=\"s-product-card-content-pie-svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n )}\n\n <div\n className={`s-product-card-content-main ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n <h3 className=\"s-product-card-content-title\">\n <a href={product.url}>{product.name}</a>\n </h3>\n {product.subtitle && !isMinimal && (\n <p className=\"s-product-card-content-subtitle opacity-80\">{product.subtitle}</p>\n )}\n </div>\n\n <div\n className={`s-product-card-content-sub ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n {!product?.donation?.can_donate && getProductPrice()}\n {product.rating?.stars && (\n <div className=\"s-product-card-rating\">\n <i className=\"sicon-star2 text-orange-300\" />\n <span>{product.rating.stars}</span>\n </div>\n )}\n </div>\n\n {!withoutAddButton && (\n <div className=\"s-product-card-content-footer gap-2\">\n <SallaAddProductButton\n ref={addButtonRef}\n fill=\"outline\"\n width=\"wide\"\n productId={product.id}\n productStatus={addButtonStatus}\n productType={product.type}\n hasPreOrder={product.has_preorder_campaign}\n />\n {(isHorizontal || isFullImage) && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n )}\n </div>\n </div>\n );\n});\n\nexport const ProductCard = memo(function ProductCard(props: ProductCardProps) {\n const Component = useMemo(() => {\n const hasOverride = registry.getOriginal<ProductCardProps>(PRODUCT_CARD_KEY) !== null;\n if (hasOverride) {\n return registry.resolve<ProductCardProps>(PRODUCT_CARD_KEY);\n }\n return null;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductCardContent {...props} />;\n});\n\nexport default ProductCard;\n","import { SallaSlider } from '@salla.sa/twilight-components-react/slider';\nimport { Suspense, useEffect, useMemo, useState } from 'react';\nimport { registry } from '../ComponentRegistry';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport type { Product, ProductImage } from '../../types';\nimport { Image } from '../common/Image';\nimport { ImageModal } from '../modal';\nimport { isNativeApp } from '../../native-app';\n\nconst PRODUCT_GALLERY_KEY = 'product:gallery';\n\nexport interface ProductGalleryProps {\n product: Product;\n}\n\ntype ImagePreview = { src: string; alt: string };\ntype GalleryMedia = { url: string; type: 'image' | 'video' | '3d-image' };\n\n/**\n * The engine's own `mobile::gallery.open` payload from before `salla.mobile.openGallery`: a video's\n * link and a 3D model's file go in `url`, with no ids. Sent when the SDK has no `openGallery`\n * (Twilight before 2.14.569) or declines inside the app, so those stores keep the gallery they had.\n */\nfunction legacyGalleryMedia(images: ProductImage[]): GalleryMedia[] {\n return images.flatMap<GalleryMedia>((image) => {\n if (image.three_d_image_url) return [{ url: image.three_d_image_url, type: '3d-image' }];\n if (image.video_url) return [{ url: image.video_url, type: 'video' }];\n return image.url ? [{ url: image.url, type: 'image' }] : [];\n });\n}\n\nfunction ProductGalleryContent({ product }: ProductGalleryProps) {\n const { t } = useTranslation();\n const { theme } = useTwilight();\n const sliderId = `details-slider-${product.id}`;\n const objectFit = theme.settings.slider_background_size ?? 'cover';\n\n // Clicking an image opens an in-app lightbox instead of navigating to the CDN URL.\n const [preview, setPreview] = useState<ImagePreview | null>(null);\n\n useEffect(() => {\n const raf = requestAnimationFrame(() => {\n const el = document.getElementById(sliderId);\n if (!el?.parentElement) return;\n const { parentElement, nextSibling } = el;\n parentElement.removeChild(el);\n parentElement.insertBefore(el, nextSibling);\n });\n return () => cancelAnimationFrame(raf);\n }, [sliderId]);\n\n // The product-details API only returns `image` (singular).\n // Fall back so the main image always renders even without the full gallery array.\n const images: ProductImage[] =\n product.images && product.images.length > 0\n ? product.images\n : product.image?.url\n ? [product.image]\n : [];\n\n const hasManyImages = images.length > 1;\n const openNativeGallery = (selected: ProductImage) => {\n if (!isNativeApp()) return false;\n if (window.salla?.mobile?.openGallery?.(images, selected)) return true;\n window.salla?.event.dispatch('mobile::gallery.open', { images: legacyGalleryMedia(images) });\n return true;\n };\n\n return (\n <div className=\"sidebar md:sticky top-24 w-full md:!w-2/4 rtl:ml-8 ltr:mr-8 pb-8 md:pb-16 overflow-hidden shrink-0\">\n <SallaSlider\n id={sliderId}\n className=\"details-slider rounded-md image-slider\"\n type=\"thumbs\"\n loop={false}\n autoHeight\n listenToThumbnailsOption\n showThumbsControls={false}\n sliderConfig={{ watchOverflow: true, autoHeight: true }}\n >\n {product.promotion_title && (\n <div className=\"promotion-title\">{product.promotion_title}</div>\n )}\n\n {product.calories && (\n <div className=\"absolute z-[2] top-4 rtl:left-4 ltr:right-4 bg-white shadow-sm flex flex-col justify-center items-center rounded-full w-20 h-20 md:w-24 md:h-24\">\n <span className=\"text-red-500 text-xl leading-none font-bold\">{product.calories}</span>\n <span className=\"text-xs text-gray-500\">\n {t('pages.products.calories', 'Calories')}\n </span>\n </div>\n )}\n\n <div slot=\"items\">\n {images.map((image, index) => (\n <ImageSlide\n key={image.id ?? image.three_d_image_url ?? image.video_url ?? image.url}\n image={image}\n product={product}\n index={index}\n objectFit={objectFit}\n onPreview={setPreview}\n onNativeOpen={openNativeGallery}\n />\n ))}\n </div>\n\n {hasManyImages && (\n <div slot=\"thumbs\">\n {images.map((image, index) => (\n <ThumbSlide\n key={image.id ?? image.three_d_image_url ?? image.video_url ?? image.url}\n image={image}\n index={index}\n />\n ))}\n </div>\n )}\n </SallaSlider>\n\n <Suspense fallback={null}>\n <ImageModal\n isOpen={!!preview}\n onClose={() => setPreview(null)}\n src={preview?.src ?? ''}\n alt={preview?.alt}\n />\n </Suspense>\n </div>\n );\n}\n\nexport function ProductGallery(props: ProductGalleryProps) {\n const Component = useMemo(() => {\n const resolved = registry.resolve<ProductGalleryProps>(PRODUCT_GALLERY_KEY);\n // A theme that seeds the key with this component (register + override) would\n // otherwise recurse into itself when it has not actually overridden anything.\n return resolved === ProductGallery ? null : resolved;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductGalleryContent {...props} />;\n}\n\nfunction ImageSlide({\n image,\n product,\n index,\n objectFit,\n onPreview,\n onNativeOpen,\n}: {\n image: ProductImage;\n product: Product;\n index: number;\n objectFit: 'cover' | 'contain';\n onPreview: (preview: ImagePreview) => void;\n onNativeOpen: (image: ProductImage) => boolean;\n}) {\n const [loaded, setLoaded] = useState(false);\n const isVideo = Boolean(image.video_url);\n\n if (image.three_d_image_url) {\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: model-viewer is an interactive web component.\n <model-viewer\n style={{ minHeight: '500px' }}\n className=\"swiper-slide model-entry w-full h-full\"\n loading=\"lazy\"\n camera-controls\n touch-action=\"pan-y\"\n auto-rotate\n poster={image.url || undefined}\n src={image.three_d_image_url}\n shadow-intensity=\"1\"\n alt={image.alt}\n onClick={() => onNativeOpen(image)}\n ></model-viewer>\n );\n }\n\n return (\n <a\n data-fslightbox={`product_${product.id}`}\n data-img-id={image.id}\n data-slid-index={index}\n {...(image.video_url ? { 'data-video-src': image.video_url } : {})}\n data-caption={image.alt}\n data-infinite=\"false\"\n data-type={image.video_url ? 'youtube' : 'image'}\n href={image.video_url || image.url}\n // FsLightbox isn't loaded in this React theme, so the bare href would leave the SPA.\n // Open images in an in-app lightbox; let videos open in a new tab.\n {...(isVideo ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n onClick={(event) => {\n if (onNativeOpen(image)) {\n event.preventDefault();\n return;\n }\n if (isVideo || !image.url) return;\n event.preventDefault();\n onPreview({ src: image.url, alt: image.alt || product.name });\n }}\n aria-label={product.name}\n className={`swiper-slide magnify-wrapper homeslider__slide ${image.video_url ? 'video-entry' : ''}`}\n >\n <div className={`w-full ${loaded ? '' : 'aspect-square bg-gray-100 animate-pulse'}`}>\n <Image\n id={String(image.id)}\n src={image.url}\n alt={image.alt || product.name}\n className={`h-full w-full object-${objectFit}`}\n aspectRatio=\"1/1\"\n priority={index === 0}\n noWrapper\n onLoad={() => setLoaded(true)}\n />\n </div>\n </a>\n );\n}\n\nfunction ThumbSlide({ image, index }: { image: ProductImage; index: number }) {\n return (\n <div\n className={`slide--one-fourth ${image.video_url ? 'video-entry' : ''} ${image.three_d_image_url ? 'model-entry' : ''}`}\n data-caption={image.alt}\n >\n <Image\n src={image.url}\n alt={image.alt || ''}\n className=\"object-cover w-full h-full bg-gray-100 rounded-md overflow-hidden\"\n title={image.alt}\n priority={index < 5}\n noWrapper\n />\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/product/lazy.ts","../src/components/product/ProductCard.tsx","../src/components/product/ProductGallery.tsx"],"names":["ProductCardContent","ProductCard","jsxs","jsx","useMemo"],"mappings":";;;;;;;;;;;;;;;;AAEO,IAAM,kBAAA,GAAqB,IAAA;AAAA,EAAK,MACrC,OAAO,8BAAkB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,cAAA,EAAe,CAAE;AACxE;AAEO,IAAM,iBAAA,GAAoB,IAAA;AAAA,EAAK,MACpC,OAAO,6BAAiB,CAAA,CAAE,IAAA,CAAK,CAAC,CAAA,MAAO,EAAE,OAAA,EAAS,CAAA,CAAE,aAAA,EAAc,CAAE;AACtE;ACMA,IAAM,gBAAA,GAAmB,cAAA;AAEzB,IAAM,2BAAA,GAA8B,CAAC,GAAA,EAAK,GAAA,EAAK,KAAK,GAAG,CAAA;AAEvD,IAAM,mBAAA,GAAsB,+BAAA;AAE5B,IAAM,wBAAA,GAA2B,iCAAA;AAoCjC,IAAM,kBAAA,GAAqB,IAAA,CAAK,SAASA,mBAAAA,CAAmB;AAAA,EAC1D,OAAA;AAAA,EACA,MAAA,GAAS,UAAA;AAAA,EACT,SAAA,GAAY,EAAA;AAAA,EACZ,UAAA,GAAa,KAAA;AAAA,EACb,YAAA,GAAe,KAAA;AAAA,EACf,gBAAA,GAAmB,KAAA;AAAA,EACnB,KAAA,GAAQ,CAAA;AAAA,EACR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T,MAAA,EAAQ,MAAM,SAAA,CAAU,IAAI;AAAA;AAAA,OAC9B,EACF;AAAA;AAAA,GACF;AAEJ;AAEA,SAAS,UAAA,CAAW,EAAE,KAAA,EAAO,KAAA,EAAM,EAA2C;AAC5E,EAAA,uBACEA,GAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,CAAA,kBAAA,EAAqB,KAAA,CAAM,SAAA,GAAY,aAAA,GAAgB,EAAE,CAAA,CAAA,EAAI,KAAA,CAAM,iBAAA,GAAoB,aAAA,GAAgB,EAAE,CAAA,CAAA;AAAA,MACpH,gBAAc,KAAA,CAAM,GAAA;AAAA,MAEpB,QAAA,kBAAAA,GAAAA;AAAA,QAAC,KAAA;AAAA,QAAA;AAAA,UACC,KAAK,KAAA,CAAM,GAAA;AAAA,UACX,GAAA,EAAK,MAAM,GAAA,IAAO,EAAA;AAAA,UAClB,SAAA,EAAU,mEAAA;AAAA,UACV,OAAO,KAAA,CAAM,GAAA;AAAA,UACb,UAAU,KAAA,GAAQ,CAAA;AAAA,UAClB,SAAA,EAAS;AAAA;AAAA;AACX;AAAA,GACF;AAEJ","file":"chunk-SCSJROJX.js","sourcesContent":["import { lazy } from 'react';\n\nexport const LazyProductDetails = lazy(() =>\n import('./ProductDetails').then((m) => ({ default: m.ProductDetails }))\n);\n\nexport const LazyAddToCartForm = lazy(() =>\n import('./AddToCartForm').then((m) => ({ default: m.AddToCartForm }))\n);\n","import { memo, useCallback, useMemo } from 'react';\nimport { SallaAddProductButton } from '@salla.sa/twilight-components-react/add-product-button';\nimport { SallaButton } from '@salla.sa/twilight-components-react/button';\nimport { useHostAttributes } from '@salla.sa/twilight-theme-engine/hooks/useHostAttributes';\nimport { useMoney } from '../../hooks/useMoney';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useWishlist } from '../../hooks/useWishlist';\nimport { useAsset } from '../../hooks/useAsset';\nimport { useNumber } from '../../hooks/useNumber';\nimport { registry } from '../ComponentRegistry';\nimport { Image } from '../common';\nimport type { Product } from '../../types';\n\nconst PRODUCT_CARD_KEY = 'product:card';\n\nconst PRODUCT_IMAGE_SRCSET_WIDTHS = [150, 300, 450, 600] as const;\n/** Matches `.s-products-list-vertical-cards`: 2-col below 768px, 4-col above. */\nconst PRODUCT_IMAGE_SIZES = '(min-width: 768px) 25vw, 50vw';\n/** fullImage / minimal slots in FeaturedProductsStyle3 (`lg:grid-cols-2`). */\nconst PRODUCT_WIDE_IMAGE_SIZES = '(min-width: 1024px) 50vw, 100vw';\n\n/** Product card layout variants - mutually exclusive */\nexport type ProductCardLayout = 'vertical' | 'horizontal' | 'fullImage' | 'minimal' | 'special';\n\nexport interface ProductCardProps {\n product: Product;\n layout?: ProductCardLayout;\n className?: string;\n withShadow?: boolean;\n withQuantity?: boolean;\n withoutAddButton?: boolean;\n index?: number;\n imagePriority?: boolean;\n /** Overrides the layout-based image `sizes` hint. */\n sizes?: string;\n}\n\n/**\n * ProductCard - Displays a product in various layouts\n *\n * Layouts:\n * - vertical: Default card with image top, content bottom\n * - horizontal: Side-by-side image and content\n * - fullImage: Full bleed image with overlay content\n * - minimal: Compact version with reduced info\n * - special: Featured card with quantity pie chart\n *\n * Features:\n * - Native lazy loading for images\n * - Product badges (promotion, preorder, quantity, out of stock)\n * - Wishlist toggle button\n * - Price display (sale, starting, regular)\n * - Rating display\n * - Add to cart button via SallaAddProductButton (handles labels internally)\n */\nconst ProductCardContent = memo(function ProductCardContent({\n product,\n layout = 'vertical',\n className = '',\n withShadow = false,\n withQuantity = false,\n withoutAddButton = false,\n index = 0,\n imagePriority = false,\n sizes,\n}: ProductCardProps) {\n const { format } = useMoney();\n const { t } = useTranslation();\n const { store, theme } = useTwilight();\n const wishlist = useWishlist();\n const { isPlaceholder } = useAsset();\n const { format: formatNumber } = useNumber();\n\n // Out-of-stock cards offer \"notify me when available\" instead of a dead button, unless\n // the merchant switched `notify_when_available_in_card` off (Twig theme-raed parity).\n const notifyInCard = theme?.settings?.notify_when_available_in_card !== false;\n const addButtonStatus =\n notifyInCard &&\n product.is_out_of_stock &&\n product.type !== 'donating' &&\n product.type !== 'financial_support'\n ? 'out-and-notify'\n : product.status;\n\n const addButtonRef = useHostAttributes({ fill: 'outline', width: 'wide' });\n\n // Layout flags\n const isVertical = layout === 'vertical';\n const isHorizontal = layout === 'horizontal';\n const isFullImage = layout === 'fullImage';\n const isMinimal = layout === 'minimal';\n const isSpecial = layout === 'special';\n\n // Wishlist status\n const productInWishlist = wishlist.has(Number(product.id));\n const handleWishlistToggle = useCallback(() => {\n wishlist.toggle(Number(product.id));\n }, [wishlist, product.id]);\n\n // Get image fit type from store settings\n const fitImageHeight = store?.settings?.product?.fit_type;\n\n // Product badge component\n const getProductBadge = () => {\n if (product?.preorder?.label && typeof product.preorder.label === 'string') {\n return <div className=\"s-product-card-promotion-title\">{product.preorder.label}</div>;\n }\n if (product.promotion_title) {\n return <div className=\"s-product-card-promotion-title\">{product.promotion_title}</div>;\n }\n if (withQuantity && product?.quantity) {\n const formattedQty = formatNumber(product.quantity);\n return (\n <div className=\"s-product-card-quantity\">\n {t('pages.products.remained', 'Remained')} {formattedQty}\n </div>\n );\n }\n if (withQuantity && product?.is_out_of_stock) {\n return (\n <div className=\"s-product-card-out-badge\">\n {t('pages.products.out_of_stock', 'Out of Stock')}\n </div>\n );\n }\n return null;\n };\n\n // Price display component\n const getProductPrice = () => {\n if (product.is_on_sale && product.sale_price) {\n return (\n <div className=\"s-product-card-sale-price\">\n <h4>{format(product.sale_price)}</h4>\n {product.regular_price && <span>{format(product.regular_price)}</span>}\n </div>\n );\n }\n if (product.starting_price) {\n return (\n <div className=\"s-product-card-starting-price\">\n <p>{t('pages.products.starting_price', 'Starting from')}</p>\n <h4>{format(product.starting_price)}</h4>\n </div>\n );\n }\n return <h4 className=\"s-product-card-price\">{format(product.price)}</h4>;\n };\n\n // Build card class names\n const cardClassName = [\n 's-product-card',\n 's-product-card-entry',\n isVertical ? 's-product-card-vertical' : '',\n isHorizontal ? 's-product-card-horizontal' : '',\n fitImageHeight && isVertical ? `s-product-card-fit-height` : '',\n isSpecial ? 's-product-card-special' : '',\n isFullImage ? 's-product-card-full-image' : '',\n isMinimal ? 's-product-card-minimal' : '',\n product?.donation ? 's-product-card-donation' : '',\n withShadow ? 's-product-card-shadow' : '',\n product?.is_out_of_stock ? 's-product-card-out-of-stock' : '',\n className,\n ]\n .filter(Boolean)\n .join(' ');\n\n // Image fit class\n const isProductPlaceholder = isPlaceholder(product.image?.url);\n const imageFitClass = isProductPlaceholder ? 'contain' : fitImageHeight || 'cover';\n\n return (\n <div\n id={`product-card-${product.id}`}\n className={cardClassName}\n data-product-id={product.id}\n style={{\n animationDelay: `${index * 100}ms`,\n }}\n >\n <div className={isFullImage ? 's-product-card-image-full' : 's-product-card-image'}>\n <a href={product.url} aria-label={product.image?.alt || product.name}>\n <Image\n className={`s-product-card-image-${imageFitClass}`}\n src={product.image?.url}\n alt={product.image?.alt ?? product.name}\n width={300}\n height={300}\n sizes={\n sizes ?? (isFullImage || isMinimal ? PRODUCT_WIDE_IMAGE_SIZES : PRODUCT_IMAGE_SIZES)\n }\n srcSetWidths={PRODUCT_IMAGE_SRCSET_WIDTHS}\n aspectRatio=\"1/1\"\n priority={imagePriority}\n />\n {!isFullImage && !isMinimal && getProductBadge()}\n </a>\n {isFullImage && (\n <a href={product.url} aria-label={product.name} className=\"s-product-card-overlay\" />\n )}\n {!isHorizontal && !isFullImage && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n <div className=\"s-product-card-content\">\n {/* Special card: quantity pie */}\n {isSpecial && product?.quantity && (\n <div className=\"s-product-card-content-pie\">\n <span>\n <b>{formatNumber(product.quantity)}</b>\n {t('pages.products.remained', 'Remained')}\n </span>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"-2 -1 36 34\"\n className=\"s-product-card-content-pie-svg\"\n >\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-base\" />\n <circle cx=\"16\" cy=\"16\" r=\"15.9155\" className=\"s-product-card-content-pie-svg-bar\" />\n </svg>\n </div>\n )}\n\n <div\n className={`s-product-card-content-main ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n <h3 className=\"s-product-card-content-title\">\n <a href={product.url}>{product.name}</a>\n </h3>\n {product.subtitle && !isMinimal && (\n <p className=\"s-product-card-content-subtitle opacity-80\">{product.subtitle}</p>\n )}\n </div>\n\n <div\n className={`s-product-card-content-sub ${isSpecial ? 's-product-card-content-extra-padding' : ''}`}\n >\n {!product?.donation?.can_donate && getProductPrice()}\n {product.rating?.stars && (\n <div className=\"s-product-card-rating\">\n <i className=\"sicon-star2 text-orange-300\" />\n <span>{product.rating.stars}</span>\n </div>\n )}\n </div>\n\n {!withoutAddButton && (\n <div className=\"s-product-card-content-footer gap-2\">\n <SallaAddProductButton\n ref={addButtonRef}\n fill=\"outline\"\n width=\"wide\"\n productId={product.id}\n productStatus={addButtonStatus}\n productType={product.type}\n hasPreOrder={product.has_preorder_campaign}\n />\n {(isHorizontal || isFullImage) && (\n <SallaButton\n shape=\"icon\"\n fill=\"outline\"\n color=\"light\"\n ariaLabel={t('pages.wishlist.toggle', 'Add or remove to wishlist')}\n className={`s-product-card-wishlist-btn animated ${productInWishlist ? 's-product-card-wishlist-added pulse-anime' : 'not-added un-favorited'}`}\n onClick={handleWishlistToggle}\n data-id={product.id}\n >\n <i className=\"sicon-heart\" />\n </SallaButton>\n )}\n </div>\n )}\n </div>\n </div>\n );\n});\n\nexport const ProductCard = memo(function ProductCard(props: ProductCardProps) {\n const Component = useMemo(() => {\n const hasOverride = registry.getOriginal<ProductCardProps>(PRODUCT_CARD_KEY) !== null;\n if (hasOverride) {\n return registry.resolve<ProductCardProps>(PRODUCT_CARD_KEY);\n }\n return null;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductCardContent {...props} />;\n});\n\nexport default ProductCard;\n","import { SallaSlider } from '@salla.sa/twilight-components-react/slider';\nimport { Suspense, useEffect, useMemo, useState } from 'react';\nimport { registry } from '../ComponentRegistry';\nimport { useTwilight } from '../../providers/TwilightProvider';\nimport { useTranslation } from '../../providers/I18nProvider';\nimport type { Product, ProductImage } from '../../types';\nimport { Image } from '../common/Image';\nimport { ImageModal } from '../modal';\nimport { isNativeApp } from '../../native-app';\n\nconst PRODUCT_GALLERY_KEY = 'product:gallery';\n\nexport interface ProductGalleryProps {\n product: Product;\n}\n\ntype ImagePreview = { src: string; alt: string };\ntype GalleryMedia = { url: string; type: 'image' | 'video' | '3d-image' };\n\n/**\n * The engine's own `mobile::gallery.open` payload from before `salla.mobile.openGallery`: a video's\n * link and a 3D model's file go in `url`, with no ids. Sent when the SDK has no `openGallery`\n * (Twilight before 2.14.569) or declines inside the app, so those stores keep the gallery they had.\n */\nfunction legacyGalleryMedia(images: ProductImage[]): GalleryMedia[] {\n return images.flatMap<GalleryMedia>((image) => {\n if (image.three_d_image_url) return [{ url: image.three_d_image_url, type: '3d-image' }];\n if (image.video_url) return [{ url: image.video_url, type: 'video' }];\n return image.url ? [{ url: image.url, type: 'image' }] : [];\n });\n}\n\nfunction ProductGalleryContent({ product }: ProductGalleryProps) {\n const { t } = useTranslation();\n const { theme } = useTwilight();\n const sliderId = `details-slider-${product.id}`;\n const objectFit = theme.settings.slider_background_size ?? 'cover';\n\n // Clicking an image opens an in-app lightbox instead of navigating to the CDN URL.\n const [preview, setPreview] = useState<ImagePreview | null>(null);\n\n useEffect(() => {\n const raf = requestAnimationFrame(() => {\n const el = document.getElementById(sliderId);\n if (!el?.parentElement) return;\n const { parentElement, nextSibling } = el;\n parentElement.removeChild(el);\n parentElement.insertBefore(el, nextSibling);\n });\n return () => cancelAnimationFrame(raf);\n }, [sliderId]);\n\n // The product-details API only returns `image` (singular).\n // Fall back so the main image always renders even without the full gallery array.\n const images: ProductImage[] =\n product.images && product.images.length > 0\n ? product.images\n : product.image?.url\n ? [product.image]\n : [];\n\n const hasManyImages = images.length > 1;\n const openNativeGallery = (selected: ProductImage) => {\n if (!isNativeApp()) return false;\n if (window.salla?.mobile?.openGallery?.(images, selected)) return true;\n window.salla?.event.dispatch('mobile::gallery.open', { images: legacyGalleryMedia(images) });\n return true;\n };\n\n return (\n <div className=\"sidebar md:sticky top-24 w-full md:!w-2/4 rtl:ml-8 ltr:mr-8 pb-8 md:pb-16 overflow-hidden shrink-0\">\n <SallaSlider\n id={sliderId}\n className=\"details-slider rounded-md image-slider\"\n type=\"thumbs\"\n loop={false}\n autoHeight\n listenToThumbnailsOption\n showThumbsControls={false}\n sliderConfig={{ watchOverflow: true, autoHeight: true }}\n >\n {product.promotion_title && (\n <div className=\"promotion-title\">{product.promotion_title}</div>\n )}\n\n {product.calories && (\n <div className=\"absolute z-[2] top-4 rtl:left-4 ltr:right-4 bg-white shadow-sm flex flex-col justify-center items-center rounded-full w-20 h-20 md:w-24 md:h-24\">\n <span className=\"text-red-500 text-xl leading-none font-bold\">{product.calories}</span>\n <span className=\"text-xs text-gray-500\">\n {t('pages.products.calories', 'Calories')}\n </span>\n </div>\n )}\n\n <div slot=\"items\">\n {images.map((image, index) => (\n <ImageSlide\n key={image.id ?? image.three_d_image_url ?? image.video_url ?? image.url}\n image={image}\n product={product}\n index={index}\n objectFit={objectFit}\n onPreview={setPreview}\n onNativeOpen={openNativeGallery}\n />\n ))}\n </div>\n\n {hasManyImages && (\n <div slot=\"thumbs\">\n {images.map((image, index) => (\n <ThumbSlide\n key={image.id ?? image.three_d_image_url ?? image.video_url ?? image.url}\n image={image}\n index={index}\n />\n ))}\n </div>\n )}\n </SallaSlider>\n\n <Suspense fallback={null}>\n <ImageModal\n isOpen={!!preview}\n onClose={() => setPreview(null)}\n src={preview?.src ?? ''}\n alt={preview?.alt}\n />\n </Suspense>\n </div>\n );\n}\n\nexport function ProductGallery(props: ProductGalleryProps) {\n const Component = useMemo(() => {\n const resolved = registry.resolve<ProductGalleryProps>(PRODUCT_GALLERY_KEY);\n // A theme that seeds the key with this component (register + override) would\n // otherwise recurse into itself when it has not actually overridden anything.\n return resolved === ProductGallery ? null : resolved;\n }, []);\n\n if (Component) {\n return <Component {...props} />;\n }\n\n return <ProductGalleryContent {...props} />;\n}\n\nfunction ImageSlide({\n image,\n product,\n index,\n objectFit,\n onPreview,\n onNativeOpen,\n}: {\n image: ProductImage;\n product: Product;\n index: number;\n objectFit: 'cover' | 'contain';\n onPreview: (preview: ImagePreview) => void;\n onNativeOpen: (image: ProductImage) => boolean;\n}) {\n const [loaded, setLoaded] = useState(false);\n const isVideo = Boolean(image.video_url);\n\n if (image.three_d_image_url) {\n return (\n // biome-ignore lint/a11y/noStaticElementInteractions: model-viewer is an interactive web component.\n <model-viewer\n style={{ minHeight: '500px' }}\n className=\"swiper-slide model-entry w-full h-full\"\n loading=\"lazy\"\n camera-controls\n touch-action=\"pan-y\"\n auto-rotate\n poster={image.url || undefined}\n src={image.three_d_image_url}\n shadow-intensity=\"1\"\n alt={image.alt}\n onClick={() => onNativeOpen(image)}\n ></model-viewer>\n );\n }\n\n return (\n <a\n data-fslightbox={`product_${product.id}`}\n data-img-id={image.id}\n data-slid-index={index}\n {...(image.video_url ? { 'data-video-src': image.video_url } : {})}\n data-caption={image.alt}\n data-infinite=\"false\"\n data-type={image.video_url ? 'youtube' : 'image'}\n href={image.video_url || image.url}\n // FsLightbox isn't loaded in this React theme, so the bare href would leave the SPA.\n // Open images in an in-app lightbox; let videos open in a new tab.\n {...(isVideo ? { target: '_blank', rel: 'noopener noreferrer' } : {})}\n onClick={(event) => {\n if (onNativeOpen(image)) {\n event.preventDefault();\n return;\n }\n if (isVideo || !image.url) return;\n event.preventDefault();\n onPreview({ src: image.url, alt: image.alt || product.name });\n }}\n aria-label={product.name}\n className={`swiper-slide magnify-wrapper homeslider__slide ${image.video_url ? 'video-entry' : ''}`}\n >\n <div className={`w-full ${loaded ? '' : 'aspect-square bg-gray-100 animate-pulse'}`}>\n <Image\n id={String(image.id)}\n src={image.url}\n alt={image.alt || product.name}\n className={`h-full w-full object-${objectFit}`}\n aspectRatio=\"1/1\"\n priority={index === 0}\n noWrapper\n onLoad={() => setLoaded(true)}\n />\n </div>\n </a>\n );\n}\n\nfunction ThumbSlide({ image, index }: { image: ProductImage; index: number }) {\n return (\n <div\n className={`slide--one-fourth ${image.video_url ? 'video-entry' : ''} ${image.three_d_image_url ? 'model-entry' : ''}`}\n data-caption={image.alt}\n >\n <Image\n src={image.url}\n alt={image.alt || ''}\n className=\"object-cover w-full h-full bg-gray-100 rounded-md overflow-hidden\"\n title={image.alt}\n priority={index < 5}\n noWrapper\n />\n </div>\n );\n}\n"]}
|